/* 《香江小風波》— 垂直切片樣式（倉庫 hk-roguelite；與舊香江 Card Game demo 無關） */

:root {
  --bg-deep: #050810;
  --bg-mid: #0c1524;
  --ink: #e8f0ff;
  --ink-dim: #9aadc8;
  --neon-cyan: #3de0ff;
  --neon-magenta: #ff2d95;
  --neon-amber: #ffc14a;
  --danger: #ff5c6c;
  --ok: #5dffb0;
  --panel: rgba(8, 16, 32, 0.78);
  --line: rgba(61, 224, 255, 0.28);
  --radius: 14px;
  /* 字體：全部用系統字體（零外部請求 → 離線可開、Pages 可靠、無 FOUT）。
     優先次序按「香港／台灣玩家實際會有嘅中文字體」排：
       Mac：PingFang HK（港字形）→ 儷黑 → 蘋方
       Windows：微軟正黑體 → 思源黑體 → 新細明體
       Android：Noto Sans CJK（系統內置，唔使下載） */
  --font-display: "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC",
    "Noto Sans TC", "Heiti TC", "LiHei Pro", system-ui, sans-serif;
  --font-body: "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC",
    "Noto Sans TC", "Heiti TC", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  min-height: 100dvh;
  /* 禁絕水平捲動：任何子元素溢出都唔可以撐開頁面再推歪置中 */
  overflow-x: clip;
  /* 舊瀏覽器唔識 clip 就落返 hidden（兩者都唔會生水平捲軸） */
  overflow-x: hidden;
}

.noscript {
  padding: 2rem;
  text-align: center;
}

/* 根容器：一定要水平置中、左右對稱、唔可以被內容撐闊。
   曾經出事：grid + place-items:center 之下，如果子元素有 min-content 比容器闊
   （例如手牌橫滑容器），grid 會用「最大內容寬」撐大整行，令畫面整體偏右。
   解法：
     1. grid-template-columns: minmax(0,1fr) —— 軌道唔可以被內容撐闊
     2. justify-items: center —— 項目喺軌道內水平置中
     3. justify-content: center —— 軌道本身喺容器內置中（寬螢幕靠呢個，
        否則 min(430px,100%) 會貼左邊） */
.app {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: clamp(0.75rem, 2.5vw, 1.75rem);
  isolation: isolate;
}

.app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 55% at 15% 10%, rgba(255, 45, 149, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 88% 18%, rgba(61, 224, 255, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255, 193, 74, 0.1), transparent 55%),
    linear-gradient(165deg, #050810 0%, #0a1220 45%, #081018 100%);
}

.app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 3px
    );
  animation: scan 12s linear infinite;
}

@keyframes scan {
  from { transform: translateY(0); }
  to { transform: translateY(12px); }
}

/*
 * 直版優先：所有畫面鎖同一個最大寬度並置中。
 * 之前 .screen 440px、.screen-wide/.screen-battle 720px，
 * 寬螢幕下地圖／戰鬥會拉到 720 而內容只佔左半，右邊一大片空；
 * 而且切換畫面時寬度跳變（440 ↔ 720），觀感差。
 */
:root {
  --app-max-w: 430px;
}

.screen {
  width: min(var(--app-max-w), 100%);
  /* grid 子元素預設 min-width:auto，內容闊過容器就唔會收縮、會撐爆整行。
     一定要 min-width:0 先可以真係貼住容器寬。 */
  min-width: 0;
  max-width: 100%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 地圖／戰鬥／選牌一律同寬（唔再 720），保持直版比例 */
.screen-wide,
.screen-battle {
  width: min(var(--app-max-w), 100%);
  min-width: 0;
  max-width: 100%;
  margin-inline: auto;
}

.brand-block {
  text-align: center;
  animation: rise-in 0.7s ease-out both;
}

.brand-compact .brand {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  letter-spacing: 0.08em;
  line-height: 1.15;
  background: linear-gradient(120deg, var(--neon-cyan), #fff 45%, var(--neon-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(61, 224, 255, 0.35));
  animation: brand-pulse 4.5s ease-in-out infinite;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 5vw, 1.85rem);
  letter-spacing: 0.06em;
}

.tagline {
  margin: 0.55rem 0 0;
  color: var(--ink-dim);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--neon-amber);
  opacity: 0.95;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--neon-cyan);
  text-transform: uppercase;
}

.run-title {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

@keyframes brand-pulse {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(61, 224, 255, 0.3)); }
  50% { filter: drop-shadow(0 0 26px rgba(255, 45, 149, 0.4)); }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*
 * 進場動畫只在「真轉場」時播：
 * - 預設 screen 內所有元素（含偽元素）都唔播動畫
 * - 只有 .app.is-screen-swap 期間才播一次
 * 用 !important 蓋過各處 `animation: rise-in … both`（both 會鎖住起始 opacity 0）。
 *
 * 注意：一定要用 `*`（連子元素一齊中），唔可以逐個列 class。
 * 之前只列 .panel/.actions/.brand-block，漏咗 .boss-gate-art、.battle-banner、
 * .status、.event-art、.card-face … 結果嗰啲仍然由 opacity 0 淡入 = 閃。
 */
.screen,
.screen *,
.screen::before,
.screen::after,
.screen *::before,
.screen *::after {
  animation: none !important;
}

/*
 * 轉場動畫：只用位移，唔用 opacity。
 * 背景層本身已經冇淡入；如果前景再淡入，加起來仍然似「閃一下」。
 * 位移由 10px 開始，視覺上足夠交代「換咗畫面」，但唔會黑／白一片。
 */
@keyframes slide-in {
  from { transform: translateY(10px); }
  to { transform: translateY(0); }
}

.app.is-screen-swap .screen > * {
  animation: slide-in 0.32s ease-out both !important;
}

.app.is-screen-swap .screen .panel {
  animation: slide-in 0.32s ease-out 0.04s both !important;
}

.app.is-screen-swap .screen .actions {
  animation: slide-in 0.32s ease-out 0.08s both !important;
}

/*
 * 背景層例外：任何情況都唔可以郁 opacity。
 * 佢係 position:fixed + inset:-12px，覆蓋整個畫面，
 * 由 opacity 0 淡入 = 全屏閃白。
 */
.screen.has-act-bg::before {
  animation: none !important;
  opacity: 1 !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.05rem 1.2rem;
  backdrop-filter: blur(10px);
  animation: rise-in 0.75s ease-out 0.1s both;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.lede {
  margin: 0;
  color: var(--ink-dim);
  line-height: 1.55;
  font-size: 0.92rem;
}

.char-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.char-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.char-card:hover,
.char-card:focus-visible {
  border-color: rgba(61, 224, 255, 0.55);
  background: rgba(61, 224, 255, 0.08);
  outline: none;
}

.char-card.is-selected {
  border-color: var(--neon-magenta);
  background: rgba(255, 45, 149, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.25);
}

.char-card.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.char-card:active:not(.is-locked) {
  transform: scale(0.985);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
}

.avatar.muted {
  background: #3a4558;
  color: #c5d0e0;
}

/* —— 角色立繪（選角） —— */
.avatar-portrait {
  position: relative;
  width: 88px;
  height: 88px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
}

.avatar-portrait .char-portrait {
  width: 100%;
  height: 100%;
  /* 立繪多數係半身／胸像，對準上部避免只見到身 */
  object-fit: cover;
  object-position: center 18%;
  display: block;
  border-radius: inherit;
}

/* 有圖：藏字首；無圖／載入失敗：顯示字首漸層 */
.avatar-portrait:not(.is-fallback) .avatar-fallback {
  display: none;
}

.avatar-portrait.is-fallback .char-portrait {
  display: none;
}

.avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bg-deep);
}

/* —— Act 區背景（戰鬥／事件／選牌／休息／Boss gate） —— */
.screen.has-act-bg {
  position: relative;
  isolation: isolate;
}

/*
 * 背景層：只做氛圍，唔搶字。
 * - 暗層 45%→62%：落在總導演指定嘅 40–55% 區間（底部略深保手牌可讀）
 * - blur(2.5px) + saturate(0.72)：打散霓虹高頻細節，比純加暗更有效護字
 * - inset 負值：blur 邊緣唔會露白邊
 */
.screen.has-act-bg::before {
  content: "";
  position: fixed;
  inset: -12px;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(5, 8, 16, 0.45) 0%, rgba(5, 8, 16, 0.55) 55%, rgba(5, 8, 16, 0.62) 100%),
    var(--act-bg, none);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  filter: blur(2.5px) saturate(0.72);
  /*
   * 背景層唔可以有任何 opacity 動畫：
   * 佢係 position:fixed + inset:-12px，等於覆蓋整個畫面，
   * 由 opacity 0 淡入就係成個屏幕閃白一次。
   * （局部更新時 ::before 亦會因 .screen 重建而重新觸發）
   */
  animation: none !important;
  opacity: 1;
}

