/* =========================================================================
 * style.css — The Sudoku (复刻版)
 * 主题变量 + 布局 + 棋盘 + 控件 + 弹窗 + 响应式
 * ========================================================================= */

/* ------------------------------ 主题变量 ------------------------------ */
:root,
[data-theme='teal'] {
  --accent: hsl(180 45% 25%);
  --accent-lighter: hsl(180 45% 40%);
  --accent-pale: hsl(180 12% 60%);
  --page-bg: #eaf5f5;
  --app-bg: #ffffff;
  --cell-bg: #ffffff;
  --cell-hover: hsl(180 45% 96%);
  --text: hsl(180 45% 20%);
  --muted: hsl(180 12% 42%);
  --given: hsl(180 10% 50%);
  --user: hsl(180 70% 18%);
  --note: hsl(180 22% 42%);
  --line: hsl(180 28% 80%);
  --line-strong: hsl(180 45% 27%);
  --peer-bg: hsl(180 45% 95%);
  --select-bg: hsl(180 55% 87%);
  --same-bg: hsl(180 60% 81%);
  --error-bg: hsl(6 72% 92%);
  --error-text: #b03000;
  --success: hsl(140 55% 36%);
  --panel-border: hsl(180 30% 86%);
  --shadow: rgba(10, 40, 40, 0.16);
}

[data-theme='brownie'] {
  --accent: hsl(20 45% 27%);
  --accent-lighter: hsl(20 45% 42%);
  --accent-pale: hsl(20 15% 60%);
  --page-bg: #f6efe6;
  --app-bg: #fdf9f3;
  --cell-bg: #ffffff;
  --cell-hover: hsl(20 45% 96%);
  --text: hsl(20 45% 20%);
  --muted: hsl(20 15% 42%);
  --given: hsl(20 12% 50%);
  --user: hsl(20 70% 20%);
  --note: hsl(20 22% 42%);
  --line: hsl(20 28% 80%);
  --line-strong: hsl(20 45% 28%);
  --peer-bg: hsl(20 45% 95%);
  --select-bg: hsl(20 55% 87%);
  --same-bg: hsl(20 60% 81%);
  --error-bg: hsl(6 72% 92%);
  --error-text: #b03000;
  --success: hsl(140 55% 36%);
  --panel-border: hsl(20 30% 86%);
  --shadow: rgba(60, 40, 20, 0.16);
}

[data-theme='ocean'] {
  --accent: hsl(205 75% 22%);
  --accent-lighter: hsl(205 70% 40%);
  --accent-pale: hsl(205 20% 58%);
  --page-bg: #e4eef6;
  --app-bg: #ffffff;
  --cell-bg: #ffffff;
  --cell-hover: hsl(205 60% 96%);
  --text: hsl(205 70% 18%);
  --muted: hsl(205 18% 42%);
  --given: hsl(205 12% 50%);
  --user: hsl(205 80% 20%);
  --note: hsl(205 25% 44%);
  --line: hsl(205 28% 80%);
  --line-strong: hsl(205 70% 24%);
  --peer-bg: hsl(205 55% 95%);
  --select-bg: hsl(205 65% 86%);
  --same-bg: hsl(205 70% 80%);
  --error-bg: hsl(6 72% 92%);
  --error-text: #b03000;
  --success: hsl(140 55% 36%);
  --panel-border: hsl(205 30% 86%);
  --shadow: rgba(10, 30, 55, 0.16);
}

