:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
  --card: #ffffff;
  --line: #e5e5e5;
  --text: #1f2937;
  --muted: #4b5563;
  --brand: #c2410c;
  --brand2: #b45309;
  --ok: #15803d;
  --radius: 12px;
  --topbar-h: 48px;
  --bottom-nav-h: 56px;
  --stage-1: #0f766e;
  --stage-2: #0369a1;
  --stage-3: #b45309;
  --stage-4: #be123c;
  --stage-5: #15803d;
  --block-tip: #fff7ed;
  --block-obj: #ecfdf5;
  --block-media: #eff6ff;
  --block-dialogue: #fafafa;
  --block-vocab: #fff7ed;
  --block-quiz: #fef2f2;
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.06);
  --spk-0: #0369a1;
  --spk-1: #b45309;
  --spk-2: #15803d;
  --spk-3: #be123c;
  --spk-4: #7c3aed;
}
* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; }
html {
  overflow-x: clip;
  scroll-padding-top: calc(var(--topbar-h) + var(--track-bar-h, 0px) + var(--stage-sticky-h, 0px) + var(--lesson-sticky-h, 48px) + 8px);
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Khmer", "Noto Sans SC", "Khmer UI", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}
body.lang-km { line-height: 1.75; }
body.is-bilingual { line-height: 1.65; }
body.is-bilingual .bi-km {
  display: block;
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.1rem;
}
body.is-bilingual .bottom-nav-label.bi-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1.15;
  text-align: center;
}
body.is-bilingual .bottom-nav-label.bi-stack .bi-km {
  font-size: 0.68rem;
  margin-top: 1px;
  font-weight: 600;
}
body.is-bilingual .bottom-nav {
  min-height: calc(var(--bottom-nav-h) + 10px);
}
body.is-bilingual .lang-menu a {
  white-space: nowrap;
}
a { color: inherit; text-decoration: none; }