/* Boss 戰／Boss gate：再壓暗一層，壓迫感 */
.screen.screen-battle.has-act-bg::before {
  background-image:
    linear-gradient(180deg, rgba(5, 8, 16, 0.58) 0%, rgba(5, 8, 16, 0.68) 55%, rgba(5, 8, 16, 0.76) 100%),
    var(--act-bg, none);
  filter: blur(3px) saturate(0.66);
}

.screen.screen-boss-gate.has-act-bg::before {
  background-image:
    linear-gradient(180deg, rgba(5, 8, 16, 0.68) 0%, rgba(10, 4, 12, 0.76) 60%, rgba(5, 8, 16, 0.84) 100%),
    var(--act-bg, none);
  filter: blur(3.5px) saturate(0.6);
}

/* Boss gate 卡片本身已經有圖，背景只做氛圍，避免搶焦點 */
.screen.screen-boss-gate.has-act-bg > * {
  position: relative;
}

.char-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.char-name {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.char-desc {
  font-size: 0.88rem;
  color: rgba(210, 222, 240, 0.9);
}

/* HUD 被動短標：一眼見被動名同狀態（待命／就緒／用過） */
.passive-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  align-self: flex-start;
  margin: 0.1rem 0 0.15rem;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(220, 232, 248, 0.88);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.passive-chip-name {
  font-weight: 800;
  letter-spacing: 0.06em;
}

.passive-chip-state {
  font-size: 0.68rem;
  opacity: 0.9;
}

/* 就緒／觸發：亮起（快手金色、檔口綠色、招牌眼青色） */
.passive-chip.is-ready.passive-chip--kuaisou,
.passive-chip.is-used.passive-chip--kuaisou {
  border-color: rgba(255, 193, 74, 0.6);
  background: rgba(255, 193, 74, 0.16);
  color: var(--neon-amber);
}

.passive-chip.is-ready.passive-chip--dangkou,
.passive-chip.is-used.passive-chip--dangkou {
  border-color: rgba(93, 255, 176, 0.6);
  background: rgba(93, 255, 176, 0.14);
  color: var(--ok);
}

.passive-chip.is-ready.passive-chip--zhaopaiyan,
.passive-chip.is-used.passive-chip--zhaopaiyan {
  border-color: rgba(61, 224, 255, 0.6);
  background: rgba(61, 224, 255, 0.14);
  color: var(--neon-cyan);
}

/* 勝仔・跌打：回復流，用綠色（同檔口綠撞就用薄荷青綠區分） */
.passive-chip.is-ready.passive-chip--seotong,
.passive-chip.is-used.passive-chip--seotong {
  border-color: rgba(120, 255, 200, 0.6);
  background: rgba(120, 255, 200, 0.14);
  color: #78ffc8;
}

/* 待命：低調，但被動名仍然清楚 */
.passive-chip.is-idle .passive-chip-name {
  color: var(--ink);
}

/* 觸發瞬間閃一下（配合跳字） */
.passive-chip.is-flash {
  animation: passive-chip-flash 0.55s ease-out;
}

@keyframes passive-chip-flash {
  0% { transform: scale(1); }
  35% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

/* 戰鬥 HUD：當前角色主路線（一眼見到） */
.battle-route {
  display: inline-block;
  align-self: flex-start;
  margin: 0.05rem 0 0.15rem;
  padding: 0.04rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.14);
  border: 1px solid rgba(255, 193, 74, 0.38);
}

/* 角色主路線標籤：選角一眼分到三種玩法 */
.char-route {
  display: inline-block;
  align-self: flex-start;
  margin-top: 0.1rem;
  padding: 0.05rem 0.42rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.13);
  border: 1px solid rgba(255, 193, 74, 0.35);
}

/* 一句講清點玩 */
.char-playstyle {
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(220, 232, 248, 0.9);
  opacity: 0.9;
}

.char-passive-tag {
  font-size: 0.72rem;
  color: var(--neon-amber);
  letter-spacing: 0.04em;
}

.event-choice.is-disabled,
.event-choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.passive-box {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(61, 224, 255, 0.08);
  border: 1px solid rgba(61, 224, 255, 0.22);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-dim);
}

.passive-box strong {
  color: var(--neon-cyan);
}

/* 「再開一局」鉤：港味一句，唔搶被動主體 */
.rerun-hook {
  margin: 0.7rem 0 0;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--neon-magenta);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 45, 149, 0.08);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: rise-in 0.8s ease-out 0.18s both;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.15rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  color: #041018;
  background: linear-gradient(90deg, var(--neon-cyan), #7af0ff 40%, var(--neon-magenta));
  box-shadow: 0 0 24px rgba(61, 224, 255, 0.28);
}

.btn-primary:not(:disabled):hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid rgba(154, 173, 200, 0.35);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: rgba(61, 224, 255, 0.45);
}

/* 危險動作（清除進度）：用紅但唔刺眼，hover 才加深 */
.btn-danger {
  color: #ffd9d4;
  background: rgba(140, 24, 24, 0.42);
  border: 1px solid rgba(255, 107, 90, 0.55);
  font-weight: 700;
}

.btn-danger:hover {
  background: rgba(170, 28, 28, 0.58);
  border-color: rgba(255, 130, 110, 0.8);
}

.status {
  min-height: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--neon-amber);
}

.foot-note {
  text-align: center;
  font-size: 0.82rem;
  color: rgba(154, 173, 200, 0.65);
  letter-spacing: 0.02em;
}

/* —— 音效開關（標題／選角／戰鬥共用） —— */
.sfx-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  align-self: center;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 224, 255, 0.28);
  background: rgba(10, 18, 32, 0.6);
  color: rgba(198, 216, 240, 0.92);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.sfx-toggle:hover {
  border-color: rgba(61, 224, 255, 0.5);
  background: rgba(16, 28, 46, 0.75);
}

.sfx-toggle:active {
  transform: scale(0.97);
}

.sfx-toggle:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

/* 靜音：用「灰 + 斜線感」表達，唔靠顏色單一辨識（色弱都分到） */
.sfx-toggle.is-muted {
  border-color: rgba(154, 173, 200, 0.28);
  background: rgba(10, 18, 32, 0.42);
  color: rgba(154, 173, 200, 0.78);
}

.sfx-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.sfx-toggle-text {
  font-size: 0.9rem;
  white-space: nowrap;
}

/* —— 每日一局鉤 —— */
/* 標題頁狀態句：已領用灰綠、未領用琥珀（唔用紅，唔係錯誤） */
.daily-line {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.55;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  width: 100%;
}

.daily-line.is-todo {
  color: rgba(255, 205, 120, 0.96);
  background: rgba(255, 193, 74, 0.1);
  border: 1px solid rgba(255, 193, 74, 0.26);
}

.daily-line.is-claimed {
  color: rgba(160, 214, 196, 0.9);
  background: rgba(24, 60, 44, 0.34);
  border: 1px solid rgba(90, 220, 170, 0.22);
}

/* 結算頁：今日獎勵 panel */
.daily-panel {
  border-color: rgba(255, 193, 74, 0.34);
}

.daily-panel h2 {
  color: var(--neon-amber);
}

.daily-lede {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(190, 212, 236, 0.86);
}

.daily-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
}

.daily-body strong {
  color: var(--neon-amber);
}

/* —— 牌組預覽（選角 / 戰鬥共用） —— */
.deck-toggle {
  width: 100%;
  min-height: 48px;
}

/* 戰鬥中：牌組掣併入牌堆列（慳一行 48px，令手牌同結束回合上到一屏） */
.pile-deck-btn {
  border: 1px solid rgba(61, 224, 255, 0.32);
  background: rgba(10, 22, 38, 0.72);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  /* 觸控目標唔可以細過 44px */
  min-height: 44px;
  padding-inline: 0.6rem;
}

.pile-deck-btn:hover {
  border-color: rgba(61, 224, 255, 0.6);
}

.pile-deck-btn:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

.pile-deck-btn[aria-expanded="true"] {
  border-color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.12);
}

.deck-panel--battle {
  margin-top: -0.2rem;
}

.deck-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.deck-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.deck-overview {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(220, 232, 248, 0.92);
}

