/* ============================================================
   沙漠精灵 Oasis —— 视觉系统
   调性：黄昏沙海的暖色 + 卡牌桌游的木/羊皮纸质感
   ============================================================ */

/* ---- 字体 ----
   三套字体各管一块，都是**按游戏实际用到的字裁出来的子集**（见 tools/subset-fonts.mjs）：
     · Oasis Body —— 正文/描述（SGHr-Regular）
     · Oasis Bold —— 卡名、商店名、标题这类需要粗体的地方（WenYuanSerifSC-Bold）
     · Oasis Hand —— 事件旁白、商人对白这类轻松搞笑的地方（写意体 SC）
     · Oasis Hand Patch —— 补手写体缺的那几十个字（旧的 851 手写体，只含那几个字）
   子集里没有的字（例如玩家自己导入的存档里出现的生僻字）会落到 LXGW 那一层 ——
   宁可用另一套字体渲染，也不要出现方块。LXGW 是完整字体，所以这一层兜得住。

   为什么手写体会是「一套主字体 + 一套补丁」：写意体 SC 只有 7977 个码位，
   游戏用到的 2004 个字里它缺 36 个（～ ⓪ ✓ ↔ ≈ － 和 23 个日文汉字）。
   缺的字会直接掉到 LXGW —— 那是套黑体，夹在手写句子里写着「好久没见啦～」，
   看起来就像「这个字体缺字」。所以把上一任手写体按那几个字再裁一次（13 KB）接在它后面。 */
@font-face {
  font-family: 'Oasis Body';
  src: url(../../assets/fonts/SGHr-Regular-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Oasis Bold';
  src: url(../../assets/fonts/WenYuanSerifSC-Bold-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Oasis Hand';
  src: url(../../assets/fonts/YShiWrittenSC-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Oasis Hand Patch';
  src: url(../../assets/fonts/851LakeusNightWriting-patch.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
/* 装饰字体（3.0.5，用户提供的「余繁离形体」）：**只给战斗背景那层花纹文字用**。
   它的汉字更像图案而不是字，所以适合当纹理；按 content/species-dex.json 里那 195 段
   图鉴文本单独裁（92KB，覆盖 100% 的用字），所以它**不进正文那几套字体栈**。 */
@font-face {
  font-family: 'Oasis Decor';
  src: url(../../assets/fonts/YuFanLiXing-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* 兜底字体：完整覆盖，子集里缺的字由它接住。
   字体文件放在 assets/fonts/，8.5MB 所以不内联进单文件构建之外的地方；
   用 file:// 双击打开时浏览器会拦掉 CSS 里的字体请求，此时自动退回系统字体；
   标题额外保留一套衬线兜底，保证离线版也不难看。 */
@font-face {
  font-family: 'LXGW Neo XiHei Plus';
  src: url(../../assets/fonts/LXGWNeoXiHeiPlus.ttf) format('truetype');
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

/* ---- 日语那三套（用户提供，按「日语用字」裁的子集：假名全表 + content/i18n/ja.json 里的字）----
   只在日语模式下生效 —— html[lang="ja"] 会改写字体栈（见下面）。
   为什么按语言换栈、而不是把六套并进同一个栈：
   中文字体缺假名（SGHr 一个假名都没有），日文字体多半缺简体字（亚 / 龙 / 话…），
   混在一个栈里会让「译文」和「还没翻译、显示中文」的部分各自掉到不同的兜底字体上，
   同一屏里三种字形打架，比现在还乱。分语言换栈之后：
     · 日语模式：日语字体 → 中文字体 → LXGW（没翻译的部分照样是中文的样子）
     · 中文模式：中文字体 → LXGW（日语字体根本不参与） */
@font-face {
  font-family: 'Oasis Body JP';
  src: url(../../assets/fonts/XiaoshanCircle-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Oasis Bold JP';
  src: url(../../assets/fonts/HanaZome-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Oasis Hand JP';
  src: url(../../assets/fonts/YOzFont-subset.woff2) format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  /* ---- 色板：沙漠黄昏 ---- */
  --sand-0: #1a120c;
  --sand-1: #241810;
  --sand-2: #33241a;
  --sand-3: #4a3524;
  --sand-4: #6b4c31;
  --sand-5: #8f6a44;
  --sand-6: #c49a63;
  --sand-7: #e8cfa2;
  --sand-8: #f7ecd6;

  --ink: #2a1c12;
  --ink-soft: #4b3524;
  --paper: #f0dcb6;
  --paper-2: #e2c795;

  --accent: #f0a93c;
  --accent-2: #ffc96b;
  --accent-deep: #b5671c;

  --good: #6fd08c;
  --good-deep: #2f7a4a;
  --bad: #e8604c;
  --bad-deep: #8f2c22;
  --info: #7bb7e8;
  --magic: #b78cf0;

  --gold: #ffd76e;

  --rarity-common: #c8bda6;
  --rarity-uncommon: #4fc45e;
  --rarity-rare: #7fb8ff;
  --rarity-epic: #ff5a44;

  /* ---- 尺寸 ---- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-1: 0 2px 0 rgba(0, 0, 0, .45);
  --shadow-2: 0 6px 0 rgba(0, 0, 0, .35), 0 10px 24px rgba(0, 0, 0, .45);
  --shadow-card: 0 4px 0 rgba(0, 0, 0, .4), 0 8px 18px rgba(0, 0, 0, .4);

  /* 三套字体各管一块（定义见文件开头的 @font-face）；
     末尾永远是完整的 LXGW + 系统字体，子集里缺字时由它们接住，不会出方块。 */
  --font-body: 'Oasis Body', 'LXGW Neo XiHei Plus', "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --font-bold: 'Oasis Bold', 'LXGW Neo XiHei Plus', "Georgia", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-hand: 'Oasis Hand', 'Oasis Hand Patch', 'LXGW Neo XiHei Plus', "PingFang SC", "Microsoft YaHei", "Noto Sans SC", cursive, sans-serif;
  /* 老名字保留成别名，改字体只要动上面三行，不用去满文件替换 */
  --font-game: var(--font-body);
  --font-ui: var(--font-body);
  --font-title: var(--font-bold);
  /* 语言 / 换行：中文按字断行，日文也是；西文那几段靠 word-break 正常断词 */
  --font-lang: normal;

  /* 战斗手牌卡面（宽 × 高）。卡面从 168×148 放大到 186×190：
     原来的卡面又小又扁，长一点的文案会被 -webkit-line-clamp 直接截掉。
     改完记得同步 battle-view.js 里的 CARD_ASPECT（出牌展示区按它算尺寸）。

     `--card-h-l10n` 是**语言补偿**的增量：日文 / 英文的卡名比中文长得多（见下面那一节），
     名字要折两行、底栏也可能换行，所以这两种语言在 `--card-h` 之外再加一点高度。
     做成「增量」而不是直接改 `--card-h`，是为了让响应式那两条 media query 仍然生效。 */
  --card-w: 186px;
  --card-h: 190px;
  --card-h-l10n: 0px;
}

/**
 * 日语模式换字体栈。
 *
 * ui.js 在启动 / 切换语言时写 `document.documentElement.lang`，这里按它整体换栈 ——
 * 三套日语字体（用户提供的 はなぞめ / XiaoshanCircle / YOzBS_）分别顶替
 * 粗体 / 正文 / 手写三个角色，后面仍然接着中文字体与 LXGW 兜底：
 * 没翻译的部分（现在还有一多半）显示中文，会自然落到中文字体上，不会变成方块。
 *
 * 选择器是 `html[lang="ja"]` 而不是 `:root`：特异性(0,1,1) 高过 `:root`(0,1,0)，
 * 不用 !important 就能赢，而且 --font-game / --font-title 这些别名是 var() 引用，
 * 会在**使用处**解析，所以它们自动跟着换，不用重复三行。
 */
html[lang="ja"] {
  --font-body: 'Oasis Body JP', 'Oasis Body', 'LXGW Neo XiHei Plus', "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Microsoft YaHei", sans-serif;
  --font-bold: 'Oasis Bold JP', 'Oasis Bold', 'LXGW Neo XiHei Plus', "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-hand: 'Oasis Hand JP', 'Oasis Hand', 'Oasis Hand Patch', 'LXGW Neo XiHei Plus', "Hiragino Sans", "Yu Gothic", cursive, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #120c08;
  color: var(--sand-8);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* 整页禁止选中文本。
     这是个「界面」不是「文档」：对战里拖着鼠标点牌、点怪物、拉线路，
     一不小心就选中一片文字，浏览器会给它涂上一块蓝色高亮 ——
     看起来就像 UI 出 bug 了（用户就是这么被吓到的：以为伤害数字背后有蓝底）。
     需要选字的地方（表单、说明文档）在下面单独放开。 */
  user-select: none;
  -webkit-user-select: none;
}
/* 表单控件还得能选字 / 能拖（设置里的滑杆），说明类面板也放开 */
input, textarea, select, .help-card, .help-card * {
  user-select: auto;
  -webkit-user-select: auto;
}
/* 头像、精灵图这些 img 默认可以被拖出一个「拖影」，游戏里用不到，关掉更干净 */
img { -webkit-user-drag: none; }

body {
  background:
    radial-gradient(120% 80% at 50% 0%, #3a2718 0%, #1d130c 55%, #0d0806 100%);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font-family: inherit; }

.hidden { display: none !important; }

.anim { image-rendering: pixelated; display: block; }

/* ============================================================
   通用控件
   ============================================================ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--sand-6), var(--sand-5) 55%, var(--sand-4));
  color: #2a1c12;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), var(--shadow-1);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4); }
.btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.btn[disabled], .btn.disabled { filter: grayscale(.7) brightness(.7); cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent) 55%, var(--accent-deep));
  color: #2b1704;
}
.btn-danger { background: linear-gradient(180deg, #f08a72, var(--bad) 55%, var(--bad-deep)); color: #2b0c07; }
.btn-ghost {
  background: rgba(255, 255, 255, .06);
  color: var(--sand-7);
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .25);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
/**
 * **浅色羊皮纸面板上的幽灵按钮要反过来染色。**
 *
 * `.btn-ghost` 那一套是给深色背景调的（`--sand-7` = #e8cfa2 的浅沙色），压在
 * `.panel-paper`（`--paper` #f0dcb6）上**实测对比度只有 1.15:1**（WCAG 正文要求 4.5:1）——
 * 玩家报的「获得道具的界面里，不要的选项太浅了，几乎看不见」说的就是掉落那一屏的
 * 「不要，就这样」。纸面上改成墨色 + 半透明白底 + 一圈看得见的描边，实测 13.8:1。
 *
 * 量法见 tools/diag-itemdrop.js（同一台浏览器、同一个按钮，只换这一条规则做 A/B）。
 *
 * 事件 / 宝箱 / 营地 / 商店那几屏也是同一张羊皮纸，一起受益。
 */
.panel-paper .btn-ghost {
  background: rgba(255, 255, 255, .38);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .45), var(--shadow-1);
  text-shadow: none;
}
.panel-paper .btn-ghost:hover { background: rgba(255, 255, 255, .6); }
.panel-paper .btn-ghost[disabled], .panel-paper .btn-ghost.disabled { color: rgba(42, 28, 18, .45); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-lg { min-height: 54px; padding: 14px 26px; font-size: 17px; }
.btn-icon { min-height: 40px; min-width: 44px; padding: 8px 10px; }
.btn-block { width: 100%; }

/* 图标：用 Kenney 白色 icon 做 mask，随文字染色 */
[class^="ico-"], [class*=" ico-"] {
  width: 20px; height: 20px; display: inline-block; flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
/* 卡面图标要更大，单独再声明一次，避免被卡牌内部样式覆盖 */
.card-art .art-ico {
  width: 46px; height: 46px;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
  background-color: #4a3524;
}
/* 保险：某些环境下 mask 可能不生效，此时用原图 + 反相把白色 icon 变成深色 */
@supports not ((mask-image: url(#a)) or (-webkit-mask-image: url(#a))) {
  [class^="ico-"], [class*=" ico-"] { background-color: transparent; }
}
/* 图标：用白色剪影做 mask，随文字染色。所有 .ico-* 规则都在下面的生成区块里 ——
   改图标请改 content/icons.json，然后跑 node tools/build-content.mjs（不要在这里手写规则）。 */
/* #region GENERATED-ICONS */
/* 这一段由 content/icons.json 生成 —— 不要手写，改注册表后跑 node tools/build-content.mjs */
/* 加图标：content/icons.json 加一条 -> & tools/fetch-iconpack.ps1 -> node tools/build-content.mjs */

/* --- 卡牌语义 --- */
.ico-sword { /* 剑：物理攻击 / 攻击属性 */ -webkit-mask-image: url(../../assets/img/icons/pack/sword.svg); mask-image: url(../../assets/img/icons/pack/sword.svg); }
.ico-double { /* 2x：连击 / 多段攻击 */ -webkit-mask-image: url(../../assets/img/icons/pack/double.svg); mask-image: url(../../assets/img/icons/pack/double.svg); }
.ico-bow { /* 弓：远程 / 投掷攻击 */ -webkit-mask-image: url(../../assets/img/icons/pack/bow.svg); mask-image: url(../../assets/img/icons/pack/bow.svg); }
.ico-volcanic_eruption { /* 火山喷发：龙息一类的大范围喷吐 */ -webkit-mask-image: url(../../assets/img/icons/pack/volcanic_eruption.svg); mask-image: url(../../assets/img/icons/pack/volcanic_eruption.svg); }
.ico-flame { /* 火焰：火属性伤害 / 灼伤状态 */ -webkit-mask-image: url(../../assets/img/icons/pack/flame.svg); mask-image: url(../../assets/img/icons/pack/flame.svg); }
.ico-earthquake { /* 开裂的岩石：地震 / 地面技 */ -webkit-mask-image: url(../../assets/img/icons/pack/earthquake.svg); mask-image: url(../../assets/img/icons/pack/earthquake.svg); }
.ico-meteor { /* 陨石：落石 / 砸落 */ -webkit-mask-image: url(../../assets/img/icons/pack/meteor.svg); mask-image: url(../../assets/img/icons/pack/meteor.svg); }
.ico-wind { /* 气流线：沙暴 / 风属性 */ -webkit-mask-image: url(../../assets/img/icons/pack/wind.svg); mask-image: url(../../assets/img/icons/pack/wind.svg); }
.ico-bug { /* 甲虫：虫鸣 / 音波类技能 */ -webkit-mask-image: url(../../assets/img/icons/pack/bug.svg); mask-image: url(../../assets/img/icons/pack/bug.svg); }
.ico-poison { /* 药水瓶 + 辐射标志：毒 / 中毒状态 */ -webkit-mask-image: url(../../assets/img/icons/pack/poison.svg); mask-image: url(../../assets/img/icons/pack/poison.svg); }
.ico-heal { /* 急救包：治疗 / 回血 */ -webkit-mask-image: url(../../assets/img/icons/pack/heal.svg); mask-image: url(../../assets/img/icons/pack/heal.svg); }
.ico-shield { /* 盾牌（基础款）：护盾卡 / 防御属性 */ -webkit-mask-image: url(../../assets/img/icons/pack/shield.svg); mask-image: url(../../assets/img/icons/pack/shield.svg); }
.ico-shield_02 { /* 盾牌（圆角款）：格挡 / 护盾值（与护盾卡区分） */ -webkit-mask-image: url(../../assets/img/icons/pack/shield_02.svg); mask-image: url(../../assets/img/icons/pack/shield_02.svg); }
.ico-counter { /* 回转箭头：反击 / 反弹 */ -webkit-mask-image: url(../../assets/img/icons/pack/counter.svg); mask-image: url(../../assets/img/icons/pack/counter.svg); }
.ico-card { /* 双张卡牌：抽牌 */ -webkit-mask-image: url(../../assets/img/icons/pack/card.svg); mask-image: url(../../assets/img/icons/pack/card.svg); }
.ico-random_dice { /* 带问号的骰子：洗牌 / 随机换牌 */ -webkit-mask-image: url(../../assets/img/icons/pack/random_dice.svg); mask-image: url(../../assets/img/icons/pack/random_dice.svg); }
.ico-temperature_up { /* 升温箭头：攻击向增益 */ -webkit-mask-image: url(../../assets/img/icons/pack/temperature_up.svg); mask-image: url(../../assets/img/icons/pack/temperature_up.svg); }
.ico-shoe { /* 鞋：敏捷 / 速度（增益与属性通用） */ -webkit-mask-image: url(../../assets/img/icons/pack/shoe.svg); mask-image: url(../../assets/img/icons/pack/shoe.svg); }
.ico-temperature_down { /* 降温箭头：虚弱 / 降防 */ -webkit-mask-image: url(../../assets/img/icons/pack/temperature_down.svg); mask-image: url(../../assets/img/icons/pack/temperature_down.svg); }
.ico-battery_negative { /* 电量不足：削弱（降攻） */ -webkit-mask-image: url(../../assets/img/icons/pack/battery_negative.svg); mask-image: url(../../assets/img/icons/pack/battery_negative.svg); }
.ico-target { /* 靶心：命中下降 */ -webkit-mask-image: url(../../assets/img/icons/pack/target.svg); mask-image: url(../../assets/img/icons/pack/target.svg); }
.ico-award { /* 奖杯：终结技 / 大招 / 胜利（与现有 Kenney 奖杯区分开） */ -webkit-mask-image: url(../../assets/img/icons/pack/award.svg); mask-image: url(../../assets/img/icons/pack/award.svg); }
.ico-backpack { /* 背包：道具类 / 背包 */ -webkit-mask-image: url(../../assets/img/icons/pack/backpack.svg); mask-image: url(../../assets/img/icons/pack/backpack.svg); }

/* --- 属性与状态 --- */
.ico-arrow_up_red { /* 向上的箭头（染红）：增益 —— 自己变强 / 攻击提升。比温度计好认（用户要求） */ -webkit-mask-image: url(../../assets/img/icons/pack/arrow_up_red.svg); mask-image: url(../../assets/img/icons/pack/arrow_up_red.svg); }
.ico-arrow_down_blue { /* 向下的箭头（染蓝）：削弱 —— 对手变弱 / 攻击下降。比温度计好认（用户要求） */ -webkit-mask-image: url(../../assets/img/icons/pack/arrow_down_blue.svg); mask-image: url(../../assets/img/icons/pack/arrow_down_blue.svg); }
.ico-clover { /* 三叶草：幸运属性 */ -webkit-mask-image: url(../../assets/img/icons/pack/clover.svg); mask-image: url(../../assets/img/icons/pack/clover.svg); }
.ico-heart_break_02 { /* 裂开的心：流血 / 持续掉血 */ -webkit-mask-image: url(../../assets/img/icons/pack/heart_break_02.svg); mask-image: url(../../assets/img/icons/pack/heart_break_02.svg); }
.ico-action_points { /* 纯文本 AP：行动点 */ -webkit-mask-image: url(../../assets/img/icons/pack/action_points.svg); mask-image: url(../../assets/img/icons/pack/action_points.svg); }
.ico-clock { /* 时钟：回合 / 计时 */ -webkit-mask-image: url(../../assets/img/icons/pack/clock.svg); mask-image: url(../../assets/img/icons/pack/clock.svg); }

/* --- 界面 --- */
.ico-book { /* 书本：图鉴（敌人图鉴的入口用书，比靶心更像「资料」） */ -webkit-mask-image: url(../../assets/img/icons/pack/book.svg); mask-image: url(../../assets/img/icons/pack/book.svg); }
.ico-music { /* 音符：曲子库（听过的 BGM） */ -webkit-mask-image: url(../../assets/img/icons/pack/music.svg); mask-image: url(../../assets/img/icons/pack/music.svg); }

/* --- 界面与地图 --- */
.ico-hit_effect { /* 命中特效：战斗节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/hit_effect.svg); mask-image: url(../../assets/img/icons/pack/hit_effect.svg); }
.ico-demon { /* 小恶魔：强敌节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/demon.svg); mask-image: url(../../assets/img/icons/pack/demon.svg); }
.ico-viking_helmet { /* 维京头盔：精英敌人节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/viking_helmet.svg); mask-image: url(../../assets/img/icons/pack/viking_helmet.svg); }
.ico-question_mark { /* 独立问号：事件节点 / 帮助 */ -webkit-mask-image: url(../../assets/img/icons/pack/question_mark.svg); mask-image: url(../../assets/img/icons/pack/question_mark.svg); }
.ico-chest { /* 宝箱：宝箱 / 奖励 */ -webkit-mask-image: url(../../assets/img/icons/pack/chest.svg); mask-image: url(../../assets/img/icons/pack/chest.svg); }
.ico-shop { /* 店铺：商店 / 商队 */ -webkit-mask-image: url(../../assets/img/icons/pack/shop.svg); mask-image: url(../../assets/img/icons/pack/shop.svg); }
.ico-tent { /* 帐篷：营地 / 休息 */ -webkit-mask-image: url(../../assets/img/icons/pack/tent.svg); mask-image: url(../../assets/img/icons/pack/tent.svg); }
.ico-boss { /* 凶恶脸：章节首领 */ -webkit-mask-image: url(../../assets/img/icons/pack/boss.svg); mask-image: url(../../assets/img/icons/pack/boss.svg); }
.ico-drought { /* 龟裂土地：地图·流沙之海 */ -webkit-mask-image: url(../../assets/img/icons/pack/drought.svg); mask-image: url(../../assets/img/icons/pack/drought.svg); }
.ico-mountain { /* 山：地图·赤岩峡谷 */ -webkit-mask-image: url(../../assets/img/icons/pack/mountain.svg); mask-image: url(../../assets/img/icons/pack/mountain.svg); }
.ico-forest { /* 森林：地图·藤蔓密林 */ -webkit-mask-image: url(../../assets/img/icons/pack/forest.svg); mask-image: url(../../assets/img/icons/pack/forest.svg); }
.ico-sea { /* 海：地图·潮汐盐海 */ -webkit-mask-image: url(../../assets/img/icons/pack/sea.svg); mask-image: url(../../assets/img/icons/pack/sea.svg); }
.ico-gravestone { /* 墓碑：地图·夜砂墓园 */ -webkit-mask-image: url(../../assets/img/icons/pack/gravestone.svg); mask-image: url(../../assets/img/icons/pack/gravestone.svg); }
.ico-star_coin { /* 四角星硬币：金币（不要用 coin：那是字母 C） */ -webkit-mask-image: url(../../assets/img/icons/pack/star_coin.svg); mask-image: url(../../assets/img/icons/pack/star_coin.svg); }
.ico-deck { /* 多张卡牌 / 牌组：卡组入口 */ -webkit-mask-image: url(../../assets/img/icons/pack/deck.svg); mask-image: url(../../assets/img/icons/pack/deck.svg); }
.ico-save_disk { /* 软盘：存档（与现有 Kenney 软盘区分开） */ -webkit-mask-image: url(../../assets/img/icons/pack/save_disk.svg); mask-image: url(../../assets/img/icons/pack/save_disk.svg); }
.ico-settings { /* 滑块：设置 */ -webkit-mask-image: url(../../assets/img/icons/pack/settings.svg); mask-image: url(../../assets/img/icons/pack/settings.svg); }
.ico-volume { /* 扬声器：音量（与 audio_off 配对） */ -webkit-mask-image: url(../../assets/img/icons/pack/volume.svg); mask-image: url(../../assets/img/icons/pack/volume.svg); }
.ico-death { /* 骷髅头：失败 / 阵亡 */ -webkit-mask-image: url(../../assets/img/icons/pack/death.svg); mask-image: url(../../assets/img/icons/pack/death.svg); }

/* --- 本地面板图标 --- */
.ico-gear { /* 齿轮：设置入口（existing） */ -webkit-mask-image: url(../../assets/img/icons/gear.png); mask-image: url(../../assets/img/icons/gear.png); }
.ico-sound { /* 喇叭：音效开（existing） */ -webkit-mask-image: url(../../assets/img/icons/audio_on.png); mask-image: url(../../assets/img/icons/audio_on.png); }
.ico-mute { /* 静音喇叭：音效关（existing） */ -webkit-mask-image: url(../../assets/img/icons/audio_off.png); mask-image: url(../../assets/img/icons/audio_off.png); }
.ico-save { /* 软盘：存档（existing） */ -webkit-mask-image: url(../../assets/img/icons/save.png); mask-image: url(../../assets/img/icons/save.png); }
.ico-home { /* 房子：返回主页（existing） */ -webkit-mask-image: url(../../assets/img/icons/home.png); mask-image: url(../../assets/img/icons/home.png); }
.ico-help { /* 问号：帮助（existing） */ -webkit-mask-image: url(../../assets/img/icons/question.png); mask-image: url(../../assets/img/icons/question.png); }
.ico-star { /* 五角星：稀有度 / 收藏（existing） */ -webkit-mask-image: url(../../assets/img/icons/star.png); mask-image: url(../../assets/img/icons/star.png); }
.ico-trophy { /* 奖杯：成就 / 胜利（existing） */ -webkit-mask-image: url(../../assets/img/icons/trophy.png); mask-image: url(../../assets/img/icons/trophy.png); }
.ico-warn { /* 三角警告：危险提示（existing） */ -webkit-mask-image: url(../../assets/img/icons/warning.png); mask-image: url(../../assets/img/icons/warning.png); }
.ico-money { /* 硬币：金币（existing） */ -webkit-mask-image: url(../../assets/img/icons/coin.png); mask-image: url(../../assets/img/icons/coin.png); }
.ico-question { /* 问号：未知事件（existing） */ -webkit-mask-image: url(../../assets/img/icons/question.png); mask-image: url(../../assets/img/icons/question.png); }
.ico-check { /* 对勾：确认（existing） */ -webkit-mask-image: url(../../assets/img/icons/check.png); mask-image: url(../../assets/img/icons/check.png); }
.ico-cross { /* 叉：取消 / 失败（existing） */ -webkit-mask-image: url(../../assets/img/icons/cross.png); mask-image: url(../../assets/img/icons/cross.png); }
.ico-fist { /* 拳头：物理攻击（existing） */ -webkit-mask-image: url(../../assets/img/icons/fist.png); mask-image: url(../../assets/img/icons/fist.png); }
.ico-arrow_right { /* 右箭头（existing） */ -webkit-mask-image: url(../../assets/img/icons/arrow_right.png); mask-image: url(../../assets/img/icons/arrow_right.png); }
.ico-arrow_up { /* 上箭头：升级（existing） */ -webkit-mask-image: url(../../assets/img/icons/arrow_up.png); mask-image: url(../../assets/img/icons/arrow_up.png); }
.ico-diamond { /* 钻石：稀有资源（existing） */ -webkit-mask-image: url(../../assets/img/icons/diamond.png); mask-image: url(../../assets/img/icons/diamond.png); }
.ico-key { /* 钥匙（existing） */ -webkit-mask-image: url(../../assets/img/icons/key.png); mask-image: url(../../assets/img/icons/key.png); }
.ico-pause { /* 暂停（existing） */ -webkit-mask-image: url(../../assets/img/icons/pause.png); mask-image: url(../../assets/img/icons/pause.png); }
.ico-trash { /* 垃圾桶：删除存档（existing） */ -webkit-mask-image: url(../../assets/img/icons/trash.png); mask-image: url(../../assets/img/icons/trash.png); }
.ico-cards { /* 扇形牌堆：卡组（existing） */ -webkit-mask-image: url(../../assets/img/cards/cards_fan.png); mask-image: url(../../assets/img/cards/cards_fan.png); }
.ico-skull { /* 骷髅头：危险 / 失败（existing） */ -webkit-mask-image: url(../../assets/img/cards/skull.png); mask-image: url(../../assets/img/cards/skull.png); }
.ico-crown { /* 王冠：首领（existing） */ -webkit-mask-image: url(../../assets/img/cards/crown.png); mask-image: url(../../assets/img/cards/crown.png); }
.ico-pouch { /* 钱袋：宝箱 / 奖励（existing） */ -webkit-mask-image: url(../../assets/img/cards/pouch.png); mask-image: url(../../assets/img/cards/pouch.png); }
.ico-house { /* 房子：商店 / 据点（existing） */ -webkit-mask-image: url(../../assets/img/cards/house.png); mask-image: url(../../assets/img/cards/house.png); }
.ico-campfire { /* 篝火：营地休息（existing） */ -webkit-mask-image: url(../../assets/img/cards/campfire.png); mask-image: url(../../assets/img/cards/campfire.png); }
.ico-shuffle { /* 交换的牌：洗牌（existing） */ -webkit-mask-image: url(../../assets/img/cards/cards_shuffle.png); mask-image: url(../../assets/img/cards/cards_shuffle.png); }
.ico-dice { /* 骰子：随机（existing） */ -webkit-mask-image: url(../../assets/img/cards/dice.png); mask-image: url(../../assets/img/cards/dice.png); }
.ico-flask { /* 满瓶药水：道具（existing） */ -webkit-mask-image: url(../../assets/img/cards/flask_full.png); mask-image: url(../../assets/img/cards/flask_full.png); }

/* --- 补充·卡牌语义 --- */
.ico-triple { /* 3x：三段攻击（岩石爆击 / 龙箭 / 连切 / 潮旋 / 杂技） */ -webkit-mask-image: url(../../assets/img/icons/pack/triple.svg); mask-image: url(../../assets/img/icons/pack/triple.svg); }
.ico-lightning { /* 闪电：先制 / 高速突进（电光一闪 / 子弹拳） */ -webkit-mask-image: url(../../assets/img/icons/pack/lightning.svg); mask-image: url(../../assets/img/icons/pack/lightning.svg); }
.ico-audio_waves { /* 声波：音波类技能（刺耳声 / 爆音波 / 低吼） */ -webkit-mask-image: url(../../assets/img/icons/pack/audio_waves.svg); mask-image: url(../../assets/img/icons/pack/audio_waves.svg); }
.ico-water { /* 水滴：水属性（水之波动 / 盐水 / 冲浪 / 生命水滴 / 水流环） */ -webkit-mask-image: url(../../assets/img/icons/pack/water.svg); mask-image: url(../../assets/img/icons/pack/water.svg); }
.ico-leaves { /* 树叶：草属性（飞叶快刀 / 寄生种子 / 飞叶风暴） */ -webkit-mask-image: url(../../assets/img/icons/pack/leaves.svg); mask-image: url(../../assets/img/icons/pack/leaves.svg); }
.ico-stone { /* 岩石：岩地属性攻击（落石 / 岩崩 / 尖石攻击） */ -webkit-mask-image: url(../../assets/img/icons/pack/stone.svg); mask-image: url(../../assets/img/icons/pack/stone.svg); }
.ico-fog { /* 雾：沙雾 / 降命中（蛛网 / 白雾 / 扬沙） */ -webkit-mask-image: url(../../assets/img/icons/pack/fog.svg); mask-image: url(../../assets/img/icons/pack/fog.svg); }
.ico-change { /* 循环双向箭头：换牌 / 折返（急速折返） */ -webkit-mask-image: url(../../assets/img/icons/pack/change.svg); mask-image: url(../../assets/img/icons/pack/change.svg); }
.ico-protect { /* 盾牌 + 对勾：守护（守住 / 神秘守护） */ -webkit-mask-image: url(../../assets/img/icons/pack/protect.svg); mask-image: url(../../assets/img/icons/pack/protect.svg); }
.ico-mace { /* 钉头锤：蛮力重击（蛮力 / 真气拳） */ -webkit-mask-image: url(../../assets/img/icons/pack/mace.svg); mask-image: url(../../assets/img/icons/pack/mace.svg); }
.ico-shield_03 { /* 圆盾（第三款）：缩壳类护盾（缩入壳中 / 缩壳） */ -webkit-mask-image: url(../../assets/img/icons/pack/shield_03.svg); mask-image: url(../../assets/img/icons/pack/shield_03.svg); }
.ico-dagger { /* 匕首：獠牙 / 撕咬类轻物理（咬住 / 咬碎） */ -webkit-mask-image: url(../../assets/img/icons/pack/dagger.svg); mask-image: url(../../assets/img/icons/pack/dagger.svg); }
.ico-spear { /* 长矛：穿刺 / 多针（双针） */ -webkit-mask-image: url(../../assets/img/icons/pack/spear.svg); mask-image: url(../../assets/img/icons/pack/spear.svg); }
.ico-heart { /* 爱心：生命回复（羽栖） */ -webkit-mask-image: url(../../assets/img/icons/pack/heart.svg); mask-image: url(../../assets/img/icons/pack/heart.svg); }
.ico-bed { /* 床：睡觉（休息牌）+ 潮汐盐海的营地节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/bed.svg); mask-image: url(../../assets/img/icons/pack/bed.svg); }
.ico-pill { /* 药丸：小回复（文柚果 / 好伤药） */ -webkit-mask-image: url(../../assets/img/icons/pack/pill.svg); mask-image: url(../../assets/img/icons/pack/pill.svg); }
.ico-refresh { /* 环形箭头：焕然一新（清除负面状态）/ 再来一次 */ -webkit-mask-image: url(../../assets/img/icons/pack/refresh.svg); mask-image: url(../../assets/img/icons/pack/refresh.svg); }

/* --- 补充·界面与地图 --- */
.ico-wolf { /* 狼：藤蔓密林的首领节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/wolf.svg); mask-image: url(../../assets/img/icons/pack/wolf.svg); }
.ico-anchor { /* 船锚：潮汐盐海的首领节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/anchor.svg); mask-image: url(../../assets/img/icons/pack/anchor.svg); }
.ico-demon_02 { /* 小恶魔（二型）：风蚀峭壁的首领节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/demon_02.svg); mask-image: url(../../assets/img/icons/pack/demon_02.svg); }
.ico-night { /* 月亮：夜砂墓原的营地节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/night.svg); mask-image: url(../../assets/img/icons/pack/night.svg); }
.ico-lantern { /* 提灯：藤蔓密林的营地节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/lantern.svg); mask-image: url(../../assets/img/icons/pack/lantern.svg); }
.ico-sign { /* 路牌：风蚀峭壁的商店节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/sign.svg); mask-image: url(../../assets/img/icons/pack/sign.svg); }
.ico-ingot { /* 金砖：赤岩峡谷的宝箱节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/ingot.svg); mask-image: url(../../assets/img/icons/pack/ingot.svg); }
.ico-tool_kit { /* 工具箱：风蚀峭壁的宝箱节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/tool_kit.svg); mask-image: url(../../assets/img/icons/pack/tool_kit.svg); }
.ico-sycee { /* 元宝：潮汐盐海的宝箱节点 */ -webkit-mask-image: url(../../assets/img/icons/pack/sycee.svg); mask-image: url(../../assets/img/icons/pack/sycee.svg); }

/* --- 界面与流程 --- */
.ico-infinity { /* 无限：无尽模式入口 */ -webkit-mask-image: url(../../assets/img/icons/pack/infinity.svg); mask-image: url(../../assets/img/icons/pack/infinity.svg); }
.ico-lock { /* 锁：还没解锁的入口 */ -webkit-mask-image: url(../../assets/img/icons/pack/lock.svg); mask-image: url(../../assets/img/icons/pack/lock.svg); }
/* #endregion GENERATED-ICONS */

/* 面板 */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .12)),
    linear-gradient(180deg, var(--sand-3), var(--sand-2));
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .18), var(--shadow-2);
  padding: 16px 18px;
}
.panel-paper {
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .25), var(--shadow-2);
}
.panel-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .06em;
  margin: 0 0 8px;
  /* 这几个标题（事件名 / 商人名 / 宝箱…）全在**浅色羊皮纸**面板上，
     而 --accent-2 是为深色背景调的亮金 —— 亮金压米黄几乎读不出来。
     换成同色系但更深的 --accent-deep，仍然跟着地图主题走，对比度却够了。 */
  color: var(--accent-deep);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
}
.panel-sub { font-size: 13px; opacity: .8; margin: -4px 0 12px; }

/* ============================================================
   HUD
   ============================================================ */
.hud {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(20, 12, 7, .96), rgba(20, 12, 7, .82));
  box-shadow: 0 1px 0 rgba(240, 169, 60, .18), 0 8px 24px rgba(0, 0, 0, .45);
}
.hud-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-portrait {
  width: 52px; height: 52px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #4d3620, #241810);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(240, 169, 60, .35);
  overflow: hidden;
}
.hud-portrait canvas { width: auto; height: 46px; image-rendering: pixelated; }

/* ---- 头像（PMD portrait）：HUD / 战斗角色卡 / 标题 / 结算 都在用 ---- */
.portrait {
  image-rendering: pixelated;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.hud-portrait img.portrait {
  width: 40px; height: 40px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6));
}
/* 战斗角色卡里的头像框 */
.fighter-face {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 226, 170, .16), rgba(0, 0, 0, .35));
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .28);
  overflow: hidden;
}
.fighter-face img { width: 40px; height: 40px; }
.fighter-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 3px;
}
.fighter-head .fighter-info { min-width: 0; flex: 1 1 auto; }
/* 标题界面：头图 + 标题排成一行当主视觉 */
.title-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 2px 0 4px;
}
.title-portrait {
  flex: 0 0 auto;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 226, 170, .22), rgba(0, 0, 0, .35));
  box-shadow: inset 0 0 0 2px rgba(255, 216, 150, .45), 0 6px 14px rgba(0, 0, 0, .45);
}
.title-portrait img {
  width: 64px; height: 64px;   /* 原生 40x40 的整数倍放大，保持锐利 */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5));
}
.title-names { text-align: left; }
/* 结算 / 奖励里的头像 */
.face-inline {
  display: inline-grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 226, 170, .14), rgba(0, 0, 0, .3));
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .25);
  overflow: hidden;
}
.face-inline img { width: 40px; height: 40px; }
.hud-ident { min-width: 96px; }
.hud-name { font-weight: 700; font-size: 15px; }
/**
 * 性别符号跟着主角的性别上色（3.0 起有两位主角）：
 *   ♀ 粉、♂ 蓝 —— 以前只有女主，这里写死了粉色，于是阿特拉斯名字旁边挂着一个粉 ♂（用户报的）。
 * 颜色由 src/ui/hud.js 按 `content/heroes.json` 的 gender 挂类名决定。
 */
