:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #d7dde5;
  --soft: #f5f7fa;
  --paper: #ffffff;
  --red: #c93a2e;
  --red-ink: #821f17;
  --teal: #0f766e;
  --teal-soft: #dff5f2;
  --gold: #b7791f;
  --gold-soft: #fff2cc;
  --green: #2f7d32;
  --danger: #b3261e;
  --blue: #2f5e9e;
  --shadow: 0 18px 42px rgba(34, 38, 44, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fafc 0%, #eef3f5 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vw, 42px);
  color: #fff;
  background: #000;
  transition:
    opacity 600ms ease,
    visibility 600ms ease,
    transform 600ms ease;
}

.app-ready .splash-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.015);
}

.splash-stage {
  width: min(1200px, 100%);
  min-height: min(820px, 90vh);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  align-items: end;
  gap: clamp(12px, 1.7vh, 20px);
}

.splash-art {
  position: relative;
  width: min(1040px, 96vw);
  aspect-ratio: 2.18 / 1;
  overflow: hidden;
  border-radius: 2px;
  background: #000;
  filter: saturate(1.08) contrast(1.05);
}

.splash-art::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 54px 42px #000,
    inset 0 -34px 48px 22px #000;
  background:
    linear-gradient(180deg, transparent 0 70%, #000 96%),
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.6) 75%, #000 100%);
  pointer-events: none;
}

.splash-art img {
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(-1.5%);
}

.splash-word {
  position: relative;
  margin: 0;
  color: #fff;
  font-size: clamp(54px, 8.8vw, 118px);
  line-height: 0.88;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  transform: translateY(clamp(-18px, -2.4vh, -10px)) perspective(420px) rotateX(5deg);
  text-shadow:
    0 1px 0 #d9d9d9,
    0 3px 0 #bdbdbd,
    0 6px 0 #8f8f8f,
    0 10px 16px rgba(0, 0, 0, 0.95),
    0 0 22px rgba(255, 255, 255, 0.34),
    0 0 42px rgba(42, 215, 255, 0.32);
}

.splash-word::after {
  content: "HSK";
  position: absolute;
  left: 50%;
  top: 78%;
  z-index: -1;
  color: rgba(255, 255, 255, 0.26);
  transform: translateX(-50%) perspective(360px) rotateX(72deg) scaleY(0.48);
  transform-origin: center top;
  filter: blur(5px);
  text-shadow:
    0 0 24px rgba(67, 226, 255, 0.24),
    0 42px 46px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.splash-start {
  min-width: 156px;
  min-height: 50px;
  padding: 10px 28px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 18px 38px rgba(0, 0, 0, 0.55);
  font-size: 20px;
  font-weight: 900;
}

.splash-start:hover,
.splash-start:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.7);
  outline: none;
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen {
    transition: none;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(201, 58, 46, 0.22);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.side-group {
  margin-bottom: 22px;
}

.side-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.side-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.side-toggle .side-label {
  display: block;
  margin: 0 0 2px;
}

.side-toggle strong {
  display: block;
  font-size: 15px;
}

.toggle-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.nav-group.collapsed {
  margin-bottom: 12px;
}

.nav-group.collapsed .side-toggle {
  margin-bottom: 0;
}

.nav-list,
.level-list {
  display: grid;
  gap: 8px;
}

.nav-button,
.level-button,
.tab-button,
.topic-button,
.pill-button,
.icon-button,
.primary-button,
.ghost-button,
.answer-button,
.token-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.nav-button,
.level-button {
  min-height: 44px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  text-align: left;
}

.nav-button {
  justify-content: flex-start;
}

.nav-button.active,
.level-button.active,
.tab-button.active,
.topic-button.active {
  border-color: var(--red);
  background: #fff2f0;
  color: var(--red-ink);
}

.nav-button:hover,
.level-button:hover,
.tab-button:hover,
.topic-button:hover,
.pill-button:hover,
.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.answer-button:hover,
.token-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(32, 33, 36, 0.07);
}