.deck-list-preview {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

/* 每行：費用圓章 + 名 + 類型 + ×N（390 下 grid 唔會擠爆） */
.deck-row {
  display: grid;
  grid-template-columns: 1.55rem 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 9px;
  background: rgba(6, 14, 26, 0.55);
  border: 1px solid rgba(61, 224, 255, 0.1);
}

.deck-cost {
  width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #04121c;
  background: linear-gradient(140deg, var(--neon-cyan), #8ef0ff);
}

.deck-name {
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

.deck-type {
  font-size: 0.7rem;
  color: rgba(154, 173, 200, 0.82);
  white-space: nowrap;
}

/* ×N：重複牌一眼見到（玩家最關心呢個） */
.deck-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--neon-amber);
  white-space: nowrap;
}

.deck-empty {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(154, 173, 200, 0.82);
}

/* —— 長按卡牌詳情 —— */
/* 卡面提示「可以長按」：只喺觸控裝置顯示細細一句，唔搶版面 */
.card-face::after {
  content: "撳住睇詳情";
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  font-size: 0.56rem;
  letter-spacing: 0.02em;
  color: rgba(198, 216, 240, 0.62);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* 桌面 hover 才顯示（手機長按自然會出，唔需要提示字） */
@media (hover: hover) and (pointer: fine) {
  .card-face:hover::after {
    opacity: 1;
  }
}

.card-face {
  position: relative;
}

/* 詳情彈層：蓋住全屏，中央 box */
.card-detail {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 8, 16, 0.78);
  backdrop-filter: blur(3px);
  animation: card-detail-in 0.16s ease-out both;
}

@keyframes card-detail-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.card-detail-box {
  width: min(360px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(14, 24, 40, 0.98), rgba(8, 14, 24, 0.98));
  border: 1px solid rgba(61, 224, 255, 0.28);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}

.card-detail-top {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-detail-cost {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #04121c;
  background: linear-gradient(140deg, var(--neon-cyan), #8ef0ff);
}

.card-detail-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.card-detail-meta {
  font-size: 0.72rem;
  color: rgba(154, 173, 200, 0.86);
}

.card-detail-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-detail-lines li {
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(206, 222, 240, 0.96);
  padding-left: 0.75rem;
  position: relative;
}

.card-detail-lines li::before {
  content: "・";
  position: absolute;
  left: 0;
  color: var(--neon-cyan);
}

.card-detail-when {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 205, 120, 0.95);
  background: rgba(255, 193, 74, 0.1);
  border: 1px solid rgba(255, 193, 74, 0.24);
}

.card-detail-blurb {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(154, 173, 200, 0.84);
}

.card-detail-close {
  width: 100%;
  min-height: 48px;
  margin-top: 0.15rem;
}

/* —— 設定頁：操作一句 —— */
.howto-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  list-style: disc;
}

.howto-list li {
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(200, 218, 238, 0.92);

}

.howto-list strong {
  color: var(--neon-cyan);
  font-weight: 700;
}

/* —— 設定頁 —— */
.screen-settings .panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
}

.screen-settings .panel .lede {
  margin: 0;
}

.screen-settings .sfx-toggle {
  align-self: flex-start;
}

.settings-keys {
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  list-style: none;
  border-radius: 10px;
  background: rgba(5, 12, 22, 0.55);
  border: 1px solid rgba(61, 224, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.settings-keys li {
  font-size: 0.78rem;
  color: rgba(163, 190, 220, 0.9);
  line-height: 1.35;
  word-break: break-all;
}

.settings-keys code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(120, 232, 255, 0.92);
}

.settings-empty {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(154, 173, 200, 0.82);
}

/* 清除進度：第一次撳只係問，唔會清 */
.settings-clear-btn {
  width: 100%;
  min-height: 48px;
}

.settings-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.settings-confirm {
  width: 100%;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  background: rgba(120, 20, 20, 0.3);
  border: 1px solid rgba(255, 107, 90, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: settings-warn-in 0.22s ease-out both;
}

@keyframes settings-warn-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.settings-confirm-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #ffcec7;
  line-height: 1.4;
}

.settings-confirm-body {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 226, 220, 0.94);
}

.settings-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-confirm-actions .btn {
  width: 100%;
  min-height: 48px;
}

.settings-result {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(190, 240, 220, 0.92);
  background: rgba(24, 60, 44, 0.42);
  border: 1px solid rgba(90, 220, 170, 0.32);
}

/* —— 新手教學（首局一頁） —— */
.screen-tutorial .tut-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.screen-tutorial .tut-panel .lede {
  margin: 0;
}

.tut-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tut-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  background: rgba(6, 14, 26, 0.62);
  border: 1px solid rgba(61, 224, 255, 0.16);
}

/* 序號：用圓章，一眼數得到三步 */
.tut-num {
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #04121c;
  background: linear-gradient(140deg, var(--neon-cyan), #8ef0ff);
  box-shadow: 0 0 12px rgba(61, 224, 255, 0.28);
}

.tut-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.tut-head {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tut-icon {
  font-size: 1rem;
  line-height: 1;
}

.tut-title {
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* 對應實機 UI 嘅名（出牌／擋／結束回合），令玩家落場認得返 */
.tut-key {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.14);
  border: 1px solid rgba(255, 193, 74, 0.32);
}

.tut-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(232, 240, 255, 0.9);

}

.tut-note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(200, 218, 238, 0.85);

}

/* 主掣 + 跳過：兩者都 ≥48px，細手指都撳得中 */
.screen-tutorial .actions .btn {
  min-height: 50px;
}

/* —— 暫停掣（地圖／戰鬥共用） —— */
.pause-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(154, 173, 200, 0.32);
  background: rgba(10, 18, 32, 0.62);
  color: rgba(198, 216, 240, 0.9);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.pause-btn:hover {
  border-color: rgba(61, 224, 255, 0.5);
  background: rgba(16, 28, 46, 0.8);
}

.pause-btn:active {
  transform: scale(0.96);
}

.pause-btn:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

.pause-btn-icon {
  font-size: 0.62rem;
  letter-spacing: -0.05em;
  opacity: 0.85;
}

/* 地圖：暫停掣夾喺標題同狀態之間，靠右上 */
.run-bar .pause-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

/* 戰鬥：同「結束回合」並排，唔會遮住敵人立繪或手牌 */
.pause-btn--battle {
  flex: 0 0 auto;
  align-self: center;
}

.screen-battle {
  position: relative;
}

/* —— 暫停頁 —— */
.screen-pause .pause-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.screen-pause .pause-panel h2 {
  margin: 0;
}

.pause-losses {
  margin: 0;
  padding: 0.6rem 0.75rem;
  list-style: none;
  border-radius: 10px;
  background: rgba(5, 12, 22, 0.6);
  border: 1px solid rgba(61, 224, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pause-losses li {
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(206, 222, 240, 0.94);
}

/* 會丟失嘅警告：用琥珀色，唔用紅（紅留返畀已確認破壞動作） */
.pause-warn {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255, 205, 120, 0.94);
}

.pause-quit-btn {
  width: 100%;
  min-height: 48px;
}

.pause-quit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pause-confirm {
  width: 100%;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  background: rgba(120, 20, 20, 0.3);
  border: 1px solid rgba(255, 107, 90, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: settings-warn-in 0.22s ease-out both;
}

.pause-confirm-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: #ffcec7;
  line-height: 1.4;
}

.pause-confirm-body {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255, 216, 210, 0.88);
}

.pause-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pause-confirm-actions .btn {
  width: 100%;
  min-height: 48px;
}

/* —— 存檔：標題頁「繼續」+ 新局覆蓋確認 —— */
.btn-continue {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-height: 60px;
  padding-block: 0.65rem;
  text-align: center;
}

.btn-continue-main {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* 摘要：細字但唔可以太淡（要有用），用 0.86 對比得住 */
.btn-continue-sub {
  font-size: 0.84rem;
  line-height: 1.4;
  font-weight: 500;
  color: rgba(10, 22, 34, 0.9);
  white-space: normal;
}

.overwrite-confirm {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: rgba(120, 20, 20, 0.32);
  border: 1px solid rgba(255, 107, 90, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  animation: settings-warn-in 0.22s ease-out both;
}

.overwrite-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffcec7;
  line-height: 1.4;
}

.overwrite-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 226, 220, 0.94);
}

.overwrite-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.overwrite-actions .btn {
  width: 100%;
  min-height: 48px;
}

/* —— Map —— */
.run-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.run-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.run-stats span {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 224, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
}

.map-panel {
  position: relative;
  overflow: hidden;
}

/* 地圖面板只用半透明底，唔再貼一次區背景（避免同一張圖疊兩層變花） */
.map-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 8, 16, 0.5), rgba(5, 8, 16, 0.86));
  z-index: 0;
  pointer-events: none;
}

.map-panel > * {
  position: relative;
  z-index: 1;
}

