/* =============================================================
   数独 · 样式表
   设计基调：暖纸色背景 + 白瓷棋盘 + 墨色线条，数字用等宽字形
   ============================================================= */

:root {
  --bg: #f2efe8;
  --bg-glow: #fdfcfa;
  --surface: #ffffff;

  --ink: #1c1f23;
  --ink-soft: #4d545c;
  --ink-mute: #8b9099;

  --line: #e2ded6;
  --line-strong: #363b41;
  --hair: #ece8e0;

  --accent: #14655c;
  --accent-dark: #0e4d46;
  --accent-soft: #e3efec;

  --user-ink: #1a63d6;
  --hint-ink: #0f7a63;

  --peer: #f4f6f5;
  --same: #e3efe9;
  --sel: #cbe4dd;

  --error: #bf3b2c;
  --error-bg: #fbe9e6;

  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(28, 31, 35, .05);
  --shadow-md: 0 2px 4px rgba(28, 31, 35, .05), 0 14px 34px -14px rgba(28, 31, 35, .22);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  padding: 36px 24px 48px;
  background:
    radial-gradient(900px 480px at 12% -12%, var(--bg-glow) 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(700px 400px at 100% 0%, #f7f4ee 0%, rgba(255, 255, 255, 0) 55%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* margin:auto 让内容在空间中垂直居中；空间不足时自动退化为顶部对齐 */
.app { width: 100%; max-width: 824px; margin: auto; }

/* ---------------------------- 顶部 ---------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  box-shadow: 0 6px 16px -8px rgba(14, 77, 70, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.brand-text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.15;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 10px;
  letter-spacing: .32em;
  color: var(--ink-mute);
  font-weight: 500;
}

.masthead-actions { display: flex; align-items: center; gap: 10px; }

/* 下拉框 */
.select-wrap { position: relative; display: flex; align-items: center; }

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 34px 10px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.select-wrap select:hover { border-color: #cfc9be; }
.select-wrap select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.select-caret {
  position: absolute;
  right: 11px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink-mute);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* 按钮 */
.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, transform .1s ease, color .16s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(20, 101, 92, .95), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover { background: rgba(255, 255, 255, .7); border-color: #cfc9be; color: var(--ink); }

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

/* ---------------------------- 布局 ---------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 540px) 248px;
  gap: 36px;
  justify-content: space-between;
  align-items: start;
}

.stage { min-width: 0; }

/* 状态条 */
.hud {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.hud-item { display: flex; flex-direction: column; gap: 2px; }

.hud-label {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--ink-mute);
  font-weight: 500;
}

.hud-value {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  line-height: 1.2;
}

.hud-value.muted { color: var(--ink-mute); font-weight: 500; }

.pause-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
}

.pause-btn .ico { width: 14px; height: 14px; fill: currentColor; stroke: none; }

/* ---------------------------- 棋盘 ---------------------------- */

.board-frame { position: relative; }

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-family: inherit;
  font-size: clamp(17px, 4.4vw, 27px);
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
  transition: background-color .13s ease;
  -webkit-tap-highlight-color: transparent;
}

/* 去掉最外圈多余的线 */
.cell[data-col="8"] { border-right: 0; }
.cell[data-row="8"] { border-bottom: 0; }

/* 3×3 宫的粗分隔线 */
.cell[data-col="2"], .cell[data-col="5"] { border-right: 2px solid var(--line-strong); }
.cell[data-row="2"], .cell[data-row="5"] { border-bottom: 2px solid var(--line-strong); }

/* --- 背景高亮：顺序即优先级 --- */
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.selected { background: var(--sel); box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }

.cell .cell-value {
  display: block;
  transform: translateY(.01em);
  transition: color .15s ease;
}

.cell.given .cell-value { color: var(--ink); font-weight: 600; }
.cell.filled .cell-value { color: var(--user-ink); font-weight: 500; }
.cell.hinted .cell-value { color: var(--hint-ink); font-weight: 600; }

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

/* 铅笔笔记 */
.cell .notes {
  position: absolute;
  inset: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}

.cell .notes i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: clamp(7px, 1.55vw, 10.5px);
  font-weight: 500;
  color: var(--ink-mute);
  line-height: 1;
}

.cell .notes[hidden] { display: none; }

/* 填入 / 出错的小动效 */
@keyframes pop-in {
  0% { transform: scale(.68); opacity: .35; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-3px); }
  46% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
  88% { transform: translateX(1px); }
}

.cell.pop .cell-value { animation: pop-in .18s cubic-bezier(.2, .9, .3, 1.2); }
.cell.shake { animation: shake-x .3s ease; }

/* 动画挂在数字本身，避免被重绘覆盖 */
.cell-value.pop { animation: pop-in .18s cubic-bezier(.2, .9, .3, 1.2); }
.cell-value.shake { animation: shake-x .3s ease; }

/* ---------------------------- 遮罩 ---------------------------- */

.board-mask {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 10px;
  background: rgba(250, 249, 246, .84);
  -webkit-backdrop-filter: blur(7px) saturate(120%);
  backdrop-filter: blur(7px) saturate(120%);
  animation: fade-in .22s ease;
}

.board-mask.hidden { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mask-card {
  text-align: center;
  animation: rise-in .28s cubic-bezier(.2, .8, .3, 1);
}

.mask-eyebrow {
  margin: 0 0 8px;
  font-size: 9.5px;
  letter-spacing: .34em;
  font-weight: 600;
  color: var(--accent);
}

.mask-title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .04em;
}

.mask-sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--ink-mute);
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 16px;
  border: 2.5px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 胜利面板 */
