/* 黑白翻转 · 翡翠绿绒棋桌 + 黄铜秤台
   结构：上下夹持（Vertical Clamp）—— 仪表在上、被测物居中、操作在下，完全没有侧栏。
   材质：拉丝黄铜 / 深胡桃木 / 绿绒台面 / 黑曜石与月白玉；标记一律无边界径向柔光。
   避开的老套网页病：四角散落浮动按钮 / 右侧 SaaS 白卡堆叠 / 死白或死黑大平铺。 */

:root {
  /* 黄铜 */
  --brass-hi: #f6e4ac;
  --brass: #c9a227;
  --brass-mid: #a1811c;
  --brass-deep: #6d5411;
  /* 深胡桃木 */
  --wood: #4a2c14;
  --wood-deep: #24140a;
  /* 翡翠绿绒 */
  --baize-hi: #1d8055;
  --baize: #0f5c3a;
  --baize-deep: #072a1b;
  /* 黑白棋子 */
  --obsidian-hi: #6f6f7c;
  --obsidian: #16161b;
  --moon-hi: #ffffff;
  --moon: #f5eddb;
  --moon-sh: #ada288;
  /* 文字与面板 */
  --ink: #f6eeda;
  --ink-dim: #c7bda2;
  --panel-face: linear-gradient(168deg, #1c3527 0%, #10231a 58%, #0a1710 100%);
  --panel-line: rgba(201, 162, 39, 0.42);
  --warm-glow: 255, 214, 120;
  --cool-glow: 150, 210, 255;
  --trap-glow: 214, 96, 84;
  /* 几何 */
  --radius: 12px;
  --radius-sm: 7px;
  --cell-gap: 2px;
  --shadow-deep: 0 10px 26px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.32);
  /* 缓动契约：一半时间必须完成 ≤72% 的位移（见 tests/layout.test.mjs 的实算护栏）。
     原候选 cubic-bezier(0.34, 0.72, 0.4, 1) 在 50% 处已完成 86.8% —— 那是"抢跑"，
     手感上表现为"一瞬间就到位、剩下时间干等"，加时长完全无效。 */
  --ease-key: cubic-bezier(0.3, 0.35, 0.4, 0.85);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

/* 弹层与开关一律靠 [hidden] 兜底，杜绝"关了还挡着画面" */
[hidden],
.layer[hidden],
.seg[hidden],
.key[hidden],
.tag[hidden],
#rush-plate[hidden],
#result-report[hidden],
#result-next[hidden],
#result-stars[hidden],
#report-note[hidden] {
  display: none !important;
}

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(29, 128, 85, 0.5) 0%, rgba(10, 35, 24, 0) 70%),
    radial-gradient(ellipse 120% 80% at 50% 45%, #123a29 0%, #0a1f16 55%, #061109 100%);
  background-attachment: fixed;
}