/* 地圖節點：390 一屏要睇到全部 6 格 + 可撳「進入」，
   所以手機用兩欄 grid（6 格 → 3 行），唔好逼玩家上下拉。 */
.map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.map-node {
  display: grid;
  /* 兩欄版面：圖示｜內容（CTA 放落第二行右邊） */
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "idx body"
    "idx cta";
  gap: 0.3rem 0.45rem;
  align-items: start;
  padding: 0.5rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

/* 內容欄：靠左收緊，唔好拉到成行闊而中間留白 */
.map-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  align-items: flex-start;
  text-align: left;
  grid-area: body;
}

/* 兩欄版面：圖示／CTA 要指定區域 */
.map-node .map-idx {
  grid-area: idx;
}

.map-node .map-cta,
.map-node .map-done {
  grid-area: cta;
  justify-self: start;
}

.map-node.is-current {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.35), 0 0 20px rgba(255, 45, 149, 0.15);
  cursor: pointer;
  animation: pulse-node 2s ease-in-out infinite;
}

.map-node.is-current:hover {
  transform: translateX(4px);
}

.map-node.is-done {
  opacity: 0.72;
  background: rgba(0, 0, 0, 0.28);
}

/* 行過節點：內容淡，但「行過」標記保持清晰 */
.map-node.is-done .map-body {
  opacity: 0.7;
}

.map-node.is-done .map-done {
  opacity: 1;
}

/* 行過節點：唔止變灰，仲有「已行過」字樣 + 左側綠色完成線 */
.map-node.is-done .map-done {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ok);
  white-space: nowrap;
}

/* —— 節點類型色系：一眼分到戰／事件／休息／店／Boss —— */
.map-type {
  display: inline-block;
  align-self: flex-start;
  padding: 0.02rem 0.34rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-idx {
  font-size: 0.85rem;
  line-height: 1;
}

/* 戰鬥：紅 */
.map-node:not(.node-boss):not(.node-event):not(.node-shop):not(.node-reward):not(.node-elite) {
  border-left: 3px solid rgba(255, 90, 108, 0.55);
}
.map-node:not(.node-boss):not(.node-event):not(.node-shop):not(.node-reward):not(.node-elite) .map-type {
  color: #ff8c9a;
  background: rgba(255, 90, 108, 0.12);
  border-color: rgba(255, 90, 108, 0.3);
}

/* 事件：青 */
.map-node.node-event {
  border-left: 3px solid rgba(61, 224, 255, 0.55);
}
.map-node.node-event .map-type {
  color: var(--neon-cyan);
  background: rgba(61, 224, 255, 0.12);
  border-color: rgba(61, 224, 255, 0.32);
}

/* 休息／店：綠 */
.map-node.node-shop {
  border-left: 3px solid rgba(93, 255, 176, 0.55);
}
.map-node.node-shop .map-type {
  color: var(--ok);
  background: rgba(93, 255, 176, 0.12);
  border-color: rgba(93, 255, 176, 0.32);
}

/* 選牌：紫 */
.map-node.node-reward {
  border-left: 3px solid rgba(178, 128, 255, 0.6);
}
.map-node.node-reward .map-type {
  color: #c9a6ff;
  background: rgba(178, 128, 255, 0.12);
  border-color: rgba(178, 128, 255, 0.32);
}

/* 精英：橙 */
.map-node.node-elite {
  border-left: 3px solid rgba(255, 140, 60, 0.6);
}
.map-node.node-elite .map-type {
  color: #ffb070;
  background: rgba(255, 140, 60, 0.12);
  border-color: rgba(255, 140, 60, 0.34);
}

/* Boss：金（加粗邊） */
.map-node.node-boss {
  border-left: 4px solid var(--neon-amber);
}
.map-node.node-boss .map-type {
  color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.16);
  border-color: rgba(255, 193, 74, 0.4);
}

.map-node.is-locked {
  opacity: 0.35;
}

.map-node.is-boss.is-current {
  border-color: var(--neon-amber);
  box-shadow: 0 0 0 1px rgba(255, 193, 74, 0.4);
}

@keyframes pulse-node {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.3); }
  50% { box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.55), 0 0 22px rgba(255, 45, 149, 0.25); }
}

.map-idx {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: rgba(61, 224, 255, 0.15);
  color: var(--neon-cyan);
}

.map-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

.map-title {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.map-cta {
  font-size: 0.78rem;
  color: var(--neon-amber);
  font-weight: 700;
  /* 觸控目標：最少 44×44（WCAG / iOS HIG） */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 44px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 193, 74, 0.45);
  background: rgba(255, 193, 74, 0.14);
  white-space: nowrap;
  flex: 0 0 auto;
}

.map-done {
  color: var(--ok);
  font-weight: 700;
}

/* —— Battle —— */
.battle-top {
  display: grid;
  /* 單欄 minmax(0,1fr)：子項（敵人卡／玩家卡）唔可以用內容寬撐爆 */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  min-width: 0;
}

.fighter {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.fighter.player {
  grid-template-columns: 1fr;
}

.fighter img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fighter-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.hp-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.hp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--danger), #ff9a6b);
  transition: width 0.2s ease-out;
}

.hp-bar.player span {
  background: linear-gradient(90deg, var(--neon-cyan), var(--ok));
}

.hp-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* 選角後開場：一句港味 + 被動提示 */
.opening-block {
  margin: 0.15rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border-left: 3px solid var(--neon-magenta);
  background: rgba(255, 45, 149, 0.09);
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.opening-line {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(230, 238, 250, 0.96);
}

.opening-passive {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--neon-amber);
  padding: 0.28rem 0.4rem;
  border-radius: 7px;
  background: rgba(255, 193, 74, 0.1);
}

/* Act 內分支：二揀一 */
.branch-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.branch-choice {
  appearance: none;
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  /* 觸控目標 ≥44px */
  min-height: 64px;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(178, 128, 255, 0.35);
  background: rgba(178, 128, 255, 0.09);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.branch-choice:hover {
  border-color: rgba(178, 128, 255, 0.7);
  background: rgba(178, 128, 255, 0.16);
}

.branch-choice:active {
  transform: scale(0.99);
}

.branch-choice strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}

/* 分支效果句：要比 label 弱但仍清楚（港味＋數值） */
.branch-effect {
  font-size: 0.86rem;
  line-height: 1.4;
  color: rgba(232, 220, 255, 0.88);
  letter-spacing: 0.01em;
}

/* 地圖分支節點：紫色 */
.map-node.node-branch {
  border-left: 3px solid rgba(178, 128, 255, 0.65);
}
.map-node.node-branch .map-type {
  color: #c9a6ff;
  background: rgba(178, 128, 255, 0.14);
  border-color: rgba(178, 128, 255, 0.35);
}

/* 敵人意圖：圖示 + 分類短語 + 具體數值 */
.intent {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-self: flex-start;
  margin-top: 0.12rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
}

.intent-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.intent-kind {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.intent-label {
  font-weight: 800;
  font-family: var(--font-display);
}

/* 攻擊：紅（最需要提防） */
.intent--attack {
  border-color: rgba(255, 70, 80, 0.5);
  background: rgba(255, 70, 80, 0.12);
  color: #ff9aa4;
}
.intent--attack .intent-label {
  color: #ff8c9a;
}

/* 防守：綠 */
.intent--block {
  border-color: rgba(93, 255, 176, 0.45);
  background: rgba(93, 255, 176, 0.1);
  color: var(--ok);
}
.intent--block .intent-label {
  color: var(--ok);
}

/* 強化：琥珀 */
.intent--buff_attack,
.intent--buff {
  border-color: rgba(255, 193, 74, 0.5);
  background: rgba(255, 193, 74, 0.12);
  color: var(--neon-amber);
}
.intent--buff_attack .intent-label,
.intent--buff .intent-label {
  color: var(--neon-amber);
}

/* 削弱：紫（陰招） */
.intent--weaken {
  border-color: rgba(178, 128, 255, 0.5);
  background: rgba(178, 128, 255, 0.12);
  color: #c9a6ff;
}
.intent--weaken .intent-label {
  color: #c9a6ff;
}

/* 牌堆計數：牌庫／棄牌／手牌一眼見到 */
.pile-row {
  display: flex;
  gap: 0.3rem;
  /* 四格（牌庫／棄牌／手牌／牌組）要逼喺一行，390 都唔折行 */
  flex-wrap: nowrap;
  align-items: stretch;
  margin: 0 0 0.1rem;
}

.pile-row > * {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}

/* 唔夠位就收細字，唔好折行 */
.pile-row .pile-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pile-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.72rem;
  color: var(--ink-dim);
  line-height: 1.4;
}

