:root {
  --ink: #172332;
  --muted: #63717c;
  --paper: #f3f6f5;
  --surface: #ffffff;
  --line: #d8e1de;
  --green: #1f7a59;
  --green-soft: #e4f2eb;
  --blue: #347fa7;
  --blue-soft: #e4f0f6;
  --coral: #d85d49;
  --coral-soft: #fae9e5;
  --yellow: #edbf45;
  --yellow-soft: #fff4d4;
  --shadow: 0 12px 32px rgba(23, 35, 50, 0.08);
  --sidebar-width: 232px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(52, 127, 167, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 72px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 28px 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: #fff;
  background: var(--green);
  border-radius: 6px;
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.day-control {
  justify-self: center;
  display: grid;
  grid-template-columns: 38px 92px 38px;
  align-items: center;
  gap: 6px;
}

.icon-button,
.audio-button,
.hint-button,
.day-display,
.nav-button,
.primary-button,
.secondary-button,
.known-button,
.text-button,
.segmented-control button,
.mobile-nav button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 20px;
}

.icon-button:hover {
  background: var(--paper);
}

.day-display {
  height: 38px;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  font-weight: 800;
  white-space: nowrap;
}

.top-progress {
  width: 146px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.points-pill {
  min-width: 82px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  color: #6f5208;
  background: var(--yellow-soft);
  border: 1px solid #ead690;
  border-radius: 6px;
}

.points-pill > span {
  color: #c38c00;
}

.points-pill strong {
  color: var(--ink);
  font-size: 15px;
}

.points-pill small {
  font-size: 10px;
  font-weight: 800;
}

.progress-track,
.test-progress {
  height: 6px;
  overflow: hidden;
  background: #e4e9e7;
  border-radius: 3px;
}

.progress-track span,
.test-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

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

.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 24px 16px;
  background: #eef2f0;
  border-right: 1px solid var(--line);
}

.primary-nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  min-height: 44px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #40505d;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.nav-button span {
  width: 24px;
  text-align: center;
  font-size: 18px;
}

.nav-button b {
  min-width: 20px;
  padding: 2px 5px;
  color: var(--coral);
  background: var(--coral-soft);
  border-radius: 4px;
  text-align: center;
  font-size: 11px;
}

.nav-button:hover,
.nav-button.active {
  color: var(--green);
  background: var(--surface);
}

.source-figure {
  margin: 30px 0 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.source-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 2;
  object-fit: cover;
}