[data-theme='monokai'] {
  --accent: hsl(338 95% 56%);
  --accent-lighter: hsl(338 95% 70%);
  --accent-pale: hsl(338 20% 62%);
  --page-bg: #2d2f23;
  --app-bg: #26281e;
  --cell-bg: #1c1f16;
  --cell-hover: #2b2e21;
  --text: hsl(338 60% 90%);
  --muted: hsl(338 18% 66%);
  --given: hsl(54 55% 58%);
  --user: hsl(338 95% 74%);
  --note: hsl(338 25% 68%);
  --line: hsl(338 12% 34%);
  --line-strong: hsl(338 55% 55%);
  --peer-bg: #2b2f21;
  --select-bg: hsl(338 40% 27%);
  --same-bg: hsl(338 45% 33%);
  --error-bg: hsl(0 55% 26%);
  --error-text: hsl(0 90% 76%);
  --success: hsl(80 65% 60%);
  --panel-border: hsl(338 14% 30%);
  --shadow: rgba(0, 0, 0, 0.45);
}

[data-theme='greenight'] {
  --accent: hsl(109 40% 52%);
  --accent-lighter: hsl(109 45% 66%);
  --accent-pale: hsl(109 15% 58%);
  --page-bg: #121212;
  --app-bg: #161816;
  --cell-bg: hsl(100 8% 15%);
  --cell-hover: hsl(100 8% 20%);
  --text: hsl(109 40% 82%);
  --muted: hsl(109 15% 62%);
  --given: hsl(109 12% 58%);
  --user: hsl(109 60% 80%);
  --note: hsl(109 18% 64%);
  --line: hsl(109 10% 30%);
  --line-strong: hsl(109 35% 45%);
  --peer-bg: hsl(100 10% 20%);
  --select-bg: hsl(109 25% 26%);
  --same-bg: hsl(109 30% 32%);
  --error-bg: hsl(0 45% 24%);
  --error-text: hsl(0 85% 76%);
  --success: hsl(88 60% 62%);
  --panel-border: hsl(109 10% 26%);
  --shadow: rgba(0, 0, 0, 0.5);
}

/* ------------------------------ 基础重置 ------------------------------ */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 18px 18px 32px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  color: var(--text);
  background: var(--page-bg);
  text-align: center;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

button:disabled { cursor: not-allowed; opacity: 0.4; }

:focus-visible { outline: 2px solid var(--accent-lighter); outline-offset: 2px; }

/* ------------------------------ 尺寸变量 ------------------------------ */
:root {
  --board-size: min(84vmin, 520px);
  --gap: 12px;
  --radius: 14px;
  --font-scale: calc(var(--board-size) / 9);
}

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto 4px;
}

.brand {
  font-size: clamp(20px, 3.4vmin, 30px);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 1.4em;
  height: 1.4em;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px;
}
.brand-mark span {
  border-radius: 1px;
  background: var(--accent-lighter);
  opacity: 0.35;
}
.brand-mark span:nth-child(1),
.brand-mark span:nth-child(5),
.brand-mark span:nth-child(9) { opacity: 1; }

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

select.difficulty {
  appearance: none;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  background: var(--app-bg);
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 34px 8px 12px;
  cursor: pointer;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  border: 2px solid var(--line-strong);
  color: var(--accent);
  background: var(--app-bg);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease,
    box-shadow 0.15s ease;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.solid { background: var(--accent); color: #fff; }
.btn.solid:hover { background: var(--accent-lighter); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--peer-bg); color: var(--accent); }
.btn.icon-only { padding: 8px; }
.btn svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.subtitle {
  max-width: 880px;
  margin: 16px auto 24px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}

/* ------------------------------ 布局 ------------------------------ */
.stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

/* 左侧竖排按钮（复刻原站风格） */
.rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 18px;
}
.rail .rail-btn {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 12px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--app-bg);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.rail .rail-btn:hover { background: var(--accent); color: #fff; }

/* 中央游戏区 */
.play {
  display: flex;
  align-items: stretch;
  gap: var(--gap);
}

/* ------------------------------ 棋盘 ------------------------------ */
.board-wrap {
  position: relative;
  background: var(--app-bg);
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: 0 10px 26px -14px var(--shadow);
}

.board {
  position: relative;
  width: var(--board-size);
  height: var(--board-size);
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--cell-bg);
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--font-scale) * 0.6);
  font-weight: 600;
  color: var(--user);
  background: var(--cell-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.12s ease;
  overflow: hidden;
}