.pile-icon {
  font-size: 0.7rem;
  opacity: 0.85;
}

.pile-label {
  letter-spacing: 0.04em;
  font-size: 0.86rem;
}

.pile-num {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--ink);
}

.pile-draw .pile-num {
  color: var(--neon-cyan);
  font-size: 1.02rem;
}

.pile-discard .pile-num {
  color: var(--neon-amber);
  font-size: 1.02rem;
}

.pile-pill.is-bump {
  animation: stat-bump 0.42s ease-out;
}

/* 洗牌提示 */
.pile-row.is-shuffling .pile-draw {
  border-color: rgba(255, 193, 74, 0.7);
  background: rgba(255, 193, 74, 0.16);
}

/* 地圖 HUD 遺物列：每件一粒 chip，點一下講效果 */
.relic-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.15rem 0 0;
}

.relic-chip {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  /* 觸控目標 ≥44px（WCAG / iOS HIG） */
  min-height: 44px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 193, 74, 0.35);
  background: rgba(255, 193, 74, 0.1);
  color: var(--neon-amber);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.relic-chip:hover {
  border-color: rgba(255, 193, 74, 0.7);
  background: rgba(255, 193, 74, 0.18);
}

.relic-chip.is-owner {
  border-color: rgba(255, 45, 149, 0.45);
  background: rgba(255, 45, 149, 0.1);
  color: var(--neon-magenta);
}

.relic-chip-tag {
  font-size: 0.58rem;
  padding: 0.02rem 0.28rem;
  border-radius: 999px;
  background: rgba(255, 45, 149, 0.22);
  color: #ffb0d8;
  letter-spacing: 0.04em;
}

/* 別角專屬：灰化 + 「唔適用」，一眼知冇效果 */
.relic-chip.is-other {
  opacity: 0.5;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
}

.relic-chip-tag.is-other {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink-dim);
}

/* 結算頁遺物：名 + 一句人話 + 專屬標 */
.relic-owner-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.34rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffb0d8;
  background: rgba(255, 45, 149, 0.2);
}

.relic-owner-tag.is-other {
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.12);
}

.relic-plain {
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(220, 232, 248, 0.88);
}

/* 唔夠費出牌：卡面左右震，明確話你知點唔到 */
.card-face.is-shake-no {
  animation: shake-no 0.4s ease-in-out;
  border-color: rgba(255, 70, 80, 0.7) !important;
}

@keyframes shake-no {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.fx-float--low-energy {
  color: #ff8c9a;
  font-size: 0.85rem;
  text-shadow: 0 0 14px rgba(255, 70, 80, 0.9), 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* —— 能量／擋：一眼睇到嘅大數字 —— */
.stat-row {
  display: flex;
  gap: 0.4rem;
  margin: 0.15rem 0 0.1rem;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.18rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  line-height: 1.3;
}

.stat-icon {
  font-size: 0.76rem;
  opacity: 0.9;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.stat-max {
  font-size: 0.68rem;
  color: var(--ink-dim);
}

/* 能量：青色；冇費時轉紅提示 */
.stat-energy {
  border-color: rgba(61, 224, 255, 0.36);
  background: rgba(61, 224, 255, 0.1);
  color: var(--neon-cyan);
}

.stat-energy.is-empty {
  border-color: rgba(255, 70, 80, 0.55);
  background: rgba(255, 70, 80, 0.14);
  color: #ff8c9a;
}

/* 擋：有擋先亮綠；冇擋灰住 */
.stat-block.is-on {
  border-color: rgba(93, 255, 176, 0.55);
  background: rgba(93, 255, 176, 0.14);
  color: var(--ok);
}

.stat-block.is-off {
  opacity: 0.42;
}

.stat-block.is-off .stat-num {
  color: var(--ink-dim);
}

/* 狀態數字變動：彈一下 */
.stat-pill.is-bump {
  animation: stat-bump 0.42s ease-out;
}

@keyframes stat-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.energy-hint {
  font-size: 0.68rem;
  color: var(--neon-amber);
  letter-spacing: 0.04em;
}

.energy {
  color: var(--neon-cyan);
}

.boss-line {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--neon-amber);
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 193, 74, 0.08);
  border: 1px solid rgba(255, 193, 74, 0.28);
  animation: rise-in 0.45s ease-out both;
}

.battle-banner {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  padding: 0.5rem;
  animation: rise-in 0.4s ease-out both;
}

.battle-banner.win { color: var(--ok); }
.battle-banner.lose { color: var(--danger); }

/* 手牌：橫向滑動單行（390 一屏睇到手牌＋結束回合，唔使上下拉） */
.hand {
  display: flex;
  flex-wrap: nowrap;
  /* 關鍵：flex 子項預設 min-width:auto，卡片 min-content 會撐爆容器。
     min-width:0 + max-width:100% 令容器真正受限於父寬，多出嚟嘅卡就靠橫滑。 */
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0.45rem;
  /* 滑動時唔好俾瀏覽器當成「上一頁／下一頁」手勢 */
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  /* 上下留少少位，避免 hover 陰影／縮卡動畫被裁 */
  padding: 0.2rem 0 0.35rem;
  /* 隱藏 scrollbar 但保留滑動能力（手機本身都唔顯示） */
  scrollbar-width: thin;
}

.hand::-webkit-scrollbar {
  height: 4px;
}

.hand::-webkit-scrollbar-thumb {
  background: rgba(61, 224, 255, 0.24);
  border-radius: 999px;
}

/* 橫滑時每張卡都吸附一下，唔會停到一半 */
.hand > .card-face {
  scroll-snap-align: start;
}

.empty-hand {
  font-size: 0.9rem;
  margin: 0;
  color: rgba(220, 232, 248, 0.88);
  text-align: center;
  flex: 1 0 100%;
}

/* 卡面：手牌用固定闊度（橫滑），唔再用 grid 撐高 */
.card-face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  text-align: left;
  padding: 0.4rem 0.4rem 0.45rem;
  border-radius: 12px;
  border: 1px solid rgba(61, 224, 255, 0.28);
  background: rgba(6, 12, 24, 0.92);
  color: inherit;
  font: inherit;
  cursor: pointer;
  /* 手牌卡：固定 118 闊，橫滑唔會變形；高度由內容決定（約 146） */
  flex: 0 0 118px;
  width: 118px;
  min-height: 0;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  animation: rise-in 0.35s ease-out both;
}

.card-face:hover:not(.is-disabled) {
  transform: translateY(-4px);
  border-color: var(--neon-cyan);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.card-face.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-face.is-kuaisou {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.35);
}

.card-cost {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--neon-amber);
  color: #1a1200;
  z-index: 1;
}

/* 手牌卡圖：4:3（唔再用 1:1，慳 30px 高） */
.card-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
}

.card-name {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  /* 1.25 會令 16px 行高裝唔落 18px 字，改用 1.35 */
  line-height: 1.35;
}

