/* ===== LionHeart 网页试玩版 —— 暗色奇幻酒馆风 ===== */
:root {
  --bg-deep: #17100b;
  --bg-panel: #241811;
  --bg-panel-2: #2e2015;
  --wood: #452c16;
  --wood-dark: #2b1a0c;
  --gold: #e8b84b;
  --gold-soft: #f4d488;
  --text: #e9dcc4;
  --text-dim: #a89478;
  --r-blue: #5b8def;
  --sr-purple: #a35bed;
  --ssr-gold: #ffce4f;
  --danger: #c0563e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }

/* ===== 顶栏 ===== */
#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(#3a2513, #2b1a0c);
  border-bottom: 2px solid #5a3c1e;
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 800; color: var(--gold); letter-spacing: 1px; }
.demo-tag { font-size: 12px; color: var(--text-dim); font-weight: 400; margin-left: 6px; }
#main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#main-nav button {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  padding: 6px 14px; border-radius: 8px; font-size: 15px;
}
#main-nav button:hover { color: var(--text); }
#main-nav button.active {
  color: var(--gold-soft); border-color: #6b4a24;
  background: rgba(232, 184, 75, 0.12);
}
.top-right { display: flex; align-items: center; gap: 10px; }
.wallet { font-size: 14px; color: var(--text-dim); white-space: nowrap; }
.wallet b { color: var(--gold-soft); font-weight: 700; }
#lang-select {
  background: var(--bg-panel); color: var(--text);
  border: 1px solid #5a3c1e; border-radius: 6px; padding: 4px 6px;
}
.end-btn {
  background: var(--danger); color: #fff; border: none;
  padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.end-btn:hover { filter: brightness(1.15); }

main#view { flex: 1; padding: 24px 18px 48px; max-width: 1100px; width: 100%; margin: 0 auto; }

h2.view-title { color: var(--gold); font-size: 22px; margin-bottom: 6px; }
p.view-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }

/* ===== 主页 ===== */
.home-hero {
  text-align: center; padding: 60px 20px;
  background: var(--bg-panel) url("../assets/bg_ui.png") center/cover;
  border: 1px solid #5a3c1e; border-radius: 16px;
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(15, 9, 5, 0.72);
}
.home-hero > * { position: relative; }
.home-hero h1 { font-size: 52px; color: var(--gold); letter-spacing: 4px; text-shadow: 0 3px 14px #000; }
.home-hero .subtitle { color: var(--text-dim); margin: 12px 0 30px; font-size: 16px; }
.big-btn {
  background: linear-gradient(#f0c766, #c99632); color: #3a2408;
  border: none; border-radius: 12px; font-size: 20px; font-weight: 800;
  padding: 14px 46px; box-shadow: 0 4px 16px rgba(232, 184, 75, 0.35);
}
.big-btn:hover { filter: brightness(1.08); }
.home-note { margin-top: 18px; font-size: 13px; color: var(--text-dim); }

/* ===== 酒馆 ===== */
.pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.pool-card {
  background: var(--bg-panel) linear-gradient(160deg, rgba(232,184,75,.06), transparent 40%);
  border: 1px solid #5a3c1e; border-radius: 14px; padding: 20px;
}
.pool-card h3 { color: var(--gold-soft); font-size: 18px; margin-bottom: 6px; }
.pool-card .rates { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 12px; }
.pool-card .pity-line { font-size: 13px; color: var(--ssr-gold); margin-bottom: 12px; }
.pull-row { display: flex; gap: 10px; }
.pull-btn {
  flex: 1; background: linear-gradient(#6b4a24, #4a3016); color: var(--gold-soft);
  border: 1px solid #8a6130; border-radius: 10px; padding: 10px; font-size: 15px; font-weight: 700;
}
.pull-btn:hover:not(:disabled) { filter: brightness(1.2); }
.pull-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.welfare-note {
  margin-bottom: 18px; padding: 10px 14px; font-size: 13px;
  background: rgba(232, 184, 75, 0.1); border: 1px dashed #8a6130; border-radius: 10px;
  color: var(--gold-soft);
}

/* ===== 倒酒动画层 ===== */
#pour-layer {
  position: fixed; inset: 0; z-index: 100;
  background: #0d0805 url("../assets/tavern_bar.png") center/cover no-repeat;
  display: flex; flex-direction: column; overflow: hidden;
}
.pour-cups { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 1.4vmin, 16px); padding: 0 4vw 15vh; }
.cup-cell { position: relative; display: flex; flex-direction: column; align-items: center; }
.stream {
  width: clamp(3px, 0.7vmin, 6px); height: clamp(44px, 9vmin, 110px); border-radius: 2px;
  background: linear-gradient(rgba(216, 141, 38, 0), rgba(250, 179, 71, 0.95));
  opacity: 0; transition: opacity 0.1s;
}
.stream.on { opacity: 1; }
.mug { position: relative; isolation: isolate; }
.mug.single { width: clamp(120px, 24vmin, 230px); aspect-ratio: 110 / 137; }
.mug.ten { width: clamp(56px, 9.5vmin, 116px); aspect-ratio: 4 / 5; }
.mug img { position: absolute; inset: 0; width: 100%; height: 100%; }
.mug .liquid-mask {
  position: absolute; inset: 0;
  clip-path: inset(100% 0 0 0); transition: clip-path 0.45s ease-in-out;
}
.mug .liquid-mask.filled { clip-path: inset(0 0 0 0); }
/* 液体图为完整杯高画布，与杯体同框铺满；mask 的 clip-path 从底部上抬即液面上升 */
.mug .liquid-mask img {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.mug .tint {
  position: absolute; inset: 0; mix-blend-mode: multiply;
  background: rgb(250, 174, 56); transition: background-color 0.3s;
  /* 只染酒液：用液体图 alpha 做蒙版，否则透明杯壁会被 multiply 成色块 */
  -webkit-mask-image: url("../assets/mug_liquid.png"); mask-image: url("../assets/mug_liquid.png");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.mug.tint-r .tint { background: rgb(115, 166, 255); }
.mug.tint-sr .tint { background: rgb(184, 115, 242); }
.mug.tint-ssr .tint { background: rgb(255, 217, 71); }
.mug .foam { opacity: 0; transition: opacity 0.25s; }
.mug.foamed .foam { opacity: 1; }
.mug .glow-halo {
  position: absolute; left: 50%; top: 50%; width: 160%; height: 160%;
  transform: translate(-50%, -50%); border-radius: 50%;
  z-index: -1; opacity: 0; transition: opacity 0.35s;
}
.cup-cell.reveal-r .glow-halo {
  opacity: 1; background: radial-gradient(circle, rgba(91, 141, 239, 0.35), transparent 60%);
}
.cup-cell.reveal-sr .glow-halo {
  opacity: 1; background: radial-gradient(circle, rgba(163, 91, 237, 0.55), transparent 60%);
  animation: pulse 0.8s ease-in-out infinite alternate;
}
.cup-cell.reveal-ssr .glow-halo {
  opacity: 1; background: radial-gradient(circle, rgba(255, 206, 79, 0.7), rgba(255, 160, 40, 0.2) 55%, transparent 70%);
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: translate(-50%, -50%) scale(0.92); } to { transform: translate(-50%, -50%) scale(1.12); } }
.pour-dim {
  position: absolute; inset: 0; background: #000; opacity: 0;
  transition: opacity 0.6s; pointer-events: none;
}
.pour-dim.on { opacity: 0.55; }
.burst-img { position: absolute; pointer-events: none; z-index: 5; }
.pour-flash {
  position: absolute; inset: 0; background: rgb(255, 235, 166); opacity: 0;
  transition: opacity 0.12s; pointer-events: none; z-index: 6;
}
.pour-flash.on { opacity: 0.14; }
.pour-skip {
  position: absolute; top: 14px; right: 14px; z-index: 8;
  background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.85);
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 700;
}
.pour-done {
  position: absolute; left: 0; right: 0; bottom: 5vh; text-align: center; z-index: 8;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.pour-done.show { opacity: 1; pointer-events: auto; }

/* ===== 抽卡结果 ===== */
.result-single { max-width: 340px; margin: 20px auto; }
.result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 20px 0; }
.char-card {
  background: var(--bg-panel-2); border: 2px solid #5a3c1e; border-radius: 12px;
  overflow: hidden; text-align: center; cursor: pointer; position: relative;
  transition: transform 0.15s;
}
.char-card:hover { transform: translateY(-3px); }
.char-card img.card-img { width: 100%; display: block; aspect-ratio: 1/2; object-fit: cover; }
.result-single .char-card img.card-img { aspect-ratio: auto; }
.char-card .cname { padding: 8px 4px 10px; font-size: 14px; font-weight: 700; }
.char-card .cmeta { font-size: 12px; color: var(--text-dim); padding-bottom: 10px; }
.badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.char-card .badge { position: absolute; top: 6px; left: 6px; color: #1a1008; }
.char-card .tag-new {
  position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: 6px; background: var(--danger); color: #fff;
}
.char-card .tag-dup {
  position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.6); color: var(--gold-soft);
}
.badge.rarity-N { background: #9aa1a9; color: #1a1008; }
.badge.rarity-R { background: var(--r-blue); color: #fff; }
.badge.rarity-SR { background: var(--sr-purple); color: #fff; }
.badge.rarity-SSR { background: var(--ssr-gold); color: #1a1008; }
.char-card.rarity-N { border-color: #6e6250; }
.char-card.rarity-R { border-color: var(--r-blue); box-shadow: 0 0 12px rgba(91,141,239,.25); }
.char-card.rarity-SR { border-color: var(--sr-purple); box-shadow: 0 0 14px rgba(163,91,237,.35); }
.char-card.rarity-SSR { border-color: var(--ssr-gold); box-shadow: 0 0 18px rgba(255,206,79,.45); }
.result-actions { text-align: center; margin-top: 10px; }
.ghost-btn {
  background: transparent; color: var(--gold-soft); border: 1px solid #8a6130;
  border-radius: 10px; padding: 10px 26px; font-size: 15px; font-weight: 700;
}
.ghost-btn:hover { background: rgba(232, 184, 75, 0.1); }

/* ===== 编队 ===== */
.team-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.team-slot {
  min-height: 150px; border: 2px dashed #5a3c1e; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 14px; background: var(--bg-panel);
  cursor: pointer; overflow: hidden; position: relative;
}
.team-slot.filled { border-style: solid; }
.team-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 15%; }
.team-slot .slot-name {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 4px;
  background: rgba(0, 0, 0, 0.65); font-size: 13px; text-align: center; color: var(--text);
}
.hero-row { position: relative; max-width: 220px; margin-bottom: 22px; }
.team-slot.hero-slot { cursor: pointer; border-color: var(--gold); min-height: 260px; }
.badge-hero { position: absolute; top: 6px; left: 6px; z-index: 1; background: #3d3d46; color: #e8e8ec; }
/* 悬停提示是 .hero-row 的兄弟节点：.team-slot 有 overflow:hidden，放内部会被裁掉 */
.hero-tip {
  display: none; position: absolute; left: calc(100% + 10px); top: 0; z-index: 5;
  width: min(280px, 62vw); padding: 12px 14px; text-align: left;
  background: var(--bg-panel-2); border: 1px solid var(--gold); border-radius: 10px;
  font-size: 12px; line-height: 1.8; color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.hero-row:hover .hero-tip { display: block; }
.owned-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.owned-card {
  background: var(--bg-panel-2); border: 2px solid #5a3c1e; border-radius: 10px;
  overflow: hidden; cursor: pointer; text-align: center; position: relative;
}
.owned-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.owned-card .cname { font-size: 13px; font-weight: 700; padding: 6px 2px 2px; }
.owned-card .cstats { font-size: 11px; color: var(--text-dim); padding-bottom: 8px; }
.owned-card.in-team { border-color: var(--gold); }
.owned-card .elem-ico { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; }
.potential-tag { font-size: 11px; color: var(--gold-soft); }

/* ===== 编队筛选条 ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.filter-chip {
  background: var(--bg-panel); color: var(--text-dim); border: 1px solid #5a3c1e;
  border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 700;
}
.filter-chip:hover { filter: brightness(1.2); }
.filter-chip.active { background: var(--gold); color: #3a2408; border-color: var(--gold); }
.filter-sep { width: 1px; height: 18px; background: #5a3c1e; margin: 0 6px; }

/* ===== 图鉴 ===== */
.dex-card { cursor: default; }
.dex-card.locked { border-color: #3a2c18; }
.dex-card.locked img:not(.elem-ico) { filter: grayscale(1) brightness(0.35); }
.dex-card.locked .cname, .dex-card.locked .cstats { color: var(--text-dim); }
.lock-tag {
  position: absolute; top: 36%; left: 0; right: 0; text-align: center;
  font-size: 13px; font-weight: 800; color: #d8d8d8; letter-spacing: 3px;
  text-shadow: 0 1px 8px #000;
}
.badge-hero-inline { background: #3d3d46; color: #e8e8ec; }

/* ===== 关卡 ===== */
.level-list { display: flex; flex-direction: column; gap: 12px; }
.level-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-panel); border: 1px solid #5a3c1e; border-radius: 12px;
  padding: 14px 18px; cursor: pointer; transition: border-color 0.15s;
}
.level-card:hover { border-color: var(--gold); }
.level-card .lv-name { font-size: 17px; font-weight: 800; color: var(--gold-soft); width: 52px; }
.level-card .lv-enemies { display: flex; gap: 6px; flex: 1; }
.level-card .lv-enemies img {
  width: 44px; height: 44px; border-radius: 8px; border: 1px solid #5a3c1e; object-fit: cover;
}
.level-card .lv-meta { font-size: 13px; color: var(--text-dim); text-align: right; line-height: 1.7; }
.level-card .lv-cleared { color: #7fc76a; font-weight: 700; font-size: 13px; }
.level-card .lv-enemy { text-align: center; }
.level-card .lv-enemy-sub {
  display: block; font-size: 10px; color: var(--text-dim);
  line-height: 1.5; margin-top: 2px; white-space: nowrap;
}
.pw-ok { color: #7fc76a; font-weight: 700; }
.pw-low { color: var(--danger); font-weight: 700; }

/* ===== 主角自定义（建号捏人） ===== */
.creation-layer {
  position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, 0.82);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.creation-box {
  background: var(--bg-panel-2); border: 2px solid var(--gold); border-radius: 16px;
  padding: 24px 26px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.creation-box h2 { color: var(--gold); font-size: 22px; margin-bottom: 14px; }
.creation-sec { margin-bottom: 14px; }
.creation-sec h4 { color: var(--gold-soft); font-size: 14px; margin-bottom: 8px; }
.sec-bonus { color: #d8912b; font-size: 12px; }
.creation-sec input {
  width: 100%; background: var(--bg-deep); border: 1px solid #5a3c1e; border-radius: 8px;
  padding: 10px; color: var(--text); font-size: 15px; font-family: inherit;
}
.creation-hint { font-size: 12px; color: #d8912b; margin-top: 6px; }
.pick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.class-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick-card {
  background: var(--bg-panel); border: 1.5px solid #5a3c1e; border-radius: 10px;
  padding: 10px 4px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text);
}
.pick-card img { width: 24px; height: 24px; display: block; margin: 0 auto 4px; }
.pick-card:hover { filter: brightness(1.25); }
.pick-card.sel { border-color: var(--gold); background: rgba(232, 184, 75, 0.14); color: var(--gold-soft); }
.cc-bonus { font-size: 10px; font-weight: 400; color: var(--text-dim); margin-top: 3px; }
.creation-preview {
  font-size: 13px; color: var(--gold-soft); background: rgba(232, 184, 75, 0.08);
  border: 1px dashed #8a6130; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px;
}
.creation-btns { display: flex; gap: 12px; }
.creation-btns .btn-confirm { flex: 1; padding: 10px; border: none; border-radius: 9px; font-size: 15px; font-weight: 700; }
.creation-btns .btn-cancel { padding: 10px 22px; border: none; border-radius: 9px; font-weight: 700; }

/* ===== 说明页 ===== */
.help-body { line-height: 2; font-size: 15px; }
.help-body a { color: var(--gold-soft); }
.help-body h3 { color: var(--gold-soft); margin: 18px 0 4px; }
.help-body ul { padding-left: 22px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--bg-panel-2); border: 1px solid #6b4a24; border-radius: 14px;
  padding: 26px; max-width: 460px; width: 100%; text-align: center;
  max-height: 88vh; overflow-y: auto;
}
.modal-box h3 { color: var(--gold); margin-bottom: 12px; }
.modal-box p { color: var(--text-dim); font-size: 14px; line-height: 1.8; margin-bottom: 16px; }
.modal-btns { display: flex; gap: 12px; justify-content: center; }
.modal-btns button { padding: 9px 26px; border-radius: 9px; font-size: 15px; font-weight: 700; border: none; }
.btn-confirm { background: var(--gold); color: #3a2408; }
.btn-cancel { background: #4a3a28; color: var(--text); }

/* ===== 结束试玩 / 反馈 ===== */
.end-hero { text-align: center; padding: 40px 16px; }
.end-hero h2 { color: var(--gold); font-size: 30px; margin-bottom: 10px; }
.feedback-form { max-width: 480px; margin: 26px auto 0; text-align: left; }
.feedback-form label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 4px; }
.feedback-form input, .feedback-form textarea {
  width: 100%; background: var(--bg-deep); color: var(--text);
  border: 1px solid #5a3c1e; border-radius: 8px; padding: 10px; font-size: 14px; font-family: inherit;
}
.feedback-form textarea { min-height: 120px; resize: vertical; }
.feedback-form .submit-btn {
  margin-top: 16px; width: 100%; background: linear-gradient(#f0c766, #c99632);
  color: #3a2408; border: none; border-radius: 10px; padding: 12px;
  font-size: 16px; font-weight: 800;
}
.form-status { margin-top: 12px; font-size: 14px; text-align: center; min-height: 20px; }
.form-status.ok { color: #7fc76a; }
.form-status.err { color: var(--danger); }

/* 占位页（第二期战斗） */
.placeholder-box {
  text-align: center; padding: 70px 20px; border: 1px dashed #8a6130;
  border-radius: 14px; color: var(--text-dim); font-size: 16px; line-height: 2;
}

@media (max-width: 720px) {
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .team-slots { grid-template-columns: repeat(2, 1fr); }
  .mug.ten { width: 40px; height: 50px; }
}

/* ===== 战斗 ===== */
.battle-root {
  background: var(--bg-deep) url("../assets/bg_battle.png") center/cover;
  border: 1px solid #5a3c1e; border-radius: 14px;
  padding: 14px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  min-height: 640px;
}
.battle-root::before {
  content: ""; position: absolute; inset: 0; border-radius: 14px;
  background: rgba(12, 7, 4, 0.55); pointer-events: none;
}
.battle-root > * { position: relative; }
.battle-topline {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
}
.battle-level-name { font-size: 18px; font-weight: 800; color: var(--gold); }
.steps-display {
  font-size: 16px; font-weight: 700; color: var(--text);
  background: rgba(0, 0, 0, 0.5); padding: 6px 14px; border-radius: 8px;
  border: 1px solid #5a3c1e;
}
.steps-display.low { color: #ff8a6a; border-color: var(--danger); }

.enemy-area, .ally-area {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; width: 100%;
}
.unit-card {
  width: 108px; background: rgba(30, 19, 11, 0.88); border: 2px solid #5a3c1e;
  border-radius: 10px; padding: 6px; text-align: center; position: relative;
  transition: box-shadow 0.2s, transform 0.15s;
}
.unit-card .unit-sprite { width: 72px; height: 72px; object-fit: contain; }
.unit-card .unit-name { font-size: 12px; font-weight: 700; margin: 2px 0 4px; }
.unit-card.dead { opacity: 0.35; filter: grayscale(0.9); }
.unit-card.acting { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(232, 184, 75, 0.6); }
.unit-card.targetable {
  cursor: pointer; border-color: var(--danger);
  box-shadow: 0 0 14px rgba(192, 86, 62, 0.8); animation: pulse-border 0.8s infinite alternate;
}
@keyframes pulse-border { from { transform: scale(1); } to { transform: scale(1.04); } }
.unit-card.shake { animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); } 50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}
.bar {
  height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.55);
  overflow: hidden; margin: 3px 0;
}
.bar .bar-fill { height: 100%; width: 100%; transition: width 0.25s; }
.hp-bar .bar-fill { background: linear-gradient(90deg, #6fbf5a, #9ae06a); }
.energy-bar .bar-fill { background: linear-gradient(90deg, #4f8fd8, #7ab8f0); }
.atb-bar { height: 3px; }
.atb-bar .bar-fill { background: #b09a72; }
.status-row { min-height: 18px; font-size: 11px; line-height: 1.2; }
.status-badge { margin: 0 1px; }
.ult-btn {
  margin-top: 4px; width: 100%; border: 1px solid #6b4a24; border-radius: 7px;
  background: #3a2a18; color: var(--text-dim); font-size: 12px; font-weight: 800;
  padding: 4px 0;
}
.ult-btn.ready {
  background: linear-gradient(#f0c766, #c99632); color: #3a2408;
  animation: ult-glow 0.9s infinite alternate;
}
@keyframes ult-glow {
  from { box-shadow: 0 0 4px rgba(240, 199, 102, 0.5); }
  to { box-shadow: 0 0 16px rgba(240, 199, 102, 0.95); }
}
.ult-hint {
  display: flex; gap: 12px; align-items: center;
  background: rgba(0, 0, 0, 0.75); border: 1px solid var(--danger);
  padding: 8px 16px; border-radius: 10px; color: #ffb9a8; font-size: 14px;
}

/* 棋盘 */
.board-wrap { display: flex; justify-content: center; }
.board {
  position: relative; width: 368px; height: 368px;
  background: rgba(0, 0, 0, 0.45); border: 2px solid #5a3c1e; border-radius: 10px;
}
.board.flash { animation: board-flash 0.4s; }
@keyframes board-flash {
  0% { box-shadow: 0 0 0 rgba(255, 220, 130, 0); }
  40% { box-shadow: 0 0 34px rgba(255, 220, 130, 0.9); }
  100% { box-shadow: 0 0 0 rgba(255, 220, 130, 0); }
}
.gem-piece {
  position: absolute; width: 46px; height: 46px; padding: 3px;
  transition: left 0.18s ease, top 0.25s ease-in, opacity 0.2s, transform 0.2s;
  cursor: pointer;
}
.gem-piece img { width: 100%; height: 100%; display: block; }
.gem-piece.selected { transform: scale(1.12); filter: brightness(1.35) drop-shadow(0 0 6px #fff); z-index: 3; }
.gem-piece.clearing {
  transform: scale(1.18); filter: brightness(1.8) drop-shadow(0 0 8px #ffe9a8); z-index: 2;
}
.gem-piece.cleared { opacity: 0; transform: scale(0.4); }
.gem-piece.shake { animation: shake 0.35s; }
/* 闪电待机呼吸 + 偶发电弧感；炸弹轻微晃动 */
.gem-piece.kind-lightning img { animation: lightning-breathe 1.6s ease-in-out infinite; }
@keyframes lightning-breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35) drop-shadow(0 0 5px #cfe8ff); }
}
.gem-piece.kind-bomb img { animation: bomb-wobble 2.2s ease-in-out infinite; }
@keyframes bomb-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}
.gem-piece.kind-diamond img { animation: diamond-shine 1.8s ease-in-out infinite; }
@keyframes diamond-shine {
  0%, 100% { filter: brightness(1.05); }
  50% { filter: brightness(1.5) drop-shadow(0 0 8px #fff); }
}

/* 飘字 */
.float-layer { position: absolute; inset: 0; pointer-events: none; z-index: 120; }
.float-text {
  position: absolute; font-size: 18px; font-weight: 800;
  text-shadow: 0 2px 4px #000; animation: float-up 1.1s ease-out forwards;
}
.float-text.dmg { color: #ff9d7a; }
.float-text.crit { color: #ffd24f; font-size: 22px; }
.float-text.crit-tag { color: #ffd24f; font-size: 13px; margin-top: 18px; }
.float-text.heal { color: #8ae08a; }
.float-text.dot { color: #c98ae0; font-size: 15px; }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(6px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-42px); }
}
.battle-toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85); color: var(--gold-soft);
  border: 1px solid #8a6130; border-radius: 10px;
  padding: 8px 20px; font-size: 15px; font-weight: 700; z-index: 130;
}

/* 结算 */
.settle-overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.78);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.settlement {
  background: var(--bg-panel-2); border: 2px solid #6b4a24; border-radius: 16px;
  padding: 28px; max-width: 440px; width: 100%; max-height: 86vh; overflow-y: auto;
  text-align: center;
}
.settlement h2 { font-size: 30px; margin-bottom: 14px; }
.settlement.win h2 { color: var(--ssr-gold); text-shadow: 0 0 18px rgba(255, 206, 79, 0.5); }
.settlement.lose h2 { color: var(--text-dim); }
.settle-section { text-align: left; margin: 12px 0; }
.settle-section h3 { color: var(--gold-soft); font-size: 15px; margin-bottom: 6px; }
.loot-line { font-size: 14px; color: var(--text); line-height: 1.9; }
.loot-line.chest { padding-left: 12px; color: var(--gold-soft); }
.loot-line.levelup { color: #ffd24f; font-weight: 700; }
.settle-note { font-size: 12px; color: var(--text-dim); margin: 14px 0 18px; }

/* 新手引导 */
.guide-overlay { position: fixed; inset: 0; z-index: 180; }
.guide-focus {
  position: relative; z-index: 181 !important;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 22px rgba(255, 220, 130, 0.9) !important;
  border-radius: 8px;
}
.guide-bubble {
  position: absolute; width: 320px; background: var(--bg-panel-2);
  border: 2px solid var(--gold); border-radius: 12px; padding: 16px; z-index: 182;
}
.guide-bubble p { font-size: 14px; line-height: 1.8; color: var(--text); margin-bottom: 12px; }
.guide-bubble .guide-next { padding: 8px 22px; border: none; border-radius: 8px; font-weight: 700; }
.guide-skip {
  position: fixed; right: 18px; bottom: 18px; z-index: 182;
  background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.85);
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 13px;
}

@media (max-width: 560px) {
  .board { width: 322px; height: 322px; }
  .gem-piece { width: 40px; height: 40px; }
  .unit-card { width: 88px; }
  .unit-card .unit-sprite { width: 56px; height: 56px; }
}