/* 宫边界加粗 */
.cell.box-right { border-right: 3px solid var(--line-strong); }
.cell.box-bottom { border-bottom: 3px solid var(--line-strong); }

.cell.given { color: var(--given); font-weight: 700; }
.cell.peer { background: var(--peer-bg); }
.cell.same { background: var(--same-bg); }
.cell.selected { background: var(--select-bg); }

.cell.error { background: var(--error-bg); }
.cell.error .value { color: var(--error-text); }

.cell.hinted .value { color: var(--success); }

.cell .value { line-height: 1; transition: transform 0.12s ease; }
.cell .notes {
  position: absolute;
  inset: 6%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-size: 0.34em;
  font-weight: 600;
  color: var(--note);
  line-height: 1;
  pointer-events: none;
}
.cell .notes span {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.cell .notes span.on { opacity: 1; }

/* 冲突脉冲动画 */
@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
:root[data-anim='on'] .cell .value.justset { animation: pop 0.18s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.cell.shake { animation: shake 0.22s ease; }

/* 网格坐标 */
.board.labels { }
.gridlabel {
  position: absolute;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}
.gridlabel.col { top: -14px; transform: translateX(-50%); }
.gridlabel.row { left: -14px; transform: translateY(-50%); }

/* 暂停遮罩 */
.pause-overlay {
  position: absolute;
  inset: 10px;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--app-bg) 82%, transparent);
  backdrop-filter: blur(3px);
}
.pause-overlay.show { display: flex; }
.pause-overlay .big { font-size: 22px; font-weight: 800; letter-spacing: 0.08em; }
.pause-overlay .sub { font-size: 12px; color: var(--muted); }
.pause-overlay svg { width: 42px; height: 42px; stroke: var(--accent); fill: none; stroke-width: 2; }

/* ------------------------------ 右侧控件 ------------------------------ */
.controls {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: calc(var(--font-scale) * 2.5);
  min-width: 70px;
}

.tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  color: var(--accent);
  background: var(--app-bg);
  font-size: 9px;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--accent); color: #fff; }
.tool.active { background: var(--accent); color: #fff; }
.tool:disabled { opacity: 0.35; }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.num {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  color: var(--accent);
  background: var(--app-bg);
  font-size: calc(var(--font-scale) * 0.42);
  font-weight: 700;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.num:hover { background: var(--peer-bg); }
.num.done { opacity: 0.35; }
.num .count {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
}
.num:hover .count { color: currentColor; }

/* ------------------------------ 状态条 ------------------------------ */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 14px auto 0;
  max-width: 1100px;
  font-size: 13px;
}
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
}
.stat b {
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat.mistakes.has b { color: var(--error-text); }
.stat b.over { color: var(--error-text); }

/* 页脚品牌 */
.footer-copy { margin: 0; }
.footer-copy a { color: var(--accent); }

/* ------------------------------ 页脚 ------------------------------ */
footer {
  margin-top: 30px;
  font-size: 12px;
  color: var(--muted);
}
footer a { color: var(--accent); }

/* 更多小游戏（页脚，版权上方） */
.more-games {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  max-width: 880px;
  margin: 0 auto 14px;
  padding: 0 10px;
  font-size: 12px;
}
.more-games-label { color: var(--muted); font-weight: 600; }
.more-games-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 2px solid var(--panel-border);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.more-games-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ------------------------------ 弹窗 ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.45);
}
.modal.show { display: flex; }

.sheet {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  text-align: left;
  background: var(--app-bg);
  border: 2px solid var(--line-strong);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 60px -20px var(--shadow);
}
.sheet h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.sheet .sheet-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.sheet h3 {
  margin: 18px 0 8px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--panel-border);
}
.row:last-child { border-bottom: 0; }
.row .label { font-size: 14px; font-weight: 600; }
.row .desc { font-size: 11px; color: var(--muted); }