.noscript {
  margin: 0;
  padding: 18px 16px;
  background: var(--brass-deep);
  color: var(--ink);
  text-align: center;
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 机台骨架 ─────────────────────────────────────────────────── */
.cabinet {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 12px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

/* ── 顶栏：返回 / 标题 / 工具，一体化收纳，绝不四角散落 ─────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: linear-gradient(180deg, #1b3325 0%, #0d1e15 100%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(246, 228, 172, 0.16);
}

.bar-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brass-hi);
  background: transparent;
  border: 1px solid var(--brass-deep);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  cursor: pointer;
  letter-spacing: 0.4px;
  transition: background 0.16s ease, color 0.16s ease, transform 0.1s ease;
}
.bar-btn:hover { background: var(--brass); color: #16261c; }
.bar-btn:active { transform: translateY(2px); }

.bar-back { text-decoration: none; white-space: nowrap; }

.title-block { flex: 1; min-width: 0; text-align: center; }
.title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.subtitle {
  margin: 1px 0 0;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--brass);
  opacity: 0.9;
}

.topbar-tools { display: flex; gap: 6px; }
.topbar-tools .bar-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; }

/* ── ① 顶部黄铜天平横梁 ───────────────────────────────────────── */
.beam-panel {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background:
    linear-gradient(180deg, rgba(246, 228, 172, 0.09) 0%, rgba(0, 0, 0, 0) 40%),
    var(--panel-face);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(246, 228, 172, 0.22);
  padding: 12px 14px 10px;
}

.beam-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.pan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.06) 100%);
  border: 1px solid rgba(201, 162, 39, 0.26);
}
.pan-plate {
  display: block;
  width: 46px; height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 45%, var(--brass-deep) 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.pan-count {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: var(--brass-hi);
  text-shadow: 0 0 12px rgba(var(--warm-glow), 0.35);
}
.pan-white .pan-count { color: var(--moon-hi); text-shadow: 0 0 12px rgba(255, 255, 255, 0.28); }
.pan-name { font-size: 10px; letter-spacing: 2px; color: var(--ink-dim); }

/* 横梁：正角 = 左端抬起、右端下沉。符号约定见 render.mjs 的 beamAngle 注释。 */
.balance {
  position: relative;
  width: 132px;
  height: 62px;
}
.balance-post {
  position: absolute;
  left: 50%; bottom: 4px;
  width: 8px; height: 40px;
  margin-left: -4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brass-deep) 0%, var(--brass-hi) 40%, var(--brass-deep) 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
}
.balance-arc {
  position: absolute;
  left: 12px; top: 6px;
  width: 108px; height: 44px;
  border-top: 1px dashed rgba(201, 162, 39, 0.42);
  border-radius: 108px 108px 0 0;
}
.beam {
  position: absolute;
  left: 2px; top: 14px;
  width: 128px; height: 12px;
  transform-origin: 50% 50%;
  transition: transform 0.5s var(--ease-key);
}
.beam-bar {
  display: block;
  width: 100%; height: 9px;
  margin-top: 1.5px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 42%, var(--brass-mid) 70%, var(--brass-deep) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.beam-pivot {
  position: absolute;
  left: 50%; top: 0;
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi) 0%, var(--brass) 45%, var(--brass-deep) 100%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
/* 跨越中点的那一瞬：横梁抖一下（由 UI 加类，谁加谁收） */
.beam.is-bump { animation: beamBump 0.42s ease-out; }
@keyframes beamBump {
  0% { transform: rotate(var(--beam-deg, 0deg)); }
  22% { transform: rotate(calc(var(--beam-deg, 0deg) - 1.8deg)); }
  55% { transform: rotate(calc(var(--beam-deg, 0deg) + 1.1deg)); }
  100% { transform: rotate(var(--beam-deg, 0deg)); }
}

.beam-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}
.tag {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 终局预报铜牌：空位 > 14 时整块不出现（PRD 定案 2A 的硬约束）。
   data-state="off" 时不仅清空文案，还要彻底失去"可点"的外观。 */
.tag-forecast {
  font-family: inherit;
  cursor: default;
  color: var(--ink-dim);
  border-color: rgba(201, 162, 39, 0.18);
  opacity: 0.45;
}
.tag-forecast[data-state="off"] { pointer-events: none; }
.tag-forecast[data-state="ready"] {
  cursor: pointer;
  color: #201703;
  border-color: var(--brass-hi);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 60%, var(--brass-mid) 100%);
  box-shadow: 0 0 14px rgba(var(--warm-glow), 0.55);
  opacity: 1;
  animation: forecastLight 0.6s ease-out;
}
@keyframes forecastLight {
  0% { opacity: 0.3; box-shadow: 0 0 0 rgba(var(--warm-glow), 0); }
  100% { opacity: 1; box-shadow: 0 0 14px rgba(var(--warm-glow), 0.55); }
}

.tag-rush { color: var(--brass-hi); border-color: var(--brass-mid); }

/* 子数曲线：横轴固定 60 手向右生长，上半黑、下半白 */
.graph {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 9px;
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(90deg, rgba(201, 162, 39, 0.1) 0 1px, rgba(0, 0, 0, 0) 1px 12px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.34) 0%, rgba(0, 0, 0, 0.16) 100%);
  border: 1px solid rgba(201, 162, 39, 0.18);
}
.graph-axis { stroke: rgba(201, 162, 39, 0.4); stroke-width: 0.4; stroke-dasharray: 2 2; }
.graph-black { fill: none; stroke: var(--obsidian-hi); stroke-width: 1.4; stroke-linejoin: round; }
.graph-white { fill: none; stroke: var(--moon); stroke-width: 1.4; stroke-linejoin: round; }

