/* ============================================================
   IDLE RO — 視覺設計（GRP-UIREVAMP-U2，docs/ui-revamp-spec.md §7 的 B 方案「森林銅橘」）
   色彩：深墨綠底 / 銅橘重點 / 杏色標題字
   字體：Marcellus SC（Logo）/ LXGW WenKai TC 霞鶩文楷（中文標題）/ Noto Sans TC（內文）
   ⚠ 規格表以外的狀態色（--bad*、--cost*）是 U2 自行決定的，對比度見 docs/tickets/grpuirevamp-u2-report.md。
   ⚠ 舊 token（gold、bg-panel 那一套）整套換名，不留別名：:root 上的 var() 別名會在 :root 就算成定值，
     打寶模式（body.farm-*）只蓋新名字時，用舊名字的元件不會跟著變色。
   ============================================================ */

:root {
  /* §7 規格表（數值與預覽頁 reports/palette-preview.html 的 B 方案逐一相同；tests/uirevamp-u2.test.js 寫死比對） */
  --bg: #121d18;
  --panel: #1a2a23;
  --panel-2: #22352c;
  --line: #3a5246;
  --ink: #eef0e5;
  --ink-dim: #a6b6ab;
  --accent: #e39a52;
  --head: #f3d2ae;
  --btn-bg: #a85a24;
  --btn-fg: #fff8ee;
  --btn-line: #e39a52;
  --hp: #62d36b;
  --sp: #5f95f2;
  --good: #9be0a2;
  --badge-bg: #cc3636;
  --badge-fg: #ffffff;
  --bubble-bg: #fff3e3;
  --bubble-fg: #1a2a23;
  --tab-on: #eef0e5;
  --field: #16241e;
  --cell: #1f3129;
  --cell-line: #3a5246;
  --accent-wash: rgba(227,154,82,.18);
  --radius: 10px;
  /* U2 自行決定（規格沒給）：危險／錯誤（取代舊 --bad-bg 系）、花費數字（取代舊 --cost-line 系）、銅橘的半透明光暈 */
  --bad: #ff8a7a;        /* 文字：對 panel 6.55、對 panel-2 5.68 */
  --bad-bg: #b8372f;     /* 底色配白字 5.79 */
  --cost: #8fd0c8;       /* 文字：對 panel 8.59、對 panel-2 7.45 */
  --cost-line: #4fa79f;  /* 框線／勾選色：對 panel 5.26 */
  --accent-glow: rgba(227,154,82,0.30);
  --hover: #2b4237;      /* 按鈕懸停底（取代舊 #2a2f4e） */
  --deep: #0b130f;       /* 比底色更深一階（取代舊 #0c0e16／#05060a） */
  --font-logo: 'Marcellus SC', 'Times New Roman', serif;
  --font-head: 'LXGW WenKai TC', 'Noto Sans TC', 'Microsoft JhengHei', serif;
  --font-body: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}

/* 打寶模式的介面染色（#111）。**只覆寫三個底色 + 分隔線**——
   重點色／HP／SP 那幾個是狀態色（按鈕、警告），整份重畫的話
   會全部失去對比，玩家反而看不出哪裡是可按的。
   一般＝微紅、瘋狂＝暗紅，用色深度區分兩檔（另有模式名稱文字，不只靠顏色）。 */
body.farm-normal {
  --bg: #1a1218;
  --panel: #271a24;
  --panel-2: #32222e;
  --line: #452a38;
}
body.farm-mad {
  --bg: #1c0c0f;
  --panel: #2d1014;
  --panel-2: #3b151b;
  --line: #5a1d24;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-body);
  /* 鎖定縮放（UI1）：manipulation 允許單指捲動／點擊，但擋掉雙擊縮放與雙指縮放；
     iOS Safari 從 iOS 10 起會忽略 viewport 的 user-scalable=no，touch-action 是第二道防線，
     第三道在 js/ui.js 的 bindZoomGuard()（攔 gesturestart 與多指 touchmove）。 */
  touch-action: manipulation;
  /* UI1b 手機寬度自適應：任何子元素不慎撐寬時，這裡當最後保險擋住橫向捲動——
     但根因（各處固定寬度／min-width／nowrap）已在下面逐一修過，這條不是用來代替那些修法。 */
  overflow-x: hidden;
  /* UI8「下拉不要重整網頁」：手機瀏覽器的 pull-to-refresh 對放置遊戲是災難——
     滑背包滑到頂再往下拉一點，整頁重載。`overscroll-behavior: none` 下在根元素上，
     同時關掉 pull-to-refresh 與橡皮筋回彈，**不影響任何元素內部的正常捲動**
     （它管的是「捲到邊界之後還繼續拉」要不要有效果，不是捲動本身）。
     ⚠ 這裡刻意不用 `touch-action: none`——那才會把捲動一起殺掉。上面那行
     `touch-action: manipulation` 必須維持原樣，它只擋雙擊／雙指縮放。
     生效範圍：Android Chrome 63+、桌機 Chromium／Firefox 全部；iOS Safari 要 16.4 以上。
     iOS 16.3 以下沒有純 CSS 解法，本單不加 JS touchmove 攔截（風險是把正常捲動一起關掉）。 */
  overscroll-behavior: none;
}

/* UI8：連鎖捲動（overscroll chaining）——內層捲到底再繼續拉，捲動會「傳」給外層，
   最後傳到根元素就觸發 pull-to-refresh。根元素那條擋得住最後一棒，但內層仍會把
   外層一起帶動（畫面跳動）。所以每一個捲動容器都要 `contain`：邊界之內照常捲、
   到底之後不往外傳。⚠ 用 `contain` 不用 `none`，內層的回彈手感保留。
   ⚠⚠ 這份清單必須涵蓋 css/** 裡**每一個** overflow:auto/scroll 的選擇器，
   tests/ui8-scroll.test.js 會自己從 CSS 掃出捲動容器再跟這條比對，漏一個就紅。 */
.slot-list,
.tab-content,
.job-tree-wrap,
.modal-box > *:not(.modal-title):not(.modal-confirm):not(.consent-row),
.refine-panel,
.refine-log,
.codex-drops, .codex-srcs,
.codex-spots,
.wh-body,
.wh-list,
.kafra-body,
#idle-report-body,
.chat-list {
  overscroll-behavior: contain;
}

.hidden { display: none !important; }

/* 鎖定縮放（UI1）：iOS 對 font-size < 16px 的文字輸入框會在取得焦點時自動放大頁面，
   與 user-scalable=no 是兩回事、viewport 設定擋不住。這裡統一蓋掉各處較小的 font-size
   （.name-input 15px、.chat-input 14px、.codex-search 12px、.mk-search/.mk-num 13px、
   .ally-num 11px…）；checkbox／range 不在清單內，維持原尺寸。 */
input[type="text"], input[type="search"], input[type="number"],
input[type="password"], input[type="email"], textarea, select {
  font-size: 16px;
}

.screen { display: none; width: 100%; min-height: 100vh; }
.screen.active { display: block; }

/* ---------------- 標題畫面（GRP-UIREVAMP-U2 重新設計）----------------
   D1：跟遊戲畫面一樣是最多 480px 的單欄、置中，左右露出 body 的底色。
   Logo 用 Marcellus SC（只有 400 一種粗細）＋銅橘；副標用霞鶩文楷；登入卡上緣一條銅橘粗線當視覺錨點。 */
#screen-title.active { display: flex; align-items: center; justify-content: center; }
.title-stage {
  position: relative;
  text-align: center;
  width: 100%;
  max-width: 480px;
  padding: 48px 16px 32px;
}
.title-glow {
  position: absolute; inset: 0 0 auto 0; height: 260px;
  background: radial-gradient(ellipse at 50% 30%, var(--accent-glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.game-title {
  position: relative; z-index: 1;
  font-family: var(--font-logo);
  font-weight: 400;
  font-size: clamp(44px, 14vw, 64px);
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow), 0 2px 0 #00000066;
  margin: 0;
}
.game-subtitle {
  position: relative; z-index: 1;
  font-family: var(--font-head);
  letter-spacing: 0.3em;
  font-size: 14px;
  color: var(--head);
  margin: 8px 0 28px;
}
.title-menu { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
/* 存檔欄位 */
.slot-title { font-family: var(--font-head); color: var(--head); font-size: 18px; margin-bottom: 16px; }
.slot-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; padding: 0 10px; }
.slot-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.slot-item:hover { border-color: var(--accent); background: var(--panel-2); }
.slot-item.has-save { border-color: var(--accent); }
.slot-header { font-weight: 700; color: var(--head); min-width: 50px; }
.slot-info { flex: 1; font-size: 13px; color: var(--ink); }
.slot-item.empty-slot { opacity: 0.5; border-style: dashed; }
.slot-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.slot-pagination .btn-small.active { background: var(--accent); color: var(--bg); }
.slot-backup-btns { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }

.title-disclaimer {
  position: relative; z-index: 1;
  margin-top: 44px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-dim);
  opacity: 0.75;
}

/* ---------------- 按鈕通用 ---------------- */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  padding: 13px 40px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  cursor: pointer;
  min-width: 220px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }
/* U2：主要按鈕用規格 §7 的 btn-bg／btn-fg（4.80:1）＋銅橘外框（btn-line，負責跟面板分開） */
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-line); box-shadow: 0 4px 14px var(--accent-glow); }
.btn-secondary { background: transparent; color: var(--head); }
.btn-small { font-size: 12px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--panel-2); color: var(--head); cursor: pointer; }
.btn-small.ghost { border-color: var(--line); color: var(--ink-dim); }
.btn-small:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-tiny { font-size: 13px; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--accent); background: var(--panel-2); color: var(--head); cursor: pointer; }
.btn-tiny:disabled { opacity: 0.3; cursor: not-allowed; }
/* UI8：加點／升技能的「按不動」改用 class 而不是 disabled 屬性——
   disabled 的按鈕**不會發出 click 事件**，於是最常見的失敗（點數不足）按下去
   永遠沒有任何回饋，正是使用者抱怨的「按了沒反應」。改成看得出來按不動（半透明
   ＋ title 寫原因），但按得下去，按下去會講為什麼。不靠顏色分辨。 */
.btn-tiny.is-blocked, .btn-small.is-blocked { opacity: 0.3; cursor: not-allowed; }

/* ---------------- 線上版：登入／選角／連線狀態 ----------------
   色弱友善：每種狀態都有「圖示＋文字」（ui.js setOnlineMsg），邊框樣式也不同
   （錯誤＝粗實線、等待＝虛線、成功／資訊＝細實線），不靠紅綠區分。 */
.online-card { width: 100%; max-width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.online-card .slot-title { margin: 0 0 10px; }
.online-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink); text-align: left; }
.online-field .name-input { margin-bottom: 10px; }
.online-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.online-actions .btn { flex: 1 1 130px; min-width: 0; padding: 11px 20px; }
.online-hint { font-size: 12px; color: var(--ink-dim); text-align: center; margin: 6px 0 0; }
.online-msg { margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); text-align: left; }
.online-msg--error { border: 3px solid var(--bad); }
.online-msg--wait { border: 2px dashed var(--ink-dim); }
.online-msg--ok, .online-msg--info { border: 1px solid var(--accent); }
#screen-charselect.active { display: flex; align-items: center; justify-content: center; }
.charselect-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
/* U2：卡片左側一條銅橘粗邊（形狀訊號），名字用中文標題字 */
.charselect-card { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 12px; align-items: center; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.charselect-name { font-family: var(--font-head); font-size: 18px; color: var(--head); }
.charselect-sub { grid-column: 1; font-size: 13px; color: var(--ink); }
.charselect-card .btn { grid-column: 2; grid-row: 1 / span 2; min-width: 96px; padding: 10px 14px; font-size: 14px; }
/* GRP-CHARS15：測試伺服器每個帳號最多 15 個角色。清單自己捲動，標題與建立／登出鈕固定留在畫面裡；窄螢幕縮內距，長名字換行不溢出。 */
.charselect-list { max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.charselect-card { flex: 0 0 auto; min-width: 0; }
.charselect-name, .charselect-sub { min-width: 0; overflow-wrap: anywhere; }
.charselect-count { margin-top: 4px; }
.net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 300; padding: 10px 16px; text-align: center; font-size: 15px; font-weight: 700; color: var(--bg); background: var(--head); border-bottom: 3px solid var(--bg); }

/* ---------------- 創角畫面 ---------------- */
#screen-create.active { display: flex; align-items: center; justify-content: center; }
/* U2（D1）：選角與創角都收進 480px 欄位；小於 480 時左右各留 8px */
.create-stage { width: calc(100% - 16px); max-width: 464px; padding: 24px 16px; margin: 16px auto; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); }
.section-title { font-family: var(--font-head); font-weight: 700; color: var(--head); text-align: center; margin: 0 0 20px; }
.name-input {
  width: 100%; padding: 12px 14px; margin-bottom: 20px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--font-body); font-size: 15px;
}
.create-budget { text-align: center; color: var(--head); font-weight: 700; margin-bottom: 14px; }
.create-cap-hint { color: var(--ink-dim); font-weight: 400; font-size: 12px; }
.create-stat-row { display: grid; grid-template-columns: 1fr 26px 34px 26px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cs-name { font-size: 14px; color: var(--ink); }
.cs-desc { display: block; font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.cs-val { text-align: center; font-weight: 700; color: var(--head); }
.create-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.create-actions .btn { flex: 1 1 140px; min-width: 0; padding: 11px 16px; }

/* ---------------- 遊戲主畫面 ---------------- */
.game-shell { display: flex; flex-direction: column; height: auto; min-height: 100vh; max-width: 480px; margin: 0 auto; }

.hud-bar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 2px solid var(--accent);
}
.hud-left { min-width: 150px; max-width: 100%; }
/* 鋅幣（#hud-gold）併進角色名稱列（UI1）：加 flex-wrap，窄螢幕放不下時鋅幣自動換到下一行，
   不會把整列撐寬造成橫向溢出（見 UI1b 手機寬度自適應）。 */
/* UI7（#141）：align-items 從 baseline 改 center——這一列現在混了純文字（名字/職業/鋅幣）
   與按鈕（選角/關於/掛機收益，見下面 .btn-hud-name），baseline 對齊會讓按鈕的框看起來
   跟文字沒對齊，center 對兩種內容都自然。 */
.hud-name-row { font-weight: 700; color: var(--head); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; max-width: 100%; }
#hud-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* min-width:0 讓職業標籤在極端窄螢幕/超長名字擠壓下也能被 ellipsis 截斷，不會逼這一列橫向溢出。 */
.hud-job-tag { font-size: 12px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.hud-lv { font-size: 12px; color: var(--ink-dim); }
/* GRP-HUDPCTOUT（B7-4，C41）：header 的 .hud-bars（EXP／JOB 條）已搬到「能力」分頁（見 .char-exp-bars），這裡不再有那個容器。 */
/* UI1b 修主對話實機核實：min-width:0 是關鍵——flex item 預設 min-width:auto，
   會讓瀏覽器在計算「該不該縮/該不該換行」時，把 .hud-right 的縮小下限當成它
   內部子項「不換行時」的最大內容寬，於是即使外層可用空間不夠，它也不會真的
   縮小或觸發內部 flex-wrap；手機媒體查詢那條把 flex-shrink 由 0 改成 1 之後，
   要靠這個 min-width:0 才吃得到效果，兩者缺一都還是會溢出。 */
.hud-right { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; max-width: 100%; }
/* margin-left:auto（UI1b）：把鋅幣推到「角色名稱那一列」自己盒子的最右端，而不是
   緊接在職業標籤後面就結束。手機寬度下 .hud-left 有 flex:1 1 auto（見 RWD），
   這一列的盒子會撐到 .hud-right 開始之前，鋅幣因此真的貼齊到那條邊界；
   桌機寬度 .hud-left 是 shrink-to-fit（未改動、避免動到既有桌機版面），這一列
   的盒寬取決於它與 .hud-lv（等級列）兩者較寬的那個——名字/職業一般比等級列短時，
   鋅幣仍會貼齊到等級列那個寬度的右端；兩列一樣寬時才會退回「緊接在職業標籤後」。
   overflow/ellipsis 是防呆：鋅幣是會一直往上漲的數字（放置遊戲），沒有上限，
   多層防呆比只靠 nowrap 安全。 */
.hud-gold { color: var(--head); font-weight: 700; font-size: 14px; white-space: nowrap; margin-left: auto; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.btn-save { background: var(--panel-2); color: var(--head); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn-save:hover { background: var(--hover); }
/* UI7（#141）：選角／關於／掛機收益併入角色名稱列，.btn-save 原本是給桌機標頭用的大尺寸，
   這裡縮小字級與 padding 才塞得下（工單原文「太大就縮小按鈕（字級／padding）」）。 */
.btn-hud-name { padding: 3px 9px; font-size: 11px; }
.volume-controls { display: flex; flex-direction: column; gap: 2px; }
.volume-label { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--head); cursor: pointer; }
.volume-label input[type="range"] { width: 70px; height: 12px; accent-color: var(--accent); cursor: pointer; }
.volume-label span { width: 30px; text-align: right; font-size: 10px; }

/* 性別選擇 */
.create-gender-select { display: flex; align-items: center; gap: 12px; margin: 14px 0; justify-content: center; }
.btn-gender { background: var(--panel-2); color: var(--ink-dim); border: 2px solid var(--line); border-radius: 8px; padding: 8px 20px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.btn-gender:hover { border-color: var(--accent); color: var(--head); }
.btn-gender.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-jobchange { background: var(--bad-bg); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-weight: 700; cursor: pointer; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{ opacity:1;} 50%{ opacity:.6;} }

.bar-track { position: relative; height: 16px; background: var(--deep); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.bar-track.small { height: 10px; }
.bar-fill { height: 100%; transition: width .3s ease; }
.hp-fill { background: var(--hp); }
.hp-fill.low { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.30) 0 3px, rgba(255,255,255,0) 3px 6px), #FF0000; }
.sp-fill { background: var(--sp); }
.bexp-fill { background: linear-gradient(90deg, #8a6d1f, var(--accent)); }
.jexp-fill { background: linear-gradient(90deg, #5b6b9c, #8ea0dd); }
.bar-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--ink); text-shadow: 0 1px 2px #000; letter-spacing: .02em; }
.exp-track.small .bar-text { font-size: 9px; }

.game-body { flex: 1; display: flex; flex-direction: column; min-height: 0; height: auto; }

.battle-panel {
  flex: 1.3; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(227,154,82,0.06), transparent 60%),
    var(--bg);
  border-right: 1px solid var(--line);
  min-width: 0;
}
/* PERF1：opacity／filter 掛在「會被 transform 搬動」的 .map-bg-track 上（而不是不動的
   父層 .map-bg-layer），讓濾鏡與透明度跟著 track 一起被點陣化一次，走步捲動只是搬動
   已畫好的合成層，不必每幀對整片 3072px 大圖重算濾鏡（手機走步卡頓的頭號嫌疑）。
   視覺數值與之前完全一致，只是換了掛載的層。 */
.map-bg-layer { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.map-bg-track { display: flex; width: max-content; height: 100%; transform: translate3d(0,0,0); will-change: transform; opacity: 0.58; filter: saturate(0.72) brightness(0.68); }
/* GRP-BATTLEAREA（#126）：object-fit 改 cover＋下緣對齊。桌機外框是 width:auto（＝圖片本身比例），cover 跟 contain 畫出來一樣；
   手機寬在下面的 860px 媒體查詢把外框寬固定成 960px（＝圖高 320 × 3:1），cover 就只裁掉上方天空、左右不裁，兩張圖照樣接得起來。 */
.map-bg-track img { display: block; flex: 0 0 auto; width: auto; max-width: none; height: 100%; object-fit: cover; object-position: center bottom; }
/* .battle-panel > .combat-log 半支已移除（UI3b：.combat-log 整組 class 已不存在於
   DOM，理由見本檔後面 .combat-log 移除說明的大段註解）：這條選擇器只留 .monster-area。 */
.battle-panel > .monster-area { position: relative; z-index: 1; }
/* GRP-UI76 #76-1：⚙ 設定鈕從戰鬥區右上角（絕對定位）搬進 header 第二列（.hud-lv-row，等級那一列）靠右。
   flex:none＋固定寬高：不被擠扁；margin-left:auto 推到該列最右邊。
   22px 圓鈕、下外距 −6px：佔的排版高度（16px）不超過等級文字那一行，header 高度與改版前相同；
   多出來的 6px 只往下凸（下面是 EXP 條，中間有 8px 間距），不往上碰第一列的按鈕（量測見 tests/ui76-layout.test.js）。 */
.hud-lv-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-lv-row .hud-lv { min-width: 0; }
.btn-gear {
  flex: none; box-sizing: border-box; padding: 0; line-height: 1; margin: 0 0 -6px auto;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(18,20,28,0.65); border: 1px solid var(--accent);
  color: var(--head); font-size: 13px; cursor: pointer;
}
/* GRP-UI76 #79-6：換區域黑幕。節點由 js/ui.js playMapTransition() 臨時建立、播完移除；
   pointer-events:none 不擋點擊；z-index 蓋過戰鬥區所有內容。時長由 JS 寫在 inline animation-duration。 */
.map-transition {
  position: absolute; inset: 0; z-index: 30; pointer-events: none;
  background: #000; opacity: 0;
  animation: map-transition-fade 420ms ease-in-out forwards;
}
@keyframes map-transition-fade {
  0% { opacity: 0; }
  35% { opacity: 1; }
  55% { opacity: 1; }
  100% { opacity: 0; }
}
/* 減少動態效果：JS 本來就不建立黑幕；萬一節點存在（例如中途切換系統設定）也不播動畫 */
@media (prefers-reduced-motion: reduce) {
  .map-transition { animation: none !important; display: none; }
}
/* GM 測試面板：只有安全區才出現（原本疊在 ⚙ 設定鈕下面；⚙ 已搬到頂端 header，GRP-UI76） */
.gm-panel {
  position: absolute; top: 52px; right: 12px; z-index: 2;
  display: flex; flex-direction: column; gap: 4px; width: 116px;
  padding: 6px; border-radius: 8px;
  background: rgba(18,20,28,0.78); border: 1px solid var(--accent);
}
.gm-title { font-size: 10px; letter-spacing: 1px; color: var(--head); text-align: center; }
.gm-btn {
  font-size: 11px; padding: 4px 6px; border-radius: 6px; cursor: pointer;
  background: rgba(227,154,82,0.12); border: 1px solid var(--head); color: var(--ink);
}
.gm-btn:hover { background: rgba(227,154,82,0.28); }
/* GRP-C #15 設定頁：復用 .modal-overlay／.modal-box，這裡只補列的排法。
   360px 不能橫向捲動：每列 flex-wrap、滑桿 min-width:0，勾選列的長文字允許換行。 */
.settings-box { width: 420px; }
.settings-body { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; min-width: 0; }
.settings-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 14px; color: var(--ink); min-width: 0; cursor: pointer; }
.settings-row .settings-label { flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
.settings-row input[type=range] { flex: 1 1 0; min-width: 0; max-width: 100%; }
.settings-row .settings-val { flex: 0 0 auto; min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; color: var(--head); }
.settings-check { flex-wrap: nowrap; }
.settings-check .settings-label { flex: 1 1 0; }
.settings-check input[type=checkbox] { flex: 0 0 auto; width: 20px; height: 20px; }
/* GRP-C #16 Debug 面板：在 ⚙ 鈕左邊，等寬字、不擋操作（pointer-events:none）。
   白字配深底，數字靠文字本身讀，不靠顏色。 */
.debug-panel {
  position: absolute; top: 10px; right: 54px; z-index: 3; margin: 0;
  max-width: calc(100% - 66px); box-sizing: border-box; overflow: hidden;
  padding: 4px 6px; border-radius: 6px; pointer-events: none;
  background: rgba(11,19,15,0.82); border: 1px solid var(--ink-dim); color: #fff;
  font: 10px/1.35 ui-monospace, Consolas, monospace; white-space: pre;
}

/* ---------------- 隊友（#83）---------------- */
/* 站在玩家的上下方、往後靠（left 小一點），縮小一號才不會搶掉玩家 */
.ally-sprite { position: absolute; left: 4%; width: 84px; height: 112px; z-index: 1; }
#ally-sprite-0 { top: 8%; }
#ally-sprite-1 { bottom: 8%; }
.ally-figure { position: relative; width: 100%; height: 100%; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5)); }
.ally-figure.downed { filter: grayscale(1) brightness(.6); }
.ally-figure img { width: 100%; height: 76%; object-fit: contain; image-rendering: pixelated; }
.ally-tag {
  font-size: 10px; color: var(--ink-dim); text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.ally-hp { height: 3px; border-radius: 2px; background: rgba(0,0,0,0.55); overflow: hidden; }
.ally-hp-fill { height: 100%; background: linear-gradient(90deg, #10ef21, #3cff4d); }
.ally-hp-fill.low { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.30) 0 3px, rgba(255,255,255,0) 3px 6px), #FF0000; }

.ally-panel-close {
  background: none; border: none; color: var(--ink-dim); cursor: pointer; font-size: 13px;
}
.ally-panel-close:hover { color: var(--accent); }
.ally-num { width: 46px; padding: 1px 3px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 4px; }
.ally-sel { max-width: 150px; padding: 1px 3px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 4px; }
.ally-opt label { flex-wrap: wrap; }
.ally-range { width: 110px; vertical-align: middle; }
.ally-sec-toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; }
/* 隊友自動戰鬥區塊裡的說明小字（#105） */
.ally-note-sm { font-size: 11px; color: var(--ink-dim); margin: 4px 0 2px; line-height: 1.5; }
.ally-sec-toggle:hover { color: var(--accent); }
.ally-note { font-size: 11px; color: var(--ink-dim); line-height: 1.7; margin-bottom: 10px; }
.ally-sec {
  font-size: 11px; color: var(--head); margin: 12px 0 6px;
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.ally-empty { font-size: 11px; color: var(--ink-dim); padding: 4px 2px; }
.ally-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px; margin-bottom: 4px;
  background: var(--panel-2); border-radius: 6px; font-size: 11px;
}
.ally-row.downed { opacity: .6; }
.ally-row-name { width: 100px; max-width: 100%; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ally-row-job { width: 104px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ally-row-hp { width: 96px; color: var(--ink-dim); }
.ally-row-exp { flex: 1; color: var(--cost); text-align: right; }
.ally-row .btn-small.danger { border-color: #a35; color: #e79; }
.ally-opt { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--ink-dim); }
.ally-opt label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ally-stock { color: var(--head); }

.monster-area { flex: 1; display: flex; align-items: center; justify-content: center; }
.monster-area-multi { display: flex; gap: 16px; justify-content: center; align-items: flex-end; flex-wrap: wrap; padding: 10px; }
.monster-empty { color: var(--ink-dim); font-size: 13px; }
.monster-card { text-align: center; min-width: 100px; }
.monster-card.target { border: 2px solid var(--accent); border-radius: 12px; padding: 8px; background: rgba(227,154,82,0.05); }

/* 戰鬥場景佈局：左1/3玩家 + 右2/3怪物半圓 */
.battle-scene {
  /* W6：上方 HUD 一列＋下方 10 格棋盤（docs/board-combat-spec.md §7.1）。 */
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}
/* UI7（#141）：HP/SP 條的容器，寬度貼合立繪（120px）而非沿用 HUD 那組 max-width:460px
   的長條——「縮短長度」是工單原文要求。 */
.player-bars {
  width: 110px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1;
}
/* GRP-BATTLEAREA（130-5）：條高 12→16px、字 8→11px（手機上看得清楚數字）。 */
.player-bar-track { height: 16px; }
.player-bars .bar-text { font-size: 11px; }
/* GRP-UIREVAMP-U4（B1-4）：#hud-ail 已搬出 .player-bars（HP 與 SP 中間不再留 16px 空行），
   改放在戰鬥區下方的狀態列 .battle-status-row，規則見 .battle-status-row。 */
.player-sprite {
  width: 120px;
  height: 160px;
  position: relative;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}
.player-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* 動畫畫布靠底置中：基本姿勢與施放姿勢的原圖尺寸不同，等比縮放後
   要對齊腳底，人才不會在切換姿勢時上下跳。 */
.player-anim-canvas {
  position: absolute; image-rendering: auto;
  /* left / margin-left / bottom 由 sizeAnimCanvas() 依非透明邊界框算出來 */
}

/* ---- 技能特效 ---- */
/* 施放瞬間疊上去的詠唱姿勢。原圖是 56×74 的點陣素材，放大要用 pixelated，
   不然會糊掉跟旁邊的角色動畫對不上風格。 */
.skill-cast-sprite {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  animation: skillCastFade 0.9s ease-out forwards;
}
@keyframes skillCastFade {
  0%   { opacity: 0;    transform: scale(1.12); }
  15%  { opacity: 1;    transform: scale(1); }
  70%  { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.04); }
}

/* 雙手劍加速：效果持續中角色整個散發金黃色光芒。三層疊出來：
     ::before  背後的發散光暈（z-index:-1）
     filter    角色本體染成金色 + 沿輪廓的描邊光
               色彩那幾道要放在 drop-shadow 前面，才不會連影子一起被染
     ::after   壓在人物之上的金色光斑（z-index:2，screen 疊加）
               父層有 filter 會自成一個合成群組，所以 mix-blend-mode 是跟角色本身混色
   不做呼吸動畫，三層都固定在較淡的那組數值（原本脈動的最暗端）。 */
.player-sprite.aura-quicken {
  filter: sepia(0.32) saturate(1.9) hue-rotate(-8deg) brightness(1.10)
          drop-shadow(0 4px 12px rgba(0,0,0,0.5))
          drop-shadow(0 0 4px rgba(255, 218, 110, 0.85))
          drop-shadow(0 0 10px rgba(255, 176, 30, 0.55));
}
.player-sprite.aura-quicken::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  /* 尺寸已經把原本脈動最暗端的 scale(0.94) 乘進去了，所以不再另外縮放 */
  width: 122%; height: 111%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
              rgba(255, 214, 92, 0.42) 0%,
              rgba(255, 176, 32, 0.20) 45%,
              rgba(255, 160, 20, 0) 72%);
  opacity: 0.65;
  pointer-events: none;
  z-index: -1;
}
.player-sprite.aura-quicken::after {
  content: '';
  position: absolute;
  left: 50%; top: 52%;
  width: 112%; height: 104%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
              rgba(255, 240, 175, 0.50) 0%,
              rgba(255, 205, 70, 0.30) 42%,
              rgba(255, 170, 20, 0) 72%);
  opacity: 0.55;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
}
.monster-slot {
  position: absolute;
  text-align: center;
  transition: all 0.3s ease;
}
/* UI4：寬高不再寫死——改成依原圖尺寸乘裝置縮放，由 js/ui.js 的
   applyMonsterImgSize() 在 <img onload> 時算好、寫成行內 style。
   object-fit:contain 留著當保險（理論上行內寬高已經等於原圖比例，
   不會用到，但留著無害）。 */
.monster-slot img {
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
  image-rendering: pixelated;
}
.monster-visual {
  display: inline-block;
  will-change: transform;
}
/* UI11：待機浮動的相位由 --ph（秒，js 依怪物 id 給）錯開，整排不會同步上下；
   受擊 140ms（≤150ms）：閃白（filter）＋往右後仰（怪物從右邊來、被往回打）＋短震動。 */
.monster-idle-float { animation: monster-idle-float 2.4s ease-in-out calc(var(--ph, 0) * -1s) infinite; }
.monster-hit-shake { animation: monster-hit-shake 140ms ease-out, monster-idle-float 2.4s ease-in-out calc(140ms - var(--ph, 0) * 1s) infinite; }
@keyframes monster-idle-float {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-3px) scaleY(1.015); }
}
@keyframes monster-hit-shake {
  0% { transform: translateX(0) rotate(0deg); filter: brightness(2.4) saturate(0.4); }
  30% { transform: translateX(4px) rotate(5deg); filter: brightness(1.9) saturate(0.6); }
  60% { transform: translateX(-2px) rotate(-1deg); filter: brightness(1.2); }
  100% { transform: translateX(0) rotate(0deg); filter: brightness(1); }
}
/* 受擊只閃白、不位移（prefers-reduced-motion 用） */
@keyframes monster-hit-flash {
  0% { filter: brightness(2.4) saturate(0.4); }
  100% { filter: brightness(1); }
}
.monster-slot .monster-name {
  font-size: 11px;
  margin-top: 2px;
}
.monster-slot .monster-hp-bar {
  width: 70px;
  height: 6px;
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  margin: 2px auto;
  overflow: hidden;
}
.monster-slot .monster-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF00E7, #ff5cef);
  transition: width 0.2s ease;
}
.monster-slot .monster-hp-fill.low {
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0.40) 0 3px, rgba(0,0,0,0) 3px 6px), #FFFF00;
}
/* 玩家的異常狀態圖示。
   GRP-BATTLEFIX-FIX1／FIX2：列高固定、不准折行，塞不下就在列內左右捲。圖示旁有名稱文字（色弱：不只靠顏色）。
   GRP-UIREVAMP-U4（B1-4，使用者 2026-10-09）：從 HP／SP 中間（永遠佔 16px＋上下 2px）搬到戰鬥區下方狀態列的最左邊，
   跟增益列 #battle-buffs 同一行。列高 24px（＝增益標籤高），沒有異常時整塊不佔寬度（:empty）。
   有異常時右邊一條虛線把它跟增益隔開（不靠顏色）。 */