.topbar {
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.topbar .inner { max-width: 900px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.logo { font-weight: 800; font-size: 18px; color: var(--brand2); }
nav { display: flex; align-items: center; gap: 16px; }
nav a { color: var(--muted); font-size: 15px; }
nav a:hover { color: var(--text); }

.lang-switch { position: relative; }
.lang-btn { background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.lang-menu { display: none; position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 120px; z-index: 60; }
.lang-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--muted); }
.lang-menu a.active { color: var(--brand2); font-weight: 600; }

.speed-control {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}
.speed-slider { width: 72px; accent-color: var(--brand2); cursor: pointer; }
.speed-value { font-size: 12px; color: var(--brand2); min-width: 36px; text-align: center; }
.speed-label { font-size: 14px; line-height: 1; user-select: none; }
.btn-speak-mode {
  font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--brand2); cursor: pointer; white-space: nowrap;
}
.btn-speak-mode.active-char { color: #e8a838; border-color: #e8a838; }
.btn-speak-mode:hover { border-color: var(--brand2); }
@media (max-width: 640px) {
  .speed-slider { width: 56px; }
  .topbar nav { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
}

.lang-switch:hover .lang-menu { display: block; }

.wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px calc(60px + var(--bottom-nav-h, 56px) + env(safe-area-inset-bottom, 0px)); }
.footer { text-align: center; padding: 24px 16px calc(24px + var(--bottom-nav-h, 56px) + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

.hero { text-align: center; padding: 30px 0 20px; }
.hero h1 { font-size: 32px; margin: 0 0 8px; }
.tip { color: var(--muted); font-size: 14px; max-width: 560px; margin: 12px auto 0; }

.section-title { font-size: 20px; margin: 24px 0 14px; }

.progress-overview { margin-bottom: 8px; }
.progress-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.stat-card .stat-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.stat-card .stat-num { font-size: 22px; font-weight: 700; display: block; }
.stat-card .stat-label { font-size: 13px; color: var(--muted); }
.stat-done { border-color: var(--ok); }
.stat-review { border-color: #c44; }
.stat-new { border-color: var(--line); }

.progress-bar-wrap {
  height: 8px; background: var(--card); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--ok), #3ecf8e);
  border-radius: 999px; transition: width .3s ease;
}

.stage-list { display: flex; flex-direction: column; gap: 14px; }
.stage-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: visible;
}
.stage-block[open] { border-color: var(--brand2); }
.stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; cursor: pointer; list-style: none;
}
.stage-head::-webkit-details-marker { display: none; }
.stage-head::marker { content: ""; }
.stage-num { font-size: 13px; color: var(--brand2); font-weight: 600; display: block; }
.stage-title { margin: 4px 0 6px; font-size: 20px; font-weight: 700; }
.stage-desc { margin: 0; font-size: 14px; }
.stage-head-meta { text-align: right; flex-shrink: 0; }
.stage-progress { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.stage-chevron { color: var(--brand2); font-size: 12px; transition: transform .2s; display: inline-block; }
.stage-block[open] .stage-chevron { transform: rotate(180deg); }

.stage-chapters, .stage-lessons { border-top: 1px solid var(--line); padding: 8px; }
.chapter-row, .lesson-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 10px; margin: 4px 0;
  transition: background .15s, border-color .15s;
  border: 1px solid transparent;
}
.chapter-row:hover, .lesson-row:hover { background: #243044; border-color: var(--line); }
.chapter-row.status-done, .lesson-row.status-done { border-color: rgba(45, 159, 111, .35); }
.chapter-row.status-review, .lesson-row.status-review { border-color: rgba(204, 68, 68, .35); }
.chapter-row.status-new, .lesson-row.status-new { border-color: transparent; }

.chapter-row-main, .lesson-row-main { flex: 1; min-width: 0; }
.chapter-row .ch-num, .lesson-row .lesson-num { font-size: 12px; color: var(--brand2); font-weight: 600; }
.chapter-row .ch-title, .lesson-row .lesson-title { margin: 4px 0 6px; font-size: 17px; font-weight: 600; }
.chapter-row .ch-summary, .lesson-row .lesson-summary { margin: 0; font-size: 13px; line-height: 1.45; }

.chapter-row-status, .lesson-row-status { flex-shrink: 0; }
.lesson-global { margin: 4px 0 8px; font-size: 13px; }
.stage-lesson-count { margin: 6px 0 0; font-size: 13px; }
.btn-back-catalog {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--brand2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}
.btn-back-catalog:hover { background: #243044; }

.lesson-row-flash {
  outline: 2px solid var(--brand2);
  outline-offset: 2px;
  transition: outline-color 0.3s ease;
}
.lesson-row-current {
  background: color-mix(in srgb, #0284c7 8%, #fff) !important;
  border-color: color-mix(in srgb, #0284c7 40%, #fff) !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.18);
}
.lesson-row-current .lesson-num {
  color: #0369a1 !important;
}
.lesson-row-current .lesson-title {
  color: #0c4a6e;
}
.spell-note { margin: 6px 0 8px; font-size: 13px; line-height: 1.45; }
.part-note { font-size: 12px; color: var(--brand2); margin: 0 2px; cursor: help; }
.status-badge {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.badge-done { background: #1a3d2e; color: #7dffb8; border: 1px solid var(--ok); }
.badge-review { background: #3d1a1a; color: #ffb4b4; border: 1px solid #c44; }
.badge-new { background: #243044; color: var(--muted); border: 1px solid var(--line); }

@media (max-width: 640px) {
  .chapter-row, .lesson-row { flex-direction: column; align-items: flex-start; }
  .progress-stats { grid-template-columns: 1fr; }
}

.chapter-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.chapter-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: border-color .15s, transform .15s; }
.chapter-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.chapter-card.done { border-color: var(--ok); }
.ch-num { font-size: 13px; color: var(--brand2); font-weight: 600; }
.chapter-card h3 { margin: 6px 0 8px; font-size: 18px; }
.badge { display: inline-block; margin-top: 8px; background: var(--ok); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.muted { color: var(--muted); font-size: 14px; }

.lesson-head { margin-bottom: 24px; }
.ch-label { color: var(--brand2); font-weight: 600; }
.lesson-head h1 { margin: 6px 0 14px; font-size: 28px; }

.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.block h2 { margin: 0 0 14px; font-size: 18px; color: var(--brand2); }
.tip-box { background: #1e2a3d; border-color: #3d5a80; }
.tip-note { margin: 10px 0 0; font-size: 13px; color: var(--brand2); }

.intro-guide h3 { margin: 22px 0 10px; font-size: 16px; color: var(--text); }
.intro-guide h4 { margin: 16px 0 8px; font-size: 15px; color: var(--brand2); }

/* 讲义折叠：默认收起，点开看要领 */
details.guide-fold {
  padding: 0;
  overflow: hidden;
}
.guide-fold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: #ffe8b8;
  user-select: none;
}
.guide-fold-head::-webkit-details-marker { display: none; }
.guide-fold-head::marker { content: ""; }
.guide-fold-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand2);
}
.guide-fold-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.guide-fold-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.guide-fold-chevron {
  font-size: 11px;
  color: var(--brand2);
  transition: transform 0.2s ease;
}
.guide-fold[open] > .guide-fold-head .guide-fold-chevron {
  transform: rotate(180deg);
}
.guide-fold[open] > .guide-fold-head {
  border-bottom: 1px solid color-mix(in srgb, #d97706 25%, transparent);
}
.guide-fold-body {
  padding: 16px 20px 20px;
}
.guide-fold:not([open]) > .guide-fold-head:hover {
  filter: brightness(0.97);
}

.intro-goal { margin: 0 0 8px; line-height: 1.55; }
.intro-quote {
  margin: 12px 0 16px; padding: 12px 14px;
  border-left: 3px solid var(--brand2); background: #1a2436;
  color: var(--text); line-height: 1.55;
}
.intro-formula {
  font-size: 18px; font-weight: 700; letter-spacing: 0.04em;
  margin: 8px 0 14px; color: var(--brand2);
}
.intro-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.intro-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  min-width: 320px;
}
.intro-table th, .intro-table td {
  border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle;
}
.intro-table th { background: #1a2436; color: var(--brand2); font-weight: 600; }
.intro-finals-list {
  letter-spacing: 0.02em;
  font-family: ui-monospace, Consolas, monospace;
  white-space: normal;
  word-break: keep-all;
  line-height: 1.55;
}
.intro-note { margin: 0 0 12px; }
.intro-note h4 { margin: 0 0 4px; }
.intro-note p { margin: 0; line-height: 1.55; color: var(--muted); }
.intro-bullets, .intro-roadmap { margin: 8px 0 14px; padding-left: 1.2em; line-height: 1.6; }
.intro-mini-examples, .intro-ex-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.intro-joined { white-space: nowrap; color: var(--muted); }
.btn-split-listen { white-space: nowrap; }

.speak-btns { display: flex; gap: 4px; flex-shrink: 0; }
.btn-pinyin-speak { opacity: 0.9; }

.pinyin-practice h3 { font-size: 15px; margin: 16px 0 10px; color: var(--text); }
.practice-hint { margin: 0 0 12px; font-size: 14px; }
.lesson-intro-block {
  margin: 8px 0 20px;
  padding: 16px 18px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 70%);
}
.lesson-intro-heading {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
}
.lesson-intro {
  font-size: 17px;
  line-height: 1.7;
  color: #1f2937;
}
.lesson-intro p {
  margin: 0 0 10px;
}
.lesson-intro p:last-child {
  margin-bottom: 0;
}
.lang-km .lesson-intro {
  font-family: "Noto Sans Khmer", inherit;
  font-size: 16px;
  line-height: 1.75;
}
.pinyin-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.btn-pinyin-chip {
  background: #243044; border: 1px solid #3d5a80; color: var(--brand2);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; font-family: inherit;
}
.btn-pinyin-chip:hover { border-color: var(--brand2); background: #2a3d58; }
.btn-pinyin-chip.small { font-size: 14px; padding: 4px 10px; }
.btn-pinyin-chip.whole { color: #fff; background: #3d5a80; }

.tone-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-tone-card {
  background: #243044; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; cursor: pointer; text-align: center; min-width: 72px; font-family: inherit; color: var(--text);
}
.btn-tone-card:hover { border-color: var(--brand2); }
.tone-hz { display: block; font-size: 28px; font-weight: 700; }
.tone-py { display: block; font-size: 14px; color: var(--brand2); margin-top: 4px; }

.syllable-sample-group { margin: 14px 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; }
.syllable-sample-group h4 { margin: 0 0 8px; font-size: 14px; color: var(--text); }
.syllable-sample-rare { opacity: 0.85; border: 1px dashed var(--muted); }
.record-task-group-label { font-weight: 600; margin: 12px 0 6px; color: var(--brand2); font-size: 13px; }
.spell-label { font-weight: 600; display: block; margin-bottom: 8px; }
.spell-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.spell-parts .plus, .spell-parts .eq { color: var(--muted); font-size: 14px; }

.dialogue .line { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dialogue .line:last-child { border: none; }
.speaker { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.zh-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.zh-stack {
  flex: 1;
  min-width: 0; /* 允许汉字折行，避免撑开整排 */
}
.zh-stack .line-pinyin {
  font-family: "Segoe UI", "Noto Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--brand2);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.zh-big { font-size: 22px; font-weight: 600; }
.hanzi-chars {
  letter-spacing: 0.02em;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.zh-stack .hanzi-chars {
  display: block;
}

/* 对话：拼音在每个字正上方，字与拼音一起换行 */
.zh-ruby {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 4px;
  row-gap: 10px;
  line-height: 1.2;
}
.ruby-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 1.15em;
  max-width: 100%;
  vertical-align: bottom;
}
.ruby-unit .ruby-py {
  display: block;
  font-family: "Segoe UI", "Noto Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand2);
  line-height: 1.15;
  white-space: nowrap;
  margin-bottom: 2px;
  min-height: 1.15em;
}
.ruby-unit .ruby-hz {
  display: block;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.25;
  text-align: center;
}
.ruby-unit.ruby-punct {
  min-width: 0.55em;
  margin-inline: 1px;
}
.ruby-unit.ruby-punct .ruby-py {
  min-height: 1.15em;
}
.zh-line .speak-btns,
.zh-line .dialogue-actions {
  flex-shrink: 0;
  margin-top: 0.2em;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
/* 默认：听/读跟在句子同一行右侧（红框位置） */
.dialogue .dialogue-actions,
.reading-line .dialogue-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 0;
  width: auto;
  flex-shrink: 0;
}
.dialogue .dialogue-actions .btn-spell-play,
.dialogue .dialogue-actions .btn-spell-follow,
.dialogue .dialogue-actions .btn-spell-write,
.reading-line .dialogue-actions .btn-spell-play,
.reading-line .dialogue-actions .btn-spell-follow,
.reading-line .dialogue-actions .btn-spell-write {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 40px;
  padding: 4px 10px;
}
/* 未包进 zh-follow-row 的旧结构：仍可整行摆放 */
.dialogue .line > .dialogue-actions,
.reading-line > .dialogue-actions {
  margin-top: 10px;
  width: 100%;
}
.dialogue .line > .dialogue-actions .btn-spell-play,
.dialogue .line > .dialogue-actions .btn-spell-follow,
.reading-line > .dialogue-actions .btn-spell-play,
.reading-line > .dialogue-actions .btn-spell-follow {
  flex: 1 1 140px;
  min-width: 120px;
  min-height: 48px;
}
.dialogue .trans,
.dialogue .trans.stage3-km,
.reading-line .trans {
  margin: 8px 0 0;
}
.dialogue .line > .zh-stack,
.reading-line > .zh-stack {
  width: 100%;
}
.zh-follow-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 0.85rem;
  width: 100%;
  margin: 0.15rem 0;
}
.zh-follow-row .zh-stack {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.zh-follow-row .dialogue-actions,
.zh-follow-row .spell-actions {
  flex: 0 0 auto;
  width: auto !important;
  margin: 0 0 2px auto;
  margin-left: auto !important;
}

/* 韵母表头：左上韵母 · 右上高棉语 · 左下听 · 右下写 */
.final-head-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "unit unit"
    "listen write";
  gap: 6px 8px;
  align-items: stretch;
  padding: 6px 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.final-head-unit {
  grid-area: unit;
  justify-self: center;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
}
.final-head-py {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  color: var(--text);
}
.final-head-sep {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 600;
  color: var(--muted);
  margin: 0 1px;
}
.final-head-km {
  font-family: "Noto Sans Khmer", inherit;
  font-size: clamp(13px, 3.5vw, 18px);
  font-weight: 600;
  color: var(--brand2);
}
.final-head-card .final-head-listen,
.final-head-card .final-head-write {
  grid-area: listen;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  min-height: 48px;
  height: 48px;
  padding: 3px 4px;
  box-sizing: border-box;
  white-space: nowrap;
  line-height: 1.15;
  overflow: hidden;
}
.final-head-card .final-head-write {
  grid-area: write;
}
.final-head-card .spell-btn-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.final-head-card .spell-btn-icon {
  display: block;
  font-size: 16px;
  line-height: 1;
}
.final-tone-table thead th .final-head-card {
  margin: 0 auto;
}
.final-tone-table thead th .final-split-mark {
  margin-top: 6px;
}
.chip-fill-grid .pinyin-chip-wrap {
  width: 100%;
  min-width: 0;
  align-items: stretch;
}
.chip-fill-grid .final-head-card {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 12px;
}
.speak-char {
  display: inline;
  padding: 0 1px;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s, box-shadow 0.1s, transform 0.1s;
}
.speak-char.speaking-active {
  background: rgba(244, 140, 6, 0.5);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(244, 140, 6, 0.55);
}
.ruby-unit.speaking-active {
  transform: translateY(-3px) scale(1.08);
  transition: transform 0.12s ease;
  z-index: 2;
}
.ruby-unit.speaking-active .ruby-hz.speak-char {
  background: rgba(244, 140, 6, 0.5);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(244, 140, 6, 0.55);
}
.ruby-unit.speaking-active .ruby-py {
  color: #c2410c;
  font-weight: 700;
}
ruby rt,
.stage3-char-py,
.dialogue .pinyin,
span.pinyin,
td.pinyin,
.tone-py {
  font-family: "Segoe UI", "Noto Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
ruby rt { font-size: 14px; color: var(--brand2); font-weight: 500; }
.trans { color: var(--muted); margin: 6px 0 0; font-size: 15px; }

.vocab-table { width: 100%; border-collapse: collapse; }
.vocab-table th, .vocab-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.vocab-table .hanzi { font-size: 20px; font-weight: 600; }
.vocab-table .pinyin { color: var(--brand2); }

.grammar-card { background: var(--bg); border-radius: 10px; padding: 14px; margin-top: 10px; }
.grammar-card h3 { margin: 0 0 8px; font-size: 16px; }
.grammar-body { white-space: pre-line; margin: 0; line-height: 1.55; }
.grammar-warn { border-left: 3px solid var(--warn, #e8a838); background: #2a2218; }

.obj-list { list-style: none; padding: 0; margin: 0; }
.obj-list li { margin: 8px 0; line-height: 1.5; }
.obj-check { margin-right: 6px; }

.dialogue-scene { background: var(--bg); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; border-left: 3px solid var(--brand2); }
.dialogue-scene .scene-label { font-size: 12px; color: var(--brand2); font-weight: 600; display: block; margin-bottom: 6px; }
.dialogue-scene p { margin: 0; color: var(--muted); font-size: 14px; }

.pinyin-chips-grid { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.pinyin-chip-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 52px; }

/* 声母/韵母芯片：按数量均分铺满，字号略大 */
.chip-fill-grid {
  display: grid !important;
  width: 100%;
  gap: 12px 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.chip-fill-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); max-width: 180px; }
.chip-fill-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chip-fill-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip-fill-grid[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chip-fill-grid[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chip-fill-grid[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip-fill-grid[data-count="7"],
.chip-fill-grid[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chip-fill-grid[data-count="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip-fill-grid[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chip-fill-grid[data-count="11"],
.chip-fill-grid[data-count="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chip-fill-grid .pinyin-chip-wrap {
  width: 100%;
  min-width: 0;
  gap: 6px;
}
.chip-fill-grid .btn-pinyin-chip {
  width: 100%;
  box-sizing: border-box;
  font-size: 20px;
  font-weight: 700;
  padding: 12px 8px;
  justify-content: center;
}
.chip-fill-grid .py-act-write {
  min-width: 44px;
  min-height: 40px;
  font-size: 20px;
}
.chip-fill-grid .final-km-hint {
  font-size: 15px;
  max-width: none;
}
@media (max-width: 640px) {
  .chip-fill-grid[data-count="5"],
  .chip-fill-grid[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .chip-fill-grid[data-count="7"],
  .chip-fill-grid[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chip-fill-grid .btn-pinyin-chip { font-size: 18px; padding: 10px 6px; }
  .chip-fill-grid .final-km-hint { font-size: 13px; }
}
.final-km-hint { font-size: 13px; color: var(--brand2); font-weight: 600; text-align: center; line-height: 1.25; max-width: 80px; }

/* 声母/韵母按钮内：拼音粗体，柬语细字 + 中间点 */
.btn-pinyin-chip .chip-py-main { font-weight: inherit; }
.btn-pinyin-chip .chip-km-dot {
  font-size: 0.72em;
  font-weight: 400;
  color: var(--muted);
  margin: 0 0.15em;
  opacity: 0.85;
}
.btn-pinyin-chip .chip-km-inline,
.final-tone-head-btn .chip-km-inline {
  font-family: "Noto Sans Khmer", inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand2);
  line-height: 1.2;
}
.final-tone-head-btn .chip-km-inline { font-size: 12px; }
.chip-fill-grid .btn-pinyin-chip .chip-km-inline { font-size: 15px; }
@media (max-width: 640px) {
  .chip-fill-grid .btn-pinyin-chip .chip-km-inline { font-size: 13px; }
}

/* 韵母横表：表头一排韵母，下列四声 */
.final-tone-table-wrap {
  overflow-x: auto;
  margin: 4px 0 14px;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.final-tone-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.final-tone-table col.final-tone-axis-col {
  width: 34px;
}
.final-tone-table col.final-tone-data-col {
  width: auto;
}
.final-tone-table th,
.final-tone-table td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #e5e7eb;
  background: #fff;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.final-tone-table thead th {
  background: #fff7ed;
  font-weight: 600;
}
.final-tone-axis-head,
.final-tone-axis-label {
  width: 34px;
  max-width: 34px;
  padding: 4px 1px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: #9a3412;
  background: #fff7ed;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  border: 1px solid #e5e7eb;
}
.final-tone-axis-label {
  background: #fafafa;
  color: #c2410c;
  font-weight: 600;
}
.final-tone-table tbody tr:nth-child(even) .final-tone-axis-label {
  background: #f5f5f5;
}
.final-tone-table tbody tr:nth-child(even) td {
  background: #fafafa;
}
.final-tone-head-btn {
  font-size: 17px;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
  width: 100%;
  max-width: 140px;
  box-sizing: border-box;
}
.final-tone-head-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  min-width: 0;
}
.final-tone-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 4px 2px;
  box-sizing: border-box;
  overflow: hidden;
  gap: 4px;
}
.final-tone-py-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--brand2);
  font-size: clamp(18px, 4.5vw, 26px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  transition: color 0.15s ease, transform 0.15s ease;
}
.final-tone-listen {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  width: 48px;
  height: 48px;
  min-width: 48px !important;
  max-width: 48px;
  min-height: 48px !important;
  max-height: 48px;
  padding: 3px;
  border-radius: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
}
.final-tone-listen .spell-btn-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
}
.final-tone-listen .spell-btn-icon {
  display: block;
  font-size: 14px;
  line-height: 1;
}
.final-tone-head-tools.pinyin-chip-wrap {
  min-width: 0;
}
.final-tone-head-tools .final-km-hint {
  max-width: none;
  font-size: 12px;
}
/* 介音拆读 ·N× 按钮已停用：不在表头展示 */
.final-split-mark {
  display: none !important;
}
.km-phonetic-legend { font-size: 12px; margin: 0 0 10px; }
.km-sound-col { color: var(--brand2); }
.stage2-syllable-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  width: 100%;
}
.stage2-syllable-grid .btn-pinyin-chip {
  font-size: 14px;
  padding: 8px 10px;
  min-width: 96px;
}
.stage2-syllable-grid .pinyin-chip-wrap {
  min-width: 96px;
}
.syllable-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 0;
  padding: 12px 10px 10px;
  background: linear-gradient(180deg, #fffdf9 0%, #fff7ed 100%);
  border: 1px solid #fdba74;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(154, 52, 18, 0.06);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.syllable-card:hover {
  border-color: #fb923c;
  box-shadow: 0 4px 14px rgba(251, 146, 60, 0.14);
}
.syllable-card-face {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  text-align: center;
  width: 100%;
  transition: transform 0.15s ease;
}
.syllable-card-hz {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  color: #111827;
  letter-spacing: 0.02em;
  transition: color 0.15s ease, transform 0.15s ease;
}
.syllable-card-py {
  font-size: 28px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.03em;
  line-height: 1.1;
  transition: color 0.15s ease, transform 0.15s ease;
}
.syllable-card-py-only {
  font-size: 26px;
  color: #111827;
}
.syllable-card.is-speaking .syllable-card-face,
.syllable-card.is-reading .syllable-card-face {
  transform: scale(1.28);
  transform-origin: center center;
}
.syllable-card.is-speaking .syllable-card-py,
.syllable-card.is-speaking .syllable-card-hz,
.syllable-card.is-speaking .syllable-card-py-only,
.syllable-card.is-reading .syllable-card-py,
.syllable-card.is-reading .syllable-card-hz,
.syllable-card.is-reading .syllable-card-py-only {
  color: #0284c7;
}
.syllable-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
  width: 100%;
  margin: 0;
}
.syllable-card-actions.spell-actions {
  display: grid !important;
  width: 100% !important;
  margin-left: 0 !important;
  flex-direction: unset;
  flex-wrap: nowrap;
}
.syllable-card-actions .btn-spell-play { grid-column: 1; justify-self: stretch; }
.syllable-card-actions .btn-spell-write { grid-column: 2; justify-self: stretch; }
.syllable-card-actions .btn-spell-follow { grid-column: 3; justify-self: stretch; }
.syllable-card-actions.spell-actions .btn-spell-play,
.syllable-card-actions.spell-actions .btn-spell-follow,
.syllable-card-actions.spell-actions .btn-spell-write {
  flex: none !important;
  width: 100%;
  min-width: 0 !important;
  min-height: 48px;
  padding: 4px 2px;
  margin: 0;
  border-radius: 10px !important;
  gap: 2px;
}
.syllable-card-actions .spell-btn-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
}
.syllable-card-actions .spell-btn-icon {
  display: block;
  font-size: 15px;
  line-height: 1;
}
@media (max-width: 640px) {
  .stage2-syllable-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .syllable-card {
    padding: 10px 8px 8px;
    gap: 8px;
  }
  .syllable-card-hz { font-size: 16px; }
  .syllable-card-py { font-size: 24px; }
  .syllable-card-actions { gap: 4px; }
  .syllable-card-actions.spell-actions .btn-spell-play,
  .syllable-card-actions.spell-actions .btn-spell-follow,
  .syllable-card-actions.spell-actions .btn-spell-write {
    min-height: 44px;
    padding: 3px 1px;
  }
  .syllable-card-actions .spell-btn-label { font-size: 9px; }
  .syllable-card-actions .spell-btn-icon { font-size: 14px; }
}
@media (min-width: 900px) {
  .stage2-syllable-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  }
}

.lesson-words-wrap {
  width: 100%;
  max-width: 100%;
}
.lesson-words-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.lesson-words-table th,
.lesson-words-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
}
.lesson-words-table th {
  color: var(--brand2);
  font-size: 12px;
  font-weight: 600;
}
.lesson-words-table .lw-key { width: 12%; }
.lesson-words-table .lw-key code {
  font-size: 14px;
  color: var(--brand2);
  font-weight: 700;
}
.lesson-words-table .hanzi { font-size: 20px; font-weight: 700; width: 14%; }
.lesson-words-table .pinyin { color: var(--brand2); font-weight: 600; width: 16%; }
.lesson-words-table .lw-meaning { width: 48%; font-size: 13px; line-height: 1.35; color: #f87171; font-weight: 600; text-align: center; }
.lesson-words-table .vocab-actions {
  width: 56px;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  padding-right: 2px;
}
.lesson-words-table .vocab-actions .btn-listen-compact {
  margin: 0 auto;
}
.lw-gloss-short { display: none; }

/* 变调课真词：flex 行布局，避免表格把右侧按钮裁切 */
.sandhi-word-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.sandhi-word-head,
.sandhi-word-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 0.7fr) 112px;
  gap: 8px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}
.sandhi-word-head {
  padding: 0 0 6px;
  color: var(--brand2);
  font-size: 12px;
  font-weight: 600;
}
.sandhi-word-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.sandhi-word-main {
  min-width: 0;
}
.sandhi-word-ruby {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.2;
}
.sandhi-word-py {
  color: var(--brand2);
  font-weight: 600;
  font-size: 13px;
}
.sandhi-word-hz {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #1a1a1a);
}
.sandhi-word-gloss {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.3;
  color: #f87171;
  font-weight: 600;
}
.sandhi-word-spoken {
  color: var(--brand2);
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  word-break: break-word;
}
.sandhi-word-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 112px;
  flex-shrink: 0;
  justify-self: end;
}
.sandhi-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 112px;
  height: 38px;
  margin: 0;
  padding: 0 8px;
  border-radius: 10px;
  border-width: 1px;
  border-style: solid;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.sandhi-btn > span:last-child {
  font-size: 14px;
  line-height: 1;
}
.sandhi-btn-listen {
  background: linear-gradient(90deg, var(--brand), var(--brand2)) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
.sandhi-btn-read {
  background: #ecfdf5 !important;
  border-color: #34d399 !important;
  color: #047857 !important;
}

/* 第三阶段：生字卡片 — 固定一排五个 */
.stage3-char-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 800px) {
  .stage3-char-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .stage3-char-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stage3-char-card {
  text-align: left;
  padding: 10px 8px 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
}
.stage3-char-grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "tl tr"
    "bl br";
  gap: 8px;
  align-items: center;
}
.stage3-slot-tl { grid-area: tl; justify-self: start; align-self: start; }
.stage3-slot-tr { grid-area: tr; justify-self: end; align-self: start; }
.stage3-slot-bl { grid-area: bl; justify-self: start; }
.stage3-slot-br { grid-area: br; justify-self: end; }
.stage3-char-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.stage3-char-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stage3-char-main {
  min-width: 0;
  flex: 1;
  text-align: center;
}
.stage3-char-hanzi {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
}
.stage3-char-py {
  margin-top: 2px;
  color: var(--brand2);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
}
.stage3-char-grid-actions .btn-spell-play,
.stage3-char-grid-actions .btn-spell-follow,
.stage3-char-grid-actions .btn-spell-write {
  min-width: 56px;
  min-height: 48px;
  padding: 4px 8px;
  border-radius: 10px !important;
}
.btn-char-listen {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line, #2a3d58);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--text, #e8eef7);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-char-listen:hover {
  border-color: var(--brand2, #38bdf8);
  background: rgba(56, 189, 248, 0.22);
}
.stage3-char-practice {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
/* 第五阶段图卡 */
.picture-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .picture-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .picture-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.picture-card {
  text-align: center;
  padding: 12px 10px 10px;
  border: 1px solid var(--line, #2a3d58);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.picture-card-visual {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.06);
}
.picture-card-visual img {
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
}
.picture-card-emoji {
  font-size: 42px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picture-card-hanzi {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.picture-card-py {
  margin-top: 4px;
  color: var(--brand2, #38bdf8);
  font-weight: 600;
  font-size: 13px;
}
.picture-card-km {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted, #8b90a3);
  line-height: 1.35;
  min-height: 1.35em;
}
.picture-card-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.picture-card-actions .btn-spell-play,
.picture-card-actions .btn-spell-follow,
.picture-card-actions .btn-char-listen,
.picture-card-actions .btn-char-practice {
  width: 100%;
  min-height: 48px;
}
.reading-passage-block .reading-passage {
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.9), rgba(255, 255, 255, 0.95));
  border-radius: 12px;
  padding: 8px 16px 4px;
  border: 1px solid var(--line, #e8e0d4);
}
.reading-passage-block .reading-line {
  padding: 16px 0;
}
.reading-passage-block .zh-big {
  font-size: 1.35rem;
  line-height: 1.7;
}
.reading-passage-block .zh-stack .hanzi-chars {
  line-height: 1.7;
}
.reading-passage-block .reading-meta {
  margin-top: 12px;
  font-size: 12px;
}
.stage3-stroke-follow {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  flex: 1;
  min-width: 0;
  width: 100%;
}
.stage3-stroke-follow-label {
  display: none;
}
.stage3-stroke-follow-body {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.stage3-stroke-build {
  min-height: 52px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
}
.stage3-stroke-build-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
}
.stage3-stroke-step {
  display: inline-flex;
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  overflow: hidden;
}
.stage3-stroke-glyph {
  width: 100%;
  height: 100%;
  display: block;
}
.stage3-stroke-plus {
  display: none;
}
.stage3-stroke-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  justify-content: center;
  align-self: center;
  align-items: stretch;
  margin-left: auto;
}
.stage3-stroke-actions .btn-spell-play,
.stage3-stroke-actions .btn-spell-write {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  min-width: 56px;
  min-height: 48px;
  padding: 5px 8px;
  border-radius: 10px;
  margin: 0;
  line-height: 1.15;
}
.stage3-stroke-actions .spell-btn-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.stage3-stroke-actions .spell-btn-icon {
  display: block;
  font-size: 16px;
  line-height: 1;
  margin-top: 1px;
}
.stage3-stroke-practice-block {
  background: var(--block-tip, #fff8ef);
}
.stage3-stroke-practice-block h2 {
  background: #ffe8b8;
  color: #b45309;
}
.stage3-stroke-practice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stage3-stroke-practice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  min-width: 0;
}
.stage3-stroke-practice-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  gap: 2px;
}
.stage3-stroke-practice-hanzi {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
}
.stage3-stroke-practice-py {
  font-size: 13px;
  color: var(--brand2, #c2410c);
}
@media (max-width: 640px) {
  .stage3-stroke-practice-row {
    flex-direction: column;
    align-items: stretch;
  }
  .stage3-stroke-practice-head {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
  }
  .stage3-stroke-step {
    width: 36px;
    height: 36px;
  }
  .stage3-stroke-actions .btn-spell-play,
  .stage3-stroke-actions .btn-spell-write {
    min-width: 52px;
    min-height: 44px;
    padding: 4px 6px;
  }
  .stage3-stroke-actions .spell-btn-label {
    font-size: 10px;
  }
  .stage3-stroke-actions .spell-btn-icon {
    font-size: 15px;
  }
}
.btn-char-practice {
  border: 1px solid var(--line, #2a3d58);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #e8eef7);
  font-size: 28px;
  line-height: 1;
  min-height: 52px;
  padding: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-char-practice:hover {
  border-color: var(--brand2, #38bdf8);
  background: rgba(56, 189, 248, 0.12);
}
.btn-pronounce-follow.btn-char-practice {
  background: rgba(251, 191, 36, 0.12);
}
.btn-pronounce-mic {
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 4px 6px;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
}
.btn-pronounce-mic:hover {
  filter: brightness(1.15);
}
.stage3-word-main .btn-pronounce-mic {
  font-size: 20px;
}
.dialogue .speak-btns .btn-pronounce-mic {
  font-size: 20px;
}
.stage3-char-km {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted, #9aa8bc);
  min-height: 1.4em;
}
.stage3-char-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.stage3-char-compound {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line, #2a3d58);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.stage3-char-compound .btn-ghost {
  justify-content: center;
  font-size: 12px;
  padding: 4px 6px;
}
.stage3-pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.stage3-pattern-card {
  padding: 12px 14px;
  border: 1px solid var(--line, #2a3d58);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.stage3-pattern-zh {
  font-size: 18px;
  font-weight: 700;
}
.stage3-pattern-km {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}
.dialogue .trans.stage3-km {
  color: #4a5568;
  font-size: 15px;
  font-weight: 500;
}
.stage3-words-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stage3-word-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.stage3-word-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.stage3-word-main {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px 18px;
  flex: 1 1 auto;
  min-width: 0;
}
.stage3-word-zh {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
}
.stage3-word-actions {
  margin-left: 0;
  flex-shrink: 0;
}
.stage3-word-actions-after {
  margin-top: 0;
  justify-content: flex-start;
}
/* 词卡：例句/词与按钮同一行 */
.stage3-word-follow {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  width: 100%;
  margin-top: 0.35rem;
}
.stage3-word-follow .hsk-word-example,
.stage3-word-follow .stage3-word-head-speak {
  flex: 1 1 auto;
  min-width: 0;
}
.stage3-word-follow .stage3-word-actions {
  flex: 0 0 auto;
  margin: 0 0 2px auto;
}
.stage3-word-main .hanzi {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
.stage3-word-main .pinyin {
  color: var(--brand2);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.stage3-word-gloss {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  color: #4a5568;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}
.stage3-word-gloss-km {
  font-family: "Noto Sans Khmer", inherit;
  color: #f87171;
  font-weight: 600;
}
.usage-tip {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid #dc2626;
  background: #fef2f2;
  border-radius: 0 8px 8px 0;
}
.usage-tip-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 4px;
}
.usage-tip p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #7f1d1d;
}
.usage-tip-example {
  margin-top: 6px;
  border-left-color: #ea580c;
  background: #fff7ed;
}
.usage-tip-example .usage-tip-label { color: #c2410c; }
.usage-tip-example p { color: #9a3412; }
.dialogue-note {
  margin-top: 8px;
  margin-bottom: 10px;
}
.dialogue-note .usage-tip-label {
  font-size: 13px;
  letter-spacing: 0.02em;
}
.dialogue-note-title {
  font-weight: 700 !important;
  margin: 2px 0 4px !important;
  color: #991b1b !important;
  font-size: 15px;
}
.dialogue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.dialogue-head h2 {
  margin: 0;
}
.btn-speak-all-prominent {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  border-radius: 12px !important;
  background: linear-gradient(90deg, #dc2626, #b91c1c) !important;
  border: 1px solid #b91c1c !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.28);
}
.btn-speak-all-prominent .play-all-icon {
  font-size: 22px;
  line-height: 1;
}
.btn-speak-all-prominent:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.server-status-hidden,
.server-status[hidden] {
  display: none !important;
}

/* 对话：不同说话人不同颜色 */
.dialogue .line {
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-left: -2px;
}
.dialogue .speaker {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.dialogue .line.spk-0 { border-left-color: var(--spk-0); background: rgba(3, 105, 161, 0.04); border-radius: 0 8px 8px 0; }
.dialogue .line.spk-0 .speaker { color: var(--spk-0); }
.dialogue .line.spk-1 { border-left-color: var(--spk-1); background: rgba(180, 83, 9, 0.05); border-radius: 0 8px 8px 0; }
.dialogue .line.spk-1 .speaker { color: var(--spk-1); }
.dialogue .line.spk-2 { border-left-color: var(--spk-2); background: rgba(21, 128, 61, 0.05); border-radius: 0 8px 8px 0; }
.dialogue .line.spk-2 .speaker { color: var(--spk-2); }
.dialogue .line.spk-3 { border-left-color: var(--spk-3); background: rgba(190, 18, 60, 0.05); border-radius: 0 8px 8px 0; }
.dialogue .line.spk-3 .speaker { color: var(--spk-3); }
.dialogue .line.spk-4 { border-left-color: var(--spk-4); background: rgba(124, 58, 237, 0.05); border-radius: 0 8px 8px 0; }
.dialogue .line.spk-4 .speaker { color: var(--spk-4); }

.quiz-item-listen {
  position: relative;
  padding-top: 8px;
}
.quiz-item-listen .quiz-reshuffle {
  float: right;
  margin: 0 0 8px 8px;
  padding: 4px 10px;
  font-size: 13px;
}
.quiz-tier-listen {
  background: rgba(244, 140, 6, 0.15);
  color: var(--brand2);
}
.quiz-opts { margin-top: 6px; }
.quiz-opts-audio {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}
.quiz-opts-audio .opt-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf0;
  box-sizing: border-box;
}
.quiz-opts-audio .opt-audio:has(input:checked) {
  border-color: var(--brand2);
  background: #ffe8c8;
}
.quiz-opts-audio .opt-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin: 0;
}
.quiz-opts-audio .opt-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  min-width: 1.5em;
}
.quiz-opts-audio .quiz-opt-speak {
  flex-shrink: 0;
}
.quiz-opts-audio .quiz-opt-speak:hover {
  filter: brightness(1.06);
}
.quiz-opts-audio .opt-tap-hint {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  line-height: 1.15;
}

.vocab-table .km-sound { font-size: 18px; font-weight: 600; color: var(--brand2); white-space: nowrap; }

.vocab-extra, .vocab-example { font-size: 12px; margin-top: 4px; }
.vocab-hint { font-size: 12px; color: #e8a838; margin-top: 4px; line-height: 1.35; }

.quiz-tier { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 4px; margin-bottom: 6px; background: #2a3548; color: var(--brand2); }
.quiz-tier-mid { color: #7ec8e3; }
.quiz-tier-apply { color: #8fd48a; }
.quiz-tier-listen_word,
.quiz-tier-listen_sent { color: #f0c674; }
.quiz-tier-match { color: #c3a6ff; }
.quiz-tier-meaning { color: #7ec8e3; }
.quiz-tier-next { color: #8fd48a; }
.quiz-match {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.quiz-match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-chip {
  border: 1px solid var(--line, #2a3d58);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #e8eef7);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
}
.match-chip:hover { border-color: var(--brand2, #38bdf8); }
.match-chip.active {
  border-color: var(--brand2, #38bdf8);
  background: rgba(56, 189, 248, 0.18);
}
.match-chip.matched {
  border-color: #8fd48a;
  background: rgba(143, 212, 138, 0.12);
}
.quiz-match-links {
  margin-top: 8px;
  font-size: 13px;
  min-height: 1.2em;
}
.quiz-listen { margin: 0; }
.quiz-prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 12px;
  padding: 14px 16px;
  border: 2px solid #fb923c;
  border-radius: 12px;
  background: #fff7ed;
}
.quiz-prompt-badge {
  font-size: 18px;
  font-weight: 800;
  color: #c2410c;
  line-height: 1.2;
  min-width: 3.2em;
  flex-shrink: 0;
}
.quiz-prompt-speak {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 52px;
  padding: 8px 16px !important;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.quiz-prompt-speak:hover {
  filter: brightness(1.06);
}
.quiz-prompt-speak .spell-btn-label {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
}
.quiz-prompt-speak .spell-btn-icon {
  font-size: 20px;
  line-height: 1;
}
.quiz-prompt-icon {
  font-size: 28px;
  line-height: 1;
}
.quiz-prompt-labels {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
}

.stroke-why { line-height: 1.55; font-size: 15px; }
.stroke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.stroke-card {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stroke-glyph {
  font-size: 42px;
  line-height: 1.2;
  min-height: 52px;
  font-family: "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #1e3a5f;
}
.stroke-glyph--svg {
  display: flex;
  align-items: center;
  justify-content: center;
}
.stroke-glyph-svg {
  width: 52px;
  height: 52px;
  display: block;
}
.stroke-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  text-align: left;
}
.stroke-head-text { min-width: 0; flex: 1; }
.stroke-name { font-size: 18px; font-weight: 600; margin: 0; line-height: 1.2; }
.stroke-py { color: var(--brand2, #c2410c); font-size: 14px; margin-top: 2px; }
.stroke-head-read {
  flex: 0 0 auto;
  padding: 6px 8px !important;
  font-size: 12px !important;
  white-space: nowrap;
}
.stroke-head-read .spell-btn-label { font-size: 12px; }
.stroke-tip {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin: 8px 0;
  min-height: 2.6em;
  text-align: left;
}
.stroke-example {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 14px;
}
.stroke-example .hanzi { font-size: 22px; font-weight: 600; }
.stroke-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.stroke-actions .btn-spell-play,
.stroke-actions .btn-spell-write {
  width: 100%;
  min-width: 0;
  padding: 8px 6px;
  font-size: 13px;
}

.quiz-feedback { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; line-height: 1.45; }
.quiz-feedback.quiz-ok { background: #1a2e1a; color: #8fd48a; }
.quiz-feedback.quiz-fail { background: #2e2218; color: #e8a838; }

.btn-primary, .btn-ghost, .btn-speak, .btn-mini-speak {
  border: none; cursor: pointer; font-family: inherit; border-radius: 999px;
}
.btn-primary { background: linear-gradient(90deg, var(--brand), var(--brand2)); color: #fff; padding: 11px 22px; font-weight: 600; display: inline-block; }
.btn-ghost { background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 10px 20px; display: inline-block; }
.btn-speak { background: #2a3548; color: var(--text); padding: 10px 18px; font-size: 14px; }
.btn-mini-speak { background: transparent; font-size: 16px; padding: 4px 8px; }

.quiz-item { margin-bottom: 18px; }
.quiz-item .q { font-weight: 600; margin-bottom: 8px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 4px 0; background: var(--bg); border-radius: 8px; cursor: pointer; }
.opt input { flex-shrink: 0; margin: 0; cursor: pointer; }
.opt:has(input:checked) { background: #243044; border: 1px solid var(--brand2); }
.opt:hover { background: #243044; }
.quiz-result { margin-top: 16px; padding: 14px; border-radius: 10px; background: #1a3d2e; border: 1px solid var(--ok); }
.quiz-result.fail { background: #3d1a1a; border-color: #c44; }
.hidden { display: none; }

.chapter-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; flex-wrap: wrap; }

.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form input { flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 10px; }
.search-form button { background: var(--brand); color: #fff; border: none; padding: 0 20px; border-radius: 10px; cursor: pointer; }

.speak-banner {
  background: #2a3d58; border: 1px solid var(--brand2); color: #fff;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px;
}
.diag-pre { background: var(--bg); padding: 12px; border-radius: 8px; overflow: auto; font-size: 13px; }

.server-status {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: #243044; border: 1px solid var(--line); color: var(--muted);
}
.server-status.ok { background: #1a3d2e; border-color: var(--ok); color: #b8f0d0; }
.server-status.fail { background: #3d1a1a; border-color: #c44; color: #ffb4b4; }
.speak-toast-error { background: #3d1a1a !important; border-color: #c44 !important; }

.speak-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1a3d2e; border: 1px solid var(--ok); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-size: 15px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: 92vw; text-align: center;
}
.speak-toast-error { background: #3d1a1a !important; border-color: #c44 !important; }

/* ── 书写练习 ── */
.vocab-actions { display: flex; gap: 4px; white-space: nowrap; }
.btn-mini-write { background: transparent; border: none; cursor: pointer; font-size: 16px; padding: 4px 8px; }

/* 拼音听 / 写 / 读：彩色大按钮（类似拼读） */
.py-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 42px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.py-act-listen,
.btn-mini-speak.py-act-listen,
.btn-mini-speak:not(.btn-pinyin-speak) {
  background: linear-gradient(90deg, var(--brand), var(--brand2)) !important;
  border: 1px solid var(--brand) !important;
  color: #fff !important;
  border-radius: 10px !important;
}
.btn-listen-compact {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 48px;
  height: 48px;
  min-width: 48px !important;
  max-width: 48px;
  min-height: 48px !important;
  max-height: 48px;
  padding: 3px !important;
  margin: 0;
  border-radius: 10px !important;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
}
.btn-listen-compact .spell-btn-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}
.btn-listen-compact .spell-btn-icon {
  display: block;
  font-size: 14px;
  line-height: 1;
}
.lesson-words-table .lw-meaning {
  width: 48%;
  font-size: 13px;
  line-height: 1.35;
  color: #f87171;
  font-weight: 600;
  text-align: center;
}
.lesson-words-table .vocab-actions {
  width: 56px;
  text-align: center;
  vertical-align: middle;
}
.lesson-words-table .vocab-actions .btn-listen-compact {
  margin: 0 auto;
}
.py-act-write,
.btn-mini-write.py-act-write {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.py-act-read,
.btn-pronounce-mic.py-act-read {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
  border: 1px solid #6ee7b7;
}
.btn-pronounce-mic {
  border: 1px solid #6ee7b7;
  background: #ecfdf5;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 18px;
  cursor: pointer;
  vertical-align: middle;
  min-width: 42px;
  min-height: 38px;
}
.btn-pronounce-mic:hover { border-color: #34d399; filter: brightness(0.98); }
.final-tone-head-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.final-tone-head-btn {
  font-size: 17px;
  min-height: 40px;
  padding: 8px 12px;
}
.spell-actions .btn-spell-play {
  border-radius: 10px;
}
.spell-actions .btn-spell-follow {
  border-radius: 10px;
}
.spell-actions .btn-spell-write {
  border-radius: 10px;
}

/* 统一三色操作钮：听=红 · 读=黄 · 读=绿 */
.btn-spell-play,
.btn-act-listen,
.btn-spell-play.btn-primary {
  background: linear-gradient(90deg, var(--brand), var(--brand2)) !important;
  border: 1px solid var(--brand) !important;
  color: #fff !important;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border-radius: 10px !important;
}
.btn-spell-play:hover,
.btn-act-listen:hover {
  filter: brightness(1.06);
}
.btn-spell-follow,
.btn-act-read {
  background: #ecfdf5 !important;
  border: 1px solid #34d399 !important;
  color: #047857 !important;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border-radius: 10px !important;
}
.btn-spell-follow:hover,
.btn-act-read:hover {
  filter: brightness(0.98);
  border-color: #10b981 !important;
}
.btn-spell-write,
.btn-act-write {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px !important;
  margin: 0;
  min-width: 64px;
  min-height: 52px;
  line-height: 1.15;
  background: #fef3c7 !important;
  border: 1px solid #f59e0b !important;
  color: #b45309 !important;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-spell-write:hover,
.btn-act-write:hover {
  filter: brightness(0.98);
  border-color: #f59e0b !important;
}
.btn-spell-write .spell-btn-label,
.btn-act-write .spell-btn-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.btn-spell-write .spell-btn-icon,
.btn-act-write .spell-btn-icon {
  display: block;
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}

.writing-section .writing-char-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.writing-char-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.writing-char-card:hover { border-color: var(--brand2); transform: translateY(-1px); }
.writing-char-card .wcc-hz { display: block; font-size: 36px; font-weight: 700; line-height: 1.1; }
.writing-char-card .wcc-py { display: block; font-size: 15px; color: var(--brand2); margin-top: 4px; }
.writing-char-card .wcc-label { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }

.final-tone-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.tone-cell-actions { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.tone-cell-py { font-size: 18px; font-weight: 600; color: var(--text); min-width: 2em; }
.btn-spell-play.small { padding: 4px 10px; font-size: 13px; margin-left: 6px; }
.speak-banner code { font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.tone-writing-table { width: 100%; border-collapse: collapse; min-width: 320px; }
.tone-writing-table th, .tone-writing-table td { padding: 6px; text-align: center; }
.tone-writing-table thead th { color: var(--brand2); font-size: 13px; font-weight: 600; }
.tone-writing-table .final-label { color: var(--muted); font-size: 15px; width: 36px; }

.tone-cell-btn {
  width: 100%;
  min-width: 56px;
  min-height: 56px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
}
.tone-cell-btn:hover { border-color: var(--brand2); }
.tone-cell-py { font-size: 22px; font-weight: 700; line-height: 1; }
.tone-cell-action { font-size: 11px; color: var(--muted); }

body.write-modal-open { overflow: hidden; }
body.pronounce-modal-open { overflow: hidden; }

.pronounce-modal {
  position: fixed; inset: 0; z-index: 310;
  display: flex; align-items: flex-end; justify-content: center;
}
.pronounce-modal.hidden { display: none; }
.pronounce-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.pronounce-modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.btn-pronounce-close {
  position: absolute; top: 10px; right: 12px;
  border: none; background: transparent; font-size: 28px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.pronounce-title { font-size: 1.25rem; margin: 0 0 8px; text-align: center; }
.pronounce-target { font-size: 2rem; font-weight: 800; text-align: center; color: var(--brand2); margin: 0 0 8px; }
.pronounce-hint { font-size: 14px; text-align: center; margin: 0 0 12px; }
.pronounce-status { min-height: 2.5em; text-align: center; margin: 12px 0; font-size: 15px; }
.pronounce-status.ok { color: var(--ok); font-weight: 600; }
.pronounce-status.err { color: #e74c3c; }
.pronounce-meter-wrap { margin: 8px 0; text-align: center; font-size: 13px; }
.pronounce-meter-wrap.hidden { display: none; }
.pronounce-meter {
  display: inline-block; width: 120px; height: 8px; margin-left: 8px;
  background: var(--line); border-radius: 4px; vertical-align: middle; overflow: hidden;
}
.pronounce-meter span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  transition: width 0.08s linear;
}
.pronounce-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px;
}
.pronounce-actions .hidden { display: none; }
.btn-pronounce-mic {
  border: 1px solid var(--line);
  background: var(--card2, #1a2332);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  vertical-align: middle;
}
.btn-pronounce-mic:hover { border-color: var(--brand2); }
.tone-cell-actions .btn-pronounce-mic { padding: 2px 6px; font-size: 12px; }

.write-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
.write-modal.hidden { display: none; }
.write-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.write-modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh;
  overflow-y: auto;
}
.write-modal.write-mode-trace .write-modal-panel {
  max-width: 100%;
  border-radius: 16px 16px 0 0;
}
.btn-write-close {
  position: absolute; right: 14px; top: 10px;
  background: transparent; border: none; color: var(--muted);
  font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 10px;
}
.write-modal-title { font-size: 42px; font-weight: 800; text-align: center; line-height: 1.1; }
.write-modal-sub { text-align: center; margin-top: 4px; font-size: 15px; }
.write-stage {
  margin: 16px auto;
  display: flex; justify-content: center; align-items: center;
  min-height: 200px;
}
.write-pinyin-wrap {
  position: relative;
  width: min(85vw, 280px);
  aspect-ratio: 1;
  margin: 0 auto;
  background: var(--bg);
  border: 2px solid var(--brand2);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(244,140,6,.25);
  touch-action: none;
  user-select: none;
}
.write-pinyin-wrap::before,
.write-pinyin-wrap::after {
  content: ""; position: absolute; pointer-events: none;
  background: rgba(244,140,6,.18);
}
.write-pinyin-wrap::before {
  left: 50%; top: 6%; bottom: 6%; width: 1px; transform: translateX(-50%);
}
.write-pinyin-wrap::after {
  top: 50%; left: 6%; right: 6%; height: 1px; transform: translateY(-50%);
}
.write-pinyin-guide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: min(42vw, 140px); font-weight: 700;
  color: rgba(139,149,168,.4);
  pointer-events: none; z-index: 1;
}
.write-pinyin-guide.hidden,
.write-pinyin-canvas.hidden { display: none !important; }
.write-pinyin-guide.animate {
  animation: pinyin-pop .65s ease;
}
@keyframes pinyin-pop {
  0% { transform: scale(.85); opacity: .3; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: .55; }
}
.write-pinyin-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 2; touch-action: none; cursor: crosshair;
}
.write-pinyin-svg {
  position: absolute; inset: 8%;
  width: 84%; height: 84%;
  z-index: 3;
  pointer-events: none;
}
.write-mode-trace .write-pinyin-svg { cursor: crosshair; }
.final-tone-cell {
  display: inline-flex; align-items: center; gap: 4px; margin: 4px;
}
.pinyin-chip-wrap .btn-mini-write { margin: 2px 0 0; }
.write-hanzi-target { margin: 0 auto; }
.write-queue-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0.55rem 0 0.15rem;
  padding: 0 4px;
}
.write-queue-strip.hidden { display: none; }
.write-queue-ch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  min-height: 1.7em;
  padding: 2px 5px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #94a3b8;
  border: none;
  border-radius: 8px;
  background: #e2e8f0;
  cursor: pointer;
  line-height: 1.2;
}
.write-queue-ch:hover {
  filter: brightness(0.97);
}
.write-queue-ch.is-done {
  color: #047857;
  background: #bbf7d0;
}
.write-queue-ch.is-current {
  color: #dc2626;
  background: #fee2e2;
  font-size: 0.95rem;
  min-width: 1.45em;
  min-height: 1.45em;
  font-weight: 800;
  box-shadow: inset 0 0 0 1.5px #f87171;
}
.write-modal-panel.is-sentence .write-modal-title {
  font-size: 28px;
}
.write-modal-panel.is-sentence .write-modal-tip {
  display: none;
}
.write-current-big {
  margin: 0.45rem auto 0.1rem;
  text-align: center;
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  color: #dc2626;
  letter-spacing: 0.02em;
  user-select: none;
}
.write-current-big.hidden { display: none; }
.write-modal-tip { text-align: center; font-size: 14px; margin: 8px 0 0; }
.write-progress { text-align: center; color: var(--ok); font-weight: 600; min-height: 1.4em; margin: 6px 0; }
.write-modal-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px;
}
.write-modal-actions .btn-primary { text-align: center; padding: 14px 10px; border-radius: 12px; }
.write-modal.write-mode-trace .write-pinyin-wrap {
  width: min(85vw, 300px);
}
.write-modal.write-mode-trace .write-hanzi-target svg {
  width: min(85vw, 300px) !important;
  height: min(85vw, 300px) !important;
}

@media (min-width: 640px) {
  .write-modal { align-items: center; }
  .write-modal-panel { border-radius: 20px; max-height: 88vh; }
}

.progress-lessons { text-align: center; margin: 8px 0 0; font-size: 13px; }

.lesson-plan-list { margin: 0; padding-left: 0; list-style: none; }
.lesson-plan-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 12px; margin: 6px 0;
  background: var(--bg); border-radius: 10px; border: 1px solid var(--line);
}
.lesson-plan-num { font-size: 12px; color: var(--brand2); font-weight: 700; flex-shrink: 0; min-width: 64px; }
.lesson-plan-title { font-size: 15px; }

/* ── 录音向导 ── */
.record-wizard { max-width: 640px; }
.record-progress-line { margin: 16px 0; }
.record-progress-bar {
  display: block; height: 8px; background: var(--line); border-radius: 999px;
  margin-top: 8px; overflow: hidden;
}
.record-progress-bar span {
  display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2));
  transition: width 0.25s ease;
}
.record-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin: 20px 0;
}
.record-label { font-size: 2rem; margin: 8px 0; color: var(--brand2); }
.record-filename code, .record-task-list code { font-size: 12px; color: var(--muted); }
.record-hint { color: var(--muted); font-size: 15px; margin: 12px 0 20px; }
.record-https-hint {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px;
  background: #fff8e6; border: 1px solid #f1c40f; color: #7a5b00; font-size: 14px;
}
.record-https-hint.hidden { display: none; }
.record-mic-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 12px 0 8px;
}
.record-mic-select {
  flex: 1; min-width: 220px; max-width: 520px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 14px;
}
.record-mic-warn {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px;
  background: #fff1f0; border: 1px solid #f5c2c0; color: #a94442; font-size: 14px;
}
.record-mic-warn.hidden { display: none; }
.record-meter-wrap {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 4px;
}
.record-meter-wrap.hidden { display: none; }
.record-meter {
  flex: 1; height: 10px; border-radius: 999px; background: #e8ecf0; overflow: hidden;
}
.record-meter span {
  display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
  transition: width 0.08s linear;
}
.record-status.ok { color: var(--ok); }
.record-status.err { color: #e74c3c; }
.record-actions, .record-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.record-list-details { margin-top: 24px; }
.record-task-list { list-style: none; padding: 0; margin: 12px 0 0; max-height: 280px; overflow-y: auto; }
.record-task-pick {
  width: 100%; text-align: left; padding: 8px 12px; margin: 4px 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); cursor: pointer; font-size: 14px;
}
.record-task-pick.done .record-task-check { color: var(--ok); }
.record-task-pick.active { border-color: var(--brand2); }


/* ══════════════════════════════════════
   UI 改版：暖色首页 / 阶段色 / 吸顶 / 拼读表
   ══════════════════════════════════════ */

.wrap { max-width: 900px; margin: 0 auto; padding: 16px 16px calc(60px + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); width: 100%; }

.footer {
  text-align: center;
  padding: 24px 16px calc(24px + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  min-height: var(--bottom-nav-h);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 10px;
}
.bottom-nav-icon {
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 400;
}
.bottom-nav-item.is-active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}
body.write-modal-open .bottom-nav,
body.pronounce-modal-open .bottom-nav {
  display: none;
}
.exam-page { max-width: 36rem; }
.exam-progress { margin: 0 0 0.85rem; font-weight: 600; }
.exam-block-title {
  margin: 1.25rem 0 0.35rem;
  font-size: 1.05rem;
}
.exam-block-hint { margin: 0 0 0.75rem; font-size: 0.88rem; }
.exam-mock-card {
  background: linear-gradient(165deg, #fff7ed 0%, #ffffff 72%);
  border-color: color-mix(in srgb, #c2410c 22%, var(--line));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  cursor: default;
  text-decoration: none;
  padding: 0.7rem 0.85rem;
}
.exam-mock-card:hover { border-color: #c2410c; }
.exam-mock-card h2 {
  color: #c2410c;
  font-size: 1.05rem;
  margin: 0 0 0.1rem;
}
.exam-mock-card .exam-level-main p {
  font-size: 0.8rem;
  line-height: 1.25;
}
.exam-mock-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.exam-mock-foot {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.exam-mock-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.65rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid color-mix(in srgb, #c2410c 12%, var(--line));
  font-size: 0.78rem;
  line-height: 1.3;
}
.exam-mock-stats > span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  white-space: nowrap;
}
.exam-mock-stats i {
  font-style: normal;
  color: var(--muted);
}
.exam-mock-stats strong {
  font-weight: 700;
  color: #9a3412;
  font-size: 0.85rem;
}
.exam-mock-card-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
}
.exam-mock-card-actions .btn-primary,
.exam-mock-card-actions .btn-secondary {
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  line-height: 1.2;
}
.exam-mock-wrong-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
@media (min-width: 520px) {
  .exam-mock-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
  }
  .exam-mock-stats {
    flex: 1 1 auto;
  }
  .exam-mock-card-actions {
    flex: 0 0 auto;
    width: auto;
  }
  .exam-mock-card-actions .btn-primary,
  .exam-mock-card-actions .btn-secondary {
    flex: 0 0 auto;
    padding: 0.42rem 0.75rem;
  }
}
.mock-wrong-row-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}
.mock-wrong-msg {
  font-size: 0.92rem;
  font-weight: 700;
}
.mock-wrong-msg.is-ok { color: #15803d; }
.mock-wrong-msg.is-bad,
.mock-wrong-msg.is-warn { color: #c2410c; }
.mock-wrong-item.is-removing {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.exam-level-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.exam-level-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: linear-gradient(165deg, #fff5f5 0%, #ffffff 70%);
}
.exam-level-card:hover { border-color: var(--stage-4); }
.exam-level-card.is-soon { opacity: 0.65; pointer-events: none; }
.exam-level-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  color: var(--stage-4);
}
.exam-level-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.exam-level-meta { font-weight: 700; color: var(--stage-4); white-space: nowrap; }

/* HSK 模拟机考 */
.mock-exam-page { max-width: 40rem; margin: 0 auto 1.5rem; }
.mock-exam-back { display: inline-block; margin-bottom: 0.75rem; }
.mock-exam-hero h1 { margin: 0 0 0.35rem; font-size: 1.45rem; }
.mock-exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 650;
  color: #44403c;
}
.mock-exam-timer {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  background: #1c1917;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.mock-start-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 1rem 1.05rem;
  margin: 1rem 0;
}
.mock-start-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  line-height: 1.55;
}
.mock-quota-list { display: flex; flex-direction: column; gap: 0.4rem; }
.mock-quota-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  background: #fafaf9;
  border-radius: 10px;
  font-size: 0.92rem;
}
.mock-section-title {
  margin: 1.35rem 0 0.7rem;
  font-size: 1.12rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.mock-q {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.75rem;
}
.mock-q-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
}
.mock-howto-title {
  margin: 1rem 0 0.4rem;
  font-size: 1.05rem;
}
.mock-howto {
  white-space: pre-line;
  line-height: 1.55;
  font-size: 0.92rem;
  color: var(--muted, #5a6570);
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}
.mock-q-stem { margin: 0.45rem 0 0.65rem; line-height: 1.45; white-space: pre-line; }
.mock-q-hint { margin: 0.25rem 0 0.15rem; font-size: 0.88rem; }
.mock-listen-btn { margin-bottom: 0.35rem; font-size: 0.88rem; }
.mock-q-options { display: flex; flex-direction: column; gap: 0.4rem; }
.mock-q-options { display: flex; flex-direction: column; gap: 0.4rem; }
.mock-opt {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  cursor: pointer;
}
.mock-opt:has(input:checked) {
  border-color: #c2410c;
  background: color-mix(in srgb, #c2410c 8%, #fff);
}
.mock-opt input { margin-top: 0.2rem; }
.mock-exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.1rem 0 0.5rem;
}
.mock-result-summary {
  border-radius: 16px;
  padding: 1.1rem 1.15rem;
  margin: 0.85rem 0 1rem;
  text-align: center;
}
.mock-result-summary.is-pass { background: #ecfdf5; color: #065f46; }
.mock-result-summary.is-fail { background: #fff7ed; color: #9a3412; }
.mock-result-score {
  font-size: 2rem;
  font-weight: 850;
  margin-bottom: 0.35rem;
}
.mock-review.is-ok { border-color: color-mix(in srgb, #059669 35%, transparent); }
.mock-review.is-bad { border-color: color-mix(in srgb, #c2410c 35%, transparent); }
.me-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 1rem 0;
}
.me-stat {
  text-align: center;
  padding: 0.75rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf5;
}
.me-stat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand);
}
.me-stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.me-menu {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.5rem 0 1.25rem;
}
.me-menu-item {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  background: #fff;
}
.me-menu-item:hover { border-color: var(--brand); color: var(--brand); }
.me-lang-label {
  margin: 0 0 0.45rem;
  font-weight: 700;
  color: var(--text);
}
.me-lang-switch { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.me-lang-chip {
  display: inline-flex;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.me-lang-chip.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.hero-compact { text-align: center; padding: 12px 0 6px; }
.hero-compact h1 { font-size: 26px; margin: 0 0 4px; color: var(--brand); }
.hero-tag { margin: 0; color: var(--muted); font-size: 14px; }
.hero .tip { display: none; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.85rem 0 0.35rem;
}
.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.hero-action-share {
  background: #c2410c;
  color: #fff;
}
.hero-action-share:hover { filter: brightness(1.05); }
.hero-action-support {
  background: #fff;
  color: #0f766e;
  border-color: #0f766e;
}
.hero-action-support:hover { background: #f0fdfa; }
.simple-page {
  max-width: 32rem;
  margin: 0.5rem auto 2rem;
}
.simple-page h1 {
  margin: 0 0 0.5rem;
  color: var(--brand);
  font-size: 1.45rem;
}
.share-box {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf5;
}
.share-link-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.share-hint { margin: 0.65rem 0 0; font-size: 0.88rem; }

.path-chooser {
  margin: 0.5rem 0 1.35rem;
  padding: 0.25rem 0 0.25rem;
}
.path-chooser-hint { margin: 0.25rem 0 0.9rem; }
.path-chooser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 720px) {
  .path-chooser-grid { grid-template-columns: 1fr; }
}
.path-choice {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffaf5 0%, #ffffff 70%);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.path-choice:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-soft);
}
.path-choice h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--brand);
}
.path-choice p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.path-choice-cta {
  margin-top: 0.45rem;
  font-weight: 600;
  color: var(--brand2);
}
.path-speak {
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 70%);
}
.path-speak:hover { border-color: var(--stage-1); }
.path-speak h3 { color: var(--stage-1); }
.path-speak .path-choice-cta { color: var(--stage-1); }
.path-choice-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}
.path-choice-skip {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.path-hsk-label { margin: 1rem 0 0.4rem; }
.path-hsk-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.path-hsk-chip {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  background: #fff;
}
.path-hsk-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.path-catalog-note { margin: 0.85rem 0 0; font-size: 0.88rem; }

/* 首页六大学习专区 */
.home-tracks { margin: 0.35rem 0 1.5rem; }
.home-tracks-hint { margin: 0.2rem 0 0.85rem; }
.home-track-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.3rem;
}
@media (max-width: 720px) {
  .home-track-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}
.home-track {
  --track-text-halo:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 6px rgba(255, 255, 255, 0.9),
    0 0 14px rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  min-height: 210px;
  background-color: #cbd5e1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  isolation: isolate;
}
a.home-track-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
a.home-track-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  border-color: color-mix(in srgb, var(--track-accent, var(--brand)) 40%, var(--line));
}
a.home-track-card:focus-visible {
  outline: 2px solid var(--track-accent, var(--brand));
  outline-offset: 3px;
}
.home-track-soon { cursor: default; }
.home-track-pinyin { background-image: url("/static/img/home-tracks/track-pinyin.jpg"); --track-accent: var(--stage-1); }
.home-track-hanzi { background-image: url("/static/img/home-tracks/track-hanzi.jpg"); --track-accent: var(--stage-3); }
.home-track-hsk { background-image: url("/static/img/home-tracks/track-hsk.jpg"); --track-accent: var(--stage-4); }
.home-track-picture { background-image: url("/static/img/home-tracks/track-picture.jpg"); --track-accent: var(--stage-5); }
.home-track-idiom { background-image: url("/static/img/home-tracks/track-idiom.jpg"); --track-accent: var(--stage-2); }
.home-track-eq { background-image: url("/static/img/home-tracks/track-eq.jpg"); --track-accent: #7c2d12; }

/* 只在底部轻轻压一点，不把整图洗白 */
.home-track::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.12) 42%,
    rgba(255, 255, 255, 0.42) 100%
  );
  pointer-events: none;
}
.home-track-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 210px;
  padding: 0.95rem 1rem 0.9rem;
  box-sizing: border-box;
}
.home-track-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.home-track-title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #0f172a;
  text-shadow: var(--track-text-halo);
}
.home-track-pinyin .home-track-title,
.home-track-hanzi .home-track-title,
.home-track-hsk .home-track-title,
.home-track-picture .home-track-title,
.home-track-idiom .home-track-title,
.home-track-eq .home-track-title {
  color: color-mix(in srgb, var(--track-accent) 82%, #0f172a);
}
.home-track-note {
  margin: 0;
  margin-top: auto;
  color: #0f172a;
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 700;
  text-shadow: var(--track-text-halo);
}
.home-track-last {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  text-shadow: var(--track-text-halo);
  line-height: 1.35;
}
.home-track-last[hidden] { display: none !important; }
.home-track-foot {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(15, 23, 42, 0.18);
}
.home-track-progress {
  font-weight: 900;
  font-size: 0.95rem;
  color: #0f172a;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: var(--track-text-halo);
}
.home-track-bar {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.22);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.home-track-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--track-accent, var(--brand2));
}
.home-track-enter {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
a.home-track-card:hover .home-track-enter {
  background: var(--track-accent, var(--brand));
  color: #fff;
  border-color: transparent;
}
.home-track-empty { margin: 0.75rem 0.25rem; }
.home-track-stages {
  margin-top: 0.65rem;
  margin-bottom: 1.7rem;
  gap: 8px;
  padding-bottom: 0.7rem;
}

/* 专区页：图上叠加深加粗字 */
.track-page {
  margin: 0 0 1.5rem;
  --track-text-halo: 0 1px 0 rgba(255,255,255,.95), 0 0 8px rgba(255,255,255,.88), 0 0 16px rgba(255,255,255,.7);
  --track-bar-h: 48px;
}
.track-sticky-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}
.track-sticky-bar .track-back {
  margin: 0;
  flex-shrink: 0;
}
.track-sticky-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1c1917;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.track-back { display: inline-flex; }
.track-hero {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  min-height: 220px;
  margin-bottom: 1.1rem;
  background-color: #cbd5e1;
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}
.track-page-pinyin .track-hero { background-image: url("/static/img/home-tracks/track-pinyin.jpg"); --track-accent: var(--stage-1); }
.track-page-hanzi .track-hero { background-image: url("/static/img/home-tracks/track-hanzi.jpg"); --track-accent: var(--stage-3); }
.track-page-hsk .track-hero { background-image: url("/static/img/home-tracks/track-hsk.jpg"); --track-accent: var(--stage-4); }
.track-page-picture .track-hero { background-image: url("/static/img/home-tracks/track-picture.jpg"); --track-accent: var(--stage-5); }
.track-page-idiom .track-hero { background-image: url("/static/img/home-tracks/track-idiom.jpg"); --track-accent: var(--stage-2); }
.track-page-eq .track-hero { background-image: url("/static/img/home-tracks/track-eq.jpg"); --track-accent: #7c2d12; }
.track-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.05) 100%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.28) 100%);
  pointer-events: none;
}
.track-hero-inner {
  position: relative;
  z-index: 1;
  padding: 1.35rem 1.25rem 1.2rem;
  max-width: 40rem;
}
.track-hero-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f172a;
  text-shadow: var(--track-text-halo);
}
.track-hero-title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.7rem, 4.2vw, 2.15rem);
  font-weight: 900;
  color: color-mix(in srgb, var(--track-accent, var(--brand)) 78%, #0f172a);
  line-height: 1.15;
  text-shadow: var(--track-text-halo);
}
.track-hero-note {
  margin: 0 0 0.85rem;
  color: #0f172a;
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 700;
  text-shadow: var(--track-text-halo);
}
.track-hero-foot {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 18rem;
}
.track-hero-foot .home-track-progress {
  font-weight: 900;
  color: #0f172a;
  text-shadow: var(--track-text-halo);
}
.continue-learn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--track-accent, var(--brand)) 35%, var(--line));
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--track-accent, var(--brand)) 12%, #fff), #fff 55%);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.continue-learn[hidden] { display: none !important; }
.continue-learn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}
.continue-learn-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--track-accent, var(--brand));
  text-transform: uppercase;
}
.continue-learn-title {
  flex: 1 1 12rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
}
.continue-learn-cta {
  margin-left: auto;
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  background: var(--track-accent, var(--brand));
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
}
.track-catalog {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.track-catalog .home-track-stages {
  margin: 0;
  padding: 0;
}
.home-track-pinyin .home-track-bar-fill,
.home-track-hanzi .home-track-bar-fill,
.home-track-hsk .home-track-bar-fill,
.home-track-picture .home-track-bar-fill,
.home-track-idiom .home-track-bar-fill,
.home-track-eq .home-track-bar-fill { background: var(--track-accent); }

.progress-compact { margin: 8px 0 14px; }
.progress-inline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; box-shadow: var(--shadow-soft);
}
.pi-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.pi-num { font-weight: 700; }
.pi-label { color: var(--muted); }
.pi-sep { color: var(--line); }
.pi-done .pi-num { color: var(--ok); }
.pi-review .pi-num { color: #be123c; }
.progress-bar-inline {
  flex: 1; min-width: 72px; height: 6px; margin: 0;
  background: var(--bg-soft); border: none;
}
.progress-lessons { margin: 8px 0 0; font-size: 12px; text-align: center; }
.section-title { font-size: 17px; margin: 16px 0 10px; }

.stage-list { display: flex; flex-direction: column; gap: 10px; }
.stage-block {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  --stage-accent: var(--brand2);
}
.stage-1 { --stage-accent: var(--stage-1); --row-a: rgba(15,118,110,.08); --row-b: rgba(15,118,110,.16); }
.stage-2 { --stage-accent: var(--stage-2); --row-a: rgba(3,105,161,.08); --row-b: rgba(3,105,161,.15); }
.stage-3, .stage-8, .stage-13, .stage-18, .stage-23 { --stage-accent: var(--stage-3); --row-a: rgba(180,83,9,.08); --row-b: rgba(180,83,9,.15); }
.stage-4, .stage-9, .stage-14, .stage-19 { --stage-accent: var(--stage-4); --row-a: rgba(190,18,60,.07); --row-b: rgba(190,18,60,.14); }
.stage-5, .stage-10, .stage-15, .stage-20 { --stage-accent: var(--stage-5); --row-a: rgba(21,128,61,.08); --row-b: rgba(21,128,61,.15); }
.stage-6, .stage-11, .stage-16, .stage-21 { --stage-accent: var(--stage-1); --row-a: rgba(15,118,110,.08); --row-b: rgba(15,118,110,.16); }
.stage-7, .stage-12, .stage-17, .stage-22 { --stage-accent: var(--stage-2); --row-a: rgba(3,105,161,.08); --row-b: rgba(3,105,161,.15); }

.stage-block[open] {
  border-color: color-mix(in srgb, var(--stage-accent) 45%, var(--line));
  overflow: visible;
}

/* 二级目录：收起时用横向长封面，只换白纸标题 */
.stage-head {
  position: relative;
  display: block;
  padding: 0;
  cursor: pointer;
  list-style: none;
  isolation: isolate;
  aspect-ratio: 3.4 / 1;
  height: auto;
  min-height: 96px;
  max-height: 112px;
  overflow: hidden;
}
.stage-head::-webkit-details-marker { display: none; }
.stage-head::marker { content: ""; }

.stage-cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #e8f0e6;
  background-image: url("/static/img/home-tracks/track-cover-template-wide.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.stage-head-panel {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
}

.stage-paper {
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(22%, 96px);
  aspect-ratio: 1.15 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.2rem 0.3rem;
  box-sizing: border-box;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  pointer-events: none;
}

.stage-title {
  margin: 0;
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: #1c1917;
}

.stage-head-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0.8rem 0.35rem;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 40%, #fff 100%);
}
.stage-head-main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.stage-num {
  font-size: 12px;
  color: var(--stage-accent);
  font-weight: 800;
  display: block;
}
.stage-desc { display: none; }
.stage-lesson-count {
  margin: 0;
  font-size: 13px;
  color: #57534e;
  font-weight: 600;
}
.stage-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.stage-progress {
  font-size: 13px;
  color: #44403c;
  font-weight: 700;
}
.stage-chevron {
  color: var(--stage-accent);
  font-size: 11px;
  transition: transform .2s;
}
.stage-block[open] .stage-chevron { transform: rotate(180deg); }

/* 展开后：细吸顶条 */
.stage-block[open] > .stage-head {
  position: sticky;
  top: calc(var(--topbar-h) + var(--track-bar-h, 48px) + 6px);
  z-index: 40;
  min-height: 0;
  aspect-ratio: auto;
  max-height: none;
  height: auto;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 14px 14px 0 0;
  backdrop-filter: blur(8px);
}
.stage-block[open] .stage-cover { display: none; }
.stage-block[open] .stage-head-panel {
  min-height: 0;
  display: block;
  padding: 0.45rem 0.85rem;
}
.stage-block[open] .stage-paper {
  position: static;
  width: auto;
  aspect-ratio: auto;
  transform: none;
  padding: 0;
  justify-content: flex-start;
  text-align: left;
  pointer-events: auto;
  margin-bottom: 0;
}
.stage-block[open] .stage-title {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}
.stage-block[open] .stage-head-foot {
  padding: 0;
  background: none;
  align-items: center;
  margin-top: 0.1rem;
}
.stage-block[open] .stage-head-main {
  flex-direction: row;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.stage-block[open] .stage-num {
  font-size: 11px;
  font-weight: 700;
}
.stage-block[open] .stage-lesson-count {
  font-size: 12px;
  font-weight: 500;
}
.stage-block[open] .stage-progress {
  font-size: 12px;
  font-weight: 650;
}

/* 专区页加宽 */
body:has(.track-page) .wrap {
  max-width: 1180px;
}
body:has(.track-page) .topbar .inner {
  max-width: 1180px;
}
.track-catalog {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.track-catalog .home-track-stages {
  margin: 0;
  padding: 0;
}

/* 课表列表：更宽、左图模板清晰 */
.stage-lessons {
  border-top: none;
  padding: 0.65rem 0.25rem 0.9rem;
  background: #fff;
  border-radius: 0 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.lesson-row {
  scroll-margin-top: calc(var(--topbar-h) + var(--track-bar-h, 48px) + var(--stage-sticky-h, 52px) + 12px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.55rem 0.75rem 0.55rem 0.55rem;
  border-radius: 18px;
  margin: 0;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  min-height: 96px;
}
.lesson-row.row-a,
.lesson-row.row-b { background: #fff; }
.lesson-row:hover {
  border-color: color-mix(in srgb, var(--stage-accent) 28%, rgba(15, 23, 42, 0.08));
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
  filter: none;
  transform: translateY(-2px);
}

.lesson-thumb {
  position: relative;
  flex: 0 0 auto;
  width: clamp(168px, 32vw, 260px);
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
  background: #dfe8dc;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.lesson-thumb-cover {
  position: absolute;
  inset: 0;
  background-image: url("/static/img/home-tracks/track-cover-template-wide.jpg");
  background-size: 145% auto;
  background-position: 42% 35%;
  background-repeat: no-repeat;
  filter: saturate(1.08) contrast(1.06);
}
.lesson-thumb-paper {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 46%;
  aspect-ratio: 1.05 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}
.lesson-thumb-label {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 900;
  color: #1c1917;
  letter-spacing: 0.02em;
  line-height: 1;
}

.lesson-row-main {
  flex: 1;
  min-width: 0;
  padding-right: 0.25rem;
}
.lesson-row .lesson-num {
  font-size: 12px;
  color: color-mix(in srgb, var(--stage-accent) 72%, #78716c);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lesson-row .lesson-title {
  margin: 0.28rem 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.28rem);
  font-weight: 800;
  color: #1c1917;
  line-height: 1.35;
}
.lesson-row-status {
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 0.15rem;
}
.status-badge {
  padding: 0;
  width: 1.45rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  background: transparent;
  border: 1.5px solid rgba(15, 23, 42, 0.14);
  color: #a8a29e;
}
.badge-done {
  background: color-mix(in srgb, var(--ok) 12%, #fff);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, #fff);
}
.badge-review {
  background: #fef2f2;
  color: #be123c;
  border-color: #fecaca;
}
.badge-new {
  background: transparent;
  color: transparent;
  border-color: rgba(15, 23, 42, 0.16);
  font-size: 0;
}

@media (max-width: 560px) {
  .lesson-row {
    gap: 0.7rem;
    padding: 0.45rem 0.55rem 0.45rem 0.45rem;
    min-height: 88px;
  }
  .lesson-thumb {
    width: 132px;
  }
  .lesson-thumb-label {
    font-size: 1.25rem;
  }
  .lesson-row .lesson-title {
    font-size: 1rem;
  }
}

/* 课文/游戏吸顶返回栏：占位不压内容，贴在顶栏下方 */
.lesson-sticky-bar,
.game-sticky-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
  transition: top 0.2s ease, box-shadow 0.2s ease;
}
.lesson-sticky-bar .btn-back-catalog,
.game-sticky-bar .btn-back-catalog {
  margin: 0; flex-shrink: 0; padding: 6px 12px; font-size: 13px;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
  font-weight: 600;
}
.lesson-sticky-bar .sticky-lesson-meta,
.game-sticky-bar .sticky-lesson-meta {
  min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; color: var(--muted);
}
.lesson-sticky-bar .sticky-lesson-meta strong,
.game-sticky-bar .sticky-lesson-meta strong { color: var(--text); font-weight: 600; }
.lesson-head .btn-back-catalog { display: none; }
.game-page { margin: 0; padding: 0; }

/* 版块配色 */
.block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-soft);
  overflow-x: visible;
}
.block h2 {
  margin: -16px -16px 14px; padding: 10px 16px; font-size: 16px;
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text); background: var(--bg-soft);
}
.block.tip-box, .block.intro-guide { background: var(--block-tip); }
.block.tip-box h2, .block.intro-guide h2 { background: #ffe8b8; }
details.guide-fold.block.intro-guide { padding: 0; }
.guide-fold-head {
  margin: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.guide-fold:not([open]) > .guide-fold-head {
  border-radius: var(--radius);
  border-bottom: none;
}
.block.block-objectives { background: var(--block-obj); }
.block.block-objectives h2 { background: #d4efe6; color: #0f766e; }
.block.picture-cards-block, .block.pinyin-chart-block { background: var(--block-media); }
.block.picture-cards-block h2, .block.pinyin-chart-block h2 { background: #d6e8ff; color: #0369a1; }
.block.block-dialogue { background: #fafafa; }
.block.block-dialogue h2 { background: #f3f4f6; color: #111827; }
.block.block-lesson-game {
  background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
  border: 1px solid #fdba74;
}
.block.block-lesson-game h2 {
  background: #ffedd5;
  color: #9a3412;
}
.lesson-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lesson-game-head h2 { margin: 0; flex: 1; }
.lesson-game-badge { font-size: 1.25rem; line-height: 1; }
.lesson-game-hint { margin: 8px 0 12px; }
.lesson-game-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 12px 14px;
}
.lesson-game-meta { flex: 1 1 180px; min-width: 0; }
.lesson-game-title {
  margin: 0 0 4px;
  font-weight: 800;
  color: #9a3412;
  font-size: 1.05rem;
}
.lesson-game-go {
  flex: 0 0 auto;
  text-decoration: none;
  white-space: nowrap;
}
.block.block-vocab, .block.stage3-chars-block, .block.stage3-words-block { background: var(--block-vocab); }
.block.block-vocab h2, .block.stage3-chars-block h2, .block.stage3-words-block h2 { background: #ffe0c2; color: #c2410c; }
.block.block-quiz, .quiz-block { background: var(--block-quiz); }
.block.block-quiz h2, .quiz-block h2 { background: #f8d4d0; color: #be123c; }
.block.stroke-why-block, .block.stroke-cards-block { background: var(--block-tip); }
.block.stroke-why-block h2, .block.stroke-cards-block h2 { background: #ffe8b8; color: #b45309; }

/* 拼读：拼音公式 + 听读按钮同一排（电脑/手机一致） */
.spell-example {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; margin: 8px 0; overflow: hidden;
}

/* 本课拼读：按声母/韵母小板块，横排卡片 */
.spell-blocks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 16px;
}
.spell-block {
  background: linear-gradient(180deg, #fffbf5 0%, #fff 48%);
  border: 1px solid #f1e4d0;
  border-radius: 12px;
  padding: 10px 12px 12px;
}
.spell-block-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: #9a3412;
  letter-spacing: 0.02em;
}
.spell-block-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #78716c;
}
.spell-block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px 10px;
}
.spell-mini.spell-example {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(154, 52, 18, 0.04);
}
.spell-mini .spell-eq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 3px 4px;
  overflow: visible;
  flex: 1 1 auto;
  min-width: 0;
}
.spell-mini .spell-cell {
  min-width: 28px;
  padding: 5px 7px;
  font-size: 15px;
}
.spell-mini .spell-cell.spell-part {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
  font-weight: 700;
}
.spell-mini .spell-cell.whole {
  gap: 0;
  padding: 5px 9px;
  background: #e0f2fe;
  border-color: #7dd3fc;
}
.spell-mini .spell-cell.spell-spelled {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #92400e;
  font-weight: 700;
}
.spell-mini-u .spell-eq {
  gap: 2px 3px;
}
.spell-mini-u .spell-cell {
  font-size: 14px;
  padding: 4px 6px;
  min-width: 24px;
}
.spell-mini .spell-whole-py {
  font-size: 15px;
  font-weight: 800;
  color: #0c4a6e;
}
.spell-mini .spell-whole-hz {
  font-size: 17px;
  font-weight: 800;
  padding-left: 3px;
  margin-left: 3px;
  border-left: 1px solid rgba(12, 74, 110, 0.22);
  color: #0c4a6e;
}
.spell-mini .spell-eq .plus,
.spell-mini .spell-eq .eq {
  font-size: 12px;
  color: #b45309;
}
.spell-mini .spell-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.spell-mini .spell-actions .btn-spell-play,
.spell-mini .spell-actions .btn-spell-follow {
  min-width: 52px;
  min-height: 44px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 8px;
}
.spell-mini .spell-actions .spell-btn-label { font-size: 11px; }
.spell-mini .spell-actions .spell-btn-icon { font-size: 16px; }

@media (min-width: 900px) {
  .spell-block-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}
@media (max-width: 640px) {
  .spell-block-grid {
    grid-template-columns: 1fr;
  }
  .spell-mini.spell-example {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 8px;
  }
  .spell-mini .spell-eq {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 2px 3px;
  }
  .spell-mini .spell-cell {
    font-size: 13px;
    padding: 4px 6px;
    min-width: 24px;
  }
  .spell-mini .spell-whole-hz { font-size: 15px; }
  .spell-mini .spell-actions {
    width: auto;
    margin-left: 4px;
    gap: 6px;
    flex-shrink: 0;
  }
  .spell-mini .spell-actions .btn-spell-play,
  .spell-mini .spell-actions .btn-spell-follow {
    min-width: 44px;
    min-height: 40px;
    padding: 3px 5px;
  }
  .spell-mini .spell-actions .spell-btn-label { font-size: 10px; }
  .spell-mini .spell-actions .spell-btn-icon { font-size: 14px; }
}
.spell-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  margin-bottom: 6px;
}
.spell-label { font-weight: 700; display: inline; margin: 0; font-size: 15px; }
.spell-note { font-size: 12px; margin: 0; line-height: 1.35; }
.spell-table {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.spell-eq {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 4px 6px;
  flex: 1 1 auto; min-width: 0;
  overflow-x: auto;
}
.spell-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; padding: 6px 8px; border-radius: 8px;
  background: #fff7ed; border: 1px solid #fdba74;
  font-weight: 600; font-size: 14px; color: var(--text);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.spell-cell.whole {
  background: #e0f2fe; border-color: #7dd3fc; color: #0c4a6e; font-weight: 700;
  gap: 6px; padding: 6px 10px;
}
.spell-whole-py { font-weight: 700; }
.spell-whole-hz {
  font-weight: 800; font-size: 1.05em;
  padding-left: 4px; border-left: 1px solid rgba(12, 74, 110, 0.25);
}
.spell-cell.speaking-active {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4);
  transform: scale(1.14);
  z-index: 1;
  animation: spell-pop 0.28s ease;
}
.spell-cell.whole.speaking-active {
  background: #0284c7;
  border-color: #0369a1;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35);
  transform: scale(1.16);
  color: #fff;
}
.spell-cell.whole.speaking-active .spell-whole-py,
.spell-cell.whole.speaking-active .spell-whole-hz {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
@keyframes spell-pop {
  0% { transform: scale(1); }
  55% { transform: scale(1.22); }
  100% { transform: scale(1.14); }
}
.btn-spell-play.is-playing {
  opacity: 1;
  pointer-events: none;
  background: linear-gradient(90deg, #9a3412, #c2410c) !important;
  border-color: #9a3412 !important;
  color: #fff !important;
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.3);
}
.spell-eq .plus, .spell-eq .eq {
  color: var(--muted); font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.spell-actions {
  display: flex; flex-wrap: nowrap; gap: 14px; flex-shrink: 0; margin-left: auto;
  align-items: stretch;
}
.spell-actions .btn-spell-play,
.spell-actions .btn-spell-follow,
.spell-actions .btn-spell-write {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px;
  margin: 0;
  min-width: 64px;
  min-height: 52px;
  line-height: 1.15;
}
.spell-actions .spell-btn-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.spell-actions .spell-btn-icon {
  display: block;
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}
.spell-actions .btn-spell-follow {
  cursor: pointer;
  font-family: inherit; font-weight: 600;
}

@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar {
    transition: transform 0.22s ease;
    will-change: transform;
  }
  .topbar .inner {
    padding: 6px 10px;
    min-height: 44px;
    gap: 8px;
  }
  .logo { font-size: 16px; }
  nav { gap: 10px; }
  nav a { font-size: 13px; }
  .lang-btn { padding: 4px 8px; font-size: 12px; }

  /* 手机：下滑收起站点顶栏，返回栏贴屏幕最顶 */
  body.has-lesson-sticky.sticky-compact .topbar {
    transform: translateY(-100%);
    pointer-events: none;
  }
  body.has-lesson-sticky .lesson-sticky-bar,
  body.has-lesson-sticky .game-sticky-bar {
    top: var(--topbar-h);
    z-index: 55;
  }
  body.has-lesson-sticky.sticky-compact .lesson-sticky-bar,
  body.has-lesson-sticky.sticky-compact .game-sticky-bar {
    top: 0;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  }
  body.has-lesson-sticky.sticky-compact .stage-block[open] > .stage-head {
    top: calc(var(--track-bar-h, 48px) + 6px);
  }
  body.has-track-sticky.sticky-compact .track-sticky-bar {
    top: 0;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    border-radius: 0 0 12px 12px;
    z-index: 56;
  }
  body.has-track-sticky.sticky-compact .stage-block[open] > .stage-head {
    top: calc(var(--track-bar-h, 48px) + 6px);
  }
  body.has-track-sticky .track-sticky-bar {
    top: var(--topbar-h);
    z-index: 55;
  }

  .progress-inline { border-radius: 12px; }
  .pi-label { display: none; }
  /* 大目录：阶段标题三行（阶段号/标题/本阶段共N课），目录更宽 */
  .wrap { padding-left: 6px; padding-right: 6px; padding-top: 12px; }
  .lesson-sticky-bar,
  .game-sticky-bar {
    margin: 0 0 12px;
    padding: 8px 10px;
    min-height: 44px;
    gap: 8px;
    border-radius: 10px;
  }
  .lesson-sticky-bar .btn-back-catalog,
  .game-sticky-bar .btn-back-catalog {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
  }
  .lesson-sticky-bar .sticky-lesson-meta,
  .game-sticky-bar .sticky-lesson-meta {
    font-size: 12px;
    line-height: 1.25;
  }
  .stage-list { gap: 10px; }
  .stage-head {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
  }
  .stage-head-main { min-width: 0; flex: 1; }
  .stage-head-meta {
    width: auto;
    text-align: right;
    flex-shrink: 0;
  }
  .stage-num { font-size: 12px; line-height: 1.2; display: block; }
  .stage-title { font-size: 16px; margin: 3px 0 2px; line-height: 1.3; }
  .stage-lesson-count {
    display: block;
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.3;
  }
  .stage-progress { font-size: 12px; margin: 0; }
  .stage-chevron { font-size: 10px; }
  /* 小课目录：红色「第N课」在上，行更紧凑、更宽 */
  .stage-lessons { padding: 4px 2px; }
  .lesson-row {
    flex-direction: row;
    align-items: center;
    padding: 7px 8px;
    margin: 1px 0;
    gap: 6px;
    border-radius: 6px;
  }
  .lesson-row .lesson-num {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--stage-accent);
    line-height: 1.2;
  }
  .lesson-row .lesson-title { font-size: 13px; margin: 2px 0 0; line-height: 1.35; font-weight: 600; }
  .lesson-row .status-badge { padding: 2px 6px; font-size: 11px; }
  /* 迷你拼读：手机也保持拼音+按钮同一排；文字在图标上方 */
  .spell-table { flex-direction: row; flex-wrap: nowrap; align-items: center; }
  .spell-table > .spell-actions,
  .spell-mini > .spell-actions {
    width: auto;
    margin-left: auto;
    gap: 12px;
  }
  .spell-table > .spell-actions .btn-spell-play,
  .spell-table > .spell-actions .btn-spell-follow,
  .spell-table > .spell-actions .btn-spell-write,
  .spell-mini > .spell-actions .btn-spell-play,
  .spell-mini > .spell-actions .btn-spell-follow,
  .spell-mini > .spell-actions .btn-spell-write {
    flex: 0 0 auto;
    padding: 5px 8px;
    min-width: 56px;
    min-height: 48px;
    font-size: 11px;
  }
  .spell-table > .spell-actions .spell-btn-label,
  .spell-mini > .spell-actions .spell-btn-label { font-size: 11px; }
  .spell-table > .spell-actions .spell-btn-icon,
  .spell-mini > .spell-actions .spell-btn-icon { font-size: 16px; }
  /* 音节卡：手机仍保持 听|写|读 三列，不被上面规则挤到右侧 */
  .syllable-card-actions.spell-actions {
    display: grid !important;
    width: 100% !important;
    margin-left: 0 !important;
    gap: 4px;
  }
  .syllable-card-actions.spell-actions .btn-spell-play,
  .syllable-card-actions.spell-actions .btn-spell-follow,
  .syllable-card-actions.spell-actions .btn-spell-write {
    flex: none !important;
    width: 100%;
    min-width: 0 !important;
    min-height: 44px;
    padding: 3px 1px;
  }
  .stage3-word-line {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .stage3-word-zh { gap: 5px; max-width: 40%; }
  .stage3-word-main .pinyin { font-size: 13px; }
  .stage3-word-main .hanzi { font-size: 20px; }
  .stage3-word-gloss {
    font-size: 13px;
    text-align: center;
  }
  .stage3-word-actions {
    gap: 8px;
  }
  .stage3-word-actions .btn-spell-play,
  .stage3-word-actions .btn-spell-follow {
    min-width: 48px;
    min-height: 44px;
    padding: 4px 6px;
  }
  .stage3-char-grid-actions .btn-spell-play,
  .stage3-char-grid-actions .btn-spell-follow,
  .stage3-char-grid-actions .btn-spell-write {
    min-width: 48px;
    min-height: 44px;
    padding: 3px 5px;
  }
  .stage3-char-hanzi { font-size: 28px; }
  .final-tone-table-wrap { overflow-x: auto; max-width: 100%; }
  .progress-stats { grid-template-columns: 1fr; }

  /* 课文表格 / 拼读 / 词表：手机排紧，图标不挤出屏 */
  .block { padding: 12px; margin-bottom: 10px; overflow-x: visible; }
  .block h2 { margin: -12px -12px 10px; padding: 8px 12px; font-size: 15px; }
  .pinyin-practice h3 { margin: 12px 0 6px; font-size: 14px; }
  .practice-hint { font-size: 13px; margin: 0 0 8px; line-height: 1.45; }
  .lesson-intro-block { padding: 12px 14px; margin: 6px 0 14px; }
  .lesson-intro-heading { font-size: 16px; }
  .lesson-intro { font-size: 15px; line-height: 1.65; }
  .lang-km .lesson-intro { font-size: 15px; }

  .lesson-words-table th,
  .lesson-words-table td { padding: 5px 3px; font-size: 12px; }
  .lesson-words-table th { font-size: 11px; }
  .lesson-words-table .lw-key { width: 10%; }
  .lesson-words-table .lw-key code { font-size: 13px; }
  .lesson-words-table .pinyin { width: 18%; font-size: 13px; }
  .lesson-words-table .hanzi { width: 14%; font-size: 18px; }
  .lesson-words-table .lw-meaning { width: 34%; font-size: 12px; line-height: 1.3; }
  .lesson-words-table .vocab-actions { width: 24%; }
  .sandhi-word-head,
  .sandhi-word-row {
    grid-template-columns: minmax(0, 1fr) minmax(64px, 0.65fr) 104px;
    gap: 6px;
  }
  .sandhi-word-hz { font-size: 20px; }
  .sandhi-word-py { font-size: 12px; }
  .sandhi-word-spoken { font-size: 13px; }
  .sandhi-word-actions,
  .sandhi-btn {
    width: 104px;
  }
  .sandhi-btn {
    height: 36px;
    font-size: 12px;
    padding: 0 6px;
  }
  .lw-gloss-full { display: none; }
  .lw-gloss-short { display: inline; }

  .vocab-table th, .vocab-table td { padding: 6px 4px; font-size: 13px; }
  .vocab-table .hanzi { font-size: 18px; }
  .vocab-actions { white-space: nowrap; }
  .btn-mini-speak, .btn-mini-write, .btn-pronounce-mic, .btn-char-listen, .btn-char-practice {
    padding: 2px 3px; font-size: 14px; min-width: 28px;
  }

  .spell-example { padding: 6px 8px; margin: 6px 0; }
  .spell-label { font-size: 14px; }
  .spell-cell { min-width: 32px; padding: 5px 6px; font-size: 13px; }
  .spell-note { font-size: 11px; }

  .btn-pinyin-chip { padding: 6px 8px; font-size: 13px; }
  .pinyin-chip-wrap { min-width: 48px; gap: 2px; }
  .tone-row { gap: 6px; }
  .btn-tone-card { padding: 8px 10px; min-width: 56px; }
  .tone-hz { font-size: 22px; }

  .picture-card-grid { gap: 8px; }
  .picture-card { padding: 8px 6px; }
  .dialogue .line { padding: 10px 0; }
  .zh-line {
    flex-wrap: wrap;
  }
  .zh-follow-row,
  .stage3-word-follow {
    flex-wrap: nowrap;
    align-items: flex-end;
  }
  .zh-follow-row .dialogue-actions,
  .stage3-word-follow .stage3-word-actions {
    margin-left: auto !important;
    width: auto !important;
    flex: 0 0 auto;
    justify-content: flex-end;
  }
  .dialogue .line > .dialogue-actions {
    flex-direction: row !important;
    width: auto;
    margin-top: 8px !important;
    margin-left: auto !important;
    justify-content: flex-end;
  }
  .dialogue .line > .dialogue-actions .btn-spell-play,
  .dialogue .line > .dialogue-actions .btn-spell-follow {
    flex: 0 0 auto;
  }
  .ruby-unit .ruby-py {
    font-size: 11px;
  }
  .final-head-py { font-size: 22px; }
  .final-head-sep { font-size: 16px; }
  .final-head-km { font-size: 14px; }
  .final-head-card {
    gap: 5px 6px;
    padding: 5px 3px;
  }
  .final-head-card .final-head-listen,
  .final-head-card .final-head-write {
    min-height: 44px;
    height: 44px;
    padding: 2px 3px;
  }
  .final-head-card .spell-btn-label { font-size: 10px; }
  .final-head-card .spell-btn-icon { font-size: 14px; }
  .final-tone-table th,
  .final-tone-table td {
    padding: 6px 4px;
  }
  .final-tone-row { padding: 3px 1px; gap: 3px; }
  .final-tone-listen {
    width: 44px;
    height: 44px;
    min-width: 44px !important;
    max-width: 44px;
    min-height: 44px !important;
    max-height: 44px;
    padding: 2px;
  }
  .final-tone-listen .spell-btn-label { font-size: 8px; }
  .final-tone-listen .spell-btn-icon { font-size: 13px; }
  .final-tone-py-text { font-size: 20px; }
  .zh-big { font-size: 18px; }
  .usage-tip { padding: 6px 8px; margin-top: 6px; }
  .usage-tip p { font-size: 13px; }
}

/* 亮色主题修补（原深色硬编码） */
.lang-btn, .speed-control, .lang-menu { background: #fff; }
.btn-speak { background: #fff3e0; color: var(--text); border: 1px solid var(--line); }
.btn-pinyin-chip { background: #fff7ed; border: 1px solid #fdba74; color: var(--text); }
.btn-pinyin-chip.whole { color: #0c4a6e; background: #e0f2fe; }

/* 点读播放中：放大 + 变色，读完去掉 .is-speaking 恢复 */
.btn-pinyin-chip.is-speaking,
.final-tone-head-btn.is-speaking,
.btn-split-listen.is-speaking,
.btn-mini-speak.is-speaking,
.btn-tone-card.is-speaking,
.btn-char-listen.is-speaking,
.btn-char-practice.is-speaking,
[data-speak].is-speaking {
  background: #0284c7 !important;
  border-color: #0369a1 !important;
  color: #fff !important;
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35);
  z-index: 2;
  position: relative;
  opacity: 1;
  pointer-events: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.final-tone-row.is-speaking .final-tone-py-text {
  color: #0284c7;
  transform: scale(1.35);
  transition: color 0.15s ease, transform 0.15s ease;
}
.final-head-card.is-speaking .final-head-py,
.final-head-card.is-speaking .final-head-sep,
.final-head-card.is-speaking .final-head-km {
  color: #0284c7;
  transition: color 0.15s ease, transform 0.15s ease;
}
.final-head-card.is-speaking .final-head-unit {
  transform: scale(1.28);
  transform-origin: center center;
  transition: transform 0.15s ease;
}
.final-head-unit {
  transition: transform 0.15s ease;
}
.final-tone-listen.is-speaking {
  background: #0284c7 !important;
  border-color: #0369a1 !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35);
  transform: none !important;
  z-index: 2;
  position: relative;
  opacity: 1;
  pointer-events: none;
}
.final-tone-listen.is-speaking .spell-btn-icon {
  transform: scale(1.55);
  display: block;
  transition: transform 0.15s ease;
}
.final-tone-listen .spell-btn-icon {
  transition: transform 0.15s ease;
}
.final-head-card .final-head-listen.is-speaking .spell-btn-icon {
  transform: scale(1.4);
  transition: transform 0.15s ease;
}
.btn-split-listen.is-speaking {
  background: #d97706 !important;
  border-style: solid !important;
  color: #fff !important;
}
.btn-pinyin-chip,
.final-tone-head-btn,
.final-tone-listen,
.btn-split-listen {
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn-tone-card { background: #fff; color: var(--text); }
.syllable-sample-group { background: #fffaf0; }
.dialogue-scene { background: #fff; }
.grammar-card { background: #fffaf0; }
.opt { background: #fffaf0; color: var(--text); }
.opt:hover, .opt:has(input:checked) { background: #ffe8c8; border: 1px solid var(--brand2); }
.quiz-tier { background: #fff3e0; color: var(--brand); }
.quiz-feedback.quiz-ok { background: #e8f8ee; color: var(--ok); }
.quiz-feedback.quiz-fail { background: #fff4e5; color: #b45309; }
.quiz-result { background: #e8f8ee; color: var(--text); }
.quiz-result.fail { background: #fde8ec; border-color: #be123c; }
.speak-banner {
  background: #fff3e0; border: 1px solid #fdba74; color: var(--text);
}
.server-status { background: #fffaf0; color: var(--muted); }
.server-status.ok { background: #e8f8ee; border-color: var(--ok); color: var(--ok); }
.server-status.fail { background: #fde8ec; border-color: #be123c; color: #be123c; }
.search-form input { background: #fff; color: var(--text); }
.picture-card { background: #fff; border: 1px solid var(--line); }
.writing-char-card { background: #fff; color: var(--text); }
.stroke-card { background: #fff; }
.chapter-row:hover, .lesson-row:hover { background: inherit; }
.stat-card { background: var(--card); }
.btn-back-catalog:hover { background: #fff3e0; }
.footer { border-top-color: var(--line); }

/* 亮色对比度补强 */
.trans, .dialogue .trans { color: #4a5568 !important; }
.dialogue .trans.stage3-km { color: #334155 !important; }
.picture-card-km { color: #334155 !important; }
.muted { color: var(--muted) !important; }
.dialogue .speaker { /* 颜色由 .spk-N 控制 */ }

/* 交作业任务 */
.block-homework { border-left: 4px solid #ea580c; }
.homework-progress { font-weight: 600; margin: 0 0 10px; }
.hw-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
}
.hw-none { background: #f1f5f9; color: #64748b; }
.hw-pending { background: #ffedd5; color: #c2410c; }
.hw-passed { background: #dcfce7; color: #15803d; }
.hw-rewrite { background: #fee2e2; color: #b91c1c; }
.homework-brief {
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
}
.homework-brief p { margin: 0 0 8px; }
.homework-brief p:last-child { margin-bottom: 0; }
.homework-items { font-size: 14px; line-height: 1.6; }
.homework-teacher-feedback {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px;
  padding: 12px; margin-bottom: 12px;
}
.homework-teacher-feedback h3 { margin: 0 0 8px; font-size: 15px; }
.homework-preview {
  display: block; max-width: min(100%, 280px); max-height: 220px;
  border-radius: 10px; border: 1px solid var(--line); margin: 8px 0 12px;
  object-fit: cover;
}
.homework-upload { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.homework-file-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px; cursor: pointer;
  background: #fff; border: 1px dashed #fb923c; color: #c2410c; font-weight: 600;
}
.homework-file-btn input { display: none; }
.homework-note {
  width: min(100%, 420px); padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); font: inherit;
}
.homework-blocked { color: var(--muted); margin: 0; }
.homework-msg.hw-ok { color: #15803d; }
.homework-msg.hw-fail { color: #b91c1c; }
.homework-upload.is-disabled { opacity: 0.95; }


/* ── 听音点对小游戏 ── */
.lesson-row-game { border-left: 3px solid #f59e0b; }
.game-hub { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.game-group {
  background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 14px;
  overflow: hidden;
}
.game-group-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none;
  font-weight: 700;
}
.game-group-head::-webkit-details-marker { display: none; }
.game-pack-list { display: flex; flex-direction: column; border-top: 1px solid var(--line, #eee); }
.game-pack-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid #f3f4f6;
}
.game-pack-row:last-child { border-bottom: none; }
.game-pack-row:hover { background: #fff7ed; }
.game-pack-title { font-weight: 600; }

.game-play { position: relative; }
.game-play-head { margin-bottom: 14px; }
.game-play-group { margin: 0 0 4px; }
.game-play-title { margin: 0; font-size: 1.35rem; }
.game-play-rules { margin: 6px 0 0; font-size: 13px; }

.game-target-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 55%, #fffbeb 100%);
  border: 1px solid #fdba74;
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.08);
}
.game-hud-left {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
}
.game-target-badge {
  font-size: 12px; font-weight: 800; color: #9a3412;
  background: #ffedd5; padding: 4px 10px; border-radius: 999px;
  border: 1px solid #fdba74;
}
.game-target-text {
  font-size: 2.15rem; font-weight: 800; min-width: 2.6rem; text-align: center;
  color: #9a3412; letter-spacing: 0.02em;
  padding: 4px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.35);
}
.game-target-text.is-shown { color: #c2410c; }
.game-hud {
  margin-left: auto;
  text-align: right;
  min-width: min(100%, 200px);
  flex: 1 1 180px;
}
.game-score { margin: 0; font-size: 1.4rem; font-weight: 800; color: #c2410c; }
.game-bar-track {
  height: 8px;
  margin: 6px 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #fed7aa;
  overflow: hidden;
}
.game-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb923c, #ea580c 55%, #22c55e);
  transition: width .28s ease;
}
.game-progress { margin: 0; font-size: 12px; }
.game-level { margin: 6px 0 0; font-size: 11px; }

.game-diff-capsule {
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  max-width: none;
  min-width: 0;
  margin: 8px 0 0 auto;
  border: 1px solid #fdba74;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.game-diff-capsule .game-diff-btn {
  flex: 1;
  padding: 5px 10px;
  border: none;
  border-radius: 0;
  border-right: 1px solid #fed7aa;
  font-size: 12px;
  background: #fff;
  text-decoration: none;
  text-align: center;
  color: #c2410c;
  font-weight: 700;
  line-height: 1.2;
}
.game-diff-capsule .game-diff-btn:last-child { border-right: none; }
.game-diff-capsule .game-diff-btn.is-active {
  background: linear-gradient(90deg, var(--brand, #ea580c), var(--brand2, #f97316));
  color: #fff;
}

/* 游戏舞台/字块视觉样式见 static/css/game_play.css，避免主题背景覆盖舞台图 */

.game-combo {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  z-index: 8; pointer-events: none;
  font-size: 1.55rem; font-weight: 900; color: #ea580c;
  text-shadow: 0 2px 0 #fff, 0 8px 18px rgba(234, 88, 12, 0.28);
  animation: gameComboIn .85s ease forwards;
}
.game-combo.hidden { display: none; animation: none; }
.game-fx {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0;
}
.game-fx.is-correct {
  background: radial-gradient(circle at center, rgba(34, 197, 94, 0.22), transparent 55%);
  animation: gameFxFlash .45s ease;
}
.game-fx.is-wrong {
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.18), transparent 55%);
  animation: gameFxFlash .4s ease;
}

.game-start-overlay {
  position: absolute; inset: 0; z-index: 12;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 247, 237, 0.72);
  backdrop-filter: blur(2px);
}
.game-start-overlay.hidden { display: none; }
.game-start-card {
  text-align: center; padding: 22px 26px; border-radius: 18px;
  background: #fff; border: 1px solid #fdba74;
  box-shadow: 0 16px 36px rgba(234, 88, 12, 0.16);
  min-width: min(86vw, 280px);
}
.game-start-kicker {
  margin: 0 0 10px; font-size: 13px; font-weight: 800; color: #c2410c; letter-spacing: 0.06em;
}
.game-start-btn {
  font-size: 1.15rem; padding: 12px 28px; border-radius: 999px;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.28); cursor: pointer;
}

.game-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  border-radius: 20px;
  backdrop-filter: blur(2px);
}
.game-overlay.hidden { display: none; }
.game-result {
  position: relative; background: #fff; border-radius: 18px; padding: 24px 26px;
  width: min(92vw, 360px); text-align: center;
  box-shadow: 0 18px 44px rgba(0,0,0,.2); overflow: hidden;
}
.game-result-glow {
  position: absolute; inset: -40% -20% auto; height: 120px;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.28), transparent 65%);
  pointer-events: none;
}
.game-result h2 { margin: 0 0 8px; position: relative; }
.game-result-actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; position: relative;
}

html.game-scroll-lock,
body.game-scroll-lock {
  overflow: hidden !important; height: 100%;
  overscroll-behavior: none; touch-action: none;
}
.game-play.game-playing { position: relative; }
.game-ctrl-col { display: flex; flex-direction: column; gap: 6px; }
.game-ctrl-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid #fdba74;
  background: #fff; color: #c2410c; font-weight: 700; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.game-sound-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-width: 52px; padding: 6px 8px; border-radius: 10px;
  border: 1px solid #fdba74; background: #fff; color: #9a3412;
  font-weight: 700; font-size: 11px; cursor: pointer; line-height: 1.1;
}
.game-sound-btn.is-muted { background: #f3f4f6; border-color: #d1d5db; color: #6b7280; }
.game-sound-icon { font-size: 1.05rem; }
.game-ctrl-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.game-ctrl-end { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.game-ctrl-pause:not(:disabled):hover,
.game-ctrl-end:not(:disabled):hover,
.game-sound-btn:hover { filter: brightness(0.98); }

/* HSK exam practice */
.hsk-steps-block .hsk-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 8px 0 0;
  padding-left: 1.2em;
  font-weight: 700;
}
.hsk-steps a { color: #c2410c; text-decoration: none; }
.hsk-steps a:hover { text-decoration: underline; }
.hsk-word-example {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.25);
}
.hsk-word-example .hsk-ex-zh { margin: 2px 0; font-size: 1.05rem; }
.hsk-key-sent-block .line { margin-bottom: 14px; }
/* HSK 配图：小图缩略，不占半屏 */
.hsk-illus {
  margin: 0.45rem 0 0.35rem;
  padding: 0;
  width: 168px;
  max-width: 42vw;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid rgba(15, 23, 42, 0.08);
  line-height: 0;
  flex-shrink: 0;
}
.hsk-illus img {
  display: block;
  width: 100%;
  height: 112px;
  object-fit: cover;
  object-position: center 30%;
  background: #f3f4f6;
}
.hsk-illus-scene {
  width: 200px;
  max-width: 48vw;
  margin: 0.4rem 0 0.55rem;
}
.hsk-illus-scene img {
  height: 120px;
}
@media (min-width: 720px) {
  .hsk-illus { width: 180px; max-width: 180px; }
  .hsk-illus img { height: 120px; }
  .hsk-illus-scene { width: 220px; max-width: 220px; }
  .hsk-illus-scene img { height: 132px; }
}
.practice-item.is-correct { outline: 2px solid #16a34a; border-radius: 12px; }
.practice-item.is-wrong { outline: 2px solid #dc2626; border-radius: 12px; }
.quiz-item.is-correct { outline: 2px solid #16a34a; border-radius: 10px; padding: 0.35rem; }
.quiz-item.is-wrong { outline: 2px solid #dc2626; border-radius: 10px; padding: 0.35rem; }
.review-rules { margin: 0.4rem 0 0; padding-left: 1.2rem; line-height: 1.55; }
.practice-explain { margin-top: 8px; }
.stage-coming-soon { padding: 12px 14px; }

/* Pinyin lesson brief */
.pinyin-brief-block { margin-bottom: 16px; }
.pinyin-brief-block .intro-note { margin-top: 10px; padding: 10px 12px; background: rgba(251, 191, 36, 0.12); border-radius: 10px; }
.vocab-actions-dual { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn-read-compact { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); }

/* HSK synonyms + oral practice */
.hsk-synonym-card { margin-bottom: 12px; }
.hsk-synonym-card h4 { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hsk-oral-block .line { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(0,0,0,0.06); }
.hsk-oral-block .line:last-child { border-bottom: none; }
.hsk-oral-gate .oral-gate-hint { margin: 0.35rem 0 0.5rem; }
.hsk-oral-gate .oral-gate-progress {
  margin: 0 0 0.85rem;
  font-weight: 600;
  color: var(--brand);
}
.hsk-oral-gate .oral-item.oral-passed {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), transparent);
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
}
/* 默认不显示；仅真正过关（父级 .oral-passed）时出现，避免 .hidden 被其它 display 规则盖住 */
.hsk-oral-gate .oral-item-badge {
  display: none;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #047857;
  background: #d1fae5;
  border-radius: 999px;
  vertical-align: middle;
}
.hsk-oral-gate .oral-item.oral-passed .oral-item-badge {
  display: inline-block;
}
.btn-primary.oral-next-locked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.15);
}
.oral-gate-nav-hint {
  margin: 0.5rem 0 0;
  text-align: right;
  font-size: 0.9rem;
}
.oral-gate-nav-hint.oral-gate-ok { color: #047857; }

/* ——— 学习用品商城 ——— */
.shop-page { margin: 0 0 1.5rem; }
.shop-hero h1 { margin: 0 0 0.35rem; font-size: 1.55rem; color: #1c1917; }
.shop-hero p { margin: 0 0 1.1rem; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
@media (min-width: 800px) {
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
}
.shop-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.shop-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}
.shop-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f5f5f4;
  overflow: hidden;
}
.shop-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shop-card-badge {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: rgba(28, 25, 23, 0.78);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.shop-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.8rem 0.85rem 0.95rem;
  flex: 1;
}
.shop-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.3;
}
.shop-card-sub {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.35rem;
}
.shop-price {
  color: #c2410c;
  font-weight: 800;
  font-size: 1.05rem;
}
.shop-price-lg { font-size: 1.45rem; }
.shop-card-cta {
  font-size: 0.82rem;
  font-weight: 700;
  color: #44403c;
}

.shop-back { margin-bottom: 0.85rem; }
.shop-detail-layout {
  display: grid;
  gap: 1.1rem;
}
@media (min-width: 860px) {
  .shop-detail-layout {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
    gap: 1.5rem;
  }
}
.shop-gallery {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 0.7rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.shop-gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #f5f5f4;
}
.shop-gallery-main img,
.shop-gallery-main video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0f172a;
}
.shop-thumbs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}
.shop-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  overflow: hidden;
  background: #f5f5f4;
  cursor: pointer;
}
.shop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shop-thumb.is-active { border-color: #c2410c; }
.shop-thumb-video {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: #1c1917;
}

.shop-buy-panel {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 1rem 1.05rem 1.15rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.shop-detail-title {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  font-weight: 850;
  line-height: 1.25;
}
.shop-detail-sub { margin: 0 0 0.85rem; line-height: 1.45; }
.shop-detail-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.shop-spec { margin-bottom: 0.95rem; }
.shop-spec-name {
  font-size: 0.88rem;
  font-weight: 750;
  color: #44403c;
  margin-bottom: 0.4rem;
}
.shop-spec-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.shop-spec-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  border-radius: 12px;
  padding: 0.35rem 0.7rem 0.35rem 0.35rem;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  color: #1c1917;
  max-width: 100%;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.shop-spec-opt:not(.has-media) {
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
}
.shop-spec-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #f5f5f4;
  display: block;
}
.shop-spec-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.shop-spec-label {
  line-height: 1.25;
}
.shop-spec-opt.is-selected {
  border-color: #c2410c;
  background: color-mix(in srgb, #c2410c 8%, #fff);
  color: #9a3412;
  box-shadow: 0 0 0 1px color-mix(in srgb, #c2410c 35%, transparent);
}
.shop-spec-opt.is-selected .shop-spec-thumb,
.shop-spec-opt.is-selected .shop-spec-swatch {
  box-shadow: 0 0 0 1px #c2410c;
}
.shop-qty { margin-bottom: 1rem; }
.shop-qty-ctrl {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  overflow: hidden;
}
.shop-qty-ctrl button {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  background: #fafaf9;
  font-size: 1.15rem;
  cursor: pointer;
  font-family: inherit;
}
.shop-qty-ctrl input {
  width: 3rem;
  height: 2.4rem;
  border: 0;
  border-left: 1px solid rgba(15, 23, 42, 0.1);
  border-right: 1px solid rgba(15, 23, 42, 0.1);
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
}
.shop-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
}
.shop-total-row strong {
  color: #c2410c;
  font-size: 1.35rem;
}
.shop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.shop-btn-buy {
  flex: 1 1 160px;
  text-align: center;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.shop-btn-support {
  flex: 0 0 auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.shop-buy-hint { margin: 0.75rem 0 0; font-size: 0.82rem; line-height: 1.45; }

.shop-order-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.shop-order-modal.hidden { display: none; }
.shop-order-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.shop-order-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 1.1rem 1.15rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.18);
}
@media (min-width: 640px) {
  .shop-order-modal { align-items: center; }
  .shop-order-panel {
    border-radius: 18px;
    padding-bottom: 1.15rem;
  }
}
.shop-order-panel h2 { margin: 0 0 0.7rem; font-size: 1.15rem; }
.shop-order-body { font-size: 0.95rem; line-height: 1.5; margin-bottom: 1rem; }
.shop-order-body ul { margin: 0.4rem 0; padding-left: 1.1rem; }
.shop-order-total {
  margin: 0.55rem 0 0;
  font-size: 1.25rem;
  font-weight: 850;
  color: #c2410c;
}
.shop-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.shop-order-actions .btn-primary,
.shop-order-actions .btn-secondary {
  flex: 1 1 140px;
  text-align: center;
  text-decoration: none;
}
