/* [claude code] 2026-10-29 v0.4 設定頁音量列
   [claude code] 2026-10-29 v0.3 局內階數光圈顏色 --tier-1~5、英雄卡頭像 / 資源圖示用圖
   [claude code] 2026-10-29 v0.2 城牆守衛隊主題:Q 版奇幻王國(暖色城牆 + 草地戰場);顏色只在 :root,字級 11 / 13 / 15 / 20 / 28,圓角 8 / 14 / 999。
   [claude code] 2026-10-18 v0.1 從 game_template 複製 */
:root {
  --bg: #1a1d2b;
  --surface: #23283a;
  --surface-2: #2e3550;
  --border: #45507a;
  --text: #f3efe3;
  --mute: #a9b0c8;
  --accent: #f2b544;
  --ink: #2a1b05;
  --gold: #ffd76a;
  --danger: #ef6b5b;
  --ok: #7fd28a;
  --scrim: rgba(10, 12, 20, .7);
  --phone-width: min(100vw, 480px);

  --field: #39573b;
  --lane: rgba(255, 255, 255, .08);
  --wall: #8a6a4a;
  --wall-top: #b48d63;
  --cell: rgba(20, 24, 36, .55);
  --cell-hi: rgba(255, 215, 106, .45);
  --hp: #ef6b5b;
  --hp-back: rgba(0, 0, 0, .45);
  --enemy: #6c4f8f;
  --boss: #9b2f3c;
  --frozen: #9fd8ff;
  --poison: #8fe36a;
  --cls-warrior: #e0a35a;
  --cls-archer: #8fd16a;
  --cls-mage: #f07a4a;
  --cls-frost: #7ec8f2;
  --cls-venom: #a7d64a;
  --cls-priest: #f4e08a;
  --rar-c: #b7bccb;
  --rar-u: #7fd28a;
  --rar-r: #6fb6ff;
  --rar-e: #c58cff;
  --rar-l: #ffb347;
  --tier-1: #9aa3b8;
  --tier-2: #7fd28a;
  --tier-3: #6fb6ff;
  --tier-4: #c58cff;
  --tier-5: #ffd76a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif; }
body { overflow: hidden; }
h1, h2, h3, p { margin: 0; }

button { font: inherit; font-size: 13px; color: var(--text); min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); font-size: 15px; font-weight: 600; }
button.flat { background: transparent; }
button.armed { border-color: var(--danger); color: var(--danger); }
button:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { font: inherit; font-size: 15px; color: var(--text); min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); width: 100%; }
label { font-size: 13px; color: var(--mute); display: flex; flex-direction: column; gap: 4px; }

/* 登入畫面 */
.screen { display: flex; flex-direction: column; justify-content: center; gap: 12px; height: 100dvh; padding: 24px 16px; max-width: 480px; margin: 0 auto; }
.screen[hidden] { display: none; }
.screen h1 { font-size: 28px; }
.screen p { font-size: 13px; color: var(--mute); }
.screen form { display: flex; flex-direction: column; gap: 8px; }
.screen form[hidden] { display: none; }

/* 遊戲畫面:一個直版框(桌機也是) */
#game { position: relative; display: flex; flex-direction: column; width: var(--phone-width); max-width: 480px; height: 100dvh; margin: 0 auto; background: var(--bg); overflow: hidden; }
#game[hidden] { display: none; }
#hud { display: flex; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid var(--border); }
.res { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); font-size: 13px; white-space: nowrap; }
.res-plus { min-height: 28px; min-width: 28px; padding: 0; border-radius: 999px; font-size: 13px; }
#hud .grow { flex: 1; }
#hud-settings { min-width: 44px; padding: 0; }
#lobby-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
#dock { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
#update-bar { position: absolute; left: 8px; right: 8px; top: 56px; z-index: 80; }
#update-bar[hidden] { display: none; }
#ad-slot[hidden] { display: none; }

.lb-art canvas { image-rendering: auto; }