.hud-ail {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1;
  box-sizing: border-box;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
}
.hud-ail::-webkit-scrollbar { height: 3px; }
.hud-ail::-webkit-scrollbar-thumb { background: rgba(238,240,229,0.45); border-radius: 2px; }
.ail-mark {
  display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto;
  white-space: nowrap; font-size: 11px; line-height: 1;
}
.ail-ic { width: 16px; height: 16px; flex: 0 0 16px; image-rendering: pixelated; display: block; }
.ail-name { font-size: 11px; line-height: 1; }
/* 臨時減益（挑釁／緩緩移動／永恆之光）：跟異常狀態同一排，用底色區分
   ——那些是有名字的十種狀態，這些是純數值削弱 */
.hud-ail .p-debuff {
  background: rgba(200, 60, 60, 0.25);
  border-radius: 3px;
  padding: 0 1px;
}

/* 怪物的異常狀態圖示：跟在 HP 數字下面，沒有狀態時整列不佔高度 */
.monster-slot .monster-ail {
  display: flex;
  justify-content: center;
  gap: 2px;
  font-size: 13px;
  line-height: 1;
  min-height: 0;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}
.monster-slot .monster-ail:not(:empty) { margin-top: 2px; }
/* 怪物自己的增益（#36）：跟異常狀態同一排，加個底色區分敵我 */
.monster-slot .monster-ail .mon-buff {
  background: rgba(255, 200, 60, 0.22);
  border-radius: 3px;
  padding: 0 1px;
}
.monster-slot.target .monster-ail { font-size: 16px; }
.monster-slot.target {
  /* transform handled by inline style */
}
/* UI4：.monster-slot.target img { width:96px; height:96px } 已刪除——
   目標怪跟旁邊的怪現在共用同一套「原圖尺寸 × 裝置縮放」邏輯
   （applyMonsterImgSize()，主目標乘 1、旁邊乘 MONSTER_SIDE_SCALE_FACTOR），
   這條固定尺寸的規則已經是死碼（一律被行內 style 蓋掉）。 */
/* ---------------- 十格棋盤（W6；docs/board-combat-spec.md §7.1）----------------
   色弱規則（全域鐵律）：每一種狀態都有顏色以外的訊號——文字、符號、底框線型、紋理；顏色只是輔助。
   GRP-BOARDMARGIN（B6-8，使用者 2026-10-10 裁決 C32／C33）：
   ・戰鬥區（#battle-scene）固定用 480px 寬排版，整塊依實際寬度等比縮放（js/ui.js battleZoomSync 寫 --battle-z，上限 1）。
     所以棋盤永遠是 480 寬，舊的寬格／窄格兩套規則合成一套（以寬格為準），不再有 @container 切換。
   ・棋盤左右各留 --board-pad（24px＝舊格寬 48 的一半）：中間 432px 平分 10 格（每格 43.2px），格號在每格正中。
     #board 仍是 inline-size container：.cell 的 --cell-w: 10cqi 量的是扣掉留白後的內容寬，自動等於一格寬。
   .bw（詞語）一律顯示、.bn（單一字元）一律隱藏；兩組都還在 DOM 裡（js 照舊產生）。 */
.board-hud {
  flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  padding: 6px 52px 4px 8px; position: relative; z-index: 2; min-width: 0;
}
/* GRP-HUDPCTOUT（B7-4，#202-5／#229；使用者 C41）：百分比搬到條外——每條是「條子＋百分比」一列（.player-bar-row）。
   條子 160px（內寬 158）：全遊戲最壞值段「HP 999,999/999,999」在 14.67px 粗體、letter-spacing 0 約 145px，要完整放得下、不准省略號吃掉任何一位
   （改前 140px／內寬 138 連五位數都少一位，見 docs/tickets/grpbattlescale-fix1-verify-report.md 第 1 條；實量見 docs/tickets/grphudpctout-report.md）。
   百分比 .bar-pct 12px 粗體＋黑描邊（與條內字同一套描邊）、min-width 46px（「100.0%」約 44px）讓條子不隨數字跳動；
   一列高仍是條子的 16px（百分比 line-height 16），兩列＋gap 3 ＝ 35，.board-hud 總高 45 排版 px 不變、不會把 #board 往下推。
   色弱：HP／SP 的區分靠條內的「HP」「SP」文字，不只靠顏色。 */
.board-hud .player-bars { width: 212px; max-width: 60%; }
.player-bar-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.player-bar-row .player-bar-track { flex: 0 0 160px; width: 160px; min-width: 0; }
.board-hud .bar-pct {
  flex: 0 0 auto; min-width: 46px; font-size: 12px; line-height: 16px; font-weight: 700; color: #fff; white-space: nowrap;
  text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000;
}
/* GRP-HUDPCTOUT（B7-4，C41）：EXP／JOB EXP 條從 header 搬到「能力」分頁最上方（js/ui.js charExpBarsHtml），百分比在條外右側。
   條子吃剩下的寬（flex:1），百分比固定最小寬 48px 靠右；條內字維持 .bar-text 10px／.small 9px。 */
.char-exp-bars { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.char-exp-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.char-exp-row .bar-track { flex: 1 1 auto; min-width: 0; }
.char-exp-row .bar-pct { flex: 0 0 auto; min-width: 48px; text-align: right; font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
/* UI11 HUD：圓角深色底、描邊數字。GRP-BATTLEAREA（130-5）：拿掉上半部白色高光（壓低白字對比）；
   HUD 因條子加高長了約 8px，手機戰鬥區的總高在 860px 媒體查詢裡一起排（.battle-panel height）。 */
.board-hud .player-bar-track {
  border: 1px solid rgba(238,240,229,0.55); border-radius: 7px;
  background: linear-gradient(180deg, rgba(6,7,12,0.88), rgba(24,26,36,0.88));
  box-shadow: 0 1px 3px rgba(0,0,0,0.65);
}
/* GRP-BATTLEAREA（130-5）：HUD 的 HP／SP 填色改成純色、調暗到白字對比 ≥ 4.5:1（WCAG 相對亮度公式，算式見 docs/tickets/grpbattlearea-report.md）：
   #1a7f2b 對白 5.10:1、#1863de 對白 5.42:1（舊的 #10ef21 只有 1.57:1）。只限 HUD（.hp-fill／.sp-fill 是全站共用的）。
   ⚠ .board-hud .hp-fill 與 .hp-fill.low 權重相同、寫在後面的贏 ⇒ 低血那條要另外寫一條 .board-hud .hp-fill.low，紅＋斜紋才不會被蓋掉。 */
.board-hud .hp-fill { background: #1a7f2b; }
.board-hud .sp-fill { background: #1863de; }
.board-hud .hp-fill.low { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.30) 0 3px, rgba(255,255,255,0) 3px 6px), #FF0000; }
.board-hud .player-bars .bar-text {
  z-index: 1; font-weight: 700; color: #fff; letter-spacing: .04em;
  text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000;
}
/* 標籤只加 4px 左右內距、間距 4px：比舊版素字（gap 10px）總寬不增加，手機寬 HUD 仍是一列、不會長高把 #board 往下推 */
.board-status { display: flex; flex-wrap: wrap; gap: 2px 4px; font-size: 12px; color: var(--ink); min-width: 0; }
.board-status > span {
  white-space: nowrap; font-weight: 700; line-height: 15px; padding: 0 4px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,33,46,0.86), rgba(11,19,15,0.86));
  border: 1px solid rgba(238,240,229,0.35); box-shadow: 0 1px 3px rgba(0,0,0,0.55);
  text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000;
}
.board-countdown { color: var(--head); border-color: rgba(232,201,106,0.6) !important; }
/* 固定手機版面：字級 11px、內距 3px；標籤區佔住 HP／SP 條右邊剩下的寬度（flex 1 1 0），放不下時在自己裡面折成兩列
   （每列 14px＋間距 2px＝30px，跟左邊兩條 HP／SP 的總高相同），不會整塊掉到下一列把 HUD 撐高、把 #board 往下推 */
.board-status { font-size: 11px; gap: 2px 3px; flex: 1 1 0; }
.board-status > span { padding: 0 3px; line-height: 12px; }
/* UI11 暗角：背景之上、棋盤之下的一層淡漸層，搭配 .map-bg-layer 的明暗濾鏡讓角色從背景裡浮出來 */
.battle-scene::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 85% 75% at 50% 62%, transparent 55%, rgba(0,0,0,0.38) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.22), transparent 22%, transparent 70%, rgba(0,0,0,0.28));
}
.board {
  flex: 1 1 auto; min-height: 170px; position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  container: board / inline-size;
  --board-pad: 24px;
  padding: 0 var(--board-pad); gap: 0;
  --unit-scale: .45;
  /* GRP-UNITSCALE（#98）：棋盤怪物顯示大小＝原圖 × scale × 格寬係數 --mon-k（有調整工具設定的照 data/unit-scales.json；
     沒調過的 scale＝1，GRP-UNITSCALE-FIX1 的 B 案）。
     ⭐ 這個數字是唯一真相源：要調係數只改這一行。js/ui.js 的飄字（FLOAT_GEOM.monK）在執行時從這裡讀，
     tests/unitscale-*.test.js 的期望值也從這裡讀。GRP-BOARDMARGIN：寬格／窄格合成一套，格子與單位直接繼承這個值。
     GRP-BATTLESCALE（B9-1，使用者 2026-10-11 選「以手機 360 寬為準」）：1 → 0.95＝舊窄格 0.71 ÷ 0.75（360 寬的縮放比），
     360 寬縮放後 0.7125 ≈ 改版前的手機人物大小；電腦寬（縮放比 1）人物因此比 BOARDMARGIN 小 5%（使用者接受的副作用）。
     GRP-BATTLESCALE393（B9-12，使用者 2026-10-11 改以 iPhone 15 Pro 393 寬為準）：0.95 → 0.867＝舊窄格 0.71 ÷ 0.81875（393 ÷ 480）。
     393 寬縮放後 0.71＝改版前；360 寬小約 8%、412 寬小約 5%（使用者接受）。 */
  --mon-k: 0.867;
  /* UI11：拿掉除錯感的整條格線，改成每格腳下一塊極淡的地面落點（橢圓）＋底部一層地面陰影。
     GRP-FLT（#43）：會跟著走步捲動的落點橢圓搬到獨立的 .board-ground 層（只改 transform，不再每幀重畫整塊棋盤）；
     .board 自己只留不捲動的那一層（純垂直漸層，水平捲動本來就看不出來）。 */
  background-image: linear-gradient(180deg, transparent 72%, rgba(0,0,0,0.20));
  background-size: 100% 100%;
}
/* GRP-FLT（#43）：地面落點層。最後一個子節點（.cell:first-child 的規則照舊成立）、z-index:-1 畫在格子底下、
   不吃點擊；軌道比棋盤寬一格（11 格），背景每格一塊（background-size 100%/11 ＝ 一格寬，橢圓的 36%／5% 仍是相對一格），
   js 只寫軌道的 transform（translate3d(−步進度×100/11 %)＝往左捲步進度格）。 */
/* GRP-BOARDMARGIN：只蓋格子那一段（扣掉左右留白），軌道 11/10 與每格一塊橢圓才會跟格子對齊 */
.board-ground { position: absolute; top: 0; bottom: 0; left: var(--board-pad, 0px); right: var(--board-pad, 0px); z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.board-ground-track {
  position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% * 11 / 10);
  background-image: radial-gradient(ellipse 36% 5% at 50% calc(100% - 37px), rgba(255,246,214,0.10), rgba(255,246,214,0.04) 60%, transparent 100%);
  background-size: calc(100% / 11) 100%;
  transform: translate3d(0,0,0); will-change: transform;
}
/* GRP-UIREVAMP-U4（B1-3／B1-4）：地平線 --ground 窄格 30→50、寬格 32→52。HUD 拿掉 #hud-ail 後棋盤長高約 23px，
   把多出來的高度放到腳下：腳底以下到第 1 隻血條下緣的空間從 21px 變 41px（窄格），同格多隻的異常列與 13 顆以上的圖示才放得下。
   立繪頭頂的餘裕不變（棋盤長高的量 ≥ 地平線上移的量）。地面落點橢圓、場域圖示跟著上移 20px；飄字的 FLOAT_GEOM.ground 一起改。 */
.cell {
  /* min-height：格子的內容全是 absolute，舊版靠 3px 底線撐出高度；UI11 拿掉底線後補一個最小高度，
     #board 一旦不是 grid（tests/ui10-layout.test.js 的 CTRL-C 對照組）10 格才會真的上下疊開、量得出欄數塌掉 */
  position: relative; min-width: 0; min-height: 3px; --cell-w: 10cqi; --ground: 52px;
  cursor: pointer;
}
/* GRP-UNITSCALE：格寬係數 --mon-k 由 .board 繼承下來（GRP-BOARDMARGIN 起只有一套，不再分寬格／窄格） */
/* 滑過的格子：極淡的落點框（站位調整時看得出是哪一格） */
.cell:hover { background: linear-gradient(180deg, transparent 60%, rgba(255,246,214,0.06)); }
/* 場域技能覆蓋格：斜線紋理（不靠顏色）＋技能圖示＋剩餘秒數 */
.cell.has-field {
  background-image: repeating-linear-gradient(45deg, rgba(255,190,90,0.30) 0 3px, transparent 3px 8px);
}
.cell-field { position: absolute; left: 0; right: 0; bottom: calc(var(--ground, 50px) - 16px); text-align: center; font-size: 11px; line-height: 1.1; pointer-events: none; }
.cell-field-icon { filter: drop-shadow(0 1px 1px #000); }
.cell-field-sec {
  font-size: 9px; display: block; overflow-wrap: anywhere; font-weight: 700; margin: 1px 2px 0; border-radius: 6px; padding: 0 3px;
  background: rgba(11,19,15,0.72); border: 1px solid rgba(255,190,90,0.55); text-shadow: 0 1px 1px #000;
}
/* UI11：格號平常隱藏（透明，仍在 DOM 裡），滑過格子或角色分頁開著（調站位）時才出現
   GRP-BOARDUI（#192-3）：格號水平置中在「這一格實際畫出來的盒子」（舊版貼左上角 left:2px，第 1 格右移半格後 1 與 2 擠在一起）。
   位置只由 --cell-num-x 決定（相對這一格自己的寬，號碼中心點）。主對話裁決先用 A 案：每格 50%（第 1 格盒子已右移半格 ⇒ 號碼在 1.0 格寬）。
   GRP-BOARDMARGIN（C32）：第 1 格不再右移半格（改成整個棋盤左右各留半格），每一格的號碼都在自己那格正中（50%），沒有特例。 */
.cell { --cell-num-x: 50%; }
.cell-num {
  /* GRP-BATTLESCALE：舊窄格 9px／行高 12／最小寬 12 ÷ 0.75 ⇒ 字 12（不變）、行高 16、最小寬 16（360 寬縮放後＝改版前的 9／12／12）。
     GRP-BATTLESCALE393：改 ÷ 0.81875（393 寬）⇒ 字 12（10.99 走 C33 下限）、行高 14.66、最小寬 14.66。 */
  position: absolute; left: var(--cell-num-x, 50%); transform: translateX(-50%); top: 1px; font-size: 12px; line-height: 14.66px; color: var(--ink); font-weight: 700;
  min-width: 14.66px; text-align: center; border-radius: 6px; background: rgba(11,19,15,0.7); border: 1px solid rgba(238,240,229,0.35);
  opacity: 0; transition: opacity 120ms ease-out; pointer-events: none;
}
.cell:hover .cell-num, .board.board-show-nums .cell-num { opacity: 1; }
/* GRP-BOARDUI（#192-3）：格號改成頂端置中後，跟寬格的同格隻數標籤（.cell-badges「×N」，也是頂端置中）同一個位置。
   格號看得見的時候（滑過、打怪設定分頁）把標籤往下挪一列（格號外高＋1px 頂距＋1px 間隔），兩個都看得到。
   GRP-BATTLESCALE：格號行高 14 → 16（舊窄格 12 ÷ 0.75）⇒ 外高 18 ⇒ 1 ＋ 18 ＋ 1 ＝ 20px（舊 18；tests/boardui-browser.test.js BOARDUI-5 量「格號與 ×N 不重疊」）。
   GRP-BATTLESCALE393：行高 14.66 ⇒ 外高 16.66 ⇒ 1 ＋ 16.66 ＋ 1 ＝ 18.66px。 */
.cell:hover .cell-badges, .board.board-show-nums .cell-badges { top: 18.66px; }
.cell-badges { position: absolute; z-index: 13; left: 0; right: 0; top: 1px; text-align: center; font-size: 9px; line-height: 1.2; word-break: break-all; pointer-events: none; }
/* UI11 統一標籤語言：半透明深底＋淡描邊＋圓角＋粗體描邊字（.cell-badge、.bm-badge、.bm-sym、.unit-label、待生） */
.cell-badge, .bm-badge, .bm-sym, .unit-label, .cell-wait-spawn:not(:empty) {
  background: linear-gradient(180deg, rgba(34,37,52,0.88), rgba(11,19,15,0.88));
  border: 1px solid rgba(238,240,229,0.38); border-radius: 6px;
  color: var(--ink); font-weight: 700;
  text-shadow: 0 1px 1px #000, 0 0 2px #000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
.cell-badge { padding: 0 2px; }
.cell-wait-spawn { position: absolute; right: 1px; top: 1px; font-size: 9px; line-height: 1.2; pointer-events: none; }
/* 待生：虛線框（不靠顏色） */
.cell-wait-spawn:not(:empty) { border: 1px dashed var(--head); padding: 0 2px; color: var(--head); }
.cell-units { position: absolute; inset: 0; pointer-events: none; }
/* GRP-UNITSCALE（#97）：同格多隻怪的圖層——先抵達的在前、晚到的在後（js 依抵達先後給每隻 --z）。
   isolation 讓 --z 只在這一格內比較，不會跟別格的怪或格子徽章（.cell-badges）互相插隊。
   GRP-BOARDFIX2（findings #104）：不同格的大圖互相重疊時，離玩家近的格畫在前——每格的怪物層 z-index＝11 − 格號
   （第 1 格 10、第 10 格 1；棋盤的子節點依序是第 1～10 格，最後才是 .board-ground，所以 nth-child(n)＝第 n 格）。
   我方單位（.board-unit 12）與格子徽章（.cell-badges 13）跟著墊高，維持「蓋在所有怪物之上」的舊關係。 */
.cell-mons { position: absolute; inset: 0; pointer-events: none; isolation: isolate; z-index: var(--cz, 1); }
.cell:nth-child(1) { --cz: 10; } .cell:nth-child(2) { --cz: 9; } .cell:nth-child(3) { --cz: 8; }
.cell:nth-child(4) { --cz: 7; } .cell:nth-child(5) { --cz: 6; } .cell:nth-child(6) { --cz: 5; }
.cell:nth-child(7) { --cz: 4; } .cell:nth-child(8) { --cz: 3; } .cell:nth-child(9) { --cz: 2; }
.cell:nth-child(10) { --cz: 1; }

/* 怪物：外層 .monster-slot 只負責 translateX（走路的小數格、擊退滑動），
   .monster-visual 自己的 transform 留給待機浮動與受擊抖動（FX5）。舊版 .monster-slot 的
   transition: all 會讓每幀插值延遲，這裡一律關掉，只有擊退那 200ms 開。 */
.monster-slot.bm {
  position: absolute; inset: 0; text-align: center; transition: none;
  transform: translateX(calc(var(--dx, 0) * var(--cell-w, 36px)));
  z-index: var(--z, 0);
}
.monster-slot.bm.bm-kb { transition: transform 200ms ease-out; }
/* UNITBAR：怪物血條固定在腳下；同格第 k 隻按血條外高往上緊貼堆疊，不受怪物圖片高度影響。
   GRP-BATTLESCALE（B9-1）：照舊窄格值 ÷ 0.75——高 5 → 6.67px、寬上限 64 → 85.33px（86% 這個比例不換算）、
   bottom 的 −9px／k × 7px → −12px／k × 9.33px（js BOARD_UNDER.hpGap 同步 12）。360 寬縮放後血條高 5px＝改版前。
   GRP-BATTLESCALE393：改 ÷ 0.81875——高 6.11px、寬上限 78.17px、bottom −10.99px／k × 8.55px（hpGap 同步 10.99）。393 寬縮放後高 5px＝改版前。 */
.bm-hp {
  position: absolute; left: 50%; width: min(86%, 78.17px); bottom: calc(var(--ground, 52px) - 10.99px + var(--k, 0) * 8.55px + var(--hp-lift, 0px)); height: 6.11px; z-index: 3;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--deep), var(--field)); border: 1px solid rgba(0,0,0,0.9); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(238,240,229,0.30), 0 1px 2px rgba(0,0,0,0.6);
}
.bm-hp .monster-hp-fill {
  height: 100%; border-radius: 2px; transition: width 0.25s ease-out;
  background: linear-gradient(180deg, rgba(255,255,255,0.30), rgba(255,255,255,0) 55%), linear-gradient(90deg, #FF00E7, #ff5cef);
}
.bm-hp .monster-hp-fill.low {
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0.40) 0 3px, rgba(0,0,0,0) 3px 6px), #FFFF00;
}
.bm-body {
  /* 寬度用 100%（格子扣掉左邊框的內容寬）而不是 --cell-w：後者比格子內容寬多出邊框那 1px，第 10 格會超出棋盤 0.5px */
  position: absolute; left: 50%; bottom: calc(var(--ground, 30px) + var(--k, 0) * 4px); width: 100%;
  /* 堆疊錯位 k × 6px（§7.1 建議值），夾在格寬 10% 以內；方向 --sdir 由 js 依格子給（右半邊往左），永遠不超出棋盤（驗收退件 B2） */
  transform: translateX(calc(-50% + var(--k, 0) * var(--sdir, 1) * min(6px, var(--cell-w, 36px) * 0.1)));
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
/* UI11 出生：從右側淡入（獨立的 translate 屬性，不碰上面那條 transform） */
.bm-body.bm-spawn { animation: bm-spawn 420ms cubic-bezier(.2,.8,.3,1) both; }
@keyframes bm-spawn {
  0% { opacity: 0; translate: 14px 0; }
  100% { opacity: 1; translate: 0 0; }
}
/* UI11 死亡殘影：閃白後縮小淡出（js 把離場節點就地改成 .bm.bm-ghost，420ms 後移除） */
.bm.bm-ghost { position: absolute; inset: 0; pointer-events: none; transform: translateX(calc(var(--dx, 0) * var(--cell-w, 36px))); }
.bm.bm-ghost .bm-hp, .bm.bm-ghost .bm-syms, .bm.bm-ghost .bm-tags, .bm.bm-ghost .monster-ail { visibility: hidden; }
.bm.bm-ghost .bm-fig { animation: bm-death 420ms ease-in forwards; transform-origin: 50% 100%; }
@keyframes bm-death {
  0% { opacity: 1; transform: scale(1); filter: brightness(1); }
  22% { opacity: 1; transform: scale(1.08); filter: brightness(2.6) saturate(0.3); }
  100% { opacity: 0; transform: scale(0.55); filter: brightness(1.6) saturate(0.2); }
}
/* UI11：立繪外框 .bm-fig——腳下影子（::before）與三態底框（::after）畫在這裡，不跟著待機浮動 */
/* GRPA-A2：.bm-fig 的下緣＝怪物腳底＝地平線（玩家的 .unit-fig 下緣也落在同一條線，見 --ground） */
.bm-fig { position: relative; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 0; }
.bm-fig::before {
  content: ''; position: absolute; left: 50%; bottom: -1px; width: 86%; height: 8px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,0.62), rgba(0,0,0,0.30) 55%, transparent 72%);
  pointer-events: none;
}
/* 怪物三態的底框線型：停下實線、走路虛線、等待點線（§7.1 色弱訊號；UI11 改畫成腳下的橢圓圈，線型不變） */
.bm-fig::after {
  content: ''; position: absolute; left: 50%; bottom: 0; width: 78%; height: 7px; transform: translateX(-50%);
  border: 2px solid rgba(240,234,210,0.85); border-radius: 50%; pointer-events: none; box-sizing: border-box;
}
.bm.st-stop .bm-fig::after { border-style: solid; }
.bm.st-walk .bm-fig::after { border-style: dashed; }
.bm.st-wait .bm-fig::after { border-style: dotted; }
.bm .monster-visual { position: relative; z-index: 1; border-radius: 6px; }
/* 被任一單位鎖定：粗外框（線粗是第二訊號，另有「目標·玩」或 ▼ ① ② 文字）；UI11 加圓角與光暈 */
.bm.bm-targeted .monster-visual { outline: 3px solid var(--head); outline-offset: 1px; box-shadow: 0 0 8px rgba(232,201,106,0.55); }
/* GRPA-A1：顯示高度只由體型決定（MONSTERS[defId].size → js 掛 .sz-small／.sz-medium／.sz-large，缺欄位當 medium），
   與原圖大小無關；寬度依比例（object-fit:contain、腳底貼齊）。
   GRP-BOARDMARGIN（使用者 2026-10-10）：拿掉「寬度 ≤ 格寬 96%」的上限——所有單位都可以超出格子（跟有設定的 .us 一樣）。
   GRP-BATTLESCALE（B9-1）：體型高度照舊窄格值 ÷ 0.75——中 46 → 61.33、小 34 → 45.33、大 58 → 77.33（js FLOAT_GEOM.monH 同步）。
   GRP-BATTLESCALE393：改 ÷ 0.81875——中 56.18、小 41.53、大 70.84。 */