#win-tech { margin: 2px 0 0; }

.win-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 22px 0 10px;
}

.win-stats > div { display: flex; flex-direction: column; gap: 4px; }

.win-num {
  font-size: 21px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.win-cap { font-size: 10px; letter-spacing: .16em; color: var(--ink-mute); }

.win-note {
  min-height: 18px;
  margin: 6px 0 20px;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
}

.win-actions { display: flex; justify-content: center; gap: 8px; }

/* ---------------------------- 侧栏 ---------------------------- */

.side { display: flex; flex-direction: column; gap: 18px; padding-top: 50px; }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.key {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 21px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s ease, color .14s ease, transform .1s ease, background-color .14s ease;
  -webkit-tap-highlight-color: transparent;
}

.key:hover { border-color: var(--accent); color: var(--accent-dark); background: #fbfdfc; }
.key:active { transform: scale(.96); }
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.key-count {
  position: absolute;
  right: 5px;
  bottom: 3px;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-mute);
  line-height: 1;
}

.key.exhausted { opacity: .38; }

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

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tool .ico {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool:hover { border-color: #cfc9be; background: rgba(255, 255, 255, .65); color: var(--ink); }

.tool.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px -9px rgba(20, 101, 92, .95);
}

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

.tips {
  margin: 0;
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-mute);
  letter-spacing: .01em;
}

/* ---------------------------- 教学 ---------------------------- */

.coach {
  margin-top: 14px;
  padding: 14px 16px 15px;
  border: 1px solid #d6e4df;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fcfb 0%, #ffffff 78%);
  box-shadow: var(--shadow-sm);
  animation: rise-in .24s cubic-bezier(.2, .8, .3, 1);
}

.coach.hidden { display: none; }

.coach-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }

.coach-badge {
  padding: 2.5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

.coach-stage { font-size: 9.5px; color: var(--ink-mute); letter-spacing: .14em; }

.coach-close {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.coach-close:hover { background: var(--hair); color: var(--ink); }

.coach-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.coach-text b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-weight: 600;
}
.coach-text code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: .92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.coach-actions { display: flex; gap: 8px; }

.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ---- 推导链：一次提示可能要先排除几处才能落子，逐条摊开 ---- */
.coach-chain {
  margin: 0 0 11px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* 链条可能有七八步，不封顶会把下面的结论和「填入」按钮顶出屏幕 */
  max-height: 34vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 2px;
}

/* 链条上的每一项都是一级台阶：点条目 = 看这一步，点「原理」= 翻手册 */
.coach-chain li {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border-radius: 9px;
  transition: background .15s ease;
}

.coach-chain li:hover { background: #f7f5f0; }
.coach-chain li.on { background: var(--accent-soft); }
.coach-chain li.on:hover { background: var(--accent-soft); }

.chain-main {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  padding: 5px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.chain-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

.chain-wiki {
  flex: none;
  align-self: center;
  margin-right: 5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.chain-wiki:hover { border-color: var(--accent); background: var(--accent-soft); }

.chain-wiki.off {
  border-color: transparent;
  background: transparent;
  color: #b9bcc1;
  cursor: default;
}

.chain-no {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--hair);
  color: var(--ink-mute);
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.coach-chain li.on .chain-no { background: var(--accent); color: #fff; }

.chain-body {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.62;
  color: var(--ink-soft);
}

.chain-body em {
  font-style: normal;
  margin-right: 5px;
  color: var(--accent-dark);
  font-weight: 600;
}

/* ---- 结论行：一眼看到「哪一格＝几」 ---- */
.coach-result {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--accent-soft);
}

.res-cell {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.res-eq { font-size: 12px; color: var(--ink-mute); }

.res-num {
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.res-note { font-size: 11.5px; color: var(--ink-soft); }

/* ---- 教学候选数浮层：推理涉及的格子摊开成候选数，被排除的划掉 ---- */
.cell.coach-cand .notes i {
  color: #3f4850;
  font-weight: 600;
}

.cell.coach-cand .notes i.gone {
  color: var(--error);
  text-decoration: line-through;
  opacity: .62;
}

/* 棋盘上的教学高亮：outline 不参与布局，内缩避开格线
   三层语义：淡黄底=相关范围 / 琥珀实线=证据 / 蓝色虚线=结论 */
.cell.coach-unit { background: rgba(207, 139, 43, .07); }

.cell.coach-mark {
  outline: 2px solid #cf8b2b;
  outline-offset: -3px;
  background: rgba(207, 139, 43, .13);
  z-index: 3;
}

.cell.coach-mark.pivot {
  outline-color: #b0552c;
  outline-width: 2.5px;
}

/* 目标格用呼吸式描边，和「普通选中」的静止实线区分开 */
.cell.coach-place {
  outline: 3px solid var(--accent);
  outline-offset: -4px;
  background: #e3f2ee;
  z-index: 3;
  animation: coach-pulse 1.7s ease-in-out infinite;
}

@keyframes coach-pulse {
  0%, 100% { outline-color: var(--accent); background: #e3f2ee; }
  50% { outline-color: #7fc4b4; background: #f1f9f7; }
}

.cell.coach-target {
  outline: 1.5px dashed #1a63d6;
  outline-offset: -3px;
  z-index: 3;
}

/* 被建议排除的候选用角标标出来 */
.cell.coach-target::after {
  content: attr(data-drop);
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #1a63d6;
  letter-spacing: 0;
  pointer-events: none;
}

/* ---------------------------- 技巧手册 ---------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 31, 35, .42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in .2s ease;
}

.sheet.hidden { display: none; }

.sheet-card {
  position: relative;
  width: min(440px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 26px 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 26px 64px -22px rgba(28, 31, 35, .5);
  animation: rise-in .26s cubic-bezier(.2, .8, .3, 1);
}

.sheet-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sheet-close:hover { background: var(--hair); color: var(--ink); }

.sheet-eyebrow {
  margin: 0 0 8px;
  font-size: 9.5px;
  letter-spacing: .3em;
  font-weight: 600;
  color: var(--accent);
}

.sheet-title {
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .02em;
}

.sheet-en {
  margin: 0 0 20px;
  font-size: 11.5px;
  letter-spacing: .05em;
  color: var(--ink-mute);
}

/* 注意：这里原本是 style="margin-top:10px" 的内联写法。
   内联 style 属性会逼 CSP 的 style-src 放开 'unsafe-inline'，
   为了两行间距把整站的样式注入面打开，不划算。 */
.sheet-note { margin-top: 10px; }

.sheet-body { margin: 0; }

.sheet-body dt {
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--accent);
}

.sheet-body dd {
  margin: 0 0 15px;
  font-size: 13px;
  line-height: 1.78;
  color: var(--ink-soft);
}

.wiki-groups { display: flex; flex-direction: column; gap: 15px; }

.wiki-group-title {
  margin-bottom: 6px;
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--ink-mute);
}

.wiki-item {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: all .14s ease;
}

.wiki-item:hover { background: var(--accent-soft); border-color: #cfe3de; }
.wiki-item em { font-style: normal; color: var(--ink-mute); font-size: 11px; margin-left: 6px; }

/* ---- 手册案例：真实盘面小图 ---- */

.demo { margin: 0 0 20px; }

.demo-card {
  padding: 12px 12px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fcfbf8;
}

.demo-head { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 9px; }

.demo-tag {
  flex: none;
  padding: 1.5px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.6;
}

.demo-note { font-size: 10.5px; line-height: 1.55; color: var(--ink-mute); }

.demo-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 286px;
  margin: 0 auto;
  border: 1.5px solid #4a5158;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.dc {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-right: 1px solid #e9e5dd;
  border-bottom: 1px solid #e9e5dd;
  font-variant-numeric: tabular-nums;
  color: #2b3138;
}

.dc:nth-child(9n) { border-right: 0; }
.dc:nth-child(n+73) { border-bottom: 0; }
.dc[data-c="2"], .dc[data-c="5"] { border-right: 1.2px solid #77808a; }
.dc[data-r="2"], .dc[data-r="5"] { border-bottom: 1.2px solid #77808a; }

.dc .dc-v { font-size: 11.5px; font-weight: 600; letter-spacing: -.02em; }

.dc .cand {
  position: absolute;
  inset: 1px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.dc .cand span {
  display: grid;
  place-items: center;
  font-size: 6.4px;
  line-height: 1;
  letter-spacing: 0;
  color: #9aa1a9;
}

.dc .cand span.on { color: #333a42; font-weight: 700; }
.dc .cand span.gone { color: var(--error); text-decoration: line-through; font-weight: 700; }

/* 只剩一个候选的格子（鱼形图）：把小数字放大，否则看不出是什么 */
.dc.solo .cand span { font-size: 9.5px; }

.dc.unit { background: rgba(207, 139, 43, .13); }
.dc.mark { background: rgba(207, 139, 43, .2); box-shadow: inset 0 0 0 1.3px #cf8b2b; }
.dc.mark.pivot { box-shadow: inset 0 0 0 1.6px #b0552c; }
.dc.target { background: rgba(26, 99, 214, .07); box-shadow: inset 0 0 0 1.2px rgba(26, 99, 214, .6); }
.dc.final { background: #e3f2ee; box-shadow: inset 0 0 0 1.6px var(--accent); }

.demo-ans {
  margin: 9px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.demo-ans span { font-weight: 600; }
.demo-ans b { font-size: 15px; margin-left: 2px; }
.demo-ans-cut { color: #1a63d6; font-size: 11.5px; line-height: 1.6; }

.demo-cap {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.demo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 9px 0 0;
  font-size: 9.5px;
  color: var(--ink-mute);
}

.demo-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 2px;
  vertical-align: -1px;
}

.lg-unit { background: rgba(207, 139, 43, .16); border: 1px solid rgba(207, 139, 43, .3); }
.lg-mark { background: rgba(207, 139, 43, .2); border: 1px solid #cf8b2b; }
.lg-target { background: rgba(26, 99, 214, .1); border: 1px solid rgba(26, 99, 214, .6); }
.lg-final { background: #e3f2ee; border: 1px solid var(--accent); }

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link:hover { color: var(--accent-dark); }

/* ---------------------------- 提示条 ---------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 31, 35, .92);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  /* 必须高于 .sheet（60）：玩家面板里点「创建」「删除」时的提示
     原本被面板压在下面，用户只会觉得「点了没反应」 */
  z-index: 80;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------- 响应式 ---------------------------- */

@media (max-width: 900px) {
  body { padding: 22px 16px 40px; }

  .app { max-width: 560px; }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    justify-content: stretch;
  }

  .masthead { margin-bottom: 18px; }

  .logo { width: 40px; height: 40px; border-radius: 11px; font-size: 21px; }
  .brand-text h1 { font-size: 19px; }

  .hud { gap: 20px; margin-bottom: 10px; }
  .hud-value { font-size: 15px; }

  .side { padding-top: 0; gap: 12px; }

  .numpad { grid-template-columns: repeat(9, 1fr); gap: 6px; }
  .key { border-radius: 9px; font-size: 17px; }
  .key-count { display: none; }

  .tools { grid-template-columns: repeat(5, 1fr); }
  .tool { flex-direction: row; justify-content: center; gap: 5px; padding: 9px 0; }
  .tool .ico { width: 15px; height: 15px; }

  .tips { display: none; }

  .cell { font-size: clamp(16px, 5.6vw, 24px); }
  .cell .notes i { font-size: clamp(7px, 2vw, 10px); }

  #win-tech { margin: 2px 0 0; }

.win-stats { gap: 22px; }
}

@media (max-width: 400px) {
  .masthead { gap: 10px; }
  .brand { gap: 10px; }
  .brand-text p { display: none; }
  .btn { padding: 9px 14px; font-size: 12.5px; }
  .select-wrap select { padding: 9px 30px 9px 12px; font-size: 12.5px; }
}

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

/* 通用隐藏：必须放在最后，否则会被 .btn 等组件的 display 覆盖 */
.hidden { display: none !important; }

/* =============================================================
   教程关
   ============================================================= */

/* 教程里不显示计时，改用一条状态带说明「这是第几关」 */
.lesson-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid #cfe3de;
  border-radius: 11px;
  background: var(--accent-soft);
}

.lesson-bar.hidden { display: none; }

.lb-num {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
}

.lb-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-exit {
  flex: none;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.lesson-grid { display: flex; flex-direction: column; gap: 7px; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}

.lesson-item:hover:not([disabled]) { background: var(--accent-soft); border-color: #cfe3de; }

.li-num {
  flex: none;
  width: 24px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.li-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.li-title { font-size: 13px; font-weight: 600; }

.li-tech {
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--ink-mute);
}

.li-state { flex: none; font-size: 10.5px; letter-spacing: .08em; color: var(--ink-mute); }

/* 下一关该玩哪一关，直接标出来，不让人自己找 */
.lesson-item.current { border-color: var(--accent); background: #f4faf8; }
.lesson-item.current .li-state { color: var(--accent-dark); font-weight: 600; }

.lesson-item.passed { opacity: .7; }
.lesson-item.passed .li-num,
.lesson-item.passed .li-state { color: var(--accent); }

.lesson-item.locked { opacity: .42; cursor: not-allowed; }

.lesson-progress {
  margin: 13px 0 0;
  font-size: 11px;
  letter-spacing: .05em;
  color: var(--ink-mute);
}

@media (max-width: 560px) {
  .lesson-bar { padding: 8px 10px; gap: 8px; }
  .lb-title { font-size: 12px; }
  .lesson-item { padding: 9px 10px; gap: 9px; }
}

/* 教程关：这一步要看的那一片淡染一下，其余空格压暗，视线有落点 */
.cell.lesson-focus { background: rgba(207, 139, 43, .085); }
.cell.lesson-dim .notes { opacity: .42; }

.coach-note {
  display: block;
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-mute);
}

/* =============================================================
   玩家与排行榜
   ============================================================= */

/* 顶栏的身份入口：头像 + 昵称，点开是玩家面板 */
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 118px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.player-chip:hover { border-color: #cfc9be; }
.player-chip:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.pc-av {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.pc-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------- 玩家面板 ---------------------------- */

.pl-hero { display: flex; align-items: center; gap: 14px; margin: 20px 0 16px; }

.pl-av {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.pl-main { flex: 1; min-width: 0; }

/* 昵称就地改：平时看着像标题，hover 才露出输入框的边 */
.pl-name {
  width: calc(100% + 16px);
  margin-left: -8px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .02em;
}

.pl-name:hover { border-color: var(--line); }
.pl-name:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pl-since { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-mute); }

.pl-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }

.pl-num {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf7;
}

.pl-num b {
  display: block;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.pl-num b i { font-style: normal; font-size: 12.5px; font-weight: 500; color: var(--ink-mute); }
.pl-num span { display: block; margin-top: 3px; font-size: 10px; letter-spacing: .12em; color: var(--ink-mute); }

.pl-diffs { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.pl-diff {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
}

.pl-diff:first-child { border-top: 0; }
.pl-d-name { flex: 1; color: var(--ink-soft); }

/* 名次小标：只在有别人一起排的时候出现 */
.pl-d-rank {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.pl-d-time {
  font-weight: 600;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.pl-diff.none .pl-d-time { color: var(--ink-mute); font-weight: 500; }
.pl-d-count { width: 40px; text-align: right; font-size: 10.5px; color: var(--ink-mute); }

.pl-section {
  margin: 20px 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--accent);
}

.pl-list { display: flex; flex-direction: column; gap: 6px; }

.pl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.pl-row:hover { border-color: #cfc9be; background: #fbfaf7; }
.pl-row.me { border-color: #bcd8d1; background: var(--accent-soft); }

.pl-row-av {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.pl-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.pl-row-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-row-name i,
.rk-name i {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .08em;
  vertical-align: 1px;
}

.pl-row-meta { font-size: 10.5px; color: var(--ink-mute); }

.pl-del {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.pl-del:hover { background: var(--error-bg); color: var(--error); }

.pl-new { display: flex; gap: 8px; margin-top: 8px; }

.pl-new input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}

.pl-new input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 存储体检：只在「存不进去」或「本地存储被禁」时出现，平时不占版面 */
.pl-store {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid #a3502b;
  border-radius: 8px;
  background: var(--hair);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.pl-store .link { font-size: 11.5px; white-space: nowrap; }

.pl-actions { display: flex; gap: 10px; margin-top: 18px; }
.pl-actions .btn { flex: 1; justify-content: center; }

/* ---------------------------- 排行榜 ---------------------------- */

.rank-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rank-tabs::-webkit-scrollbar { display: none; }

.rk-tab {
  flex: none;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.rk-tab:hover { border-color: #cfc9be; }
.rk-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.rank-list { display: flex; flex-direction: column; }

.rk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-top: 1px solid var(--hair);
}

.rk-row:first-child { border-top: 0; }
.rk-row.me { background: var(--accent-soft); border-radius: 10px; border-top-color: transparent; }

.rk-no {
  flex: none;
  width: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.rk-no.m1 { color: #b07d18; font-size: 13.5px; }
.rk-no.m2 { color: #79838d; font-size: 13.5px; }
.rk-no.m3 { color: #a2622f; font-size: 13.5px; }

.rk-av {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.rk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.rk-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rk-meta { font-size: 10.5px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }

.rk-time {
  flex: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.rk-gap { padding: 5px 0; text-align: center; font-size: 11px; letter-spacing: .2em; color: var(--ink-mute); }

.rk-empty {
  margin: 30px 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 2;
  color: var(--ink-mute);
}

.rank-foot {
  margin: 14px 0 0;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--ink-mute);
}

#rank-back { display: inline-block; margin-top: 14px; }

/* ---------------------------- 复盘 ---------------------------- */

/* 三个数并排：用时 / 填错 / 独立完成 */
.rv-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 18px 0 16px;
}

.rv-stat {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}

.rv-stat b {
  display: block;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rv-stat b i {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-mute);
}

.rv-stat span {
  display: block;
  margin-top: 4px;
  font-size: 9.5px;
  letter-spacing: .1em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

/*
 * 节奏条：44 根柱子，每根代表整局的一个等长时间片。
 * 柱子高＝那段时间停得久。中盘崩和收尾拖在这条上一眼能分开。
 */
.rv-pace {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf7;
}

.rv-bar {
  flex: 1;
  min-width: 2px;
  align-self: flex-end;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.rv-head {
  margin: 20px 0 6px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rv-item {
  padding: 11px 0;
  border-top: 1px solid var(--hair);
}

.rv-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rv-cell {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rv-gap {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.rv-body {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* 盘上有错填时的提示：这是「你的前提就错了」，不是普通说明，要显眼但不刺眼 */
.rv-body.warn {
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--error-bg);
  color: #8c2c20;
}

.rv-mis {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--hair);
  font-size: 12px;
}

.rv-mis-flow {
  font-weight: 600;
  color: var(--error);
  font-variant-numeric: tabular-nums;
}

.rv-mis-n { font-size: 11px; color: var(--ink-mute); }

.rv-mis-at {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.rv-note {
  margin: 16px 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-mute);
}

#review-back { display: inline-block; margin-top: 14px; }

/* 玩家面板里的「最近对局」 */
.pl-recent-wrap { margin-top: 16px; }
.pl-recent { display: flex; flex-direction: column; gap: 6px; }

.rv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.rv-row:hover { border-color: #cfc9be; background: #fbfaf7; }

.rv-row-main { flex: 1; font-weight: 500; color: var(--ink); }
.rv-row-meta { font-size: 10.5px; color: var(--ink-mute); }

.rv-row-time {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* 窄屏：顶栏放不下就折成两行，动作区独占一行，谁也不挤谁 */
@media (max-width: 430px) {
  .masthead { flex-wrap: wrap; row-gap: 12px; }
  .masthead-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .player-chip { max-width: 104px; }

  /* 三列数字在 390px 下每列只剩百余像素，19px 的 "1:23:45" 会撑破 */
  .rv-stats { gap: 6px; }
  .rv-stat b { font-size: 16px; }
  .rv-stat span { font-size: 9px; letter-spacing: .06em; }
}

/* ---------------------------- 页脚 ---------------------------- */

/*
 * 语言切换放在页脚而不是顶栏：顶栏在 390px 已经折成两行，
 * 再塞一个控件会把「新游戏」挤走。页脚是内容站放语言切换的常规位置，
 * 爬虫也照常能顺着这三个链接（en / zh / 文章）走。
 */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  font-size: 11.5px;
  color: var(--ink-mute);
}

.lang-switch { display: flex; gap: 2px; }

.lang-switch a {
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--ink-mute);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}

.lang-switch a:hover { color: var(--ink); background: var(--hair); }

/* 当前语言不当作可点的链接，但保留同样的位置，切换时不会跳来跳去 */
.lang-switch a[aria-current] {
  color: var(--ink);
  background: var(--hair);
  font-weight: 600;
}

.foot-links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.foot-links a {
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot-links a:hover { color: var(--ink); border-bottom-color: currentColor; }

@media (max-width: 560px) {
  .site-foot { flex-direction: column; align-items: flex-start; }
}

/* =============================================================
   每日一题：HUD 下面的一条。做得比 HUD 重一点，因为它是个入口，
   不是状态显示；但也不能抢盘面，所以只有一行。
   ============================================================= */

.daily-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 7px 9px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.daily-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.daily-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* 正在做：呼吸一下，告诉人这局还没完 */
.daily-bar.is-live .daily-dot { animation: daily-pulse 1.9s ease-in-out infinite; }
/* 做完了：亮点熄掉 */
.daily-bar.is-done .daily-dot { background: var(--ink-mute); }

@keyframes daily-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.daily-text {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.daily-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 有副标题时才加分隔点，空的时候别留一个孤零零的「·」 */
.daily-sub:not(:empty)::before {
  content: '·';
  margin-right: 6px;
  opacity: .55;
}

.daily-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.daily-btn {
  padding: 5px 13px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.daily-btn:hover { background: var(--accent-dark); }

.daily-print {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.daily-print:hover { background: var(--hair); color: var(--ink); }
.daily-print .ico { width: 15px; height: 15px; }

/* 打印标题与出处：屏幕上不存在，只服务于纸面 */
.print-head,
.print-foot { display: none; }

@media (max-width: 560px) {
  .daily-text { font-size: 12px; }
  .daily-sub { font-size: 11px; }
  .daily-btn { padding: 5px 11px; }
}

/* =============================================================
   打印：只留标题、盘面、一行出处
   -------------------------------------------------------------
   纸面没有交互，所以选中高亮、候选浮层、提示染色全部关掉——
   那些是屏幕上的辅助，印出来只会变成看不懂的色块。
   ============================================================= */

@media print {
  @page { margin: 14mm; }

  html, body {
    padding: 0;
    margin: 0;
    background: #fff !important;
    color: #000;
  }

  .masthead,
  .hud,
  .daily-bar,
  .side,
  .site-foot,
  .coach,
  .board-mask,
  .toast,
  .lesson-bar,
  .sheet { display: none !important; }

  .app { max-width: none; }
  .layout { display: block; }
  .stage { margin: 0 auto; max-width: 150mm; }

  .print-head {
    display: block;
    margin: 0 0 6mm;
    font-size: 13pt;
    font-weight: 600;
    text-align: center;
    letter-spacing: .02em;
  }

  .board {
    border: 2.5pt solid #000;
    border-radius: 0;
    box-shadow: none;
    break-inside: avoid;
  }

  .cell {
    border-right: 0.6pt solid #999;
    border-bottom: 0.6pt solid #999;
    background: #fff !important;
    font-size: 19pt;
  }

  /* 宫的粗线要压过普通细线，否则印出来分不出九个宫 */
  .cell[data-col="2"], .cell[data-col="5"] { border-right: 1.6pt solid #000; }
  .cell[data-row="2"], .cell[data-row="5"] { border-bottom: 1.6pt solid #000; }
  .cell[data-col="8"] { border-right: 0; }
  .cell[data-row="8"] { border-bottom: 0; }

  /* 屏幕上的辅助标记一律不印 */
  .cell.selected,
  .cell.peer,
  .cell.same,
  .cell.error,
  .cell.coach-unit,
  .cell.coach-mark,
  .cell.coach-target,
  .cell.coach-place,
  .cell.coach-cand,
  .cell.lesson-focus { background: #fff !important; box-shadow: none !important; }

  .cell .cell-value,
  .cell.given .cell-value,
  .cell.filled .cell-value,
  .cell.hinted .cell-value { color: #000 !important; }

  .cell.given .cell-value { font-weight: 700; }
  .cell.filled .cell-value { font-weight: 400; }

  .cell .notes { opacity: 1 !important; }
  .cell .notes i { font-size: 7pt; color: #444 !important; }

  .print-foot {
    display: block;
    margin-top: 6mm;
    font-size: 9pt;
    color: #666;
    text-align: center;
  }
}

/* =============================================================
   技巧长文入口：main 和 footer 之间的一条。
   首页是全站权重最高的页面，之前只链到索引页；
   现在直接链到三篇文章，读者和搜索引擎都能少走一跳。
   刻意安静：不抢盘面的注意力，滚动到底才看见。
   ============================================================= */

.read-more {
  max-width: 720px;
  margin: 34px auto 0;
  padding: 22px 24px 20px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--bg-glow);
}

.read-more h2 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.read-more > p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-mute);
}

.read-more ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.read-more li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 13.5px;
  line-height: 1.55;
}

.read-more li a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.read-more li a:hover { text-decoration: underline; }

.read-more li span { color: var(--ink-mute); }

.read-more-all { margin: 14px 0 0; font-size: 13px; }

.read-more-all a { color: var(--ink-soft); text-decoration: none; }

.read-more-all a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 560px) {
  .read-more { margin-top: 26px; padding: 18px 16px 16px; }
}