.segmented {
  display: inline-flex;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
}
.segmented button {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--app-bg);
  border-right: 1px solid var(--panel-border);
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent); color: #fff; }

/* 开关 */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--app-bg);
  transition: background-color 0.15s ease;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.16s ease;
}
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(20px); background: #fff; }

/* 主题色板 */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.swatch .chip {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.swatch.active .chip { border-color: var(--text); }
.swatch.active { color: var(--text); }

.chip-teal { background: linear-gradient(135deg, #235c5c, #dff0ef); }
.chip-brownie { background: linear-gradient(135deg, #6b4c28, #f6ede0); }
.chip-ocean { background: linear-gradient(135deg, #14496b, #dbeaf5); }
.chip-monokai { background: linear-gradient(135deg, #f92672, #1c1f16); }
.chip-greenight { background: linear-gradient(135deg, #4a7a3e, #121212); }

/* 弹窗底部按钮 */
.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

textarea, input[type='text'], input[type='email'] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--cell-bg);
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 11px;
  margin-top: 6px;
}
textarea { min-height: 96px; resize: vertical; }

.howto p { font-size: 14px; line-height: 1.7; color: var(--text); margin: 0 0 12px; }
.howto .tip { color: var(--muted); font-size: 13px; }

/* 胜利弹窗 */
.win-sheet { text-align: center; }
.win-sheet .trophy { font-size: 46px; line-height: 1; }
.win-sheet h2 { margin-top: 8px; }
.win-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 18px 0 6px;
}
.win-stats .item { display: flex; flex-direction: column; gap: 2px; }
.win-stats .item b { font-size: 20px; font-variant-numeric: tabular-nums; }
.win-stats .item span { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.best-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.best-badge[hidden] { display: none; }
.best-badge.missed { background: var(--muted); }

/* 通关后自动下一局 */
.autonext {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
.autonext[hidden] { display: none; }
.autonext .btn { padding: 4px 10px; font-size: 12px; }

/* 目标时间设置 */
.hint-line {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.target-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; }
.target-row { display: flex; align-items: center; gap: 8px; }
.target-row label { font-size: 13px; font-weight: 600; min-width: 62px; }
.target-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--cell-bg);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 8px;
  margin: 0;
}

/* 成绩记录工具栏 */
.records-tools { display: flex; gap: 8px; margin-top: 10px; }
.records-tools .btn { padding: 5px 12px; font-size: 12px; }

/* 成绩记录表 */
.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.records-table th,
.records-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--panel-border);
}
.records-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.records-table td.n { font-variant-numeric: tabular-nums; }
.records-table tr.is-best td { color: var(--accent); font-weight: 700; }
.records-empty { font-size: 13px; color: var(--muted); padding: 4px 0 2px; }

/* ------------------------------ 轻提示 ------------------------------ */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 60;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px -12px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.snackbar.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 860px) {
  .rail { display: none; }
}

@media (max-width: 780px) {
  :root { --board-size: min(92vmin, 520px); }
  body { padding: 12px 10px 26px; }
  .stage { gap: 10px; }
  .play { flex-direction: column; align-items: center; gap: 12px; }
  .controls { width: var(--board-size); flex-direction: column; }
  .tools { grid-template-columns: repeat(4, 1fr); }
  .numpad { width: min(70%, 280px); margin: 0 auto; }
  .num { font-size: calc(var(--font-scale) * 0.52); }
  .topbar { justify-content: center; }
  .brand { margin-right: 0; width: 100%; justify-content: center; }
}

/* 打印 */
@media print {
  body { background: #fff; padding: 0; }
  .topbar, .rail, .controls, .stats, footer, .subtitle { display: none !important; }
  .board-wrap { box-shadow: none; padding: 0; }
  .cell.peer, .cell.same, .cell.selected { background: transparent !important; }
}