.bm { --mon-h: 56.18px; }
.bm.sz-small { --mon-h: 41.53px; }
.bm.sz-large { --mon-h: 70.84px; }
.bm .monster-visual img {
  display: block;
  height: var(--mon-h); width: auto; max-width: none;
  object-fit: contain; object-position: 50% 100%; image-rendering: pixelated;
  /* GRP-FLT（#43）：拿掉 filter: drop-shadow——它讓每隻怪在棋盤重畫時都要重算陰影（怪越多越卡）。
     影子改由不跟著浮動的 .bm-fig::before 橢圓負責（UI11 起就有）。⚠ 必須明寫 none：比較寬鬆的
     `.monster-slot img` 也命中棋盤上的怪，只刪掉這一行會讓那條更大更糊的 drop-shadow 接手。 */
  filter: none;
}
/* GRP-UNITSCALE（#98）：有調整工具設定的怪（js 掛 .us 與 --uw／--uh／--uox／--uoy，單位 px＝原圖 × scale）。
   照 scripts/unit-scale-tuner/index.html 的 geom()：大小＝原圖 × scale（× 格寬係數 --mon-k），不套體型高度、不設格寬上限
   （單位可以超出格子寬度）；原圖下緣貼地，offsetY 正值往上、offsetX 正值往右（同樣 × scale × --mon-k）。
   ・往上／往下用 margin-bottom：.monster-visual 的頂端（血條、飄字的基準）跟著圖片頂端走，腳下影子留在地面。
   ・往左／往右用獨立的 translate 屬性：走路小跳步（img 的 transform）、待機浮動（.monster-visual 的 transform）照常疊加；
     血條、影子、飄字留在格子中心（offsetX 是把圖片裡偏一邊的身體挪回格子中心）。 */
.bm.us .monster-visual img {
  width: calc(var(--uw) * var(--mon-k, 1)); height: calc(var(--uh) * var(--mon-k, 1)); max-width: none;
  margin-bottom: calc(var(--uoy) * var(--mon-k, 1));
  translate: calc(var(--uox) * var(--mon-k, 1)) 0;
}
/* GRPA-A3：走路小跳步——只動圖片內層（外框 .monster-slot 的 --dx、.monster-visual 的待機浮動／受擊都不碰），只用 transform */
.bm.st-walk .monster-visual img {
  transform-origin: 50% 100%;
  animation: bm-walk-hop 0.5s ease-in-out calc(var(--ph, 0) * -0.2s) infinite;
}
@keyframes bm-walk-hop {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  25% { transform: translateY(-2.5px) rotate(0deg); }
  50% { transform: translateY(0) rotate(2.5deg); }
  75% { transform: translateY(-2.5px) rotate(0deg); }
}
/* 窄格的目標／免推符號：排在血條上方（以立繪頂端為基準，跟血條一起讓位） */
.bm-syms {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 10px + var(--k, 0) * 4px); z-index: 2;
  display: flex; gap: 1px; justify-content: center; font-size: 11px; line-height: 1.1; white-space: nowrap;
}
.bm-sym { padding: 0 1px; border-color: rgba(232,201,106,0.7); }
/* U4（B1-3）：寬格的詞語徽章一個一行、固定 13px 高（js boardUnderBlockPx 照這個數算塊高）。
   窄格裡標籤全是 .bw（不顯示），這一列高 0；跟下面圖示列之間的 1px 只在寬格、而且有標籤時才加（不用 .bm-under 的 gap）。 */
.bm-tags { display: flex; flex-direction: column; align-items: center; gap: 1px; max-width: var(--cell-w, 36px); }
.bm-tags .bm-badge { height: 13px; line-height: 11px; box-sizing: border-box; }
/* GRP-UIREVAMP-U4（B1-3，同格多隻）：腳下資訊塊 .bm-under（寬格的標籤＋異常／增益圖示列）改成「從棋盤下緣往上疊」。
   舊版（GRPA-A2／UNITBAR）以每隻的腳底為基準、第 k 隻再往下 k × 33px ⇒ 第二隻掉到棋盤下方被增益列蓋住、第三隻被戰鬥區裁掉（#160①）。
   新規則（js/ui.js boardLayoutUnders 算 --uo，單位 px，＝這一塊的下緣離棋盤下緣多高）：
   ① 同一格的怪依 k（停下的在前、再依 id）由下往上疊，沒有異常／增益（也沒有標籤）的那隻不佔位，塊與塊之間 1px。
   ② 第一塊的下緣貼棋盤下緣。同一格有兩塊以上時，這一格的圖示一律 8px（.bm-ail-sm），塊比較矮、疊得下。可用高度＝棋盤下緣到第 1 隻血條下緣（窄格 --ground − 9px、寬格 −14px）。
   ③ 放不下的塊整塊不畫，改在這一格最上面那一塊之上畫一個「+N」（N＝沒畫出來的隻數，點格子看詳情）。
      第一塊一定畫（單隻怪的圖示全部畫出，不藏成 +N——GRP-BATTLEFIX-FIX2 的裁決）；第一塊自己就超過可用高度時，
      這一格的血條整組往上讓（--hp-lift），血條永遠在腳下資訊塊之上。
   bottom 的算式：.bm-body 的下緣＝棋盤下緣 ＋ --ground ＋ k × 4px，這一層要扣回去才會以棋盤下緣為基準；
   水平也扣回 .bm-body 的堆疊錯位（k × 方向 × min(6px, 格寬 10%)），每一塊都置中在自己那一格，不會跨進鄰格。 */
.bm-under {
  position: absolute; left: 50%; top: auto;
  bottom: calc(var(--uo, 0px) - var(--ground, 30px) - var(--k, 0) * 4px);
  transform: translateX(calc(-50% - var(--k, 0) * var(--sdir, 1) * min(6px, var(--cell-w, 36px) * 0.1)));
  width: var(--cell-w, 36px); max-width: var(--cell-w, 36px);
  display: flex; flex-direction: column; align-items: center; gap: 0; pointer-events: none; z-index: 1;
}
.bm-under.bm-under-off { visibility: hidden; }
.bm-badge { font-size: 9px; line-height: 1.2; white-space: nowrap; padding: 0 3px; }
.bm-badge.bm-tgt { border-color: var(--head); }
/* 格級「+N」：這一格還有 N 隻的腳下資訊沒畫（放不下）。文字＋虛線框（不靠顏色），格級節點不受窄格「一字」限制。 */
.cell-ail-more {
  position: absolute; left: 50%; bottom: var(--uo, 0px); transform: translateX(-50%); z-index: 2;
  font-size: 8px; line-height: 8px; height: 10px; box-sizing: border-box; padding: 0 2px; white-space: nowrap; font-weight: 700;
  color: var(--ink); background: rgba(11,19,15,0.82); border: 1px dashed rgba(238,240,229,0.7); border-radius: 4px; pointer-events: none;
}
.cell-ail-more:empty { display: none; }
/* GRP-BATTLEFIX-FIX2：腳下異常全部畫出，不捲、不藏成 +N。
   10px 圖一列放 floor(格寬 / 10) 顆；放不下就往上疊（wrap-reverse，底緣錨住、第一顆在最低那一列）。
   名稱只留在 title，視覺上藏起（格子詳情仍有名稱＋圖示）。色弱不靠顏色：title 與詳情文字。
   GRP-BATTLEFIX-FIX3：黑暗／出血的 emoji 字級 7px 才放得進 10px 盒子；怪物增益跟異常用同一套盒子。
   7 顆以上改 8×8、字級 5px。
   U4：這一列在 .bm-under 裡照排版流排（不再自己 absolute），塊高＝標籤＋列數 × 圖示邊長，js 照同一條規則算（boardUnderBlockPx）。 */
.monster-slot.bm .monster-ail {
  position: relative; flex: none;
  width: var(--cell-w, 36px); max-width: var(--cell-w, 36px); min-width: 0; margin: 0;
  box-sizing: border-box; display: flex; flex-wrap: wrap-reverse; overflow: visible;
  justify-content: center; align-items: center; align-content: flex-end; gap: 0;
  font-size: 7px; line-height: 1; text-shadow: 0 0 4px rgba(0,0,0,0.8); pointer-events: none;
}
.monster-slot.bm .monster-ail:empty { display: none; }
.monster-slot.bm .monster-ail .ail-mark,
.monster-slot.bm .monster-ail .mon-buff {
  position: relative; box-sizing: border-box;
  width: 10px; min-width: 10px; max-width: 10px; height: 10px; flex: 0 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; gap: 0; font-size: 7px; line-height: 1; overflow: hidden;
}
.monster-slot.bm .monster-ail .mon-buff { background: rgba(255, 200, 60, 0.22); border-radius: 2px; }
.monster-slot.bm .monster-ail .ail-ic { width: 10px; height: 10px; flex: 0 0 10px; }
.monster-slot.bm .monster-ail .ail-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.monster-slot.bm .monster-ail:has(> :nth-child(7)) .ail-mark,
.monster-slot.bm .monster-ail:has(> :nth-child(7)) .mon-buff,
.monster-slot.bm .monster-ail.bm-ail-sm .ail-mark,
.monster-slot.bm .monster-ail.bm-ail-sm .mon-buff {
  width: 8px; min-width: 8px; max-width: 8px; height: 8px; flex: 0 0 8px; font-size: 5px;
}
.monster-slot.bm .monster-ail:has(> :nth-child(7)) .ail-ic,
.monster-slot.bm .monster-ail.bm-ail-sm .ail-ic { width: 8px; height: 8px; flex: 0 0 8px; }

/* GRP-UIREVAMP-U4（D8）：點玩家角色（本單不做交換，使用者 2026-10-09 裁決）。
   被選的玩家：立繪外框加 2px 虛線框（.unit-selected .unit-fig）＋格內「已選取」字（色弱：不只靠框色）。
   隔壁的移動目標：整格疊一層半透明（accent-wash）＋虛線框＋文字「◀ 移到這」「移到這 ▶」。整格都能點
   （這一層 pointer-events:none，點擊落在 .cell，由 boardCellClick 分流）。窄格 36px 放不下一行就折兩行，不准水平溢出。 */
.cell-move, .cell-sel { pointer-events: none; }
.cell-move:empty, .cell-sel:empty { display: none; }
.cell-move {
  position: absolute; inset: 0; z-index: 14; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 1px; overflow: hidden; overflow-wrap: anywhere; word-break: break-all;
  font-size: 10px; line-height: 1.15; font-weight: 700; color: var(--ink);
  text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000;
  background: rgba(227,154,82,0.18); border: 2px dashed var(--accent); border-radius: 6px;
}
.cell-sel {
  position: absolute; left: 50%; top: 15px; transform: translateX(-50%); z-index: 14;
  font-size: 9px; line-height: 12px; font-weight: 700; white-space: nowrap; padding: 0 2px; border-radius: 4px;
  color: var(--ink); background: rgba(11,19,15,0.86); border: 1px dashed var(--accent);
}
.board-unit.unit-selected .unit-fig { outline: 2px dashed var(--accent); outline-offset: 1px; border-radius: 6px; }

/* GRP-UIREVAMP-U6（§6／D12）：主城棋盤第 9 格的卡普拉。立繪與頭上文字都不吃點擊（點擊落在 .cell，由 boardCellClick 分流）。
   頭上一定有文字「💬 卡普拉」（色弱：不只靠圖），深底白字。立繪高度跟怪物一樣乘格寬係數 --mon-k。 */
.cell-kafra {
  position: absolute; left: 50%; bottom: var(--ground, 50px); transform: translateX(-50%); z-index: 12;
  display: flex; flex-direction: column; align-items: center; gap: 1px; pointer-events: none;
}
.kafra-tag {
  font-size: 9px; line-height: 12px; font-weight: 700; white-space: nowrap; padding: 0 3px; border-radius: 4px;
  color: var(--ink); background: rgba(11,19,15,0.86); border: 1px solid var(--accent);
}
.kafra-img { display: block; height: calc(80px * var(--mon-k, 1)); width: auto; image-rendering: pixelated; pointer-events: none; }
/* 小選單：在戰鬥區卡普拉左邊往左展開（right／top 由 js 在打開時算）、2 欄、每顆圖示＋文字。 */
.kafra-menu {
  position: absolute; z-index: 40; display: grid; grid-template-columns: repeat(2, auto); gap: 4px; padding: 6px;
  background: rgba(11,19,15,0.95); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}
.kafra-menu-btn {
  display: flex; align-items: center; gap: 4px; padding: 5px 8px; min-height: 28px;
  font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer;
  color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
}
.kafra-menu-btn:hover, .kafra-menu-btn:focus-visible { border-color: var(--accent); background: var(--hover); }
.kafra-menu-icon { font-size: 14px; line-height: 1; }

/* 單位（玩家、隊友）：外框搬進 actualCells 那一格；立繪用 zoom 縮到格寬（--unit-scale 由 js 量格寬算） */
.board-unit-store { display: none; }
.board-unit { position: absolute; left: 50%; bottom: var(--ground, 30px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; z-index: 12; pointer-events: none; }
/* UI11：.unit-fig 的高度只留人物本體（--unit-char-px，js 給）＋一點餘裕；外框上半部的透明留白往上溢出（看不見）。 */
/* GRP-CHARPX（#122）：zoom＝格寬係數 --mon-k（從 .board 繼承；GRP-BOARDMARGIN 起只有一個值），與怪物共用同一個值；
   框內是「原圖像素 × scale」（js 依 js/unit-scales.js 寫外框與畫布尺寸），所以人物顯示高＝原圖人物高 × scale × 係數。
   --unit-char-px 由 js 寫在每個 #unit-* 上（玩家、隊友各自的人物高）。 */
.board-unit .unit-fig {
  zoom: var(--mon-k, 1); position: relative;
  height: calc(var(--unit-char-px, 84px) + 8px);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
/* UI11：腳下影子（跟著 zoom 一起縮放） */
.board-unit .unit-fig::before {
  content: ''; position: absolute; left: 50%; bottom: -4px; width: 64%; height: 20px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,0.55), rgba(0,0,0,0.22) 55%, transparent 72%);
  pointer-events: none; z-index: 0;
}
/* GRP-BOARDMARGIN（C32）：拿掉 GRP-BATTLEFIX 的第 1 格特例（單位貼左緣、整格 translate 右移半格、::before 補點擊範圍）。
   棋盤左右改留 --board-pad 的空白，第 1 格跟其他格一樣：單位置中、格子本身吃點擊、飄字不必另加半格。 */
.board-unit .ally-sprite { position: relative; left: auto; top: auto; bottom: auto; }
/* GRP-CHARPX：舊版戰鬥區的 #ally-sprite-0 { top: 8% }／#ally-sprite-1 { bottom: 8% }（id 權重）會壓過上一行，
   讓棋盤上的隊友腳底離開地平線（實量窄格差約 6px）——棋盤上一律歸零 */