/* ── ② 中央舞台：绿绒台面 + 胡桃木外框 + 四角黄铜包角 ─────────── */
.board-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  touch-action: none;
  overscroll-behavior: none;
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(246, 228, 172, 0.14) 0%, rgba(0, 0, 0, 0) 45%),
    linear-gradient(160deg, var(--wood) 0%, var(--wood-deep) 100%);
  box-shadow:
    var(--shadow-deep),
    inset 0 1px 0 rgba(246, 228, 172, 0.28),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6);
}

/* 四角黄铜包角：绝对定位必须显式给 left/top，否则在无定位父级下会整只跑掉 */
.corner {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid var(--brass);
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(var(--warm-glow), 0.28);
  pointer-events: none;
}
.corner-tl { left: 5px; top: 5px; border-right: none; border-bottom: none; }
.corner-tr { right: 5px; top: 5px; border-left: none; border-bottom: none; }
.corner-bl { left: 5px; bottom: 5px; border-right: none; border-top: none; }
.corner-br { right: 5px; bottom: 5px; border-left: none; border-top: none; }

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: var(--cell-gap);
  aspect-ratio: 1 / 1;
  padding: 6px;
  border-radius: 9px;
  touch-action: none;
  overscroll-behavior: none;
  background:
    radial-gradient(ellipse 78% 70% at 50% 26%, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0) 62%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.13) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
    linear-gradient(180deg, var(--baize-hi) 0%, var(--baize) 46%, var(--baize-deep) 100%);
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.cell {
  position: relative;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: default;
  transition: background-image 0.18s ease;
  /* 格线是"绒布被压出网格"的暗纹，不是描边 */
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.22), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}
.cell:disabled { cursor: default; }

/* 合法落点：无边界径向柔光点（严禁硬边描边圈） */
.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(246, 228, 172, 0) 0%, rgba(246, 228, 172, 0) 100%);
  transition: background-image 0.18s ease;
  pointer-events: none;
}
.cell.is-legal::after {
  background: radial-gradient(circle at 50% 50%, rgba(246, 228, 172, 0.82) 0%, rgba(246, 228, 172, 0.42) 30%, rgba(246, 228, 172, 0) 62%);
}
/* 对手可落点（机动性光环）：冷色，落在格子四角，与中心暖点天然错开 */
.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
.cell.is-threat::before {
  background: radial-gradient(circle at 50% 50%, rgba(var(--cool-glow), 0.5) 0%, rgba(var(--cool-glow), 0.18) 42%, rgba(var(--cool-glow), 0) 76%);
}
/* 悬停预演：这一手会把哪些子翻过来 */
.cell.is-preview::before {
  background: radial-gradient(circle at 50% 50%, rgba(246, 228, 172, 0.6) 0%, rgba(246, 228, 172, 0.22) 48%, rgba(246, 228, 172, 0) 82%);
  animation: previewPulse 1.1s ease-in-out infinite;
}
/* 提示：格子底色泛暖金，占用 background 通道，与两个伪元素互不打架 */
.cell.is-hint {
  background-image: radial-gradient(circle at 50% 50%, rgba(var(--warm-glow), 0.72) 0%, rgba(var(--warm-glow), 0.22) 46%, rgba(var(--warm-glow), 0) 78%);
  animation: hintPulse 1.4s ease-in-out infinite;
}
.cell.is-last .disc {
  filter: drop-shadow(0 0 4px rgba(var(--warm-glow), 0.9));
}

/* 圆片：外层的 .disc 承担落子入位与翻面，两层 .face 靠 backface-visibility 换面 */
.disc {
  position: absolute;
  inset: 6%;
  transform-style: preserve-3d;
  opacity: 0;
  filter: brightness(1.4);
  transform: rotateY(var(--deg, 0deg));
  transition: opacity 0.14s ease-out, filter 0.2s ease-out, transform 0.28s ease-in-out;
  pointer-events: none;
}
.cell[data-disc] .disc { opacity: 1; filter: none; }
.cell[data-disc="black"] .disc { --deg: 0deg; }
.cell[data-disc="white"] .disc { --deg: 180deg; }