.hud-name .gender { color: #ff9ad0; font-weight: 700; }
.hud-name .gender.male { color: #7fb8ff; }
.hud-name .gender.female { color: #ff9ad0; }
.hud-species { font-size: 11px; opacity: .68; }
.hud-hp { width: 190px; }
.hp-bar {
  position: relative;
  height: 22px;
  border-radius: 11px;
  background: #2a1a12;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 2px 6px rgba(0, 0, 0, .6);
  overflow: hidden;
}
.hp-fill {
  height: 100%;
  width: 100%;
  border-radius: 11px;
  background: linear-gradient(180deg, #8ff0a8, var(--good) 45%, var(--good-deep));
  transition: width .28s cubic-bezier(.2, .8, .3, 1), background .3s;
}
.hp-fill.warn { background: linear-gradient(180deg, #ffe07a, var(--accent) 45%, var(--accent-deep)); }
.hp-fill.crit { background: linear-gradient(180deg, #ff9d8a, var(--bad) 45%, var(--bad-deep)); }
.hp-bar span {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.hud-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.stat-chip b { color: var(--accent-2); }
.gold-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  color: #2b1704;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 60%, #d6a12f);
  box-shadow: var(--shadow-1);
}
.gold-pill .ico-money { width: 16px; height: 16px; }

/**
 * 右上角「背包」按钮上的件数角标（src/ui/hud.js 的 updateItemsButton 写它）。
 *
 * 玩家最想一眼看到的其实不是「有几件」，而是「**还放不放得下**」——
 * 拿到掉落时要不要丢一件、商店里能不能再买，全看这个数，所以满栏位时它变色。
 */
.btn-icon { position: relative; }
.hud-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 999px;
  font-size: 11px; font-weight: 800; line-height: 1;
  color: #2b1704;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 60%, #d6a12f);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(43, 23, 4, .35);
  pointer-events: none;
}
/* 手持栏满了：换成警示色（和「栏位满了」那句提示同一个红）*/
.hud-count.full {
  color: #2b0c07;
  background: linear-gradient(180deg, #f0a08c, var(--bad) 60%, #a83a2a);
}

/* ============================================================
   舞台
   ============================================================ */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: fadeIn .3s ease both;
}
.screen-scroll { overflow-y: auto; overflow-x: hidden; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
.screen { animation: screenIn .18s ease both; }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } 30% { transform: translate(-50%, -22px) scale(1.15); } to { opacity: 0; transform: translate(-50%, -70px) scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
@keyframes pulseGlow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(40px) scale(.94); } to { opacity: 1; transform: none; } }
/**
 * 沙丘 / 沙雾那两层。
 *
 * ⚠ 用户报的「背景那种沙漠一样的雾是断开的、不是完全连着的」= 这个动画的锅：
 * 原先是 `left/right: -20%`（宽度 140%）配 `translateX(±30%)` —— **平移幅度是按自身宽度算的**，
 * ±30% × 140% = ±42% 的屏幕宽，飘到两头时图层边缘直接进了画面，于是出现一条直边的「断面」。
 * 现在两头都留足余量（图层宽 190%、平移只有 ±13% 自身宽 ≈ ±25% 屏幕宽），
 * 并且每团雾气的渐变都**在图层内部就淡完**（`transparent 70%` 左右）——
 * 就算将来谁改了幅度，边缘也只是「已经透明」而不是一条硬线。
 */
@keyframes slither { 0% { transform: translateX(-13%) rotate(-1.2deg); } 100% { transform: translateX(13%) rotate(1.2deg); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.shake { animation: shake .34s ease; }
.bob { animation: bob 3s ease-in-out infinite; }

/* ============================================================
   标题界面
   ============================================================ */
.title-screen {
  align-items: center;
  justify-content: center;
  gap: 0;
  /** 内容一律不许溢出到屏幕外（用户报过「东西挤到屏幕外面去了」） */
  overflow: hidden;
  background:
    radial-gradient(90% 60% at 50% 12%, rgba(255, 200, 110, .22), transparent 70%),
    linear-gradient(180deg, #2a1a12 0%, #6b4a2a 42%, #d79a4e 62%, #7a4f26 72%, #2a1810 100%);
}
.title-screen::before {
  content: "";
  position: absolute;
  /* 比屏幕大一圈：动画平移时边缘始终在画面外（见 @keyframes slither 的说明） */
  inset: -12% -45%;
  background:
    radial-gradient(60% 30% at 20% 74%, #8a5a2b, transparent 70%),
    radial-gradient(70% 28% at 68% 78%, #a06a34, transparent 72%),
    radial-gradient(52% 24% at 44% 86%, #935f2c, transparent 74%);
  opacity: .85;
  animation: slither 26s ease-in-out infinite alternate;
  pointer-events: none;
}
/**
 * 两栏：左 = 主视觉（飞着的沙漠蜻蜓 + 标题），右 = 选项。
 * 用户的要求：「左边是标题和头像……标题选项放在右边。这样就不会挤到外面去了。」
 */
.title-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  align-items: center;
  gap: clamp(14px, 2.6vw, 48px);
  width: min(1180px, 96vw);
  height: 100%;
  padding: clamp(12px, 2.4vh, 30px) clamp(16px, 3vw, 44px);
  overflow: hidden;
}
.title-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.title-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}
/* 飞行姿态：底下一圈椭圆影子，让「飞」看得出来（不然像悬在半空） */
.title-hero { position: relative; margin-bottom: 2px; }
/**
 * 主视觉**居中**（3.0.2 用户报的「行走图偏左上」）。
 *
 * 原因：`canvas` 是行内元素，而精灵图的一帧里角色本身往往画在格子的左上角
 * （PMD 的帧格子比角色大一圈），行内元素又带基线留白 ——
 * 于是那一帧看起来既偏左、又比它该在的位置高一点，和下面那行标题对不齐。
 * 这里让 canvas 变成块级 + 居中，并且**不留基线空隙**。
 */
.title-hero { display: flex; flex-direction: column; align-items: center; }
.title-hero canvas { display: block; margin: 0 auto; vertical-align: top; }
/**
 * 头图外圈那个**按钮**（3.0：点它切换主角）。
 * 它套在 .title-hero 外面，所以必须把按钮自身的样式清干净（背景 / 边框 / 内边距），
 * 不然浏览器默认按钮会给这块主视觉描一圈灰边 —— 主角看起来像贴在一张纸条上。
 */
.title-hero-btn {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer;
  border-radius: var(--r-lg);
}
.title-hero-btn:hover .title-hero canvas { filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .5)) brightness(1.08); }
.title-hero-btn:active .title-hero canvas { transform: scale(.97); }
.title-hero-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* 头图旁那行「点头图换主角」：一排小胶囊，锁着的时候压暗并换成锁图标 */
.hero-swap-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 8px; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; line-height: 1.4; text-align: center;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  color: #ffe9c8;
}
.hero-swap-hint .ico-change { color: var(--accent-2); }
.hero-swap-hint.locked { opacity: .68; }
.title-hero::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -6px;
  width: 62%; height: 18px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, .45), transparent 70%);
  pointer-events: none;
}
.title-hero canvas {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .5));
  animation: bob 3.4s ease-in-out infinite;
}
.title-h1 {
  font-family: var(--font-title);
  font-size: clamp(28px, 4.4vw, 54px);
  margin: 0;
  letter-spacing: .12em;
  color: #fff4dd;
  text-shadow: 0 3px 0 #8a4d16, 0 6px 0 #4a2607, 0 10px 26px rgba(0, 0, 0, .6);
}
.title-h2 {
  font-family: var(--font-title);
  font-size: clamp(13px, 1.7vw, 19px);
  letter-spacing: .42em;
  margin: 2px 0 4px;
  color: var(--accent-2);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
}
.title-quote {
  /* 标题页 / 结算页那段旁白是「讲故事」的地方，用手写体。
     字号比正文大一档：手写体的字面比正文那套小一圈，同字号会显得偏小。 */
  font-family: var(--font-hand);
  max-width: 100%;
  margin: 8px auto 10px;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.8;
  text-align: center;
  color: #ffe9c8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  opacity: .92;
}
.title-menu { display: flex; flex-direction: column; gap: 9px; width: min(360px, 100%); }
.title-foot { margin-top: 6px; font-size: 10.5px; opacity: .55; line-height: 1.65; text-align: center; max-width: 620px; }
.title-meta { display: flex; gap: 14px; font-size: 12px; opacity: .8; justify-content: center; flex-wrap: wrap; }
.title-meta b { color: var(--accent-2); }

/**
 * 窄屏 / 矮屏：两栏压回一栏，并且允许纵向滚动 ——
 * 挤压的时候宁可让玩家滚一下，也不能把按钮推到屏幕外面（这一条就是这次的起因）。
 */
@media (max-width: 860px), (max-height: 700px) {
  .title-inner {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    overflow-y: auto;
    padding: 12px 16px 20px;
  }
  .title-hero canvas { max-height: 24vh; }
  .title-quote { font-size: 13.5px; margin: 4px auto 6px; }
  .title-foot { display: none; }
}

/* ============================================================
   地图界面
   ============================================================ */
.map-screen { background: linear-gradient(180deg, var(--sky-1, #2a1c14), var(--sky-3, #c98f4a)); }
.map-screen::before {
  content: "";
  position: absolute;
  left: -10%; right: -10%; bottom: -6%; height: 46%;
  background:
    radial-gradient(50% 100% at 15% 100%, rgba(255, 220, 150, .35), transparent 70%),
    radial-gradient(55% 100% at 62% 100%, rgba(255, 200, 140, .28), transparent 70%),
    radial-gradient(45% 90% at 90% 100%, rgba(120, 70, 30, .3), transparent 70%);
  pointer-events: none;
}
.map-header {
  position: relative;
  z-index: 5;
  padding: 12px 20px 8px;
  text-align: center;
  pointer-events: none;
}
.map-chapter {
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: .34em;
  color: rgba(255, 245, 225, .8);
  text-shadow: 0 2px 4px rgba(0, 0, 0, .7);
}
.map-name {
  font-family: var(--font-title);
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: .14em;
  color: #fff6e2;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 8px 20px rgba(0, 0, 0, .55);
  margin: 0;
  /* 章节名旁边挂一枚本章的图标（流沙之海=龟裂、夜砂墓原=墓碑…） */
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.map-name-ico { width: 30px; height: 30px; opacity: .92; }
.map-desc { font-size: 12px; color: rgba(255, 240, 215, .8); text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }

.map-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 90px;
  scrollbar-width: thin;
}
.map-scroll-inner { position: relative; width: min(880px, 96vw); margin: 0 auto; }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-lines path { fill: none; stroke: rgba(255, 240, 210, .28); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 7 9; }
.map-lines path.open { stroke: var(--accent-2); stroke-width: 4; animation: dashMove 1.6s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -32; } }

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: radial-gradient(circle at 40% 32%, #6b4a2a, #33241a 70%);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .45), 0 6px 0 rgba(0, 0, 0, .35);
  color: var(--sand-7);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s;
}
.map-node .node-ico { width: 34px; height: 34px; }
.map-node .node-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #ffeecd;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
  opacity: .0;
  transition: opacity .15s;
}
.map-node:hover .node-label, .map-node:focus-visible .node-label { opacity: 1; }
.map-node.available { box-shadow: inset 0 0 0 3px var(--accent-2), 0 0 0 4px rgba(255, 201, 107, .25), 0 8px 0 rgba(0, 0, 0, .35); animation: pulseGlow 2.2s ease-in-out infinite; }
.map-node.available:hover { transform: translate(-50%, -50%) scale(1.12); }
.map-node.available::after {
  content: "";
  position: absolute; inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 201, 107, .6);
  animation: spinSlow 12s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.map-node.done { filter: grayscale(.75) brightness(.6); cursor: default; }
.map-node.current { box-shadow: inset 0 0 0 3px #fff, 0 0 22px rgba(255, 255, 255, .5); }
.map-node.locked { filter: grayscale(.55) brightness(.55); cursor: not-allowed; }
.map-node.boss { width: 96px; height: 96px; background: radial-gradient(circle at 40% 32%, #7a2a3a, #2a1018 70%); }
.map-node small { font-size: 10px; opacity: .8; }

.map-legend {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  /* 不再铺全宽的深色渐变：图例每个小胶囊自己就有底色，
     底下再垫一条黑带只会让地图看起来「糊了一块」（截图反馈过）。 */
  padding: 8px 10px 4px;
  background: none;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(20, 12, 7, .7);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }
/* 图例改成和地图节点同一枚图标（颜色仍按节点类型） */
.legend-item .legend-ico { width: 13px; height: 13px; }

/* 标题 / 结算页的大图标（胜利=奖杯、失败=骷髅） */
.title-illo { display: flex; justify-content: center; margin: 4px 0 2px; opacity: .9; }

/* 地图上的快捷操作条 */
.map-actions {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 10px;
  /* 内边距收窄 + 渐变更短：以前上下各 10px 再叠一条到 92% 不透明的黑渐变，
     按钮下方会糊出一大块深色空白，看着像「页面底下多出一截」。 */
  padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(12, 8, 5, .78) 62%);
}

/* ============================================================
   战斗界面
   ============================================================ */
.battle-screen {
  background:
    radial-gradient(120% 70% at 50% 120%, rgba(255, 190, 100, .18), transparent 60%),
    linear-gradient(180deg, var(--sky-1, #241810) 0%, var(--sky-2, #6b4a2a) 55%, var(--ground, #8a5a2b) 100%);
  justify-content: space-between;
}
.battle-field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  /* 两栏布局：左半边放角色站位，右半边固定放战斗日志 —— 两者互不遮挡 */
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(230px, 0.95fr);
  /* 两行都按比例分：以前敌方 1fr、我方 auto，我方内容一高就把敌方那行挤扁，
     行走图被顶出行外、被上方 HUD 压住。现在两边都跟着场地高度走。 */
  grid-template-rows: minmax(0, 1fr) minmax(0, 0.85fr);
  grid-template-areas: "enemy log" "player log";
  column-gap: clamp(10px, 2vw, 26px);
  row-gap: 2px;
  padding: 6px clamp(10px, 3vw, 34px) 4px;
  overflow: hidden;
}
.weather {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; opacity: .5;
}

/* ------------------------------------------------------------------
   背景那层波浪花纹文字（3.0.5，用户要的；3.0.7 换成位图平铺）
   「和背景颜色相近但勉强能看清的文本作为装饰」——
   所以它不是白色也不是彩色，是**暖白、极低透明度**：在深色的上半片上像比背景亮一点的底纹，
   在浅色的下半片上同样只是勉强能看清。字体是用户给的那套装饰字体（汉字像图案）。

   ⚠ 这里是**位图平铺 + GPU 平移**，不是「SVG 文字在动」（见 battle-decor.js 的长说明）：
   位图里只有「一个周期的花纹」，`background-repeat: repeat-x` 平铺，
   整层用 transform 平移**一个周期**，linear 无限循环 —— 接缝处逐像素相同，
   而 transform 是合成层操作，**每帧不需要重绘**。前三版用 SVG 文字逐行动画，
   16000 多个字形每帧重光栅化，玩家实测「巨卡无比」。
   变亮：三层同一张位图、只差 opacity（底色 0.10 / 高亮 0.22），
   高亮那两份再用 mask 圈住自己那一侧 —— 亮起来的就是同一片字，不会多出别的形状。
   ------------------------------------------------------------------ */
.battle-decor {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
  /* 这层只画背景花纹：告诉浏览器它和别的盒子互不影响 */
  contain: strict;
}
.decor-layer {
  position: absolute; top: 0; bottom: 0;
  /* 比战场宽出两个周期：平移一个周期之后，战场仍然被铺满 */
  left: calc(-1 * var(--roll, 640px));
  width: calc(100% + 2 * var(--roll, 640px));
  background-repeat: repeat-x;
  background-position: 0 0;
  will-change: transform;
  /* 3D transform 会强制这一层进合成层（GPU 平移，不重绘） */
  animation: decorRoll var(--rollDur, 30s) linear infinite;
}
/* 一个周期就是画面的重复单元，所以「滚一个周期」是逐像素无缝的 */
@keyframes decorRoll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(calc(-1 * var(--roll, 640px)), 0, 0); }
}
.decor-base { opacity: .10; }
.decor-glow {
  opacity: 0;
  transition: opacity .55s ease;
}
/* 敌人那一半在上、主角那一半在下 —— 中心由 battle-view 的 layoutDecorGlow() 算出来
   写进 --glow-*（横向跟精灵、纵向取那条行带的中心，理由见那边的注释）。
   圈开得比较大（68% × 50%）：这层本身很淡，圈小了看着就像「没亮」。
   两侧的强度不一样，是**量出来的**：下半场的底色更亮（渐变的下半段），同样的附加亮度
   算成相对变化天然更小 —— 实测玩家那侧只有敌人那侧的 1/5，玩家原话就是「我方这边似乎不会点亮」。
   所以玩家那侧给到 .21（敌人 .16），让两边看上去差不多。 */
.decor-glow-enemy {
  -webkit-mask-image: radial-gradient(68% 50% at var(--glow-enemy-x, 60%) var(--glow-enemy-y, 24%), #000 0%, rgba(0, 0, 0, .5) 55%, transparent 82%);
  mask-image: radial-gradient(68% 50% at var(--glow-enemy-x, 60%) var(--glow-enemy-y, 24%), #000 0%, rgba(0, 0, 0, .5) 55%, transparent 82%);
}
.decor-glow-player {
  -webkit-mask-image: radial-gradient(68% 50% at var(--glow-player-x, 30%) var(--glow-player-y, 76%), #000 0%, rgba(0, 0, 0, .5) 55%, transparent 82%);
  mask-image: radial-gradient(68% 50% at var(--glow-player-x, 30%) var(--glow-player-y, 76%), #000 0%, rgba(0, 0, 0, .5) 55%, transparent 82%);
}
.battle-screen[data-acting="enemy"] .decor-glow-enemy { opacity: .16; }
.battle-screen[data-acting="player"] .decor-glow-player { opacity: .21; }
/* 降低动效 / 诊断用（?fps=1 的第二轮会挂 html[data-decor-motion="off"]）时就不滚了 */
@media (prefers-reduced-motion: reduce) {
  .decor-layer { animation: none !important; }
  .decor-glow { transition: none; }
}
html[data-decor-motion="off"] .decor-layer { animation: none !important; }
.weather i {
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(255, 226, 170, .8);
  border-radius: 50%;
  animation: sandFly linear infinite;
}
@keyframes sandFly {
  from { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  to { transform: translate(60vw, 18vh); opacity: 0; }
}

.fighter { position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; }
.fighter-enemy { grid-area: enemy; }
.fighter-player { grid-area: player; }
.fighter-enemy { justify-content: flex-end; }
.fighter-player { justify-content: flex-start; }
.fighter-body { position: relative; }
/* 精灵一律**绝对定位居中**：换动作时帧盒子大小会变（Idle 32×72 / Attack 64×80），
   如果让画布参与流式布局，右边那张血条卡就会被挤得左右跳。
   身体盒子的宽高由 battle-view 的 layoutBattle() 按待机那张写死，所以布局恒定。
   `--sprite-dy` 是**按内容对齐**的纵向补偿（帧盒子的空白四边不对称，不平移的话
   换动作会让角色上下跳 —— 实测 206 只里 199 只有这个毛病，见 applyAnimScale）。 */
.fighter-body canvas {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, calc(-50% + var(--sprite-dy, 0px)));
}
/* 精灵尺寸由 JS 按「这一行实际高度」算好后写进 canvas 的内联宽高。
   ⚠ 这里**不能**再夹 `max-height: 100%`：身体盒子被钉成待机那张的大小，
   而出招 / 受伤的帧盒子比待机大（冰宝 Idle 32×32 → Attack 64×64），
   单轴夹高度会把画布压成扁的 —— 用户报的「基本所有敌人出招、受伤时行走图都会被压扁」
   就是这一句（实测帧比 0.900 的画布被显示成 1.795，正好差一倍）。
   画布本来就是绝对定位居中的、不参与布局，让它自然溢出即可。 */
.fighter-body canvas { filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .45)); }

/* ------------------------------------------------------------------
   出牌展示区：一侧打出的牌会把卡面摊在这里
   对手用的牌必须看得见（不然完全不知道自己在挨什么打），
   所以这里不是缩成一个图标，而是真的把整张卡面亮出来。
   位置选在「自己半场的靠内一侧」：敌方那行左边是空的（信息卡和精灵都靠右），
   我方那行右边是空的，这样卡面既显眼又不会盖住任何一只怪兽。
   ------------------------------------------------------------------ */
.play-zone {
  position: absolute;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 8;
  transform: translateY(-50%);
}
.play-zone.enemy-play { left: 2%; }
.play-zone.player-play { right: 2%; }
.played-label {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  color: #ffe9c9;
  background: rgba(20, 12, 7, .78);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .3);
  white-space: nowrap;
}
.played-card {
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .65));
  opacity: 0;
  transform: translateY(22px) scale(.72) rotate(-7deg);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.25), opacity .2s ease;
}
.played-enemy { transform: translateY(-22px) scale(.72) rotate(7deg); }
/* .in 由 JS 在插进 DOM 的下一帧加上，这样过渡才会触发 */
.played-card.in { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
/* 出牌卡面：尺寸由 battle-view.js 的 layoutPlayZone() 算好后写成 zone 上的内联变量；
   这里的默认值只是兜底（脚本还没跑完的那一帧）。
   注意要写在 .play-zone 上而不是 .play-zone .card 上 —— 写在卡牌元素上会盖掉 JS 传下来的值。 */
.play-zone { --card-w: 186px; --card-h: 166px; }

/* 窄屏：左右两栏都被怪兽和角色卡占满了，layoutPlayZone() 会自动把出牌区挪到右侧日志上方的空白，
   这里保留一份纯 CSS 的兜底（JS 没跑起来时也不会盖住东西）。 */
@media (max-width: 760px) {
  .play-zone {
    position: fixed;
    top: 92px;
    transform: none;
    --card-w: 143px;
    --card-h: 146px;
  }
  .play-zone.enemy-play,
  .play-zone.player-play { left: auto; right: 3vw; }
}

.fighter-hurt { animation: shake .3s ease; }

/* ============================================================
   战斗简单特效（全部复用 assets/img/fx 里的贴图，不额外画素材）
   ============================================================ */

/* 护盾 / 强化 / 净化：行走图**整个剪影变成一种颜色**再复原。
   `--flash-filter` 由 JS 给（见 battle-fx.js 的 flashFilter）：默认 `brightness(0) invert(1)`
   = 纯白剪影；属性升降时是「中灰起步再上色」的红 / 蓝 —— 透明处一律仍然透明，
   所以是「这只精灵变色了一下」，不是糊一块色块。
   ⚠ 上色**不能从纯白起步**：纯白经 sepia 之后明度 97%，饱和度顶格，saturate 挤不出颜色，
   表现出来就是「设了红蓝还是闪白光」（用户报过）。
   闪两下（12% → 30% 半 → 48%）是有意的：只闪一下太像掉帧，两下才像「生效了」。 */
@keyframes whiteFlash {
  0%   { filter: none; }
  12%  { filter: var(--flash-filter, brightness(0) invert(1)) drop-shadow(0 0 16px rgba(255, 255, 255, .95)); }
  30%  { filter: brightness(2.2) saturate(.4) drop-shadow(0 0 10px rgba(255, 240, 200, .75)); }
  48%  { filter: var(--flash-filter, brightness(0) invert(1)) drop-shadow(0 0 12px rgba(255, 255, 255, .8)); }
  100% { filter: none; }
}
.fighter-flash { animation: whiteFlash var(--flash-ms, 620ms) ease both; }

/* 叠在角色身上的贴图特效：出现 → 放大 → 淡出。
   ⚠ 形状 = `background-image` 那张**贴图本身**（含羽化边与 alpha），
   颜色 = 元素自己的 `filter`（JS 按属性/状态算好一串 sepia→hue-rotate→saturate，
   见 battle-fx.js 的 tintFilter）。
   为什么不用「mask + background-color」那套：在无头浏览器里没问题，但**玩家机器上
   整个特效层渲染成了全透明**（「什么特效都没了」），而同一时刻护盾的闪白（普通 filter）
   是好的 —— 说明 CSS 本身没问题、是 mask 那条路不通。
   另外：贴图是**纯灰**的，所以早期用 `filter: hue-rotate()` 给状态上色的写法
   从来就没生效过（色相旋转改不了灰），这也是这一次才发现的。 */
.fx-burst {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--fx-size, 120px);
  height: var(--fx-size, 120px);
  margin-left: calc(var(--fx-size, 120px) / -2);
  margin-top: calc(var(--fx-size, 120px) / -2);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: screen;
  transform: rotate(var(--fx-rot, 0deg));
  animation: fxBurst var(--fx-ms, 460ms) cubic-bezier(.2, .8, .3, 1) var(--fx-delay, 0ms) both;
}
@keyframes fxBurst {
  0%   { opacity: 0; scale: .45; }
  25%  { opacity: 1; scale: 1.05; }
  60%  { opacity: .95; scale: 1.12; }
  100% { opacity: 0; scale: 1.3; }
}
/* 负面特效不要用叠加发光，改成压暗（混合模式是**真的生效**的那一项，不是被删掉的 hue-rotate） */
.fx-debuff { mix-blend-mode: multiply; opacity: .85; }
/* 环状特效（护盾的罩子、净化的光圈）：从中心涨开、不旋转 */
.fx-ring { animation: fxRing var(--fx-ms, 520ms) cubic-bezier(.15, .8, .3, 1) both; }
@keyframes fxRing {
  0%   { opacity: 0; scale: .3; }
  22%  { opacity: .95; scale: .95; }
  100% { opacity: 0; scale: 1.45; }
}

/* 出招时的弧光：从角色朝对手那一侧甩出去 */
.fx-swing-right { animation: fxSwingRight var(--fx-ms, 380ms) ease-out both; }
.fx-swing-left  { animation: fxSwingLeft var(--fx-ms, 380ms) ease-out both; }
@keyframes fxSwingRight {
  0%   { opacity: 0; translate: -10px 0; scale: .5; }
  30%  { opacity: 1; }
  100% { opacity: 0; translate: 52px 0; scale: 1.15; }
}
@keyframes fxSwingLeft {
  0%   { opacity: 0; translate: 10px 0; scale: .5; }
  30%  { opacity: 1; }
  100% { opacity: 0; translate: -52px 0; scale: 1.15; }
}

/* 远隔类的招式：一道流光从出手那一侧**飞到**对手身上。
   起点写在 left/top（JS 按两只精灵的实际位置算），位移交给 --fx-dx/--fx-dy。
   贴图（trace 那族）是竖着的光条，所以 JS 会把旋转角设成「飞行方向 + 90°」。 */
.fx-projectile {
  left: var(--fx-x, 0px);
  top: var(--fx-y, 0px);
  margin: 0;
  z-index: 7;
  animation: fxFly var(--fx-ms, 340ms) cubic-bezier(.35, .1, .6, 1) both;
}
@keyframes fxFly {
  0%   { opacity: 0; translate: 0 0; scale: .6; }
  18%  { opacity: 1; scale: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; translate: var(--fx-dx, 0px) var(--fx-dy, 0px); scale: 1.12; }
}

/* 命中冲击：稍微抖动放大一点 */
.fx-impact      { animation: fxBurst var(--fx-ms, 360ms) ease-out both, fxShake .24s ease; }
.fx-impact-crit { animation: fxBurst var(--fx-ms, 460ms) ease-out both, fxShake .3s ease; }
@keyframes fxShake {
  0%, 100% { translate: 0 0; }
  30% { translate: 4px -3px; }
  60% { translate: -3px 2px; }
}

/* ⚠ 「降低动效」下特效**不能变成什么都没有**。
   style.css 末尾有一条全局规则（`*, *::before, *::after { animation-duration: .001ms !important }`），
   而 .fx-burst 的关键帧是**淡到 opacity 0 结束**的 —— 动画被压成 0.001ms 之后，
   元素直接停在结束帧：什么都不显示。实测（shot.mjs 默认就带 --force-prefers-reduced-motion）
   整个特效层是完全不可见的，一版截图里「特效全没了」就是这个。
   所以这里给一条兜底：降低动效时**不要动画**，让特效以一张静态图显示到节点被移除为止
   （JS 到点会摘掉它，见 battle-fx.js），信息量保住、动作幅度为零。 */
@media (prefers-reduced-motion: reduce) {
  .fx-burst, .fx-projectile { animation: none !important; opacity: .85 !important; scale: 1 !important; }
  .fx-projectile { translate: calc(var(--fx-dx, 0px) * .5) calc(var(--fx-dy, 0px) * .5); }
}

/* 强化 / 削弱的飘字（保留 float-text 的描边，只换颜色和辉光） */
.float-buff   { color: #ffe9a8; font-size: 26px; text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 12px rgba(255, 210, 90, .85); }
.float-debuff { color: #dfb0ff; font-size: 24px; text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 10px rgba(160, 90, 220, .7); }
.fighter-dead { filter: grayscale(1) brightness(.5); transform: rotate(12deg) translateY(10px); transition: all .6s ease; }

.fighter-card {
  /* 必须 relative：护盾胶囊是绝对定位的，挂在卡上才能贴着卡片角；
     否则它会去认祖先 .fighter（整整一行的宽度），被甩到半场另一头去。 */
  position: relative;
  min-width: 180px;
  max-width: 290px;
  padding: 6px 11px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(20, 12, 7, .9), rgba(20, 12, 7, .74));
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .2), var(--shadow-1);
}
.fighter-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.fighter-name .tier {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}
.tier-elite { background: rgba(255, 140, 140, .25); color: #ffc2c2; }
.tier-boss { background: rgba(255, 120, 180, .28); color: #ffc6e2; }
/* 首领称号（「流沙之主」）：名字**底下那一行**小字，总宽由 JS 撑到与名字相等。
   以前它跟在名字后面（一行里挤着名字 + 档位角标 + 称号），窄屏上会被省略号切掉。 */
.boss-title-row { display: flex; justify-content: flex-start; margin-top: 1px; }
.boss-title {
  display: flex;
  justify-content: space-between;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  color: #ffd98a; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  white-space: nowrap;
}
/* 称号比名字长时（撑不开）退回自然宽度居中 */
.boss-title.centered { justify-content: center; }
.boss-title.centered span { margin: 0 .05em; }
.fighter-types { font-size: 10px; opacity: .7; margin-bottom: 4px; }

/* 窗口很矮时（行高 < 128px，由 layoutBattle() 加这个类）把角色卡压缩：
   隐藏次要信息、缩小头像与内边距，保证信息卡不会溢出到自己那一行外面。 */
.fighter.compact .fighter-types,
.fighter.compact .stat-chips { display: none; }
/* 窗口很矮时称号那一行也收掉：它是氛围信息，宁可让位给血条与攻防速 */
.fighter.compact .boss-title-row { display: none; }
.fighter.compact .fighter-card { min-width: 132px; max-width: 190px; padding: 3px 8px; }
.fighter.compact .fighter-face { width: 30px; height: 30px; }
.fighter.compact .fighter-face .portrait { width: 26px !important; height: 26px !important; }
.fighter.compact .fighter-name { font-size: 12px; }
.fighter.compact .bar { height: 12px; margin: 2px 0; }
.fighter.compact .fighter-statuses { min-height: 0; margin-top: 2px; }
.bar {
  position: relative;
  height: 16px;
  border-radius: 8px;
  background: #241610;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55);
  margin: 3px 0;
}
.bar > i {
  display: block; height: 100%;
  border-radius: 8px;
  transition: width .32s cubic-bezier(.2, .8, .3, 1);
}
.bar-hp > i { background: linear-gradient(180deg, #9bf0b0, var(--good) 45%, var(--good-deep)); }
.bar-hp.enemy > i { background: linear-gradient(180deg, #ff9d8a, var(--bad) 45%, var(--bad-deep)); }
.bar-hp.mid > i { background: linear-gradient(180deg, #ffe07a, var(--accent) 45%, var(--accent-deep)); }
.bar b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.bar-shield > i { background: linear-gradient(180deg, #cfe8ff, #7bb7e8 45%, #3a6f9c); }
.fighter-shield {
  /* 挂在信息卡的外侧上角：我方卡片在怪兽右边，敌人卡片在怪兽左边（镜像站位），
     所以敌人那侧的护盾改挂左上角，免得压住怪兽。 */
  position: absolute; top: -14px; right: -6px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: linear-gradient(180deg, #cfe8ff, #7bb7e8);
  color: #0d2233;
  box-shadow: var(--shadow-1);
  /**
   * 这里**不再**挂 popIn。
   *
   * 徽章现在只在数值变化时重建内容（见 battle-view.js 的 refreshSide），
   * 所以入场动画由「涨的那一下」的 .tick-up 负责；如果这里还留着一条基础 animation，
   * 那么每次把 .tick-up 摘掉时 animation-name 就变了，浏览器会把 popIn 当成一条新动画重播一遍 ——
   * 表现就是「护盾数字变一次，徽章弹两下」。
   *
   * 护盾徽章和状态胶囊共用一套「涨 / 掉」的弹跳动画（见 chipTickUp / chipTickDown），
   * 所以也要有 --chip：护盾的蓝。
   */
  --chip: #7bb7e8;
  z-index: 3;
}
.fighter-enemy .fighter-shield { right: auto; left: -6px; }
.fighter-statuses { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; min-height: 18px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  /* --chip 由 JS 按 STATUS_INFO 的主题色写上：入场闪、层数变化、退场都用它 */
  --chip: var(--accent-2);
  position: relative;
  transition: box-shadow .18s ease, background-color .18s ease;
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
/* 状态胶囊上的图标：mask 染成 STATUS_INFO 的主题色（内联 backgroundColor 覆盖 currentColor） */
.status-chip .status-ico { width: 11px; height: 11px; }
.status-val { display: inline-block; }
/**
 * 强化胶囊（我方 buff，v2.9961）：和状态胶囊同一排，但要一眼分得清 ——
 * 状态是「我身上出了什么事」（暗底），强化是「我自己挂上的」（金底 + 金色描边）。
 */
.status-chip.buff {
  background: rgba(255, 210, 122, .18);
  color: #ffe9bd;
}

/**
 * 「被挂上了毒」：从无到有，必须看得见。
 *
 * 这个动画只在**新建**的胶囊上播一次（refreshSide 里的对齐逻辑保证已有的胶囊不会被重建），
 * 所以它读起来就是「刚刚附加上了」；如果每次刷新都重建节点，这里就会变成满屏乱闪。
 */
.status-chip.enter { animation: chipIn .34s cubic-bezier(.22, 1.4, .4, 1); }
@keyframes chipIn {
  0%   { transform: scale(.35) translateY(7px); opacity: 0; }
  45%  { opacity: 1; box-shadow: inset 0 0 0 2px var(--chip), 0 0 12px 2px var(--chip); }
  70%  { transform: scale(1.16) translateY(0); }
  100% { transform: scale(1); opacity: 1; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip) 40%, transparent); }
}

/**
 * 层数变化：整颗胶囊弹一下（涨＝更亮更用力，掉＝暗一下，方向读得出来），
 * 数字本身滑进新值，旁边再飘一颗 +N / −N。
 */
.status-chip.tick-up, .fighter-shield.tick-up { animation: chipTickUp .34s ease; }
.status-chip.tick-down, .fighter-shield.tick-down { animation: chipTickDown .34s ease; }
@keyframes chipTickUp {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.16); box-shadow: inset 0 0 0 2px var(--chip), 0 0 10px 2px var(--chip); }
  100% { transform: scale(1); }
}
@keyframes chipTickDown {
  0%   { transform: scale(1); }
  35%  { transform: scale(.88); opacity: .55; }
  100% { transform: scale(1); opacity: 1; }
}
.status-val.val-up { animation: valUp .3s ease; }
.status-val.val-down { animation: valDown .3s ease; }
@keyframes valUp   { 0% { transform: translateY(7px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes valDown { 0% { transform: translateY(-7px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/**
 * Δ 角标：飘出去的是「这次变了多少」，胶囊上的数字才是当前层数。
 *
 * 往上飘会撞到上面那排属性（实测：正好压在「防42」上，两颗叠一起读成一片糊的），
 * 而状态胶囊是角色卡的最后一行 —— 往下飘是空的，所以让它往下走。
 */
.status-delta {
  position: absolute; right: 2px; bottom: -9px;
  font-size: 9px; font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 7px currentColor;
  pointer-events: none;
  animation: deltaFloat .74s ease forwards;
}
@keyframes deltaFloat {
  0%   { opacity: 0; transform: translateY(-3px) scale(.7); }
  25%  { opacity: 1; transform: translateY(1px) scale(1.12); }
  100% { opacity: 0; transform: translateY(11px) scale(1); }
}

/**
 * 退场：缩小、上浮、化掉，同时把宽度收掉 ——
 * 宽度不收的话胶囊虽然看不见了，那一格的空位还留着，整排会「顿」一下。
 */
.status-chip.out {
  animation: chipOut .32s ease forwards;
  pointer-events: none;
}
@keyframes chipOut {
  0%   { max-width: 220px; transform: scale(1); opacity: 1; }
  35%  { max-width: 220px; transform: scale(1.12); opacity: 1;
         box-shadow: inset 0 0 0 2px var(--chip), 0 0 12px 3px var(--chip); }
  100% { max-width: 0; padding-left: 0; padding-right: 0;
         transform: scale(.45) translateY(-6px); opacity: 0; }
}
/* 被净化掉的那几个：先用白光点一下名，再化掉（JS 在净化事件里先加 .purge，隔一帧才加 .out） */
.status-chip.purge {
  background: rgba(255, 255, 255, .55);
  box-shadow: inset 0 0 0 2px #fff, 0 0 14px 4px rgba(255, 255, 255, .75) !important;
  color: #2a1c12;
  transition: background-color .12s ease, box-shadow .12s ease, color .12s ease;
}

@media (prefers-reduced-motion: reduce) {
  .status-chip.enter, .status-chip.tick-up, .status-chip.tick-down,
  .fighter-shield.tick-up, .fighter-shield.tick-down,
  .status-chip.out, .status-val, .status-delta { animation: none; }
  .status-chip.out { opacity: 0; max-width: 0; padding-left: 0; padding-right: 0; }
  .status-delta { display: none; }
}
.stat-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; font-size: 11px; }
.stat-chips span { display: inline-flex; align-items: center; gap: 3px; opacity: .85; }
.stat-chips b { color: var(--accent-2); }
.stat-chips .up { color: var(--good); }
.stat-chips .down { color: var(--bad); }

.battle-middle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 4px 0;
  grid-column: 1;
}
.turn-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(20, 12, 7, .75);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
  font-size: 12px; font-weight: 700;
}

/* ------------------------------------------------------------------
   回合切换立绘
   回合数显示完整之后，对应一侧的正面/背面图「由大变小」落到**回合光带上**
   回合数的左边 / 右边（我方在左、敌方在右，和正作一样：自己的宝可梦给看后背）。

   三条硬约束：

   · 立绘位在光带内部、和回合数同一行，两侧留**等宽**的空位 ——
     所以回合数永远在正中，立绘多宽都不会把字幕顶偏；
   · 缩放原点是「靠着回合数的那条边」，于是放大时它朝字幕中央铺开、
     收拢时退回自己那一侧，而不是从旁边长出来；
   · 光带整体 `skewX(-12deg)`，立绘用等量的反向 skew 掰回来 ——
     宝可梦歪着站会很像坏图，但斜切的光带是这套 UI 的招牌样子。
   ------------------------------------------------------------------ */
.turn-sweep-row {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(10px, 2vw, 30px);
}
.turn-sweep-mid { display: flex; flex-direction: column; align-items: center; }
.turn-art {
  /* 高度跟着窗口走，窄窗口自动变小，不需要第二套断点 */
  --tart-h: clamp(56px, 8.4vw, 128px);
  flex: 0 0 auto;
  width: calc(var(--tart-h) * 1.6);
  height: var(--tart-h);
  position: relative;
  transform: skewX(12deg);   /* 把光带的 -12deg 掰回来 */
}
.turn-art-player { text-align: right; }
.turn-art-img {
  position: absolute;
  top: 50%;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .5));
  animation: turnArtIn var(--tart-in, 620ms) cubic-bezier(.16, .84, .3, 1) both;
}
.turn-art-player .turn-art-img { right: 0; margin-top: calc(var(--tart-ih, 0px) / -2); transform-origin: 0% 50%; }
.turn-art-enemy .turn-art-img { left: 0; margin-top: calc(var(--tart-ih, 0px) / -2); transform-origin: 100% 50%; }

@keyframes turnArtIn {
  0%   { opacity: 0; transform: scale(var(--tart-from, 2.6)); }
  18%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}
/* 淡出单独一个动画：想在同一条元素上用两条 animation 叠「入场 + 淡出」的话，
   后一条的 backwards 填充会在入场期间就把 transform 覆盖成 scale(1)，入场就不动了 */
.turn-art-img.turn-art-out,
.turn-art-glow.turn-art-out {
  animation: turnArtOut var(--tart-out, 300ms) ease-in both;
}
@keyframes turnArtOut {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.84); }
}

/* 脚下一圈光晕，把立绘从光带上托出来 */
.turn-art-glow {
  position: absolute;
  bottom: 2px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 236, 190, .6), rgba(255, 236, 190, 0) 72%);
  animation: turnArtGlow var(--tart-in, 620ms) ease-out both;
}
.turn-art-player .turn-art-glow { right: 0; }
.turn-art-enemy .turn-art-glow { left: 0; }
@keyframes turnArtGlow {
  0%   { opacity: 0; transform: scale(.6); }
  30%  { opacity: 1; transform: scale(1); }
  100% { opacity: .6; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .turn-art-img { animation: none; }
  .turn-art-glow { animation: none; opacity: .5; }
}

/* 每回合的预算胶囊（敏捷管的三件事里，出牌上限 / 抽牌数写在这里） */
.budget-chips { display: flex; gap: 8px; font-size: 11px; }
.budget-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(20, 12, 7, .5);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
  opacity: .92;
}
.budget-chip b { color: var(--accent-2); }
/* 出牌次数用完了：这一颗变红，玩家一眼知道「打不出去是因为次数」，不是卡住了 */
.budget-chip.out { background: rgba(90, 22, 16, .7); box-shadow: inset 0 0 0 1px rgba(255, 130, 110, .5); }
.budget-chip.out b { color: #ffb3a0; }
.intent {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 140, 110, .9), rgba(180, 60, 40, .9));
  font-size: 12px; font-weight: 700;
  box-shadow: var(--shadow-1);
  animation: popIn .25s ease;
}
.intent.calm { background: linear-gradient(180deg, rgba(140, 200, 255, .85), rgba(60, 110, 170, .9)); }
/* 威胁预警：黄色=这一下会很痛，红色=会被直接打倒 */
.intent.warn { background: linear-gradient(180deg, rgba(255, 214, 120, .92), rgba(176, 116, 24, .92)); color: #2a1c05; }
.intent.danger {
  background: linear-gradient(180deg, rgba(255, 120, 110, .95), rgba(150, 26, 30, .95));
  animation: popIn .25s ease, dangerPulse 1.1s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 80, 80, .0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 80, 80, .35); }
}

/* 右半边那一栏（3.1）：日志在上、弃牌区在下。
   用户：「右方日志可以往上挪，腾出下方空间用于放置玩家打过的牌」。 */
.battle-side {
  grid-area: log;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  width: 100%;
  align-self: stretch;
  z-index: 2;
}
.battle-log {
  /* 日志占这一栏的上半部分；下面留给弃牌区 */
  flex: 1 1 auto;
  min-height: 0;
  max-height: 150px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: rgba(12, 8, 5, .55);
  font-size: 12px;
  line-height: 1.7;
  scrollbar-width: thin;
  overflow-y: auto;
  /* 没有内容时不显示，避免开场一大块空方块 */
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
/* 弃牌区：玩家打过的牌（最新的排最前），张数多时只留最近一批 */
.discard-zone {
  flex: 0 1 auto;
  min-height: 44px;
  max-height: 42%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: rgba(12, 8, 5, .42);
  overflow: hidden;
}
.discard-head {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 11px; letter-spacing: .06em; opacity: .8;
}
.discard-head b { color: var(--accent-2); font-size: 12px; }
.discard-empty { font-size: 11px; opacity: .45; }
.discard-list {
  display: flex; flex-wrap: wrap; gap: 3px;
  overflow: hidden; align-content: flex-start;
}
.discard-card {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px 1px 2px;
  border-radius: 999px;
  background: rgba(255, 236, 200, .10);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 200, .18);
  font-size: 11px; line-height: 1.6;
  white-space: nowrap;
}
.discard-cost {
  width: 14px; height: 14px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: #2b6ea8; color: #eaf6ff;
  font-style: normal; font-size: 10px; font-weight: 700;
}
.discard-card.rarity-rare { background: rgba(160, 200, 255, .16); }
.discard-card.rarity-epic { background: rgba(215, 170, 255, .18); }
.battle-log.has-content {
  opacity: 1;
  pointer-events: auto;
}
.battle-log p { margin: 0; padding: 1px 0; opacity: .88; border-bottom: 1px solid rgba(255,255,255,.05); }
.battle-log p.good { color: #9be8b4; }
.battle-log p.bad { color: #ffa894; }
/* 「没抽到牌，因为打出去的牌要下回合才回牌堆」这类解释性提示：压暗一档，不抢眼 */
.battle-log p.note { opacity: .62; }
.battle-log p:last-child { opacity: 1; font-weight: 600; }

/* 战斗底部：手牌区 */
.battle-bottom {
  position: relative;
  z-index: 12;
  padding: 4px clamp(8px, 2vw, 24px) calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(12, 8, 5, .82) 30%);
}
.battle-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 2px;
}
.ap-display { display: flex; align-items: center; gap: 8px; }
.ap-orbs { display: flex; gap: 4px; }
.ap-orb {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7fe0ff, #2b7fa8 70%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 2px 0 rgba(0, 0, 0, .4);
}
.ap-orb.spent { background: #2a1a12; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .1); opacity: .5; }
/* 花掉 AP：球先弹起来亮一下，再缩下去熄灭（非线性，不是直接跳成暗的） */
@keyframes apOrbSpend {
  0%   { transform: scale(1); opacity: 1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 0 rgba(150, 225, 255, .6); }
  38%  { transform: scale(1.55); opacity: 1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .2), 0 0 14px 5px rgba(150, 225, 255, .5); }
  100% { transform: scale(.55); opacity: .25; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .1), 0 0 0 0 rgba(150, 225, 255, 0); }
}
.ap-orb.ap-orb-spending { animation: apOrbSpend .34s cubic-bezier(.2, .85, .3, 1) both; }
/* 回合开始 AP 回满：一颗一颗「充能」亮起来，不是瞬间全亮 */
@keyframes apOrbFill {
  0%   { transform: scale(.4); opacity: .25; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 0 rgba(150, 225, 255, 0); }
  55%  { transform: scale(1.42); opacity: 1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), 0 0 16px 6px rgba(150, 225, 255, .55); }
  100% { transform: scale(1); opacity: 1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 2px 0 rgba(0, 0, 0, .4); }
}
.ap-orb.ap-orb-filling { animation: apOrbFill .42s cubic-bezier(.2, .9, .25, 1) both; }
@media (prefers-reduced-motion: reduce) { .ap-orb.ap-orb-filling { animation: none !important; } }

/* 回合切换：一条斜切光带横扫 + 回合数推进。
   关键改动：光带**在屏幕中间停住**一段时间（26%~72% 都是 translateX(0)），
   以前只有一个 52% 关键帧，等于从头到尾一直在滑，回合数根本来不及看清。
   时长由 JS 通过 --sweep-ms 传进来，跟着「演出速度」缩放。 */
.turn-sweep {
  position: fixed;
  left: 0; right: 0; top: 42%;
  height: 96px;
  z-index: 200;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform: translateX(-115%) skewX(-12deg);
  animation: turnSweep var(--sweep-ms, 1250ms) cubic-bezier(.22, .9, .25, 1) both;
  box-shadow: 0 0 40px 8px rgba(120, 200, 255, .18);
}
.turn-sweep-glow {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(140, 210, 255, .16) 18%, rgba(140, 210, 255, .30) 50%, rgba(140, 210, 255, .16) 82%, transparent);
  border-top: 1px solid rgba(190, 235, 255, .5);
  border-bottom: 1px solid rgba(190, 235, 255, .5);
}
.turn-sweep-text {
  position: relative;
  font-family: var(--font-title);
  font-size: 40px; font-weight: 700; letter-spacing: .16em;
  color: #eaf6ff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 22px rgba(130, 205, 255, .8);
  animation: turnSweepText var(--sweep-ms, 1250ms) cubic-bezier(.2, .9, .25, 1) both;
}
.turn-sweep-sub {
  position: relative;
  margin-top: 2px;
  font-size: 15px; letter-spacing: .3em;
  color: #bfe4ff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  animation: turnSweepText var(--sweep-ms, 1250ms) cubic-bezier(.2, .9, .25, 1) .06s both;
}
.turn-sweep.sweep-enemy .turn-sweep-glow {
  background: linear-gradient(90deg, transparent, rgba(255, 170, 140, .16) 18%, rgba(255, 160, 130, .30) 50%, rgba(255, 170, 140, .16) 82%, transparent);
  border-color: rgba(255, 205, 185, .5);
}
.turn-sweep.sweep-enemy .turn-sweep-text { color: #ffece4; text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 22px rgba(255, 150, 110, .8); }
.turn-sweep.sweep-enemy .turn-sweep-sub { color: #ffd2c2; }
@keyframes turnSweep {
  0%   { transform: translateX(-115%) skewX(-12deg); opacity: 0; }
  8%   { opacity: 1; }
  16%  { transform: translateX(0) skewX(-12deg); opacity: 1; }
  /* 停住很久：光带现在**不挡操作**了，停久一点才有时间看清回合数和立绘
     （立绘就在这段时间里由大变小落到回合数旁边） */
  76%  { transform: translateX(0) skewX(-12deg); opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(115%) skewX(-12deg); opacity: 0; }
}
@keyframes turnSweepText {
  0%   { transform: scale(.84); opacity: 0; letter-spacing: .42em; }
  12%  { transform: scale(1.05); opacity: 1; letter-spacing: .16em; }
  78%  { transform: scale(1); opacity: 1; letter-spacing: .16em; }
  100% { transform: scale(1.03); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .turn-sweep { animation-duration: .01s; }
  .turn-sweep-text, .turn-sweep-sub { animation: none; }
}
@media (prefers-reduced-motion: reduce) { .ap-orb.ap-orb-spending { animation: none !important; } }
.ap-text { font-weight: 700; font-size: 15px; color: #b8ecff; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
/* AP 图标（注册表里的 action_points 就是「AP」两个字），所以文字里不再重复写 AP */
.ap-ico { width: 15px; height: 15px; color: #b8ecff; opacity: .9; }
.pile-info { display: flex; gap: 10px; font-size: 11px; opacity: .8; }
.pile-info b { color: var(--accent-2); }

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  min-height: calc(var(--card-h) + var(--card-h-l10n, 0px) + 4px);
  padding-bottom: 2px;
}
/* 叠放量由 battle-view.js 的 fitHand() 按手牌张数和可用宽度算好写进 --hand-overlap，
   这里的 12px 只是脚本还没跑时的兜底（以前写死 -14px，卡变大以后会溢出）。 */
.hand .card { margin: 0 calc(-1 * var(--hand-overlap, 12px)); }
.hand .card:hover { z-index: 20; }
.hand-empty { opacity: .5; font-size: 13px; padding: 40px 0; }

/* ============================================================
   卡牌
   ============================================================
   稀有度靠**整套配色**区分，全部由下面这几个变量驱动，加一档稀有度只要加一组变量：
     --card-paper-1/2/3  卡面纸色（整张卡的底色，不是一层会淡出的叠加 —— 第一版就是叠加，
                         结果只有顶上一点点染色，玩家反馈「卡的底色并没有更改」）
     --card-art-1/2      美术横幅的底色（原来固定是褐色，整张卡看着还是褐的）
     --card-body-ink     正文颜色（跟着底色走，蓝底上用蓝黑而不是褐墨）
     --rarity-frame      描边颜色
     --rarity-ink        卡名颜色
     --rarity-glow       外发光（只有精良以上有）
   —— 做成变量而不是四套重复规则：以前箱阴影那几行就是复制粘贴出来的，
   改一处忘一处，结果「战斗里的稀有卡同时带 card-common 和 card-rare」时谁也说不清哪条赢。 */
.card {
  position: relative;
  width: var(--card-w);
  height: calc(var(--card-h) + var(--card-h-l10n, 0px));
  flex: 0 0 auto;
  border-radius: 14px;
  padding: 8px 9px 9px;
  cursor: pointer;
  color: var(--ink);
  --card-paper-1: #f0dcb6;
  --card-paper-2: #e2c795;
  --card-paper-3: #c9a974;
  --card-art-1: #d9bb8b;
  --card-art-2: #ad8551;
  --card-body-ink: #4a3524;
  --rarity-frame: rgba(90, 60, 30, .5);
  --rarity-ink: #2b1a0a;
  --rarity-glow: 0 0 0 rgba(0, 0, 0, 0);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 30%),
    linear-gradient(168deg, var(--card-paper-1) 0%, var(--card-paper-2) 62%, var(--card-paper-3) 100%);
  box-shadow:
    inset 0 0 0 2px var(--rarity-frame),
    inset 0 0 0 4px rgba(255, 240, 210, .35),
    var(--rarity-glow),
    var(--shadow-card);
  transition: transform .16s cubic-bezier(.2, .8, .3, 1), box-shadow .16s, filter .16s;
  user-select: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 卡面的字号 / 尺寸全部走这几个变量，三档尺寸（sm / 默认 / lg）只改变量不改结构。
   以前卡面是「左边一竖条美术 + 右边一条窄文字」，文字只剩三四十像素宽——
   明明卡不小，文案却挤成一列列断行；现在美术是一条通栏横幅，文字吃满整张卡的宽度。
   卡名比描述明显大一档（18 vs 12.5）+ 更粗（800）：扫一眼先看到「这是哪张牌」，
   再读描述 —— 以前名字只比描述大 1.5px，两者看着像同一层信息。 */
.card {
  --card-name-fs: 18px;
  --card-text-fs: 12.5px;
  --card-art-h: 46px;
  --card-ico: 32px;
  --card-clamp: 4;
}
.card::after {
  content: "";
  position: absolute; inset: 5px;
  border-radius: 8px;
  border: 1px solid rgba(120, 80, 40, .28);
  pointer-events: none;
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex: 0 0 auto; }
.card-name {
  font-family: var(--font-title);
  font-size: var(--card-name-fs);
  font-weight: 800;
  /* 名字比描述粗一档、大 5.5px，行高收紧到 1.15：一是别把行动点圆圈那行撑高，
     二是给下面的描述多留一行空间（卡名最长 4 个字，实测三档都放得下，诊断脚本会卡这一点） */
  line-height: 1.15;
  letter-spacing: .01em;
  color: var(--rarity-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-ap {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 15px; font-weight: 800;
  color: #04222e;
  background: radial-gradient(circle at 35% 30%, #a8ecff, #4aa8d0 70%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .3), 0 1px 0 rgba(0, 0, 0, .3);
}
.card-mid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
  margin: 5px 0 4px;
}
.card-art {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: var(--card-art-h);
  margin: 0;
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 240, 210, .5), transparent 70%),
    linear-gradient(180deg, var(--card-art-1), var(--card-art-2));
  box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .35), inset 0 4px 10px rgba(90, 60, 30, .3);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card-art canvas { image-rendering: pixelated; max-width: 96%; max-height: 96%; }
.card-art .art-ico { width: var(--card-ico); height: var(--card-ico); opacity: 1; background-color: var(--card-body-ink); }
.card-art .art-fx {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: .22;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.card-text {
  font-size: var(--card-text-fs);
  line-height: 1.45;
  color: var(--card-body-ink);
  order: 3;
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: var(--card-clamp);
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 9.5px; letter-spacing: .08em;
  color: rgba(74, 53, 36, .75);
  text-transform: uppercase;
  border-top: 1px dashed rgba(120, 80, 40, .3);
}
/* 底栏左右两组：左边是「稀有度宝石 + 类型 + 角色标记」，右边是 ×N / 未获得 这类角标。
   以前是「一个 span 一个 badge 平铺 + space-between」，加两个角色标记就会和角标抢位置。 */
.card-foot .foot-left,
.card-foot .foot-right {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.card-foot .foot-right { flex: 0 0 auto; gap: 3px; }
/* 稀有度宝石：颜色就是描边色，悬停会说出稀有度叫什么 */
.rarity-gem {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: var(--rarity-frame);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 0 4px rgba(0, 0, 0, .25);
  margin-right: 2px;
}
.card-tag { flex: 0 0 auto; }
/* 角色标记：保护 / 代价。文字 + 图标一起给，比只放一个图标好认（第一次玩的人不认识图标） */
.card-role {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 0 3px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 13px;
}
.card-role > [class^="ico-"], .card-role > [class*=" ico-"] { width: 9px; height: 9px; }
.card-role.role-protect {
  color: #0d5540;
  background: rgba(111, 211, 160, .38);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 70, .5);
}
.card-role.role-cost {
  color: #7d1d12;
  background: rgba(255, 140, 120, .34);
  box-shadow: inset 0 0 0 1px rgba(150, 50, 30, .5);
}
.card-band {
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
}
.card-common .card-band { background: var(--rarity-common); }
.card-uncommon .card-band { background: var(--rarity-uncommon); }
.card-rare .card-band { background: var(--rarity-rare); }
.card-epic .card-band { background: var(--rarity-epic); }

/* 稀有度整套配色：纸色 / 美术横幅 / 正文色 / 描边 / 卡名 / 外发光。
   色相和 --rarity-* 保持一致，玩家看到蓝底蓝边就知道是稀有，不用去背图例。
   商店的货架行也在选择器里（`.shop-item.rarity-*`）：货架上的卡要和别处的卡长得一样，
   而且是**同一份色号** —— 复制一套过去迟早会改一处忘一处。 */
.card-common, .shop-item.rarity-common {
  --card-paper-1: #f0dcb6;
  --card-paper-2: #e2c795;
  --card-paper-3: #c9a974;
  --card-art-1: #d9bb8b;
  --card-art-2: #ad8551;
  --card-body-ink: #4a3524;
  --rarity-frame: rgba(90, 60, 30, .5);
  --rarity-ink: #2b1a0a;
}
/* 精良（uncommon）：原来是淡绿，压在米黄卡面上几乎看不出和普通卡的区别 —— 加浓一档，
   纸面明显偏绿、美术横幅用更深的草绿，四档里一眼分得出「这张不是普通卡」。 */
.card-uncommon, .shop-item.rarity-uncommon {
  --card-paper-1: #dcebc4;
  --card-paper-2: #c2dda1;
  --card-paper-3: #90bc67;
  --card-art-1: #a6cd7c;
  --card-art-2: #5c8d38;
  --card-body-ink: #22401c;
  --rarity-frame: rgba(56, 118, 36, .82);
  --rarity-ink: #2b6a17;
  --rarity-glow: 0 0 14px rgba(109, 190, 74, .34);
}
.card-rare, .shop-item.rarity-rare {
  --card-paper-1: #dde8fc;
  --card-paper-2: #c9d9f8;
  --card-paper-3: #9db6e2;
  --card-art-1: #b4c7ec;
  --card-art-2: #7890c2;
  --card-body-ink: #26364f;
  --rarity-frame: rgba(46, 104, 186, .85);
  --rarity-ink: #17457e;
  --rarity-glow: 0 0 18px rgba(127, 184, 255, .40);
}
/* 史诗（epic）：原来是浅紫，和稀有（浅蓝）放在一起几乎分不出来 —— 改成**红**，
   四档的色相彻底拉开：普通=米黄 / 精良=绿 / 稀有=蓝 / 史诗=红。 */
.card-epic, .shop-item.rarity-epic {
  --card-paper-1: #f8ded8;
  --card-paper-2: #efc3ba;
  --card-paper-3: #d08d82;
  --card-art-1: #e5a79c;
  --card-art-2: #a8453a;
  --card-body-ink: #4a201a;
  --rarity-frame: rgba(186, 46, 34, .9);
  --rarity-ink: #8c1c11;
  --rarity-glow: 0 0 22px rgba(255, 106, 86, .48);
}
/* 悬停 / 选中时把稀有度的外发光接着带上，别被统一的 box-shadow 顶掉 */
.card-rare:hover, .card-epic:hover { box-shadow: inset 0 0 0 2px var(--rarity-frame), 0 12px 22px rgba(0, 0, 0, .55), var(--rarity-glow); }
.card-rare.selected, .card-epic.selected { box-shadow: 0 0 0 3px var(--accent-2), 0 12px 24px rgba(0, 0, 0, .55), var(--rarity-glow); }
.card-exhaust::before {
  content: "销毁";
  position: absolute; top: 8px; right: 34px; z-index: 3;
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(120, 30, 30, .88); color: #ffd7d0;
  letter-spacing: .08em;
}

.card:hover { transform: translateY(-16px) scale(1.06); z-index: 15; box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .5), 0 12px 22px rgba(0, 0, 0, .55); }
.card.selected { transform: translateY(-22px) scale(1.08); box-shadow: 0 0 0 3px var(--accent-2), 0 12px 24px rgba(0, 0, 0, .55); }
.card:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.card.disabled { filter: grayscale(.65) brightness(.75); cursor: not-allowed; }
.card.disabled:hover { transform: none; }
.card.playing { animation: cardPlay .35s ease forwards; }
@keyframes cardPlay { to { transform: translateY(-90px) scale(.6) rotate(6deg); opacity: 0; } }
.card-locked { opacity: .35; }.card-picked { box-shadow: 0 0 0 3px var(--good), var(--shadow-card); }
/* 纯展示用的大卡面（卡牌详情页左边那张）：不做悬停抬起，也不响应鼠标 ——
   它不是按钮，抬起会让人以为点了有用；要悬停查词请用右边的说明文字。 */
.card-static { pointer-events: none; }

/* 图鉴里「从没见过」的卡：压暗 + 灰掉，卡面下沿会写「未获得」。
   以前图鉴把 86 张按同一个亮度全画出来，玩家以为「没拿过的也算已收集」。
   压得比较狠是有意的：这一档要和「已收集」一眼分得开，光靠一点色差看不出来。 */
.card-unowned { filter: grayscale(.88) brightness(.62); }
.card-unowned:hover { filter: grayscale(.45) brightness(.88); }

/* 三档尺寸：卡组列表（sm）/ 战斗手牌（默认）/ 展示与详情（lg）。
   卡面结构完全一样，只改变量与字号 —— 越大的档文字越大、能放的行数越多。
   卡名一律比同档描述大 4~7px（18 vs 12.5 / 16 vs 12 / 21 vs 14）：名字要跳出来。
   sm 档名字不能再大了：卡组页的卡左边还要让开勾选圈，14 字宽的位置只够 4 个字 × 16px。 */
.card-sm {
  --card-w: 148px; --card-h: 208px;
  --card-name-fs: 16px;
  --card-text-fs: 12px;
  --card-art-h: 42px;
  --card-ico: 28px;
  --card-clamp: 6;
}
.card-lg {
  --card-w: 212px; --card-h: 272px;
  --card-name-fs: 21px;
  --card-text-fs: 14px;
  --card-art-h: 88px;
  --card-ico: 54px;
  --card-clamp: 7;
}

/**
 * 日文 / 英文的卡面：卡名更长，得单独放宽。
 *
 * 起因（用户截图）：中文卡名最长 4 个字，日文最长 11 个假名（アイアンテールウォール），
 * 英文最长 19 个字母（Dragon Water Cannon）—— 一行放不下就被 `text-overflow` 切成
 * 「ドラゴン…」「Venom Dr…」；底栏的英文角色标记（PROTECTION）也会被切掉尾巴。
 *
 * 这几条只对 ja / en 生效，中文那套逐字不变：
 *   ① 卡名允许折成**两行**（中文仍然单行，四字名不会突然变两行）；
 *   ② 名字字号降一档（md 18 → 15.5），但**仍比同档描述大 3px 且 800 粗** ——
 *      `?dgcards=1` 有一条断言卡这个（差 ≥3px），所以别降过头；
 *   ③ 底栏允许换行 + 字号收一档 + 字距收紧（英文大写字母本来就宽）；
 *   ④ 卡面加高（`--card-h-l10n`），把多出来的那行吃掉，描述的行数不变。
 *
 * 出牌展示区（.played-card）例外：那里的尺寸和字号都由 JS 按 `--u` 算，不能叠加这两条。
 */
html[lang="ja"], html[lang="en"] { --card-h-l10n: 20px; }
html[lang="ja"] .card-name,
html[lang="en"] .card-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.12;
}
html[lang="ja"] .card, html[lang="en"] .card { --card-name-fs: 15.5px; }
html[lang="ja"] .card-sm, html[lang="en"] .card-sm { --card-name-fs: 15px; --card-h-l10n: 24px; }
html[lang="ja"] .card-lg, html[lang="en"] .card-lg { --card-name-fs: 19px; --card-h-l10n: 24px; }
html[lang="ja"] .card-foot,
html[lang="en"] .card-foot {
  flex-wrap: wrap;
  row-gap: 2px;
  font-size: 8.5px;
  letter-spacing: .04em;
}
/* 底栏内部两组也要能换行：英文的「DEFENSE + PROTECTION」并排就是 168px 宽，
   而窄卡（sm 档）里只有 130px —— 只让外层换行不够，里面这一排得自己折下去。 */
html[lang="ja"] .card-foot .foot-left,
html[lang="en"] .card-foot .foot-left,
html[lang="ja"] .card-foot .foot-right,
html[lang="en"] .card-foot .foot-right { flex-wrap: wrap; row-gap: 2px; }
html[lang="ja"] .card-role,
html[lang="en"] .card-role { padding: 0 2px; }
/* 卡组页那种「左边让开勾选圈」的窄卡（.card-with-check，卡名可用宽度只剩 ~69px）：
   19 个字母的英文名即使折两行也放不下，"Acrobatics" 这种单个长词更是没法换行 ——
   这一档允许在词中间断开，总比被省略号切掉强。（正常界面不会走到这一档：
   勾选圈只有卡面诊断当检具用。） */
html[lang="ja"] .card-with-check .card-name,
html[lang="en"] .card-with-check .card-name { overflow-wrap: anywhere; }
/* 出牌展示区：尺寸由 JS 按 --u 缩放，这里把语言补偿撤掉、字号跟着 --u 走 */
html[lang="ja"] .played-card .card,
html[lang="en"] .played-card .card {
  --card-h-l10n: 0px;
  --card-name-fs: calc(15.5px * var(--u, 1));
}
html[lang="ja"] .played-card .card-foot,
html[lang="en"] .played-card .card-foot { font-size: calc(8.5px * var(--u, 1)); }

.card-check {
  position: absolute; top: 7px; left: 7px; z-index: 4;
  width: 24px; height: 24px; border-radius: 50%;
  padding: 0;
  border: 0;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .45);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
  color: transparent;
}
.card-check:hover { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 2px rgba(255, 255, 255, .35); }
/* 出战卡组满了：还没选的圆圈画成「锁住」，悬停说明为什么会点不动 */
.card-check.locked {
  background: rgba(0, 0, 0, .55);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16);
}
.card-check.locked:hover { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16); }
/* 勾选圈会压在卡名的第一个字上，有圆圈时把名字整行往右让开 */
.card-with-check .card-top { padding-left: 27px; }
.card.in-deck .card-check { background: var(--good); color: #08240f; }

/* 出牌展示区的卡面：尺寸由 JS 按可用空白算（可能比手牌小很多），
   所以卡面内部**所有**尺寸都按 `--u`（= 卡宽 ÷ 标准卡宽 186，由 JS 写进 zone）等比缩放。
   以前只改 --card-w/--card-h 而不动字号间距：卡一窄，能放下的行数就变少，
   -webkit-line-clamp 直接把描述截掉 —— 对手打出的牌只能看到半句
   （用户报的：「二连踢」只剩「连续 2 次造成 7 点伤」，最后一行被切）。
   等比缩放之后，小卡面就是标准卡面的缩小版，排版比例一致，文案一定放得下。
   兜底值 1：JS 还没跑（或 --u 没设）时按标准尺寸排版。 */
.played-card .card {
  border-radius: calc(14px * var(--u, 1));
  padding: calc(8px * var(--u, 1)) calc(9px * var(--u, 1)) calc(9px * var(--u, 1));
  --card-name-fs: calc(18px * var(--u, 1));
  --card-text-fs: calc(12.5px * var(--u, 1));
  --card-art-h: calc(46px * var(--u, 1));
  --card-ico: calc(32px * var(--u, 1));
}
.played-card .card-top { gap: calc(6px * var(--u, 1)); }
.played-card .card-ap {
  width: calc(28px * var(--u, 1));
  height: calc(28px * var(--u, 1));
  font-size: calc(15px * var(--u, 1));
}
.played-card .card-mid {
  gap: calc(5px * var(--u, 1));
  margin: calc(5px * var(--u, 1)) 0 calc(4px * var(--u, 1));
}
.played-card .card-art { border-radius: calc(9px * var(--u, 1)); }
.played-card .card-foot {
  gap: calc(6px * var(--u, 1));
  padding-top: calc(4px * var(--u, 1));
  font-size: calc(9.5px * var(--u, 1));
}
.played-card .card-acts {
  left: calc(4px * var(--u, 1));
  bottom: calc(4px * var(--u, 1));
  gap: calc(4px * var(--u, 1));
  padding: calc(2px * var(--u, 1)) calc(4px * var(--u, 1));
}
.played-card .card-act {
  width: calc(14px * var(--u, 1));
  height: calc(14px * var(--u, 1));
}
.played-card .card-exhaust::before {
  top: calc(8px * var(--u, 1));
  right: calc(34px * var(--u, 1));
  font-size: calc(9px * var(--u, 1));
  padding: calc(1px * var(--u, 1)) calc(6px * var(--u, 1));
}

/* 卡组 / 收藏网格：列宽跟着卡面走（卡变大了，minmax 也要跟着长，否则一列塞不下会挤成一团） */.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  justify-items: center;
}
/* 「按特殊效果排序」时插的分组标题：占满一整行 */
.grid-group {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 -2px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--accent-2);
  opacity: .95;
}
.grid-group::after {
  content: ""; flex: 1 1 auto; height: 1px;
  background: linear-gradient(90deg, currentColor, transparent);
  opacity: .35;
}
.deck-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.deck-count { font-weight: 700; }
.deck-count.ok { color: var(--good); }
.deck-count.bad { color: var(--bad); }

/* ============================================================
   事件 / 商店 / 宝箱 / 营地
   ============================================================ */
.scene-screen { padding: 18px; align-items: center; justify-content: center; }
.scene-bg-desert { background: linear-gradient(180deg, #241810, #6b4a2a 60%, #a06a34); }
.scene-bg-canyon { background: linear-gradient(180deg, #1d1420, #5a2a28 60%, #a04a30); }
.scene-bg-forest { background: linear-gradient(180deg, #0c1a10, #1f4028 60%, #3f7a40); }
.scene-bg-tide   { background: linear-gradient(180deg, #0a1830, #1d4a68 60%, #4f9ec0); }
.scene-bg-cliff  { background: linear-gradient(180deg, #14141e, #3c3a4e 60%, #7e7ea0); }
.scene-bg-night  { background: linear-gradient(180deg, #0d1030, #241a4a 60%, #4a3a7a); }
/* 替补场景（随机替换中间 4 章）：配色跟着 content/biomes.json 的 sky/ground 走 */
.scene-bg-ruins   { background: linear-gradient(180deg, #15120d, #3a3128 60%, #8a7a52); }
.scene-bg-fungal  { background: linear-gradient(180deg, #10160c, #2e3a1e 60%, #6a7a42); }
.scene-bg-storm   { background: linear-gradient(180deg, #080c18, #232a52 60%, #5a6fc0); }
.scene-bg-crystal { background: linear-gradient(180deg, #080e18, #243a5e 60%, #62b8cc); }

.scene-panel {
  width: min(760px, 94vw);
  max-height: 92%;
  overflow-y: auto;
  animation: slideInUp .32s ease both;
}
.scene-illo {
  display: flex; justify-content: center; margin-bottom: 6px;
}
.scene-illo canvas { image-rendering: pixelated; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }

/* ============================================================
   战斗里的两个手感动画
   ============================================================ */

/* 抽牌：从屏幕下方滑上来。
   用 cubic-bezier(.16, 1, .3, 1)（先快后极慢）——匀速滑上来会显得很「机械」。 */
@keyframes cardDrawIn {
  0%   { transform: translateY(118%) scale(.9) rotate(-5deg); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
.hand .card.card-draw-in { animation: cardDrawIn .54s cubic-bezier(.16, 1, .3, 1) both; }

/* 销毁：卡牌碎成碎片，向两侧飞散 + 旋转 + 淡出（碎片里是那张卡自己的画面） */
.shatter-host { pointer-events: none; }
.card-shard {
  position: absolute;
  overflow: hidden;
  animation: shardFly .58s cubic-bezier(.2, .75, .25, 1) both;
}
@keyframes shardFly {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  18%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
/* 降低动效偏好（系统设置或截图用）时不要动画 */
@media (prefers-reduced-motion: reduce) {
  .hand .card.card-draw-in,
  .card-shard { animation: none !important; }
}
/* 商人的脸：面板顶部一张带框的头像（只在商店界面用） */
.merchant-illo { margin-bottom: 8px; }
.merchant-illo img.portrait {
  width: 104px; height: 104px;
  padding: 4px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(0, 0, 0, .22));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22), 0 8px 16px rgba(0, 0, 0, .35);
}
.scene-text {
  /* 事件旁白 / 商人的招呼语这一段是「讲故事」的地方，用手写体，
     和旁边规规矩矩的数值区拉开（用户点名：手写体给轻松搞笑的地方用）。
     字号比正文大一档：手写体的字面比正文那套小一圈，同字号会显得偏小。 */
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.95;
  white-space: pre-wrap;
  margin: 10px 0 16px;
  color: var(--ink);
}
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left;
  padding: 12px 16px;
  min-height: 52px;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(214, 186, 140, .5));
  box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .28), 0 2px 0 rgba(90, 60, 30, .25);
  color: #33210f;
  font-size: 14.5px;
  font-weight: 700;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.option:hover { transform: translateX(3px); box-shadow: inset 0 0 0 2px var(--accent-deep), 0 2px 0 rgba(90, 60, 30, .3); }
/* 选项标题行（图标 + 文字）：.option 本身是竖向 flex，图标要和文字排成一行 */
.option-label { display: inline-flex; align-items: center; gap: 8px; }
.option-label [class^="ico-"] { width: 17px; height: 17px; opacity: .85; }
.option:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.option small { font-size: 12px; font-weight: 400; opacity: .72; }
.option[disabled] { opacity: .5; cursor: not-allowed; }
.option-danger { background: linear-gradient(180deg, rgba(255, 200, 190, .6), rgba(220, 150, 140, .55)); }
.option-good { background: linear-gradient(180deg, rgba(200, 255, 215, .6), rgba(150, 220, 175, .55)); }

.result-box {
  /* 事件的结算文案（「你把果子让给了它……」「宝箱是活的！」）—— 同样是讲故事的地方 */
  font-family: var(--font-hand);
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 17px;
  line-height: 1.95;
  white-space: pre-wrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(226, 199, 149, .5));
  box-shadow: inset 0 0 0 2px rgba(90, 60, 30, .3);
  animation: popIn .3s ease;
}
.result-box.good { box-shadow: inset 0 0 0 2px var(--good-deep), 0 0 18px rgba(111, 208, 140, .3); }
.result-box.bad { box-shadow: inset 0 0 0 2px var(--bad-deep), 0 0 18px rgba(232, 96, 76, .3); }

/* 商店 */
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
/* 商店顶部的「卡组 N 张 / 金币 M」：删卡之后要能当场看见卡组变短 */
.shop-ledger { display: flex; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
/**
 * 货架行 —— **和卡面同一套底色**（纸色 + 描边 + 正文色都由稀有度变量给，
 * 变量定义见上面 `.card-common, .shop-item.rarity-common` 那一组）。
 *
 * 以前这里是一层半透明的「白 → 褐」渐变，压在米黄面板上等于没上色：
 * 玩家看到的是一排和面板同色的方框（用户的原话：「商店里的卡牌没有底色」）。
 * 这和当初卡面「只有顶上一点点染色」是同一个毛病 —— 半透明叠加在有底色的面板上不会变成底色。
 * 道具 / 服务没有稀有度，按普通档上纸色（选择器由 screens.js 统一给 rarity-* 类）。
 */
.shop-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 30%),
    linear-gradient(168deg, var(--card-paper-1) 0%, var(--card-paper-2) 62%, var(--card-paper-3) 100%);
  box-shadow:
    inset 0 0 0 2px var(--rarity-frame),
    inset 0 0 0 4px rgba(255, 240, 210, .35);
  color: var(--card-body-ink);
}
/* 卡名跟着稀有度上色（和卡面上「卡名 = --rarity-ink」一致） */
.shop-item h4 { margin: 0; font-size: 15px; font-family: var(--font-title); display: flex; align-items: center; gap: 7px; color: var(--rarity-ink); }
.shop-item h4 .shop-ico { width: 16px; height: 16px; opacity: .85; }
.shop-item p { margin: 0; font-size: 12px; opacity: .8; min-height: 32px; }
.shop-item .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #7a4d10; }
.shop-item.sold { filter: grayscale(.8); opacity: .55; }

/* 奖励 */
.reward-screen { align-items: center; justify-content: center; padding: 18px; }
.reward-cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.reward-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.reward-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .25);
  font-weight: 700;
}

/* ============================================================
   弹窗
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 5, 3, .72);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  width: min(880px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popIn .24s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--sand-4), var(--sand-3));
  box-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}
.modal-head h3 { margin: 0; font-family: var(--font-title); font-size: 19px; letter-spacing: .06em; }
.modal-body { padding: 16px 18px; overflow-y: auto; background: linear-gradient(180deg, var(--sand-2), var(--sand-1)); }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--sand-3), var(--sand-2));
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .35);
}

/* 数值条（设置里的音量） */
input[type="range"] { width: 160px; accent-color: var(--accent); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed rgba(232, 207, 162, .18); }
.setting-row:last-child { border-bottom: 0; }
.setting-row label { font-weight: 600; }
/* 右侧的说明文字（当前曲目、素材出处）：窄屏折行，别把设置页撑破 */
.setting-value { font-size: 12px; opacity: .75; text-align: right; max-width: 62%; line-height: 1.6; }
.setting-hint { font-size: 11.5px; opacity: .62; font-weight: 400; }

/* ============================================================
   飘字层
   ============================================================ */
.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.float-text {
  position: absolute;
  transform: translate(-50%, 0);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 30px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 18px rgba(0, 0, 0, .4);
  animation: floatUp 1.05s cubic-bezier(.2, .8, .3, 1) forwards;
  white-space: nowrap;
}
.float-dmg { color: #ffe08a; }
.float-crit { color: #ff8a6b; font-size: 40px; }
.float-heal { color: #8ff0a8; }
.float-shield { color: #a8d8ff; }
.float-block { color: #d8d8d8; font-size: 22px; }
.float-miss { color: #cfc3ab; font-size: 22px; }
/* 花掉 AP 时从 AP 栏飘出来的「-N」 */
.float-ap { color: #b8ecff; font-size: 20px; text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 10px rgba(120, 210, 255, .7); }

/* 战斗界面的悬停说明浮层（替代原生 title：即时、可读、样式统一） */
.tip-layer {
  position: fixed;
  left: 0; top: 0;
  z-index: 300;
  max-width: 340px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(22, 15, 10, .96);
  color: #f4e9d8;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-line;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .13);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.tip-layer.show { opacity: 1; transform: translateY(0); }
.tip-layer b { color: #ffdf9e; font-weight: 700; }

/* ============================================================
   卡面文案的高亮（见 src/ui/cardtext.js）
   数字 / 状态 / 关键词分色，扫一眼就能抓到重点。
   同一套语义有两套配色：
     · 默认（亮色）—— 用在深色界面上（卡牌详情页的说明文字）；
     · .card-text / .shop-item 里（深色墨）—— 用在米黄羊皮纸卡面上，
       亮色在纸底上会糊成一片，必须压暗。
   ============================================================ */
.kw { font-weight: 700; }
.card-num { color: #ffd07a; font-weight: 800; }
.kw-poison { color: #c79cf5; }
.kw-burn { color: #ffab6b; }
.kw-weak { color: #c8c8d4; }
.kw-bleed { color: #ff8f9c; }
.kw-shield { color: #8fc9ff; }
.kw-pierce { color: #8fc9ff; }
.kw-draw { color: #7fe0d8; }
.kw-ap { color: #7fe0d8; }
.kw-heal { color: #8ff0a8; }
.kw-cleanse { color: #8ff0a8; }
.kw-exhaust { color: #ff9d8a; }
.kw-recoil { color: #ff9d8a; }
.kw-stat { color: #ffd08a; }
.kw-luck { color: #ffd08a; }

/* 羊皮纸卡面（以及商店行）上的深墨版本 */
.card-text .card-num, .shop-item .card-num { color: #a8360f; }
.card-text .kw-poison, .shop-item .kw-poison { color: #7b2fb5; }
.card-text .kw-burn, .shop-item .kw-burn { color: #b8451a; }
.card-text .kw-weak, .shop-item .kw-weak { color: #4f4f5c; }
.card-text .kw-bleed, .shop-item .kw-bleed { color: #a8183c; }
.card-text .kw-shield, .shop-item .kw-shield { color: #1f5c8f; }
.card-text .kw-pierce, .shop-item .kw-pierce { color: #1f5c8f; }
.card-text .kw-draw, .shop-item .kw-draw { color: #0f6b6b; }
.card-text .kw-ap, .shop-item .kw-ap { color: #0f6b6b; }
.card-text .kw-heal, .shop-item .kw-heal { color: #1f6b3a; }
.card-text .kw-cleanse, .shop-item .kw-cleanse { color: #1f6b3a; }
.card-text .kw-exhaust, .shop-item .kw-exhaust { color: #8f2c22; }
.card-text .kw-recoil, .shop-item .kw-recoil { color: #a3401f; }
.card-text .kw-stat, .shop-item .kw-stat { color: #7a4a12; }
.card-text .kw-luck, .shop-item .kw-luck { color: #7a4a12; }

/* ============================================================
   卡组页：排序条 + 卡牌详情
   ============================================================ */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(232, 207, 162, .18);
}
.sort-bar .sort-label { font-size: 12.5px; opacity: .8; }
.sort-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(232, 207, 162, .28);
  background: rgba(0, 0, 0, .28);
  color: var(--sand-7);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.sort-tab:hover { background: rgba(255, 255, 255, .1); }
.sort-tab.active {
  color: #2a1c12;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: var(--accent-deep);
}
.sort-hint { font-size: 12px; opacity: .7; margin-left: auto; }

.card-detail { display: flex; gap: 20px; align-items: flex-start; }
.card-detail-main { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.card-detail-main .detail-deckstate { font-size: 12.5px; font-weight: 700; opacity: .85; }
.card-detail-info { flex: 1 1 auto; min-width: 0; }
.detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-head h2 { margin: 0; font-family: var(--font-title); font-size: 24px; letter-spacing: .05em; }
.detail-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .28);
}
.detail-chip.rarity-common { color: var(--rarity-common); }
.detail-chip.rarity-uncommon { color: var(--rarity-uncommon); }
.detail-chip.rarity-rare { color: var(--rarity-rare); }
.detail-chip.rarity-epic { color: var(--rarity-epic); }
.detail-desc {
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 15.5px;
  line-height: 2;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .18);
}
.detail-sec { margin-top: 16px; }
.detail-sec h4 {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: 13.5px;
  letter-spacing: .08em;
  color: var(--accent-2);
}
.detail-rows { display: grid; gap: 6px; }
.detail-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .14);
}
.detail-row .dr-ico { width: 16px; height: 16px; flex: 0 0 auto; background-color: var(--sand-7); }
.detail-row .dr-label { font-size: 13.5px; font-weight: 700; min-width: 92px; }
.detail-row .dr-value { font-size: 14px; font-weight: 800; color: var(--accent-2); }
.detail-row .dr-note { margin-left: auto; font-size: 12px; opacity: .75; text-align: right; max-width: 46%; }
.detail-kw { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-kw span {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .2);
}
.detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
/* 包住按钮的壳：说明挂在它身上（禁用的按钮收不到鼠标事件，挂按钮上等于没有说明） */
.btn-wrap { display: inline-flex; }
.detail-tip { font-size: 12px; opacity: .7; }
@media (max-width: 720px) {
  .card-detail { flex-direction: column; align-items: center; }
  .detail-row .dr-note { margin-left: 0; max-width: none; }
}

/* 商店行里的行动点费用小标 */
.shop-ap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #6b4a2a;
  background: rgba(255, 255, 255, .5);
  box-shadow: inset 0 0 0 1px rgba(120, 80, 40, .25);
}
.shop-ap .ico-action_points { background-color: #6b4a2a; }

/* 语言切换（标题页与设置里各一份，样式共用） */
.lang-switch { display: flex; gap: 6px; justify-content: center; margin: 10px 0 4px; }
.lang-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 207, 162, .3);
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.lang-btn:hover { background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.lang-btn.on {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #2a1a08;
}

/* ============================================================
   按地图换 UI 主题色
   切屏时 ui.js 在 <body> 上打 data-biome，这三个 accent 变量整体跟着换 ——
   按钮 / 面板标题 / 血条 / 地图节点 / 焦点描边都走它们，所以一处改就全页统一。
   （以前主题色永远停在金色，盐海那种蓝色地图上就会出现「金色按钮压在蓝背景上」的违和感。）
   每组都是同一色相的「亮 / 中 / 暗」三步，和原来的金色关系一致。
   ============================================================ */
body[data-biome="desert"] { --accent-2: #ffd98a; --accent: #e0a13c; --accent-deep: #8f5c12; }
body[data-biome="canyon"] { --accent-2: #ffb08a; --accent: #e8632c; --accent-deep: #8f3410; }
body[data-biome="forest"] { --accent-2: #b6f095; --accent: #6cbb45; --accent-deep: #356b1c; }
body[data-biome="tide"]   { --accent-2: #a8f0ff; --accent: #3fb8e0; --accent-deep: #14607f; }
body[data-biome="cliff"]  { --accent-2: #e4e9ff; --accent: #8f9fe0; --accent-deep: #3f4b8f; }
body[data-biome="night"]  { --accent-2: #c9b6ff; --accent: #7f5ce0; --accent-deep: #3f2a8f; }
body[data-biome="ruins"]   { --accent-2: #f0e4b8; --accent: #c0a45c; --accent-deep: #6f5a24; }
body[data-biome="fungal"]  { --accent-2: #d8ff9a; --accent: #7fae43; --accent-deep: #3f5c1c; }
body[data-biome="storm"]   { --accent-2: #ffe98a; --accent: #6f86e0; --accent-deep: #33409f; }
body[data-biome="crystal"] { --accent-2: #b8f4ff; --accent: #4fb8d8; --accent-deep: #1a5e7a; }
/* 卡牌上的特殊动作角标：抽牌 / 销毁 / 弃牌（以前只写在描述里，扫一眼看不出来）。
   贴在美术横幅左下角，不再单独占一行 —— 卡面每一点高度都要留给文字。 */
.card-acts {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(46, 26, 12, .55);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 210, .22);
}
.card-act {
  width: 14px;
  height: 14px;
  background-color: #f7e6c4;
  opacity: .95;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35));
}
.card-act.ico-trash { background-color: #ff9d8a; }   /* 销毁用红一点，一眼区分 */
/* 削弱 / 增益：**紫下箭头 / 红上箭头**（用户要求，取代温度计）。
   颜色定在角标上，所以别在这里被 .card-act 的米黄底色盖回去 —— 靠 `.card-act.xxx` 的双类选择器赢。 */
.card-act.ico-arrow_down_blue { background-color: #b98cff; }   /* 削弱对手：紫，和「抽牌 / 销毁」拉开 */
.card-act.ico-arrow_up_red { background-color: #ff8f7a; }      /* 强化自己：红 */
[data-tip] { cursor: help; }

/* ============================================================
   鼠标指针：Kenney 光标素材包（32×32，正好是 CSS 光标的安全尺寸）
   ============================================================ */
html, body {
  cursor: url(../../assets/img/cursors/hand_open.png) 12 4, auto !important;
}
a, button, select, summary, [role="button"], .btn, .card, .map-node, .legend-item, .option, .shop-item button {
  cursor: url(../../assets/img/cursors/hand_point.png) 12 4, pointer !important;
}
a:active, button:active, .btn:active, .card:active, .map-node:active {
  cursor: url(../../assets/img/cursors/hand_closed.png) 12 4, pointer !important;
}
/* 带悬停说明的元素用「问号手」——和刚加的 tooltip 正好配套 */
[data-tip] {
  cursor: url(../../assets/img/cursors/cursor_help.png) 8 4, help !important;
}
/* 但卡面里的关键词 / 角标例外：那张卡整体是「可点的」，
   指针在这里变成问号手会让人以为点不动。让它们继承卡牌的指针。 */
.card-text [data-tip],
.card-act[data-tip] {
  cursor: inherit !important;
}
.card-check[data-tip] {
  cursor: url(../../assets/img/cursors/hand_point.png) 12 4, pointer !important;
}
/* 禁用按钮（比如「只能拥有 X 张」）必须看着点不动：
   .btn[disabled] 里写了 not-allowed，但没有 !important，会被上面的指针规则盖掉 */
button[disabled], .btn[disabled], .btn.disabled {
  cursor: not-allowed !important;
}
/* 输入框保持文本光标，不然没法选字 */
input, textarea { cursor: text !important; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(180deg, rgba(20, 12, 7, .96), rgba(20, 12, 7, .86));
  box-shadow: inset 0 0 0 2px rgba(232, 207, 162, .3), 0 8px 24px rgba(0, 0, 0, .5);
  animation: slideInUp .22s ease;
  max-width: 90vw;
  text-align: center;
}
.toast.good { color: #9be8b4; }
.toast.bad { color: #ffa894; }

/* ============================================================
   结算界面
   ============================================================ */
.gameover-screen {
  align-items: center; justify-content: center;
  background: radial-gradient(80% 60% at 50% 40%, #3a1414, #120a08 75%);
  text-align: center;
}
.gameover-screen h1 {
  font-family: var(--font-title);
  font-size: clamp(32px, 6vw, 54px);
  margin: 0 0 6px;
  color: #ffb3a0;
  text-shadow: 0 4px 0 #6b1c14, 0 10px 30px rgba(0, 0, 0, .7);
  letter-spacing: .1em;
}
.victory-screen {
  align-items: center; justify-content: center;
  background: radial-gradient(80% 60% at 50% 40%, #2a3a5a, #0e1220 75%);
  text-align: center;
}
.victory-screen h1 {
  font-family: var(--font-title);
  font-size: clamp(32px, 6vw, 54px);
  margin: 0 0 6px;
  color: #ffe9a8;
  text-shadow: 0 4px 0 #8a5a12, 0 10px 30px rgba(0, 0, 0, .7);
  letter-spacing: .1em;
}
/**
 * 通关页比标题页**内容多得多**：结局正文（5~8 行）+ 收尾台词 + 两条解锁横幅 +
 * 10 个数据格 + 3 个按钮。3.0 加上「新主角解锁」那条之后，900px 高的窗口里
 * 右边的按钮会被挤到屏幕外（截图里能看到「再来一次」只剩一半）。
 * 所以这一屏单独压一档纵向间距和主视觉尺寸 —— 只有这一屏，标题页不动。
 */
.victory-screen .title-inner {
  gap: clamp(10px, 2vw, 34px);
  padding-top: clamp(6px, 1.2vh, 16px);
  padding-bottom: clamp(6px, 1.2vh, 16px);
}
.victory-screen .title-hero canvas { max-height: 15vh; }
.victory-screen h1 { font-size: clamp(26px, 4.4vw, 46px); margin-bottom: 2px; }
.victory-screen .title-quote { margin: 4px auto; line-height: 1.62; }
.victory-screen .unlock-banner { margin-top: 6px; padding: 6px 12px; font-size: 12.5px; }
.victory-screen .run-stats {
  /* 数据格那一排按**这一栏的宽度**排（不是写死的 620px）：写死的话右栏只有 ~480px，
     第 4 格会被切掉一半（截图里右边那条窄缝就是它）。列宽放到 104px，一栏排得下 4 格。 */
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  margin: 8px 0;
  gap: 8px;
}
.victory-screen .run-stat { padding: 7px; }
.run-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0;
  width: min(620px, 90vw);
}
.run-stat {
  padding: 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .2);
}
.run-stat b { display: block; font-size: 22px; color: var(--accent-2); font-family: var(--font-title); }
.run-stat span { font-size: 11px; opacity: .75; }

/* ============================================================
   帮助 / 说明
   ============================================================ */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.help-card { padding: 12px 14px; border-radius: var(--r-md); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .18); }
.help-card h4 { margin: 0 0 6px; font-family: var(--font-title); color: var(--accent-2); letter-spacing: .05em; }
.help-card ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
/* 「状态效果」那几条前面挂状态图标（和战斗里状态胶囊上的同一套） */
.help-ico { width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; opacity: .9; }
.help-card code {
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
  background: rgba(0, 0, 0, .35); color: var(--accent-2);
}

/* ============================================================
   遭遇演出：地图 → 战斗之间的过场
   几何（谁的宽、谁在哪）全部由 src/ui/encounter.js 每帧写死，
   这里只管长相与层级；所以别在这里写死 width/height/top（错开站位那两行除外）。
   ============================================================ */
.encounter {
  position: fixed;
  inset: 0;
  /* 盖住 HUD(30) / 浮字(60) / 弹窗(100) / 卡面(200)，但低于最高层(300) */
  z-index: 250;
  overflow: hidden;
  /* 演出期间把点击吃掉：不然玩家手快点到地图上的下一个节点，会连着触发第二场战斗 */
  pointer-events: auto;
  /* 主题色不写在这里 —— body[data-biome] 已经把 --accent / --accent-2 换成当前地图的了 */
}

/* 黑幕：**整屏、一上来就不透明** —— 用户要求「黑幕能遮挡住整个屏幕」，
   所以它不是被横线慢慢张开的，而是开演第一帧就把地图全盖住。
   退场时整块往右滑走（横线是它的子节点，跟着一起走）。 */
.enc-curtain {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 46%, rgba(255, 255, 255, .07), transparent 62%),
    linear-gradient(180deg, #100b14 0%, #05040a 52%, #100b14 100%);
  will-change: transform;
}
/* 那组「黑色 + 主题色」的横线：宽度与纵向位置由 JS 按敌人立绘现算
   （整组右端 = 立绘中线，整组以立绘中腰为基准上下铺开），看起来就是跟着正面图铺过来的。
   外层 .enc-lines 只是个「零点」：高度 0，所有线按 --o 相对它上下偏移。 */
.enc-lines {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  will-change: width, top;
}
.enc-line {
  position: absolute;
  left: 0;
  display: block;
  /* --o 是这条线的中线相对零点的偏移，--t 是粗细 */
  top: calc(var(--o, 0px) - var(--t, 2px) / 2);
  width: calc(100% * var(--w, 1));
  height: var(--t, 2px);
  opacity: var(--a, 1);
  /* 左端淡出、右端最亮：视觉上就是「从左往右铺过来」的那一下 */
  background: linear-gradient(90deg,
    transparent,
    color-mix(in srgb, var(--accent, #f0a93c) 55%, transparent) 22%,
    var(--accent-2, #ffc96b));
  box-shadow: 0 0 16px 1px color-mix(in srgb, var(--accent, #f0a93c) 60%, transparent);
}
/* 主线：最粗最亮的一条，右端再补一道亮边（就是「铺到哪儿」的那条前沿） */
.enc-line-main {
  border-right: 3px solid var(--accent-2, #ffc96b);
  box-shadow:
    0 0 22px 3px color-mix(in srgb, var(--accent, #f0a93c) 75%, transparent),
    0 0 60px 8px color-mix(in srgb, var(--accent, #f0a93c) 35%, transparent);
}

/* 两只立绘。站位**错开**：敌人正面图在右上、我方背影在左下（和战斗场地的对角站位一致），
   所以它们不在同一条水平线上，横线只跟着上边那只走。 */
.enc-fighter {
  position: absolute;
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 38px);
  transform: translateY(-50%);
  will-change: transform;
}
.enc-player { left: 4%; top: 72%; z-index: 3; }   /* 背影离镜头更近，从正面图上压过去 */
.enc-enemy { right: 4%; top: 32%; z-index: 2; }
.enc-body { position: relative; }
/* 立绘是 Generation 9 的正面/背面图（回合数旁边那种），已经按可见内容裁过，
   所以图框就是怪兽本人 —— 不需要再做任何裁切或留白补偿。 */
.enc-art {
  display: block;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 16px 12px rgba(0, 0, 0, .55));
}

/* 名牌：霓虹灯在下、名字压在它正中，整块挂在屏幕右下。
   它是 .encounter 的**直接子节点**，z-index 比两只立绘都高 ——
   用户要求「霓虹灯叠在所有元素（除了背景）之上」，塞在立绘那一组里是做不到的。
   霓虹灯和名字用 grid 放在**同一格**里：格子大小由霓虹灯撑出来，
   名字 align/justify 居中 → 正好压在霓虹灯正中（用户：「霓虹灯叠在名字之下，名字放中间」）。 */
.enc-plate {
  position: absolute;
  right: 4%;
  bottom: 8%;
  z-index: 4;                 /* 黑幕 1 · 敌人立绘 2 · 我方立绘 3 · 名牌 4 */
  display: grid;
  grid-template-columns: auto;
  text-align: center;
  pointer-events: none;
  /* 进场 / 退场都由 encounter.js 每帧写 transform：
       进场 —— 整块从屏幕右边外面划进来（距离按它自己的宽度现算）；
       退场 —— 跟黑幕同一个位移，被幕布一起带走。
     所以这里**不能**再放 transition：JS 每帧写一个新的 transform，
     有 transition 的话名牌会一直追不上、看起来像被拖在后面。 */
  will-change: transform;
}
.enc-name {
  /* 粗体字体：卡名 / 商店名 / 这里的怪名都属于「要一眼认出来」的字 */
  font-family: var(--font-bold);
  font-size: clamp(44px, 10.4vw, 158px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: .02em;
  color: #fff;
  /* 压在霓虹灯上面，所以除了描边还要一层暗色底影，免得被灯管的花纹吃掉 */
  text-shadow:
    0 4px 0 rgba(0, 0, 0, .55),
    0 0 4px rgba(0, 0, 0, .9),
    0 0 10px rgba(0, 0, 0, .8),
    0 0 44px var(--accent, #f0a93c);
}
/* 名字 + 称号：**两条各自占 1/1 格**（和霓虹灯叠在同一格），都靠右对齐。
   关键是不能把两条包进一层 wrapper —— 那样网格项就变成 wrapper，
   名字不再与霓虹灯同格（实测名牌整体上移、名字压不住霓虹灯了）。
   纵向落差由 encounter.js 现量着补（translateY），落在名字正下方。 */
.enc-name { grid-area: 1 / 1; align-self: center; justify-self: end; z-index: 1; }
/* 首领称号：名字底下那一行小字。
   宽度由 encounter.js 现量着撑到与名字相等（拆成单字 + space-between），
   所以这里只要排得开、跟着名字的位移走就行。 */
.enc-boss-title-row {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: end;
  z-index: 1;
  /* 位移由 JS 每帧写（横向跟名字的滞后、纵向落在名字下面），所以不能有 transition */
  will-change: transform;
}
.enc-boss-title {
  display: flex;
  justify-content: space-between;
  /* 撑不开（称号比名字长）时加 .centered：退回自然宽度、居中 */
  /* 字体与名字**同一套**（用户要求）：粗体那套，只是字号小一号 */
  font-family: var(--font-bold);
  font-weight: 700;
  font-size: clamp(16px, 1.9vw, 30px);
  line-height: 1.25;
  letter-spacing: .02em;
  white-space: nowrap;
  color: #fff6e4;
  opacity: .96;
  /**
   * 不给底带（用户要求：「没有这个雷霆大横条作底，可以单独给字加阴影之类的」）。
   *
   * 它压在霓虹灯的灯管上，所以字自己的阴影要够厚：八个方向各一圈暗描边（做轮廓），
   * 再加两层柔和的暗影把底下的灯管压下去，最后一层主题色微光把字托起来。
   * 这类「描边」用 text-shadow 叠出来而不是 -webkit-text-stroke：
   * 后者会把描边画在字身**上面**（HTML 文字没有 paint-order），字会变细变脏。
   */
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    1.5px 0 0 rgba(0, 0, 0, .98), -1.5px 0 0 rgba(0, 0, 0, .98),
    0 1.5px 0 rgba(0, 0, 0, .98), 0 -1.5px 0 rgba(0, 0, 0, .98),
    1.5px 1.5px 0 rgba(0, 0, 0, .95), -1.5px 1.5px 0 rgba(0, 0, 0, .95),
    1.5px -1.5px 0 rgba(0, 0, 0, .95), -1.5px -1.5px 0 rgba(0, 0, 0, .95),
    0 3px 8px rgba(0, 0, 0, 1),
    0 0 18px rgba(0, 0, 0, .85),
    0 0 28px var(--accent, #f0a93c);
}
.enc-boss-title.centered { justify-content: center; }
.enc-boss-title.centered span { margin: 0 .06em; }
/* 上面那行字压在霓虹灯上，灯管的描边会透出来 —— 给称号垫一层暗底 */
.enc-boss-title span {
  display: inline-block;
  /* 每一份自己扛一点暗影，拆字之后看不出接缝 */
  background: none;
}
/* 名字压在霓虹灯**之上**：同一个格子，z-index 高的那个在上面。
   两者都**居右**（用户要求）—— 共享同一条右边缘，所以名字右对齐、霓虹灯基准那份也右对齐。 */
.enc-neon { z-index: 0; }
.enc-name { grid-area: 1 / 1; align-self: center; justify-self: end; z-index: 1; }

/**
 * 档位标注做成**霓虹灯**：同一个词（野生 / 较强 / 精英 / 首领）用超大**空心**字
 * 横向错开叠 4 份、半透明 —— 整组叠在所有元素之上（背景那块黑幕除外）、名字之下。
 *   · 空心 = 字身透明 + -webkit-text-stroke 画描边（落不到 text-stroke 的浏览器上
 *     它就整个不显示 —— 这里是纯装饰，宁可不显示也不要出实心方块）；
 *   · 四份用 grid 放进**同一格**、都**靠右对齐**，再各自往左错开 ——
 *     于是基准那一份的右边缘就是整块的右边缘，和名字共用同一条对齐线；
 *   · 错开量与描边粗细都写成 em（跟着字号走），放大之后比例不会走样；
 *   · 错开量由每一份自己的 --i 决定，所以「四份」在 DOM 上数得出来（诊断会数）。
 */
.enc-neon {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: auto;
  font-size: clamp(100px, 21vw, 300px);
  line-height: 1;
  letter-spacing: .02em;
  /* 只留左边：错开是往左走的，右侧不留会白白把右对齐线推离屏幕边 */
  padding: 0 0 0 .21em;
}
.enc-neon-i {
  grid-area: 1 / 1;
  justify-self: end;
  font-family: var(--font-bold);
  font-weight: 700;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: max(2px, .022em) var(--neon, var(--accent-2, #ffc96b));
  opacity: .42;
  /* 基准那份（--i: 0）贴住右边缘，其余几份依次往左错开。
     错开量写小一点是有意的：字号到 300px 之后，0.12em 的错开会把两个字糊成一片网，
     读不出是哪个词；.07em 既看得出「叠了四份」，笔画又还是分开的。
     --dx 是**进场时**额外多留的一段距离（encounter.js 每帧写）：越靠左的几份留得越多、
     落定得越晚，整组字就是「从右往左一份份拉开」的。落定后 --dx 归 0，只剩下面这个错开量。 */
  transform: translateX(calc(var(--i, 0) * -.07em + var(--dx, 0px)));
  /* 描边外面再糊一层同色光晕，才有灯管的感觉 */
  filter: drop-shadow(0 0 .08em var(--neon, var(--accent-2, #ffc96b)));
}
/* 四份的浓淡错开一点，像灯管接缝处的重叠 */
.enc-neon-i:nth-child(2) { opacity: .3; }
.enc-neon-i:nth-child(3) { opacity: .34; }
.enc-neon-i:nth-child(4) { opacity: .22; }
/* 档位各有自己的灯色：野生/较强跟地图主题走，精英红、首领品红（和档位胶囊时代的配色一致） */
.encounter[data-tier="elite"] .enc-neon { --neon: #ff8080; }
.encounter[data-tier="boss"]  .enc-neon { --neon: #ff6cb6; }

@media (max-width: 900px) {
  .enc-fighter { gap: 8px; }
  .enc-player { left: 2%; }
  .enc-enemy { right: 2%; }
  .enc-plate { right: 2%; bottom: 9%; }
  .enc-name { font-size: clamp(30px, 8.8vw, 76px); }
  .enc-neon { font-size: clamp(72px, 19vw, 140px); }
}

/* ============================================================
   通关记录 / 图鉴（标题页入口 + 游戏内入口）
   ============================================================ */

/* ---- 标题页那一排入口 ---- */
.title-codex {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  width: 100%;
}
/* 5 个入口排成一行：min-width 压在 84px，右栏（≈470px）刚好放得下 5 × 84 + 4 × 6 的间隙 */
.title-codex-btn {
  flex: 1 1 calc(20% - 6px); min-width: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; line-height: 1.2;
}
.title-codex-label { font-size: 12.5px; }
.title-codex-ico { width: 20px; height: 20px; opacity: .95; }
.title-codex-label { font-size: 13px; font-family: var(--font-title); letter-spacing: .04em; }
.title-codex-sub { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }

/* ---- 卡牌详情里的流派标签（毒 / 出血 / 单次高伤 / 削弱 / 强化 / 蓄势）----
   以前这些标签只活在内容校验里，界面上一个字都看不到（用户要求补上）。
   颜色由 JS 写在行内变量 --tag 上，图标用 mask 吃到 currentColor。 */
.tag-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--tag, var(--accent-2)); box-shadow: inset 0 0 0 1px currentColor; }
.tag-ico { width: 12px; height: 12px; background-color: currentColor; }

/* ---- 两个图鉴顶上的进度 ---- */
.codex-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.codex-progress { display: flex; align-items: baseline; gap: 8px; }
.codex-progress b {
  font-family: var(--font-title); font-size: 22px; color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.codex-progress span { font-size: 12px; opacity: .78; }
.codex-sub { font-size: 12px; opacity: .7; }

/* ---- 敌人图鉴 ---- */
.dex-sections { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.dex-section-head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px; margin-bottom: 8px;
  box-shadow: inset 0 -1px 0 rgba(232, 207, 162, .2);
}
.dex-section-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.dex-section-name { font-family: var(--font-title); font-size: 15px; letter-spacing: .04em; }
.dex-section-count { margin-left: auto; font-size: 11.5px; opacity: .65; font-variant-numeric: tabular-nums; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 9px; }

.dex-card {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  text-align: left;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .18);
  color: var(--sand-8);
  transition: background .15s ease, transform .12s ease;
}
.dex-card:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.dex-art {
  flex: 0 0 auto; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.dex-art img { width: 40px; height: 40px; image-rendering: pixelated; }
.dex-card-body { min-width: 0; }
.dex-card-name {
  font-family: var(--font-title); font-size: 13.5px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dex-card-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dex-no { font-size: 10.5px; opacity: .55; font-variant-numeric: tabular-nums; }
.dex-tier {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: rgba(0, 0, 0, .3); color: var(--tier-ink, #c8bda6);
  box-shadow: inset 0 0 0 1px currentColor;
}
.tier-mob    { --tier-ink: #a9b7a0; }
.tier-normal { --tier-ink: #8fc4e8; }
.tier-elite  { --tier-ink: #ff9a86; }
.tier-boss   { --tier-ink: #ff8cc8; }

/* 没见过：剪影 + 压暗（只留图鉴编号，就是「这里还有一只」的意思） */
.dex-card.new { filter: grayscale(.9) brightness(.62); }
.dex-card.new:hover { filter: grayscale(.5) brightness(.8); }
.dex-unknown {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 20px; color: var(--sand-7);
  background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .25);
}
.dex-unknown.big { width: 84px; height: 84px; font-size: 46px; }
/* 打赢过：右上角一个勾（用图标而不是「✓」这个字符 ——
   日文那两套字体里没有这个字形，写字会掉到兜底字体上，和旁边的字不是一套） */
.dex-slain {
  position: absolute; top: 5px; right: 7px;
  width: 14px; height: 14px;
  color: #8ee89a;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .85));
}
.dex-empty { font-size: 13px; opacity: .75; margin: 8px 0; }

/* ---- 图鉴详情 ---- */
.dex-detail-face {
  flex: 0 0 auto; width: 128px; height: 128px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: radial-gradient(70% 70% at 50% 40%, rgba(255, 255, 255, .12), rgba(0, 0, 0, .25));
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.dex-detail-face img { width: 128px; height: 128px; image-rendering: pixelated; }
.dex-detail-info { flex: 1 1 auto; min-width: 0; }
.dex-lines { font-family: var(--font-hand); font-size: 15px; line-height: 1.85; opacity: .92; }
.dex-lines p { margin: 0 0 4px; }
.dex-locked { font-size: 13px; opacity: .8; }
.dex-record { font-size: 13px; opacity: .85; margin: 0; }
.dex-moves { display: flex; flex-wrap: wrap; gap: 6px; }
.dex-move {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px;
  background: rgba(0, 0, 0, .3);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.dex-move .ico-action_points { opacity: .7; }
/* 招牌招式：和普通招式区分开（开打时它一定在手上） */
.dex-move.sig {
  color: #ffd9a0;
  box-shadow: inset 0 0 0 1px rgba(255, 185, 92, .55);
  background: rgba(255, 185, 92, .12);
}

/* ---- 通关记录 ---- */
.rec-stats { width: 100%; margin: 0 0 14px; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.rec-row.win { background: rgba(255, 210, 120, .1); box-shadow: inset 0 0 0 1px rgba(255, 200, 110, .38); }
.rec-badge {
  flex: 0 0 auto; min-width: 52px; text-align: center;
  padding: 4px 8px; border-radius: 999px;
  font-family: var(--font-title); font-size: 12.5px;
  background: rgba(0, 0, 0, .32); color: #f0a58f;
  box-shadow: inset 0 0 0 1px currentColor;
}
.rec-row.win .rec-badge { color: #ffd27a; }
.rec-main { flex: 1 1 auto; min-width: 0; }
.rec-title { font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.rec-dot { opacity: .4; }
.rec-biomes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.rec-biome {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; opacity: .85;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .22);
}
.rec-biome-dot { width: 7px; height: 7px; border-radius: 50%; }
.rec-when { margin-top: 4px; font-size: 11px; opacity: .6; display: flex; gap: 10px; }
.rec-seed { font-variant-numeric: tabular-nums; }
.rec-empty { font-size: 13px; opacity: .78; margin: 6px 0 0; }
.rec-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.rec-note { font-size: 11.5px; opacity: .6; }
.rec-deck-title { margin: 16px 0 8px; font-family: var(--font-title); color: var(--accent-2); }
.rec-detail { display: flex; gap: 20px; align-items: flex-start; }

/* ============================================================
   曲子库（音乐室）：听过的才亮出来，没听过的显示 ？？？
   ============================================================ */
.mr { display: flex; flex-direction: column; gap: 14px; }
.mr-lead { margin: 0; font-size: 13px; opacity: .82; line-height: 1.7; }
.mr-group-title {
  margin: 0 0 7px; font-family: var(--font-title); font-size: 14px; color: var(--accent-2);
  letter-spacing: .04em; padding-bottom: 5px;
  box-shadow: inset 0 -1px 0 rgba(232, 207, 162, .2);
}
.mr-list { display: flex; flex-direction: column; gap: 6px; }

.mr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
/* 没听过的那首：压暗 + 斜体问号，一眼看出是「还锁着」而不是「加载失败」 */
.mr-row.locked {
  background: rgba(0, 0, 0, .22);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .1);
  color: rgba(247, 236, 214, .42);
}
.mr-row.playing {
  background: rgba(255, 210, 120, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 110, .45);
}
.mr-scene { flex: 0 0 auto; min-width: 190px; font-size: 13px; }
.mr-title { flex: 1 1 auto; min-width: 0; font-size: 12.5px; opacity: .78; }
.mr-row.playing .mr-scene { color: #ffd27a; font-weight: 600; }
.mr-actions { flex: 0 0 auto; }
.mr-lock { font-size: 11.5px; opacity: .55; }
.mr-credits {
  margin-top: 6px; padding: 11px 13px; border-radius: var(--r-md);
  background: rgba(0, 0, 0, .24);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .14);
  font-size: 12px; line-height: 1.75;
}
.mr-credits h4 { margin: 0 0 6px; font-family: var(--font-title); font-size: 13.5px; }
.mr-credits ul { margin: 0; padding-left: 18px; }
.mr-credits li { margin-bottom: 7px; }
.mr-license { opacity: .72; }
.mr-note { margin: 4px 0 0; font-size: 11.5px; opacity: .62; }
@media (max-width: 560px) {
  .mr-scene { min-width: 0; }
  .mr-row { flex-wrap: wrap; }
}

/* ============================================================
   更新日志（标题页入口）
   ============================================================ */
.changelog { display: flex; flex-direction: column; gap: 14px; }
.cl-entry {
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.cl-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 7px; margin-bottom: 7px;
  box-shadow: inset 0 -1px 0 rgba(232, 207, 162, .2);
}
.cl-version {
  font-family: var(--font-title); font-size: 17px; color: var(--accent-2);
  letter-spacing: .05em;
}
.cl-date { font-size: 11.5px; opacity: .6; font-variant-numeric: tabular-nums; }
.cl-items { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.85; }
.cl-items li { margin-bottom: 3px; }
.cl-items b { color: var(--accent-2); }
/* 标题页主菜单上「更新日志」右边那个版本号 */
.btn-sub { margin-left: 6px; font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }

/* ============================================================
   小图标（Essentials 的 animated Icons，来自 Generation 9 Pack）
   每张素材是「64×64 一帧、横向排开」的动图条，用 background-position + steps() 逐帧播
   （帧数与尺寸由 src/core/icons.js 现算，不写死在这里）。
   ============================================================ */
@keyframes poke-icon-play {
  from { background-position: 0 0; }
  to { background-position: calc(-1 * var(--icon-total, 0px)) 0; }
}
.poke-icon {
  display: inline-block;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-position: 0 0;
  image-rendering: pixelated;
}

/* ============================================================
   图鉴详情（用户给的排版）：
     ┌──────────────────┬───────────────────────────────┐
     │   ╔══════════╗   │ 名字 编号 称号 属性              │
     │   ║  回合立绘  ║   │ 简短介绍                        │
     │   ║  ┌──┐     ║   │ 怎么打                          │
     │   ╚══│行走图│══╝   │ 面板                            │
     │  [小图标]          │                                │
     ├──────────────────┴───────────────────────────────┤ ← 分割线（正好在图和下方文本之间）
     │ [挑战][击败][失败][胜率][招式] ── 击败奖牌进度 ── 🥇 │
     │ 它会用的卡牌            │ 它可能会这么说 / 出场台词   │
     └─────────────────────────┴────────────────────────┘
   左边是**一整块图**：立绘当主体、放大；行走图按正常尺寸压在它右下角、
   小图标压在左下角 —— 两张小图都和立绘**部分重叠**，三张图**不是一样大**。
   分割线以下横跨整个图鉴宽度，所以行走图下面不会再留一大块空白。
   ============================================================ */
.dex-detail { display: flex; flex-direction: column; gap: 16px; }
/**
 * 上半场：图 +（行首 + 三条简短介绍）。
 * `align-items: stretch` 是关键：右列会**撑到和图一样高**（.dex-intro 吃掉剩下的空间），
 * 于是三条介绍正好对齐行走图 / 立绘的高度，这一块的下边线就是那条
 * 「正好分开『图 + 简短介绍』和下方文本」的分割线 —— 左下方不会再空出一大块。
 */
.dex-detail-top {
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 30px; align-items: stretch;
  padding-bottom: 14px;
  box-shadow: inset 0 -1px 0 rgba(232, 207, 162, .28);
}

/* 三张图叠成一块：立绘是网格主体，另外两张按九宫格压在它的角上 */
.dex-art-compose {
  position: relative;
  display: grid;
  grid-template-areas: 'stack';
  align-items: end;
  min-width: 210px;
}
.dex-art-compose > * { grid-area: stack; }
.dex-turnart {
  display: flex; align-items: flex-end; justify-content: center;
  min-height: 172px;
}
.dex-turnart-img { image-rendering: pixelated; height: 172px; width: auto; }

/* 行走图：**正常尺寸**（立绘的六成高，不跟着放大），压在立绘右下角、和它重叠 */
.dex-walk {
  position: relative;
  display: flex; align-items: flex-end; justify-content: flex-end;
  transform: translate(18px, 10px);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .55));
}
.dex-walk-stage { display: flex; align-items: flex-end; justify-content: flex-end; }
.dex-walk canvas, .dex-battleart canvas, .dex-anim { image-rendering: pixelated; width: auto; height: auto; }

/* 小图标：压在立绘左下角，尺寸不放大 */
.dex-iconbox {
  display: flex; align-items: flex-end; justify-content: flex-start;
  transform: translate(-2px, 4px);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .55));
}

/* ---- 右列：三条简短介绍（用户给的排版）---- */
/**
 * `flex: 1 1 auto` + `justify-content: space-between`：这三条把右列剩下的高度**平分掉**，
 * 所以它们的下沿永远压在分割线上、和左侧那三张图对齐（用户要求）。
 * 字号也比第一版大了一档（13px → 14.5px），三条撑起来刚好和图差不多高。
 */
.dex-intro {
  display: flex; flex-direction: column; justify-content: space-between;
  flex: 1 1 auto; min-height: 0; gap: 8px; margin-top: 8px;
}
.dex-intro-row { display: flex; gap: 10px; align-items: baseline; }
.dex-intro-cap {
  flex: 0 0 auto; min-width: 62px;
  font-size: 12.5px; opacity: .66; letter-spacing: .04em;
}
.dex-intro-text { font-size: 14.5px; line-height: 1.7; }

/* ---- 分割线以下：横跨整个图鉴的一栏（用户要求「占满横栏」）---- */
.dex-detail-bottom { display: flex; flex-direction: column; gap: 14px; }
.dex-detail-cols {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 26px; align-items: start;
}
.dex-detail-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---- 计数（最右端是奖牌）---- */
/* 上面那条分割线现在是 .dex-detail-top 的下边线，这里不再画第二条 */
.dex-record-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.dex-record-row .dex-stats { flex: 0 0 auto; }
.dex-record-row .dex-medal-row { flex: 1 1 220px; min-width: 160px; }
.dex-medal-inline { position: static; width: 26px; height: 26px; flex: 0 0 auto; }

/* ---- 击败奖牌（5 铜 / 15 银 / 25 金 / 50 紫金）---- */
.dex-medal {
  position: absolute; top: 0; right: -4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .45);
}
.dex-medal::after {
  content: ''; width: 17px; height: 17px; background-color: currentColor;
  -webkit-mask-image: url(../../assets/img/icons/medal.png); mask-image: url(../../assets/img/icons/medal.png);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.medal-bronze { color: #cd8b53; }
.medal-silver { color: #d7dde5; }
.medal-gold { color: #ffcc5c; }
.medal-platinum { color: #c9a8ff; }

/* ---- 右侧：名称 / 编号 / 称号 / 属性 + 战绩 ---- */
.dex-detail-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.dex-detail-head { display: flex; flex-direction: column; gap: 9px; }
.dex-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.dex-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 62px; padding: 6px 10px; border-radius: var(--r-md);
  background: rgba(0, 0, 0, .24);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.dex-stat b { font-family: var(--font-title); font-size: 17px; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.dex-stat span { font-size: 10.5px; opacity: .7; }

/* ---- 奖牌进度条：4 段（5 / 15 / 25 / 50）---- */
.dex-medal-row { display: flex; align-items: center; gap: 9px; }
.dex-medal-cap { font-size: 11.5px; opacity: .65; flex: 0 0 auto; }
.dex-medal-bar { display: flex; gap: 5px; flex: 1 1 auto; }
.dex-medal-step {
  position: relative; flex: 1 1 0; height: 15px;
  display: flex; align-items: center; gap: 3px; padding: 0 5px;
  border-radius: 999px; overflow: hidden;
  background: rgba(0, 0, 0, .3);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.dex-medal-fill { position: absolute; left: 0; top: 0; bottom: 0; background: currentColor; opacity: .3; }
.dex-medal-step.done { box-shadow: inset 0 0 0 1px currentColor; }
.dex-medal-step.done .dex-medal-fill { opacity: .55; }
.dex-medal-ico {
  position: relative; width: 10px; height: 10px; background-color: currentColor; flex: 0 0 auto;
  -webkit-mask-image: url(../../assets/img/icons/medal.png); mask-image: url(../../assets/img/icons/medal.png);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.dex-medal-num { position: relative; margin-left: auto; font-size: 10px; opacity: .8; font-variant-numeric: tabular-nums; }

/* ---- 手持道具面板（overlays.js 的 showItems）----
   这一版把「背包」换成了「手持道具」：一排有限的格子 + 生效中的效果汇总 + 每件的使用 / 丢掉。
   道具的图是 assets/items/<id>.png（Generation 9 Pack 的 Items，48×48）。 */
.held-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.held-count { font-family: var(--font-title); font-size: 16px; color: var(--accent-2); letter-spacing: .04em; }
.held-hint { font-size: 11.5px; opacity: .62; }
.held-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.held-slot {
  width: 54px; height: 54px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .26);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.held-slot.empty { box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .1); }
.held-slot-plus { font-size: 20px; opacity: .25; }
.held-slot-art { width: 44px; height: 44px; image-rendering: pixelated; }
.held-active { display: flex; flex-wrap: wrap; gap: 6px; }
.held-chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .18);
  color: #ffe6b8;
}
.held-item h4 { display: flex; align-items: center; gap: 8px; }
.held-art { width: 34px; height: 34px; image-rendering: pixelated; flex: 0 0 auto; }
.held-kind {
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px; letter-spacing: .06em;
  box-shadow: inset 0 0 0 1px currentColor; opacity: .85;
}
.held-kind.hold { color: #9fd6ff; }
.held-kind.use { color: #ffd27a; }
.shop-item-art { width: 26px; height: 26px; image-rendering: pixelated; flex: 0 0 auto; }
/* 商店里「卖掉手上的道具」那一栏（screens.js 的 renderShop） */
.shop-sell { margin-top: 14px; padding-top: 10px; box-shadow: inset 0 1px 0 rgba(232, 207, 162, .18); }
.shop-sell h4 { margin: 0 0 8px; font-family: var(--font-title); font-size: 14px; color: var(--accent-2); letter-spacing: .06em; }
.shop-sell-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-sell-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 9px; border-radius: var(--r-md);
  background: rgba(0, 0, 0, .22);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.shop-sell-name { font-size: 13px; }
/* 手持栏满了的选择框（overlays.js 的 showHeldOverflow） */
.held-slot-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; font-size: 13px; }

/* ============================================================
   「捡到道具」单独一屏（screens.js 的 renderItemDrop）
   ------------------------------------------------------------
   用户要的：打完怪掉的那件东西以前是奖励页里的一枚小胶囊，太小看不清 ——
   现在它自己占一屏：大图 + 名字 + 类别 + 效果 + 出处 + 有没有收进手持栏。
   ============================================================ */
.drop-screen { align-items: center; justify-content: center; }
.drop-panel { max-width: 560px; text-align: center; }
.drop-art {
  display: flex; align-items: center; justify-content: center;
  margin: 6px auto 10px;
  width: 168px; height: 168px;
  border-radius: 50%;
  background: radial-gradient(60% 60% at 50% 45%, rgba(255, 226, 160, .22), rgba(255, 226, 160, 0) 70%);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .22);
}
.drop-art-img { width: 112px; height: 112px; image-rendering: pixelated; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45)); }
.drop-name-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/**
 * 名字用 --accent-deep，不是 --accent-2：这一屏是**浅色羊皮纸**面板，
 * 亮金（--accent-2，为深色背景调的）压米黄几乎读不出来 —— 第一次截图就是那样，
 * 名字「龙之牙」淡得看不清（同样的坑 .panel-title 的注释里也记着）。
 */
.drop-name { font-family: var(--font-title); font-size: 22px; letter-spacing: .06em; color: var(--accent-deep); text-shadow: 0 1px 0 rgba(255, 255, 255, .45); }
.drop-rarity {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; letter-spacing: .06em;
  color: var(--rarity-ink, #4a3524);
  box-shadow: inset 0 0 0 1px currentColor; opacity: .9;
}
.drop-eff {
  margin: 0 auto 10px; padding: 10px 12px; max-width: 460px; text-align: left;
  border-radius: var(--r-md);
  background: rgba(74, 53, 36, .10);
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .22);
}
.drop-eff-title { font-size: 12px; letter-spacing: .08em; color: #6b4a2a; margin-bottom: 6px; }
.drop-eff-line { display: flex; align-items: flex-start; gap: 7px; font-size: 14px; line-height: 1.7; color: var(--ink); }
.drop-eff-dot { margin-top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-deep); flex: 0 0 auto; }
.drop-desc { font-size: 13.5px; line-height: 1.7; margin-bottom: 8px; color: var(--ink); opacity: .82; }
.drop-source { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--ink); opacity: .78; margin-bottom: 10px; }
.drop-held { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* 商店货架 / 手持栏里那件道具「干什么」（screens.js 的 shopItemEffect、overlays.js 的 heldEffectBox） */
.shop-eff { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
/**
 * 货架是**浅色羊皮纸**：这里的墨色要按纸面来（.card-expert-chip 已经处理过，
 * 但「可用 / 持有」那两枚胶囊的配色是给深色手持栏调的亮色 —— 压在米黄上几乎看不见）。
 */
.shop-eff-line {
  font-size: 12px; padding: 1px 8px; border-radius: 999px;
  background: rgba(74, 53, 36, .10);
  color: #4a3524;
  box-shadow: inset 0 0 0 1px rgba(74, 53, 36, .22);
}
.shop-item:not(.held-item) .shop-eff .held-kind.hold { color: #1f5c8f; }
.shop-item:not(.held-item) .shop-eff .held-kind.use { color: #8a5a12; }
.held-item .shop-eff-line { background: rgba(255, 255, 255, .07); color: #ffe6b8; box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .2); }

/* ---- 道具图鉴（codex.js 的 showItemCodex / showItemDetail）----
   规则和敌人图鉴一样：没拿过 = 压暗剪影 + ？？？。道具的图是 48×48 的 png，
   剪影用 filter: brightness(0) 压成纯黑块（比画一个「?」更像「这里有一件东西」）。 */
.item-codex-art { width: 42px; height: 42px; image-rendering: pixelated; }
.item-codex-art.silhouette, .item-detail-art.silhouette { filter: brightness(0) opacity(.5); }
/**
 * 道具卡和敌人卡不一样：敌人卡是「图标 + 名字 + 编号」横着排，名字短（3 个字），
 * 而道具名可以到 4~5 个字（「哞哞鲜奶」「紧缠钩爪」），横排会被 `.dex-card-name`
 * 的 `nowrap + ellipsis` 截成「哞…」（第一版就是这样，截图里一片省略号）。
 * 所以道具卡改成**竖排**：图在上、名字居中、下面一排小胶囊，名字允许换行。
 */
.item-card { flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; text-align: center; }
.item-card .dex-card-name {
  font-size: 12.5px; line-height: 1.25;
  white-space: normal; overflow: visible; text-overflow: clip;
  word-break: break-word;
}
.item-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.item-kind, .item-type {
  font-size: 10px; padding: 1px 6px; border-radius: 999px; letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .28); opacity: .9;
}
.item-kind.hold { color: #9fd6ff; }
.item-kind.use { color: #ffd27a; }
.item-type { color: #d8c7a6; }
.item-detail-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.item-detail-art { width: 84px; height: 84px; image-rendering: pixelated; }
.item-detail-info h2 { margin: 0 0 6px; font-family: var(--font-title); font-size: 21px; }
.item-detail-info p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.7; opacity: .92; }
.item-src { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; opacity: .9; }

/* ---- 只给敌人用的卡（图鉴里的分类与标注）----
   这 40 张玩家抽不到，所以图鉴里要一眼看得出：卡面描一条红边 + 详情里一个胶囊。
   它们的解锁条件是「在战斗里看见敌方打出」（见 battle.js 的 onCardPlayed）。 */
.card-enemy-only { box-shadow: inset 0 0 0 1px rgba(255, 143, 122, .45); }
.detail-chip.enemy-only {
  color: #ffb0a0;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 122, .5);
  background: rgba(255, 143, 122, .12);
  letter-spacing: .04em;
}

/* ---- 无尽模式（用户要的另一个入口）----
   标题页多一个按钮：未解锁时点不动、直接写着解锁条件；通关一次之后亮起来，
   副标题显示「最远 第 N 章」—— 这个模式的成绩就是距离。 */
.endless-btn .ico-infinity, .unlock-banner .ico-infinity { color: #c9a8ff; }
.endless-btn.locked { opacity: .55; }
.endless-btn.locked .ico-lock { color: #d8c7a6; }
.unlock-banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  max-width: 620px; margin: 10px auto 0; padding: 8px 14px;
  border-radius: var(--r-md); font-size: 13px; line-height: 1.5;
  background: rgba(201, 168, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 255, .38);
  color: #e6dcff;
}
.rec-badge.endless {
  background: rgba(201, 168, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 255, .45);
  color: #e6dcff;
}
/* 通关记录里「这一局用的哪位主角」（3.0）：暖色，和无尽的紫色区分开 */
.rec-badge.hero {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 197, 110, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 197, 110, .4);
  color: #ffe6bd;
}
/* 「新主角解锁了」那条：和「无尽模式解锁」并列，但换成暖色（换人而不是换模式） */
.unlock-banner-hero {
  background: rgba(255, 197, 110, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 197, 110, .42);
  color: #ffe6bd;
}
.unlock-banner-hero .ico-change { color: var(--accent-2); }
/* 通关页那第二段（主角的收尾台词）：比正文弱一档，别和结局正文抢 */
.title-quote-soft { opacity: .78; font-size: clamp(13px, 1.35vw, 15.5px); }

/* ---- 口吻台词：**头像 + 对话框**（用户给的版式）----
   头像用 PMD 头像（portraits），左边一列；右边是标题 + 对话框 + 一行小字。
   对话框左边那个小三角指向头像 —— 一眼看出这句话是谁说的。 */
.dex-say { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.dex-say-face {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); overflow: hidden;
  background: rgba(0, 0, 0, .22);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .16);
}
.dex-say-face img.portrait { width: 64px; height: 64px; image-rendering: pixelated; }
.dex-say-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dex-say-main h4 { margin-bottom: 0; }
.dex-say-bubble {
  position: relative;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, .3);
  box-shadow: inset 0 0 0 1px rgba(232, 207, 162, .2);
}
.dex-say-bubble::before {
  content: ''; position: absolute; left: -6px; top: 15px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
  border-right: 7px solid rgba(0, 0, 0, .3);
}
.dex-voice-line { margin: 0; font-size: 13.5px; line-height: 1.7; }
.dex-voice.locked .dex-voice-line { opacity: .6; }
.dex-voice.locked .dex-say-face { filter: grayscale(.55); opacity: .8; }
.dex-voice-note { font-size: 11px; opacity: .55; }
.dex-move-group { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.dex-move-cap { flex: 0 0 auto; font-size: 11.5px; opacity: .65; padding-top: 3px; }
.dex-empty { font-size: 12px; opacity: .6; }
/* 首领称号（3.1）：不再做成名字旁边的一枚胶囊，而是**名字下面那一行**。
   理由：遭遇演出里这个称号本来就打在大字名下面（见 .enc-boss-title-row），
   图鉴里却把它塞进「#0844 / 较强 / 地面」那一排小胶囊里 —— 又挤，又不像称号。 */
.dex-boss-title {
  margin: 2px 0 4px;
  font-family: var(--font-bold);
  font-size: 13px;
  letter-spacing: .22em;
  color: #ffd27a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

@media (max-width: 720px) {
  .dex-detail-top { grid-template-columns: 1fr; }
  /* 窄屏：图在上、介绍在下，这时不需要「撑到一样高」，正常堆叠就好 */
  .dex-intro { flex: 0 0 auto; justify-content: flex-start; }
  .dex-detail-cols { grid-template-columns: 1fr; gap: 14px; }
  /* 窄屏：头像小一圈，对话框不会被挤成一条 */
  .dex-say { gap: 9px; }
  .dex-say-face, .dex-say-face img.portrait { width: 52px; height: 52px; }
  .dex-art-box, .dex-iconbox { min-height: 92px; }
}

/* ============================================================
   专家模式：卡面上那一行数字（设置里开，默认关）
   描述少留一行（--card-clamp 减 1），所以卡面高度不变、排版不会跳。
   ============================================================ */
.card.expert { --card-clamp: calc(var(--card-clamp) - 1); }
.card-expert {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-top: 3px;
}
.card-expert-chip {
  font-size: 9.5px; line-height: 1.5;
  padding: 0 4px; border-radius: 4px;
  background: rgba(74, 53, 36, .14);
  color: var(--card-ink, #4a3524);
  box-shadow: inset 0 0 0 1px rgba(74, 53, 36, .18);
  font-variant-numeric: tabular-nums;
}
.card-lg .card-expert-chip { font-size: 11px; padding: 1px 6px; }
/* 出牌展示区里那张卡是等比缩放的，这一行也跟着缩（--u 由 layoutPlayZone 写） */
.played-card .card-expert-chip { font-size: calc(10px * var(--u, 1)); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  :root { --card-w: 164px; --card-h: 176px; }
  .hud-stats { display: none; }
  .hud-hp { width: 140px; }
  .fighter-card { min-width: 150px; padding: 6px 9px; }
  /* 图鉴/记录：卡面变窄了，敌人卡片一行也能多放几张 */
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .rec-row { flex-wrap: wrap; }
}
@media (max-width: 620px) {
  :root { --card-w: 150px; --card-h: 168px; }
  .hud-portrait { display: none; }
  .hud-species { display: none; }
  .battle-log { max-height: 76px; min-height: 40px; font-size: 11px; }
  .float-text { font-size: 24px; }
  /* 详情页（卡牌 / 图鉴）竖着排：窄屏上左右两栏会把说明挤成一条线 */
  .card-detail { flex-direction: column; align-items: center; }
  .dex-detail-face { width: 96px; height: 96px; }
  .dex-detail-face img { width: 96px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ============================================================
   地图装饰物（图片地址在文件末尾的 GENERATED-MAP-DECOR 区块里，由 tools/build-map-decor.mjs 生成）
   ============================================================ */
.map-decor {
  position: absolute;
  inset: 0;
  z-index: 0;             /* 连线(1) 与节点(2) 都在它上面 */
  pointer-events: none;   /* 装饰物不该吃掉点击 —— 能点的只有节点 */
}
.map-deco {
  position: absolute;
  display: block;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  /* 提一点饱和、再压暗一档：一是不让「主题色画在主题色背景上」糊成一片（沙漠里的沙色仙人掌就是），
     二是压暗之后它们读起来像「画在地图上的墨线」，而不是贴上去的彩色贴纸 */
  filter: saturate(1.08) brightness(.84) drop-shadow(0 5px 7px rgba(0, 0, 0, .4));
}
/* 一半左右镜像：同一款树 / 岩不会看出是同一个模子 */
.map-deco.flip { transform: scaleX(-1); }

/* GENERATED-MAP-DECOR */
/* 地图装饰物（Kenney 制图包）。由 tools/build-map-decor.mjs 从 assets/img/map/ 生成，别手改。
   统一用 background-image 而不是 <img>：单文件包（file://）会拦掉 <img src>，
   而 CSS 里的 url() 会被打包器内联成 data URI。 */
.map-deco-bush { background-image: url(../../assets/img/map/bush.png); }
.map-deco-cactus { background-image: url(../../assets/img/map/cactus.png); }
.map-deco-cactusLarge { background-image: url(../../assets/img/map/cactusLarge.png); }
.map-deco-campfire { background-image: url(../../assets/img/map/campfire.png); }
.map-deco-castleWideLow { background-image: url(../../assets/img/map/castleWideLow.png); }
.map-deco-chest { background-image: url(../../assets/img/map/chest.png); }
.map-deco-church { background-image: url(../../assets/img/map/church.png); }
.map-deco-dock { background-image: url(../../assets/img/map/dock.png); }
.map-deco-elementDiamond { background-image: url(../../assets/img/map/elementDiamond.png); }
.map-deco-elementShield { background-image: url(../../assets/img/map/elementShield.png); }
.map-deco-fence { background-image: url(../../assets/img/map/fence.png); }
.map-deco-flag { background-image: url(../../assets/img/map/flag.png); }
.map-deco-gate { background-image: url(../../assets/img/map/gate.png); }
.map-deco-graveyard { background-image: url(../../assets/img/map/graveyard.png); }
.map-deco-lake { background-image: url(../../assets/img/map/lake.png); }
.map-deco-lakeRound { background-image: url(../../assets/img/map/lakeRound.png); }
.map-deco-lighthouse { background-image: url(../../assets/img/map/lighthouse.png); }
.map-deco-mill { background-image: url(../../assets/img/map/mill.png); }
.map-deco-mine { background-image: url(../../assets/img/map/mine.png); }
.map-deco-palm { background-image: url(../../assets/img/map/palm.png); }
.map-deco-palmLarge { background-image: url(../../assets/img/map/palmLarge.png); }
.map-deco-pyramid { background-image: url(../../assets/img/map/pyramid.png); }
.map-deco-rocks { background-image: url(../../assets/img/map/rocks.png); }
.map-deco-rocksA { background-image: url(../../assets/img/map/rocksA.png); }
.map-deco-rocksB { background-image: url(../../assets/img/map/rocksB.png); }
.map-deco-rocksMountain { background-image: url(../../assets/img/map/rocksMountain.png); }
.map-deco-rocksTall { background-image: url(../../assets/img/map/rocksTall.png); }
.map-deco-runis { background-image: url(../../assets/img/map/runis.png); }
.map-deco-ship { background-image: url(../../assets/img/map/ship.png); }
.map-deco-skull { background-image: url(../../assets/img/map/skull.png); }
.map-deco-tent { background-image: url(../../assets/img/map/tent.png); }
.map-deco-tipi { background-image: url(../../assets/img/map/tipi.png); }
.map-deco-towerLow { background-image: url(../../assets/img/map/towerLow.png); }
.map-deco-towerWatch { background-image: url(../../assets/img/map/towerWatch.png); }
.map-deco-treePine { background-image: url(../../assets/img/map/treePine.png); }
.map-deco-treePineLarge { background-image: url(../../assets/img/map/treePineLarge.png); }
.map-deco-treePineTall { background-image: url(../../assets/img/map/treePineTall.png); }
.map-deco-treePineTallLow { background-image: url(../../assets/img/map/treePineTallLow.png); }
.map-deco-treePines { background-image: url(../../assets/img/map/treePines.png); }
.map-deco-treePinesSmall { background-image: url(../../assets/img/map/treePinesSmall.png); }
.map-deco-treeTall { background-image: url(../../assets/img/map/treeTall.png); }
.map-deco-vulcano { background-image: url(../../assets/img/map/vulcano.png); }
.map-deco-watchtower { background-image: url(../../assets/img/map/watchtower.png); }
.map-deco-waterWheel { background-image: url(../../assets/img/map/waterWheel.png); }
.map-deco-well { background-image: url(../../assets/img/map/well.png); }
/* END GENERATED-MAP-DECOR */