.level-meta {
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: clamp(17px, 1.6vw, 24px);
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.page-title {
  max-width: 980px;
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.16;
  font-weight: 800;
  text-wrap: balance;
}

.page-summary {
  max-width: 980px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}

.quick-actions {
  min-width: 210px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.ghost-button,
.pill-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-weight: 700;
}

.primary-button {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.ghost-button {
  background: #fff;
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.pill-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.ghost-button.active-soft {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  min-height: 78px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 24px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.learning-band {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 12px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-header .select-field {
  width: auto;
  min-width: 150px;
}

.panel-title {
  margin: 0;
  font-size: 18px;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 14px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: min(430px, 55vh);
  overflow-y: auto;
  padding-right: 4px;
}

.topic-button {
  min-height: 86px;
  padding: 10px;
  text-align: left;
}

.topic-button strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.25;
}

.topic-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.topic-button > span:not(.topic-progress):not(.topic-progress-text) {
  min-height: 32px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topic-progress {
  width: 100%;
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf2;
}

.topic-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.topic-progress-text {
  min-height: 0;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 6px;
  overflow-x: visible;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(248, 250, 252, 0.9));
  backdrop-filter: blur(8px);
}

.tab-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.dashboard-layout,
.review-layout,
.lesson-layout,
.practice-layout,
.pronunciation-layout,
.tutor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.exam-layout {
  align-items: start;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.overview-card,
.plan-block,
.topic-summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.overview-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--red-ink);
  font-size: 28px;
  line-height: 1;
}

.overview-card span,
.topic-summary p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.learning-plan {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.today-plan-card {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(211, 59, 48, 0.06)),
    #fff;
}

.today-plan-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.today-plan-head h3 {
  margin: 0 0 5px;
  font-size: 22px;
  line-height: 1.15;
}

.today-plan-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.study-duration-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.daily-task-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.daily-task {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.daily-task:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.backup-actions {
  display: grid;
  gap: 8px;
}

.backup-import {
  justify-content: center;
  cursor: pointer;
}

.backup-import input {
  display: none;
}

.plan-block {
  display: grid;
  align-content: start;
  gap: 10px;
}

.plan-block h3,
.topic-summary h3,
.review-section h3 {
  margin: 0;
  font-size: 16px;
}

.plan-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.compact-topic-list {
  display: grid;
  gap: 7px;
}

.compact-topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  text-align: left;
}

.compact-topic-row.active,
.compact-topic-row:hover {
  border-color: var(--teal);
  background: #f7fbfa;
}

.compact-topic-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-topic-row strong {
  color: var(--teal);
  font-size: 12px;
}

.compact-topic-row i {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf2;
}

.compact-topic-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.topic-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.topic-summary {
  display: grid;
  gap: 8px;
}

.topic-summary p {
  margin: 0;
}

.review-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.review-token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.review-token {
  min-height: 82px;
  display: grid;
  gap: 3px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.review-token strong {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 22px;
  line-height: 1.1;
}

.review-token span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.lesson-sections {
  display: grid;
  gap: 12px;
}

.lesson-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lesson-card-strong {
  border-color: #c7e3df;
  background: #f7fbfa;
}

.lesson-card h3 {
  margin: 0;
  font-size: 18px;
}

.lesson-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.lesson-kicker {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.lesson-token-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lesson-token,
.dialogue-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.lesson-token {
  display: grid;
  gap: 3px;
  min-height: 68px;
  padding: 9px;
}

.lesson-token strong {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 22px;
}

.lesson-token span,
.dialogue-line span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pattern-list,
.dialogue-lines {
  display: grid;
  gap: 8px;
}

.pattern-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.pattern-item strong {
  color: #6b4b10;
  overflow-wrap: anywhere;
}

.pattern-item span {
  color: var(--muted);
  line-height: 1.4;
}

.dialogue-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 3px 10px;
  padding: 10px;
}

.dialogue-line strong {
  grid-row: span 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

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

.progress-card-head h3 {
  margin: 0;
}

.progress-card-head span {
  min-width: 44px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.progress-checklist {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.progress-checklist li {
  min-height: 32px;
}

.progress-step {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.progress-step:hover {
  border-color: var(--teal);
  background: #f7fbfa;
  color: var(--teal);
}

.progress-checklist li.done .progress-step {
  border-color: #c7e3df;
  background: #f7fbfa;
  color: var(--teal);
}

.progress-dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  border: 2px solid #9aa3ad;
  border-radius: 50%;
  color: #fff;
}

.progress-dot .icon {
  width: 12px;
  height: 12px;
}

.progress-checklist li.done .progress-dot {
  border-color: var(--teal);
  background: var(--teal);
}

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

.vocab-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.35fr) minmax(140px, 0.3fr);
  gap: 8px;
  margin-bottom: 12px;
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field .text-input {
  padding-left: 38px;
}

.vocab-card {
  min-height: 176px;
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.vocab-card.learned {
  border-color: #c7e3df;
  background: #f7fbfa;
}

.vocab-card.weak {
  border-color: #f2c8c4;
}

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

.hanzi strong {
  font-size: 34px;
  line-height: 1;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.vocab-actions {
  display: flex;
  gap: 6px;
}

.icon-button.known {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.vocab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.vocab-tags span {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.vocab-tags .danger-tag {
  background: #fce8e6;
  color: var(--danger);
}

.pinyin {
  color: var(--red);
  font-weight: 800;
}

.meaning,
.example-translation {
  color: var(--muted);
  line-height: 1.45;
}

.example {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.example-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.example-line .chinese-line {
  min-width: 0;
}

.icon-button.example-speak {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-color: #c7e3df;
  background: var(--teal-soft);
  color: var(--teal);
}

.icon-button.example-speak .icon {
  width: 15px;
  height: 15px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.pagination-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chinese-line {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: #fff;
}

.icon-button.primary {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.grammar-list {
  display: grid;
  gap: 12px;
}

.grammar-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.grammar-title {
  margin: 0;
  font-size: 17px;
}

.formula {
  display: inline-block;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: #6b4b10;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.grammar-card p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.55;
}

.grammar-example {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 3px solid var(--teal);
  background: #f7fbfa;
}

.exercise-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exercise-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.exercise-meta span {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--soft);
}

.exercise-question {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.answer-grid,
.token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.answer-button,
.token-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  text-align: left;
  line-height: 1.3;
}

.answer-letter {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.answer-button.selected,
.token-button.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.answer-button.selected .answer-letter {
  background: #fff;
  color: var(--teal);
}

.text-input,
.chat-input,
.select-field {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.text-input:focus,
.chat-input:focus,
.select-field:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.chat-input {
  min-height: 96px;
  resize: vertical;
}

.assembled-answer {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  overflow-wrap: anywhere;
}

.feedback {
  min-height: 52px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.45;
}

.feedback span {
  display: block;
}

.feedback-next {
  margin-top: 5px;
  font-weight: 800;
}

.feedback-extra {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed currentColor;
}

.feedback.good {
  background: #e8f5e9;
  color: var(--green);
}

.feedback.bad {
  background: #fce8e6;
  color: var(--danger);
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 12px;
}

.mini-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.mini-card p,
.mini-card li {
  color: var(--muted);
  line-height: 1.5;
}

.mini-card p {
  margin: 0;
}

.mini-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.question-jump-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.question-jump-grid.compact {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.question-jump {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.question-jump.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.question-jump.sentence {
  border-style: dashed;
}

.exam-hero {
  min-height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.11), rgba(211, 59, 48, 0.08)),
    #fff;
}

.exam-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.exam-hero h3 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.1;
}

.exam-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.exam-bullets span,
.exam-step,
.exam-mini-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.exam-bullets span {
  padding: 7px 10px;
}

.exam-section-table {
  display: grid;
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-table-head,
.exam-table-row,
.exam-table-total {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 110px 110px;
  align-items: stretch;
}

.exam-table-head,
.exam-table-total {
  background: var(--soft);
  font-weight: 900;
}

.exam-table-head span,
.exam-table-row > span,
.exam-table-total span {
  display: grid;
  place-items: center;
  padding: 10px;
  border-left: 1px solid var(--line);
}

.exam-table-row {
  border-top: 1px solid var(--line);
}

.exam-table-row > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.exam-table-row strong {
  color: var(--teal);
  font-size: 18px;
}

.exam-table-row span,
.exam-table-row small {
  color: var(--muted);
}

.exam-progress-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.exam-step {
  display: grid;
  gap: 2px;
  padding: 10px;
}

.exam-step.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.exam-step span {
  font-size: 12px;
}

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

.exam-timer {
  min-width: 96px;
  padding: 9px 12px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.exam-timer.danger {
  border-color: var(--danger);
  background: #fff4f2;
  color: var(--danger);
}

.exam-audio {
  justify-self: start;
}

.exam-set-grid {
  display: grid;
  gap: 8px;
}

.exam-set-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.exam-set-card span {
  color: var(--muted);
  font-size: 13px;
}

.exam-set-card.active {
  border-color: var(--danger);
  background: #fff4f2;
  color: var(--danger);
}

.exam-mini-list {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.exam-mini-list li {
  padding: 8px 10px;
}

.exam-result-summary {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-result-summary h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.exam-result-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.exam-section-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.exam-section-score {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.exam-section-score span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.exam-review-list {
  display: grid;
  gap: 10px;
}

.exam-review-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-review-item.good {
  border-color: #b7dfc0;
}

.exam-review-item.bad {
  border-color: #f0b7b0;
}

.exam-explain {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.45;
}

.exam-weak-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-weak-panel h3 {
  margin: 0;
  font-size: 16px;
}

.exam-weak-panel p {
  margin: 0;
  color: var(--muted);
}

.weak-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weak-chip-list span {
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff4f2;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
}

.exam-history-list {
  display: grid;
  gap: 8px;
}

.exam-history-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.exam-history-item span,
.exam-history-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.practice-toolbar,
.pronunciation-toolbar,
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-settings {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.rate-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.voice-test-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.voice-status {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.voice-status.good {
  background: #e8f5e9;
  color: var(--green);
}

.voice-status.warn {
  background: #fff2cc;
  color: #6b4b10;
}

.phrase-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.flashcard {
  min-height: 330px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.flashcard.flipped {
  background: #f7fbfa;
  border-color: var(--teal);
}

.flashcard-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.flashcard-meta span {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--soft);
}

.flashcard-main {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.flashcard-hanzi {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(58px, 10vw, 108px);
  line-height: 1;
  font-weight: 900;
}

.flashcard-meaning {
  color: var(--teal);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 900;
}

.flashcard-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.phrase-display {
  display: grid;
  gap: 4px;
}

.phrase-hanzi {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.08;
}

.score-ring {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(var(--teal) calc(var(--score) * 1%), #e5e9ef 0);
  color: var(--teal);
  font-size: 28px;
  font-weight: 900;
}

.chat-window {
  min-height: 360px;
  max-height: 470px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.message {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.45;
}

.message.tutor {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
}

.message.user {
  justify-self: end;
  background: var(--teal);
  color: #fff;
}

.mistake-list {
  display: grid;
  gap: 10px;
}

.mistake-list.compact {
  max-height: 430px;
  overflow-y: auto;
}

.mistake-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: #fff;
}

.mistake-item strong {
  display: block;
  margin-bottom: 4px;
}

.mistake-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mistake-review-card {
  margin-top: 4px;
}

.mistake-stat-list {
  display: grid;
  gap: 8px;
}

.mistake-stat-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.source-links a {
  color: var(--blue);
  text-decoration: none;
}

.source-links a:hover {
  text-decoration: underline;
}

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

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 16px;
  }

  .side-group {
    margin-bottom: 14px;
  }

  .level-list {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 6px;
  }

  .side-toggle {
    margin-bottom: 6px;
  }

  .nav-button {
    min-height: 36px;
    padding: 7px 9px;
    gap: 8px;
    font-size: 14px;
  }

  .nav-button .icon {
    width: 17px;
    height: 17px;
  }

  .tabbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .learning-band,
  .dashboard-layout,
  .review-layout,
  .lesson-layout,
  .practice-layout,
  .pronunciation-layout,
  .tutor-layout {
    grid-template-columns: 1fr;
  }

  .topic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .vocab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vocab-tools {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .lesson-token-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pattern-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 1380px) {
  .eyebrow {
    font-size: clamp(16px, 1.45vw, 21px);
  }

  .page-title {
    font-size: clamp(23px, 2.3vw, 31px);
  }

  .page-summary {
    max-width: 860px;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px 12px 28px;
  }

  .topbar {
    display: grid;
  }

  .page-title {
    font-size: clamp(22px, 6vw, 30px);
    line-height: 1.12;
  }

  .eyebrow {
    font-size: clamp(15px, 4.8vw, 20px);
  }

  .page-summary {
    font-size: 13px;
  }

  .quick-actions {
    min-width: 0;
    justify-content: flex-start;
  }

  .tabbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid,
  .overview-grid,
  .learning-plan,
  .topic-summary-grid,
  .review-token-grid,
  .vocab-grid,
  .answer-grid,
    .token-grid {
    grid-template-columns: 1fr;
  }

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

  .vocab-tools {
    grid-template-columns: 1fr;
  }

  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    padding: 14px 12px;
  }

  .level-list {
    grid-template-columns: repeat(3, minmax(108px, 1fr));
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message {
    max-width: 95%;
  }

  .exam-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .exam-progress-strip {
    grid-template-columns: 1fr;
  }

  .exam-header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .today-plan-head {
    flex-direction: column;
  }

  .study-duration-switch {
    justify-content: flex-start;
  }

  .daily-task-list,
  .learning-plan {
    grid-template-columns: 1fr;
  }

  .exam-result-summary,
  .exam-section-score-grid {
    grid-template-columns: 1fr;
  }

  .exam-table-head,
  .exam-table-row,
  .exam-table-total {
    grid-template-columns: minmax(0, 1fr) 80px 80px;
  }
}

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

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