/* [claude code] 2026-10-18 v0.1 萌將千秋主題(從 game_template 複製)
   [claude code] 2026-10-19 v0.2 換成三國之塔的亮色系:奶油紙底 · 玉綠主操作 · 暖金獎勵;陣營 / 增減色也在這裡
   [claude code] 2026-10-19 v0.4 加戰鬥用色(血條 / 傷害數字 / 光圈 / 目標)
   [claude code] 2026-10-19 v0.6 加英靈收集用色(稀有度框 / 召喚光柱 / 演出底色 / 卡背)
   顏色只在 :root 定義(其他地方一律用變數),字級 11 / 13 / 15 / 20 / 28,圓角 8 / 14 / 999。 */
:root {
  --bg: #f5ecd9;
  --surface: #fff9ec;
  --surface-2: #f7efdd;
  --border: #e5dac4;
  --text: #203c45;
  --mute: #65746c;
  --accent: #14685e;
  --accent-deep: #0e4b44;
  --ink: #ffffff;
  --gold: #e9b94e;
  --gold-ink: #7a5510;
  --danger: #ad3f39;
  --up: #c8392f;   /* 台灣慣例:紅 ▲ 增加 */
  --down: #2f7f55; /* 綠 ▼ 減少 */
  --scrim: rgba(32, 60, 69, .45);
  --shadow: 0 2px 8px rgba(32, 60, 69, .12);
  --fac-qinglong: #3ca078;
  --fac-baihu: #8c96a8;
  --fac-zhuque: #e4573e;
  --fac-xuanwu: #3c6ec8;
  --fac-xian: #d9a520;
  --fac-mo: #8f52c9;
  --look-0: #f2b5a0;
  --look-1: #a8d5ba;
  --look-2: #a9c4e8;
  --look-3: #e8d38a;
  /* 戰鬥:血條 / 數字 / 光圈(傷害 / 暴擊 / 治療 / 護盾 用形狀 + 字一起分,不只靠顏色) */
  --hp-ally: #3ca078;
  --hp-enemy: #d4573e;
  --hp-back: rgba(32, 60, 69, .35);
  --shield-c: #9fd4ff;
  --hurt: #ffffff;
  --hurt-edge: #8a1f14;
  --crit: #ffd34d;
  --heal-c: #7ce08f;
  --ring: rgba(233, 185, 78, .85);
  --target: rgba(124, 196, 240, .95);
  --field-shade: rgba(255, 249, 236, .35);
  --proj: #fff3b0;
  /* 地圖上的 HUD(疊在斜格地圖上,要壓得住各種地面顏色) */
  --hud-bg: rgba(32, 60, 69, .72);
  --hud-text: #fff9ec;
  --hud-line: rgba(255, 249, 236, .45);
  --hud-soft: rgba(255, 249, 236, .18);
  --flash: #ffffff;
  /* 英靈收集:稀有度框(★3 藍 / ★4 紫 / ★5 金)· 召喚光柱 · 演出底色 · 卡背 */
  --rar-3: #5a9bd8;
  --rar-4: #9b6bd6;
  --rar-5: #e9b94e;
  --beam-3: rgba(124, 196, 240, .85);
  --beam-4: rgba(178, 132, 232, .9);
  --beam-5: rgba(255, 214, 102, .95);
  --reveal-bg: #14202a;
  --card-back: #2c4a55;
  --phone-width: min(100vw, 480px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif; }
body { overflow: hidden; overscroll-behavior: none; }
h1, h2, 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-deep); color: var(--ink); font-size: 15px; box-shadow: 0 2px 0 var(--accent-deep); }
button.flat { background: transparent; }
button:focus-visible, [role="button"]:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }

/* 登入 / 建角 / 被踢 */
.screen { display: flex; flex-direction: column; justify-content: center; gap: 12px; height: 100dvh; padding: 24px 16px; overflow-y: auto; }
.screen[hidden] { display: none; }
.screen h1 { font-size: 28px; color: var(--accent-deep); }
.screen p { font-size: 13px; color: var(--mute); }

/* 遊戲畫面:一個直版框(桌機也是) */
#game { position: relative; display: flex; flex-direction: column; width: var(--phone-width); max-width: 480px; height: 100dvh; margin: 0 auto; background: var(--bg); }
#game[hidden] { display: none; }
#dock { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }

/* 面板 */
#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); box-shadow: var(--shadow); }
.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; }
.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); }

#battle { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
#battle[hidden] { display: none; }

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