/* 熊猫引路 · 外壳样式（A）。品牌 token 沿用站内；系统字体，无 webfont。
   目录：1 token/基础  2 游戏区  3 海报退路  4 HUD  5 对话气泡  6 下方正文
        7 对话框（头像+选项）  8 物品卡  9 行囊与电影黑边（PRESENT 2.0，DESIGN.md §11） */

/* ───────── 1 token / 基础 ───────── */
:root {
  --bg: #F5F2EC;
  --panel: #FFFEFB;
  --ink: #1A1814;
  --ink-2: #4A463E;
  --ink-3: #7A7568;
  --line: #E5DDC9;
  --accent: #D97757;
  --accent-dk: #A25941;
  --accent-soft: #F3DDD0;
  --paper: #F7F0E0;
  --paper-2: #EFE4CC;
  --seal: #C8402C;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "AR PL UKai CN", "Noto Serif CJK SC", "Songti SC", var(--sans);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", sans-serif;
}
/* System-only language stacks. zh-CN repeats the original tokens exactly. */
:root:lang(zh-CN) {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", sans-serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "AR PL UKai CN", "Noto Serif CJK SC", "Songti SC", var(--sans);
}
:root { --world-serif: "Songti SC","STSong","Noto Serif CJK SC","Noto Serif SC",ui-serif,Georgia,"Times New Roman",serif; }
:root:lang(en) {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --kai: ui-serif, Georgia, "Times New Roman", serif;
  --world-serif: ui-serif,Georgia,"Times New Roman",serif;
}
:root:lang(ja) {
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
  --kai: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  --world-serif: "Hiragino Mincho ProN","Yu Mincho","Noto Serif CJK JP",serif;
}
:root:lang(ko) {
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif;
  --kai: "AppleMyungjo", "Batang", "Noto Serif CJK KR", serif;
  --world-serif: "AppleMyungjo","Batang","Noto Serif CJK KR",serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.8 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dk); text-underline-offset: 5px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent-dk); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--panel); text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.btn {
  display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 20px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  font: 650 14px/1.2 var(--sans); text-decoration: none; color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--accent-dk); }
.btn.primary { background: var(--accent-dk); border-color: var(--accent-dk); color: var(--panel); }
.btn[hidden] { display: none; }
.eyebrow { font: 600 13px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-dk); margin: 0 0 14px; }

/* ───────── 2 游戏区 ───────── */
.trail-game {
  position: relative; width: 100%; height: 100vh; height: 100svh; min-height: 420px; overflow: hidden;
  background: var(--bg); touch-action: pan-y; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; outline: none;
}
.trail-game.kbd:focus { outline: 3px solid var(--accent-dk); outline-offset: -3px; }
/* 底部节奏（自下而上）：进度线 → 行囊（避开 7% 的电影黑边）→ 对话框。--sat-bottom 里的百分比按使用处的包含块高度解析。 */
.trail-game { --sat-h: 58px; --sat-bottom: max(calc(env(safe-area-inset-bottom, 0px) + 20px), calc(7% + 6px)); }
.trail-game:lang(en) { --kai: Georgia, "Iowan Old Style", "Palatino Linotype", serif; }
.trail-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity .5s ease;
}
.trail-game[data-mode="game"] .trail-canvas { opacity: 1; }
.trail-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.trail-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
/* 游戏未就绪时，HUD/气泡层不参与显示 */
.trail-game:not([data-mode="game"]) .trail-hud,
.trail-game:not([data-mode="game"]) .trail-overlay { visibility: hidden; }

/* ───────── 3 海报退路 ───────── */
.poster { position: absolute; inset: 0; z-index: 0; transition: opacity .7s ease .1s, visibility 0s linear .8s; }
.poster-svg { display: block; width: 100%; height: 100%; }
.trail-game[data-mode="game"] .poster { opacity: 0; visibility: hidden; }

.poster-ui { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.poster-ui a { pointer-events: auto; }
/* 有 JS 时：模式未决（加载中）与游戏中都不显示海报文字层 */
html[data-js] .trail-game:not([data-mode]) .poster-ui,
.trail-game[data-mode="loading"] .poster-ui,
.trail-game[data-mode="game"] .poster-ui { visibility: hidden; opacity: 0; }

.p-brand {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 14px 0 12px;
  border-radius: 999px; background: rgba(255, 254, 251, .72); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font: 750 15px/1 var(--sans); letter-spacing: -.02em;
}
.p-hero {
  position: absolute; left: 0; right: 0; top: clamp(72px, 12vh, 150px); text-align: center;
  padding: 0 24px; pointer-events: none;
}
.p-eyebrow { font: 600 12px/1.5 var(--mono); letter-spacing: .16em; color: var(--accent-dk); margin: 0 0 10px; }
.p-title {
  margin: 0 0 10px; font: 780 clamp(44px, 8.4vw, 96px)/1.05 var(--sans); letter-spacing: .06em; color: var(--ink);
}
.p-sub { margin: 0 0 24px; font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-2); }
.p-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.p-actions .btn { pointer-events: auto; }
.p-note { margin: 18px auto 0; max-width: 28em; font-size: 14px; line-height: 1.7; color: var(--ink-2); }

/* ───────── 4 HUD ───────── */
.hud-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.hud-brand {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 14px 0 12px;
  border-radius: 999px; background: rgba(255, 254, 251, .82); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ink); text-decoration: none; font: 750 15px/1 var(--sans); letter-spacing: -.02em;
}
.hud-brand svg { flex: none; }
.hud-tools { display: flex; align-items: center; gap: 8px; }
.hud-language, .hud-text, .hud-mute {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border-radius: 999px; background: rgba(255, 254, 251, .82); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ink);
}
.hud-text { padding: 0 14px; text-decoration: none; font: 650 14px/1 var(--sans); }
.hud-mute { width: 44px; padding: 0; cursor: pointer; font: inherit; }
.hud-brand:hover, .hud-language:hover, .hud-text:hover, .hud-mute:hover { border-color: var(--accent-dk); }
.hud-mute svg { width: 22px; height: 22px; display: block; }
.hud-mute .ico-off { display: none; }
.hud-mute[aria-pressed="true"] .ico-on { display: none; }
.hud-mute[aria-pressed="true"] .ico-off { display: block; }
.hud-mute[aria-pressed="true"] { color: var(--accent-dk); }

.hud-hint {
  position: absolute; left: 50%; bottom: calc(var(--sat-bottom) + var(--sat-h) + 10px); transform: translateX(-50%);
  max-width: calc(100% - 28px); padding: 9px 16px; border-radius: 999px; white-space: nowrap;
  background: rgba(26, 24, 20, .78); color: #FFFEFB; font: 500 14px/1.3 var(--sans);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity .6s ease; pointer-events: none;
}
.hud-hint[data-hidden="1"] { opacity: 0; }
.trail-game[data-dlg="1"] .hud-hint { opacity: 0; visibility: hidden; pointer-events: none; transition: none; }   /* 对话框开着（序章第 1 句）时让位：二者占同一条带，对话框关了自动恢复（R4 自测发现重叠） */
.hud-hint[hidden] { display: none; }
.hud-hint kbd {
  display: inline-block; min-width: 1.5em; padding: 1px 6px; margin: 0 1px; border-radius: 6px; text-align: center;
  background: rgba(255, 254, 251, .16); border: 1px solid rgba(255, 254, 251, .28);
  font: 600 13px/1.4 var(--mono); color: inherit;
}
.hud-hint .sep { opacity: .5; margin: 0 6px; }