.card-type,
.card-stats {
  font-size: 0.68rem;
  color: var(--ink-dim);
  /* 效果字串可能較長（如「傷 8／下回合再痛 2／半血以下 +6 傷」），
     容許換行避免裁字或撐爆卡面 */
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-stats {
  color: var(--neon-cyan);
}

/* 手牌上嘅 blurb（flavor 句）唔顯示：長按睇詳情就有，
   留返空間令 390 一屏放得晒手牌＋結束回合。 */
.hand .card-blurb {
  display: none;
}

.card-blurb {
  font-size: 0.72rem;
  color: rgba(200, 216, 236, 0.92);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.battle-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.battle-log {
  list-style: none;
  margin: 0;
  padding: 0.98rem 1.08rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.86rem;
  color: rgba(220, 232, 248, 0.9);
  max-height: 8rem;
  overflow: auto;
}

.battle-log li + li {
  margin-top: 0.36rem;
  line-height: 1.5;
}

/* 回合結束短回饋：最頂一行，金色，淡入 */
.battle-log .turn-line {
  margin: 0 0 0.34rem;
  padding: 0.34rem 0.5rem;
  border-radius: 7px;
  border-left: 2px solid var(--neon-amber);
  background: rgba(255, 193, 74, 0.14);
  color: var(--neon-amber);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.battle-log .turn-line.is-on {
  opacity: 1;
}

/* —— Reward / Event —— */
.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

/* 選牌：每格 = 卡片 + 一句「呢張幫到你咩」 */
.reward-cell {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  align-items: stretch;
}

/*
 * 獎卡喺直向 flex（.reward-cell）入面：
 * 手牌用嘅 `flex: 0 0 118px` 會變成鎖死「高度」118px，
 * 令 .card-stats（青字傷／盾數）溢出壓住下面橙金 .reward-why。
 * 呢度改為高度跟內容；卡面置中、圖限高，數字同短述分行唔叠、唔裁。
 */
.reward-cell .card-face {
  flex: 0 0 auto;
  align-self: center;
  width: min(100%, 168px);
  max-width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.reward-cell .card-art {
  max-height: 4.5rem;
  width: 100%;
  object-fit: cover;
}

.reward-cell .card-stats {
  flex: 0 0 auto;
  position: relative;
  z-index: 0;
}

.reward-why {
  margin: 0;
  padding: 0.1rem 0.2rem 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--neon-amber);
  opacity: 1;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .reward-grid {
    grid-template-columns: 1fr;
  }
}

.event-art {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  animation: rise-in 0.6s ease-out both;
}

.event-art img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.event-choice {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(61, 224, 255, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

/* 事件結果頁：顯示「你揀咗…」，令過程完整 */
.event-picked {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 193, 74, 0.1);
  border-left: 3px solid var(--neon-amber);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.event-picked span {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.event-picked strong {
  font-size: 0.86rem;
  color: var(--neon-amber);
}

/* 事件選項揀中：先亮一下，之後才轉結果頁（過程感） */
.event-choice.is-chosen {
  border-color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.16);
  transform: scale(1.02);
  box-shadow: 0 0 0 2px rgba(255, 193, 74, 0.4);
}

.event-choice:hover {
  border-color: var(--neon-magenta);
  background: rgba(255, 45, 149, 0.08);
}

/* effectText／貨架副句：要比 label 弱一級但仍清楚可讀（港味＋數值） */
.event-choice span {
  font-size: 0.84rem;
  line-height: 1.35;
  color: rgba(232, 240, 255, 0.78);
  letter-spacing: 0.01em;
}

.event-choice strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.run-inline {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--neon-amber);
}

/* —— Feel / juice —— */
#fx-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.card-face.is-pressing {
  transform: scale(0.92) !important;
  transition: transform 0.06s ease-out;
}

/* 選牌確認：放大高亮 + 輕微上彈，令「揀咗邊張」有明確回饋 */
.card-face.is-picked {
  transform: scale(1.06) translateY(-6px);
  border-color: var(--neon-amber);
  box-shadow: 0 0 0 2px rgba(255, 193, 74, 0.65), 0 10px 28px rgba(255, 193, 74, 0.3);
  animation: pick-pop 0.24s ease-out both;
  z-index: 3;
}

@keyframes pick-pop {
  0% { transform: scale(1) translateY(0); }
  55% { transform: scale(1.09) translateY(-9px); }
  100% { transform: scale(1.06) translateY(-6px); }
}

.fx-proj {
  position: fixed;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  box-shadow: 0 0 16px currentColor, 0 0 28px currentColor;
  opacity: 1;
  will-change: transform, opacity;
}

.fx-proj--ghost {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  filter: blur(0.4px);
}

.fx-proj--attack {
  background: var(--neon-magenta);
  color: var(--neon-magenta);
}

.fx-proj--skill {
  background: var(--neon-cyan);
  color: var(--neon-cyan);
}

.fx-float {
  position: fixed;
  transform: translate(-50%, 0) scale(0.9);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.26rem;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.45);
  opacity: 1;
  transition: transform 0.75s ease-out, opacity 0.75s ease-out;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

.fx-float.is-on {
  opacity: 0;
  transform: translate(-50%, -64px) scale(1.12);
}

.fx-float--dmg {
  color: #ff5a6c;
  font-size: 0.9rem;
}

.fx-float--block {
  color: #b8fff6;
  font-size: 0.9rem;
  text-shadow: 0 0 14px rgba(61, 224, 255, 1), 0 2px 8px rgba(0, 0, 0, 0.65);
}

.fx-float--heal {
  font-size: 0.9rem;
  color: var(--ok);
}

.fx-float--kuaisou {
  color: var(--neon-amber);
  font-size: 0.88rem;
}

/* 金幣跳字：金色 + 上彈，數值變動即刻見到 */
.fx-float--gold {
  color: #ffd76a;
  font-size: 0.9rem;
  text-shadow: 0 0 16px rgba(255, 193, 74, 0.95), 0 2px 8px rgba(0, 0, 0, 0.8);
  font-weight: 900;
}

.fx-float--gold-spend {
  color: #ffb4a2;
  font-size: 0.88rem;
  text-shadow: 0 0 14px rgba(255, 140, 110, 0.9), 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* 狀態列金幣數字：賺／花各彈一下 */
.run-stats span.is-gold-up {
  color: #ffd76a;
  animation: gold-pop 0.6s ease-out;
}

.run-stats span.is-gold-down {
  color: #ffb4a2;
  animation: gold-pop 0.6s ease-out;
}

@keyframes gold-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* 載入失敗兜底畫面：唔會再白屏，一定睇到原因同重載掣 */
.boot-error {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-deep);
  color: var(--ink);
}

.boot-error h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--danger);
  letter-spacing: 0.08em;
}

.boot-error p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-dim);
  max-width: 42ch;
}

.boot-error pre,
.boot-error code {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--neon-cyan);
}

.boot-error pre {
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(61, 224, 255, 0.25);
}

.boot-error a {
  color: var(--neon-amber);
}

.boot-error button {
  min-height: 44px;
  min-width: 140px;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--neon-cyan);
  background: rgba(61, 224, 255, 0.12);
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.fx-float--dangkou {
  color: var(--neon-cyan);
  font-size: 0.95rem;
}

.fx-float--zhaopaiyan {
  color: #c9a0ff;
  font-size: 0.92rem;
}

.fx-float--yanli {
  color: #b8ff5c;
  font-size: 0.95rem;
}

.fx-kuaisou-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -8px) scale(0.9);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  letter-spacing: 0.18em;
  color: var(--neon-amber);
  text-shadow: 0 0 18px rgba(255, 193, 74, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.25s ease;
  z-index: 55;
}

.fx-passive-banner--dangkou {
  color: var(--neon-cyan);
  text-shadow: 0 0 18px rgba(61, 224, 255, 0.55);
}

.fx-passive-banner--zhaopaiyan {
  color: #c9a0ff;
  text-shadow: 0 0 18px rgba(180, 120, 255, 0.55);
}

.fx-passive-banner--seotong {
  color: #78ffc8;
  text-shadow: 0 0 18px rgba(120, 255, 200, 0.6);
}

.fx-passive-banner--yanli {
  color: #b8ff5c;
  text-shadow: 0 0 18px rgba(184, 255, 92, 0.5);
}

.fx-kuaisou-banner.is-on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

#enemy-portrait,
#fighter-player {
  transition: transform 0.08s ease, filter 0.08s ease, box-shadow 0.08s ease;
}

#enemy-portrait.is-impact,
#fighter-player.is-impact {
  transform: scale(1.06);
}

#enemy-portrait.is-kickback {
  animation: kickback 0.1s ease;
}

#enemy-portrait.is-flash-red,
#fighter-player.is-flash-red {
  filter: brightness(1.55) saturate(1.55) contrast(1.08);
  box-shadow: 0 0 0 3px rgba(255, 70, 80, 0.85), 0 0 22px rgba(255, 40, 60, 0.55);
}

#enemy-portrait.is-flash-cyan,
#fighter-player.is-flash-cyan {
  filter: brightness(1.4) saturate(1.35);
  box-shadow: 0 0 0 3px rgba(61, 224, 255, 0.85), 0 0 18px rgba(61, 224, 255, 0.45);
}

@keyframes kickback {
  0% { transform: scale(1.08) translateX(0); }
  35% { transform: scale(1.06) translateX(6px); }
  70% { transform: scale(1.02) translateX(-3px); }
  100% { transform: scale(1) translateX(0); }
}

.screen-battle.is-screen-shake {
  animation: screen-shake 0.1s linear;
}

@keyframes screen-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  45% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
}

.screen-battle.is-hurt-vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 60px 12px rgba(255, 40, 60, 0.45);
  animation: vignette-flash 0.16s ease-out;
}

.screen-battle {
  position: relative;
}

@keyframes vignette-flash {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

#enemy-intent.is-telegraph {
  color: #fff;
  font-weight: 800;
  transform: scale(1.12);
  text-shadow: 0 0 12px rgba(255, 193, 74, 0.8);
  transition: transform 0.15s ease, color 0.15s ease;
  animation: intent-pulse 0.28s ease-out;
}

@keyframes intent-pulse {
  0% { transform: scale(1); }
  55% { transform: scale(1.16); }
  100% { transform: scale(1.12); }
}

/* 敵人行動中：名牌底下出短標記，令「意圖 → 執行」順序可見 */
.fighter.enemy .fighter-meta.is-acting {
  position: relative;
}