.source-figure figcaption {
  padding: 9px 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-note {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0 8px;
  margin-top: 18px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
}

.data-note strong {
  color: var(--green);
  font-size: 26px;
}

.data-note span,
.data-note small {
  color: var(--muted);
  font-size: 11px;
}

.data-note small {
  grid-column: 1 / -1;
}

main {
  width: 100%;
  min-width: 0;
  padding: 38px 44px 72px;
}

.view {
  display: none;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.view.active {
  display: block;
}

.view-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.view-heading {
  min-height: 66px;
  margin-bottom: 30px;
}

.view-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-heading h1,
.section-heading h2 {
  margin: 0;
}

.view-heading h1 {
  font-size: 34px;
  line-height: 1.1;
}

.section-heading h2 {
  font-size: 17px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.known-button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button,
.known-button {
  color: #fff;
  background: var(--green);
}

.primary-button:hover,
.known-button:hover {
  background: #17694b;
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.text-button {
  padding: 3px 0;
  color: var(--green);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

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

.metric {
  min-height: 126px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-items: end;
  padding: 18px;
  border-top: 4px solid;
  border-radius: 6px;
}

.metric span,
.metric small {
  font-size: 11px;
  font-weight: 800;
}

.metric strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-size: 42px;
}

.metric-green {
  color: #155d43;
  background: var(--green-soft);
  border-color: var(--green);
}

.metric-blue {
  color: #245f7f;
  background: var(--blue-soft);
  border-color: var(--blue);
}

.metric-coral {
  color: #a84233;
  background: var(--coral-soft);
  border-color: var(--coral);
}

.today-band,
.queue-band {
  margin-top: 36px;
}

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

.section-heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-heading > div > span,
.library-count,
.plan-total,
#test-counter {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-heading .progress-track.wide {
  width: min(360px, 40%);
}

.section-heading.compact {
  align-items: center;
}

.section-heading.compact > div:first-child {
  display: block;
}

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

.word-chip {
  min-width: 0;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.word-chip strong,
.word-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-chip strong {
  font-size: 14px;
}

.word-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.word-chip.done {
  background: var(--green-soft);
  border-color: #a8cfbc;
}

.focus-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 28px;
  padding: 20px 24px;
  background: #edf4f7;
  border-left: 5px solid var(--blue);
}

.focus-copy h2,
.focus-copy p {
  margin: 0;
}

.focus-copy h2 {
  font-size: 18px;
}

.focus-copy p:last-child {
  max-width: 650px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.focus-timer {
  width: min(280px, 35%);
  display: grid;
  grid-template-columns: 72px minmax(90px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.focus-timer > strong {
  color: var(--blue);
  font-size: 23px;
  white-space: nowrap;
}

.focus-track {
  height: 7px;
  overflow: hidden;
  background: #cfdae0;
  border-radius: 4px;
}

.focus-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
}

.focus-timer .auto-timer-status {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.focus-timer .auto-timer-status > span {
  margin-right: 4px;
  color: var(--green);
}

.diagnostic-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
  padding: 22px 24px;
  color: #5e4510;
  background: var(--yellow-soft);
  border-left: 5px solid var(--yellow);
}

.diagnostic-band h2,
.diagnostic-band p {
  margin: 0;
}

.diagnostic-band h2 {
  font-size: 20px;
}

.diagnostic-band p {
  margin-top: 5px;
  font-size: 13px;
}

.day-five-mark {
  display: inline-block;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 900;
}

.queue-list,
.wrong-list {
  display: grid;
  gap: 8px;
}

.queue-row,
.wrong-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 36px minmax(120px, 1fr) minmax(140px, 2fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.queue-row .symbol,
.wrong-row .symbol {
  font-size: 22px;
  text-align: center;
}

.queue-row strong,
.wrong-row strong,
.queue-row small,
.wrong-row small {
  display: block;
}

.queue-row small,
.wrong-row small {
  color: var(--muted);
  font-size: 11px;
}

.queue-type {
  padding: 4px 7px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed #bcc9c5;
  text-align: center;
}

.library-heading {
  align-items: center;
}

.library-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-field,
.select-field {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.search-field input,
.select-field select {
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field input {
  width: 210px;
}

.select-field select {
  width: 160px;
}

.library-count {
  margin: -14px 0 14px;
}

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

.word-card {
  min-height: 112px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.word-card:hover {
  border-color: #9bb8ad;
  box-shadow: var(--shadow);
}

.word-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.word-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.word-card .status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-top: 5px;
  background: #c9d1ce;
  border-radius: 50%;
}

.word-card.mastered .status-dot {
  background: var(--green);
}

.word-card p {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.word-card small {
  display: block;
  margin-top: 9px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.load-more {
  display: block;
  margin: 20px auto 0;
}

.word-page {
  max-width: 980px;
  margin: 0 auto;
}

.word-page-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 18px;
}

.word-page-toolbar > div {
  justify-self: end;
  display: flex;
  gap: 6px;
}

.word-page-toolbar > span {
  color: var(--muted);
  font-size: 12px;
}

.word-hero {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 30px;
  background: var(--surface);
  border-top: 5px solid var(--green);
}

.word-symbol {
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  border: 1px solid #b7d7c7;
  border-radius: 8px;
  font-size: 60px;
}

.word-visual {
  width: 130px;
  margin: 0;
  text-align: center;
}

.word-visual img {
  width: 130px;
  height: 130px;
  display: block;
  object-fit: contain;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.word-visual figcaption {
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.word-meta span {
  padding: 4px 7px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}

.word-title-block h1 {
  margin: 10px 0 8px;
  overflow-wrap: anywhere;
  font-size: 48px;
  line-height: 1.04;
}

.pronunciation-row {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--muted);
}

.audio-button,
.hint-button {
  min-height: 36px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.hint-button {
  align-self: start;
}

.chinese-corner {
  position: absolute;
  right: 30px;
  bottom: 24px;
  max-width: 180px;
  padding: 8px 10px;
  background: var(--yellow-soft);
  border-left: 3px solid var(--yellow);
  text-align: right;
}

.chinese-corner small,
.chinese-corner strong {
  display: block;
}

.chinese-corner small {
  color: #87691e;
  font-size: 9px;
}

.chinese-corner strong {
  margin-top: 3px;
  font-size: 14px;
}

.meaning-band,
.example-band,
.practice-band {
  padding: 26px 30px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.definition {
  max-width: 800px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.45;
}

.meaning-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.meaning-heading .eyebrow {
  margin: 0;
}

.glossary-term {
  display: inline;
  padding: 0 2px;
  color: #245f7f;
  background: linear-gradient(transparent 67%, #cde4ef 67%);
  border: 0;
  border-bottom: 1px dotted var(--blue);
  font: inherit;
  cursor: pointer;
}

.word-glossary {
  display: grid;
  gap: 8px;
  max-width: 840px;
  margin-top: 18px;
}

.glossary-intro {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.glossary-entry {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 14px;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  transition: background 160ms ease, border-color 160ms ease;
}

.glossary-entry.highlight {
  background: var(--yellow-soft);
  border-color: var(--yellow);
}

.glossary-audio {
  align-self: start;
  font-size: 17px;
}

.glossary-word-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.glossary-word-line strong {
  font-size: 17px;
}

.glossary-word-line span {
  color: var(--muted);
  font-size: 13px;
}

.glossary-word-line em {
  margin-left: auto;
  padding: 2px 6px;
  color: #795d17;
  background: var(--yellow-soft);
  border-radius: 4px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.glossary-content p {
  margin: 7px 0 0;
  color: #40505d;
  font-size: 13px;
  line-height: 1.5;
}

.glossary-content p span {
  margin-right: 7px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.additional-meanings {
  margin-top: 12px;
  padding-left: 18px;
  color: var(--muted);
}

.additional-meanings p {
  margin: 6px 0;
}

.example-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #edf4f7;
}

.example-band p:last-child {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
}

.segmented-control {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented-control button {
  min-height: 40px;
  background: #f7f9f8;
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.active {
  color: #fff;
  background: var(--green);
}

.practice-content {
  min-height: 140px;
  display: grid;
  place-items: center;
  padding-top: 20px;
}

.practice-task {
  width: min(620px, 100%);
  text-align: center;
}

.practice-task h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.practice-task p {
  margin: 8px 0;
  color: var(--muted);
}

.practice-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 16px;
}

.practice-input-row input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #afc0ba;
  border-radius: 6px;
}

.practice-feedback {
  min-height: 22px;
  margin-top: 10px !important;
  font-weight: 800;
}

.practice-feedback.correct {
  color: var(--green);
}

.practice-feedback.incorrect {
  color: var(--coral);
}

.reading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.reading-stars {
  min-height: 40px;
  margin-top: 14px;
  color: #c4cbc8;
  font-size: 31px;
  line-height: 1;
}

.reading-stars span.filled {
  color: #d99a00;
}

.reading-best,
.reading-transcript {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.reading-playback {
  width: min(420px, 100%);
  height: 42px;
  margin-top: 10px;
}

.word-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 22px 30px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: -12px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.plan-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-new {
  background: var(--green);
}

.legend-review {
  background: var(--blue);
}

.legend-test {
  background: var(--coral);
}

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

.plan-day {
  min-height: 142px;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.plan-day:hover,
.plan-day.current {
  border-color: var(--green);
}

.plan-day.complete {
  background: var(--green-soft);
}

.plan-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-day-head strong {
  font-size: 17px;
}

.plan-day-head span {
  color: var(--muted);
  font-size: 10px;
}

.plan-counts {
  display: grid;
  gap: 5px;
  margin-top: 16px;
}

.plan-counts span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.plan-counts b {
  color: var(--ink);
}

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

.test-progress {
  margin-bottom: 26px;
}

.test-stage {
  min-height: 520px;
  display: grid;
  place-items: center;
}

.test-card {
  width: min(700px, 100%);
  min-height: 410px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
}

.test-mode {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
}

.test-word {
  margin: 14px 0 10px;
  overflow-wrap: anywhere;
  font-size: 42px;
}

.test-prompt {
  max-width: 570px;
  margin: 14px auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.5;
}

.test-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 24px;
}

.quiz-sheet {
  width: min(920px, 100%);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--yellow);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quiz-sheet-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  background: var(--yellow-soft);
  border-bottom: 1px solid #ead690;
}

.quiz-sheet-heading span {
  color: #7a5c0e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 800;
}

.quiz-sheet-heading strong {
  color: #5c4a1a;
  font-size: 13px;
}

.quiz-remaining-banner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 24px 0;
  padding: 11px 14px;
  color: #245f7f;
  background: var(--blue-soft);
  border-left: 5px solid var(--blue);
  border-radius: 4px;
}

.quiz-remaining-banner span,
.quiz-remaining-banner small {
  display: block;
}

.quiz-remaining-banner span {
  font-size: 12px;
  font-weight: 900;
}

.quiz-remaining-banner small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.quiz-remaining-banner > strong {
  color: var(--ink);
  font-size: 22px;
  white-space: nowrap;
}

.quiz-clues {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 22px 28px 20px 54px;
}

.quiz-clues li {
  min-height: 38px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding-left: 4px;
  color: #293947;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.45;
}

.quiz-clues li::marker {
  color: var(--blue);
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
}

.quiz-clue-visual {
  width: 76px;
  height: 70px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--green-soft);
  border: 1px solid #b7d7c7;
  border-radius: 6px;
}

.quiz-word-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quiz-symbol {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 38px;
}

.quiz-clue-copy {
  min-width: 0;
}

.quiz-clue-audio {
  width: 32px;
  height: 32px;
  display: inline-grid;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 15px;
}

.quiz-letter-board {
  display: grid;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quiz-answer-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #fbfcfc;
}

.quiz-answer-row + .quiz-answer-row {
  border-top: 1px solid var(--line);
}

.quiz-answer-row.correct {
  background: var(--green-soft);
}

.quiz-answer-row.incorrect {
  background: var(--coral-soft);
}

.quiz-answer-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-weight: 800;
}

.quiz-letter-grid {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.quiz-letter,
.quiz-letter.fixed {
  width: 38px;
  height: 44px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 2px solid #7d8c96;
  border-radius: 3px;
  text-align: center;
  text-transform: uppercase;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 800;
}

.quiz-letter:focus {
  border-color: var(--blue);
}

.quiz-letter.fixed {
  background: #eef2f0;
}

.quiz-letter.hint-letter {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.quiz-letter-gap {
  width: 12px;
  height: 1px;
  flex: 0 0 12px;
}

.quiz-row-result {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.quiz-answer-row.correct .quiz-row-result {
  color: var(--green);
}

.quiz-answer-row.incorrect .quiz-row-result {
  color: var(--coral);
}

.quiz-feedback {
  margin: 14px 24px 0 !important;
  text-align: center;
}

.quiz-sheet > .test-actions {
  margin: 12px 0 20px;
  padding: 0 24px;
}

.quiz-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 8px;
}

.quiz-summary-stats span {
  padding: 12px 8px;
  color: var(--muted);
  background: var(--paper);
  border-radius: 6px;
  font-size: 11px;
}

.quiz-summary-stats strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 24px;
}

.wrong-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.wrong-stat {
  padding: 16px;
  background: var(--surface);
  border-top: 4px solid var(--coral);
  border-radius: 6px;
}

.wrong-stat strong,
.wrong-stat span {
  display: block;
}

.wrong-stat strong {
  font-size: 28px;
}

.wrong-stat span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.wrong-row {
  grid-template-columns: 36px minmax(180px, 1fr) minmax(190px, 240px) 100px auto;
}

.wrong-stage strong,
.wrong-due strong {
  font-size: 13px;
}

.wrong-stage small,
.wrong-due small {
  margin-top: 3px;
}

.wrong-due {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.store-heading {
  align-items: center;
}

.store-balance {
  min-width: 154px;
  padding: 12px 16px;
  color: #6f5208;
  background: var(--yellow-soft);
  border-left: 5px solid var(--yellow);
  border-radius: 6px;
}

.store-balance small,
.store-balance strong {
  display: block;
}

.store-balance small {
  font-size: 10px;
  font-weight: 800;
}

.store-balance strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 21px;
}

.store-rate-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 13px 16px;
  background: var(--blue-soft);
  border-left: 5px solid var(--blue);
}

.store-rate-band strong {
  white-space: nowrap;
}

.store-rate-band span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.store-tabs {
  width: min(480px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 28px;
}

.store-section-heading {
  margin: 30px 0 14px;
}

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

.store-item {
  min-width: 0;
  display: grid;
  grid-template-rows: 112px 1fr auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.store-item-visual {
  position: relative;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
}

.store-item-visual > span {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 52px;
}

.store-item-visual > small {
  position: absolute;
  left: 10px;
  bottom: 8px;
  padding: 3px 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 900;
}

.visual-green { background: var(--green-soft); }
.visual-blue { background: var(--blue-soft); }
.visual-yellow { background: var(--yellow-soft); }
.visual-coral { background: var(--coral-soft); }

.store-item-copy {
  padding: 14px 14px 8px;
}

.store-item-copy h3 {
  margin: 0;
  font-size: 16px;
}

.store-item-copy p {
  min-height: 36px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.store-item-copy > small {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.store-item-action {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.store-item-action > strong {
  color: #7a5c0e;
  font-size: 19px;
  white-space: nowrap;
}

.store-item-action > strong small {
  font-size: 10px;
}

.store-item-action .primary-button {
  min-width: 76px;
  padding: 0 10px;
  font-size: 12px;
}

.redemption-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.redemption-summary > div {
  padding: 16px;
  background: var(--surface);
  border-top: 4px solid var(--blue);
  border-radius: 6px;
}

.redemption-summary small,
.redemption-summary strong {
  display: block;
}

.redemption-summary small {
  color: var(--muted);
  font-size: 10px;
}

.redemption-summary strong {
  margin-top: 4px;
  font-size: 27px;
}

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

.redemption-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 44px minmax(180px, 1fr) 120px auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--yellow);
  border-radius: 6px;
}

.redemption-row.fulfilled {
  border-left-color: var(--green);
}

.redemption-symbol {
  font-size: 30px;
}

.redemption-row > div strong,
.redemption-row > div small {
  display: block;
}

.redemption-row > div small,
.fulfilled-time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.redemption-status {
  color: #795d17;
  font-size: 11px;
  font-weight: 900;
}

.redemption-row.fulfilled .redemption-status {
  color: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 35, 50, 0.52);
}

.app-modal {
  position: relative;
  width: min(440px, 100%);
  padding: 30px;
  background: var(--surface);
  border-top: 6px solid var(--yellow);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(23, 35, 50, 0.24);
  text-align: center;
}

.modal-symbol {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: var(--yellow-soft);
  border-radius: 50%;
  font-size: 34px;
}

.app-modal .eyebrow {
  margin-bottom: 6px;
}

.app-modal h2 {
  margin: 0;
  font-size: 27px;
}

.app-modal > p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-points {
  display: block;
  margin: 17px 0 0;
  padding: 11px;
  color: #6f5208;
  background: var(--yellow-soft);
  border-radius: 6px;
}

.app-modal .primary-button {
  min-width: 120px;
  margin-top: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.settings-modal {
  border-top-color: var(--blue);
}

.settings-modal > p:not(.eyebrow) {
  margin-bottom: 20px;
}

.danger-button {
  min-height: 42px;
  padding: 0 17px;
  color: #fff;
  background: var(--coral);
  border: 0;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.danger-button:hover {
  background: #b94737;
}

.reset-confirmation {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reset-confirmation > strong {
  display: block;
  color: var(--coral);
  font-size: 18px;
}

.reset-confirmation > p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 200px;
  }

  .topbar {
    padding-right: 18px;
  }

  main {
    padding: 32px 28px 70px;
  }

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

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

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

@media (max-width: 760px) {
  body {
    padding-bottom: 66px;
  }

  .topbar {
    height: 62px;
    grid-template-columns: minmax(112px, 1fr) auto 52px;
    gap: 6px;
    padding: 0 12px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand small,
  .top-progress {
    display: none;
  }

  .day-control {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 34px 72px 34px;
  }

  .top-status {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .points-pill {
    min-width: 48px;
    height: 34px;
    padding: 0 6px;
  }

  .points-pill small,
  .points-pill > span {
    display: none;
  }

  .day-control .icon-button,
  .day-display {
    height: 34px;
  }

  .day-control .icon-button {
    width: 34px;
    flex-basis: 34px;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 62px);
  }

  .sidebar {
    display: none;
  }

  main {
    padding: 24px 15px 36px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: 62px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .mobile-nav button {
    min-width: 0;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 5px 1px;
    color: var(--muted);
    background: transparent;
    font-size: 9px;
    font-weight: 800;
  }

  .mobile-nav button span {
    font-size: 19px;
  }

  .mobile-nav button.active {
    color: var(--green);
  }

  .view-heading {
    min-height: 56px;
    margin-bottom: 22px;
  }

  .view-heading h1 {
    font-size: 28px;
  }

  .view-heading .primary-button {
    padding: 0 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .metric {
    min-height: 98px;
    display: block;
    padding: 12px 9px;
  }

  .metric strong,
  .metric span,
  .metric small {
    display: block;
  }

  .metric strong {
    margin: 7px 0 3px;
    font-size: 30px;
  }

  .section-heading .progress-track.wide {
    width: 34%;
  }

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

  .focus-band {
    display: block;
    padding: 18px;
  }

  .focus-timer {
    width: 100%;
    grid-template-columns: 72px minmax(70px, 1fr) auto;
    margin-top: 16px;
  }

  .queue-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .queue-row > :nth-child(3) {
    display: none;
  }

  .wrong-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: start;
    padding: 12px;
  }

  .wrong-word small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .wrong-stage,
  .wrong-due {
    grid-column: 2;
  }

  .wrong-due {
    padding-left: 0;
    border-left: 0;
  }

  .wrong-row > .icon-button {
    grid-column: 3;
    grid-row: 1 / 4;
    align-self: center;
  }

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

  .redemption-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .redemption-status {
    grid-column: 2;
  }

  .redemption-row > .secondary-button,
  .fulfilled-time {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .library-heading {
    display: block;
  }

  .library-tools {
    margin-top: 15px;
  }

  .search-field {
    flex: 1;
  }

  .search-field input {
    width: 100%;
  }

  .select-field select {
    width: 120px;
  }

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

  .word-card {
    min-height: 106px;
  }

  .word-hero {
    min-height: 220px;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 16px;
    padding: 22px 18px 62px;
  }

  .word-symbol {
    width: 82px;
    height: 82px;
    font-size: 38px;
  }

  .word-visual,
  .word-visual img {
    width: 82px;
  }

  .word-visual img {
    height: 82px;
  }

  .word-title-block h1 {
    font-size: 34px;
  }

  .hint-button {
    position: absolute;
    left: 18px;
    bottom: 17px;
  }

  .chinese-corner {
    right: 18px;
    bottom: 14px;
  }

  .meaning-band,
  .example-band,
  .practice-band {
    padding: 22px 18px;
  }

  .definition {
    font-size: 21px;
  }

  .word-actions {
    padding: 16px 18px;
  }

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

  .plan-day {
    min-height: 128px;
  }

  .test-stage {
    min-height: 440px;
  }

  .test-card {
    min-height: 390px;
    padding: 26px 18px;
  }

  .quiz-sheet-heading {
    display: block;
    padding: 16px 18px;
  }

  .quiz-sheet-heading span,
  .quiz-sheet-heading strong {
    display: block;
  }

  .quiz-sheet-heading span {
    font-size: 23px;
  }

  .quiz-sheet-heading strong {
    margin-top: 5px;
  }

  .quiz-remaining-banner {
    min-height: 58px;
    margin: 14px 14px 0;
    padding: 10px 12px;
  }

  .quiz-remaining-banner > strong {
    font-size: 18px;
  }

  .quiz-clues {
    padding: 18px 16px 16px 42px;
  }

  .quiz-clues li {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 10px;
    font-size: 15px;
  }

  .quiz-clue-visual {
    width: 62px;
    height: 58px;
  }

  .quiz-symbol {
    font-size: 31px;
  }

  #test-counter {
    max-width: none;
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
  }

  .quiz-answer-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    padding: 13px 12px;
  }

  .quiz-answer-number {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .quiz-letter,
  .quiz-letter.fixed {
    width: 28px;
    height: 36px;
    flex-basis: 28px;
    font-size: 17px;
  }

  .quiz-letter-grid {
    gap: 3px;
  }

  .quiz-letter-gap {
    width: 8px;
    flex-basis: 8px;
  }

  .quiz-row-result {
    grid-column: 2;
  }

  .test-word {
    font-size: 34px;
  }

  .test-prompt {
    font-size: 20px;
  }

  .wrong-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .wrong-stat {
    padding: 12px 9px;
  }

  .wrong-stat strong {
    font-size: 24px;
  }

  .toast {
    right: 16px;
    bottom: 76px;
  }

  .app-modal {
    padding: 24px 20px;
  }
}

@media (max-width: 420px) {
  .brand strong {
    font-size: 13px;
  }

  .day-control {
    grid-template-columns: 32px 64px 32px;
  }

  .view-heading {
    align-items: center;
  }

  #start-today {
    width: 44px;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  #start-today span {
    color: #fff;
    font-size: 18px;
  }

  .store-rate-band {
    display: block;
  }

  .store-rate-band span {
    display: block;
    margin-top: 5px;
    text-align: left;
  }

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

  .store-item {
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
  }

  .store-item-visual {
    grid-row: 1 / 3;
    min-height: 152px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .store-item-visual > span {
    font-size: 42px;
  }

  .store-item-action {
    grid-column: 2;
  }

  .library-tools {
    display: grid;
    grid-template-columns: 1fr 120px;
  }

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

  .word-card {
    min-height: 96px;
  }

  .word-hero {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .word-symbol {
    width: 64px;
    height: 64px;
    font-size: 31px;
  }

  .word-visual,
  .word-visual img {
    width: 64px;
  }

  .word-visual img {
    height: 64px;
  }

  .word-title-block h1 {
    font-size: 29px;
  }

  .pronunciation-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .segmented-control button {
    padding: 0 4px;
    font-size: 11px;
  }

  .word-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 350px) {
  .brand > span:last-child {
    display: none;
  }

  .topbar {
    grid-template-columns: 38px auto 46px;
  }

  .focus-timer {
    grid-template-columns: 1fr auto;
  }

  .focus-track {
    grid-column: 1 / 3;
    grid-row: 2;
  }
}
