/* ==========================================================================
   星芽五子棋 · 页面主题与新增页面样式
   在 styles/main.css 之后加载：保留上游棋盘/引擎组件，覆盖为儿童友好的
   浅色主题，并为教学、闯关、棋谱、家庭房间页提供布局。
   ========================================================================== */

:root {
  --color-bg-primary: #eef8f1;
  --color-panel-bg: #fffdf8;
  --color-panel-border: rgba(53, 91, 71, 0.13);
  --color-panel-shadow: 0 10px 30px rgba(45, 82, 62, 0.09);

  --color-text-main: #283a31;
  --color-text-muted: #6d8176;
  --color-text-dark: #283a31;
  --color-text-light: #ffffff;

  --color-score-positive: #247067;
  --color-score-negative: #ae6b2d;
  --color-score-neutral: #40564b;

  --color-source-ai: #2c7a9c;
  --color-source-human: #9a6a1f;

  --color-brand: #2f6b4f;
  --color-accent: #45a86b;

  --color-board-frame: #517d57;
  --color-board-wood: #efd29b;
  --color-board-wood-dark: #e3c187;
  --color-board-line: #88643e;
  --color-stone-black: #23292d;
  --color-stone-white: #fffdf6;
  --color-win-line: #dd5648;

  --color-eval-black: #30373a;
  --color-eval-white: #fffaf0;

  --radius-card: 20px;
  --radius-btn: 999px;
  --board-size: clamp(320px, min(54vw, 72vh), 960px);
  --panel-width: clamp(350px, 25vw, 540px);
}

html {
  scroll-behavior: smooth;
}

body,
body.page-body,
body.game-page {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-text-main);
  background-color: #eef8f1;
  background-image:
    radial-gradient(circle at 8% 10%, rgba(255, 221, 132, 0.34) 0 2px, transparent 3px),
    radial-gradient(circle at 92% 18%, rgba(115, 199, 151, 0.26) 0 2px, transparent 3px),
    radial-gradient(circle at 74% 84%, rgba(255, 203, 113, 0.22) 0 2px, transparent 3px),
    linear-gradient(160deg, #f7fcf7 0%, #ecf8f0 42%, #f8f3e5 100%);
  background-attachment: fixed;
}

body.game-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 22px 38px;
}

body.page-body {
  display: block;
  padding: 16px 0 0;
}

::selection {
  background: #c8ebd3;
  color: #1d3b2a;
}