.face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
}
/* 黑曜石：高光更锐、更小（色觉障碍玩家也能靠高光判色） */
.face-black {
  background:
    radial-gradient(circle at 33% 26%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 26%),
    radial-gradient(circle at 50% 50%, var(--obsidian-hi) 0%, var(--obsidian) 42%, #08080a 100%);
}
/* 月白玉：高光更大更柔，且带一圈内反射 */
.face-white {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 38% 30%, var(--moon-hi) 0%, rgba(255, 255, 255, 0) 48%),
    radial-gradient(circle at 50% 50%, var(--moon) 0%, #e6dcc4 58%, var(--moon-sh) 100%);
}

/* 得角 / 踩陷阱：一次性柔光，类由 ui 的调度器负责收尾 */
.cell.flash-corner { animation: flashCorner 0.95s ease-out; }
@keyframes flashCorner {
  0% { box-shadow: inset 0 0 24px rgba(var(--warm-glow), 0.9); }
  100% { box-shadow: inset 0 0 0 rgba(var(--warm-glow), 0); }
}
.cell.flash-trap { animation: flashTrap 0.9s ease-out; }
@keyframes flashTrap {
  0% { box-shadow: inset 0 0 22px rgba(var(--trap-glow), 0.8); }
  100% { box-shadow: inset 0 0 0 rgba(var(--trap-glow), 0); }
}

@keyframes previewPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.status {
  margin: 0;
  min-height: 20px;
  font-size: 13px;
  letter-spacing: 1.2px;
  color: var(--brass-hi);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* ── ③ 底部黄铜仪表条：机械按键 ──────────────────────────────── */
.instrument-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background:
    linear-gradient(180deg, rgba(246, 228, 172, 0.1) 0%, rgba(0, 0, 0, 0) 42%),
    var(--panel-face);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(246, 228, 172, 0.2);
}
.instrument-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.seg-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}
.seg {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.24) 100%);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.seg:hover { color: var(--ink); border-color: var(--brass); }
.seg[aria-pressed="true"] {
  color: #201703;
  border-color: var(--brass-hi);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 62%, var(--brass-mid) 100%);
  box-shadow: 0 0 10px rgba(var(--warm-glow), 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* 黄铜机械按键：微浮雕 + 悬停轻浮 + 按下机械下沉 */
.key {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: #201703;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brass-deep);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 46%, var(--brass-mid) 100%);
  box-shadow: 0 3px 0 var(--brass-deep), 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transform: translateY(0);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.16s ease;
}
.key:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--brass-deep), 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brass-deep), 0 2px 5px rgba(0, 0, 0, 0.4); }
.key:disabled {
  cursor: default;
  filter: grayscale(0.5) brightness(0.68);
  transform: translateY(0);
  box-shadow: 0 2px 0 var(--brass-deep), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.key-primary { color: #14210f; }
.key-danger {
  color: var(--ink);
  background: linear-gradient(180deg, #8d3b30 0%, #6d2a22 60%, #4d1c16 100%);
  border-color: #3d150f;
  box-shadow: 0 3px 0 #3d150f, 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.key-danger:hover { box-shadow: 0 5px 0 #3d150f, 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22); }

/* ── 弹层：铜牌面板，不是白色弹窗 ────────────────────────────── */
.layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(4, 12, 8, 0.72) 0%, rgba(3, 8, 5, 0.92) 100%);
}
.layer-panel {
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 16px 18px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel-face);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(246, 228, 172, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.layer-panel h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 3px;
  color: var(--brass-hi);
  text-align: center;
}
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 2px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--brass);
  text-transform: uppercase;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-dim);
  cursor: pointer;
}
.check input { accent-color: var(--brass); width: 15px; height: 15px; }
#volume-range { width: 100%; accent-color: var(--brass); }
.record-line {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* 结算档案卡 */
.result-badge {
  margin: 0;
  text-align: center;
  font-size: 34px;
  line-height: 1;
}
.result-score {
  margin: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--brass-hi);
  font-variant-numeric: tabular-nums;
}
.result-stars {
  margin: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 5px;
  color: var(--brass);
}
.report {
  border-top: 1px solid rgba(201, 162, 39, 0.24);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report h3 {
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--brass);
  text-transform: uppercase;
  font-weight: 600;
}
.report-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-dim);
}
.report-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.report-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--brass-hi);
  text-align: center;
  letter-spacing: 1px;
}