.hud-progress {
  position: absolute; left: 0; right: 0; bottom: max(0px, env(safe-area-inset-bottom)); height: 16px; pointer-events: none;
}
.hud-progress .track { position: absolute; left: 0; right: 0; bottom: 3px; height: 3px; background: rgba(26, 24, 20, .14); }
.hud-progress .fill {
  position: absolute; left: 0; right: 0; bottom: 3px; height: 3px; background: var(--accent);
  transform-origin: 0 50%; transform: scaleX(0); transition: transform .25s linear;
}
.hud-progress .tick {
  position: absolute; bottom: 3px; width: 2px; height: 8px; margin-left: -1px; border-radius: 1px;
  background: rgba(26, 24, 20, .42); transition: background-color .3s, height .3s;
}
.hud-progress .tick[data-visited="1"] { background: var(--accent-dk); height: 10px; }

/* ───────── 5 对话气泡（NPC 对话框） ───────── */
.pb-live {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.pb {
  position: absolute; left: 0; top: 0; width: max-content; max-width: min(340px, 80vw);
  visibility: hidden; opacity: 0; pointer-events: none; will-change: transform;
  transition: opacity .09s linear, visibility 0s linear .09s;
}
.pb[data-state="full"], .pb[data-state="collapsed"], .pb[data-state="bark"] {
  visibility: visible; opacity: 1; pointer-events: auto; transition: opacity .09s linear;
}
.pb-box { position: relative; }
.pb-panel {
  display: none; position: relative; background: var(--panel); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 rgba(26, 24, 20, .16), 0 12px 26px -10px rgba(26, 24, 20, .4);
}
.pb[data-state="full"] .pb-main,
.pb[data-state="collapsed"] .pb-dots,
.pb[data-state="bark"] .pb-bark { display: block; }

.pb-main { padding: 10px 18px 14px 16px; cursor: pointer; }
.pb-name {
  display: inline-block; margin: 0 0 6px; padding: 4px 9px 3px; border-radius: 6px; background: var(--accent); color: var(--ink);
  font: 700 12px/1 var(--mono); letter-spacing: .1em;
}
.pb-text { margin: 0; font: 400 17px/1.65 var(--sans); color: var(--ink); line-break: strict; overflow-wrap: anywhere; text-wrap: pretty; }
.pb-rest { visibility: hidden; }
.pb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pb-chips:empty { display: none; }
.pb-chips[data-ready="0"] { visibility: hidden; }
.pb-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-dk); color: #FFFEFB; font: 650 14px/1.2 var(--sans); text-decoration: none; cursor: pointer;
}
.pb-chip::after { content: "→"; font-weight: 500; }
.pb-chip:hover { background: var(--ink); }
.pb-chip:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pb-next {
  position: absolute; right: 11px; bottom: 6px; font-size: 16px; line-height: 1; color: var(--accent-dk); opacity: 0; pointer-events: none;
}
.pb[data-typed="1"] .pb-next { opacity: 1; animation: pb-blink 1s steps(1, end) infinite; }
.pb[data-final="1"] .pb-next { display: none; }
@keyframes pb-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

.pb-dots { padding: 13px 15px; font-size: 0; line-height: 0; cursor: default; }
.pb-dots i {
  display: inline-block; width: 7px; height: 7px; margin: 0 2.5px; border-radius: 50%; background: var(--ink-2);
  animation: pb-dot 1.2s ease-in-out infinite;
}
.pb-dots i:nth-child(2) { animation-delay: .15s; }
.pb-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pb-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-3px); opacity: 1; } }

.pb-bark { padding: 8px 15px; font: 500 16px/1.5 var(--sans); white-space: nowrap; cursor: default; }