.fighter.enemy .fighter-meta.is-acting::after {
  content: attr(data-act);
  position: absolute;
  right: 0;
  top: -0.15rem;
  padding: 0.04rem 0.34rem;
  border-radius: 999px;
  background: rgba(255, 70, 80, 0.9);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  animation: act-pop 0.28s ease-out both;
  pointer-events: none;
}

@keyframes act-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 結束回合掣：按下即刻轉文字，唔好靜過 */
.btn.is-pending {
  opacity: 0.75;
  cursor: progress;
}

.end-turn-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.end-turn-pending::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--neon-cyan);
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-pressable:active {
  transform: scale(0.94);
}

.btn-primary.btn-pressable:hover {
  transform: translateY(-1px) scale(1.02);
}

.btn-primary.btn-pressable:active {
  transform: scale(0.94);
}

/* Boss 戰前強制停一句 */
.screen-boss-gate .boss-gate-art {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 193, 74, 0.35);
  animation: rise-in 0.5s ease-out both;
}

.screen-boss-gate .boss-gate-art img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: top;
}

.boss-gate-quote {
  margin: 0;
  padding: 1.15rem 1.1rem;
  border-radius: var(--radius);
  background: rgba(255, 193, 74, 0.08);
  border: 1px solid rgba(255, 193, 74, 0.3);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.25rem, 5.2vw, 1.65rem);
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--neon-amber);
  text-align: center;
  animation: rise-in 0.55s ease-out 0.08s both;
}

