:root {
  color-scheme: dark;
  /* 博物馆展厅主题：墨玉底 + 青铜金 + 玉白 */
  --bg: #0d1420;
  --bg-2: #121c2b;
  --panel: rgba(18, 28, 43, 0.9);
  --panel-solid: #131d2d;
  --line: rgba(217, 178, 92, 0.24);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #f2ecdd;
  --muted: rgba(242, 236, 221, 0.62);
  --accent: #d9b25c;          /* 青铜金：主强调 */
  --accent-soft: rgba(217, 178, 92, 0.14);
  --gold: #e8c878;
  --jade: #7fd4a8;            /* 玉色青绿：完成/确认 */
  --jade-soft: rgba(127, 212, 168, 0.14);
  --ink: #f4ecd8;             /* 题字玉白 */
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shell-pad-top: max(18px, env(safe-area-inset-top));
  --shell-pad-bottom: max(18px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 全局防重叠：任何带 hidden 属性的元素一律隐藏（video 除外，留给 MindAR 自行管理），
   避免 .panel{display:flex} 等规则覆盖 [hidden] 导致隐藏面板仍堆叠显示文字重叠 */
[hidden]:not(video) { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); letter-spacing: 0.01em; }
button, input { font: inherit; }

a-scene { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; visibility: hidden; pointer-events: none; }
body.is-scanning a-scene { visibility: visible; pointer-events: auto; }
body > video { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important; object-fit: cover !important; z-index: 0 !important; background: #06090f; visibility: hidden !important; }
body.is-scanning > video { visibility: visible !important; }
.a-canvas { background: transparent !important; }
a-assets, a-assets img { display: none !important; }

body.is-scanning .app-shell { display: none; }
/* 展厅氛围：顶部一道柔和的暖光洒下，如展柜射灯 */
.app-shell {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: end center;
  padding: var(--shell-pad-top) 14px var(--shell-pad-bottom); pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -12%, rgba(217, 178, 92, 0.16), transparent 46%),
    radial-gradient(100% 70% at 50% 118%, rgba(16, 24, 38, 0.9), transparent 55%),
    linear-gradient(180deg, #0e1623 0%, #0b1119 100%);
}
.panel {
  display: flex; flex-direction: column; gap: 14px;
  width: min(94vw, 540px); max-height: calc(100dvh - var(--shell-pad-top) - var(--shell-pad-bottom));
  overflow: auto; overscroll-behavior: contain; padding: 20px 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}
.panel[hidden] { display: none; }
.panel > * { margin-block: 0; }
.panel > .button-row { margin-top: 6px; }
.mission-panel, .clue-panel, .guide-panel, .ending-panel { align-self: end; }
/* 章节小标：如展签上的编号 */
.kicker {
  color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.28em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.kicker::before { content: ""; width: 18px; height: 1px; background: var(--accent); opacity: 0.6; }
h1, h2 { margin: 4px 0 8px; line-height: 1.18; font-family: var(--serif); color: var(--ink); letter-spacing: 0.02em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 700; }
p { margin: 0 0 14px; color: var(--muted); line-height: 1.62; font-size: 14.5px; }
.topbar { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.topbar > div:first-child { min-width: 0; }
.topbar h2 { overflow-wrap: anywhere; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
button {
  min-height: 46px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
button:active { transform: translateY(1px) scale(0.99); }
/* 主按钮：青铜金描边 + 低饱和金底，如展厅重点操作 */
.primary {
  border-color: rgba(217, 178, 92, 0.7); color: #f6e3b0; font-weight: 700;
  background: linear-gradient(180deg, rgba(217, 178, 92, 0.24), rgba(217, 178, 92, 0.12));
  box-shadow: 0 6px 20px rgba(217, 178, 92, 0.16), inset 0 1px 0 rgba(255, 235, 190, 0.14);
}
.primary:active { background: linear-gradient(180deg, rgba(217, 178, 92, 0.3), rgba(217, 178, 92, 0.16)); }
.secondary { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.demo-skip { border-color: rgba(232, 200, 120, 0.4); color: var(--gold); }
.small { min-height: 36px; font-size: 13px; padding: 0 12px; }
.text-button { margin-top: 10px; min-height: 32px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.floating-reset { position: fixed; right: 10px; top: max(10px, env(safe-area-inset-top)); z-index: 60; padding: 8px 12px; border: 1px solid rgba(255, 120, 120, 0.5); border-radius: 999px; background: rgba(46, 12, 12, 0.85); color: #ffd0d0; font-size: 12px; font-weight: 700; pointer-events: auto; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.floating-reset:active { transform: translateY(1px) scale(0.97); }
/* 面板打开或扫描时隐藏悬浮按钮，避免压住面板按钮 / 扫描 HUD */
body.has-panel .floating-reset, body.is-scanning .floating-reset { display: none; }
.build-badge { position: fixed; left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 60; padding: 5px 10px; border-radius: 999px; background: rgba(13, 20, 32, 0.85); color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.3px; pointer-events: none; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
body.has-panel .build-badge, body.is-scanning .build-badge { display: none; }
.icon-button { width: 38px; min-height: 38px; padding: 0; font-weight: 900; border-radius: 50%; }
.panel-button { min-height: 38px; padding: 0 12px; border-color: rgba(217, 178, 92, 0.5); color: var(--gold); background: rgba(217, 178, 92, 0.1); font-size: 13px; font-weight: 700; white-space: nowrap; }
/* 结局：纯黑全屏展示 */
.ending-panel {
  position: fixed; inset: 0; z-index: 200;
  width: 100vw; max-width: none; height: 100dvh; max-height: none;
  align-self: stretch; justify-content: center; align-items: center; text-align: center;
  gap: 30px; padding: 36px;
  background: radial-gradient(90% 60% at 50% 0%, rgba(217, 178, 92, 0.1), transparent 55%), #05070c !important;
  border: none; border-radius: 0;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--text);
}
.ending-panel .topbar { display: none; }
.ending-panel .kicker { color: rgba(242, 236, 221, 0.5); justify-content: center; }
.ending-panel .kicker::before, .ending-panel .kicker::after { content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.5; }
.ending-panel h2 { color: var(--ink); font-size: 26px; letter-spacing: 2px; }
.ending-panel p { color: rgba(242, 236, 221, 0.82); font-size: 17px; line-height: 1.95; max-width: 22em; margin: 0 auto; }
.ending-panel .primary { background: var(--gold); color: #2a1d04; border-color: var(--gold); }
/* 游戏中实时计时浮层（仅正式版） */
.game-timer {
  position: fixed; top: 12px; right: 12px; z-index: 120;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(13, 20, 32, 0.72); border: 1px solid rgba(217, 178, 92, 0.45);
  color: var(--gold); font-size: 13px; font-weight: 700; pointer-events: none;
  font-variant-numeric: tabular-nums; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.game-timer[hidden] { display: none; }
/* 扫描模式下把计时器移到右下角，避开右上角「退出」按钮，避免界面元素重叠 */
body.is-scanning #gameTimer {
  top: auto;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 64px);
  left: auto;
  right: 12px;
}
/* 结局成就卡 */
.achievement-area { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 340px; }
.achievement-area[hidden] { display: none; }
.achievement-image { width: min(76vw, 300px); height: auto; border-radius: 16px; border: 1px solid rgba(217, 178, 92, 0.5); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65); }
.achievement-hint { color: rgba(242, 236, 221, 0.45); font-size: 12px; line-height: 1.4; }
.player-name-input {
  width: 100%; max-width: 280px; padding: 11px 12px; border-radius: 12px;
  border: 1px solid rgba(217, 178, 92, 0.5); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-size: 15px; text-align: center; outline: none;
}
.player-name-input::placeholder { color: rgba(242, 236, 221, 0.4); }
/* 状态行 / 说明牌 */
.status-line { padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.04); color: var(--gold); line-height: 1.4; overflow-wrap: anywhere; font-size: 13.5px; }
.hint-card { margin: 0; padding: 12px 14px; border: 1px solid rgba(217, 178, 92, 0.4); border-radius: var(--radius-sm); background: var(--accent-soft); overflow-wrap: anywhere; }
.hint-label { margin-bottom: 5px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; }
.puzzle-inline { margin: 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.03); }
.puzzle-question { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; font-family: var(--serif); }
.puzzle-input-row { display: flex; gap: 10px; align-items: stretch; }
.puzzle-input-row .answer-input { flex: 1; }
.direction-hint { margin: 0; padding: 12px 14px; border: 1px dashed rgba(217, 178, 92, 0.5); border-radius: var(--radius-sm); background: rgba(217, 178, 92, 0.07); font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.direction-hint p { margin: 0 0 12px; line-height: 1.5; }
.direction-hint strong { color: var(--gold); font-size: 16px; }
.scan-checklist { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.scan-checklist.compact { margin-top: 0; }
/* 本关目标：展签样式 */
.objective-box { margin: 0; padding: 13px 15px; border: 1px solid rgba(217, 178, 92, 0.4); border-radius: var(--radius-sm); background: linear-gradient(180deg, rgba(217, 178, 92, 0.1), rgba(217, 178, 92, 0.04)); }
.objective-box[hidden] { display: none; }
.objective-label { color: var(--accent); font-size: 11px; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.24em; }
.objective-text { margin: 0; color: var(--text); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; font-family: var(--serif); }
.objective-clues { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.objective-clues img { flex: 1 1 120px; max-width: 220px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.04); }
/* 跳过步骤：仅测试版可见（正式版为通关验证用，不暴露给玩家） */
.demo-skip { display: none; }
body.test-mode .demo-skip { display: inline-block; }
.scan-chip { min-height: 30px; display: inline-flex; align-items: center; padding: 0 11px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, 0.04); font-size: 12px; font-weight: 700; }
.scan-chip.done { border-color: rgba(127, 212, 168, 0.6); color: var(--jade); background: var(--jade-soft); }
/* 第三关常驻线索图廊：退出扫描后仍可反复查看，直到解开密语 */
.clue-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 2px; }
.clue-card { flex: 1 1 84px; max-width: 136px; }
.clue-card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px 12px 0 0; border: 1px solid rgba(217, 178, 92, 0.45); background: rgba(255, 255, 255, 0.04); padding: 6px; display: block; }
.clue-card .clue-cap { margin-top: 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--gold); }
.field-label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
.answer-input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.06); color: var(--text); }
.answer-input:focus { outline: none; border-color: rgba(217, 178, 92, 0.6); }

.scan-layer { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
.scan-hud { position: fixed; z-index: 16; left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); display: flex; gap: 8px; align-items: start; justify-content: space-between; pointer-events: auto; }
.scan-hud .status-line { flex: 1; min-width: 0; padding: 9px 11px; font-size: 13px; background: rgba(10, 16, 25, 0.66); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.scan-actions { display: flex; flex-wrap: wrap; gap: 6px; }
/* 原生摄像头预览（不再依赖 MindAR 的识别相机，避免真机识别失败/相机抢占） */
#scanVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; background: #06090f; pointer-events: none; }
.scan-targets-hint { position: fixed; left: 12px; right: 12px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 104px); text-align: center; color: #f2ecdd; font-size: 13px; font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); z-index: 17; pointer-events: none; }
.scan-targets { position: fixed; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 17; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 0 12px 6px; pointer-events: auto; }
.scan-target { position: relative; width: 76px; padding: 6px; border: 2px solid rgba(217, 178, 92, 0.6); border-radius: 14px; background: rgba(11, 17, 26, 0.78); color: #f2ecdd; text-align: center; font-size: 11px; font-weight: 700; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; }
.scan-target img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, 0.3); display: block; }
.scan-target .scan-target-name { margin-top: 4px; display: block; line-height: 1.2; }
.scan-target.done { border-color: rgba(127, 212, 168, 0.85); opacity: 0.55; }
.scan-target.done::after { content: "✓"; position: absolute; top: 3px; right: 6px; color: var(--jade); font-size: 16px; font-weight: 900; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }

.center-reveal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; align-content: center; gap: 14px; padding: 22px; background: rgba(5, 8, 13, 0.6); }
.center-reveal[hidden] { display: none; }
.center-reveal img { width: min(80vmin, 460px); max-height: 58dvh; object-fit: contain; filter: drop-shadow(0 18px 42px rgba(0, 0, 0, 0.5)); }
.auto-note { padding: 8px 12px; border: 1px solid rgba(127, 212, 168, 0.45); border-radius: 999px; color: var(--jade); background: rgba(8, 13, 20, 0.76); font-size: 13px; font-weight: 700; }
.ending-message { max-width: min(90vw, 520px); padding: 14px 20px; border: 1px solid rgba(232, 200, 120, 0.4); border-radius: 14px; background: rgba(13, 20, 32, 0.96); color: var(--gold); font-size: 15px; font-weight: 600; line-height: 1.55; text-align: center; box-shadow: 0 16px 60px rgba(0, 0, 0, 0.55); font-family: var(--serif); }

.bag-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); background: rgba(5, 8, 13, 0.66); pointer-events: auto; }
.bag-modal[hidden] { display: none; }
.bag-card { width: min(94vw, 560px); max-height: calc(100dvh - 36px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(17, 26, 40, 0.95); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.bag-item { min-width: 0; padding: 11px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); }
.bag-item img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, 0.28); }
.bag-title { margin-top: 8px; color: var(--text); font-weight: 700; font-size: 13px; }
.bag-item p { margin: 5px 0 0; font-size: 12px; line-height: 1.45; }
.bag-send-btn { margin-top: 8px; width: 100%; font-size: 12px; padding: 6px 8px; }
.empty-bag { padding: 18px 0 4px; color: var(--muted); text-align: center; }
.combine-area { margin-top: 14px; padding: 14px; border: 1px dashed rgba(217, 178, 92, 0.5); border-radius: var(--radius-sm); background: rgba(217, 178, 92, 0.07); text-align: center; }
.combine-area[hidden] { display: none; }
.combine-hint { margin: 0 0 10px; color: var(--text); font-size: 14px; }
.combine-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-top: 4px; }
.combine-option { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 2px solid var(--line-soft); border-radius: 12px; background: rgba(255, 255, 255, 0.04); color: var(--text); text-align: center; cursor: pointer; }
.combine-option img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, 0.28); }
.combine-option-name { font-size: 12px; font-weight: 700; }
.combine-option.selected { border-color: rgba(127, 212, 168, 0.85); background: var(--jade-soft); }
.combine-feedback { min-height: 18px; margin-top: 8px; color: #ffb4b4; font-size: 13px; font-weight: 700; }
.combine-actions { margin-top: 10px; }
.combine-actions .primary { width: 100%; }

/* Step-area (步数关) */
.step-area { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(217, 178, 92, 0.06); border: 1px dashed rgba(217, 178, 92, 0.4); text-align: center; }
.step-area[hidden] { display: none; }
.step-meter { margin-bottom: 12px; }
.step-label { font-size: 13px; opacity: 0.8; }
.step-count { font-size: 42px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.step-bar { height: 8px; background: rgba(255, 255, 255, 0.12); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.step-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--jade)); transition: width 0.3s ease; }
.step-hint { font-size: 13px; opacity: 0.85; margin-bottom: 10px; }
.step-fragments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.step-fragment { position: relative; border-radius: 8px; overflow: hidden; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line-soft); padding: 4px; }
.step-fragment img { width: 100%; display: block; border-radius: 4px; opacity: 0.45; transition: opacity 0.3s; }
.step-fragment.claimed img { opacity: 1; }
.step-fragment span { display: block; font-size: 10px; margin-top: 3px; opacity: 0.8; }
.step-fragment-check { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #1a1204; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }

/* Shake-area (摇晃抽签关) */
.shake-area { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(217, 178, 92, 0.06); border: 1px dashed rgba(217, 178, 92, 0.45); text-align: center; }
.shake-area[hidden] { display: none; }
.shake-bucket { width: 160px; height: 160px; margin: 0 auto 10px; border-radius: 50%; background: rgba(0, 0, 0, 0.2); display: flex; align-items: center; justify-content: center; }
.shake-bucket img { max-width: 80%; max-height: 80%; transition: transform 0.15s; }
.shake-bucket.done { animation: bucketPulse 2s infinite ease-in-out; }
@keyframes bucketPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.shake-count { font-size: 18px; font-weight: 700; color: var(--gold); }
.shake-subhint { font-size: 13px; opacity: 0.75; margin: 6px 0 12px; }
.shake-hint { font-size: 13px; opacity: 0.85; margin: 8px 0 12px; }
.shake-result { margin-top: 14px; }
.shake-result img { max-width: 200px; max-height: 180px; border-radius: 8px; }
.shake-result-text { font-size: 18px; font-weight: 700; color: var(--gold); margin-top: 8px; }

.phone-modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); background: rgba(5, 8, 13, 0.74); pointer-events: auto; }
.phone-modal[hidden] { display: none; }
.phone-card { width: min(90vw, 380px); padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: rgba(17, 26, 40, 0.97); box-shadow: 0 26px 90px rgba(0, 0, 0, 0.6); text-align: center; }
.phone-avatar { width: 74px; height: 74px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); border: 1px solid rgba(217, 178, 92, 0.4); font-size: 34px; }
/* 棺材界面上的来电振铃提示（响铃时停留在棺材界面，接通才弹电话） */
.coffin-ring-indicator { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: rgba(17, 26, 40, 0.92); border: 1px solid rgba(217, 178, 92, 0.55); color: var(--ink); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); z-index: 6; pointer-events: none; }
.coffin-ring-indicator[hidden] { display: none; }
.coffin-ring-icon { font-size: 20px; display: inline-block; }
.phone-ringing .coffin-ring-icon { animation: phone-ring 0.8s ease-in-out infinite; }
@keyframes phone-ring {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-14deg); }
  75% { transform: rotate(14deg); }
}
.phone-ringing .coffin-ring-text::after { content: ""; display: inline-block; animation: phone-dots 1.2s steps(4, end) infinite; }
@keyframes phone-dots { 0% { content: ""; } 25% { content: "·"; } 50% { content: "··"; } 75% { content: "···"; } }
.phone-caller { color: var(--ink); font-size: 20px; font-weight: 700; font-family: var(--serif); }
.phone-status { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }
.phone-message { min-height: 56px; margin: 0 0 18px; padding: 13px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 15px; line-height: 1.58; overflow-wrap: anywhere; }
.phone-actions { display: flex; gap: 12px; }
.phone-actions button { flex: 1; min-height: 48px; border-radius: 999px; font-weight: 700; }
.phone-decline { border-color: rgba(255, 120, 120, 0.45); background: rgba(255, 80, 80, 0.13); color: #ffd0d0; }
.phone-answer { border-color: rgba(127, 212, 168, 0.6); background: rgba(127, 212, 168, 0.16); color: #d6ffe8; }
.phone-end { width: 100%; margin-top: 14px; min-height: 44px; border-radius: 999px; border-color: rgba(217, 178, 92, 0.55); background: rgba(217, 178, 92, 0.14); color: #ffe6a8; font-weight: 700; }
.phone-end[hidden] { display: none; }
.phone-progress { margin: 14px 0 0; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.phone-progress[hidden] { display: none; }
.phone-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--jade), var(--accent)); transition: width 200ms linear; }

/* 罗盘：寻宝铜盘 */
.compass { position: relative; width: min(72vmin, 280px); aspect-ratio: 1; margin: 16px auto; border: 1px solid rgba(217, 178, 92, 0.4); border-radius: 50%; background: radial-gradient(circle, rgba(217, 178, 92, 0.16), rgba(255, 255, 255, 0.03)); box-shadow: inset 0 0 40px rgba(217, 178, 92, 0.12); }
.cardinal { position: absolute; color: var(--muted); font-weight: 900; }
.cardinal.n { top: 10px; left: 50%; transform: translateX(-50%); color: var(--accent); }
.cardinal.e { right: 12px; top: 50%; transform: translateY(-50%); }
.cardinal.s { bottom: 10px; left: 50%; transform: translateX(-50%); }
.cardinal.w { left: 12px; top: 50%; transform: translateY(-50%); }
.compass-arrow { position: absolute; left: 50%; top: 50%; width: 8px; height: 54%; transform-origin: 50% 50%; transform: translate(-50%, -50%); border-radius: 999px; background: linear-gradient(var(--accent), #8a6a2c); box-shadow: 0 0 22px rgba(217, 178, 92, 0.6); transition: transform 160ms ease-out; }
.compass-arrow::before { content: ""; position: absolute; left: 50%; top: -15px; transform: translateX(-50%); border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 22px solid var(--accent); }
.compass-target { position: absolute; inset: 0; transform: rotate(0deg); transform-origin: 50% 50%; pointer-events: none; transition: transform 220ms ease-out; }
.compass-target .target-ring { position: absolute; top: 6px; left: 50%; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; border: 2px dashed rgba(232, 200, 120, 0.9); box-shadow: 0 0 16px rgba(232, 200, 120, 0.5); }
.compass-target .target-dot { position: absolute; top: 10px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--gold); border: 2px solid #fff4d7; box-shadow: 0 0 18px rgba(232, 200, 120, 0.95); }
.heading-label { margin: 0; text-align: center; color: var(--text); font-weight: 900; }
.guide-feedback { min-height: 44px; text-align: center; color: var(--gold); line-height: 1.55; overflow-wrap: anywhere; }
.guide-confirm { display: block; width: 100%; padding: 14px; font-size: 17px; border-color: rgba(127, 212, 168, 0.7); background: rgba(127, 212, 168, 0.18); color: #d6ffe8; box-shadow: 0 0 22px rgba(127, 212, 168, 0.24); animation: confirmPulse 1.1s ease-in-out infinite; }
.guide-confirm[hidden] { display: none; }
@keyframes confirmPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@media (prefers-reduced-motion: reduce) { .guide-confirm { animation: none; } }

.diagnostics { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: 12px; max-width: 420px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(10, 16, 25, 0.9); pointer-events: auto; }
.diagnostics-title { color: var(--accent); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.diagnostics dl { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
.diagnostics dt { color: var(--muted); }
.diagnostics dd { margin: 0; overflow-wrap: anywhere; }

.accent { border-color: rgba(217, 178, 92, 0.65); background: rgba(217, 178, 92, 0.16); color: var(--gold); font-weight: 700; }

.video-panel { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; gap: 14px; padding: 16px; background: var(--bg); }
.video-panel[hidden] { display: none; }
.video-panel video { width: 100%; max-width: 960px; max-height: 70dvh; border-radius: var(--radius); background: #000; }

@media (max-width: 680px) {
  .button-row button { flex: 1; }
}

/* 第三关：扫描界面浮现的跟随浮动线索图 */
.floating-clues { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.floating-clue { position: absolute; width: 32vw; max-width: 160px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); border: 2px solid rgba(232, 200, 120, 0.8); background: var(--panel-solid); overflow: hidden; animation: floatBob 3.2s ease-in-out infinite; }
.floating-clue img { display: block; width: 100%; height: auto; }
.floating-clue-cap { padding: 4px 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--gold); background: rgba(0, 0, 0, 0.35); }
.floating-clue:nth-child(1) { left: 6%; top: 14%; animation-delay: 0s; }
.floating-clue:nth-child(2) { right: 6%; top: 38%; animation-delay: .7s; }
.floating-clue:nth-child(3) { left: 50%; bottom: 10%; transform: translateX(-50%); animation: floatBobCenter 3.2s ease-in-out infinite; animation-delay: 1.4s; }
@keyframes floatBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes floatBobCenter { 0%, 100% { transform: translate(-50%, 0) rotate(-2deg); } 50% { transform: translate(-50%, -14px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .floating-clue { animation: none; } }

/* 背包里可点开 3D 的物品 */
.bag-item-openable { cursor: pointer; outline: 2px solid rgba(217, 178, 92, 0.55); }
.bag-item-openable:active { transform: scale(0.98); }
.bag-3d-badge { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 999px; font-size: 12px; color: #1a1204; background: linear-gradient(var(--accent), #a4d4b0); font-weight: 800; }

/* 无头天使签 · 3D 模型弹层 */
.angel3d-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 10px; overflow: auto; background: rgba(4, 8, 14, 0.94); backdrop-filter: blur(6px); }
.angel3d-modal[hidden] { display: none; }
.angel3d-card { width: min(680px, 97vw); max-height: 96dvh; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); overflow: hidden; box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55); }
.angel3d-stage { position: relative; width: 100%; flex: 1 1 auto; min-height: 60dvh; height: 68dvh; background: radial-gradient(120% 90% at 50% 30%, #182430, #0a0f16); }
.angel3d-stage model-viewer { width: 100%; height: 100%; display: block; touch-action: none; --poster-color: transparent; }
.angel3d-stage img.angel3d-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.angel3d-label { padding: 12px 14px 16px; text-align: center; color: var(--text); font-size: 16px; font-weight: 700; letter-spacing: 0.5px; font-family: var(--serif); }

/* 陵墓棺材：model-viewer 弹层，可自由旋转查看底部符文 */
.coffin3d-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 10px; overflow: auto; background: rgba(4, 8, 14, 0.94); backdrop-filter: blur(6px); }
.coffin3d-modal[hidden] { display: none; }
.coffin3d-card { width: min(680px, 97vw); max-height: 96dvh; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); overflow: hidden; box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55); }
.coffin3d-hint { margin: 0; padding: 11px 16px; text-align: center; color: var(--gold); font-size: 14px; font-weight: 600; }
.coffin3d-stage { position: relative; width: 100%; flex: 1 1 auto; min-height: 58dvh; height: 64dvh; background: radial-gradient(120% 90% at 50% 30%, #182430, #0a0f16); }
.coffin3d-stage model-viewer { width: 100%; height: 100%; display: block; touch-action: none; --poster-color: transparent; }
.coffin3d-actions { display: flex; gap: 10px; justify-content: center; padding: 14px 16px 18px; }

/* 日期谜题：日历选择器 */
.date-picker-area { margin-top: 10px; }
.puzzle-clues { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.puzzle-clues img { flex: 1 1 120px; max-width: 220px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.04); }
.calendar-box { padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.25); }
.calendar-controls { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar-nav { min-height: 32px; width: 32px; padding: 0; border-radius: 8px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.07); font-size: 18px; color: var(--text); }
.calendar-month-year { font-weight: 700; color: var(--gold); }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.calendar-weekdays span { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day { min-height: 34px; padding: 0; border-radius: 8px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 14px; }
.calendar-day:disabled { opacity: 0.25; background: transparent; border-color: transparent; }
.calendar-day.selected { border-color: rgba(217, 178, 92, 0.8); background: rgba(217, 178, 92, 0.22); font-weight: 700; }
.calendar-day.today { border-color: rgba(232, 200, 120, 0.55); color: var(--gold); }
.selected-date { margin: 10px 0 6px; text-align: center; font-size: 15px; font-weight: 700; color: var(--accent); min-height: 22px; }

/* 顺序选择题 */
.order-picker-area { margin-top: 10px; }
.order-instruction { margin-bottom: 8px; color: var(--text); font-size: 14px; font-weight: 700; }
.order-slots { display: flex; gap: 8px; margin-bottom: 12px; }
.order-slot { flex: 1; min-height: 44px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-weight: 700; }
.order-slot.filled { border-color: rgba(127, 212, 168, 0.7); background: var(--jade-soft); color: var(--text); }
.order-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.order-option { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; }
.order-option.selected { opacity: 0.45; cursor: not-allowed; }
.order-option.correct { border-color: rgba(127, 212, 168, 0.7); background: var(--jade-soft); }
.order-option.wrong { border-color: rgba(255, 120, 120, 0.6); background: rgba(255, 120, 120, 0.14); }
.order-actions { display: flex; gap: 8px; justify-content: center; }
.order-feedback { min-height: 18px; margin: 2px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.order-feedback.wrong { color: #ff9a9a; }
.order-feedback.correct { color: var(--jade); }

/* 视频奖励弹层 */
.video-reward-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); background: rgba(4, 8, 14, 0.94); backdrop-filter: blur(6px); pointer-events: auto; }
.video-reward-modal[hidden] { display: none; }
.video-reward-card { width: min(94vw, 720px); max-height: calc(100dvh - 36px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-solid); overflow: hidden; box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55); }
.video-reward-card .topbar { padding: 12px 16px 0; }
.video-reward-card video { width: 100%; background: #000; max-height: 60dvh; }
.video-reward-card .button-row { padding: 12px 16px 16px; margin: 0; }

/* NPC 交付（给面具线索） */
.npc-delivery-area { margin-top: 10px; padding: 12px; border: 1px dashed rgba(217, 178, 92, 0.5); border-radius: var(--radius-sm); background: rgba(217, 178, 92, 0.07); text-align: center; }
.npc-delivery-area[hidden] { display: none; }
.npc-delivery-hint { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.npc-delivery-modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); background: rgba(5, 8, 13, 0.74); pointer-events: auto; }
.npc-delivery-modal[hidden] { display: none; }
.npc-delivery-card { width: min(94vw, 520px); max-height: calc(100dvh - 36px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: rgba(17, 26, 40, 0.97); overflow: hidden; box-shadow: 0 26px 90px rgba(0, 0, 0, 0.6); }
.npc-delivery-stage { padding: 16px; text-align: center; }
.npc-avatar { width: 82px; height: 82px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); border: 1px solid rgba(217, 178, 92, 0.4); font-size: 38px; }
.npc-delivery-prompt { margin: 0; font-size: 15px; color: var(--text); line-height: 1.5; }
.npc-delivery-bag { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; padding: 0 16px 16px; overflow: auto; }
.npc-delivery-item { padding: 10px; border: 2px solid var(--line-soft); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); text-align: center; cursor: pointer; }
.npc-delivery-item img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; background: rgba(0, 0, 0, 0.28); }
.npc-delivery-item .bag-title { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.npc-delivery-item:hover, .npc-delivery-item:active { border-color: rgba(217, 178, 92, 0.7); background: rgba(217, 178, 92, 0.12); }
.npc-delivery-feedback { min-height: 24px; padding: 0 16px 16px; text-align: center; font-size: 15px; font-weight: 700; color: var(--gold); }

/* 面具回复浮层（toast）：直接点背包里的物品得到面具反馈，无需中间选择界面 */
.npc-toast {
  position: fixed; left: 50%; bottom: 16%; transform: translateX(-50%) translateY(12px);
  z-index: 80; max-width: min(90vw, 480px); padding: 13px 19px;
  border: 1px solid rgba(217, 178, 92, 0.4); border-radius: 14px;
  background: rgba(17, 26, 40, 0.97); color: var(--gold);
  font-size: 15px; font-weight: 600; line-height: 1.55; text-align: center;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.55);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none;
}
.npc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