.rules-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-dim);
}

/* 选关：6 章 × 10 题 */
.levels-panel { max-width: 520px; }
.levels-total {
  margin: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.levels-grid { display: flex; flex-direction: column; gap: 12px; }
.chapter-block { display: flex; flex-direction: column; gap: 6px; }
.chapter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chapter-name { font-size: 13px; color: var(--brass-hi); letter-spacing: 1.5px; }
.chapter-progress { font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.chapter-desc { margin: 0; font-size: 11px; line-height: 1.5; color: var(--ink-dim); opacity: 0.85; }
.cells-row { display: flex; flex-wrap: wrap; gap: 5px; }
.level-cell {
  font-family: inherit;
  width: 42px;
  padding: 5px 0 4px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.28) 100%);
  color: var(--ink-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: background 0.16s ease, transform 0.1s ease;
}
.level-cell:hover { border-color: var(--brass); color: var(--ink); }
.level-cell:active { transform: translateY(1px); }
.level-cell .lv-id { font-size: 11px; font-weight: 600; }
.level-cell .lv-stars { font-size: 9px; letter-spacing: 1px; color: var(--brass); }
.level-cell.is-solved { border-color: var(--brass); }
.level-cell.is-locked { filter: grayscale(0.7) brightness(0.62); cursor: default; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(84px, calc(30px + env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  z-index: 60;
  margin: 0;
  padding: 8px 16px;
  max-width: 88vw;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--ink);
  border-radius: 999px;
  border: 1px solid var(--panel-line);
  background: rgba(12, 30, 21, 0.94);
  box-shadow: var(--shadow-deep);
  text-align: center;
}

/* ── 响应式：移动端压缩为细长 HUD，底部严格留出广告避让区 ───────── */
@media (max-width: 768px) {
  .cabinet {
    padding: 8px 8px max(68px, calc(16px + env(safe-area-inset-bottom)));
    gap: 9px;
  }
  .title { font-size: 16px; letter-spacing: 3px; }
  .subtitle { display: none; }
  .back-home { padding: 5px 8px; }
  .beam-panel { padding: 9px 10px 8px; }
  .balance { width: 104px; height: 52px; }
  .balance-arc { left: 8px; top: 6px; width: 88px; height: 36px; }
  .beam { left: 2px; top: 12px; width: 100px; height: 11px; }
  .pan-count { font-size: 18px; }
  .pan-plate { width: 34px; }
  .graph { height: 38px; }
  .board-frame { padding: 10px; }
  .corner { width: 20px; height: 20px; }
  .key { padding: 9px 12px; font-size: 12px; }
  .toast { bottom: max(76px, calc(24px + env(safe-area-inset-bottom))); }
}

@media (min-width: 900px) {
  /* 桌面端：核心舞台居中，两侧只留环境光，天然躲开侧栏广告 */
  .cabinet { max-width: 820px; padding-top: 20px; }
  .board-frame { max-width: 600px; }
}

/* ── 动效降级：只去动画，绝不 display:none 任何核心交互件 ──────── */
@media (prefers-reduced-motion: reduce) {
  .beam,
  .disc,
  .cell,
  .key,
  .seg,
  .bar-btn,
  .level-cell,
  .cell::after,
  .cell::before {
    transition-duration: 0.001ms !important;
  }
  .cell.is-preview::before,
  .cell.is-hint,
  .beam.is-bump,
  .cell.flash-corner,
  .cell.flash-trap,
  .tag-forecast[data-state="ready"] {
    animation: none !important;
  }
}