.boss-gate-hint {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

/* 最終 Boss：加一層紅黑壓迫感 */
.screen-boss-gate.is-elite .eyebrow {
  color: var(--warn, #e8b84a);
}

.screen-boss-gate.is-elite .boss-gate-quote {
  border-color: rgba(232, 184, 74, 0.45);
}

.screen-boss-gate.is-final .boss-gate-art {
  border-color: rgba(255, 92, 108, 0.55);
  box-shadow: 0 0 28px rgba(255, 45, 149, 0.22);
}

.screen-boss-gate.is-final .boss-gate-quote {
  background: linear-gradient(160deg, rgba(255, 45, 149, 0.14), rgba(255, 193, 74, 0.08));
  border-color: rgba(255, 92, 108, 0.45);
  color: #ffd9a0;
}

/* —— 三區進度條（地圖頂） —— */
.act-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.act-pip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  min-width: 0;
}

.act-pip span {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}

.act-pip strong {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-pip.is-cleared {
  border-color: rgba(93, 255, 176, 0.35);
}

.act-pip.is-cleared strong {
  color: var(--ok);
}

.act-pip.is-active {
  border-color: rgba(255, 45, 149, 0.55);
  background: rgba(255, 45, 149, 0.1);
}

.act-pip.is-active strong {
  color: var(--ink);
}

.map-node.is-choice .map-sub {
  color: var(--neon-amber);
}

/* —— 窄屏（≈375px）：節點／卡牌／按鈕可點、唔遮、唔橫向捲 —— */
@media (max-width: 400px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .app {
    padding: 0.55rem 0.45rem 1rem;
    place-items: stretch;
    width: 100%;
    max-width: 100vw;
  }

  .screen,
  .screen-wide,
  .screen-battle {
    width: 100%;
    /* 用 100% 會跟父容器（.app 有 padding），390 下會變成 430 爆邊。
       改用 100vw 減返 .app 嘅左右 padding（0.45rem × 2），確保永遠貼合視口。 */
    max-width: min(var(--app-max-w), calc(100vw - 0.9rem));
    gap: 0.85rem;
  }

  .run-bar {
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .run-stats {
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }

  .map-node {
    /* 窄屏：左右收窄留返空間畀文字同 CTA */
    padding: 0.7rem 0.55rem;
    min-height: 56px;
    gap: 0.45rem;
  }

  .map-idx {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  .map-sub {
    font-size: 0.68rem;
  }

  .map-title {
    font-size: 0.92rem;
  }

  .map-node.is-current {
    /* 加大點擊面；唔用橫移以免裁切 */
    transform: none;
  }

  .map-node.is-current:hover,
  .map-node.is-current:active {
    transform: none;
  }

  .map-cta {
    /* 窄屏維持 ≥44px 觸控面，用縮短文字間距而非縮細高度 */
    padding: 0 0.55rem;
    min-width: 56px;
    border-radius: 10px;
  }

  .hand {
    /* 窄屏 3 欄：卡片約 118px 闊，一屏睇到 3 張，減少垂直滾動 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .card-face {
    min-height: 148px;
    min-width: 0;
    width: 100%;
    padding: 0.4rem;
  }

  /* 窄屏手牌圖用 4:3 而唔係 1:1，減少中段空位同總高度 */
  .card-art {
    aspect-ratio: 4 / 3;
  }

  .reward-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* 高度跟內容；唔再寫死 min-height，避免同手牌 flex-basis 一齊夾爆 */
  .reward-cell .card-face {
    min-height: 0;
    height: auto;
  }

  .fighter {
    grid-template-columns: 64px 1fr;
    gap: 0.5rem;
  }

  .fighter img {
    width: 64px;
    height: 64px;
  }

  .battle-actions,
  .actions {
    position: relative;
    z-index: 5;
    width: 100%;
  }

  .btn {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1rem;
  }

  .event-choice {
    min-height: 52px;
    padding: 0.85rem 0.75rem;
  }

  /* 士多／遺物：窄屏下文字唔好擠埋一齊 */
  .event-choice strong {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
  }

  .relic-rarity {
    margin-left: 0;
  }

  .panel-shop .event-choice span {
    font-size: 0.76rem;
    line-height: 1.45;
  }

  .char-card {
    min-height: 64px;
    padding: 0.85rem 0.75rem;
  }

  /* 立繪：窄屏 76px，唔好大到推走名／被動／開局掣 */
  .avatar-portrait {
    width: 76px;
    height: 76px;
  }

  .char-card {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .boss-gate-quote {
    font-size: clamp(1.2rem, 6vw, 1.45rem);
    padding: 1rem 0.75rem;
  }

  .boss-gate-hint {
    font-size: 0.76rem;
  }

  .act-strip {
    gap: 0.3rem;
  }

  .act-pip {
    padding: 0.4rem 0.35rem;
  }

  .act-pip strong {
    font-size: 0.7rem;
  }

  .clear-stats {
    gap: 0.4rem;
  }

  /*
   * 手機字級：390 寬下太細嘅字統一放大
   * （原本 map-type 9.6px、card-blurb 10.4px、playstyle 11.84px 太細睇唔清）
   */
  .map-type {
    font-size: 0.72rem; /* 11.5px */
    padding: 0.06rem 0.42rem;
  }

  .map-sub {
    font-size: 0.78rem; /* 12.5px */
  }

  .map-title {
    font-size: 1rem; /* 16px */
  }

  .map-cta {
    font-size: 0.86rem; /* 13.8px */
  }

  .char-desc {
    font-size: 0.86rem; /* 13.8px */
  }

  .char-playstyle {
    font-size: 0.82rem; /* 13.1px */
    line-height: 1.5;
  }

  .char-route {
    font-size: 0.74rem;
  }

  .char-passive-tag {
    font-size: 0.78rem;
  }

  .passive-box {
    font-size: 0.9rem; /* 14.4px */
  }

  .card-name {
    font-size: 0.9rem; /* 14.4px */
    line-height: 1.35;
  }

  .card-stats {
    font-size: 0.78rem; /* 12.5px */
    line-height: 1.4;
  }

  .card-type {
    font-size: 0.72rem; /* 11.5px */
  }

  .card-blurb {
    font-size: 0.72rem; /* 11.5px */
    line-height: 1.4;
    -webkit-line-clamp: 3;
  }

  .battle-log {
    font-size: 0.8rem; /* 12.8px */
  }

  .turn-line {
    font-size: 0.82rem;
  }

  .foot-note {
    font-size: 0.76rem; /* 12.2px */
  }

  .opening-line {
    font-size: 0.9rem;
  }

  .opening-passive {
    font-size: 0.78rem;
  }

  .relic-chip {
    font-size: 0.8rem;
  }

  .status,
  .status-map {
    font-size: 0.9rem;
  }

  .enc-list,
  .deck-list {
    max-height: none;
  }

  .screen-boss-gate .boss-gate-art img {
    max-height: 160px;
  }

  .battle-log {
    max-height: 5.5rem;
  }

  /* FX 層永不擋點擊 */
  #fx-root,
  .fx-float,
  .fx-proj,
  .fx-kuaisou-banner {
    pointer-events: none !important;
  }
}

/* 結算勝／敗 */
.screen-result.is-win {
  animation: win-neon 1.2s ease-out both;
}

.screen-result.is-win .result-title {
  animation: brand-pulse 2.2s ease-in-out infinite;
}

/* 注意：呢個 filter 會令 `.screen-result` 變成 fixed 子元素嘅包含塊，
   所以結算頁嘅底欄一定要掛喺 body 而唔可以留喺 .screen 入面
   （見 renderResultBar()）。 */
.screen-result.is-lose {
  filter: saturate(0.7) brightness(0.88);
}

.screen-result.is-lose .result-title.dim {
  background: linear-gradient(120deg, #7a889c, #c5d0e0);
  -webkit-background-clip: text;
  background-clip: text;
  filter: none;
  animation: none;
}

.screen-result .result-sub {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.screen-result.is-win .result-sub {
  color: var(--ok);
}

.screen-result.is-lose .result-sub {
  color: var(--danger);
}

/* Boss 戰後一句：金框、置中、唔搶手牌 */
.boss-afterword {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border-left: 3px solid var(--neon-amber);
  background: rgba(255, 193, 74, 0.1);
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.55;
  text-align: center;
  animation: rise-in 0.4s ease-out both;
}

/* 下一鋪建議：換构筑／換角色／唔換都得 */
.next-run {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: rgba(61, 224, 255, 0.07);
  border: 1px solid rgba(61, 224, 255, 0.2);
}

.next-run-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--neon-cyan);
}

.next-run-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.next-run-list li {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-dim);
}

.next-run-list strong {
  color: var(--ink);
  font-weight: 700;
}

/* 通關總結一句（角色專屬，講呢一鋪做到咩） */
.clear-summary {
  margin: 0.6rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  border-left: 3px solid var(--neon-amber);
  background: rgba(255, 193, 74, 0.1);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 500;
}

/* 通關結算：本局關鍵一句（金幣／遺物／主路線） */
.clear-keys {
  margin: 0.7rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  border-left: 3px solid var(--neon-cyan);
  background: rgba(61, 224, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.clear-keys-label {
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  font-weight: 700;
}

.clear-keys-line {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
}

/* Act 銜接過場：一句港味，交代由邊行到邊 */
.act-trans-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-left: 3px solid var(--neon-magenta);
}

.act-trans-from {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.act-trans-line {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(230, 238, 250, 0.95);
}

.act-trans-note {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 45, 149, 0.1);
  font-size: 0.92rem;
  font-style: italic;
  color: rgba(220, 232, 248, 0.9);
}

/* 「差一點」診斷：失敗頁最搶眼嘅一句 */
.near-miss {
  margin: 0.75rem 0 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border-left: 3px solid var(--danger);
  background: rgba(255, 70, 80, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.near-miss strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--danger);
}

.near-miss-stats {
  margin-top: 0.65rem;
}

.screen-result.is-lose .near-miss-stats li {
  border-color: rgba(255, 120, 90, 0.28);
  background: rgba(40, 8, 8, 0.35);
}

.next-run-clear {
  margin-top: 0.85rem;
}

.enemy-flavor-line {
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(210, 222, 240, 0.9);
  font-style: italic;
  max-width: 100%;
}

.near-miss span {
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(240, 220, 220, 0.95);
}

/* —— 通關結算（Act3 打完） —— */
.clear-badge {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.8rem;
  display: inline-block;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  color: #1a1200;
  background: linear-gradient(135deg, var(--neon-amber), #ffd98a);
  box-shadow: 0 0 18px rgba(255, 193, 74, 0.45);
}

.clear-hero h2 {
  font-size: 1.15rem;
  color: var(--ok);
}

/* 「再來一局」大掣：通關／敗北共用，窄屏都易點 */
/* 用 fixed 底欄之後，內容底部要留返位，否則最後一段會被蓋住 */

.result-actions {
  margin-top: 0.2rem;
}

/* —— 結算頁：細節收納（主掣先見到，唔使拉到底） —— */
.result-details {
  border-radius: 12px;
  border: 1px solid rgba(61, 224, 255, 0.18);
  background: rgba(6, 14, 26, 0.5);
  overflow: hidden;
}

.result-details-summary {
  padding: 0.75rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: rgba(198, 216, 240, 0.9);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  /* 觸控目標 */
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

/* 自訂箭頭（唔同瀏覽器預設樣式唔一致） */
.result-details-summary::-webkit-details-marker {
  display: none;
}

.result-details-summary::after {
  content: "▾";
  font-size: 0.8rem;
  color: var(--neon-cyan);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.result-details[open] .result-details-summary::after {
  transform: rotate(180deg);
}

.result-details-summary:hover {
  color: var(--ink);
}

.result-details-summary:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: -2px;
}

.result-details-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.5rem 0.7rem;
}

/* 結算頁主掣：永遠可見（fixed 底部），唔使拉到底先撳到。
   用 fixed 而唔用 sticky：sticky 只喺容器高度內生效，
   內容一長過視口就會被推落去（實測 actions top 922，仍喺屏外）。 */
.screen-result .result-actions {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 20;
  width: min(var(--app-max-w), 100%);
  margin: 0;
  /* 底欄要薄：390 高度有限，唔可以食太多 */
  padding: 0.45rem 0.45rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(4, 10, 18, 0.97) 60%, rgba(4, 10, 18, 0));
  pointer-events: auto;
  border-top: 1px solid rgba(61, 224, 255, 0.12);
}

/* 結算頁底欄：因為 .screen-result.is-lose 有 filter、.is-win 有 animation，
   兩者都會令 fixed 定位改以該元素為包含塊（唔再貼視口），所以底欄由
   `renderResultBar()` 直接掛喺 body，唔留喺 .screen 入面。 */
.result-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 20;
  width: min(var(--app-max-w), 100%);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0.45rem 0.45rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(4, 10, 18, 0.97) 62%, rgba(4, 10, 18, 0));
  border-top: 1px solid rgba(61, 224, 255, 0.12);
}

.result-bar .btn {
  width: 100%;
  min-height: 44px;
}

.result-bar .btn-rerun {
  min-height: 56px;
}

/* 底欄出現時，結算內容要留位（否則最後一段被蓋住） */
.screen-result {
  padding-bottom: 9rem;
}


.btn-rerun {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-height: 64px;
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
}

.btn-rerun-main {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.btn-rerun-sub {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0.82;
  line-height: 1.3;
}

.clear-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.clear-stats li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(61, 224, 255, 0.2);
}

.clear-stats span {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.clear-stats strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}

.enc-list,
.deck-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 13rem;
  overflow: auto;
}

.enc-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
}

.enc-tag {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--neon-amber);
}

.enc-name {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enc-act {
  font-size: 0.68rem;
  color: var(--ink-dim);
}

.enc-empty {
  display: block;
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.deck-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.1rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  font-size: 0.82rem;
}

.deck-list li:last-child {
  border-bottom: none;
}

.deck-n {
  color: var(--neon-cyan);
  font-weight: 700;
}

.stub-card {
  border-style: dashed;
  border-color: rgba(255, 193, 74, 0.35);
}

.stub-note {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.74rem;
  color: rgba(154, 173, 200, 0.8);
}

.screen-result.is-clear .result-sub {
  color: var(--neon-amber);
}

/* —— 遺物（士多／結算） —— */
.relic-rarity {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--neon-amber);
  background: rgba(255, 193, 74, 0.14);
  border: 1px solid rgba(255, 193, 74, 0.35);
  vertical-align: middle;
}

.panel-shop {
  border-color: rgba(255, 193, 74, 0.28);
}

.shop-sub {
  margin: 0.9rem 0 0.2rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.event-choice.is-sell {
  border-color: rgba(154, 173, 200, 0.28);
  background: rgba(255, 255, 255, 0.02);
}

.event-choice.is-sell:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  background: rgba(61, 224, 255, 0.07);
}

.relic-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.relic-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 193, 74, 0.07);
  border: 1px solid rgba(255, 193, 74, 0.22);
}

.relic-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--neon-amber);
}

.relic-desc {
  font-size: 0.75rem;
  color: var(--ink-dim);
  line-height: 1.4;
}

@keyframes win-neon {
  0% { filter: brightness(1.35) saturate(1.3); }
  40% { filter: brightness(1.1); }
  100% { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-float,
  .fx-kuaisou-banner,
  .fx-proj,
  #enemy-portrait,
  #fighter-player,
  .screen-battle.is-screen-shake,
  .screen-result.is-win,
  .panel,
  .actions,
  .brand-block,
  .boss-gate-quote,
  .map-node.is-current,
  .card-face,
  .event-art {
    animation: none !important;
    transition: opacity 0.2s ease !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