/* 面板 */
#backdrop { position: absolute; inset: 0; z-index: 25; background: var(--scrim); }
#backdrop[hidden] { display: none; }
.sheet { position: absolute; inset: 8px; z-index: 30; display: flex; flex-direction: column; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.sheet[hidden] { display: none; }
.sheet > h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-bottom: 8px; font-size: 20px; }
.sheet-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.tab-body { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.row > div { flex: 1; min-width: 0; }
.row b { display: block; font-size: 15px; }
.row small, .note { font-size: 11px; color: var(--mute); }
.vol-row { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; }
.vol-row input { flex: 1; min-height: 44px; accent-color: var(--gold); }
.vol-row b { width: 32px; text-align: right; }
.row.dim { opacity: .55; }
.row.ready { border-color: var(--gold); }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.section-title { font-size: 13px; color: var(--mute); margin-top: 4px; }

.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.chip-ic { font-size: 13px; }

.info-btn { min-height: 24px; min-width: 24px; padding: 0; border-radius: 999px; font-size: 11px; color: var(--mute); }
.info-tip { position: fixed; z-index: 90; max-width: 240px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 13px; }

/* 英雄卡 */
.hero-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hero-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 104px; padding: 8px 4px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.hero-card.not-owned { opacity: .5; }
.hero-card.in-team { box-shadow: 0 0 0 2px var(--accent) inset; }
.hero-card .face { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; font-size: 20px; font-weight: 700; color: var(--ink); background-size: 175%; background-position: center 12%; }
.face.has-art { color: transparent; }
.ic { width: 16px; height: 16px; vertical-align: -3px; }
.chip .ic { width: 15px; height: 15px; }
.hero-card b { font-size: 13px; text-align: center; }
.hero-card small { font-size: 11px; color: var(--mute); }
.rar-c { border-color: var(--rar-c); } .rar-u { border-color: var(--rar-u); } .rar-r { border-color: var(--rar-r); } .rar-e { border-color: var(--rar-e); } .rar-l { border-color: var(--rar-l); }
.cls-warrior { background: var(--cls-warrior); } .cls-archer { background: var(--cls-archer); } .cls-mage { background: var(--cls-mage); }
.cls-frost { background: var(--cls-frost); } .cls-venom { background: var(--cls-venom); } .cls-priest { background: var(--cls-priest); }
.team-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.team-slots .hero-card.picking { border-color: var(--gold); }

/* 戰鬥 */
#battle { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
#battle[hidden] { display: none; }
.bt-top { display: flex; align-items: center; gap: 6px; padding: calc(4px + env(safe-area-inset-top)) 8px 4px; }
.bt-wave { font-size: 13px; white-space: nowrap; }
.bt-wallbar { position: relative; flex: 1; height: 18px; border-radius: 999px; background: var(--hp-back); overflow: hidden; }
.bt-wallbar i { position: absolute; inset: 0 auto 0 0; background: var(--wall-top); }
.bt-walltext { position: relative; display: block; text-align: center; font-size: 11px; line-height: 18px; }
.bt-small { min-width: 44px; padding: 4px 6px; }
.bt-field { position: relative; flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; touch-action: none; }
.bt-field canvas { display: block; touch-action: none; border-radius: 8px; }
.bt-tip { position: absolute; left: 16px; right: 16px; top: 45%; padding: 8px 12px; border-radius: 14px; background: var(--scrim); text-align: center; font-size: 15px; pointer-events: none; }
.bt-tip[hidden] { display: none; }
.bt-bottom { display: flex; align-items: center; gap: 8px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.bt-gold { min-width: 72px; font-size: 15px; color: var(--gold); }
.bt-summon { flex: 1; min-height: 52px; }
.bt-sell { display: grid; place-items: center; min-width: 88px; min-height: 52px; padding: 0 8px; border: 2px dashed var(--border); border-radius: 14px; font-size: 11px; color: var(--mute); text-align: center; }
.bt-sell.hot { border-color: var(--danger); color: var(--danger); }
.bt-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 24px 16px; background: var(--scrim); }
.bt-overlay[hidden] { display: none; }
.bt-overlay h2 { font-size: 20px; text-align: center; }
.bt-card { min-height: 64px; font-size: 15px; border-color: var(--gold); }

#modal { position: absolute; inset: 0; z-index: 75; display: flex; align-items: center; padding: 16px; background: var(--scrim); }
#modal[hidden] { display: none; }
#modal .box { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
#modal h2 { font-size: 20px; }

#toast { position: absolute; left: 50%; top: 64px; z-index: 95; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 14px; background: var(--surface-2); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