:focus-visible {
  outline: 3px solid #f0b84f;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: #253c30;
  color: #fff;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

/* ── 全站导航 ───────────────────────────────────────────────────────── */

.site-header {
  width: min(100%, 1500px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(53, 91, 71, 0.13);
  box-shadow: 0 8px 26px rgba(45, 82, 62, 0.07);
  backdrop-filter: blur(12px);
}

.page-body .site-header {
  width: min(calc(100% - 32px), 1500px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-main);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand:hover {
  text-decoration: none;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fffdf2;
  background: linear-gradient(145deg, #5bbb7c, #2f7b55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 5px 12px rgba(47, 123, 85, 0.24);
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.brand-text small {
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.site-nav a {
  padding: 8px 13px;
  border-radius: 999px;
  color: #4f6759;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background: #eaf6ed;
  color: #23573e;
  text-decoration: none;
}

.site-nav a.active {
  background: #2f7b55;
  color: #fff;
  box-shadow: 0 4px 10px rgba(47, 123, 85, 0.2);
}

/* ── 游戏页浅色覆盖 ─────────────────────────────────────────────────── */

.game-page .app {
  max-width: 1640px;
  gap: 16px;
}

.game-page .content-title {
  padding: 2px 6px;
}

.title-wrap {
  text-align: center;
}

.game-page .title {
  color: #274d3a;
  text-shadow: none;
  letter-spacing: 0.12em;
  font-size: clamp(26px, 3.2vw, 40px);
}

.title-sub {
  margin-top: 3px;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.game-page .title-counter {
  border-color: rgba(47, 107, 79, 0.18);
  box-shadow: 0 5px 14px rgba(45, 82, 62, 0.09);
}

.game-page .title-counter.black-counter {
  background: #2b3438;
  color: #fff;
}

.game-page .title-counter.white-counter {
  background: #fffdf8;
  color: #2f4439;
}

.game-page .board-frame {
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(48, 78, 61, 0.2);
}

.game-page .board-options {
  border-radius: 16px;
  background: rgba(31, 48, 39, 0.84);
}

.game-page .menu-page p {
  color: #dbe8df;
}

.game-page .menu-page .btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f7fbf8;
}

.game-page .menu-page .btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.game-page .menu-page .btn-primary {
  background: #5cc07d;
  color: #173222;
  border-color: transparent;
}

.menu-link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  width: 100%;
}

.menu-page .menu-link-grid .btn {
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  font-size: 12px;
  text-decoration: none;
}

.game-page .panel-card {
  border-radius: 18px;
}

.game-page .panel-card h2 {
  color: #315745;
}

.game-page .panel-card h2::before {
  content: "✦";
  margin-right: 7px;
  color: #e7ad3e;
  font-size: 12px;
}

.game-page .panel-sub,
.game-page .info-grid dt,
.game-page .stats-empty,
.game-page .engine-facts,
.game-page .current-status {
  color: var(--color-text-muted);
}

.game-page .current-status {
  background: #eff8f1;
  border-color: #d8ebdc;
  color: #4d6858;
}

.game-page .stats-table thead th {
  background: #fffdf8;
  color: #73877b;
  border-bottom-color: #e6eee8;
}

.game-page .stats-table tbody td {
  border-bottom-color: #eff3ef;
}

.game-page .stats-table tbody tr:nth-child(even) {
  background: #fafcf8;
}

.game-page .engine-note {
  margin-top: 2px;
  background: rgba(255, 253, 248, 0.84);
  border-color: var(--color-panel-border);
  color: #5f7468;
  box-shadow: var(--color-panel-shadow);
}

.game-page .engine-note h3 {
  color: #315745;
}

.game-page .engine-note a {
  color: #28705a;
}

.game-page .engine-note code {
  background: #edf5ef;
  color: #355b47;
}

.game-page .game-summary-card {
  background: #fffdf8;
  border-color: var(--color-panel-border);
  border-radius: 24px;
}

.game-page .game-summary-card h2 {
  color: #2b513e;
}

.game-page .game-summary-card .summary-detail {
  color: var(--color-text-muted);
}

.game-page .game-summary {
  background: rgba(36, 54, 44, 0.38);
  backdrop-filter: blur(5px);
}

.game-page .toast {
  background: #273d31;
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.save-status {
  margin-top: 9px;
  min-height: 18px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ── 通用按钮/表单在浅色主题下 ─────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid #d8e6dc;
  background: #f2f8f4;
  color: #315b46;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: #e8f4ec;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(145deg, #55b878, #33885e);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px rgba(51, 136, 94, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(145deg, #61c583, #389466);
}

.btn-ghost {
  background: transparent;
}

.btn:disabled {
  box-shadow: none;
  transform: none;
}

.text-button {
  padding: 4px;
  border-radius: 6px;
  background: transparent;
  color: #557064;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  color: #23573e;
  text-decoration: underline;
}

.danger-text {
  color: #b7574e;
}

.danger-text:hover {
  color: #943c34;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.pill-green {
  background: #e6f6ea;
  color: #2d7a52;
}

.pill-warm {
  background: #fff1d5;
  color: #9a641d;
}

.muted {
  color: var(--color-text-muted);
}

/* ── 教学/训练/棋谱/房间页面骨架 ───────────────────────────────────── */

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 32px;
  align-items: center;
  margin-bottom: 28px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #699074;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-intro h1,
.room-hero h1 {
  color: #264d39;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.lead {
  max-width: 620px;
  margin-top: 14px;
  color: #647b6d;
  font-size: 15px;
  line-height: 1.85;
}

.progress-card,
.local-note {
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--color-panel-border);
  box-shadow: var(--color-panel-shadow);
}

.progress-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #3c5d49;
  font-size: 13px;
}

.progress-card-head span {
  color: #2d7a52;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 12px;
  margin: 12px 0 9px;
  border-radius: 999px;
  background: #eaf2eb;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7ed69a, #f3c255);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-card p {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h2 {
  color: #2b513e;
  font-size: clamp(22px, 3vw, 30px);
}

/* ── 闯关页 ─────────────────────────────────────────────────────────── */

.training-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.map-card,
.puzzle-card,
.record-list-card,
.replay-card,
.room-card,
.how-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-card);
  box-shadow: var(--color-panel-shadow);
}

.map-card {
  padding: 18px;
}

.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.map-head h2 {
  font-size: 15px;
  color: #315745;
}

.puzzle-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.puzzle-dot {
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f2f7f3;
  border: 1px solid #e2ece5;
  color: #668071;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease, background 0.12s ease;
}

.puzzle-dot:hover {
  transform: translateY(-2px);
  background: #e8f4ec;
}

.puzzle-dot.is-revealed {
  background: #fff2d8;
  border-color: #f4d59b;
  color: #98631f;
}

.puzzle-dot.is-done {
  background: #dff4e4;
  border-color: #b7e4c4;
  color: #25764d;
}

.puzzle-dot.is-current {
  box-shadow: 0 0 0 3px #f0b84f;
  color: #213d2e;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed #dfe9e2;
  color: #7a8d82;
  font-size: 10.5px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #edf3ee;
  border: 1px solid #d4e2d8;
}

.dot-done { background: #7ecf92; border-color: #58b571; }
.dot-revealed { background: #f0c56d; border-color: #d5a541; }

.puzzle-card {
  padding: 20px;
}

.puzzle-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 12px;
}

.puzzle-stage {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(290px, 0.72fr);
  gap: 24px;
  align-items: start;
}

.training-board-frame {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  border-radius: 18px;
}

.training-board-frame .board-stage {
  border-radius: 10px;
}

.puzzle-side {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 12px;
}

.turn-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.turn-row h2 {
  color: #2b513e;
  font-size: clamp(21px, 2.3vw, 27px);
  line-height: 1.3;
}

.turn-badge {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.turn-badge.is-black {
  background: #2c3539;
  color: #fff;
}

.turn-badge.is-white {
  background: #fffdf8;
  border: 1px solid #d8e2da;
  color: #44594d;
}

.puzzle-prompt {
  color: #536a5d;
  font-size: 14px;
  line-height: 1.8;
}

.feedback {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.65;
  border: 1px solid transparent;
}

.feedback-neutral {
  background: #f3f8f4;
  border-color: #e2ece5;
  color: #647b6d;
}

.feedback-good {
  background: #e7f8ec;
  border-color: #b9e7c7;
  color: #226b46;
}

.feedback-hint {
  background: #fff6df;
  border-color: #f4dca8;
  color: #89601f;
}

.feedback-wrong {
  background: #fff0ee;
  border-color: #f2cbc6;
  color: #9d433b;
}

.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.answer-row .btn {
  flex: 1 1 140px;
}

.answer-box {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff9eb;
  border: 1px dashed #eacb8e;
  color: #74531c;
  font-size: 12.5px;
  line-height: 1.7;
}

.rule-details {
  border-top: 1px dashed #e1eae4;
  padding-top: 10px;
  color: #697f72;
  font-size: 12px;
}

.rule-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #4e6e5b;
}

.rule-details p {
  margin-top: 7px;
  line-height: 1.7;
}

.puzzle-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.puzzle-actions .btn {
  flex: 1;
}

.tip-strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
  padding: 15px 18px;
  border-radius: 16px;
  background: rgba(255, 250, 234, 0.82);
  border: 1px solid #f0e1ba;
  color: #75633c;
  font-size: 12px;
  line-height: 1.7;
}

.tip-strip strong {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f5d98d;
  color: #6c4f15;
  font-size: 11px;
}

/* ── 新手学堂 ───────────────────────────────────────────────────────── */

.teach-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 34px;
  align-items: center;
  margin: 8px 0 48px;
}

.teach-hero h1 {
  color: #264d39;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.03;
  letter-spacing: 0.01em;
}

.teach-hero .lead {
  max-width: 560px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.teach-hero-art {
  position: relative;
  min-height: 330px;
  padding: 30px;
  border-radius: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 22%, #ffe8a7 0 52px, transparent 53px),
    radial-gradient(circle at 20% 82%, rgba(255, 255, 255, 0.65) 0 5px, transparent 6px),
    linear-gradient(155deg, #d8f2df 0%, #f3f8df 56%, #fce9bd 100%);
  border: 1px solid rgba(70, 120, 85, 0.12);
  box-shadow: var(--color-panel-shadow);
}

.art-sun {
  position: absolute;
  top: 22px;
  right: 28px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #ffd66e;
  box-shadow: 0 0 0 12px rgba(255, 214, 110, 0.2);
}

.art-sprout {
  position: absolute;
  left: 28px;
  bottom: 74px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 48% 52% / 60% 45% 55% 40%;
  background: #57b779;
  color: #fff8d8;
  font-size: 26px;
  transform: rotate(-8deg);
  box-shadow: 0 8px 18px rgba(54, 128, 83, 0.25);
}

.art-stones {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 290px;
  margin: 88px auto 0;
  padding: 20px 14px;
  border-radius: 22px;
  background: rgba(255, 253, 246, 0.72);
  border: 1px dashed rgba(72, 109, 83, 0.22);
  transform: rotate(-2deg);
}

.stone {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-block;
}

.teach-hero-art .stone {
  box-shadow: 0 3px 7px rgba(45, 65, 52, 0.16);
}

.stone-black {
  background: radial-gradient(circle at 33% 27%, #596166, #22282b 68%);
}

.stone-white {
  background: radial-gradient(circle at 33% 27%, #ffffff, #f3eee3 72%);
  border: 1px solid #d8d2c6;
}

.stone-gold {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffd977, #f1b43e);
  color: #8a5a0d;
  font-size: 21px;
}

.teach-hero-art p {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  text-align: center;
  color: #54705e;
  font-size: 12px;
  font-weight: 700;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.lesson-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 19px 16px 17px;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--color-panel-border);
  box-shadow: 0 8px 22px rgba(45, 82, 62, 0.06);
}

.lesson-num {
  color: #b1c2b5;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.lesson-card h3 {
  color: #2d523e;
  font-size: 15px;
  line-height: 1.4;
}

.lesson-card p {
  color: #6a7e71;
  font-size: 12px;
  line-height: 1.72;
}

.lesson-visual {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 14px;
  background: #f1f8f3;
  border: 1px solid #e2ece5;
}

.g-stone {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.g-stone.black { background: radial-gradient(circle at 33% 27%, #596166, #22282b 68%); }
.g-stone.white { background: radial-gradient(circle at 33% 27%, #fff, #f1ece1 72%); border: 1px solid #d8d2c6; }

.visual-grid {
  background-image: linear-gradient(#dce9df 1px, transparent 1px), linear-gradient(90deg, #dce9df 1px, transparent 1px);
  background-size: 21px 21px;
  background-position: center;
}

.visual-turn .turn-arrow {
  color: #98ab9d;
  font-size: 13px;
}

.visual-line .g-stone {
  width: 20px;
  height: 20px;
}

.visual-block .g-stone {
  width: 22px;
  height: 22px;
}

.block-mark {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.visual-open {
  position: relative;
  padding: 0 10px;
}

.visual-open .g-stone {
  width: 20px;
  height: 20px;
}

.open-tip {
  position: absolute;
  right: 6px;
  bottom: 4px;
  color: #9a7a36;
  font-size: 8.5px;
  font-weight: 700;
}

.practice-panel {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 34px;
  align-items: center;
  margin-top: 44px;
  padding: 28px;
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--color-panel-border);
  box-shadow: var(--color-panel-shadow);
}

.practice-board-wrap {
  min-width: 0;
}

.mini-board-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px;
  border-radius: 24px;
  background: #527e58;
  box-shadow: 0 16px 34px rgba(47, 82, 60, 0.18);
}

.teach-board {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #efd29b;
}

.teach-board svg {
  display: block;
  width: 100%;
  height: 100%;
}

.board-legend {
  margin-top: 10px;
  text-align: center;
  color: #75897d;
  font-size: 11px;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 3px 0 8px;
  border-radius: 50%;
  vertical-align: -2px;
}

.legend-dot.black { background: #2a3033; }
.legend-dot.white { background: #fffdf6; border: 1px solid #cfc8bb; }

.practice-copy h2 {
  color: #2b513e;
  font-size: clamp(24px, 3vw, 33px);
}

.practice-copy h3 {
  margin-top: 16px;
  color: #385c47;
  font-size: 18px;
}

.practice-prompt {
  margin: 9px 0 14px;
  color: #62796b;
  font-size: 14px;
  line-height: 1.8;
}

.practice-copy .feedback {
  margin-bottom: 13px;
}

.small-note {
  margin-top: 13px;
  font-size: 11px;
}

.challenge-dots {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.challenge-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #dbe8df;
  background: #f2f8f4;
  color: #6e8376;
  font-size: 11px;
  font-weight: 800;
}

.challenge-dot.is-done {
  background: #dff4e4;
  border-color: #a9dfba;
  color: #26764e;
}

.challenge-dot.is-current {
  box-shadow: 0 0 0 3px #f0b84f;
}

.svg-wood { fill: #efd29b; }
.svg-grid { stroke: #8b673f; stroke-width: 1.05; opacity: 0.9; }
.svg-star-point { fill: #7d5a36; }
.svg-stone { stroke-width: 1.2; }
.svg-black { fill: #252b2e; stroke: #111416; }
.svg-white { fill: #fffdf6; stroke: #bdb5a6; }
.svg-hit { fill: transparent; cursor: pointer; pointer-events: all; }
.svg-hit:hover,
.svg-hit:focus { fill: rgba(255, 255, 255, 0.3); outline: none; }
.svg-wrong-ring { fill: rgba(255, 255, 255, 0.55); stroke: #d44a43; stroke-width: 3; }
.svg-wrong-x { stroke: #d44a43; stroke-width: 3.4; stroke-linecap: round; }
.svg-star { fill: #7c520c; font-size: 16px; font-weight: 800; }
.svg-stone-group.is-new { animation: stone-pop 0.28s ease both; transform-origin: center; }
@keyframes stone-pop {
  from { opacity: 0; transform: scale(1.35); }
  to { opacity: 1; transform: scale(1); }
}

.rule-recap {
  display: grid;
  grid-template-columns: minmax(200px, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 26px;
  align-items: center;
  margin-top: 38px;
  padding: 26px 30px;
  border-radius: 26px;
  background: linear-gradient(145deg, #e9f7ed, #fff8e7);
  border: 1px solid #dcebd9;
}

.rule-recap h2 {
  color: #2b513e;
  font-size: clamp(21px, 2.5vw, 28px);
}

.recap-list {
  display: grid;
  gap: 8px;
  list-style: none;
}

.recap-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #506b5a;
  font-size: 13px;
}

.recap-list span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fffdf8;
  border: 1px solid #cfe2d4;
  color: #3f7958;
  font-size: 10px;
  font-weight: 800;
}

/* ── 棋谱页 ─────────────────────────────────────────────────────────── */

.local-note strong {
  display: block;
  color: #335d46;
  font-size: 14px;
}

.local-note p {
  margin-top: 6px;
  color: #72857a;
  font-size: 12px;
  line-height: 1.7;
}

.records-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.record-list-card {
  padding: 18px;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 2px;
}

.record-list-empty {
  padding: 26px 10px;
  text-align: center;
  color: #84958a;
  font-size: 12px;
  line-height: 1.7;
}

.record-item {
  position: relative;
  display: flex;
  align-items: stretch;
  border: 1px solid #e5eee8;
  border-radius: 14px;
  background: #fbfdf9;
  overflow: hidden;
}

.record-item.is-active {
  border-color: #8bcaa0;
  background: #eff9f1;
  box-shadow: inset 3px 0 0 #4cae70;
}

.record-open {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 11px 30px 11px 12px;
  text-align: left;
  background: transparent;
}

.record-open strong {
  color: #315744;
  font-size: 12.5px;
}

.record-meta {
  color: #7d8f83;
  font-size: 10.5px;
}

.record-result {
  color: #a36b24;
  font-size: 10.5px;
  font-weight: 700;
}

.record-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #9bb0a1;
  font-size: 16px;
  line-height: 1;
}

.record-delete:hover {
  background: #ffeae6;
  color: #b74b41;
}

.record-list-card > .text-button {
  margin-top: 13px;
}

.replay-card {
  min-height: 560px;
  padding: 20px;
}

.replay-empty {
  min-height: 470px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-star {
  width: 70px;
  height: 70px;
  margin-bottom: 16px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e4f6e8, #fff4d6);
  color: #d9a534;
  font-size: 32px;
}

.replay-empty h2 {
  color: #315744;
  font-size: 21px;
}

.replay-empty p {
  max-width: 340px;
  margin: 9px 0 18px;
  color: #7b8e81;
  font-size: 12.5px;
  line-height: 1.7;
}

.replay-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.replay-topline h2 {
  color: #2b513e;
  font-size: 21px;
}

.replay-stage {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(250px, 0.62fr);
  gap: 22px;
  align-items: start;
}

.replay-board-frame {
  width: 100%;
  max-width: 620px;
  border-radius: 18px;
}

.replay-board-frame .board-stage {
  border-radius: 10px;
}

.replay-side {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.replay-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.replay-meta div {
  padding: 9px 11px;
  border-radius: 12px;
  background: #f4f9f5;
  border: 1px solid #e6eee8;
}

.replay-meta dt {
  color: #8a9a90;
  font-size: 9.5px;
  font-weight: 700;
}

.replay-meta dd {
  margin-top: 2px;
  color: #3d5c49;
  font-size: 11.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.replay-controls {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0f7f2;
  border: 1px solid #dae9de;
  color: #3c7052;
  font-size: 12px;
  font-weight: 800;
}

.icon-btn:hover:not(:disabled) {
  background: #e3f2e8;
}

.icon-btn.play {
  background: #4caf72;
  border-color: transparent;
  color: #fff;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.move-scroll {
  max-height: 200px;
  overflow: auto;
  padding: 3px;
  border-radius: 12px;
  background: #fbfdf9;
  border: 1px solid #edf2ee;
}

.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
}

.move-chip {
  min-width: 42px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #f0f6f1;
  border: 1px solid #e1ece4;
  color: #526b5c;
  font-size: 10.5px;
  font-weight: 700;
}

.move-chip:hover {
  background: #e5f2e9;
}

.move-chip.is-current {
  background: #3c9662;
  border-color: transparent;
  color: #fff;
}

.chip-no {
  margin-right: 4px;
  opacity: 0.58;
}

.replay-status {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f4f9f5;
  color: #647b6d;
  font-size: 11px;
  line-height: 1.55;
}

/* ── 家庭房间 ───────────────────────────────────────────────────────── */

.room-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
}

.room-badge {
  flex: 0 0 170px;
  height: 170px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 27%, rgba(255, 255, 255, 0.75), transparent 34%),
    linear-gradient(145deg, #ffe6a4, #f5c95e);
  border: 8px solid rgba(255, 253, 248, 0.72);
  box-shadow: 0 18px 36px rgba(155, 115, 29, 0.16);
  transform: rotate(4deg);
}

.room-badge span {
  color: #7d5614;
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
}

.room-badge small {
  margin-top: 3px;
  color: #8b651f;
  font-size: 12px;
  font-weight: 800;
}

.room-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.room-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
}

.room-card h2 {
  color: #2b513e;
  font-size: 25px;
}

.room-card > p {
  color: #657c6e;
  font-size: 13px;
  line-height: 1.8;
}

.room-card ul {
  display: grid;
  gap: 5px;
  margin: 2px 0 6px;
  padding-left: 18px;
  color: #718478;
  font-size: 12px;
  line-height: 1.65;
}

.room-card .btn {
  margin-top: auto;
}

.room-card-ready {
  border-color: #c9e5d1;
  background: linear-gradient(160deg, #fffdf8, #f4fbf5);
}

.room-card-planned {
  opacity: 0.84;
  background: linear-gradient(160deg, #fffdf8, #faf7ed);
}

.how-card {
  margin-top: 20px;
  padding: 26px;
}

.how-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0 20px;
  list-style: none;
}

.how-list li {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: #f5faf6;
  border: 1px solid #e7efe9;
}

.how-list li > span {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dff2e4;
  color: #2d7a52;
  font-size: 12px;
  font-weight: 900;
}

.how-list strong {
  color: #385d48;
  font-size: 13px;
}

.how-list p {
  margin-top: 3px;
  color: #74877b;
  font-size: 11.5px;
  line-height: 1.65;
}

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

/* ── 页脚 ───────────────────────────────────────────────────────────── */

.site-footer {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 36px;
  border-top: 1px solid rgba(77, 110, 89, 0.12);
  color: #84958a;
  font-size: 10.5px;
  line-height: 1.7;
  text-align: center;
}

.game-page .site-footer {
  width: min(100%, 1500px);
  padding: 8px 0 0;
  border-top: none;
}

.site-footer a {
  color: #4f8066;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── 响应式 ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .lesson-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .puzzle-stage,
  .replay-stage {
    grid-template-columns: minmax(280px, 1fr) minmax(250px, 0.78fr);
    gap: 18px;
  }
}

@media (max-width: 980px) {
  .training-layout,
  .records-layout {
    grid-template-columns: 1fr;
  }
}

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

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .page-intro,
  .teach-hero,
  .practice-panel {
    grid-template-columns: 1fr;
  }

  .teach-hero-art {
    min-height: 260px;
  }

  .teach-hero-art .art-stones {
    margin-top: 54px;
  }

  .training-layout,
  .records-layout {
    grid-template-columns: 1fr;
  }

  .puzzle-list {
    grid-template-columns: repeat(10, 1fr);
  }

  .record-list {
    max-height: 300px;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .how-list {
    grid-template-columns: 1fr;
  }

  .rule-recap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body.game-page {
    padding: 10px 10px 24px;
  }

  body.page-body {
    padding-top: 10px;
  }

  .site-header {
    padding: 11px 12px;
    border-radius: 18px;
  }

  .brand-text {
    font-size: 17px;
  }

  .brand-text small {
    display: none;
  }

  .site-nav a {
    padding: 7px 10px;
    font-size: 12px;
  }

  .page-shell,
  .site-footer,
  .page-body .site-header {
    width: calc(100% - 22px);
  }

  .page-shell {
    padding-top: 24px;
  }

  .page-intro,
  .teach-hero {
    gap: 20px;
  }

  .lesson-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lesson-card:last-child {
    grid-column: 1 / -1;
  }

  .puzzle-card {
    padding: 14px;
  }

  .puzzle-stage,
  .replay-stage {
    grid-template-columns: 1fr;
  }

  .puzzle-list {
    grid-template-columns: repeat(5, 1fr);
  }

  .training-board-frame,
  .replay-board-frame {
    max-width: 560px;
  }

  .practice-panel,
  .how-card {
    padding: 18px;
  }

  .teach-hero h1 {
    font-size: clamp(36px, 12vw, 52px);
  }

  .room-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .room-badge {
    width: 120px;
    height: 120px;
    flex-basis: 120px;
  }

  .room-badge span {
    font-size: 42px;
  }

  .game-page .content-title {
    gap: 10px;
  }

  .game-page .title-counter {
    width: 44px;
    height: 44px;
    font-size: 15px;
  }

  .game-page .title-sub {
    display: none;
  }

  .game-page .engine-note {
    font-size: 11.5px;
  }
}

@media (max-width: 480px) {
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .lesson-card:last-child {
    grid-column: auto;
  }

  .answer-row .btn {
    flex-basis: 100%;
  }

  .puzzle-actions {
    flex-direction: column;
  }

  .replay-meta {
    grid-template-columns: 1fr;
  }

  .site-nav {
    gap: 1px;
  }

  .site-nav a {
    padding: 7px 8px;
    font-size: 11px;
  }
}

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