.board-unit #ally-sprite-0, .board-unit #ally-sprite-1 { top: auto; bottom: auto; }
/* GRP-CHARPX：隊友圖片照原圖 × scale 絕對定位（js 寫行內尺寸，邊界框下緣貼外框底）；名牌與小血條移到腳底下方，不佔人物框 */
.ally-figure.charpx .ally-tag, .ally-figure.charpx .ally-hp { position: absolute; left: 0; right: 0; }
.ally-figure.charpx .ally-tag { top: 100%; }
.ally-figure.charpx .ally-hp { top: calc(100% + 14px); }
.board-unit.unit-shifting .unit-fig { opacity: 0.5; }
/* UNITBAR：隊友腳下依序是 HP、SP、狀態標籤；玩家的棋盤腳下留空。 */
.unit-hp {
  position: absolute; top: calc(100% + 1px); left: 50%; transform: translateX(-50%);
  width: min(40px, calc(var(--cell-w, 36px) * 0.86)); height: 3px;
  background: linear-gradient(180deg, var(--deep), var(--field)); border: 1px solid rgba(0,0,0,0.9); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(238,240,229,0.30);
}
.unit-hp-fill { height: 100%; width: 0; transition: width 0.25s ease-out; background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0) 55%), linear-gradient(90deg, #10ef21, #3cff4d); }
.unit-hp-fill.low { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.30) 0 3px, rgba(255,255,255,0) 3px 6px), #FF0000; }
.unit-sp {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: min(40px, calc(var(--cell-w, 36px) * 0.86)); height: 3px;
  background: var(--deep); border: 1px solid rgba(0,0,0,0.9); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(238,240,229,0.30);
}
.unit-sp-fill { height: 100%; width: 0; transition: width 0.25s ease-out; background: linear-gradient(90deg, #1863de, #4387ee); }
#unit-player > .unit-hp, #unit-player > .unit-sp, .board-unit.unit-downed > .unit-hp, .board-unit.unit-downed > .unit-sp { display: none; }
/* GRP-UI76 #76-2：Debug 關時腳下文字是空字串（倒地除外）；空框不可見。用 visibility 而不是 display:none：
   框仍在原位（position:absolute，本來就不佔排版），量測與版面都不會跳。 */
.unit-label:empty { visibility: hidden; }
.unit-label {
  font-size: 9px; line-height: 1.2; text-align: center; max-width: var(--cell-w, 36px); word-break: break-all;
  padding: 0 3px; margin-top: 1px; z-index: 1;
  /* GRPA-A2：名稱列改貼在腳底（.unit-fig 下緣＝地平線）下方，不再用排版流把人物往上推 */
  position: absolute; top: calc(100% + 11px); left: 50%; transform: translateX(-50%); width: max-content;
}
.board-unit.unit-downed > .unit-label { top: 100%; }

/* 點格開的詳情（窄格模式看不到詞語時用）：純文字列出那格每一隻
   GRP-BOARDUI（#192-16）：貼戰鬥區右下、在狀態列（.battle-status-row，內含 #battle-buffs，固定 32px 高）上方 4px；
   寬度依內容（max-content，上限＝戰鬥區寬 − 12px）；背景半透明（α 0.78，白字對合成色最壞情況仍 ≥ 4.5:1，算式見報告）。
   bottom 36px＝狀態列 32px ＋ 4px 間隔：.battle-status-row 是 .battle-scene 最後一個參與排版的子節點（下緣貼戰鬥區下緣）。
   GRP-BATTLESCALE393：狀態列 39.08 ＋ 間隔 4.89（4 ÷ 0.81875）＝ 43.97px。 */
.board-detail {
  position: absolute; left: auto; right: 6px; top: auto; bottom: 43.97px; z-index: 6;
  width: max-content; max-width: calc(100% - 12px); box-sizing: border-box;
  max-height: 60%; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(12,14,22,0.78); border: 1px solid var(--accent); border-radius: 6px; padding: 6px 8px; font-size: 12px;
  text-shadow: 0 1px 1px #000;
}
.board-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.board-detail-row { padding: 2px 0; border-top: 1px dashed var(--line); overflow-wrap: anywhere; }
/* FIX3：格子詳情的異常名稱必須看得見（色弱不靠圖的顏色）。 */
.board-detail .ail-name { display: inline; }

/* BUF1：戰鬥區最下方的增益列。三種來源靠文字前綴（▲增益／⛨護盾／▨場域）區分，不靠顏色。
   GRP-BATTLEFIX-FIX1（156-7）：固定一列。不准折行，不准縮到看不清，多的在列內左右捲。
   GRP-BATTLEFIX-FIX2：外框 40→32、標籤 28→24、圖示 22→20。
   height 寫死（不是只有 min-height）：空列、純文字、圖示、捲軸出現，外框高都是 32px。
   標籤高 24px（border-box：1px 框＋1px 內距後內容 20px，20px 圖放得下）。文字標與圖示標同一高。 */
.battle-buffs {
  flex: 0 0 auto; display: flex; flex-wrap: nowrap; align-items: center; gap: 3px 6px;
  padding: 2px 8px; z-index: 2; min-width: 0; width: 100%; max-width: 100%;
  box-sizing: border-box; height: 32px; min-height: 32px; max-height: 32px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain;
}
/* GRP-UIREVAMP-U4（B1-4）：狀態列＝玩家異常（#hud-ail，左）＋增益（#battle-buffs，右）同一行，固定 32px 高。
   兩塊各自在列內左右捲；異常最多佔一半寬，其餘給增益。增益列的 32px 外框改由這一層負責（裡面的增益列高 32 不變）。 */
.battle-status-row {
  flex: 0 0 auto; display: flex; flex-wrap: nowrap; align-items: center;
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  height: 32px; min-height: 32px; max-height: 32px; overflow: hidden; position: relative; z-index: 2;
}
.battle-status-row .hud-ail { flex: 0 1 auto; min-width: 0; max-width: 50%; padding: 0 6px 0 8px; }
.battle-status-row .hud-ail:empty { display: none; }
.battle-status-row .hud-ail:not(:empty) { border-right: 1px dashed rgba(238,240,229,0.55); }
.battle-status-row .battle-buffs { flex: 1 1 auto; width: auto; }
.battle-buffs::-webkit-scrollbar { height: 4px; }
.battle-buffs::-webkit-scrollbar-thumb { background: rgba(238,240,229,0.5); border-radius: 2px; }
/* hidden class 仍在（BUF1 斷言的是 class）。要蓋過檔案前面 .hidden{display:none!important}，
   所以這裡用 id＋!important，只把內容藏起來，列還在排版裡。 */
#battle-buffs.hidden { display: flex !important; visibility: hidden; }
.battle-buff-tag {
  font-size: 11px; line-height: 1.2; color: #fff;
  background: linear-gradient(180deg, rgba(30,33,46,0.9), rgba(11,19,15,0.9));
  border: 1px solid rgba(238,240,229,0.35); border-radius: 8px; padding: 1px 6px;
  white-space: nowrap; flex: 0 0 auto; max-width: none; overflow: visible; text-overflow: clip;
  display: inline-flex; align-items: center; box-sizing: border-box; height: 24px;
  text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000;
}
.battle-buff-tag.bb-shield { border-color: rgba(255,190,90,0.55); }
.battle-buff-tag.bb-field { border-color: rgba(125,173,226,0.55); }
/* GRP-CAST4（#13）：有官方圖示的增益＝圖示＋往下縮的遮罩（已經過的比例）＋剩餘秒數數字。
   三種來源改用邊框線型區分（增益實線／護盾雙線／場域虛線），不只靠顏色；數字一定在，不只靠遮罩明暗。 */
.battle-buff-tag.bb-iconic { display: inline-flex; align-items: center; gap: 3px; padding: 1px 4px 1px 1px; border-radius: 5px; }
.battle-buff-tag.bb-iconic.bb-shield { border-style: double; border-width: 3px; }
.battle-buff-tag.bb-iconic.bb-field { border-style: dashed; }
.bb-ic { position: relative; width: 20px; height: 20px; flex: 0 0 20px; overflow: hidden; border-radius: 3px; background: #000; }
.bb-ic img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.bb-cover { position: absolute; left: 0; right: 0; top: 0; height: 0; background: rgba(0,0,0,0.62); border-bottom: 1px solid rgba(255,255,255,0.7); }
.bb-sec { font-size: 12px; font-weight: 700; min-width: 1.2em; }
.bb-alt { display: none; }
.bb-noimg .bb-ic { display: none; }
.bb-noimg .bb-alt { display: inline; }
.bb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* GRP-BATTLEAREA（130-3）：增益列與 HUD 異常狀態列每一顆可點，開出說明氣泡（js/ui.js battleTipSync）。
   被點開的那一顆加粗金框（不只靠顏色：框變粗）。氣泡掛在 body、position:fixed，不被戰鬥區 overflow:hidden 裁掉；
   寬度上限＝視窗寬 − 16px，js 再把位置夾在視窗內 ⇒ 360px 不會水平溢出。 */
#battle-buffs [data-tip], #hud-ail [data-tip] { cursor: pointer; }
#battle-buffs .bb-open, #hud-ail .bb-open { outline: 2px solid var(--accent); outline-offset: 1px; }
.bb-tip {
  position: fixed; left: 0; top: 0; z-index: 160; box-sizing: border-box;
  width: max-content; max-width: min(280px, calc(100vw - 16px));
  padding: 6px 9px; border-radius: 8px; border: 1px solid var(--accent);
  background: rgba(14,16,26,0.96); color: var(--ink); font-size: 12px; line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6); overflow-wrap: anywhere; pointer-events: auto;
}
.bb-tip.hidden { display: none; }
.bb-tip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-weight: 700; color: #fff; }
.bb-tip-kind { font-size: 11px; color: var(--head); }
.bb-tip-desc { margin-top: 3px; color: var(--ink); }
.bb-tip-row { margin-top: 2px; font-weight: 700; color: #fff; }
/* UNITBAR：棋盤上角色與隊友頭上的詠唱條，直接沿用舊頭頂 HP 條的位置、大小與外框。 */
.unit-cast { order: -1; position: relative; display: flex; align-items: center; margin-bottom: 1px; }
/* GRP-BATTLESCALE（B9-1）：詠唱條照舊窄格值 ÷ 0.75——寬 min(40px, 格寬 × 0.86) → min(53.33px, 格寬 × 0.86)（比例不換算）、高 4 → 5.33px。
   GRP-BATTLESCALE393：改 ÷ 0.81875——min(48.85px, 格寬 × 0.86)、高 4.89px。 */
.unit-cast-track {
  position: relative; flex: none; width: min(48.85px, calc(var(--cell-w, 43.2px) * 0.86)); height: 4.89px;
  background: linear-gradient(180deg, var(--deep), var(--field)); border: 1px solid rgba(0,0,0,0.9); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(238,240,229,0.30);
}
.unit-cast-fill { height: 100%; width: 0; background: var(--accent); }
/* 等級數字掛在條的右側、不佔排版寬度：條本身才會跟血條同一個水平中心 */
.unit-cast-lv { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 1px; font-size: 8px; line-height: 1; font-weight: 700; color: #fff; text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000; }
/* 施放成功後接在同一個頭頂位置；動畫末段淡出。方角與文字讓它不只靠顏色辨識。
   GRP-BATTLEFIX（156-5）：拿掉白框。黑底與白字留著。 */
.unit-skill-name {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
  width: max-content; max-width: max(56px, calc(var(--cell-w, 36px) * 1.8)); box-sizing: border-box;
  margin-bottom: 1px; padding: 1px 3px; border: 0; border-radius: 0;
  background: rgba(0,0,0,0.72); color: #fff; font-size: 9px; line-height: 1.2; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
  animation: unit-skill-name-life 1.2s linear both;
}
@keyframes unit-skill-name-life { 0%, 72% { opacity: 1; } 100% { opacity: 0; } }

/* GRP-BOARDMARGIN（C33）：舊的「寬格／窄格切換」（@container board (min-width: 480px)）拿掉——棋盤永遠是 480 排版，
   寬格那套直接寫進各條基本規則（--ground 52；GRP-BATTLESCALE 起血條 6.67px、體型 45.33／61.33／77.33、詠唱條 5.33px）。詞語徽章（.bw）一律顯示。 */
.board span.bw { display: inline-block; }
.board .bn { display: none; }

/* GRP-BOARDMARGIN（C33）：戰鬥區最小字 12px（480 版面）。只管「文字」：
   怪物腳下的異常／增益 emoji 圖示（10／8px 小方塊）與讀屏專用的隱藏字（.ail-name 1px 裁切、.bb-sr）不算（主對話 2026-10-10 裁決 A）。
   GRP-BATTLESCALE（B9-1，使用者 2026-10-11 選「以手機 360 寬為準」）＋ FIX1（指揮官 2026-10-11 裁決）：逐條照「改版前 360 寬實際字級 ÷ 0.75」換算，
   不再一律 16——360 寬縮放後（× 0.75）每個字都回到改版前手機的大小。對照表（改版前 360 → 480 值）：
     9 → 12：名牌 .unit-label、場域秒數 .cell-field-sec、卡普拉 .kafra-tag、×N .cell-badges、待生 .cell-wait-spawn、技能名 .unit-skill-name、
             腳下標籤 .bm-badge、格號 .cell-num（見 .cell-num）、已選取 .cell-sel
     10 → 13.33：移到這 .cell-move；玩家回復飄字 .heal-self（見 .damage-float.heal-self）
     11 → 14.67：HUD 血條字 .bar-text、狀態列 .board-status、增益標籤 .battle-buff-tag、HUD 異常名 .hud-ail／.ail-name、場域圖示 .cell-field、
             .bm-syms、詳情框裡那隻怪的 .ail-name
     12 → 16：格子詳情框 #board-detail（使用者點名太小的那一處）
     8 → 10.67 ⇒ 12（C33 最小字下限）：+N .cell-ail-more、詠唱等級 .unit-cast-lv
   電腦寬（縮放比 1）這些字因此比改版前大 1 ÷ 0.75 倍——使用者接受的副作用。
   GRP-BATTLESCALE393（B9-12，使用者 2026-10-11 改以 iPhone 15 Pro 393 寬為準）：上表改成「÷ 0.81875」（393 ÷ 480）：
     9 → 12（10.99 走 C33 下限，不變）；10 → 12.21；11 → 13.43（工單寫法；四捨五入是 13.44）；12 → 14.66；8 → 12（不變）。
     行高：.board-status > span、.kafra-tag、.cell-sel 12 ÷ 0.81875 ＝ 14.66。393 寬縮放後＝改版前；360 寬小約 8%、412 寬小約 5%。
   盒子跟著字改的：.board-status > span 行高 12 ÷ 0.75 ＝ 16；.kafra-tag 行高 12 ÷ 0.75 ＝ 16；.cell-sel 行高 14、top 20（讓開變高的格號，見 .cell-num）；
   .cell-ail-more 行高 12、高 14（js BOARD_UNDER.morePx 同步 14）。腳下標籤 .bm-tags .bm-badge 維持 14px（12px 字、行高 12＋上下框線）、不留縫；
   地平線下的空間仍是 --ground 52，3 個標籤＋一列圖示＝52 不變（tests/grpa-board-look.test.js 的 tags 檢查）。
   盯著這些數字的測試：tests/battlescale-layout.test.js（真瀏覽器 computed）、tests/battlescale-face.test.js（CSS 與 js 常數同步）。 */
/* HUD 血條字 14.67px（＝改版前 11px ÷ 0.75）。GRP-BATTLESCALE-FIX1（F1）：條子（.player-bars 140px，內寬 138）放不下時原本會折成兩行、上下超出 16px 高的條子
   （「SP 11/11 (100.0%)」在 14.67px、letter-spacing .04em 時約 140px 寬）。指揮官 2026-10-11 裁決走純 CSS：單行（nowrap）、放不下就省略號
   （overflow hidden ＋ text-overflow），letter-spacing 從 .04em 降到 0 讓常見字串（HP／SP 滿值、兩位數到四位數）完整放得下；
   只有極大數值（UI4S-B2 的 99,999／999,999 那組）會被省略號吃掉尾巴——等 todo-open B7-4（HUD-PCT-OUT）把百分比搬到條外就放得下。
   display 從 flex 改 block：text-overflow 只對 block 容器裡的行內文字生效。
   實量（headless Edge、Noto Sans TC／Microsoft JhengHei）：letter-spacing 0 時「HP 35/35 (100.0%)」132.5px、「SP 11/11 (100.0%)」130.5px 放得進 138；
   「HP 999/999 (100.0%)」149.8px 起（三位數以上）百分比那一段被省略號吃掉，HP 數值本身仍完整——指揮官 2026-10-11 接受，B7-4 排下一批。
   line-height 11px（比字小）是刻意的：這個字體的內容區 21px（ascent 17 ＋ descent 4）、括號的墨水 16px（上 13、下 3），都比條子內高 14px 大；
   行高 L 時基線在 L/2 ＋ 6.5 ⇒ L＝11 讓括號墨水 −1～15 在 14px 的盒子裡上下各被切 1px（對稱）；L＝14 會讓基線落在 13.5、括號下緣 16.5 被切 2.5px。
   數字與字母（高約 10.7px）完全在盒內。tests/battlescale-layout.test.js ⑦ 量行數＝1、字盒在條內、兩位數字串沒被省略、三位數以上 HP 數值完整；
   tests/ui4small-browser.test.js UI4S-B2 只量左右緣，量不到折行。 */
.board-hud .player-bars .bar-text {
  font-size: 13.43px; letter-spacing: 0; display: block; line-height: 11px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-status { font-size: 13.43px; }
.board-status > span { line-height: 14.66px; }
.board-detail { font-size: 14.66px; }
.cell-badges, .cell-wait-spawn, .cell-field-sec, .kafra-tag, .unit-label, .unit-skill-name { font-size: 12px; }
.cell-field, .bm-syms { font-size: 13.43px; }
/* .cell-sel「已選取」12px（＝改版前 9 ÷ 0.75；3 個字 16px＝52px 放不進 43.2px 的格子，tests/uirevamp-u4-layout.test.js U4-L3 擋下）。top 20＝讓開變高的格號（1＋18＋1）。
   GRP-BATTLESCALE393：行高 12 ÷ 0.81875 ＝ 14.66；top 18.66＝1＋16.66＋1（格號外高 16.66）。 */
.cell-sel { font-size: 12px; line-height: 14.66px; top: 18.66px; }
.cell-move { font-size: 12.21px; }
.kafra-tag { line-height: 14.66px; }
.bm-badge { font-size: 12px; }
.bm-tags { gap: 0; }
.bm-tags .bm-badge { height: 14px; line-height: 12px; }
.cell-ail-more { font-size: 12px; line-height: 12px; height: 14px; }
.unit-cast-lv { font-size: 12px; }
.battle-buff-tag { font-size: 13.43px; }
#battle-scene .hud-ail, #battle-scene .hud-ail .ail-mark { font-size: 13.43px; }
/* GRP-BOARDMARGIN-FIX1：異常名稱寫在內層 span，:653 的 .ail-name 11px 會蓋過繼承 ⇒ 要點名。兩處看得見：
   HUD 異常列（「昏迷」「冰凍」）與格子詳情框裡那隻怪的異常（boardDetailMonRowHtml）。
   怪物腳下的 .monster-ail .ail-name 是讀屏用的 1px 裁切，不在這兩處裡，不受影響。 */
#battle-scene .hud-ail .ail-name, #battle-scene .board-detail .ail-name { font-size: 13.43px; }

/* GRP-BATTLESCALE393（B9-12，使用者 2026-10-11）：狀態列（#battle-status-row：HUD 異常＋增益列）的圖示、標籤與列高
   B9-1 沒動，改版前手機不縮放＝20／24／32，393 寬實際只剩 16.4／19.7／26.2。照同一條規則「改版前值 ÷ 0.81875」還原
   （393 寬縮放後＝改版前）。1px 框線／虛線與 line-height 1.2 這類相對值不換算（主對話 2026-10-11 裁決）。
   選擇器限定在 #battle-scene 底下，不動別處的 .ail-mark／.ail-ic。戰鬥區總高跟著加 7.08（219 → 226.08，見 .battle-panel）。
     列高 32 → 39.08；增益列 padding 2／8 → 2.44／9.77、gap 3／6 → 3.66／7.33；捲軸 4 → 4.89、異常列捲軸 3 → 3.66
     增益標籤高 24 → 29.31、padding 1／6 → 1.22／7.33、圓角 8 → 9.77；圖示型 padding 1 4 1 1 → 1.22 4.89 1.22 1.22、gap 3 → 3.66、圓角 5 → 6.11、護盾雙線 3 → 3.66
     圖示 .bb-ic 20 → 24.43、圓角 3 → 3.66；秒數 .bb-sec 12 → 14.66
     HUD 異常列高 24 → 29.31、gap 3 → 3.66、列內 padding 0 6 0 8 → 0 7.33 0 9.77；.ail-mark gap 2 → 2.44；.ail-ic 16 → 19.54；臨時減益 padding 1 → 1.22、圓角 3 → 3.66
   盯著這些數字的測試：tests/battlescale-layout.test.js ⑨（真瀏覽器 393 寬畫面值＝改版前）、tests/battlescale-face.test.js。 */
#battle-scene .battle-status-row { height: 39.08px; min-height: 39.08px; max-height: 39.08px; }
#battle-scene .battle-buffs { height: 39.08px; min-height: 39.08px; max-height: 39.08px; padding: 2.44px 9.77px; gap: 3.66px 7.33px; }
#battle-scene .battle-buffs::-webkit-scrollbar { height: 4.89px; }
#battle-scene .battle-buff-tag { height: 29.31px; padding: 1.22px 7.33px; border-radius: 9.77px; }
#battle-scene .battle-buff-tag.bb-iconic { padding: 1.22px 4.89px 1.22px 1.22px; gap: 3.66px; border-radius: 6.11px; }
#battle-scene .battle-buff-tag.bb-iconic.bb-shield { border-width: 3.66px; }
#battle-scene .bb-ic { width: 24.43px; height: 24.43px; flex: 0 0 24.43px; border-radius: 3.66px; }
#battle-scene .bb-sec { font-size: 14.66px; }
#battle-scene .hud-ail { height: 29.31px; min-height: 29.31px; max-height: 29.31px; gap: 3.66px; }
#battle-scene .hud-ail::-webkit-scrollbar { height: 3.66px; }
#battle-scene .battle-status-row .hud-ail { padding: 0 7.33px 0 9.77px; }
#battle-scene .hud-ail .ail-mark { gap: 2.44px; }
#battle-scene .hud-ail .ail-ic { width: 19.54px; height: 19.54px; flex: 0 0 19.54px; }
#battle-scene .hud-ail .p-debuff { padding: 0 1.22px; border-radius: 3.66px; }

/* UI11 待機呼吸：我方單位輕微上下起伏（相位各自錯開）；受擊／浮動的支點在腳底 */
.bm .monster-visual { transform-origin: 50% 100%; }
.board-unit .unit-fig { animation: unit-breathe 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
#unit-ally0 .unit-fig { animation-delay: -0.9s; }
#unit-ally1 .unit-fig { animation-delay: -1.8s; }
.board-unit.unit-downed .unit-fig { animation: none; }
@keyframes unit-breathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-1px) scaleY(1.02); }
}
/* UI11：尊重「減少動態效果」——關掉待機浮動、呼吸與受擊震動（受擊只留閃白），出生／死亡只淡入淡出 */
@media (prefers-reduced-motion: reduce) {
  .monster-idle-float, .board-unit .unit-fig { animation: none; }
  .bm.st-walk .monster-visual img { animation: none; }
  .monster-hit-shake { animation: monster-hit-flash 140ms ease-out; }
  .bm-body.bm-spawn { animation: bm-fade-in 300ms ease-out both; }
  .bm.bm-ghost .bm-fig { animation: bm-fade-out 300ms ease-out forwards; }
}
@keyframes bm-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes bm-fade-out { 0% { opacity: 1; } 100% { opacity: 0; } }

/* 站位與坐下（角色分頁，§7.3） */
.board-cells-rows { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.board-cell-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.board-cell-row .bcr-name { min-width: 4.5em; }
.board-cell-row .btn-small { min-width: 0; padding: 2px 8px; }
.board-warn { font-size: 12px; color: var(--head); border-left: 3px double var(--head); padding-left: 6px; margin: 4px 0; overflow-wrap: anywhere; }
.board-sit-opts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.board-sit-opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.monster-icon { width: 96px; height: 96px; margin: 0 auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5)); }
.monster-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; border-radius: 10px; }
.monster-name { font-weight: 700; margin-top: 6px; color: var(--ink); }
.monster-lv { color: var(--ink-dim); font-weight: 400; font-size: 12px; }
.monster-hp-track { width: 220px; height: 12px; margin: 10px auto 4px; }
.monster-hp-text { font-size: 11px; color: var(--ink-dim); text-align: center; }
.monster-element { font-size: 11px; padding: 2px 6px; border-radius: 10px; font-weight: 600; vertical-align: middle; }
.elem-none { background: #444; color: #ccc; }
.elem-water { background: #1a5276; color: #85c1e9; }
.elem-earth { background: #7d6608; color: #f9e79f; }
.elem-fire { background: #922b21; color: #f5b7b1; }
.elem-wind { background: #1e8449; color: #abebc6; }
.elem-poison { background: #4a235a; color: #d2b4de; }
.elem-holy { background: #7d6608; color: #fef9e7; }
.elem-shadow { background: #1b2631; color: #aeb6bf; }
.elem-ghost { background: #4a235a; color: #d7bde2; }
.elem-undead { background: #1c2833; color: #f1948a; }

/* .skill-bar / .skill-btn 已移除（#101）：畫面上不再有技能按鈕列，
   技能一律在自動戰鬥分頁設定。 */

/* .combat-log／.log-pane／.log-pane-head／.log-pane-body／.log-line 已移除（UI3b）：
   UI3（f39b90c）把畫面上的戰鬥／技能／隊友三欄併入聊天面板的「⚔️ 戰鬥」頁籤
   （js/chat-ui.js，.chat-line--battle 系列），index.html／js/ui.js 已經沒有任何
   元素會套用這些 class，確認過 grep 全 repo 零命中（僅剩 js/chat-ui.js 頭部的
   說明性註解提到「舊版三欄 combat-log」，那是文字說明不是選取器）。 */

.side-panel { flex: 1 1 auto; display: flex; flex-direction: column; background: var(--panel); min-width: 0; max-width: none; }

/* UI6：分頁改成兩層——主分頁（5 顆，.tab-btn-main，data-group）決定要看哪一組；
   子分頁沿用原本的 .tab-btn／data-tab（market-ui.js、js/ui.js 有多處靠
   .tab-btn[data-tab="…"] 認人，類名不能改），js/ui.js 的 renderTabNav() 只顯示屬於
   目前主分頁的那幾顆。子分頁顆數不固定（鐵匠多一顆「鍛造」、聊天有 5 個頻道），
   兩排都改用 flex-wrap 而不是固定欄數的 grid，用 gap＋容器底色當分隔線（「泥縫」），
   不用 `:nth-child` 去猜誰是最後一顆——舊版註解就提醒過這個坑，顆數一變、或某顆被
   `.hidden` 藏起來都不會漏線多線，兩層之後（顆數更常變）更容易犯。 */
/* GRP-TABS（B9-9，#221-12，使用者選 1；示意檔 reports/tab-redesign-mockup.html 的「建議（選項 1）」）：
   主分頁＝資料夾標籤。整列底下一條 2px 金線；每顆上方圓角、沒有下框，坐在金線上。
   選中那顆：上下 padding 各多 3px（比未選高）＋2px 金框＋margin-bottom:-2px 蓋過金線，
   下框塗成跟子分頁列一樣的 --panel-2 ⇒ 看起來跟下面的子分頁列接成一塊（資料夾的標籤）。
   色弱：選中靠「較高＋接到下面＋粗框＋粗體」，不靠顏色（tests/grptabs-layout.test.js 量真排版）。 */
.tab-nav-main {
  display: flex; gap: 3px; padding: 6px 6px 0; align-items: flex-end;
  background: var(--deep); border-bottom: 2px solid var(--accent);
}
.tab-btn-main {
  flex: 1 1 0; padding: 7px 4px 6px; background: var(--panel); color: var(--ink-dim);
  font-size: 13px; font-family: var(--font-body); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); border-bottom: none; border-radius: 10px 10px 0 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.tab-btn-main:hover { background: var(--panel-2); color: var(--ink); }
.tab-btn-main.active {
  padding-top: 10px; padding-bottom: 9px;
  margin-bottom: -2px;
  color: var(--tab-on); background: var(--panel-2); font-weight: 700;
  border: 2px solid var(--accent); border-bottom-color: var(--panel-2);
}
/* 子分頁裡有東西沒看過（信箱未領取／成就新解鎖）：主分頁跟著點亮一顆會脈動的小圓點——
   跟成就分頁既有的 .tab-btn.has-new 共用同一顆視覺與 keyframes（見下方成就分頁段落），
   不是另外發明一套。這顆點只是第三層訊號，不是唯一訊號：子分頁按鈕自己還有文字變化
   （「📬 信箱 (N)」）與底線／粗體（.has-mail），三層合起來才是完整的「看得到有未讀」。 */
.tab-btn-main.has-badge::after {
  content: ''; position: absolute; top: 4px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 6px var(--accent); animation: acv-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .tab-btn-main.has-badge::after { animation: none; } }

/* GRP-TABS：子分頁＝膠囊按鈕。列底色改成 --panel-2（選中的主分頁接到這裡），按鈕之間留 6px 空隙；
   每顆全圓角、比主分頁小；未選＝透明底＋外框，選中＝塗滿金色＋深色字＋前面「●」（::before；
   ::after 已被 .has-new／.tut-hl 用掉）。「●」用 content 的替代文字語法給空字串，讀屏不念。
   選取器一律掛在 .tab-nav-sub 底下（三個 class 的權重）：「全服／公告」同時帶 .chat-tab，
   後面的 .chat-tab／.chat-tab.active（聊天段）與 .tab-btn.has-mail（信箱段）權重只有兩個 class，
   不這樣寫會被它們蓋回方角、或把選中的字改成淺色疊在金底上。
   未選的外框用 --ink-dim（對 --panel-2 6.14:1）而不是示意檔的 --line（1.53:1，色弱看不到框）。 */
.tab-nav-sub {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
/* 衝裝備沒有子分頁（整列按鈕都是 .hidden）：不留一條 16px 的空白膠囊列，只剩下框線。 */
.tab-nav-sub:not(:has(> :not(.hidden))) { padding: 0; }
.tab-btn {
  /* UI1b 手機寬度自適應：flex item 預設 min-width:auto，白名單一樣的 nowrap 文字
     （例如「⚔️ 自動戰鬥」「📬 信箱 (12)」）在窄螢幕會把欄位撐寬，逼整個
     .tab-nav-sub／.side-panel 超出視窗、右側露出空白。min-width:0 讓欄位能真的縮到
     比文字還窄，超出的部分用 ellipsis 截斷，不會撐寬版面。 */
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.tab-nav-sub .tab-btn {
  flex: 0 1 auto; padding: 4px 12px; background: transparent; color: var(--ink-dim);
  font-size: 12px; font-family: var(--font-body); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--ink-dim); border-radius: 999px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab-nav-sub .tab-btn:hover { background: var(--panel); color: var(--ink); }
.tab-nav-sub .tab-btn.active {
  background: var(--accent); color: var(--deep); border: 1px solid var(--accent); font-weight: 700;
}
.tab-nav-sub .tab-btn.active::before { content: '● '; content: '● ' / ''; }
/* UI6b：鍛造（#tab-btn-forge）用這個 class——它會開一個獨立浮動視窗，不是可選取的
   分頁，js/ui.js 的 renderTabNav() 永遠不會給它 .active（它沒有 .sub-tab class，
   高亮判定的選字選不到它，見該函式的註解）。這裡給 .tab-btn-extra 實際的外觀效果：
   虛線下緣跟旁邊一般子分頁的實線做形狀區分（不只是顏色），比照本檔既有的
   「非一般可選取狀態」語彙（.chat-tab--closed／.chat-tab:disabled 也是虛線框）。 */
.tab-btn-extra { border-bottom-style: dashed; }
/* 「聊天」的子分頁列是 js/chat-ui.js 動態塞進來的既有頻道鈕（.chat-tab，見該檔）：
   display:contents 讓這個容器本身不佔一個 flex item、只當掛載點；`.hidden`
   （display:none）對它仍然有效——對 display:contents 的元素設 display:none 一樣會把
   子孫整組藏起來，切走聊天分頁時這排一樣完全消失，不用另外處理。 */
.tab-subnav-chat { display: contents; }
.tab-subnav-chat .chat-tabs { flex: 1 1 100%; margin: 0; gap: 6px; }
/* GRP-UIREVAMP-U5（規格 §5）：分頻道未讀數字。紅色圓角底＋白字的**數字**（不是只有紅點），
   按鈕有 overflow:hidden，所以徽章是按鈕裡面的真 <span>、貼在右上角內側，不凸出去。
   「交朋友」主分頁同時有信箱／成就的小圓點（.has-badge::after，右上角）時，小圓點讓到左上角，兩者不重疊。 */
.tab-subnav-chat .chat-tab { position: relative; }
.tab-subnav-chat .chat-tab.has-chat-unread { padding-right: 30px; }
.chat-unread {
  position: absolute; top: 2px; right: 2px; z-index: 1;
  min-width: 18px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 8px; background: var(--badge-bg); color: var(--badge-fg);
  font: 700 10px/16px var(--font-body, sans-serif); text-align: center; pointer-events: none;
}
.tab-btn-main.has-chat-unread { padding-right: 26px; padding-left: 14px; }
.tab-btn-main.has-chat-unread.has-badge::after { right: auto; left: 4px; }
/* 聊天泡泡：漫畫對話框（下方尖端，--tail-x 由 js/chat-ui.js 依目標按鈕中心算）。最多 2 行、超過「…」。
   放在 body 底下用頁面座標，右緣對齊遊戲欄（≤480px）。 */
.chat-bubble {
  position: absolute; z-index: 60; box-sizing: border-box; max-width: 320px;
  padding: 6px 10px; border-radius: 10px; border: 2px solid var(--accent);
  background: var(--panel-2); color: var(--ink); font-size: 12px; line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); cursor: pointer; transform-origin: var(--tail-x, 50%) 100%;
}
.chat-bubble::after {
  content: ''; position: absolute; bottom: -8px; left: var(--tail-x, 50%); margin-left: -7px;
  border-width: 8px 7px 0; border-style: solid; border-color: var(--accent) transparent transparent;
}
.chat-bubble-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; word-break: break-word; white-space: normal;
}
.chat-bubble--system { border-style: double; border-width: 3px; }
/* GRP-BOARDMARGIN（主對話 2026-10-10 准改，只動這一條 CSS）：戰鬥區改成 480 排版等比縮放後，窄螢幕的戰鬥區變矮
   （360 寬約 165px），怪物血條離戰鬥區下緣從 70px 變 52.5px。兩行的泡泡（舊 49.6px 高）從主分頁鈕往上長，360 寬會蓋到血條 4.8px
   （tests/uirevamp-u5-layout.test.js U5-L1）。窄於 420 時泡泡改緊湊（上下內距 6→3、行高 1.4→1.3），兩行高 49.6 → 41.2px；
   480 以上不受影響（位置與改前相同）。仍是兩行＋省略號，字級不變。 */
@media (max-width: 419px) {
  .chat-bubble { padding-top: 3px; padding-bottom: 3px; line-height: 1.3; }
}
.chat-bubble--in { animation: chat-bubble-in 0.16s ease-out; }
.chat-bubble--out { transform: scale(0); opacity: 0; transition: transform 0.16s ease-in, opacity 0.16s ease-in; }
@keyframes chat-bubble-in { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .chat-bubble--in { animation: none; }
  .chat-bubble--out { transition: none; }
}
.tab-content { flex: 1; overflow-y: auto; padding: 16px; }
/* GRP-UIREVAMP-U6（§6、§10 第 175 行）：卡普拉視窗在頁面流裡，上緣接主分頁列、寬＝遊戲畫面、高＝螢幕高。
   開著時子分頁列、分頁內容（含 40vh 上限的捲動區）與頁尾都藏起來，視窗是頁面的最後一塊：
   ①一打開（整頁捲回頂端）戰鬥區與主分頁完全看得到 ②整頁捲到底時視窗剛好填滿螢幕 ③關掉時 js 把整頁捲回頂端。 */
.side-panel.kafra-open > .tab-nav-sub,
.side-panel.kafra-open > .tab-content,
.side-panel.kafra-open > .disclaimer-footer { display: none; }
.kafra-window {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0;
  background: var(--panel); border-top: 2px solid var(--accent);
}
.kafra-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.kafra-title { margin: 0; font-family: var(--font-head); font-size: 15px; color: var(--head); }
.kafra-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px; }
/* 商店沿用 engine 的 openNpcShop 畫面；「← 返回地圖」在卡普拉視窗裡沒有意義（關閉在標題列） */
#kafra-body .npc-shop-header > button[onclick^="renderMapTab"] { display: none; }
#kafra-body .rebirth-panel { margin-top: 0; }
.kafra-note {
  margin-bottom: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.6;
  color: var(--ink); border: 1px dashed var(--accent); border-radius: 8px; background: var(--deep);
}
/* GRP-KAFRA-C：卡普拉抽獎老虎機（js/kafra-lottery-ui.js）。三個轉輪並排，360px 也不溢出（grid 三欄 minmax(0,1fr)）。
   稀有度不只靠顏色（使用者色弱）：每格都有「符號＋文字」（◇普通／◆稀有／★史詩／✦傳說），框線樣式也各不相同
   （普通 實線細、稀有 虛線、史詩 雙線、傳說 粗雙線＋底色），轉成灰階仍分得出來。 */
.kafra-lottery { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kl-intro { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ink-dim); }
.kl-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.kl-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 6px 4px; font-size: 13px; }
.kl-pick small { font-size: 11px; color: var(--ink-dim); }
.kl-pick.kl-pick-on { border-color: var(--accent); background: var(--accent-wash); font-weight: 700; }
.kl-money { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 13px; }
.kl-money b { color: var(--head); }
.kl-spin { font-size: 15px; padding: 8px; }
.kl-reels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.kl-reel { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.kl-reel-off { opacity: .6; border-style: dashed; }
.kl-reel-head { font-size: 12px; font-weight: 700; color: var(--head); text-align: center; }
.kl-rates { margin: 0; padding: 0; list-style: none; font-size: 11px; line-height: 1.45; color: var(--ink-dim); }
.kl-rates li { overflow-wrap: anywhere; }
.kl-window { min-width: 0; }
.kl-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 6px 4px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--deep); text-align: center;
}
.kl-cell-name { font-size: 12px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.kl-cell-qty { font-size: 12px; color: var(--head); }
.kl-cell-empty .kl-cell-name, .kl-cell-wait .kl-cell-name { color: var(--ink-dim); }
.kl-tier { font-size: 11px; font-weight: 700; white-space: nowrap; }
.kl-tier-common { color: #c9d3cc; }
.kl-tier-rare { color: #8fc2ff; }
.kl-tier-epic { color: #dcb0ff; }
.kl-tier-legendary { color: #ffd76e; }
.kl-cell-common { border: 1px solid #6c8075; }
.kl-cell-rare { border: 2px dashed #8fc2ff; }
.kl-cell-epic { border: 3px double #dcb0ff; }
.kl-cell-legendary { border: 4px double #ffd76e; background: #2e2610; }
.kl-reel-fresh .kl-cell { animation: kl-drop .45s ease-out 1; }
@keyframes kl-drop { from { transform: translateY(-14px); opacity: .2; } to { transform: none; opacity: 1; } }
.kl-result { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); min-width: 0; }
.kl-result-head, .kl-got-head { font-size: 13px; font-weight: 700; color: var(--head); }
.kl-free-count { font-size: 12px; color: var(--ink); }
.kl-capped { font-size: 12px; padding: 6px 8px; border: 1px dashed var(--accent); border-radius: 6px; color: var(--ink); }
.kl-spins { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.kl-spin-row { min-width: 0; }
.kl-spin-head { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--ink-dim); margin-bottom: 3px; }
.kl-line { color: var(--head); font-weight: 700; }
.kl-spin-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.kl-got { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }
/* GRP-UISMALL7（B7-2）：最近 30 次抽獎紀錄（臉端 localStorage、依帳號）。列表自己捲（最多約四成視窗高），不撐長卡普拉視窗。 */
.kl-log { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); min-width: 0; }
.kl-log-head { font-size: 13px; font-weight: 700; color: var(--head); }
.kl-log-head small { font-weight: 400; font-size: 11px; color: var(--ink-dim); margin-left: 4px; }
.kl-log-note { font-size: 12px; padding: 4px 8px; border: 1px dashed var(--accent); border-radius: 6px; color: var(--ink); }
.kl-log-empty { font-size: 12px; color: var(--ink-dim); }
.kl-log-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.kl-log-row { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); min-width: 0; font-size: 12px; }
.kl-log-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--ink-dim); }
.kl-log-free { color: var(--head); font-weight: 700; }
.kl-log-items { color: var(--ink); overflow-wrap: anywhere; word-break: break-word; line-height: 1.5; }
.kl-log-item { white-space: normal; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.equipment-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#tab-equipment > section + section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.map-monster-list, .map-drop-list { display: flex; flex-direction: column; gap: 5px; }
.map-monster-card { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.map-monster-row, .map-drop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.map-monster-row > span, .map-drop-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.map-drop-row { padding-left: 14px; font-size: 12px; color: var(--ink-dim); }
.map-drop-row b { color: var(--head); }
.battle-unit-picker .sb-units { margin-bottom: 0; }
.battle-position .ab-mode-btns { margin-bottom: 6px; }
/* 聊天面板（.chat-panel）本身用 flex 排版；沒有這條組合選擇器的話，
   下面 .chat-panel { display:flex } 跟這裡的 .tab-panel { display:none }
   specificity 相同、且宣告順序在後，會贏過未啟用分頁的 display:none，
   導致聊天室在任何分頁都顯示。用三個 class 的選擇器把它的優先權蓋過去。 */
.tab-panel.active.chat-panel { display: flex; }
.panel-title { font-family: var(--font-head); color: var(--head); font-size: 15px; margin: 0 0 12px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.empty-hint { color: var(--ink-dim); font-size: 13px; padding: 20px 0; text-align: center; }

/* 地圖分頁 */
.map-list { display: flex; flex-direction: column; gap: 8px; }
.map-item { text-align: left; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); }
.map-item.active { border-color: var(--accent); background: var(--hover); }
.map-item.locked { opacity: 0.45; cursor: not-allowed; }
.map-item-name { font-weight: 700; }
.map-item-req { font-size: 12px; color: var(--ink-dim); margin-top: 3px; }
.auto-toggle { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--ink-dim); }

/* 地區選單（兩層導覽：地區列表 → 城鎮/原野） */
.region-list { display: flex; flex-direction: column; gap: 8px; }
.region-item { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink); }
.region-item:hover:not(.locked) { border-color: var(--accent); }
.region-item.locked { opacity: 0.45; cursor: not-allowed; }
.region-icon { font-size: 28px; flex-shrink: 0; }
.region-info { flex: 1; min-width: 0; }
.region-name { font-weight: 700; font-size: 14px; }
.region-subtitle { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.region-arrow { font-size: 20px; color: var(--head); flex-shrink: 0; }
.region-back { background: none; border: none; color: var(--head); font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 10px; }
.region-back:hover { text-decoration: underline; }
.region-subtitle-detail { font-size: 12px; color: var(--ink-dim); margin: -6px 0 14px; }

/* 地圖下拉選單 */
.map-select-group { margin-bottom: 12px; }
.map-select-label { display: block; font-size: 11px; color: var(--ink-dim); margin-bottom: 4px; }
.map-select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: var(--font-body);
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--accent); border-radius: 8px;
  cursor: pointer;
}
.map-select:focus { outline: none; border-color: var(--head); }
.map-preview-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 14px 0; }
.map-preview-title { font-size: 12px; color: var(--head); font-weight: 700; margin-bottom: 6px; }
.map-preview-body { font-size: 14px; line-height: 1.8; }
.map-preview-hint { font-size: 11px; color: var(--ink-dim); margin-top: 8px; line-height: 1.6; }
.monster-safe { font-size: 14px; color: var(--ink-dim); text-align: center; padding: 0 20px; }

/* 掛機收益面板的實測產出（YLD1：原地圖分頁產出估算已移除） */
.yield-reset-btn { font-size: 11px; padding: 4px 10px; border-radius: 6px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); }
.yield-reset-btn:hover { border-color: var(--accent); color: var(--head); }

.yield-col { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.yield-col-title { font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; }
.yield-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; padding: 2px 0; }
.yield-row span { color: var(--ink-dim); }
.yield-row b { color: var(--head); font-variant-numeric: tabular-nums; }
.yield-empty { font-size: 11px; color: var(--ink-dim); padding: 6px 0; }

/* 技能分頁 */
.skill-list { display: flex; flex-direction: column; gap: 10px; }
.skill-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.skill-row.learned { border-color: var(--accent); }
.skill-name { font-weight: 700; }
/* GRP-SKILLTAB-ICON：技能清單的圖示（固定 20px，不縮、不撐寬）。名稱文字照常保留 */
.sk-ic { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; margin: -2px 4px 0 0; image-rendering: pixelated; }
.skill-desc { font-size: 12px; color: var(--ink-dim); margin: 3px 0; }
.skill-cost { font-size: 11px; color: var(--cost); }
.skill-tag { font-size: 11px; color: var(--head); border: 1px solid var(--accent); padding: 3px 8px; border-radius: 12px; white-space: nowrap; }

/* 背包分頁 */
.equip-row { display: flex; gap: 10px; margin-bottom: 16px; }
.equip-slot { flex: 1; padding: 10px; background: var(--panel-2); border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.equip-icon { width: 26px; height: 26px; object-fit: contain; border-radius: 5px; }
.inv-list { display: flex; flex-direction: column; gap: 8px; }
.inv-row { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.inv-row-main { display: flex; align-items: center; gap: 10px; }
.inv-icon { width: 34px; height: 34px; flex-shrink: 0; }
.inv-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.inv-info { flex: 1; min-width: 0; }
.inv-name { font-size: 13px; font-weight: 700; }
.inv-desc { font-size: 11px; color: var(--ink-dim); }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 藥水設定 */
.potion-toggles { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.potion-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.potion-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.potion-row.selected { border-color: var(--accent); }
.potion-radio { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 13px; cursor: pointer; }
.potion-icon-img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.potion-heal { color: var(--cost); font-size: 11px; }
.potion-qty { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }

/* 角色分頁 */
.job-name { font-size: 13px; color: var(--ink-dim); }
.stat-grid { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
/* 數值欄改成 auto：素質加上職業與裝備加成後會變成「1123+8」這種長字串，
   原本固定 34px 會撐爆並蓋掉右邊的消耗點數 */
.stat-row { display: grid; grid-template-columns: 1fr auto auto 30px; align-items: center; gap: 10px; }
.stat-cost { font-size: 11px; color: var(--cost); text-align: right; white-space: nowrap; min-width: 30px; }
.stat-label { font-size: 13px; color: var(--ink-dim); }
.stat-value { text-align: right; font-weight: 700; color: var(--head); white-space: nowrap; }
/* 有加成來源的區段：提示可以指上去看明細 */
.stat-seg { cursor: help; }
.stat-points-left { font-size: 12px; color: var(--ink-dim); margin-bottom: 14px; }
.derived-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; color: var(--ink); background: var(--panel-2); padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.stat-formula-hint { font-size: 11px; color: var(--ink-dim); line-height: 1.6; margin-top: 10px; }

/* Active buffs display */
.active-buffs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.buff-tag { font-size: 11px; background: #2a4a3a; color: #5dade2; padding: 3px 8px; border-radius: 10px; border: 1px solid var(--cost-line); }
.buff-tag .buff-ic { width: 18px; height: 18px; margin-right: 3px; vertical-align: middle; image-rendering: pixelated; }
.buff-active { font-size: 10px; color: #5dade2; font-weight: 700; }
/* 生效中的裝備套裝：跟 buff 分開配色——buff 會過期，套裝是穿著就有 */
.active-sets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.set-tag {
  font-size: 11px; background: #3a2f18; color: var(--accent);
  padding: 3px 8px; border-radius: 10px; border: 1px solid var(--accent);
}

/* 轉職樹（簽名視覺） */
.job-tree-wrap { background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 8px; overflow-x: auto; }
.job-tree-svg { width: 100%; height: auto; display: block; }
.tree-line { stroke: #3a3f5c; stroke-width: 2; }
.tree-line-active { stroke: var(--accent); stroke-width: 2.5; }
.tree-rect { fill: var(--panel-2); stroke: #3a3f5c; stroke-width: 1.5; }
.tree-node-unlocked .tree-rect { stroke: var(--accent); fill: var(--hover); }
.tree-node-current .tree-rect { fill: #3a2f10; stroke: var(--head); stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(227,154,82,0.6)); }
.tree-icon { font-size: 20px; }
.tree-label { font-size: 11px; fill: var(--ink); font-family: var(--font-body); font-weight: 700; }
.tree-cta { font-size: 8px; fill: var(--head); }
/* 進階二轉的技能分批補，還沒補到的節點標這個 */
.tree-wip { font-size: 8px; fill: #7a8496; }
/* GRP-UISMALL7（B7-3）：還沒開放的職業整個節點不畫了（原 GRP-FEATUREGATE-FACE 的虛線框＋「尚未開放」腳註兩條樣式已拿掉） */
.tree-hint { font-size: 12px; color: var(--ink-dim); line-height: 1.7; margin-top: 12px; }

/* 轉生面板（#56）：條件沒到是暗的，到了才亮金框——一眼看得出現在能不能轉 */
.rebirth-panel { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--deep); }
.rebirth-panel.rebirth-ready { border-color: var(--head); box-shadow: 0 0 12px rgba(227,154,82,.18); }
.rebirth-panel.rebirth-done { border-color: #4a5a7a; }
/* 轉職樹上的指路（面板本體在地圖分頁的安全區） */
.rebirth-pointer {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  border: 1px dashed #4a5a7a; color: var(--ink-dim); font-size: 12px;
}
.rebirth-panel h4 { margin: 0 0 8px; font-size: 14px; color: var(--head); }
.rebirth-req { font-size: 12px; color: var(--ink); margin-bottom: 6px; }
.rebirth-gain { font-size: 12px; color: var(--ink-dim); line-height: 1.7; margin-bottom: 10px; }
.rebirth-block { font-size: 12px; color: #e0674f; }

/* ---------------- 強制手機版面（D1：所有視窗寬度都套用） ---------------- */
  .game-shell { height: auto; min-height: 100vh; }
  .game-body { flex-direction: column; min-height: 0; height: auto; }

  .hud-bar { flex-wrap: wrap; padding: 8px 12px; gap: 8px 14px; }
  .hud-left { min-width: 0; flex: 1 1 auto; }
  /* UI1b 修主對話實機核實：這裡原本是 flex:0 0 auto（flex-shrink:0），
     .hud-right 完全不准縮，於是無視 gap/flex-wrap，永遠用未縮版最大內容寬（~365px）
     渲染，360px 寬時整排連同 #btn-idle-report 一起溢出視窗（實測右緣 365）。
     改成 flex-shrink:1（配合下面 base rule 的 min-width:0），才會真的在窄螢幕
     跟 .hud-left 搶版面、縮到需要換行為止。 */
  .hud-right { flex: 0 1 auto; }
  /* GRP-HUDPCTOUT（B7-4）：.hud-bars 已不存在（EXP／JOB 條搬到能力分頁），原本這裡的 order:3／width:100% 規則移除。 */

  /* GRP-BATTLEAREA（#126）：手機戰鬥區固定 220px，下方分頁不跳。
     GRP-BATTLEFIX（156-7）實測：跳的是 #board，不是 .battle-panel，也不是 .side-panel。
     原因是 4754e0a 把戰鬥區釘成 220px，增益列 display:none 離開排版後，高度差由棋盤吸收
     舊版折行會讓棋盤從 124 掉到 101.61（三顆）或 108.22（三個純文字）。
     FIX1：增益列與異常列固定高度，0～12 顆與 0～6 個異常棋盤同高。多的在列內左右捲。
     FIX2：增益列 32px、HUD 異常列 16px＋上下 margin。怪物腳下異常改往上疊，不佔棋盤高。
     .battle-scene 直接用基底的 height:100%（父層是固定 height，解得出來）。 */
  /* GRP-BOARDMARGIN（C33，使用者 2026-10-10 選 1）：戰鬥區固定用 480×220 排版（#battle-scene），整塊等比縮放：
     縮放比 --battle-z＝min(1, 戰鬥區實際寬 ÷ 480)，由 js/ui.js battleZoomSync() 量 .battle-panel 寫入（CSS 沒辦法把長度除成純數字）。
     ・上限 1：.game-shell 本來就 max-width:480px，寬螢幕時戰鬥區不會比 480 寬，兩邊留白由 .game-shell 的 margin:auto 負責；
       不放大也避免像素圖被拉糊。
     ・高度一起縮（主對話 2026-10-10 裁決 A）：戰鬥區看起來的高＝219 × 縮放比 ＋ 1px 下框線（舊版 220 扣下框線＝219；360 寬 → 約 165px）。
     ・用獨立的 scale 屬性、不用 transform：稀有掉寶的震動（lootRareImpact）用 WAAPI 動畫 #battle-scene 的 transform，
       兩者各自疊加，不會在震動那 240ms 把縮放蓋掉。不用 zoom：transform 類的縮放在各瀏覽器的
       getBoundingClientRect／點擊命中都一致（畫面座標＝本地座標 × 縮放比），zoom 在舊版 Safari 的量測行為不一樣。
     ・#battle-scene 的排版盒仍是 480×219（超出 .battle-panel 的部分由它的 overflow:hidden 裁掉，不會出現水平捲軸）。 */
  /* GRP-BATTLESCALE393（B9-12，主對話 2026-10-11 裁決 B）：狀態列 32 → 39.08 多出的 7.08 不讓棋盤吸收，排版總高 219 → 226.08
     （HUD 45 ＋ 棋盤 142 ＋ 狀態列 39.08），棋盤可視高維持；代價是下方分頁少約 6px。 */
  .battle-panel { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--line); height: calc(226.08px * var(--battle-z, 1) + 1px); min-height: 0; }
  .battle-panel > .battle-scene {
    flex: none; width: 480px; height: 226.08px; max-width: none;
    margin-left: max(0px, calc((100% - 480px) / 2));
    scale: var(--battle-z, 1); transform-origin: 0 0;
  }
  /* 棋盤手機最小高 170→96：增益列折成兩列時（約 59px）棋盤剩 113px，仍留地平線下 30px＋人物約 66px，增益列不被戰鬥區下緣裁掉。 */
  .board { min-height: 96px; }
  /* 背景外框寬固定 960px（＝改前 320px 高時的顯示尺寸 3072×1024 × 0.3125），cover＋下緣對齊：
     圖還是 320px 高、下緣貼戰鬥區底，上方約 100px 天空被裁掉；左右不裁，兩張接續的圖之間沒有縫。
     ⚠ 地圖主題圖全部 3072×1024（3:1）；外框比例 960:219 比 3:1 寬，cover 一律以寬度縮放 ⇒ 不會裁左右。 */
  .map-bg-track img { width: 960px; }
  .monster-area { min-height: 150px; }
  /* .combat-log { height: 96px; } 已移除（UI3b）：.combat-log 整組 class 不存在於 DOM，
     說明見本檔前面 .combat-log 移除的大段註解。 */

  .side-panel { max-width: none; min-width: 0; flex: 1 1 auto; }
  /* UI6：多了一整排主分頁列（約 35–40px），46vh 是舊版單排分頁列時代量出來的數字，
     兩排之後會把輸入列擠出視窗外要捲動才看得到。先保守收窄成 40vh 讓兩排＋輸入列
     留在視窗內；沒有真機／瀏覽器可以量，屬未驗證的估計值，需要指揮官在實機（或
     360–412px 寬的瀏覽器視窗）核實後再微調（見派工回報「給指揮官的實機驗證清單」）。 */
  .tab-content { max-height: 40vh; }

  .create-stat-row { grid-template-columns: 1fr 26px 30px 26px; }
@media (max-width: 420px) {
  .game-title { font-size: 40px; }
  .btn { min-width: 200px; padding: 12px 24px; }
  .monster-icon { font-size: 64px; }
}
/* GRP-CHARS15：選角卡片在窄螢幕縮內距（放在這裡，不要放到 860px 媒體查詢之前——tests/face-chat-market.test.js 的 UI1b 以「第一個 420px 媒體查詢」當 860px 區段的結尾）。 */
@media (max-width: 420px) {
  #screen-charselect .create-stage { padding: 20px 14px; }
  .charselect-card { padding: 10px 12px; gap: 2px 8px; }
  .charselect-card .btn { min-width: 96px; padding: 8px 10px; }
}

/* ---------------- Toast 提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--head);
  padding: 10px 22px; border-radius: 24px; font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* GRP-D：右下角變體（背包排序切換提示）；不影響其他置中 toast */
.toast.toast-br { left: auto; right: 16px; bottom: 16px; transform: translate(0, 20px); }
.toast.toast-br.show { transform: translate(0, 0); }
/* GRP-UI5SMALL（B7-1）：「按住可連點」提示貼在被點的「＋」上緣（位置由 js/ui.js placePlusHoldTip 每格對位；放不下就到下緣加 .below）。
   配色同 toast（文字＋邊框，不靠顏色傳意思）；箭頭指著按鈕中心（--tip-arrow-x）。 */
.plus-hold-tip {
  position: fixed; left: 0; top: 0; display: none; white-space: nowrap; max-width: calc(100vw - 8px);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--head);
  padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.4;
  pointer-events: none; z-index: 210; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.plus-hold-tip.show { display: block; }
.plus-hold-tip::after {
  content: ''; position: absolute; left: var(--tip-arrow-x, 50%); top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--accent);
}
.plus-hold-tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--accent); }

/* ---------------- 傷害飄字 ---------------- */
.damage-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 15;
  /* GRP-FLT（#42）：飄字的物件池都在這一層（.battle-scene 裡、蓋住 HUD 與棋盤），數字的版面與繪製
     不會牽動層外。⚠ contain: strict 含 paint，超出 .battle-scene 的部分會被裁掉——
     外層 .battle-panel 本來就是 overflow:hidden，看得到的範圍不變。 */
  contain: strict;
  /* 便宜的黑邊：8 個方向各 1px 的 text-shadow（不模糊），取代 3px 的 -webkit-text-stroke＋paint-order。
     上色的變體只換自己的光暈，黑邊一律疊在最前面。 */
  --flt-ol: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 -1px 0 #000, 0 1px 0 #000, -1px 0 0 #000, 1px 0 0 #000;
}
/* 物件池的閒置節點：display:none。從 none 變回顯示時 CSS 動畫會重頭播（js 只重用更早的幀就收起的節點）。 */
.flt-off { display: none; }
.damage-float {
  position: absolute;
  /* FX3：水平回退半個字寬，讓整串數字的中心對齊 style.left（＝目標中心），
     跟暴擊的 .crit-burst-num 同一個中心。
     ⚠ 一定要用獨立的 `translate:` 屬性——`@keyframes floatUp` 每一格都設 `transform`，
     寫成 transform: translateX(-50%) 會被動畫整個蓋掉（看起來像改了沒用）。 */
  translate: -50%;
  font-weight: 900;
  font-size: 22px;
  color: #fff;
  /* UI11：黑色描邊，在任何背景上都讀得到。GRP-FLT：改成多向 1px 的 text-shadow（--flt-ol），
     不再用 -webkit-text-stroke＋paint-order（描邊要沿字形路徑點陣化，手機上很貴）；上色的變體只換光暈。 */
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  pointer-events: none;
  z-index: 9999;
  /* UI11：彈出（放大後回彈）→ 上飄 → 淡出；both 讓錯開的延遲期間保持隱形，不先閃一下靜止的字 */
  animation: floatUp 1.05s cubic-bezier(.2,.7,.3,1) both;
  white-space: nowrap;
  overflow: visible;
}
.damage-float.crit {
  font-size: 30px;
  color: #ff4444;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(255,68,68,0.5);
  animation: critFloat 0.9s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes critFloat {
  0% { opacity: 0; transform: translateY(4px) scale(0.6); }
  10% { opacity: 1; transform: translateY(-4px) scale(1.15); }
  24% { opacity: 1; transform: translateY(-10px) scale(1.1); }
  70% { opacity: 1; transform: translateY(-44px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}

/* 暴擊星爆：15 張圖輪播，整組（星爆圖＋黃色數字）一起往上飄並淡出。
   飄動掛在外層，圖與數字各自只負責自己的置中，兩者就會鎖在一起移動。 */
.crit-burst {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
  animation: critBurstFloat 0.9s ease-out forwards;
}
.crit-burst-img {
  display: block;
  width: 96px;
  height: 66px;
  margin: -33px 0 0 -48px;   /* 以自身中心對齊外層的定位點 */
  image-rendering: pixelated;
}
.crit-burst-num {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 900;
  font-size: 30px;
  color: #ffd83d;
  /* UI11：爆擊描邊比一般數字更粗。GRP-FLT：多向 text-shadow 黑邊再疊一圈 2px 的（仍不模糊） */
  text-shadow: var(--flt-ol), -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000, 1px 1px 2px rgba(0,0,0,0.95), 0 0 10px rgba(255,200,40,0.75);
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  transform: translate(-50%, -50%);
  animation: critNumPop 0.25s ease-out;
}
/* 節奏比照原本的飄字：先快後慢往上 72px，最後三成才淡掉 */
@keyframes critBurstFloat {
  0%       { opacity: 1; transform: translateY(0); }
  25%      { opacity: 1; transform: translateY(-14px); }
  70%      { opacity: 1; transform: translateY(-48px); }
  100%     { opacity: 0; transform: translateY(-72px); }
}
/* 數字起手放大彈一下，位置維持在圖正中央 */
@keyframes critNumPop {
  /* GRP-FLT：起手放大 ≤1.15（舊版 2.1 倍會讓文字在動畫中重新點陣化） */
  0%   { transform: translate(-50%, -50%) scale(1.15); }
  60%  { transform: translate(-50%, -50%) scale(0.96); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* 暴擊閃光效果 */
.crit-flash-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(circle, rgba(255,100,50,0.35) 0%, rgba(255,50,0,0.15) 40%, transparent 70%);
  animation: critFlash 0.35s ease-out forwards;
}
@keyframes critFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.damage-float.heal {
  color: #00FF00;
  font-size: 20px;
}
/* GRP-FXB1（#46）：補 SP 飄字——官方藍 #2130BF（深藍在暗背景太暗，加亮藍實心描邊，見下），
   字尾帶「SP」字樣（由引擎組字），色弱不靠顏色也能分。 */
.damage-float.heal-sp {
  color: #2130BF;
  font-size: 20px;
  /* GRP-FXB1-FIX：#2130BF 對黑底只有 2.24:1。改成兩圈**不模糊**的實心描邊（模糊外光會變半透明、對比算不準）：
     內圈 1px 亮藍 #9EC0FF（對黑底 11.44:1、對字色 #2130BF 5.11:1，都 ≥ 4.5），外圈 2px 黑（亮背景上也有邊）。
     text-shadow 先寫的畫在上層，所以亮藍內圈貼著字、黑圈在外。字色本身維持官方藍。 */
  text-shadow: -1px -1px 0 #9EC0FF, 1px -1px 0 #9EC0FF, -1px 1px 0 #9EC0FF, 1px 1px 0 #9EC0FF, 0 -1px 0 #9EC0FF, 0 1px 0 #9EC0FF, -1px 0 0 #9EC0FF, 1px 0 0 #9EC0FF,
    -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 -2px 0 #000, 0 2px 0 #000, -2px 0 0 #000, 2px 0 0 #000;
}
/* GRP-FLOATFX2（#130-4）：玩家身上的回復飄字（heal／heal-sp）字級縮小（20px → 10px），
   怪物頭上的補血沒有 .heal-self、維持 20px。
   GRP-BOARDMARGIN（C33）：戰鬥區最小字 12px ⇒ 10 → 12px（仍比怪物補血的 20px 小，「玩家身上的比較小」不變）。
   GRP-BATTLESCALE（B9-1）：舊值 10px ÷ 0.75 ⇒ 13.33px（360 寬縮放後＝改版前的 10px；仍比怪物補血的 20px 小）。
   GRP-BATTLESCALE393：改 ÷ 0.81875 ⇒ 12.21px（393 寬縮放後＝改版前的 10px）。 */
.damage-float.heal.heal-self,
.damage-float.heal-sp.heal-self {
  font-size: 12.21px;
}
/* GRP-FXB1（#36）：玩家受到的傷害（怪普攻／技能／反射／DoT／自傷）一律官方紅 #FF0000，
   前置「-」（由呼叫點組字），不借用 element-bad 的「▼」。 */
.damage-float.hit-taken {
  color: #FF0000;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(255,0,0,0.45);
}
/* GRP-FXB2（#49）：多段傷害的累計總和——官方黃 #E6E626（COMBO）。
   色弱：不只靠顏色——①文字帶「Σ」前綴（js/ui.js 拼字）②外加一圈方框（形狀訊號，灰階下照樣看得到）
   ③位置固定在整疊白字上方（js 的 FLOAT_GEOM.comboGapPx）。 */
.damage-float.combo {
  color: #E6E626;
  font-weight: 700;
  border: 2px solid #E6E626;
  border-radius: 4px;
  padding: 0 4px;
  background: rgba(0,0,0,0.55);
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9);
}
/* FX3：MISS／GUARD／免傷的共用外觀（字級、斜體）。顏色由下面兩個分邊 class 決定；
   `.miss` 自己保留舊的灰色，給不認得新型別的舊呼叫端當保底。 */
.damage-float.miss {
  color: #aaa;
  font-size: 16px;
  font-style: italic;
  /* UI11：MISS 自己的樣式——字距拉開、較細的描邊、不彈跳只輕飄（跟傷害數字一眼分得出來） */
  letter-spacing: .08em;
  animation: missFloat 0.9s ease-out both;
}
@keyframes missFloat {
  0% { opacity: 0; transform: translateY(2px) scale(0.85); }
  15% { opacity: 1; transform: translateY(-4px) scale(1.05); }
  70% { opacity: 1; transform: translateY(-22px) scale(1); }
  100% { opacity: 0; transform: translateY(-34px) scale(1); }
}
/* 打在玩家身上（MISS／GUARD／免傷／免疫）＝紅。字樣本身就是文字，不是只靠顏色分類。 */
.damage-float.miss-self {
  color: #ff5b5b;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(255,91,91,0.45);
}
/* 打在怪身上（玩家／隊友打歪）＝白。 */
.damage-float.miss-foe {
  color: #ffffff;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.6);
}
/* FX3 追加：完全迴避（Perfect Dodge）＝官方 RO 的 "Lucky!!"，用淡黃。
   跟暴擊的 #ffd83d 差在**飽和度**（76% → 31%）而不是亮度——兩個都是接近白的亮色，
   單靠相對亮度只能拉到 1.23:1。真正的區分訊號是字樣本身（Lucky!! vs 數字）、
   位置（玩家 vs 怪物）與大小（16px 斜體 vs 26px 粗體＋星爆圖），色弱也分得出來。
   在戰鬥背景 --bg #12141c 上的對比度 16.37:1（WCAG AAA 門檻 7:1）。 */
.damage-float.miss-lucky {
  color: #fff3b0;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(255,224,102,0.55);
}
/* GRP-FLTD（#78）：怪物身上的持續傷害每跳。字級與動畫刻意跟一般白字相同（22px＋floatUp）——
   js/ui.js 把它當成一顆白字記進飄字障礙（盒高 32、motion white），換字級或動畫會讓 Σ 的避讓模型算錯。
   色弱：不只靠顏色——①數字前的符號（🩸 出血、☠ 中毒，js/ui.js 的 floatText 拼字）②兩者亮度拉開
   （出血淡紅 #ff9b9b 相對亮度約 0.47，中毒紫 #b07cff 約 0.31，兩者對比只有 1.45:1，所以主要訊號是符號；
   對戰鬥背景 #12141c 分別是 9.1:1 與 6.3:1）
   ③斜體（形狀訊號，跟直立的普攻白字分得開）。 */
.damage-float.dot { font-style: italic; }
.damage-float.dot-bleed {
  color: #ff9b9b;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(255,80,80,0.5);
}
.damage-float.dot-poison {
  color: #b07cff;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(150,90,255,0.5);
}
.damage-float.element-good {
  color: #2ecc71;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 6px rgba(46,204,113,0.4);
}
.damage-float.element-bad {
  color: #bb77dd;
  text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 6px rgba(155,89,182,0.4);
}
.damage-float.element-immune {
  color: #999;
  font-size: 20px;
}

/* 魔法傷害的數字照施法屬性上色。顏色與下面的 .element-float 同一套，
   但這裡是傷害數字，所以只換顏色與光暈，字級維持原本的 22px。
   無屬性魔法不會拿到這些 class，看起來跟物理傷害一樣。 */
.damage-float.ele-fire    { color: #ff4b30; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(255,75,48,0.7); }
.damage-float.ele-water   { color: #3ba7ff; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(59,167,255,0.7); }
.damage-float.ele-wind    { color: #2fdc6e; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(47,220,110,0.7); }
.damage-float.ele-earth   { color: #d2a63c; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(210,166,60,0.7); }
.damage-float.ele-poison  { color: #b45cff; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(180,92,255,0.7); }
.damage-float.ele-holy    { color: #ffe066; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(255,224,102,0.7); }
.damage-float.ele-shadow  { color: #8f7bd8; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(143,123,216,0.7); }
.damage-float.ele-ghost   { color: #7fe6e0; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(127,230,224,0.7); }
.damage-float.ele-undead  { color: #9aa88c; text-shadow: var(--flt-ol), 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(154,168,140,0.7); }

/* ---------------- 屬性克制飄字 ----------------
   GRP-BATTLEFIX（156-8）：字級 14px（傷害數字是 22px），停在多段白字下方。
   屬性名文字留著（火／水…、×N%、免疫），不只靠顏色。三種都是 14px，大小也不當唯一訊號。 */
.element-float {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
  color: #fff;
  text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9);
  animation: elementFloatDown 1.4s ease-out forwards;
}
/* 被克時透明一些——是壞消息，不該比克制還搶眼。字級與克制相同。 */
.element-float.weak { font-size: 14px; opacity: 0.9; }
.element-float.immune { font-size: 14px; color: #b0b0b0; }

.element-float.ele-fire    { color: #ff4b30; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(255,75,48,0.85); }
.element-float.ele-water   { color: #3ba7ff; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(59,167,255,0.85); }
.element-float.ele-wind    { color: #2fdc6e; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(47,220,110,0.85); }
.element-float.ele-earth   { color: #d2a63c; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(210,166,60,0.85); }
.element-float.ele-poison  { color: #b45cff; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(180,92,255,0.8); }
.element-float.ele-holy    { color: #ffe066; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(255,224,102,0.85); }
.element-float.ele-shadow  { color: #8f7bd8; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(143,123,216,0.8); }
.element-float.ele-ghost   { color: #7fe6e0; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(127,230,224,0.8); }
.element-float.ele-undead  { color: #9aa88c; text-shadow: var(--flt-ol), 0 2px 4px rgba(0,0,0,0.9), 0 0 14px rgba(154,168,140,0.8); }
.element-float.ele-none    { color: #e8e8e8; }

@keyframes elementFloatDown {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0px) scale(0.85); }
  18%  { opacity: 1; transform: translateX(-50%) translateY(2px) scale(1.08); }
  32%  { opacity: 1; transform: translateX(-50%) translateY(4px) scale(1); }
  75%  { opacity: 1; transform: translateX(-50%) translateY(8px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(14px) scale(1); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(4px) scale(0.5); }
  10% { opacity: 1; transform: translateY(-4px) scale(1.12); }
  22% { opacity: 1; transform: translateY(-8px) scale(0.94); }
  32% { opacity: 1; transform: translateY(-12px) scale(1); }
  75% { opacity: 1; transform: translateY(-40px) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.96); }
}

/* ---------------- 怪物受擊動畫 ---------------- */
.monster-hit {
  animation: monsterShake 0.15s ease-in-out;
}
@keyframes monsterShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* 攻擊閃光效果 */
.attack-flash {
  animation: flashWhite 0.1s ease-out;
}
@keyframes flashWhite {
  0% { filter: brightness(2); }
  100% { filter: brightness(1); }
}

/* 暴擊特效 */
.crit-flash {
  animation: critPulse 0.3s ease-out;
}
@keyframes critPulse {
  0% { transform: scale(1); filter: brightness(1.5) saturate(1.5); }
  50% { transform: scale(1.1); filter: brightness(2) saturate(2); }
  100% { transform: scale(1); filter: brightness(1) saturate(1); }
}

/* 怪物死亡動畫 */
.monster-dying {
  animation: monsterDie 0.5s ease-out forwards;
}
@keyframes monsterDie {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); filter: brightness(2); }
  100% { opacity: 0; transform: scale(0.5); filter: brightness(0); }
}

/* 玩家受擊效果 */
.player-hit {
  animation: playerShake 0.2s ease-in-out;
}
@keyframes playerShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* 技能施放特效 */
.skill-cast {
  animation: skillPulse 0.3s ease-out;
}
@keyframes skillPulse {
  0% { box-shadow: 0 0 0 0 rgba(227,154,82,0.7); }
  70% { box-shadow: 0 0 0 15px rgba(227,154,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(227,154,82,0); }
}

/* 屬性特效背景 */
.element-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  animation: elementBurst 0.4s ease-out forwards;
}
.element-effect.fire { background: radial-gradient(circle, rgba(255,100,0,0.6), transparent); }
.element-effect.water { background: radial-gradient(circle, rgba(0,150,255,0.6), transparent); }
.element-effect.earth { background: radial-gradient(circle, rgba(139,100,0,0.6), transparent); }
.element-effect.wind { background: radial-gradient(circle, rgba(100,255,100,0.6), transparent); }
.element-effect.holy { background: radial-gradient(circle, rgba(255,255,200,0.6), transparent); }
.element-effect.shadow { background: radial-gradient(circle, rgba(100,0,150,0.6), transparent); }

@keyframes elementBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* ---------------- 離線結算彈窗 ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,19,15,0.72);
  display: flex; align-items: center; justify-content: center; z-index: 150; padding: 20px;
}
.modal-box {
  width: 420px; max-width: 100%; background: var(--panel); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  /* 內容再長也不超過視窗高度（#123）。改成直排 flex 之後，
     只有**中間那塊**會捲——標題與底下的按鈕永遠留在畫面上。
     整個盒子一起捲的話，「我知道了」會被推到看不見的地方，
     使用者得先捲到底才關得掉。 */
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);   /* 40px = overlay 的上下 padding */
}
/* 中間可捲的那塊。用 :not() 排除固定不動的標題與按鈕，
   免得每個彈窗都要另外加 class */
.modal-box > *:not(.modal-title):not(.modal-confirm):not(.consent-row) {
  overflow-y: auto; min-height: 0;
}
.modal-title, .modal-confirm, .consent-row { flex: 0 0 auto; }
.modal-title { font-family: var(--font-head); color: var(--head); margin: 0 0 14px; text-align: center; }
.offline-duration { font-size: 14px; line-height: 1.7; color: var(--ink); margin: 0 0 10px; }
.offline-levelup { color: var(--head); font-weight: 700; margin-bottom: 10px; }
/* T14 離線報告：被擊倒／藥水用完。狀態靠圖示＋文字＋粗邊框，不靠色相 */
.offline-notice { font-size: 13px; line-height: 1.6; color: var(--ink); margin: 0 0 10px; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 6px; }
.offline-notice--death { font-weight: 700; border: 2px solid var(--ink); }
.offline-consumed { margin-bottom: 12px; }
.offline-sub { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.offline-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; margin-bottom: 12px; }
.offline-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.offline-item { font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; }
.offline-item-empty { font-size: 12px; color: var(--ink-dim); }
.modal-confirm { width: 100%; min-width: 0; }

/* Skills tab */
.skills-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.skills-header .panel-title { margin: 0; }
.btn-respec { background: var(--bad-bg); color: #fff; font-size: 0.7rem; padding: 2px 8px; }
.skill-tag { font-size: 0.65rem; padding: 1px 5px; border-radius: 3px; margin-left: 6px; }
.skill-tag.quest { background: var(--accent); color: var(--bg); }
.skill-tag.maxed { background: var(--cost-line); color: #fff; }
.skill-tag.unlearned { background: var(--ink-dim); color: var(--bg); }
.skill-actions { display: flex; align-items: center; gap: 4px; }
.btn-levelup { width: 28px; height: 28px; font-size: 1rem; font-weight: 700; padding: 0; }
.btn-levelup:disabled { opacity: 0.3; }
/* GRP-SKILLTAB（192-9）：技能分頁的圖示與「＋」放大 2 倍（20→40、28→56），「放進技能欄」排在「＋」下面（直排）。
   只限 #tab-skills：.sk-ic 也用在打怪設定的技能欄清單，那邊不放大。 */
#tab-skills .skill-name .sk-ic { width: 40px; height: 40px; margin: -4px 6px 0 0; }
#tab-skills .skill-actions { flex-direction: column; align-items: stretch; gap: 6px; flex: none; }
#tab-skills .btn-levelup { width: 56px; height: 56px; font-size: 2rem; align-self: center; }
#tab-skills .skill-put-bar { max-width: 76px; white-space: normal; line-height: 1.2; padding: 4px 6px; }
#tab-skills .skill-put-bar.is-full { border-style: dashed; color: var(--ink-dim); }
/* 192-8：按住連點——手機長按不選字、不跳選單、不等雙擊縮放 */
.btn-levelup, .stat-row .btn-tiny { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* 192-9：技能滿級——Lv 標籤本身變色＋粗框＋★（拿掉了 MAX 標籤；色弱：不只靠顏色） */
.skill-tag.skill-lv-max { background: var(--cost-line); color: #fff; border: 2px solid var(--head); font-weight: 700; }

/* Skill job sections */
.skill-job-section { margin-bottom: 12px; }
.skill-job-header { font-size: 14px; font-weight: 700; color: var(--head); padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.2s; user-select: none; }
.skill-job-header:hover { background: var(--hover); }
.skill-job-section.current-job .skill-job-header { border-color: var(--accent); background: var(--hover); }
.skill-job-toggle { font-size: 10px; width: 14px; text-align: center; flex-shrink: 0; }
.skill-job-tier { font-size: 11px; color: var(--ink-dim); font-weight: 400; }
.skill-job-current { font-size: 10px; color: var(--bg); background: var(--accent); padding: 1px 6px; border-radius: 8px; font-weight: 700; }
.skill-job-points { margin-left: auto; font-size: 12px; color: var(--cost); font-weight: 600; }
/* 二轉／進階二轉共用同一個技能點池時，標在數字後面（#101） */
.skill-job-shared { margin-left: 4px; font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.skill-job-spent { font-size: 11px; color: var(--ink-dim); }
/* 展開後標頭釘在頂端（#102）：一個職業攤開有 15~22 招，捲到一半就看不到
   「現在看的是哪個職業、還剩幾點、已投入幾點」。做法跟裝備分頁同一套——
   .tab-content 是外層捲動容器，負的 top 抵銷它的 16px padding 才會真的貼齊上緣。
   只有展開的區塊需要黏；收合的整列本來就只有一行高。 */
.skill-job-section.expanded .skill-job-header {
  position: sticky;
  top: -16px;
  z-index: 5;
}
.skill-job-section.collapsed .skill-list { display: none; }
.skill-job-section.expanded .skill-list { display: block; }
.skill-type { font-size: 10px; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.skill-type.passive { background: #5b6b9c; color: #fff; }
.skill-type.attack { background: #c0392b; color: #fff; }
.skill-type.heal { background: #27ae60; color: #fff; }
.skill-type.dot { background: #8e44ad; color: #fff; }
.skill-type.buff { background: #2980b9; color: #fff; }
.skill-type.debuff { background: #d35400; color: #fff; }
/* GRP-SKILLTAB（192-12）：多標籤新增的五種（標籤本身就是文字，顏色只是輔助） */
.skill-type.magic { background: #6c3fb5; color: #fff; }
.skill-type.phys { background: #a93226; color: #fff; }
.skill-type.aoe { background: #1f6f6b; color: #fff; }
.skill-type.ailment { background: #7d5a00; color: #fff; }
.skill-type.knockback { background: #4a4a4a; color: #fff; }
.skill-element { font-size: 12px; margin-left: 4px; }

/* NPC Shop */
.npc-shop { padding: 8px 0; }
.npc-shop-list { display: flex; flex-direction: column; gap: 8px; }
.npc-shop-card { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color 0.2s; }
.npc-shop-card:hover { border-color: var(--accent); }
.npc-shop-icon { font-size: 1.5rem; }
.npc-shop-info { flex: 1; }
.npc-shop-name { font-weight: 600; color: var(--head); font-size: 0.9rem; }
.npc-shop-hint { font-size: 0.7rem; color: var(--ink-dim); margin-left: auto; }
.npc-shop-count { font-size: 0.7rem; color: var(--ink-dim); }
.npc-shop-arrow { color: var(--ink-dim); font-size: 0.8rem; }
.npc-shop-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.npc-shop-header .panel-title { margin: 0; }
.shop-category { margin-bottom: 12px; }
.shop-category-title { font-size: 0.85rem; color: var(--head); margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.shop-items { display: flex; flex-direction: column; gap: 4px; }
.shop-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.shop-cannot-afford { opacity: 0.6; }
.shop-item-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.shop-item-icon { font-size: 1.2rem; }
/* GRP-UISMALL6（B9-7）：圖示換成背包同一張圖（js/ui.js shopUseBagIcons），尺寸照背包列表的 .inv-icon（34px）。 */
.shop-item-icon { width: 34px; height: 34px; flex-shrink: 0; }
.shop-item-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.shop-item-details { display: flex; flex-direction: column; }
.shop-item-name { font-weight: 500; font-size: 0.85rem; }
.shop-item-desc { font-size: 0.7rem; color: var(--ink-dim); margin-left: 6px; }
.shop-item-stats { font-size: 0.7rem; color: var(--cost); }
.shop-item-actions { display: flex; align-items: center; gap: 8px; }
.shop-item-price { font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.shop-item-owned { font-size: 0.7rem; color: var(--ink-dim); }
.equip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.equip-slot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; text-align: center; }
.equip-slot-name { font-size: 0.65rem; color: var(--ink-dim); margin-bottom: 4px; }
.equip-slot-item { font-size: 0.75rem; color: var(--head); display: flex; align-items: center; justify-content: center; gap: 4px; }
.equip-icon { width: 20px; height: 20px; object-fit: contain; }
.ref-tag { color: #5dade2; font-weight: 700; font-size: 0.7rem; }
.equip-refine { margin-top: 4px; }
.equip-card { font-size: 0.65rem; color: #58d68d; margin-top: 2px; }
.equip-card-actions { margin-top: 2px; }

/* ---- RO 風裝備視窗（10 格自設計） ---- */
.ro-equip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* GRP-F-UI #24：長名稱不准撐寬欄位 */
  gap: 6px;
  margin-bottom: 12px;
  max-width: 360px;
}
.ro-equip-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 52px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ro-equip-slot:hover {
  border-color: var(--accent);
  background: var(--panel);
}
.ro-equip-slot.has-item {
  border-color: var(--accent);
  border-style: solid;
}
.ro-equip-slot .slot-label {
  font-size: 9px;
  color: var(--ink-dim);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ro-equip-slot .slot-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
}
.ro-equip-slot .slot-empty {
  width: 28px;
  height: 28px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--line);
}
.ro-equip-slot .slot-name {
  font-size: 10px;
  color: var(--head);
  margin-top: 2px;
  text-align: center;
  max-width: 100%;
  /* GRP-F-UI #24：名稱含精煉與插卡前綴、不設長度上限 ⇒ 換行顯示，不截斷、不撐破格子 */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
/* ---- 裝備分頁：GRP-F-UI #41 起只有「武器／防具」切換列黏頂，裝備欄與清單一起捲 ---- */
/* GRP-F-UI #41：裝備分頁的 .equip-sticky 只包切換列（裝備欄移到外面，見 renderEquipTab()）；遺物頁仍包「切換列＋八格遺物欄」。
   以下是舊註解：.tab-content 是外層捲動容器，這裡用 sticky 把「裝備欄 + 武器/防具切換鈕」
   一起黏在頂端；負的 top 是為了抵銷 .tab-content 的 16px padding，讓它真的貼齊上緣。
   兩者包在同一個容器裡而不是各自 sticky——分開做的話切換鈕的 top 必須等於
   裝備欄的實際高度，而那個高度會隨外觀面板與裝備數量變動，只能靠 JS 量。 */
.equip-sticky {
  position: sticky;
  top: -16px;
  z-index: 5;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.equip-fixed {
  background: var(--panel);
  padding: 12px 0 8px;
  margin-top: -12px;
}
/* 裝備分頁裡的格子縮小一點，才空得出下方選單的位置 */
.equip-fixed .ro-equip-grid { gap: 4px; margin-bottom: 8px; max-width: 300px; }
.equip-fixed .ro-equip-slot { min-height: 42px; padding: 4px 3px; }
.equip-fixed .ro-equip-slot .slot-icon,
.equip-fixed .ro-equip-slot .slot-empty { width: 22px; height: 22px; }
.equip-fixed .ro-equip-slot .slot-label { font-size: 8px; margin-bottom: 1px; }
.equip-fixed .ro-equip-slot .slot-name { font-size: 9px; }
.equip-fixed .ro-equip-slot .slot-cards { margin-top: 1px; }

.equip-fixed-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.equip-fixed-head .panel-title { margin: 0; display: flex; align-items: center; gap: 6px; }
.equip-collapse-btn { padding: 0 6px; line-height: 1.4; font-size: 11px; }
.equip-fixed.collapsed { padding-bottom: 4px; }
.equip-skin-select { font-size: 11px; padding: 2px 4px; max-width: 150px; }

/* ---- RO 原版底圖裝備視窗 ---- */
.equipwin {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 280 / 130;   /* 底圖原始比例，格子座標才對得準 */
  margin: 8px 0;
}
.equipwin-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}
/* 深色版：同一張圖反轉，白底變深底、灰橢圓變橄欖金 */
.equipwin--dark .equipwin-bg { filter: invert(1); }
.equipwin-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  cursor: pointer;
}
.equipwin-slot img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.equipwin-slot:hover { background: rgba(227,154,82,0.25); box-shadow: 0 0 0 1px var(--accent); }
.equipwin-slot.is-empty { cursor: default; }
.equipwin-slot.two-hand-shadow { opacity: 0.55; }
.equipwin-refine {
  position: absolute; top: -4px; right: -4px;
  font-size: 9px; font-weight: 700; color: #5dade2;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}
.equipwin-card {
  position: absolute; bottom: -4px; left: -4px;
  font-size: 8px; text-shadow: 0 0 3px #000;
}
.equipwin-qty {
  position: absolute; bottom: -5px; right: -4px;
  font-size: 9px; font-weight: 700; color: var(--head);
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

/* ---- 攻速藥水勾選列 ---- */
.aspd-potion-row { display: flex; align-items: center; gap: 6px; }
.aspd-potion-row.disabled { opacity: 0.5; }
.aspd-potion-block { color: var(--bad); font-size: 11px; }

/* ---- 箭矢狀態列 ---- */
.ammo-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px; margin: 6px 0 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
  font-size: 12px;
}
.ammo-row.warn { border-color: var(--bad); }
.ammo-label { color: var(--ink-dim); font-size: 11px; }
.ammo-icon { width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; }
.ammo-name { color: var(--ink); }
.ammo-qty { color: var(--head); font-variant-numeric: tabular-nums; }
.ammo-qty.zero { color: var(--bad); }
.ammo-warn { color: var(--bad); font-size: 11px; }

/* ---- GRP-REFINEUI：精煉視窗 ----
   U3（D9）：外框改成統一浮動視窗（.refine-overlay／.refine-window 的位置、寬高、不變暗
   都跟 .wh-window／.wh-frame 寫在同一條規則，見「統一浮動視窗」那段）。這裡只剩內容排版。 */
.refine-titlebar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  min-width: 0; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel-2); cursor: move; user-select: none; touch-action: none;
}
.refine-equip-icon, .refine-mat-icon {
  width: 36px; height: 36px; flex: 0 0 auto; object-fit: contain; image-rendering: pixelated;
}
.refine-title-copy { flex: 1 1 auto; min-width: 0; }
.refine-title-copy h3 {
  margin: 0 0 2px; color: var(--head); font-family: var(--font-head);
  font-size: 15px; overflow-wrap: anywhere;
}
.refine-close {
  flex: 0 0 auto; width: 38px; height: 38px; padding: 0; cursor: pointer;
  color: var(--ink); background: transparent; border: 1px solid var(--line);
  font: inherit; font-size: 20px; line-height: 1;
}
/* GRP-UISMALL6（B9-4，#221-5）：舊版 overflow:hidden ⇒ 材料區＋紀錄的最小高度一撐，精煉券那段（當時是第 6 段）
   就被裁到視窗外，看不到也點不到（實測 360×640 第一顆券在 y=807，面板底在 601）。改成面板自己直向捲動，
   捲動位置由 showRefinePanel() 在整塊重畫後接回去；橫向維持不捲。
   FIX1：精煉券段改排在材料段前面（js/ui.js showRefinePanel），捲動只是內容超出時的保底。 */
.refine-panel {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 7px;
  min-width: 0; min-height: 0; padding: 9px 12px 10px; overflow-x: hidden; overflow-y: auto;
  overflow-wrap: anywhere; background: var(--panel);
}
.refine-step { font-size: 15px; color: var(--ink); }
.refine-step b { color: var(--accent); }
.refine-meta { font-size: 11px; color: var(--ink-dim); }
.refine-preview {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  font-size: 12px;
}
.refine-preview span, .refine-cost {
  min-width: 0; padding: 5px 7px; border: 1px solid var(--line); background: var(--panel-2);
}
.refine-preview b { margin-right: 5px; color: var(--head); }
.refine-cost { font-size: 11px; color: var(--ink-dim); }
.refine-section-label { font-size: 11px; font-weight: 700; color: var(--head); }
.refine-material-section, .refine-ticket-section, .refine-source, .refine-hint { flex: 0 0 auto; min-height: 0; }
.refine-mats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin-top: 4px; }
.refine-mat {
  position: relative; display: flex; flex-direction: column; gap: 2px; align-items: center;
  min-width: 0; padding: 5px 6px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
  font-family: inherit; text-align: center;
}
.refine-mat:hover:not(:disabled) { border-color: var(--head); }
.refine-mat.active { border: 2px solid var(--accent); background: var(--bg-panel-3, var(--panel)); }
.refine-mat:disabled, .refine-mat.out { opacity: 0.45; cursor: not-allowed; }
.refine-mat-name { font-size: 12px; }
.refine-mat-qty { font-size: 11px; color: var(--head); font-variant-numeric: tabular-nums; }
.refine-mat-qty.zero { color: var(--bad); }
.refine-mat-note { font-size: 10px; color: var(--ink-dim); }
.refine-mat-tooltip {
  display: block; width: 100%; margin-top: 3px; padding: 5px;
  color: var(--ink); background: var(--deep); border: 1px solid var(--head);
  font-size: 10px; line-height: 1.35; text-align: left;
}
.refine-blessing { grid-template-columns: minmax(0, 1fr); }
.refine-blessing .refine-mat { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; text-align: left; }
.refine-blessing .refine-mat-icon { grid-row: 1 / span 3; }
.refine-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.refine-hint { font-size: 11px; color: var(--bad); }
/* REF7：面板開在背包分頁時的來源說明。⚠ 色弱規則：這一條的辨識靠「📦 符號 ＋ 逐字說明
   ＋ 左側粗邊框」三樣，顏色只是點綴，轉成灰階也分得出它和一般段落不同。 */
.refine-source {
  margin: 6px 0 0; padding: 4px 8px;
  border-left: 3px solid var(--head);
  font-size: 11px; color: var(--ink-dim); line-height: 1.6;
}
.refine-log {
  flex: 1 1 auto; min-height: 52px; overflow-y: auto;
  margin-top: 1px; padding: 7px 8px; border: 1px solid var(--line);
  font-size: 11px; color: var(--ink-dim); line-height: 1.7;
}
.refine-log-empty { padding: 4px 0; }
/* GRP-REF3：精煉券選擇器。長名稱要換行，360px 不得把 .tab-content 撐出橫向捲軸。
   「沒有目標」用文字＋「無目標」前綴，不靠顏色。 */
.refine-ticket-picker {
  margin: 10px 0;
  padding: 10px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
}
.refine-ticket-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.refine-ticket-row {
  display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.refine-ticket-name { flex: 1 1 120px; min-width: 0; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
.refine-ticket-step { flex: 0 0 auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.refine-ticket-why { flex: 1 1 160px; min-width: 0; display: block; font-size: 11px; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
/* GRP-UISMALL6-FIX1（B9-4）：上面那條的 flex-basis 160px 是給橫向券列（背包分頁的「使用」鈕旁）用的；精煉面板的
   .refine-ticket-list 是**直向** flex，同一條在直向軸上變成 160px 的最小高度 ⇒ 說明文字下面多出約 130px 空白
   （GRP-REF3 遺留），把券按鈕又往下推一截。面板裡只佔內容高度。 */
.refine-ticket-list .refine-ticket-why { flex: 0 0 auto; }   /* MUTATION_POINT_UISMALL6FIX1_WHY_BASIS */

@media (max-width: 600px) {
  /* U3（D9）：手機上也是統一浮動視窗（不再全螢幕），外框尺寸見「統一浮動視窗」那段 */
  .refine-titlebar { padding: 7px 9px; }
  .refine-panel { padding: 7px 9px 8px; gap: 5px; }
  .refine-preview span, .refine-cost { padding: 4px 6px; }
  .refine-mats { grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 4px; }
  .refine-mat { padding: 4px; }
  .refine-mat-icon { width: 30px; height: 30px; }
  .refine-mat-note { font-size: 9px; }
  .refine-ticket-list { gap: 4px; margin-top: 4px; }
  .refine-ticket-row { padding: 4px 6px; gap: 5px; }
}

.equip-pick-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0; margin: 0;   /* 在 .equip-sticky 裡面，用 padding 撐開才不會露出底下的內容 */
  background: var(--panel);
}
.equip-pick-empty { color: var(--ink-dim); font-size: 13px; padding: 16px 0; text-align: center; }
.equip-pick-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; margin-bottom: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
}
.equip-pick-row.equipped { border-color: var(--accent); }
.equip-pick-row img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.equip-pick-info { flex: 1; min-width: 0; }
/* GRP-F-UI：插卡改名後名稱不設長度上限 ⇒ 換行顯示，不截斷 */
.equip-pick-name { font-size: 12px; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
.equip-pick-stats { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.equip-pick-cards { font-size: 10px; color: var(--head); margin-top: 2px; }

/* 雙手武器佔住的左手格：同一把武器的分身，畫淡一點並用虛線邊框跟真正的裝備區隔 */
.ro-equip-slot.two-hand-shadow { opacity: 0.55; border-style: dashed; }

/* 頭部三格佔滿第一行 */
.ro-equip-slot.head-slot {
  grid-column: span 1;
}
/* 武器佔中間行 */
.ro-equip-slot.weapon-slot {
  grid-column: 2;
}
/* 裝備提示框 */
.ro-equip-tooltip {
  display: none;
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 200px;
  max-width: 280px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  pointer-events: none;
}
.ro-equip-tooltip.show { display: block; }
.ro-equip-tooltip .tt-name { font-weight: 700; color: var(--head); font-size: 13px; margin-bottom: 4px; overflow-wrap: anywhere; word-break: break-word; }
.ro-equip-tooltip .tt-type { font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; }
.ro-equip-tooltip .tt-desc { font-size: 11px; color: var(--ink); line-height: 1.5; margin-bottom: 6px; }
.ro-equip-tooltip .tt-stats { font-size: 11px; color: #5dade2; }
.ro-equip-tooltip .tt-stats span { display: inline-block; margin-right: 8px; }
.ro-equip-tooltip .tt-refine { color: #f0c040; font-weight: 700; }
.ro-equip-tooltip .tt-card { color: #58d68d; margin-top: 4px; }
.ro-equip-tooltip .tt-hint { font-size: 10px; color: var(--ink-dim); margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }

/* Card system */
.card-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.card-row { display: flex; justify-content: space-between; align-items: center; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.card-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.card-icon { font-size: 1.2rem; }
.card-details { display: flex; flex-direction: column; }
.card-name { font-weight: 500; font-size: 0.85rem; }
.card-desc { font-size: 0.7rem; color: var(--cost); }

/* Town NPCs */
.town-npcs { margin-top: 12px; }
.town-npc-title { font-size: 0.9rem; color: var(--head); margin: 0 0 8px; }
.town-npc-list { display: flex; gap: 8px; }
.town-npc-card { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.town-npc-card:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.town-npc-card:hover .town-npc-hint { color: var(--bg); }
.town-npc-icon { font-size: 1.5rem; }
.town-npc-name { font-weight: 600; font-size: 0.85rem; color: var(--head); }
.town-npc-card:hover .town-npc-name { color: var(--bg); }
.town-npc-hint { font-size: 0.7rem; color: var(--ink-dim); }

/* Auto Battle Tab */
.ab-status { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.ab-bar-label { font-size: 12px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }
.ab-hp, .ab-sp { margin-bottom: 8px; }
.ab-info-row { display: flex; gap: 12px; font-size: 12px; color: var(--ink-dim); margin-top: 8px; }
.ab-section { margin-bottom: 16px; }
.ab-section-title { font-size: 14px; color: var(--head); margin: 0 0 10px; font-weight: 700; }
.ab-attack-config { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 8px; }
.ab-config-row { margin-bottom: 10px; }
.ab-config-row:last-child { margin-bottom: 0; }
.ab-config-label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 4px; }
.ab-select { width: 100%; padding: 8px 10px; font-size: 13px; font-family: var(--font-body); background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; cursor: pointer; }
.ab-select:focus { outline: none; border-color: var(--head); }
.ab-mode-btns { display: flex; gap: 8px; }
.ab-mode-btns .btn-small.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
/* W6 L1 量到：range 的瀏覽器預設左右 margin 讓 width:100% 超出內容框 2px（自動戰鬥分頁），margin 歸零 */
.ab-slider { width: 100%; margin-left: 0; margin-right: 0; accent-color: var(--accent); }
.ab-slider-val { font-size: 12px; color: var(--head); font-weight: 700; }
.ab-config-hint { font-size: 12px; color: var(--ink-dim); }
/* GRP-POTIONTUTOR（B9-6，#221-9）：🧪 喝水。每種藥水一列（勾選＋文字、數字框、一個下拉、自動買、ⓘ）；
   整列 flex-wrap：360px 放不下時下拉／自動買／ⓘ 自己折到第二列，不水平捲（下拉 min-width:0、max-width:100%）。
   說明（.potion-help）、舊設定提醒（.potion-note）、輸入錯誤（.potion-msg）都是整行寬（flex-basis 100%），
   ⓘ 按了才展開（js/ui.js potionHelpToggle）。色弱：開關是勾選框＋文字，ⓘ 展開時框變實心＋ aria-expanded，不只靠顏色。 */
.potion-rows { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.potion-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 8px; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--ink); }
.potion-row > label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; margin: 0; }
.potion-row input[type="checkbox"] { accent-color: var(--accent); margin: 0; flex: 0 0 auto; }
.potion-num { width: 52px; padding: 3px 4px; font-size: 13px; font-family: var(--font-body); text-align: right;
  background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; }
.potion-word { white-space: nowrap; }
.potion-sel { flex: 1 1 140px; min-width: 0; max-width: 100%; padding: 4px 6px; font-size: 12px; font-family: var(--font-body);
  background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; cursor: pointer; }
.potion-sel:focus, .potion-num:focus { outline: none; border-color: var(--head); }
.potion-info { flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--head); font-size: 14px; line-height: 1; cursor: pointer; }
.potion-info[aria-expanded="true"] { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.potion-help, .potion-note, .potion-msg { flex: 1 1 100%; min-width: 0; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.potion-help { color: var(--ink-dim); border-top: 1px dashed var(--line); padding-top: 4px; }
.potion-note { color: var(--ink-dim); }
.potion-msg { color: var(--bad); font-weight: 700; }
.ab-info-text { font-size: 12px; color: var(--ink-dim); margin-top: 8px; line-height: 1.5; }
.ab-skill-slot { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.ab-skill-slot:last-child { margin-bottom: 0; }
.ab-skill-slot-label { font-size: 12px; color: var(--head); font-weight: 700; margin-bottom: 8px; }

/* Support Skills */
.support-skill-list { display: flex; flex-direction: column; gap: 6px; }
.support-skill-row { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.support-skill-row.enabled { border-color: var(--cost-line); }
.support-skill-toggle { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.support-skill-toggle input[type="checkbox"] { margin-top: 2px; accent-color: var(--cost-line); }
.support-skill-info { display: flex; flex-direction: column; }
.support-skill-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.support-skill-desc { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.support-skill-cost { font-size: 11px; color: var(--cost); margin-top: 2px; }

/* GRP-CAST4：技能欄（docs/cast-spec.md §4.9）。選中的角色／格子：▶／▼ 符號＋粗底線＋粗外框，不只靠顏色；360px 下全部可換行。 */
.sb-section { min-width: 0; }
.sb-units { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.sb-unit { font-size: 13px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-dim); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* GRP-FEATUREGATE-FACE：組隊關閉時取代「＋ 雇用隊友」的說明文字（不是按鈕） */
.sb-unit-closed { font-size: 13px; padding: 5px 10px; border-radius: 6px; border: 1px dashed var(--line); color: var(--ink-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-unit.active { border: 3px solid var(--accent); color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.sb-sub { font-size: 12px; color: var(--head); margin: 10px 0 4px; }
.sb-buffs { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.sb-buffs .auto-toggle { margin-top: 2px; }
/* GRP-AUTOTAB（findings 130-2）：文字自成一行在上、條子佔滿整行（以前同一行，長字串把條子擠短）。Lv 標籤照舊在條子下方 */
/* 左右 4px：0%／100% 的刻度方塊（寬 8px、置中在節點上）不凸出捲動區 */
.sb-castbar { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 6px 0 22px; padding: 0 4px; min-width: 0; }
.sb-cast-track { position: relative; flex: none; width: 100%; box-sizing: border-box; min-width: 0; height: 12px; border: 2px solid var(--ink-dim); border-radius: 3px; background: transparent; }
.sb-castbar.casting .sb-cast-track { border-color: var(--accent); }
.sb-cast-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
/* 節點刻度：已念完＝實心方塊、未念完＝空心方塊（形狀不同，不只顏色）；Lv 標籤在條下方 */
.sb-cast-tick { position: absolute; top: -4px; width: 8px; height: 16px; margin-left: -4px; border: 2px solid #fff; background: var(--deep); box-sizing: border-box; }
.sb-cast-tick.done { background: #fff; border-color: #000; }
.sb-cast-tl { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-size: 10px; line-height: 1; white-space: nowrap; color: var(--ink); }
.sb-cast-tick:last-child .sb-cast-tl { left: auto; right: -2px; transform: none; }
.sb-cast-text { font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* GRP-AUTOTAB（findings 130-7）：四格任何寬度都一橫排；格內圖示約 32px 置中在上、名稱一行只放中文名（過長「…」）。
   選中＝粗金框（3px＋底 6px）＋名稱粗體，不只靠顏色。DOM 裡名稱在前、圖示在後，用 order 把圖示排到上面。 */
.sb-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sb-tab { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; padding: 6px 4px 4px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 1px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.sb-tab.active { border: 3px solid var(--accent); border-bottom-width: 6px; }
.sb-tab-head { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; min-width: 0; }
.sb-tab-icon { order: -1; position: relative; flex: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.sb-ic { display: block; width: 32px; height: 32px; image-rendering: pixelated; }
.sb-tab-noimg { width: 32px; height: 32px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; border: 2px dashed var(--ink-dim); border-radius: 4px; color: var(--ink); }
.sb-tab-plus { font-size: 30px; line-height: 32px; font-weight: 700; color: var(--ink-dim); }
.sb-tab-name { display: block; max-width: 100%; font-size: 12px; font-weight: 400; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-tab.active .sb-tab-name { font-weight: 700; }
/* GRP-AUTOTAB（130-8）：冷卻／GCD 色塊——同增益列 .bb-cover 的半透明深色，貼圖示下緣（bottom: 0）、高度由 js 每幀改
   ＝剩餘 ÷ 最大剩餘 ⇒ 深色塊上緣一路往下走（findings 原文「由上往下持續縮短」，GRP-AUTOTAB 修正 1 主對話裁決）。
   剩 ≥1 秒中央白字黑描邊秒數（色弱：有數字，不只靠明暗）；正在詠唱那一格閃金框（動態，不只靠顏色） */
.sb-tab-cover { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,0.62); pointer-events: none; }
.sb-tab-sec { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: #fff; pointer-events: none;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 2px #000; }
.sb-tab-sec:empty { display: none; }
/* 非時間的阻擋原因（✖ SP 不足／學不到、⏸ 射程內沒怪／條件不符）：圖示右上角的小符號，完整文字在詳情區 */
.sb-tab-blk { position: absolute; top: -5px; right: -7px; min-width: 15px; height: 15px; box-sizing: border-box; padding: 0 2px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1; color: #fff; background: var(--deep); border: 1px solid #fff; border-radius: 8px; pointer-events: none; }
.sb-tab-blk:empty { display: none; }
.sb-tab.casting { box-shadow: 0 0 0 3px var(--accent); animation: sb-cast-blink 0.9s steps(1, end) infinite; }
@keyframes sb-cast-blink { 0% { box-shadow: 0 0 0 3px var(--accent); } 50% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .sb-tab.casting { animation: none; } }
.sb-detail-st { font-size: 12px; color: var(--ink); margin-bottom: 6px; overflow-wrap: anywhere; }
/* GRP-AUTOTAB（130-10）：開關型技能一行勾選框；勾了才在下方縮排出現設定（.sb-tg.on） */
.sb-tg { flex: 1 0 100%; min-width: 0; }
.sb-tg-sub { display: none; margin: 4px 0 6px 26px; min-width: 0; }
.sb-tg.on .sb-tg-sub { display: block; }
.sb-st-sym { font-weight: 700; margin-right: 3px; color: var(--ink); }
.sb-msg { margin-top: 6px; padding: 4px 8px; font-size: 12px; border: 2px dashed var(--accent); border-radius: 6px; color: var(--ink); overflow-wrap: anywhere; }
.sb-detail, .sb-picker { margin-top: 8px; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.sb-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.sb-cond-title { font-size: 12px; color: var(--head); margin: 8px 0 4px; }
.sb-cond { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 0; border-top: 1px dashed var(--line); }
.sb-sel { max-width: 100%; padding: 4px; font-size: 13px; background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 4px; }
.sb-num { width: 4.2em; padding: 4px; font-size: 13px; background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 4px; }
.sb-val { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; max-width: 100%; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sb-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-picker-cancel { flex: 1 0 100%; }
.sb-pick { font-size: 13px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.sb-pick.current { border: 3px solid var(--accent); font-weight: 700; }
.ally-skillbar-link { margin: 2px 6px 2px 0; }

/* ---------------- 圖鑑分頁 ---------------- */
.codex-progress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.codex-prog-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-dim); margin-bottom: 3px; }
.codex-prog-fill { background: linear-gradient(90deg, #8a6d1f, var(--head)); }

.codex-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.codex-tabs .btn-small { flex: 1; }
.codex-tabs .btn-small.active,
.codex-filters .btn-small.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.codex-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.codex-search {
  flex: 1; min-width: 140px; padding: 7px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); font-family: var(--font-body); font-size: 12px;
}
.codex-search:focus { outline: none; border-color: var(--accent); }
.codex-filters { display: flex; gap: 4px; }
.codex-filters .btn-small { padding: 6px 9px; font-size: 11px; }

.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.codex-cell {
  position: relative; padding: 8px 4px 6px; text-align: center; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s ease, transform .15s ease;
}
.codex-cell:hover { border-color: var(--accent); transform: translateY(-2px); }
.codex-cell.open { border-color: var(--accent); background: var(--hover); }
/* 圖鑑全開放之後，沒收藏過的只是淡一點，照樣點得開（不再是剪影 ？？？）*/
.codex-cell.unfound { opacity: .62; }
.codex-cell.unfound:hover { opacity: 1; }
.codex-icon { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.codex-icon.silhouette { filter: brightness(0) opacity(.45); }
.silhouette-box {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: 0 auto;
  color: var(--ink-dim); font-size: 20px; font-weight: 700;
}
.codex-cell-name {
  font-size: 11px; color: var(--ink); margin-top: 4px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* GRP-F-UI：背包格子的個體裝備名稱（精煉＋插卡前綴）不設長度上限，不用圖鑑的兩行截斷 */
.inv-cell .codex-cell-name { display: block; -webkit-line-clamp: unset; overflow: visible; overflow-wrap: anywhere; word-break: break-word; }
.codex-cell-sub { font-size: 10px; color: var(--ink-dim); margin-top: 2px; }
.codex-cell-count {
  position: absolute; top: 3px; right: 4px;
  font-size: 9px; color: var(--head); background: rgba(0,0,0,.45);
  padding: 1px 4px; border-radius: 4px;
}
.codex-cell-count.zero { color: var(--ink-dim); }

.codex-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.codex-pager-info { font-size: 11px; color: var(--ink-dim); }

.codex-detail {
  position: relative; padding: 12px; margin-bottom: 12px;
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 10px;
}
.codex-detail-close {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  background: transparent; border: 1px solid var(--line); border-radius: 5px;
  color: var(--ink-dim); cursor: pointer; font-size: 11px; line-height: 1;
}
.codex-detail-close:hover { border-color: var(--accent); color: var(--head); }
.codex-detail-head { display: flex; gap: 12px; align-items: flex-start; }
.codex-detail-icon { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.codex-detail-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--head); }
.codex-detail-lv { font-size: 12px; color: var(--ink-dim); font-weight: 400; }
.codex-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.codex-detail-tags span {
  font-size: 10px; color: var(--ink-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
}
.codex-detail-tags .codex-mvp { color: var(--bad); border-color: var(--bad-bg); }
/* 迷你王：同樣是 BOSS 階級但不是 MVP，用金色跟正牌 MVP 的紅色區隔 */
.codex-detail-tags .codex-miniboss { color: var(--head); border-color: var(--accent); }
.codex-detail-kills { font-size: 11px; color: var(--ink-dim); margin-top: 6px; }
.codex-detail-kills b { color: var(--head); font-size: 13px; }
.codex-detail-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.codex-detail-stats span {
  font-size: 11px; color: var(--ink);
  background: var(--panel); border-radius: 4px; padding: 2px 7px;
}
.codex-detail-desc { font-size: 11px; color: var(--ink-dim); margin-top: 10px; line-height: 1.5; }
/* 區塊標題：標題在左、說明小字靠右。
   **用 flex 不用 float**（#136）：說明小字本來是 `float: right`，
   而浮動元素會溢出自己的區塊、插進後面的盒子裡。
   後面的 `.codex-spots` 是 `display:flex`（一個 BFC），而 BFC 會**避開浮動**——
   於是整個出沒地圖列被擠成幾十 px，地圖名縮成 0、「前往」鈕被推出可視範圍。
   畫面越窄越嚴重（使用者 2026-08-22 回報的 MVP 圖鑑就是這個）。 */
.codex-detail-sec {
  font-size: 11px; color: var(--head); margin: 12px 0 6px;
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.codex-maps { display: flex; flex-wrap: wrap; gap: 5px; }
.codex-maps span { font-size: 10px; color: var(--ink-dim); background: var(--panel); border-radius: 4px; padding: 2px 6px; }
.codex-drops, .codex-srcs { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.codex-drop, .codex-src {
  display: flex; align-items: center; gap: 7px; padding: 4px 6px;
  background: var(--panel); border-radius: 5px; font-size: 11px;
}
.codex-drop img, .codex-src img { width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; }
.codex-drop-name, .codex-src-name { flex: 1; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codex-drop.got .codex-drop-name { color: var(--ink); }
.codex-drop.card { border: 1px solid var(--accent); }
.codex-drop-rate { color: var(--cost); font-variant-numeric: tabular-nums; }
.codex-src-lv { color: var(--ink-dim); font-size: 10px; }
.codex-drop-got { width: 48px; text-align: right; color: var(--head); font-variant-numeric: tabular-nums; }
.codex-drops .dim, .codex-srcs .dim, .codex-maps .dim, .codex-spots .dim { color: var(--ink-dim); font-size: 11px; }

/* 出沒地／去哪裡打：一行一個去處，最右邊是可以直接過去的按鈕 */
.codex-sec-hint { flex: none; text-align: right; font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.codex-spots { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.codex-spot {
  display: flex; align-items: center; gap: 7px; padding: 4px 6px;
  background: var(--panel); border-radius: 5px; font-size: 11px;
}
.codex-spot-icon { width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; }
.codex-spot-mon { display: flex; align-items: baseline; gap: 4px; width: 104px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codex-spot-name { flex: 1; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codex-spot-pct { width: 34px; text-align: right; color: var(--head); font-variant-numeric: tabular-nums; }
.codex-spot.shop .codex-spot-name { flex: none; color: var(--head); }
.codex-spot.mvp { border-left: 2px solid var(--accent); }
.codex-spot.mvp .codex-spot-pct { color: var(--cost); }
/* MVP 出沒地圖的「BOSS 模式」標籤（#108） */
.codex-spot-mvp {
  flex: none; font-size: 9px; padding: 1px 5px; border-radius: 3px;
  color: var(--bad); border: 1px solid var(--bad-bg); white-space: nowrap;
}
/* 這一行是獨立的整句說明，不是標題旁的小字：滿行靠左，也不跟著靠右 */
.codex-mvp-note { display: block; text-align: left; margin: 2px 0 4px; line-height: 1.5; }
.codex-go {
  flex: none; padding: 2px 8px; font-size: 10px; border-radius: 4px; cursor: pointer;
  background: rgba(227,154,82,0.12); border: 1px solid var(--head); color: var(--head);
}
.codex-go:hover { background: rgba(227,154,82,0.3); color: var(--ink); }

/* ---------------- 成就分頁 ---------------- */
.tab-btn { position: relative; } /* 讓新成就的小紅點定位得住 */
.tab-btn.has-new::after {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 6px var(--accent); animation: acv-pulse 1.4s ease-in-out infinite;
}
@keyframes acv-pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .tab-btn.has-new::after { animation: none; } }

.acv-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.acv-points {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 74px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 10px;
}
.acv-points-num { font-family: var(--font-head); font-size: 22px; font-weight: 900; color: var(--head); line-height: 1; }
.acv-points-label { font-size: 10px; color: var(--ink-dim); margin-top: 3px; }
.acv-summary-bar { flex: 1; }
.acv-prog-fill { background: linear-gradient(90deg, #8a6d1f, var(--head)); }

.acv-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.acv-cats .btn-small { padding: 5px 9px; font-size: 11px; }
.acv-cats .btn-small.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.acv-cat-n { opacity: .7; font-size: 10px; font-variant-numeric: tabular-nums; }
.acv-hide { margin-top: 0; margin-bottom: 10px; font-size: 12px; }

.acv-list { display: flex; flex-direction: column; gap: 6px; }
.acv-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--line); border-radius: 8px;
}
.acv-row.tier-1 { border-left-color: #6b7280; }
.acv-row.tier-2 { border-left-color: var(--cost-line); }
.acv-row.tier-3 { border-left-color: #7a6ad8; }
.acv-row.tier-4 { border-left-color: var(--bad); }
.acv-row.tier-5 { border-left-color: var(--accent); }
.acv-row.done { border-color: var(--accent); background: var(--panel-2); }
.acv-icon { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.acv-row:not(.done) .acv-icon { filter: grayscale(1) opacity(.55); }
.acv-body { flex: 1; min-width: 0; }
.acv-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.acv-row:not(.done) .acv-name { color: var(--ink-dim); }
.acv-check { color: var(--accent); font-size: 12px; }
.acv-desc { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.acv-bar { height: 4px; background: var(--deep); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.acv-bar-fill { height: 100%; background: linear-gradient(90deg, #8a6d1f, var(--head)); transition: width .3s ease; }
.acv-row.done .acv-bar-fill { background: var(--accent); }
.acv-side { text-align: right; flex-shrink: 0; }
.acv-count { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.acv-reward { font-size: 10px; color: var(--head); margin-top: 3px; white-space: nowrap; }

/* 圖鑑：卡片插圖與未實裝效果 */
.codex-card-art { display: flex; justify-content: center; margin: 12px 0 4px; }
.codex-card-art img {
  width: 180px; max-width: 100%; height: auto; border-radius: 8px;
  border: 1px solid var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.codex-unimpl { display: flex; flex-direction: column; gap: 3px; }
.codex-unimpl div {
  font-size: 11px; color: var(--ink-dim); line-height: 1.45;
  padding: 3px 7px; background: var(--panel); border-radius: 4px;
  border-left: 2px solid var(--bad-bg);
}

/* 裝備欄位的卡片插槽 */
.slot-cards { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.slot-pips { font-size: 9px; color: var(--head); letter-spacing: 1px; }
.btn-pip {
  font-size: 9px; padding: 1px 5px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--head);
}
.btn-pip:hover { border-color: var(--accent); }
.btn-pip.danger { color: var(--bad); }
.btn-pip.danger:hover { border-color: var(--bad-bg); }
.tt-slots { font-size: 11px; color: var(--head); margin-top: 6px; }
.card-row.inserted { border-color: var(--accent); background: var(--panel-2); }
.card-warn {
  font-size: 11px; color: var(--bad); line-height: 1.5;
  margin: 8px 0; padding: 7px 9px;
  background: var(--panel); border-left: 2px solid var(--bad-bg); border-radius: 4px;
}

/* ---------------- 背包四分類 ---------------- */
.inv-cats { display: flex; gap: 5px; margin-bottom: 8px; }
.inv-cats .btn-small { flex: 1; padding: 7px 4px; font-size: 12px; }
.inv-cats .btn-small.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.inv-cat-n { opacity: .7; font-size: 10px; font-variant-numeric: tabular-nums; }

.inv-toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.inv-toolbar .codex-search { flex: 1; min-width: 0; }
.inv-sort { flex-shrink: 0; width: auto; padding: 6px 8px; font-size: 12px; }

.inv-subs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.btn-chip {
  font-size: 11px; padding: 3px 9px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
}
.btn-chip:hover { border-color: var(--accent); color: var(--head); }
.btn-chip.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.inv-slots { color: var(--head); font-size: 11px; }
.inv-cardslot { font-size: 10px; color: var(--cost); margin-top: 2px; }

/* ---------------- 統一浮動視窗（GRP-UIREVAMP U3／D9）---------------- */
/* 外層鋪滿但不吃事件，只有 frame 收 → 遊戲在背後照跑、背景不變暗。
   ⚠ 「點外面」不會穿透到背景：視窗開著時 js/ui.js 的 uwOnClickCapture 在 document 的 capture 階段
     攔下視窗外的點擊、只關視窗（D9 行為改變；做法同規格 §6 卡普拉視窗）。
   寬度不超過遊戲畫面（D1 的 480px 欄，左右各留 12px）；高度照舊。
   精煉視窗（#refine-overlay／.refine-window）與這裡共用同一組外框規則。 */
.wh-window, .refine-overlay { position: fixed; inset: 0; z-index: 72; pointer-events: none; }
.wh-window.hidden, .refine-overlay.hidden { display: none; }
.wh-frame, .refine-window {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(calc(100vw - 24px), 456px); height: min(88vh, 700px); min-width: 0; max-width: 100%;
  box-sizing: border-box;
  display: flex; flex-direction: column; pointer-events: auto;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6); overflow: hidden;
}
.wh-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; cursor: move; user-select: none; touch-action: none;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--line);
}
.wh-header h3 { margin: 0; font-family: var(--font-head); font-size: 15px; color: var(--head); }
.wh-header-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.wh-sub { font-size: 11px; color: var(--ink-dim); }
.wh-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.wh-hint { font-size: 11px; color: var(--ink-dim); margin-bottom: 10px; line-height: 1.5; }

.wh-gold {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; color: var(--ink-dim);
}
.wh-gold b { color: var(--head); font-variant-numeric: tabular-nums; }
.wh-gold-input { width: 7em; padding: 4px 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }

.wh-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wh-toolbar .codex-search { flex: 1; min-width: 0; }
.wh-qty-label { font-size: 11px; color: var(--ink-dim); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.wh-qty { width: 5em; padding: 5px 7px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }

.wh-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .wh-cols { grid-template-columns: 1fr; } }
.wh-col { display: flex; flex-direction: column; min-width: 0; }
.wh-col-head {
  font-size: 11px; color: var(--head); padding-bottom: 5px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.wh-list { display: flex; flex-direction: column; gap: 3px; max-height: 46vh; overflow-y: auto; }
.wh-row {
  display: flex; align-items: center; gap: 7px; padding: 5px 7px; cursor: pointer;
  background: var(--panel-2); border: 1px solid transparent; border-radius: 6px; font-size: 12px;
}
.wh-row:hover { border-color: var(--accent); background: var(--hover); }
.wh-row img { width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.wh-row-name { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.wh-row-qty { color: var(--head); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* 同步自動販賣清單的小視窗（#140）：疊在自動販賣視窗上面，所以 z-index 要更高 */
.assync-window { z-index: 74; }
/* U3（D9）：寬度上限同統一視窗（不超出 480px 遊戲欄）。它是自動販賣的子視窗，開它不會關掉自動販賣 */
.assync-frame { width: min(calc(100vw - 24px), 456px); height: auto; max-height: min(80vh, 560px); }
.assync-list { display: flex; flex-direction: column; gap: 6px; }
.assync-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12px;
}
.assync-who { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assync-sub { color: var(--ink-dim); font-size: 11px; margin-left: 6px; }
.assync-n { color: var(--head); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.assync-btns { display: flex; gap: 4px; flex-shrink: 0; }
.assync-btns button[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------------- 道具鎖定 / 裝備比較 ---------------- */
.inv-row.locked { border-color: var(--accent); background: var(--panel-2); }
.inv-lock-tag { font-size: 11px; }
.inv-compare {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
  font-size: 10px; color: var(--ink-dim); margin-top: 4px;
}
.inv-compare.same { color: var(--ink-dim); font-style: italic; }
/* 一次可能列出好幾項（ATK/DEF/最大HP/攻速…），彼此要留空隙才讀得開 */
.cmp-up, .cmp-down { display: inline-block; margin-right: 10px; font-variant-numeric: tabular-nums; }
.cmp-up { color: var(--good); }
.cmp-down { color: var(--bad); }

/* ---------------- 遺物頁（#113／#115 改版）----------------
   八格欄位釘在頂端跟著分頁鈕一起 sticky；套裝說明改走 tooltip，
   欄位本身只用發光顏色表示湊到第幾段（2 綠／3 黃／5 紅）。 */
.relic-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin: 8px 0; padding-bottom: 8px;
}
.relic-cell {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 4px;
  text-align: center; background: var(--panel-2); min-height: 66px;
}
.relic-cell.empty { opacity: .45; }
.relic-cell.filled { cursor: pointer; border-color: var(--accent); }
.relic-cell.filled:hover { background: var(--panel); }
.relic-cell-icon { font-size: 20px; line-height: 1.1; }
.relic-cell-name { font-size: 11px; margin-top: 2px; }
.relic-cell-set { font-size: 10px; color: var(--ink-dim); }

/* 湊到第幾段就發什麼光。用外框＋光暈而不是改底色——
   打寶模式已經把整個介面染紅了，改底色會分不出來 */
.relic-cell.glow2 { border-color: #4fd07a; box-shadow: 0 0 8px rgba(79,208,122,.55); }
.relic-cell.glow3 { border-color: #f2c744; box-shadow: 0 0 9px rgba(242,199,68,.6); }
.relic-cell.glow5 { border-color: #ff5a4a; box-shadow: 0 0 11px rgba(255,90,74,.7); }

/* 背包分頁（#116）：一次只看一套，切換鈕吃跟欄位一樣的發光顏色 */
.relic-bag-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 6px;
}
.relic-tab { font-size: 12px; }
.relic-tab-n { font-variant-numeric: tabular-nums; opacity: .75; margin-left: 2px; }
.relic-tab.glow2 { border-color: #4fd07a; }
.relic-tab.glow3 { border-color: #f2c744; }
.relic-tab.glow5 { border-color: #ff5a4a; }
.relic-bag-missing {
  font-size: 11px; color: var(--ink-dim); margin: 0 0 6px 8px;
}

/* 這一格現在被誰佔著。空著＝可直接穿，別套＝穿上去會換掉那件 */
.relic-occ { font-size: 11px; }
.relic-occ.free { color: #4fd07a; }
.relic-occ.same { color: var(--ink-dim); }
.relic-occ.swap { color: #f2c744; }

.relic-bag-group { margin-bottom: 10px; }
.relic-bag-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 600; padding: 4px 8px; margin-bottom: 4px;
  border-left: 3px solid var(--line); background: var(--panel-2); border-radius: 0 4px 4px 0;
}
.relic-bag-head.glow2 { border-left-color: #4fd07a; }
.relic-bag-head.glow3 { border-left-color: #f2c744; }
.relic-bag-head.glow5 { border-left-color: #ff5a4a; }
.relic-bag-count { font-weight: 400; font-size: 12px; color: var(--ink-dim); }

.relic-merchant {
  border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px;
}
.relic-merchant-head { font-weight: 600; margin-bottom: 6px; }
.relic-merchant-sub { font-weight: 400; font-size: 12px; color: var(--ink-dim); }
.relic-merchant-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.relic-merchant-note { font-size: 11px; color: var(--ink-dim); }
.relic-row-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px;
}

/* tooltip 裡的套裝三段 */
.tt-relic-count.glow2 { color: #4fd07a; }
.tt-relic-count.glow3 { color: #f2c744; }
.tt-relic-count.glow5 { color: #ff5a4a; }
.tt-relic-tier { display: flex; gap: 8px; font-size: 12px; padding: 3px 0; line-height: 1.35; }
.tt-relic-tier.off { opacity: .42; }
.tt-relic-need { flex: 0 0 52px; font-variant-numeric: tabular-nums; }

/* ---- 武僧遺物的兩個特效（#113）---- */
/* 加特林的「-1」：比一般傷害小一號、偏金色，讓一排連射看起來是同一串 */
.damage-float.gatling {
  translate: 0;   /* FX3：加特林刻意噴一排（不在本單範圍），維持原本的落點 */
  font-size: 15px; color: #ffd76a; text-shadow: var(--flt-ol), 0 0 4px rgba(255,180,40,.8);
}
/* 佛法無邊：全身黃光一秒 */
@keyframes buddha-glow-kf {
  0%   { filter: drop-shadow(0 0 0 rgba(255,215,90,0)); }
  25%  { filter: drop-shadow(0 0 14px rgba(255,215,90,1)) brightness(1.35); }
  100% { filter: drop-shadow(0 0 0 rgba(255,215,90,0)); }
}
.player-sprite.buddha-glow { animation: buddha-glow-kf 1s ease-out; }
.damage-float.buddha-text {
  color: #ffd76a; font-size: 20px; font-weight: 700;
  text-shadow: var(--flt-ol), 0 0 8px rgba(255,180,40,.9);
}

/* ---------------- 免責聲明（#118）----------------
   標題畫面用有框的區塊（要被看到），遊戲中用細細一行（不能擋路）。
   兩者的文字都來自 js/about.js，這裡只管長相。 */
.disclaimer-box {
  position: relative; z-index: 1;
  margin: 24px auto 0; max-width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; background: rgba(0,0,0,.28);
}
.disclaimer-badge {
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
  color: var(--accent); margin-bottom: 8px;
}
.disclaimer-lines {
  font-size: 11px; line-height: 1.85; color: var(--ink-dim);
}
.disclaimer-lines div { margin: 1px 0; }

/* 創角畫面：一行就好，不要擋住加點 */
.disclaimer-inline {
  margin-top: 14px; font-size: 11px; color: var(--ink-dim); text-align: center;
}

/* 遊戲中的常駐頁尾：一直看得到，但只佔一行 */
.disclaimer-footer {
  flex: 0 0 auto;
  padding: 4px 8px; font-size: 10px; line-height: 1.4;
  color: var(--ink-dim); text-align: center;
  border-top: 1px solid var(--line); cursor: pointer;
}
/* U2：拿掉原本的 opacity .7（會把次要文字的對比壓到 4.5 以下）；懸停改用底線 */
.disclaimer-footer:hover { text-decoration: underline; }

/* 關於視窗 */
.about-lines { text-align: left; font-size: 13px; line-height: 1.75; margin: 10px 0; }
.about-lines p { margin: 6px 0; }
.about-home { font-size: 12px; color: var(--ink-dim); margin-top: 10px; }

/* 關於視窗裡的連結；標題畫面的「關於本作」入口（U2：取代原本的授權與鳴謝列，D23） */
.about-sec a { color: var(--accent); }
.btn-about-link {
  margin-top: 8px; font: inherit; font-size: 12px; font-weight: 700;
  background: transparent; color: var(--accent); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.btn-about-link:hover { border-color: var(--accent); }
.about-sec {
  text-align: left; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
.about-sec h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.about-sec p { margin: 4px 0; font-size: 12px; line-height: 1.7; }

/* 回安全區鈕（#120）：貼在「選擇地區」標題右邊 */
.map-home-btn { float: right; font-size: 12px; }

/* 關於視窗與法律聲明（#121）。捲動交給 .modal-box 那組規則（#123）。
   GRP-UISMALL6（B9-3）：首次確認視窗已刪除，它專用的 .consent-row／#consent-enter 規則一併拿掉
  （.modal-box 那兩段 :not(.consent-row) 選擇器留著，不影響）。 */
.modal-box-tall { width: 620px; }
.legal-list { margin: 6px 0 0; padding-left: 20px; }
.legal-list > li { margin-bottom: 8px; }
.legal-list > li > b { color: var(--ink); }
.legal-list p { margin: 3px 0; font-size: 12px; line-height: 1.65; color: var(--ink-dim); }

/* ---------------- 掛機收益（#135）----------------
   內容是浮動面板而不是 modal-overlay——開著的時候遊戲照跑，
   這正是使用者要的「不影響掛機可以查看」。
   UI7（#141）：按鈕本體從戰鬥區右上角的 68px 大圓鈕＋30px emoji，搬進 .hud-name-row
   跟「選角」「關於」同款的小型文字鈕（.btn-hud-name），原本的圓鈕樣式不再需要。 */
.btn-idle-report {
  position: relative;
  background: var(--panel-2); color: var(--head); border: 1px solid var(--accent);
  border-radius: 8px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-idle-report:hover { background: var(--hover); color: var(--ink); }
/* 有沒看過的紀錄時點一下金點，不然玩家不知道裡面有東西 */
.btn-idle-report.has-new::after {
  content: ''; position: absolute; top: -3px; right: -3px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 5px var(--accent); border: 1px solid var(--panel-2);
}
/* 外層不捲、只有 body 捲：跟隊友面板同一個理由（標題與勾選要釘住） */
/* GRP-UIREVAMP-U4（U3 遺留）：寬度不超過 480 欄（D1／D9）：跟統一視窗同一個上限 min(100vw − 24px, 456px)。
   舊值 95vw 在 1280 寬的螢幕上是 1216px，比遊戲畫面寬。 */
.idle-report-panel {
  position: fixed; top: 52px; z-index: 40;
  width: min(calc(100vw - 24px), 456px); max-width: min(calc(100vw - 24px), 456px); box-sizing: border-box;
  right: auto; left: 50%; transform: translateX(-50%);
  max-height: calc(100% - 76px);
  display: flex; flex-direction: column; overflow: hidden;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(18,20,28,0.94); border: 1px solid var(--accent);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
/* YLD1：實測產出在最上方、釘住不捲 */
.idle-live-box { flex: none; margin-bottom: 8px; }
.idle-live-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.idle-live-title { font-size: 12px; color: var(--head); font-weight: 700; }
/* GRP-YIELD2：實測下方三個比例表。外框釘住不捲，比例表自己限高捲動，才不會把下面的紀錄擠出畫面。
   每列＝名稱（太長就省略）＋數值＋百分比；底下細長條只是輔助，資訊都在文字裡（色弱友善）。 */
.yield-breakdown { max-height: 32vh; overflow-y: auto; overscroll-behavior: contain; margin-top: 6px; padding-right: 2px; }
.yield-share-title { font-size: 11px; color: var(--head); margin: 8px 0 2px; }
.yield-share-title:first-child { margin-top: 0; }
.yield-row.yield-share {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 4.2em; gap: 8px;
  position: relative; padding-bottom: 4px;
}
.yield-share-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yield-share-pct { font-style: normal; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.yield-share-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; max-width: 100%;
  background: var(--head); opacity: 0.55; border-radius: 1px;
}
.idle-report-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--head); margin-bottom: 6px;
}
.idle-report-opt {
  flex: none; display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-dim); cursor: pointer;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
/* min-height:0 少了的話 flex 子元素不會縮，body 撐爆外層就等於沒有捲動 */
#idle-report-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.idle-rec {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
}
.idle-rec-when { font-size: 11px; color: var(--ink-dim); margin-bottom: 4px; }
.idle-rec-head { font-size: 12px; color: var(--head); margin-bottom: 6px; }
.idle-rec-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px;
  font-size: 12px; color: var(--ink);
}
.idle-rec-lv { font-size: 12px; color: var(--head); font-weight: 700; margin-top: 4px; }
.idle-rec-items { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.idle-rec-items .offline-item { font-size: 11px; padding: 2px 7px; }
.idle-rec-empty { font-size: 12px; color: var(--ink-dim); text-align: center; padding: 18px 0; line-height: 1.7; }

/* 頭目的擊殺耗時（#137）：離線結算靠這個數字決定打不打得動，所以要看得到。
   三種打寶模式各一份紀錄，左邊三顆小鈕切換。 */
.codex-boss-time {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  font-size: 11px; color: var(--head); margin-top: 3px;
}
.codex-bt-modes { display: inline-flex; gap: 2px; }
.codex-bt-mode {
  padding: 1px 6px; font-size: 10px; border-radius: 3px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
}
.codex-bt-mode.has { color: var(--head); border-color: var(--head); }
.codex-bt-mode.active { background: rgba(227,154,82,0.22); color: var(--ink); border-color: var(--accent); }
.codex-bt-mode:hover { border-color: var(--accent); }
.codex-bt-none { color: var(--ink-dim); }

/* 圖鑑的分類列（#138）：怪分普通／BOSS、卡分部位、道具分武防飾消素遺。
   一頁 60 格而道具有一千四百多筆，只有「已發現／未發現」翻不完。 */
.codex-cats { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.codex-cats .btn-small { padding: 2px 8px; font-size: 11px; }
.codex-cats .btn-small.empty { opacity: 0.45; }
.codex-cat-n { font-size: 10px; opacity: 0.7; margin-left: 2px; font-variant-numeric: tabular-nums; }

/* ---------------- 線上版：聊天／交易所／信箱（T12） ----------------
   色弱友善：狀態一律有圖示＋文字；成功與失敗用「亮度＋邊框粗細」拉開，不用紅綠色相區分。 */
/* display 交給 .tab-panel.active.chat-panel（見上方分頁區塊）決定，
   這裡只留 flex 的排版細節，避免和 .tab-panel { display:none } 打架。 */
.chat-panel { flex-direction: column; gap: 6px; }
.chat-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-tab { flex: 1 1 auto; min-width: 0; padding: 6px 8px; font-size: 12px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.chat-tab.active { border: 2px solid var(--accent); color: var(--head); font-weight: 700; }
.chat-tab--closed, .chat-tab:disabled { cursor: not-allowed; opacity: 0.6; border-style: dashed; color: var(--ink-dim); }
.chat-list { height: 46vh; min-height: 180px; overflow-y: auto; padding: 6px 8px; background: var(--deep);
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.5; }
.chat-line { padding: 1px 0; word-break: break-word; overflow-wrap: anywhere; color: var(--ink); }
.chat-line--notice { background: rgba(232,201,106,0.10); border-left: 3px solid var(--head); padding-left: 6px; font-weight: 700; }
.chat-time { color: var(--ink-dim); font-size: 11px; margin-right: 4px; font-variant-numeric: tabular-nums; }
/* 系統訊息徽章：由伺服器旗標 kind='system' 決定（js/chat-ui.js），玩家的名字／內容做不出來。
   色弱友善：不靠顏色，靠「📢 系統」文字＋外框＋整列的粗左邊框三重訊號，灰階下仍分得出來。 */
.chat-badge { font-size: 11px; font-weight: 700; margin-right: 4px; padding: 0 4px;
  border: 1px solid var(--head); border-radius: 4px; white-space: nowrap; }
.chat-line--system { border-left: 5px solid var(--head); padding-left: 6px; font-weight: 700; }
.chat-user { color: var(--head); font-weight: 700; }
.chat-user--system { color: var(--ink); }
.chat-sep { color: var(--ink-dim); }
.chat-hint { font-size: 12px; color: var(--ink); padding: 4px 8px; border: 1px dashed var(--ink-dim); border-radius: 6px; }
.chat-status { font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 6px; color: var(--ink); background: var(--panel-2); }
.chat-status--err { border: 3px solid var(--ink); background: var(--deep); }
.chat-status--ok { border: 1px solid var(--accent); background: var(--ink); color: var(--bg); }
.chat-form { display: flex; gap: 6px; align-items: center; }
.chat-input { flex: 1 1 auto; min-width: 0; padding: 8px 10px; font-size: 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--bg); color: var(--ink); }
.chat-input:disabled { opacity: 0.5; border-style: dashed; }
.chat-counter { flex: none; font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.chat-counter--over { color: var(--ink); font-weight: 700; text-decoration: underline; }
.chat-send { flex: none; }

/* UI3：合併戰鬥／技能／隊友日誌的「⚔️ 戰鬥」頁籤（js/chat-ui.js buildBattleLine）。
   色弱友善：三個來源一律「圖示＋文字」徽章（不是純色塊），這是主要的分辨訊號；
   左邊框與徽章顏色只是輔助，三色對 .chat-list 實際背景 #0c0e16 的對比度都 ≥9.9:1
   （--ink 14.88:1／--head 11.92:1／--ink-dim 9.91:1，遠高於 WCAG 3:1 門檻），
   且相對亮度彼此有落差（0.76／0.60／0.49），轉灰階仍看得出深淺不同——但即使色弱到
   完全看不出這三色的差異，圖示＋文字本身已經足夠分辨來源。 */
.chat-badge--battle-main  { border-color: var(--ink); color: var(--ink); }
.chat-badge--battle-skill { border-color: var(--head); color: var(--head); }
.chat-badge--battle-ally  { border-color: var(--ink-dim); color: var(--ink-dim); }
.chat-line--battle-main  { border-left: 3px solid var(--ink); padding-left: 6px; }
.chat-line--battle-skill { border-left: 3px solid var(--head); padding-left: 6px; }
.chat-line--battle-ally  { border-left: 3px solid var(--ink-dim); padding-left: 6px; }

.mk-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mk-subtab.active { background: var(--accent); color: var(--bg); font-weight: 700; }
.mk-status { font-size: 13px; font-weight: 700; padding: 8px 10px; margin: 6px 0; border-radius: 6px; color: var(--ink); background: var(--panel-2); word-break: break-word; }
.mk-status--ok { background: var(--ink); color: var(--bg); border: 1px solid var(--accent); }
.mk-status--err { background: var(--deep); color: var(--ink); border: 3px solid var(--ink); }
.mk-status--wait { border: 2px dashed var(--ink-dim); }
.mk-section { display: flex; flex-direction: column; gap: 6px; }
.mk-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-search { flex: 1 1 140px; min-width: 0; width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.mk-select { flex: 1 1 110px; min-width: 0; max-width: 100%; padding: 6px; font-size: 13px; border-radius: 6px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--accent); }
.mk-list { display: flex; flex-direction: column; gap: 6px; }
.mk-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.mk-row--mine { border-left: 4px solid var(--head); }
.mk-icon { width: 32px; height: 32px; object-fit: contain; }
.mk-info { min-width: 0; }
.mk-name { font-weight: 700; color: var(--ink); word-break: break-word; }
.mk-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--ink-dim); }
.mk-price { color: var(--head); font-weight: 700; }
.mk-seller-name { color: var(--ink); }
.mk-mine-tag { font-size: 11px; padding: 0 4px; border: 1px solid var(--head); border-radius: 4px; }
.mk-mine-head { font-size: 13px; color: var(--ink); font-weight: 700; }
.mk-act { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 84px; }
.mk-num { width: 100%; max-width: 160px; margin: 0; padding: 4px 6px; font-size: 13px; }
.mk-buy-qty { width: 84px; }
.mk-note { font-size: 11px; color: var(--ink-dim); text-align: center; }
.mk-note--bad { color: var(--ink); font-weight: 700; border: 2px solid var(--ink); border-radius: 4px; padding: 1px 4px; }
.mk-sell { gap: 8px; }
.mk-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ink); }
.mk-estimate { font-size: 13px; color: var(--ink); }
.mk-estimate--warn { font-weight: 700; }
.mk-sell-btn { min-width: 0; align-self: flex-start; }
.mail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.mail-count { font-weight: 700; color: var(--ink); }
.mail-row { grid-template-columns: 88px minmax(0, 1fr) auto; }
.mail-kind { font-size: 12px; font-weight: 700; color: var(--ink); }
.mail-row--sold { border: 3px solid var(--head); background: var(--hover); }
/* 世界王獎勵：雙線框＋標籤文字，不靠顏色單獨分辨 */
.mail-row--worldboss { border: 3px double #f5f0e4; background: var(--panel); }
.mail-time { font-variant-numeric: tabular-nums; }
.tab-btn.has-mail { color: var(--ink); font-weight: 700; text-decoration: underline; }

/* 固定手機版面下，分頁列＋輸入列要留在視窗內。 */
.chat-list { height: 22vh; min-height: 120px; }
@media (max-width: 420px) {
  .mk-row { grid-template-columns: 28px minmax(0, 1fr); }
  .mk-row .mk-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .mail-row { grid-template-columns: minmax(0, 1fr); }
  .mail-row .mk-act { grid-column: auto; }
  .mk-icon { width: 26px; height: 26px; }
}
.refine-bulk-progress { margin-left: .5rem; color: var(--text-muted, #aaa); font-size: .9em; }

/* ---------------- 世界王橫幅（WB6）----------------
   狀態不靠顏色：參戰＝實線＋●，未參戰＝虛線＋○，冷卻＝⏳＋秒數＋disabled。
   血量同時有寬度、斜線與「HP n / m」文字。窄螢幕 flex-wrap，不設大於 100% 的固定寬。
   UI7（#141）：加收合功能——分成 head（標題＋收合鈕，永遠顯示）與 body（血條/倒數/
   狀態/加入離開，收合時整段不畫）兩段，改直排讓兩段各自佔一整列。 */
.wb-banner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; max-width: 100%; box-sizing: border-box;
  margin: 0; padding: 6px 8px;
  background: var(--bg); color: #f5f0e4;
  border: 2px dashed #c9b98c; border-radius: 8px;
  font-size: 12px; line-height: 1.35;
}
.wb-banner.wb-in { border-style: solid; border-width: 3px; }
.wb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.wb-title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* 收合／展開：箭頭符號（▾／▸）＋文字兩個訊號一起變，不靠顏色分辨（CLAUDE.md 第 5 條鐵律）。
   配色沿用既有 .wb-btn（#f5f0e4 對 #1c2030），實算相對亮度得對比度 14.2:1，遠高於 3:1 門檻。 */
.wb-toggle {
  flex: none; font-size: 11px; padding: 3px 9px; border-radius: 6px; cursor: pointer;
  background: var(--panel); color: #f5f0e4; border: 1px solid #f5f0e4; white-space: nowrap;
}
.wb-toggle:hover { background: var(--hover); }
.wb-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.wb-banner.wb-collapsed .wb-body { display: none; }
.wb-meta, .wb-status, .wb-note { min-width: 0; max-width: 100%; }
.wb-note { font-weight: 700; }
.wb-hp-track {
  position: relative; flex: 1 1 140px; min-width: 0; height: 16px;
  background: var(--deep); border: 1px solid #9aa0b4; border-radius: 8px; overflow: hidden;
}
.wb-hp-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--head) 0 6px, #8a6d1f 6px 8px);
}
.wb-hp-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #f5f0e4; pointer-events: none;
}
/* 對比度：文字疊在填滿的金色斜紋上時（#f5f0e4 對 #e8c96a）只有 1.42:1，不合格。
   改成不透明深底徽章（與 --wb-hp-label-bg 同色），文字對徽章底色恆為 16.94:1，
   不受填滿／空槽狀態影響；徽章只包住文字本身，兩側的寬度＋斜紋訊號仍保留可見。 */
.wb-hp-label {
  display: inline-block; background: #0b130f; padding: 0 6px; border-radius: 3px;  /* ＝ --deep；face-worldboss 測試要求這裡寫成不透明 6 位數 hex */
  line-height: 14px; white-space: nowrap;
}
.wb-actions { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.wb-btn {
  font-size: 16px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
  background: var(--panel); color: #f5f0e4; border: 2px solid #f5f0e4;
}
.wb-btn:disabled { cursor: not-allowed; border-style: dotted; opacity: 1; }

/* ---------------- UI10：背包／圖鑑的檢視模式切換 ----------------
   兩邊各一個 <select>（沿用 .ab-select 與裝備外觀切換器 .equip-skin-select 的慣例）：
   選項文字本身就寫著「▤ 列表檢視／▦ 格狀檢視」，目前選中的狀態靠**文字＋符號**，
   完全不依賴顏色（色弱友善），轉灰階照樣分得出來。

   手機寬度：格狀一律沿用圖鑑既有的 `repeat(auto-fill, minmax(84px, 1fr))`
   —— 欄數由容器寬度自己算，360／390／412 都不會固定欄數、右邊也不留空白。
   不新增斷點（本檔的 RWD 斷點是 860px／420px，這裡不需要另開一個）。 */
.inv-view-select, .codex-view-select { flex-shrink: 0; width: auto; padding: 6px 8px; font-size: 12px; }
/* GRP-D：檢視切換鈕（背包／圖鑑共用）與背包排序鈕 */
.view-toggle-btn { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0; }
.view-toggle-btn .view-toggle-icon { display: block; }
.inv-sort-btn { flex-shrink: 0; white-space: nowrap; padding: 6px 8px; min-width: 44px; }

/* 背包格狀：跟 .codex-grid 同一套自適應欄寬（改成固定欄數就會在 360px 溢出） */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.inv-cell { min-width: 0; }
/* 點開的那一件：完整的一列，顯示在格子上方 */
.inv-open { margin-bottom: 10px; }

/* 圖鑑詳情檢視：一列一件，結構與間距比照背包的 .inv-row */
.codex-rows { display: flex; flex-direction: column; gap: 8px; }
.codex-row {
  display: flex; align-items: center; gap: 10px; padding: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
}
.codex-row:hover { border-color: var(--accent); }
/* 展開中的那一列：粗左邊框＋整列底色，不是只換文字顏色 */
.codex-row.open { border-color: var(--accent); border-left-width: 4px; background: var(--hover); }
.codex-row.unfound { opacity: .62; }
.codex-row.unfound:hover { opacity: 1; }
.codex-row-icon { width: 34px; height: 34px; flex-shrink: 0; }
.codex-row-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.codex-row-info { flex: 1; min-width: 0; }
.codex-row-name { font-size: 13px; font-weight: 700; }
.codex-row-type { font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.codex-row-desc {
  font-size: 11px; color: var(--ink-dim); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.codex-row-count { flex-shrink: 0; font-size: 11px; color: var(--head); font-variant-numeric: tabular-nums; }
.codex-row-count.zero { color: var(--ink-dim); }

/* GRP-E（findings #22）：格子＋插列詳情共用元件（js/ui.js inlineDetailListHtml）。
   詳情在 DOM 裡緊接在被點那一格之後，橫跨整排（grid-column: 1 / -1）；容器用 dense 自動擺放，
   同一列剩下的格子會回頭填滿那一列，詳情因此落在「那一列的下面」，欄數交給瀏覽器的真實排版。
   ⚠ 每格都只佔 1 欄，dense 不會改變格子本身的順序。min-width:0：跨欄的詳情裡有不換行的長列
   （.codex-spots、背包按鈕列），不給的話 360px 會把整個格子區撐寬（橫向溢出）。 */
[data-inline-host] { grid-auto-flow: row dense; }
.inline-detail { grid-column: 1 / -1; min-width: 0; }
.inline-detail > .codex-detail { margin-bottom: 0; }
.inline-detail > .inv-open { margin-bottom: 0; }
/* 背包列表檢視：原本列直接放在 .inv-list 裡，現在多包一層共用元件的容器，間距照舊 */
.inv-rows { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.inv-row-main[role="button"] { cursor: pointer; }
.inv-usage-hint { font-size: 11px; color: var(--head); margin-top: 3px; }
/* 背包列表展開的「消耗用途」：粗左邊框＋底色標出它屬於上一列（不只靠顏色） */
.inv-usage-detail {
  padding: 4px 10px 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px;
}
/* 消耗用途區塊（js/item-usage.js 的 itemUsageBlockHtml，背包與圖鑑共用） */
.item-usage-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.item-usage-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 4px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; min-width: 0;
}
.item-usage-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-usage-qty { flex-shrink: 0; color: var(--head); font-variant-numeric: tabular-nums; }

/* ---------------- GRP-LOOTFX-A：掉寶飛行層（findings #81 第 2 項） ----------------
   掛在 body 底下、position: fixed：飛行要從戰鬥區飛到下方（手機）或右上（桌面）的「背包」主分頁鈕，
   放在 .battle-scene 裡會被它（與 .damage-container 的 contain: strict）裁掉。
   js/ui.js 每幀只寫 transform（外框＝位置；<img>＝旋轉＋縮放）與 opacity，這裡不放任何 CSS 動畫。
   稀有：★ 角標＋「稀有」文字（不只靠顏色；色弱友善）。 */
.loot-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 150; contain: strict; }
.loot-off { display: none; }
.loot-fly { position: absolute; left: 0; top: 0; width: 32px; height: 32px; will-change: transform, opacity; }
.loot-img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; will-change: transform; }
.loot-star {
  position: absolute; right: -10px; top: -12px; font-size: 18px; line-height: 1; color: #ffd54a;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.loot-tag {
  position: absolute; left: 50%; top: calc(100% + 2px); transform: translateX(-50%);
  font-size: 11px; font-weight: 700; line-height: 1.3; white-space: nowrap;
  color: #fff; background: #4a1466; border: 1px solid #ffd54a; border-radius: 3px; padding: 0 4px;
}
.loot-note {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-size: 13px; font-weight: 700; line-height: 1.4; color: #fff;
  background: rgba(0, 0, 0, .78); border: 1px solid #fff; border-radius: 4px; padding: 1px 6px;
}
.loot-note-rare { background: #4a1466; border-color: #ffd54a; }

/* ---------------- GRP-NOVICE：新手教學閃框（docs/novice-spec-draft.md v1 §8.3） ----------------
   不只靠顏色（色弱規則）：粗「虛線」框＋左上角「👉」圖示＋上方 #tutorial-hint 一行文字寫出下一步。
   框用 --head（淺杏色，對深色面板高對比）外加一圈深色外光，淺色底上也看得出來。
   👉 用絕對定位放在元素左上角外側（負的 top／left 不會讓容器產生水平捲動）。 */
.tut-hl {
  outline: 3px dashed var(--head);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(0,0,0,.55);
  animation: tut-blink 1s steps(2, start) infinite;
  /* GRP-POTIONTUTOR-FIX1：applyTutorialHighlight() 用 scrollIntoView({block:'nearest'}) 把目標捲到看得見，
     「nearest」會讓目標貼齊捲動容器（.tab-content）的邊緣，而框（offset 2px＋框 3px＋外光 5px）與 👉（上方 14px）都畫在目標外面
     ⇒ 真實流程下（上一步目標在下面、這一步目標在上面，或反過來）貼齊的那一邊整條被 overflow 裁掉。
     scroll-margin 是 scrollIntoView 計算「看得見」時加在目標四周的留白：上 20px 放 👉、其餘 14px 放框＋外光，捲完整個框都在容器裡。
     （.tab-content 有 16px padding，所以第一個／最後一個元素也留得出這段。）框畫在鈕裡面的分頁鈕不受影響。 */
  scroll-margin: 20px 14px 14px 14px;
}
.tut-hl-rel { position: relative; }
.tut-hl::after {
  content: '👉';
  position: absolute; left: -6px; top: -14px;
  font-size: 14px; line-height: 1;
  pointer-events: none; z-index: 6;
}
@keyframes tut-blink { 50% { outline-color: transparent; box-shadow: none; } }
/* GRP-POTIONTUTOR（B9-2 bug，#221-2「虛線框高度不夠、被分頁蓋住」）：主分頁／子分頁按鈕本身 overflow:hidden（👉 在按鈕外側被裁掉），
   而且框畫在按鈕外面 2px 時，下緣被下一列（子分頁列／提示列）蓋住、右緣被隔壁按鈕蓋住（360 實測只看得到上緣與左緣）。
   ⇒ 分頁按鈕的框改畫在按鈕**裡面**（負的 outline-offset，整個框都在按鈕範圍內，不會被裁、不會被蓋），
   深色外光改成 inset，👉 也放進按鈕左上角內側。其他元素（棋盤格、數字框、站位鈕…）照舊畫在外面。 */
.tab-btn-main.tut-hl, .tab-btn.tut-hl {
  outline-offset: -4px;
  box-shadow: inset 0 0 0 6px rgba(0,0,0,.55);
}
.tab-btn-main.tut-hl::after, .tab-btn.tut-hl::after { left: 2px; top: 1px; }
.tutorial-hint {
  margin: 4px 8px; padding: 5px 8px;
  border: 2px dashed var(--head); border-radius: 8px;
  background: var(--panel-2); color: var(--ink);
  font-size: 12px; line-height: 1.4;
  overflow-wrap: anywhere;
}
.sb-buff-note { color: var(--ink-dim); font-size: 11px; margin-left: 4px; }
/* 卡普拉視窗開著時（.kafra-open 藏起子分頁列與分頁內容），提示列一起藏：視窗要貼主分頁列、高度＝螢幕高度（U6） */
.side-panel.kafra-open > .tutorial-hint { display: none; }
/* 減少動態效果：不閃，改靜態粗框＋文字（同 .tab-btn-main.has-badge 的寫法） */
@media (prefers-reduced-motion: reduce) {
  .tut-hl { animation: none; outline-width: 4px; }
}
/* ---------------- GRP-MARQUEE-B：跑馬燈（findings 150-4） ----------------
   #hud-marquee 在 header.hud-bar 裡，絕對定位、下緣 bottom:-2px 蓋住 header 底線、貼著戰鬥區。
   GRP-HUDPCTOUT-FIX1：EXP／JOB 條搬到能力分頁後，原本「蓋在 EXP 條上」的 44px 會蓋住等級列與名字列。
   改成 header 底部**永遠預留**一條 --hud-mq-h 高的跑馬燈列（padding-bottom 多加這麼多）：
   平時那條是空的 header 底色，有公告時跑馬燈只畫在這一條裡——不蓋任何 HUD 文字／按鈕（⚙ 下凸的 6px 也在上面），
   也不碰戰鬥區；跑馬燈出現／消失時 header 高度不變、棋盤不上下移動（tests/marquee-b-browser.test.js MQB-B2 量交集面積）。
   .hidden 仍是 display:none（只是預留的空間在 header 的 padding 上，不在跑馬燈自己身上）。
   這條要寫在強制手機版面（D1）的 .hud-bar { padding: 8px 12px } 之後才蓋得過它。
   overflow:hidden＋contain:paint：起跑時文字停在右緣外，不能算進任何祖先的可捲動寬度。
   文字 #fff4cc；底色見下方 GRP-BOARDUI 註解（半透明）。不只靠顏色：文字前固定有「📢 公告」。 */
.hud-bar { position: relative; --hud-mq-h: 20px; padding-bottom: calc(8px + var(--hud-mq-h)); }
.hud-marquee {
  position: absolute; left: 0; right: 0; bottom: -2px; top: auto; height: var(--hud-mq-h);
  z-index: 6; overflow: hidden; contain: paint;
  display: flex; align-items: center;
  /* GRP-BOARDUI（#192-14）：底色改半透明（當時底下是 EXP／JOB 條；FIX1 之後底下是空的 header 底色）。α 0.72：最壞情況（底下是純白）合成後
     #fff4cc 對合成色的亮度對比仍有 7.24:1（純黑 18.04:1；算式見 docs/tickets/grpboardui-report.md），≥ 4.5:1。 */
  background: rgba(11,13,18,0.72); color: #fff4cc;
  border-top: 1px solid var(--accent); border-bottom: 2px solid var(--accent);
  pointer-events: none;
}
.hud-marquee-text {
  flex: 0 0 auto; white-space: nowrap; padding: 0 10px;
  font-size: 13px; font-weight: 700; line-height: 1.3; letter-spacing: .02em;
}
.hud-marquee.is-run .hud-marquee-text {
  will-change: transform;
  animation: hud-marquee-scroll var(--mq-dur, 8000ms) linear forwards;
}
@keyframes hud-marquee-scroll {
  from { transform: translateX(var(--mq-from, 480px)); }
  to   { transform: translateX(var(--mq-to, -100%)); }
}
.hud-marquee.is-static .hud-marquee-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) {
  .hud-marquee .hud-marquee-text { animation: none !important; transform: none !important; }
}

/* ---------------- GRP-RANK（150-5）：排行榜分頁 ----------------
   一律可換行、min-width:0，360px 不溢出（tests/rank-layout.test.js 量真排版）。
   色弱：自己的那一列有「◆ 你」文字＋粗左框（不只靠底色）；選中的按鈕有「▸」前綴＋粗底線。 */
.rank-tab { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rank-subs, .rank-jobs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.rank-sub.active, .rank-jobbtn.active { font-weight: 700; border-bottom-width: 3px; border-bottom-style: solid; }
.rank-branch { border-style: dashed; }
.rank-meta, .rank-msg { margin: 0; font-size: 0.85em; overflow-wrap: anywhere; }
.rank-err { font-weight: 700; }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rank-row {
  display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; grid-template-areas: "no name lv" "no job val";
  column-gap: 8px; row-gap: 1px; align-items: baseline; padding: 4px 6px; min-width: 0;
  border-left: 3px solid transparent; background: rgba(0, 0, 0, 0.18);
}
.rank-no { grid-area: no; font-weight: 700; }
.rank-name { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
.rank-job { grid-area: job; min-width: 0; overflow-wrap: anywhere; font-size: 0.85em; opacity: 0.85; }
.rank-lv { grid-area: lv; white-space: nowrap; font-size: 0.85em; }
.rank-val { grid-area: val; white-space: nowrap; font-size: 0.85em; text-align: right; }
.rank-reb { margin-left: 4px; padding: 0 3px; border: 1px solid currentColor; font-size: 0.8em; }
.rank-mine { border-left: 6px double var(--accent); background: var(--panel-2); }
.rank-you { font-weight: 700; }
.rank-me { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 6px; min-width: 0;
  border-top: 2px dashed currentColor; background: var(--panel); }
.rank-me-label { font-size: 0.85em; font-weight: 700; }