/* 尾巴：SVG 三角（根部在盒子边缘，尖由 JS 指向锚点；可斜、可长）。填充盖住盒子边框，只描两条斜边 */
.pb-tail { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.pb-tail-fill { fill: var(--panel); }
.pb-tail-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pb[data-notail="1"] .pb-tail { display: none; }
/* 竖屏：RPG 式对话框停靠在视口底部（宽度、位置由 JS 设置），尖角在顶边 */
.pb[data-layout="docked"] .pb-panel { border-radius: 16px; }
.pb[data-layout="docked"][data-state="full"] .pb-text { font-size: 16px; }

/* ───────── 6 下方正文 ───────── */
.t-main { background: var(--bg); outline: none; }
.t-wrap { max-width: 1040px; margin: 0 auto; padding: 0 32px; }
.t-back { margin: 0; padding: 18px 0 0; font-size: 14px; }
.t-back a { color: var(--ink-2); }
.t-head { padding: 46px 0 8px; }
.t-head h1 { margin: 0; font: 750 clamp(30px, 4.4vw, 42px)/1.3 var(--sans); letter-spacing: -.025em; max-width: 18em; text-wrap: balance; }

.t-main .prologue { padding: 18px 0 56px; }
.t-main .prologue > * { max-width: 720px; }
.t-main .prologue p { margin: 0 0 12px; }
.t-main .line-lead { font-size: 19px; font-weight: 650; line-height: 1.7; color: var(--ink); }
.t-main .line-claim {
  font-size: 17px; line-height: 1.8; font-weight: 400; color: var(--ink-2);
}
.fine { margin: 0 0 18px; font-size: 14px; line-height: 1.7; color: var(--ink-3); }
.fine a { margin-left: .5em; }

.station {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 44px; align-items: center;
  padding: 56px 0; border-top: 1px solid var(--line);
}
.station:nth-of-type(odd) .station-copy { order: 2; }
.station h2, .epilogue h2 { margin: 0 0 18px; font: 750 30px/1.3 var(--sans); letter-spacing: -.025em; }
.station-copy p[data-line], .station-copy p[data-card-value], .epilogue p[data-line] { margin: 0 0 12px; color: var(--ink-2); font-size: 17px; }
/* 补充正文只保留台词和图鉴未覆盖的信息。 */
.more-line { margin: 0 0 14px; color: var(--ink-2); font-size: 16px; line-height: 1.75; }
.t-main .prologue .more-line { color: var(--ink-3); font-size: 15px; }
.station-copy p[data-line] { color: var(--ink); font-weight: 650; font-size: 19px; }
.station-actions { margin: 22px 0 0; }
.station-shot {
  margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.station-shot img { width: 100%; height: auto; }
.station-shot.tall { max-width: 420px; justify-self: center; width: 100%; }

/* Detailed text layout only; the in-game .ic card keeps its own styles. */
.t-main p, .t-main dd { text-wrap: pretty; }
.t-main .station { align-items: start; }
.t-main .station-copy { min-width: 0; }
.t-main .codex {
  display: grid; grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0; row-gap: 6px; margin: 20px 0;
  font-size: 15px; line-height: 1.75;
}
.t-main .codex dt {
  grid-column: 1; margin: 0; color: var(--ink-3);
  font-size: 12px; letter-spacing: .06em; padding: 3px 16px 0 0;
}
.t-main .codex dd { grid-column: 2; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.t-main .codex dt:not(:first-child), .t-main .codex dt:not(:first-child) + dd {
  border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px;
}
.t-main .codex dt[data-codex-label="core"], .t-main .codex dd[data-codex="core"] { display: none; }
.t-main .codex dd[data-codex="get"] { line-height: 1.5; }
@media (min-width: 761px) {
  .t-main figure.station-shot { position: sticky; top: 24px; }
}
@media (max-width: 480px) {
  .t-main .codex { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .t-main .codex dt, .t-main .codex dd { grid-column: 1; }
  .t-main .codex dt:not(:first-child) + dd { border-top: 0; margin-top: 0; padding-top: 0; }
  .t-main .codex dt:not(:first-child) { margin-top: 4px; padding-top: 10px; }
}

.epilogue { padding: 56px 0 72px; border-top: 1px solid var(--line); }
.epilogue > * { max-width: 760px; }
.epilogue p[data-line]:first-of-type { color: var(--ink); font-weight: 650; font-size: 19px; }
.coming { list-style: none; margin: 18px 0 26px; padding: 0; display: grid; gap: 10px; }
.coming li { display: flex; align-items: baseline; gap: 12px; }
.coming a { font-weight: 650; }
.coming span { font: 600 12px/1.5 var(--mono); letter-spacing: .08em; color: var(--ink-3); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
.more { display: flex; flex-wrap: wrap; gap: 12px; }

.t-foot { border-top: 1px solid var(--line); background: var(--bg); font-size: 14px; color: var(--ink-2); }
.t-foot .t-wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
.t-foot a { color: var(--ink-2); }

@media (max-width: 760px) {
  .t-wrap { padding: 0 20px; }
  .station { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 40px 0; }
  .station:nth-of-type(odd) .station-copy { order: 0; }
  .station h2, .epilogue h2 { font-size: 26px; }
  .t-main .line-lead { font-size: 17px; }
  .t-main .line-claim { font-size: 16px; }
  .p-hero { top: clamp(64px, 10vh, 110px); }
}
/* 手机竖屏：气泡文字略收，HUD 紧凑 */
@media (max-width: 480px) {
  .hud-brand { padding: 0 11px 0 10px; font-size: 14px; }
  .hud-text { padding: 0 12px; }
  .pb-text { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pb-dots i, .pb[data-typed="1"] .pb-next { animation: none; }
  .hud-progress .fill, .hud-hint, .trail-canvas, .poster { transition: none; }
}

/* ═════════ PRESENT 2.0 · 游戏式 UI（DESIGN.md §11）═════════
   宣纸 / 绢底 + 墨色笔触描边 + 朱砂印；品牌橙 #D97757 只做点睛。全部 CSS / 内联 SVG，不加载图片。 */

/* ───────── 7 共用：墨框 / 选项 / 印 ───────── */
.ux-frame { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0;
  filter: drop-shadow(0 5px 0 rgba(26, 24, 20, .14)) drop-shadow(0 14px 16px rgba(26, 24, 20, .26)); }
.ux-paper { fill: var(--paper); }
.ux-wash { fill: url(#ux-wash-g); }
.ux-ink-main { fill: none; stroke: var(--ink); stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.ux-ink-press { fill: none; stroke: var(--ink); stroke-width: 4.6; stroke-linecap: round; stroke-dasharray: .16 .34 .2 .3; stroke-dashoffset: .04; opacity: .82; }
.ux-ink-inner { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: .58 .04 .3 .08; opacity: .42; }
.ux-seal { display: block; width: 100%; height: 100%; overflow: visible; }

.ux-choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ux-choices[hidden] { display: none; }
.ux-choices[data-ready="0"] { visibility: hidden; }
.ux-choices[data-ready="done"] { pointer-events: none; }
.ux-choices[data-ready="done"] .ux-choice[data-focus="0"] { opacity: .45; }
.ux-choice {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 42px; padding: 0 16px 0 10px;
  border: 2px solid var(--ink); border-radius: 13px 9px 12px 8px / 9px 12px 8px 13px;
  background: rgba(239, 228, 204, .62); color: var(--ink); text-decoration: none; cursor: pointer;
  font: 700 16px/1.2 var(--sans); letter-spacing: .03em; -webkit-appearance: none; appearance: none;
  transition: background-color .12s ease, color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.ux-choice.is-primary { background: rgba(217, 119, 87, .24); }
.ux-caret { display: inline-block; width: 0; overflow: hidden; opacity: 0; color: #FF9A78; font-size: 15px; transition: width .12s ease, opacity .12s ease; }
.ux-label { white-space: nowrap; }
.ux-ext { font-size: 13px; opacity: .65; margin-left: 2px; }
.ux-choice[data-focus="1"] {
  background: var(--ink); color: var(--paper); transform: translateY(-1px);
  box-shadow: 0 3px 0 rgba(26, 24, 20, .28), 0 0 0 3px rgba(217, 119, 87, .55);
}
.ux-choice[data-focus="1"] .ux-caret { width: 1em; opacity: 1; }
.ux-choice:focus { outline: none; }
.ux-choice:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }


/* ───────── 7a 对话框 + 熊猫头像 ───────── */
.dlg {
  position: absolute; left: 0; right: 0; z-index: 2;
  bottom: calc(var(--sat-bottom, 20px) + var(--sat-h, 58px) + 24px);       /* 原 +12px：开合动画起点比终点低 18px，会和行囊条短暂相交（R4 逐帧相交检查发现），留 24px 余量 */
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
  container-type: inline-size; container-name: dlg;
}
/* visibility alone leaves source-independent SVG fiber noise in some renderers.
   Only remove painting/layout once closeAnim has finished; open/closing keep their animation. */
.dlg[data-state="hidden"] { display: none; opacity: 0; visibility: hidden; }
.dlg[data-state="hidden"], .dlg[data-state="hidden"] * { pointer-events: none; }
.dlg[data-state="closing"], .dlg[data-state="closing"] * { pointer-events: none; }
.dlg-box {
  --av: 96px;
  position: relative; width: min(720px, 100%); min-height: 112px; pointer-events: auto;
  display: grid; grid-template-columns: var(--av) minmax(0, 1fr); column-gap: 20px; align-items: start;
  padding: 20px 28px 18px 20px; color: var(--ink); font-family: var(--kai); cursor: default;
}
.dlg-portrait { position: relative; z-index: 1; width: var(--av); height: var(--av); margin-top: -30px; filter: drop-shadow(0 4px 0 rgba(26, 24, 20, .2)); }
.dlg-main { position: relative; z-index: 1; min-width: 0; padding-top: 6px; }
.dlg-text {
  margin: 0; font-size: 19px; line-height: 1.78; letter-spacing: .02em; font-weight: 600;
  line-break: strict; overflow-wrap: anywhere;
}
.dlg-rest { visibility: hidden; }
.dlg-name {
  position: absolute; z-index: 2; top: -14px; left: calc(20px + var(--av) + 20px);
  padding: 5px 15px 4px; border: 2px solid var(--ink); border-radius: 4px 8px 5px 9px; background: var(--accent); color: var(--ink);
  font: 800 13px/1 var(--sans); letter-spacing: .14em; transform: rotate(-1.2deg); box-shadow: 0 2px 0 rgba(26, 24, 20, .3);
}
.dlg-seal { position: absolute; z-index: 2; top: -13px; right: 22px; width: 38px; height: 38px; transform: rotate(5deg); transform-origin: 50% 50%; filter: drop-shadow(0 1px 0 rgba(26, 24, 20, .25)); }
.dlg-next {
  position: absolute; z-index: 2; right: 28px; bottom: 12px; color: var(--seal); font-size: 22px; line-height: 1; opacity: 0; pointer-events: none;
}
.dlg[data-typed="1"][data-has-choices="0"] .dlg-next { opacity: 1; animation: ux-bob 1.1s ease-in-out infinite; }
@keyframes ux-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.dlg .ux-choices { margin-top: 12px; }

/* 头像 SVG：表情靠 data-mood 切换，眨眼靠 data-blink，嘴靠 --mo */
.pt, .pt-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pt-head { transform-origin: 60px 90px; transition: transform .26s cubic-bezier(.3, .8, .3, 1); }
.pt-svg[data-mood="smile"] .pt-head { transform: rotate(-2deg); }
.pt-svg[data-mood="proud"] .pt-head { transform: rotate(-4deg) translateY(-2px); }
.pt-svg[data-mood="think"] .pt-head { transform: rotate(4deg) translateX(1px); }
.pt-eyes, .pt-m, .pt-spark, .pt-dots, .pt-blush, .pt-brows { opacity: 0; transition: opacity .12s linear; }
.pt-svg[data-mood="neutral"] .pt-eyes-open, .pt-svg[data-mood="neutral"] .pt-m-neutral,
.pt-svg[data-mood="smile"] .pt-eyes-smile, .pt-svg[data-mood="smile"] .pt-m-smile, .pt-svg[data-mood="smile"] .pt-blush,
.pt-svg[data-mood="proud"] .pt-eyes-half, .pt-svg[data-mood="proud"] .pt-m-proud, .pt-svg[data-mood="proud"] .pt-spark, .pt-svg[data-mood="proud"] .pt-blush,
.pt-svg[data-mood="think"] .pt-eyes-think, .pt-svg[data-mood="think"] .pt-m-think, .pt-svg[data-mood="think"] .pt-dots, .pt-svg[data-mood="think"] .pt-brows { opacity: 1; }
.pt-svg[data-blink="1"] .pt-eyes-open .pt-eye, .pt-svg[data-blink="1"] .pt-eyes-think g, .pt-svg[data-blink="1"] .pt-eyes-half g { transform: scaleY(.08); }
.pt-eye, .pt-eyes-think g, .pt-eyes-half g { transform-box: fill-box; transform-origin: center; transition: transform 55ms linear; }
.pt-open { opacity: 0; transform-origin: 60px 82px; transform: scaleY(0); transition: transform 55ms linear, opacity 55ms linear; }
.pt-svg[data-talk="1"] .pt-open { opacity: 1; transform: scaleY(var(--mo, 0)); }
.pt-svg[data-talk="1"] .pt-mouth { opacity: .0; }
.pt-svg[data-mood="proud"] .pt-spark { animation: pt-twinkle 1.8s ease-in-out infinite; transform-origin: 104px 20px; }
.pt-svg[data-mood="think"] .pt-dots circle { animation: pt-dot 1.6s ease-in-out infinite; }
.pt-svg[data-mood="think"] .pt-dots circle:nth-child(2) { animation-delay: .2s; }
.pt-svg[data-mood="think"] .pt-dots circle:nth-child(3) { animation-delay: .4s; }
.pt-bust { animation: pt-breathe 3.8s ease-in-out infinite; transform-origin: 60px 100px; }
@keyframes pt-twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.78) rotate(12deg); opacity: .7; } }
@keyframes pt-dot { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes pt-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.1px); } }

/* 窄屏（竖屏）：头像缩小，选项占满整行 */
@container dlg (max-width: 560px) {
  .dlg-box { --av: 68px; column-gap: 12px; padding: 18px 16px 15px 14px; min-height: 96px; }
  .dlg-portrait { margin-top: -26px; }
  .dlg-main { display: contents; }
  .dlg-text { position: relative; z-index: 1; grid-column: 2; grid-row: 1; font-size: 17px; line-height: 1.72; padding-top: 6px; }
  .dlg .ux-choices { position: relative; z-index: 1; grid-column: 1 / -1; grid-row: 2; margin-top: 12px; }
  .dlg .ux-choice { flex: 1 1 auto; }
  .dlg-name { left: calc(14px + var(--av) + 12px); top: -13px; }
  .dlg-seal { right: 16px; width: 28px; height: 28px; }
}

/* ───────── 8 物品卡 ───────── */
.ic { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
/* 外边界就是 region：卷轴端头不再向外探出，装饰、焦点描边也留在卡片内。 */
.ic-scroll {
  position: absolute; pointer-events: auto; color: var(--ink); font-family: var(--sans);
  overflow: clip; border-radius: 5px; --ic-roll: 8px; --ic-gap: 4px;
}
.ic-scroll[hidden] { display: none; }
.ic-content { height: 100%; }
.ic-content[aria-hidden="true"], .ic-content[aria-hidden="true"] * { pointer-events: none !important; }
.ic-roll {
  position: relative; z-index: 3; height: var(--ic-roll); margin: 0; border-radius: 5px;
  background: linear-gradient(#7b5a3f, #46321f 42%, #21170f);
  box-shadow: inset 0 1px 0 rgba(255, 224, 176, .4);
}
.ic-knob { position: absolute; inset-block: 0; width: 10px; border: 1px solid var(--ink); border-radius: 3px; background: linear-gradient(90deg, #8e2d20, #cf4a34 50%, #7c2519); }
.ic-knob.l { left: 0; } .ic-knob.r { right: 0; }
.ic-paper {
  position: relative; height: calc(100% - 2 * var(--ic-roll)); display: grid;
  grid-template-columns: minmax(0, 47fr) minmax(0, 53fr); gap: 12px; padding: var(--ic-pad-y, 12px) 12px;
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, rgba(255, 252, 243, .6), rgba(246, 237, 216, 0) 50%, rgba(216, 193, 149, .3)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='f' x='0' y='0' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='.9 .55' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 .42 0 0 0 0 .31 0 0 0 0 .18 0 0 0 .22 -.02'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>");
}
.ic-paper::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  border: 5px solid #E4D3AC; box-shadow: inset 0 0 0 1px rgba(26, 24, 20, .65);
}
.ic-left { position: relative; z-index: 1; grid-column: 2; grid-row: 1; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: var(--ic-gap); min-width: 0; min-height: 0; }
.ic-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ic-icon, .ic-fly-icon { position: relative; flex: none; width: 30px; height: 30px; display: grid; place-items: center; }
.ic-icon::before, .ic-fly-icon::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--ink);
  background: radial-gradient(circle at 50% 36%, #FFF8E6, #EBD9B0); box-shadow: 0 0 0 2px rgba(217, 119, 87, .26);
}
.ic-icon-glow { position: absolute; inset: -4px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 226, 170, .8), rgba(217, 119, 87, 0) 68%); opacity: 0; transition: opacity .3s; animation: ic-pulse 2.6s ease-in-out infinite; }
.ic-icon[data-landed="1"] .ic-icon-glow { opacity: 1; }
.ic-icon-svg { position: relative; width: 26px; height: 26px; display: block; }
.ic-icon:not([data-landed="1"]) .ic-icon-svg { opacity: 0; }
.ic-icon-svg svg, .ic-fly-icon svg { display: block; width: 100%; height: 100%; }
@keyframes ic-pulse { 0%, 100% { transform: scale(.94); opacity: .75; } 50% { transform: scale(1.06); opacity: 1; } }
.ic-name { min-width: 0; margin: 0; font: 800 21px/1.2 var(--sans); letter-spacing: 0; overflow-wrap: anywhere; }
.ic-tag {
  flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 3px; padding: 3px 5px;
  border: 1px solid var(--ink); border-radius: 3px 6px; background: var(--accent); color: var(--ink);
  font: 750 10px/1.1 var(--sans); letter-spacing: 0;
}
.ic-tag-hole { width: 4px; height: 4px; border-radius: 50%; border: 1px solid var(--ink); background: var(--paper); flex: none; }
.ic-tag[data-status="beta"] { background: var(--paper-2); border-style: dashed; }
.ic-meta { display: flex; align-items: start; gap: 4px; margin: 0; min-width: 0; font: 500 10.5px/1.4 var(--sans); }
.ic-meta .ic-fact { display: block; padding: 2px 4px; border-radius: 3px; background: var(--paper-2); }
.ic-meta dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ic-meta dd { margin: 0; }
.ic-summary { margin: 0; min-width: 0; }
.ic-core { padding: 3px 6px; background: rgba(217, 119, 87, .1); border-left: 2px solid var(--accent); font-size: var(--ic-core-font, 15px); line-height: 1.55; overflow-wrap: anywhere; }
.ic-core dt { display: inline; margin-right: 5px; color: var(--accent-dk); font: 750 10px/1.55 var(--sans); }
.ic-core dd { display: inline; margin: 0; font: 650 var(--ic-core-font, 15px)/1.55 var(--sans); letter-spacing: normal; }
.ic-details { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--accent-dk) var(--paper-2); font: var(--ic-font, 13px)/1.42 var(--sans); overflow-wrap: anywhere; }
.ic-details:focus-visible { outline: 2px solid var(--accent-dk); outline-offset: -2px; }
.ic-facts { margin: 0; }
.ic-facts .ic-fact { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 3px; margin: 0 0 5px; }
.ic-facts dt { padding-top: 2px; font: 750 10px/1.5 var(--sans); color: var(--accent-dk); }
.ic-facts dd { margin: 0; min-width: 0; }
/* Foreign labels share their longest intrinsic width. Keep whole labels (also
   Japanese/Korean); zh-CN retains the original 26px column and wrapping. */
.ic-facts:is(:lang(en), :lang(ja), :lang(ko)) { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 3px; }
.ic-facts:is(:lang(en), :lang(ja), :lang(ko)) .ic-fact { grid-column: 1 / -1; grid-template-columns: subgrid; }
.ic-facts:is(:lang(en), :lang(ja), :lang(ko)) dt { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.ic-core:is(:lang(en), :lang(ja), :lang(ko)) dt { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.ic-affixes, .ic-notes { list-style: none; margin: 0; padding: 0; }
.ic-affixes li + li { margin-top: 3px; }
.ic-get { display: flex; flex-wrap: wrap; gap: 3px; }
.ic-get a { display: inline-block; padding: 2px 5px; border: 1px solid rgba(162, 89, 65, .3); border-radius: 4px; background: rgba(255, 254, 251, .55); font-size: 10.5px; line-height: 1.45; text-underline-offset: 2px; }
.ic-get a:focus-visible { outline-offset: -2px; }
.ic-note { color: var(--ink-2); font-size: 11px; line-height: 1.4; }
.ic-notes li + li { margin-top: 2px; }
.ic-choices-slot { min-width: 0; align-self: end; }
.ic-scroll .ic-choices { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 5px; margin: 0; }
.ic-scroll .ic-choices .ux-choice { width: auto; flex: 1; min-width: 0; min-height: 32px; padding: 4px 5px; font-size: 12px; line-height: 1.3; white-space: normal; }
.ic-scroll .ic-choices .ux-label { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.ic-scroll .ic-choices .ux-choice:focus-visible { outline-offset: -3px; }
.ic-frame { position: relative; z-index: 1; grid-column: 1; grid-row: 1; margin: 0; min-width: 0; min-height: 0; contain: size; display: flex; align-items: center; justify-content: center; }
.ic-frame[hidden] { display: none; }
/* JS 根据 frame 槽与 naturalWidth/Height 求出框尺寸；宽图的框会变扁，槽内垂直居中。 */
.ic-shot { position: relative; flex: none; width: var(--ic-shot-w, 100%); height: var(--ic-shot-h, 100%); max-width: 100%; max-height: 100%; display: block; padding: 0; border: 0; color: var(--ink); background: transparent; cursor: zoom-in; font: 600 10px/1.3 var(--sans); }
.ic-shot:focus-visible { outline-offset: -3px; }
.ic-mount { position: relative; display: flex; width: 100%; height: 100%; padding: 3px; border: 1px solid rgba(26, 24, 20, .82); border-radius: 3px; background: linear-gradient(160deg, #EFE2C2, #DCC796); box-shadow: 0 4px 8px -4px #1a181466; }
.ic-mat { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; padding: 1px; background: #FBF6E8; border: 1px solid rgba(26, 24, 20, .6); }
.ic-img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; opacity: 0; transition: opacity .4s ease; }
.ic-img[data-loaded="1"] { opacity: 1; }
.ic-frame[data-broken="1"] .ic-img { display: none; }
.ic-image-fallback { width: 100%; align-self: center; padding: 12px; text-align: center; overflow-wrap: anywhere; }
.ic-image-fallback[hidden] { display: none; }
.ic-warm { position: absolute; inset: 4px; pointer-events: none; background: linear-gradient(135deg, #ffc47812, #d977570a); mix-blend-mode: multiply; }
.ic-shot-hint { position: absolute; right: 5px; bottom: 5px; max-width: calc(100% - 10px); padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); pointer-events: none; }
.ic-seal { position: absolute; z-index: 3; left: 14px; bottom: 14px; width: 20px; height: 20px; pointer-events: none; }
.ic-switch-ghost { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

/* 竖屏的主属性独立于滚动区；底部选项固定，至少留出首条词条的一整行。 */
.ic-scroll[data-layout="tall"] { --ic-gap: 3px; }
.ic-scroll[data-layout="tall"] .ic-paper { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--ic-fh) auto auto auto minmax(0, 1fr) auto; gap: var(--ic-gap); padding: var(--ic-pad-y, 8px) 10px; }
.ic-scroll[data-layout="tall"] .ic-left { display: contents; }
.ic-scroll[data-layout="tall"] .ic-frame { grid-column: 1; grid-row: 1; }
.ic-scroll[data-layout="tall"] .ic-head { grid-row: 2; }
.ic-scroll[data-layout="tall"] .ic-meta { grid-row: 3; }
.ic-scroll[data-layout="tall"] .ic-summary { grid-row: 4; }
.ic-scroll[data-layout="tall"] .ic-details { grid-row: 5; }
.ic-scroll[data-layout="tall"] .ic-choices-slot { grid-row: 6; }
.ic-scroll[data-layout="tall"] .ic-icon { width: 26px; height: 26px; }
.ic-scroll[data-layout="tall"] .ic-icon-svg { width: 23px; height: 23px; }
.ic-scroll[data-layout="tall"] .ic-name { font-size: 18px; }
.ic-scroll[data-layout="tall"] .ic-core { padding-block: 2px; }
.ic-scroll[data-layout="tall"] .ic-seal { display: none; }
/* Only selected by layout() when the normal grid cannot show the first affix
   line. The screenshot slot and fixed choices retain their original sizes. */
.ic-scroll[data-layout="tall"][data-density="compact"] .ic-paper { gap: 2px; padding-block: 6px; }
.ic-scroll[data-density="compact"] .ic-head { gap: 5px; }
.ic-scroll[data-density="compact"] .ic-icon { width: 24px; height: 24px; }
.ic-scroll[data-density="compact"] .ic-name { font-size: 16px; }
.ic-scroll[data-density="compact"] .ic-meta { display: block; font-size: 10px; line-height: 1.2; }
.ic-scroll[data-density="compact"] .ic-meta .ic-fact { display: inline; padding: 0; background: none; }
.ic-scroll[data-density="compact"] .ic-meta .ic-fact + .ic-fact::before { content: ' · '; }
.ic-scroll[data-density="compact"] .ic-meta dd { display: inline; }
.ic-scroll[data-density="compact"] .ic-core { padding: 1px 4px; font-size: 12px; line-height: 1.25; }
.ic-scroll[data-density="compact"] .ic-core dd { font-size: 12px; line-height: 1.25; }
/* English only, and only if the existing compact pass still hides the first
   affix line or overflows choices. The image slot remains 35% + 12px matting.
   Ellipsis is visual only: the complete subtitle DOM stays in the a11y tree. */
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-paper { gap: 1px; padding: 5px 6px; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; line-height: 1.3; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-core,
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-core dd { font-size: 13px; line-height: 1.3; font-weight: 500; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-details { font-size: 13px; line-height: 1.3; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-note,
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-get a { font-size: 13px; line-height: 1.3; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-choices .ux-choice { flex: 1 0 auto; font-size: 13px; letter-spacing: normal; }
.ic-scroll:lang(en)[data-overflow-fit="1"] .ic-choices .ux-label { white-space: nowrap; }
.ic-scroll[data-noimage="1"] .ic-paper { grid-template-columns: minmax(0, 1fr); }
.ic-scroll[data-noimage="1"] .ic-left { grid-column: 1; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-paper { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-head { grid-row: 1; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-meta { grid-row: 2; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-summary { grid-row: 3; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-details { grid-row: 4; }
.ic-scroll[data-noimage="1"][data-layout="tall"] .ic-choices-slot { grid-row: 5; }

/* Mobile compact is independent of tall/wide and the legacy desktop density.
   The body is the only scroll owner; choices stay in the paper's bottom row. */
.ic-scroll[data-compact] { --ic-roll: 6px; touch-action: pan-y; }
.ic-scroll[data-compact][data-layout] .ic-paper { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 4px; padding: 4px 8px; }
.ic-scroll[data-compact] .ic-body { grid-column: 1; grid-row: 1; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: var(--accent-dk) var(--paper-2); display: flex; flex-direction: column; gap: 5px; padding: 2px; }
.ic-scroll[data-compact] .ic-body:focus-visible { outline: 2px solid var(--accent-dk); outline-offset: -2px; }
.ic-scroll[data-compact][data-layout] .ic-left { display: contents; }
.ic-scroll[data-compact] .ic-body > .ic-frame,
.ic-scroll[data-compact] .ic-left > * { flex: none; min-width: 0; }
.ic-scroll[data-compact] .ic-head { order: 1; gap: 5px; }
.ic-scroll[data-compact] .ic-name { font-size: 18px; }
.ic-scroll[data-compact] .ic-icon { width: 24px; height: 24px; }
.ic-scroll[data-compact] .ic-icon-svg { width: 21px; height: 21px; }
.ic-scroll[data-compact] .ic-summary { order: 2; }
.ic-scroll[data-compact] .ic-core,
.ic-scroll[data-compact] .ic-core dd { font-size: 13px; line-height: 1.4; }
.ic-scroll[data-compact] .ic-meta { order: 3; font-size: 11px; }
.ic-scroll[data-compact] .ic-frame { order: 4; height: var(--ic-compact-fh); }
.ic-scroll[data-compact] .ic-details { order: 5; overflow: visible; max-height: none; font-size: 13px; line-height: 1.42; }
.ic-scroll[data-compact] .ic-facts { display: grid; }
.ic-scroll[data-compact] .ic-facts > .ic-fact[data-field="get"] { order: 1; }
.ic-scroll[data-compact][data-layout] .ic-choices-slot { grid-column: 1; grid-row: 2; }
.ic-scroll[data-compact] .ic-seal { display: none; }
/* Short landscapes keep the complete image in the lightbox. A text button
   spends less vertical space than a tiny, unreadable screenshot thumbnail. */
.ic-scroll[data-compact="landscape"] .ic-frame { height: 26px; justify-content: start; contain: none; }
.ic-scroll[data-compact="landscape"] .ic-shot { width: auto; height: 26px; max-width: 100%; }
.ic-scroll[data-compact="landscape"] .ic-mount { display: none; }
.ic-scroll[data-compact="landscape"] .ic-shot-hint { position: static; display: block; max-width: 100%; padding: 4px 7px; }

/* 原生模态 top layer：覆盖视口，HUD 不穿透；Escape / 遮罩 / 关闭按钮均可退出。 */
.ic-lightbox { position: fixed; inset: 0; width: 100vw; height: 100vh; width: 100dvw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: max(72px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); border: 0; overflow: hidden; background: rgba(26, 24, 20, .94); color: var(--paper); pointer-events: auto; }
.ic-lightbox:not([open]) { display: none; }
.ic-lightbox::backdrop { background: rgba(26, 24, 20, .85); }
.ic-lightbox-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ic-lightbox-img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 24px #0008); }
.ic-lightbox-close { position: absolute; right: max(20px, env(safe-area-inset-right)); top: max(16px, env(safe-area-inset-top)); min-height: 44px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--paper); font: 700 14px var(--sans); cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .ic-img { transition: none; }
}

/* 升起的法宝 + 光点 */
.ic-fly { position: absolute; left: 0; top: 0; width: 60px; height: 60px; z-index: 5; pointer-events: none; will-change: transform; }
.ic-fly-glow { position: absolute; inset: -16px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 232, 180, .95), rgba(217, 119, 87, .35) 56%, rgba(217, 119, 87, 0) 74%); }
.ic-fly-icon { position: absolute; inset: 0; width: 60px; height: 60px; }
.ic-fly-icon::before { border-width: 2.5px; box-shadow: 0 0 0 4px rgba(217, 119, 87, .26); }
.ic-fly-icon svg { position: absolute; inset: 7px; width: 46px; height: 46px; }
.ic-spark { position: absolute; z-index: 6; border-radius: 50%; pointer-events: none; opacity: 0; box-shadow: 0 0 6px 1px rgba(255, 214, 150, .9); }

/* "！"标记 */
.ic-marker {
  position: absolute; left: 0; top: 0; z-index: 4; width: 44px; height: 44px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent;
}
.ic-marker[hidden] { display: none; }
.ic-marker-ring { position: absolute; inset: 3px; border: 2px solid var(--seal); border-radius: 50%; animation: ic-ping 1.9s ease-out infinite; }
.ic-marker-dot {
  position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 2.5px solid var(--ink); border-radius: 50%;
  background: var(--seal); color: var(--paper); font: 900 21px/1 "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  box-shadow: 0 3px 0 rgba(26, 24, 20, .3); animation: ic-bob 1.5s ease-in-out infinite;
}
.ic-marker-dot::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -5px; border: 5px solid transparent; border-top: 6px solid var(--ink); }
.ic-marker:focus { outline: none; }
.ic-marker:focus-visible .ic-marker-dot { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes ic-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes ic-ping { 0% { transform: scale(.8); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }

/* ───────── 9 行囊 + 电影黑边 ───────── */
.hud-satchel {
  position: absolute; left: 50%; bottom: var(--sat-bottom); transform: translateX(-50%); z-index: 1; pointer-events: auto;
  transition: opacity .3s ease, visibility 0s linear 0s;
}
.sat-plate { position: relative; display: flex; align-items: center; gap: 8px; height: var(--sat-h); padding: 0 16px; }
.sat-plate .ux-frame { filter: drop-shadow(0 3px 0 rgba(26, 24, 20, .16)) drop-shadow(0 8px 10px rgba(26, 24, 20, .22)); }
.sat-plate .ux-paper { fill-opacity: .95; }
.slot {
  position: relative; z-index: 1; display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: none;
  border-radius: 50%; cursor: default; -webkit-tap-highlight-color: transparent; color: inherit;
}
.slot::before { content: ""; position: absolute; inset: 2px; border: 2px dashed rgba(26, 24, 20, .34); border-radius: 50%; transition: background-color .3s, border-color .3s, box-shadow .15s; }
.slot-ico { position: relative; display: grid; place-items: center; width: 36px; height: 36px; }
.slot-ico svg { display: block; width: 100%; height: 100%; }
.slot[data-filled="0"] .slot-ico { filter: brightness(0); opacity: .17; transform: scale(.86); }
.slot[data-filled="1"] { cursor: pointer; }
.slot[data-filled="1"]::before { border: 2px solid var(--ink); background: radial-gradient(circle at 50% 36%, #FFF8E6, #EBD9B0); }
.slot[data-filled="1"]:hover::before { box-shadow: 0 0 0 3px rgba(217, 119, 87, .5); }
.slot[aria-current="true"]::before {
  border-color: var(--accent-dk); border-width: 3px;
  box-shadow: 0 0 0 3px rgba(217, 119, 87, .6), 0 4px 14px rgba(255, 205, 122, .85);
}
.slot[data-filled="1"]:active .slot-ico { transform: scale(.94); }
.slot:focus:not(:focus-visible) { outline: none; }
.slot:focus-visible { outline: 2px dashed var(--ink); outline-offset: 5px; }
.slot-ring { position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: 50%; opacity: 0; pointer-events: none; }
.slot-brand::before { border-radius: 13px; }
.sat-sep { flex: none; width: 2px; height: 26px; margin: 0 2px; border-radius: 2px; background: var(--ink); opacity: .26; position: relative; z-index: 1; }
.sat-fly { position: absolute; left: 0; top: 0; width: 40px; height: 40px; z-index: 6; pointer-events: none; will-change: transform; }
.sat-fly-glow { position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 232, 180, .9), rgba(217, 119, 87, .3) 58%, rgba(217, 119, 87, 0) 74%); }
.sat-fly-ico { position: absolute; inset: 0; }
.sat-fly-ico svg { display: block; width: 100%; height: 100%; }
.sat-spark { position: absolute; z-index: 6; border-radius: 50%; pointer-events: none; box-shadow: 0 0 5px 1px rgba(255, 214, 150, .85); }

.cine-bars { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cb { position: absolute; left: 0; right: 0; height: 7%; background: #0F0D0A; transition: transform .4s cubic-bezier(.3, .7, .2, 1); will-change: transform; }
.cb-top { top: 0; transform: translateY(-102%); box-shadow: 0 1px 0 rgba(217, 119, 87, .4); }
.cb-bot { bottom: 0; transform: translateY(102%); box-shadow: 0 -1px 0 rgba(217, 119, 87, .4); }
.cine-bars[data-on="1"] .cb { transform: none; }

/* 电影模式：保留文字 / 静音；图鉴打开时保留可交互的行囊。 */
.hud-brand, .hud-text, .hud-hint, .hud-progress { transition: opacity .35s ease, visibility 0s linear 0s; }
.trail-hud[data-cinema="1"] .hud-brand,
.trail-hud[data-cinema="1"] .hud-hint, .trail-hud[data-cinema="1"] .hud-progress,
.trail-hud[data-cinema="1"]:not([data-card-open="1"]) .hud-satchel[data-reveal="0"] {
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease, visibility 0s linear .3s;
}
.trail-hud[data-cinema="1"] .hud-language, .trail-hud[data-cinema="1"] .hud-text, .trail-hud[data-cinema="1"] .hud-mute { background: rgba(255, 254, 251, .9); }

/* 入场立即显示，避免卡片 ready 后仍有行囊淡入空档。提示条为图鉴让位。 */
.trail-hud[data-card-open="1"] .hud-satchel { opacity: 1; visibility: inherit; pointer-events: auto; transition: none; }
.trail-hud[data-card-open="1"] .hud-hint { opacity: 0; visibility: hidden; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .cb { transition: opacity .12s linear; transform: none; opacity: 0; }
  .cine-bars[data-on="1"] .cb { opacity: 1; }
  .hud-satchel, .hud-brand, .hud-text, .hud-hint, .hud-progress { transition: none; }
  .pt-bust, .pt-spark, .pt-dots circle, .ic-icon-glow, .ic-marker-dot, .ic-marker-ring, .dlg-next { animation: none !important; }
  .pt-head, .ux-choice { transition: none; }
  .slot::before { transition: none; }
}

/* H1: same-page opening, above the live world; no additional bitmap assets. */
.trail-game[data-mode="hero"] .trail-canvas { opacity: 1; transition: none; }
.trail-game[data-mode="hero"] .poster,
.trail-game[data-mode="hero"] .poster-ui { visibility: hidden; opacity: 0; }
.trail-hero { position: absolute; inset: 0; z-index: 6; color: #1A1814; background: linear-gradient(90deg, rgba(245,242,236,.99) 0%, rgba(245,242,236,.97) 58%, rgba(245,242,236,.15) 72%, transparent); }
.trail-hero[hidden] { display: none; }
.hero-brand { position: absolute; top: 16px; left: 28px; min-height: 44px; display: inline-flex; align-items: center; color: #1A1814; font-weight: 700; text-decoration: none; }
.hero-copy { position: absolute; left: 5%; top: 24%; width: 52%; max-width: 810px; }
.hero-eyebrow { margin: 0 0 16px; font: 650 13px/1.5 var(--mono); letter-spacing: .15em; }
.hero-title { margin: 0 0 22px; font: 750 clamp(30px, 3.7vw, 54px)/1.4 var(--sans); letter-spacing: -.035em; }
.hero-title span { display: block; }
.hero-description { max-width: 36em; margin: 0 0 24px; font-size: 16px; line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.hero-start, .hero-text { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 16px; font: 650 15px/1.5 var(--sans); border-radius: 6px; }
.hero-start { border: 1px solid #1A1814; background: #1A1814; color: #FFFEFB; cursor: pointer; }
.hero-text { color: #1A1814; text-underline-offset: 6px; }
.hero-instructions { max-width: 100%; margin: 18px 0 0; font: 500 12px/1.8 var(--sans); }
@media (max-width: 600px), (orientation: portrait) {
  .trail-hero { background: linear-gradient(180deg, rgba(245,242,236,.99) 0%, rgba(245,242,236,.97) 60%, rgba(245,242,236,.12) 73%, transparent); }
  .hero-brand { left: 20px; top: 12px; font-size: 14px; }
  .hero-copy { left: 20px; top: 92px; width: calc(100% - 40px); }
  .hero-eyebrow { margin-bottom: 12px; font-size: 12px; }
  .hero-title { font-size: clamp(24px, 6.9vw, 42px); margin-bottom: 16px; line-height: 1.5; }
  .hero-description { font-size: 14px; line-height: 1.9; margin-bottom: 16px; }
  .hero-actions { gap: 8px; }
  .hero-start, .hero-text { font-size: 14px; padding: 8px 12px; }
  .hero-instructions { margin-top: 12px; font-size: 11px; }
}
/* Persistent guidance occupies the bottom right; geometric conflicts hide it
   synchronously with a recorded reason, and it returns on the first safe frame. */
.hud-guide { position: absolute; right: 12px; bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px)); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); pointer-events: auto; }
.hud-guide[hidden] { display: none; }
.hud-guide .hud-hint { position: static; transform: none; max-width: none; padding: 6px 9px; white-space: normal; background: #F5F2EC; color: #4A463E; font: 500 11px/1.6 var(--sans); opacity: 1; visibility: visible; transition: none; border-radius: 6px; }
.hud-help { flex: none; width: 44px; height: 44px; border: 1px solid #E5DDC9; border-radius: 50%; background: #F5F2EC; color: #4A463E; cursor: pointer; font: 700 18px/1 var(--sans); }
.trail-help { max-width: min(540px, calc(100vw - 32px)); max-height: calc(100svh - 48px); padding: 24px; border: 1px solid #A25941; border-radius: 16px; background: #F5F2EC; color: #1A1814; font: 15px/1.8 var(--sans); overflow: auto; }
.trail-help::backdrop { background: rgba(26,24,20,.5); }
.trail-help h2 { font-size: 22px; margin: 0 0 12px; }
.trail-help button, .trail-help a { display: inline-flex; align-items: center; min-height: 44px; }
.trail-help button { padding: 8px 16px; font: inherit; cursor: pointer; }
.trail-help { position: fixed; z-index: 30; left: 50%; top: 50%; margin: 0; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 32px)); }

/* Language-dependent prose wrapping; retain zh-CN's existing layout rules.
   sr-only/live-region nowrap is an accessibility clipping rule, not a text hack. */
:lang(en) :is(.pb-bark, .hud-hint, .ux-label),
:lang(ja) :is(.pb-bark, .hud-hint, .ux-label),
:lang(ko) :is(.pb-bark, .hud-hint, .ux-label) { white-space: normal; }
:lang(en) :is(.pb-text, .pb-bark, .dlg-text, .ux-label) { word-break: normal; overflow-wrap: anywhere; }
:lang(ja) :is(.pb-text, .pb-bark, .dlg-text) { line-break: strict; }
:lang(ko) :is(.pb-text, .pb-bark, .dlg-text, .ux-label, .ic-core, .ic-details) { word-break: keep-all; overflow-wrap: anywhere; }

/* Opening copy fades while its initiating gesture is consumed. */
.trail-hero { transition: opacity 180ms ease; -webkit-user-select: text; user-select: text; }
.trail-hero.hero-leaving { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .trail-hero { transition: none; } }

/* I2: language is a permanent top tool, including the opening and cinematic bars. */
.hud-language { min-width: 44px; padding: 0 8px; text-decoration: none; font: 650 14px/1 var(--sans); }
.hero-language { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); text-decoration: none; font: 650 14px/1 var(--sans); }
.t-language { float: right; margin: 0; }
.t-language a { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
@media (max-width: 600px) {
  .hud-brand span { display: none; }
  .hud-brand { min-width: 44px; padding: 0; justify-content: center; }
  .hud-tools { gap: 6px; }
  .hud-text { font-size: 12px; padding: 0 10px; }
}

.hud-language[hidden], .hero-language[hidden], .t-language a[hidden] { display: none; }

/* Touch controls have no boxes on fine-pointer desktops. The language shell
   contributes no desktop box; the original native select keeps its styles. */
.hud-language-shell { display: contents; }
.hud-language-code, .hud-doc-icon, .trail-touch, .trail-rotate-tip { display: none; }
@media (pointer: coarse) {
  .trail-touch { display: contents; }
  .trail-touch[hidden], .trail-rotate-tip[hidden] { display: none; }
  .touch-walk {
    position: absolute; z-index: 5; bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
    width: 56px; height: 56px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
    background: rgba(255,254,251,.82); color: var(--ink); box-shadow: 0 2px 6px #1a181426;
    font: 700 22px/1 var(--sans); pointer-events: auto; touch-action: none; user-select: none;
    -webkit-user-select: none; -webkit-touch-callout: none;
  }
  .touch-left { left: max(12px, calc(env(safe-area-inset-left) + 8px)); }
  .touch-right { right: max(12px, calc(env(safe-area-inset-right) + 8px)); }
  .touch-walk:active { background: var(--accent-soft); }
  .trail-rotate-tip {
    position: absolute; z-index: 5; top: var(--rotate-top, 64px); left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 999px; background: rgba(255,254,251,.94);
    color: var(--ink-2); font: 500 12px/1.5 var(--sans); pointer-events: auto; white-space: nowrap;
  }
  .trail-rotate-tip svg { width: 18px; height: 18px; flex: none; }
}
/* Every change to existing geometry is restricted to the requested phone MQ. */
@media (pointer: coarse) and ((max-width: 600px) or (max-height: 500px)) {
  .trail-game {
    min-height: 0; --phone-tool: 40px; --phone-top: max(10px, calc(env(safe-area-inset-top) + 6px));
    --sat-h: 50px; --sat-bottom: max(calc(env(safe-area-inset-bottom) + 80px), calc(7% + 6px));
  }
  .hud-top {
    gap: 8px; align-items: center; padding: var(--phone-top) max(12px, calc(env(safe-area-inset-right) + 8px)) 0 max(12px, calc(env(safe-area-inset-left) + 8px));
  }
  .hud-tools { gap: 8px; }
  .hud-brand, .hud-language-shell, .hud-text, .hud-mute {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: var(--phone-tool); height: var(--phone-tool); min-width: var(--phone-tool); min-height: var(--phone-tool);
    padding: 0; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,254,251,.9);
    box-shadow: 0 2px 6px #1a181426;
  }
  .hud-brand svg, .hud-brand span { display: none; }
  .hud-brand::after { content: 'M'; font: 850 23px/1 var(--sans); color: var(--accent-dk); letter-spacing: -.08em; padding-right: 2px; }
  .trail-hud[data-cinema="1"] .hud-brand { opacity: 1; visibility: visible; pointer-events: auto; transition: none; }
  .hud-language-shell { width: 64px; pointer-events: auto; }
  .hud-language-code { pointer-events: none; display: inline-flex; gap: 7px; align-items: center; font: 650 13px/1 var(--sans); }
  .hud-language-code::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: translateY(-2px) rotate(45deg); }
  .hud-language-shell .hud-language {
    position: absolute; inset: 0; width: 100% !important; max-width: none !important; height: 100%; min-height: 0;
    margin: 0; appearance: none; -webkit-appearance: none; opacity: 0; cursor: pointer;
  }
  .hud-language-shell:focus-within { outline: 3px solid var(--accent-dk); outline-offset: 3px; }
  .hud-text span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hud-doc-icon { display: block; width: 21px; height: 21px; }
  .cb-top { height: max(7%, calc(var(--phone-tool) + 2 * var(--phone-top))); }
  .trail-game[data-cinema="1"] .hud-top { padding-top: max(var(--phone-top), calc((7svh - var(--phone-tool)) / 2)); }
  .sat-plate { gap: 4px; padding: 0 10px; }
  .slot { width: 40px; height: 40px; }
  .slot-ico { width: 32px; height: 32px; }
  .hud-guide { left: max(80px, calc(env(safe-area-inset-left) + 76px)); right: max(80px, calc(env(safe-area-inset-right) + 76px)); max-width: none; gap: 6px; }
  .hud-guide .hud-hint { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px; font-size: 10px; }
  .hud-help { width: 40px; height: 40px; }
}
@media (pointer: coarse) and (max-height: 500px) {
  .trail-game { --phone-tool: 36px; --sat-h: 40px; --sat-bottom: max(env(safe-area-inset-bottom), 7%); }
  .touch-walk { width: 48px; height: 48px; }
  /* Keep guidance in the road-side gap beside the satchel, below the actors.
     The five 40px slots, separator, gaps and padding form a 246px plate;
     its left edge is 50% - 123px. Leave another 9px before that edge. */
  .hud-guide { left: max(76px, calc(env(safe-area-inset-left) + 68px)); right: calc(50% + 132px); bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px)); justify-content: center; }
  .hud-guide .hud-hint { flex: 0 1 auto; max-width: calc(100% - 42px); font-size: 10px; line-height: 1.3; }
  .hud-help { width: 36px; height: 36px; }
  .hero-brand { top: 4px; left: 20px; font-size: 12px; min-height: 36px; }
  .hero-copy { top: 44px; left: 20px; width: 60%; }
  .hero-eyebrow { font-size: 10px; margin-bottom: 4px; }
  .hero-title { font-size: clamp(22px, 3.2vw, 28px); line-height: 1.2; margin-bottom: 8px; }
  .hero-description { font-size: 12px; line-height: 1.5; margin-bottom: 8px; }
  .hero-start, .hero-text { font-size: 12px; min-height: 40px; padding: 6px 10px; }
  .hero-instructions { font-size: 10px; line-height: 1.4; margin-top: 6px; }
  .dlg-box { --av: 56px; min-height: 76px; column-gap: 12px; padding: 12px 20px 12px 14px; }
  .dlg-portrait { margin-top: -18px; }
  .dlg-main { padding-top: 0; }
  .dlg-text { font-size: 14px; line-height: 1.5; }
  .dlg-name { left: 82px; font-size: 11px; padding: 4px 10px; }
  .dlg-seal { width: 26px; height: 26px; }
  .dlg .ux-choices { margin-top: 6px; }
  .pb-text { font-size: 14px; line-height: 1.5; }
  .pb-main { padding: 10px 14px; }
}
