:root {
  color-scheme: light;
  --ink: #10182f;
  --muted: #65708b;
  --blue: #1237d6;
  --blue-dark: #0b238f;
  --blue-soft: #edf1ff;
  --lime: #d9ff59;
  --line: #dce2ef;
  --paper: #ffffff;
  --canvas: #f4f6fb;
  --success: #13805d;
  --success-soft: #e5f8f1;
  --error: #c63e3e;
  --error-soft: #fff0ef;
  --shadow: 0 20px 60px rgba(25, 44, 101, 0.11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% -10%, rgba(18, 55, 214, 0.11), transparent 32rem),
    var(--canvas);
  color: var(--ink);
}

button, input, select { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(18, 55, 214, 0.26);
  outline-offset: 3px;
}

[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;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(220, 226, 239, 0.85);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 0.98rem; }
.brand small { color: var(--muted); font-size: 0.75rem; }

.brand-mark {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 13px;
  background: var(--blue);
}

.brand-mark i { width: 3px; border-radius: 4px; background: var(--lime); }
.brand-mark i:nth-child(1) { height: 12px; }
.brand-mark i:nth-child(2) { height: 21px; }
.brand-mark i:nth-child(3) { height: 15px; }
.brand-mark i:nth-child(4) { height: 24px; }

nav { display: flex; gap: 6px; }
.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}
.nav-button:hover { background: var(--blue-soft); color: var(--blue); }
.nav-button.is-active { background: var(--ink); color: white; }
.nav-count {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--lime);
  color: var(--ink);
  font-size: 0.72rem;
}

main { width: min(1180px, 90vw); margin: 0 auto; padding: 54px 0 80px; }
.view { animation: view-in 260ms ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } }

.home-heading, .review-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.13; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: 1.2rem; }
.home-heading > div > p:last-child, .review-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.7; }

.streak-card {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  min-width: 156px;
  padding: 18px 22px;
  border-radius: 20px;
  background: var(--ink);
  color: white;
}
.streak-card .streak-label { grid-column: 1 / -1; margin-bottom: 6px; color: #aeb7cc; font-size: 0.76rem; }
.streak-card strong { margin-right: 5px; color: var(--lime); font-size: 2rem; line-height: 1; }
.streak-card > span:last-child { font-size: 0.78rem; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.72fr); gap: 24px; align-items: start; }
.setup-card, .progress-panel, .quiz-card, .result-card, .review-table-wrap, .empty-state {
  border: 1px solid rgba(220, 226, 239, 0.9);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.setup-card { padding: 30px; }
.form-section { margin: 0 0 30px; padding: 0; border: 0; }
.form-section legend {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 14px;
  color: var(--ink);
  font-weight: 750;
}
.form-section legend > span {
  margin-right: 9px;
  color: var(--blue);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}
.text-button { margin-left: auto; padding: 5px 0; border: 0; background: transparent; color: var(--blue); font-size: 0.82rem; font-weight: 700; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-card {
  position: relative;
  display: flex;
  min-height: 138px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: #9aacff; }
.choice-card.is-selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card strong { margin-top: 13px; font-size: 0.95rem; }
.choice-card small { margin-top: 4px; color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.choice-icon { display: inline-flex; gap: 2px; align-items: baseline; color: var(--blue); font-size: 1.25rem; font-weight: 850; }
.choice-icon span { color: var(--ink); font-size: 0.68rem; }
.speaker-glyph { letter-spacing: -0.18em; transform: translateX(-2px); }

.group-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.group-option {
  position: relative;
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 68px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  cursor: pointer;
}
.group-option:hover { border-color: #9aacff; }
.group-option.is-selected { border-color: var(--blue); background: #f7f8ff; box-shadow: inset 0 0 0 1px var(--blue); }
.group-option input { position: absolute; opacity: 0; }
.group-number { display: grid; width: 33px; height: 33px; place-items: center; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 0.82rem; font-weight: 800; }
.group-copy { min-width: 0; }
.group-copy strong, .group-copy small { display: block; }
.group-copy strong { margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.83rem; }
.group-copy small { color: var(--muted); font-size: 0.72rem; }
.check-mark { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid #bdc6da; border-radius: 7px; color: transparent; font-size: 0.7rem; }
.group-option.is-selected .check-mark { border-color: var(--blue); background: var(--blue); color: white; }

.compact-section { margin-bottom: 22px; }
.pill-options { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-options label { cursor: pointer; }
.pill-options input { position: absolute; opacity: 0; }
.pill-options span { display: block; min-width: 76px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 99px; text-align: center; color: var(--muted); font-size: 0.84rem; font-weight: 650; }
.pill-options input:checked + span { border-color: var(--ink); background: var(--ink); color: white; }

.inline-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.select-field { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 650; }
select {
  width: 100%;
  height: 46px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.primary-button, .secondary-button, .danger-button {
  min-height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 750;
}
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: white; box-shadow: 0 10px 25px rgba(18, 55, 214, 0.2); }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:hover { border-color: #9aacff; background: var(--blue-soft); }
.danger-button { border: 1px solid var(--error); background: var(--error); color: white; }
.start-button { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 0 22px; }
.start-button span { color: var(--lime); font-size: 1.3rem; }
.form-error { margin: -8px 0 14px; color: var(--error); font-size: 0.84rem; }

.progress-panel { position: sticky; top: 100px; padding: 26px; }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.local-badge { padding: 6px 9px; border-radius: 99px; background: #eef0f5; color: var(--muted); font-size: 0.68rem; white-space: nowrap; }
.completion-table { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.completion-row { display: grid; grid-template-columns: 0.85fr repeat(3, 1fr); align-items: center; min-height: 39px; border-top: 1px solid var(--line); font-size: 0.74rem; text-align: center; }
.completion-row:first-child { border-top: 0; }
.completion-row > * { padding: 8px 4px; }
.completion-row strong { color: var(--ink); font-size: 0.75rem; }
.completion-header { min-height: 36px; background: var(--ink); color: white; font-size: 0.68rem; font-weight: 750; }
.record-section { margin-top: 24px; }
.record-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.record-heading h3 { margin: 0; font-size: 0.92rem; }
.record-heading span { color: var(--muted); font-size: 0.67rem; }
.record-list { display: grid; gap: 8px; }
.record-empty { margin: 0; padding: 15px; border-radius: 12px; background: var(--canvas); color: var(--muted); font-size: 0.78rem; text-align: center; }
.record-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; }
.record-item strong, .record-item span, .record-item small { display: block; }
.record-item strong { font-size: 0.78rem; }
.record-item span { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.record-item small { margin-top: 3px; color: #929bb0; font-size: 0.64rem; }
.record-actions { display: flex; flex-direction: column; gap: 5px; }
.record-actions button { min-width: 48px; padding: 5px 7px; border: 0; border-radius: 7px; font-size: 0.68rem; font-weight: 700; }
.record-resume { background: var(--blue); color: white; }
.record-delete { background: var(--error-soft); color: var(--error); }
.progress-ring, .result-ring {
  display: grid;
  width: 170px;
  height: 170px;
  place-items: center;
  margin: 30px auto 22px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) var(--progress), #e8ebf3 0);
}
.progress-ring::before, .result-ring::before { content: ""; grid-area: 1 / 1; width: 134px; height: 134px; border-radius: 50%; background: white; }
.progress-ring > div, .result-ring > div { z-index: 1; grid-area: 1 / 1; text-align: center; }
.progress-ring strong { font-size: 2.1rem; }
.progress-ring span { color: var(--muted); font-size: 0.78rem; }
.progress-copy { color: var(--muted); font-size: 0.84rem; line-height: 1.6; text-align: center; }
.stats-grid, .result-summary dl { display: grid; grid-template-columns: 1fr 1fr; margin: 22px 0; }
.stats-grid div { padding: 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.stats-grid div + div { border-left: 1px solid var(--line); }
dt { color: var(--muted); font-size: 0.72rem; }
dd { margin: 5px 0 0; font-size: 1.08rem; font-weight: 800; }
.group-progress-list { display: grid; gap: 12px; }
.mini-progress-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 9px; align-items: center; font-size: 0.72rem; }
.mini-progress-row span:first-child { color: var(--muted); }
.mini-progress-track { height: 5px; overflow: hidden; border-radius: 9px; background: #e7eaf2; }
.mini-progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.mini-progress-row strong { min-width: 30px; text-align: right; }

.quiz-view { width: min(760px, 100%); margin: 0 auto; }
.quiz-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.quiz-nav-actions { display: flex; gap: 18px; align-items: center; }
.back-button { padding: 8px 0; border: 0; background: transparent; color: var(--muted); font-weight: 650; }
.back-button:disabled { cursor: not-allowed; opacity: 0.35; }
.quiz-progress-meta { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 0.82rem; }
.quiz-progress-meta strong { color: var(--ink); }
.progress-track { height: 7px; margin-bottom: 22px; overflow: hidden; border-radius: 10px; background: #e2e6ef; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #6680f4); transition: width 250ms ease; }
.quiz-card { padding: 30px; }
.question-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 26px; color: var(--muted); font-size: 0.78rem; }
.section-chip { padding: 5px 8px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.question-area { min-height: 180px; display: grid; place-items: center; text-align: center; }
.prompt-label { margin-bottom: 13px; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; }
.word-prompt { margin: 0; font-size: clamp(2.3rem, 8vw, 4.6rem); line-height: 1.05; letter-spacing: -0.05em; }
.word-with-audio { display: flex; justify-content: center; align-items: center; gap: 14px; }
.inline-audio-button { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.inline-audio-button:hover { background: var(--blue); color: white; }
.inline-audio-button svg { width: 23px; }
.translation-prompt { max-width: 620px; margin: 0; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.3; letter-spacing: -0.035em; }
.letters-hint { margin-top: 14px; color: var(--muted); font-size: 0.78rem; }
.hint-wrap { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 38px; margin-top: 12px; }
.hint-button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; background: white; color: var(--blue); font-size: 0.75rem; font-weight: 750; }
.hint-wrap .letters-hint { margin: 0; }
.audio-prompt { display: grid; justify-items: center; gap: 16px; }
.play-button {
  display: grid;
  width: 110px;
  height: 110px;
  place-items: center;
  border: 0;
  border-radius: 34px;
  background: var(--blue);
  color: white;
  box-shadow: 0 18px 40px rgba(18, 55, 214, 0.25);
  transition: transform 150ms ease;
}
.play-button:hover { transform: scale(1.04); }
.play-button svg { width: 44px; }
.play-button.is-speaking { animation: pulse-audio 900ms ease-in-out infinite alternate; }
@keyframes pulse-audio { to { box-shadow: 0 18px 42px rgba(18,55,214,.38), 0 0 0 10px rgba(18,55,214,.08); } }
.audio-label { color: var(--muted); font-size: 0.83rem; }

.choice-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.answer-choice { position: relative; cursor: pointer; }
.answer-choice input { position: absolute; opacity: 0; }
.answer-choice span { display: flex; min-height: 68px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); line-height: 1.5; }
.answer-choice:hover span { border-color: #9aacff; }
.answer-choice input:checked + span { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.answer-input {
  width: 100%;
  height: 64px;
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  font-size: 1.15rem;
  text-align: center;
}
.answer-input::placeholder { color: #a3abc0; }
.answer-input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(18, 55, 214, 0.1); }
.answer-button { width: 100%; margin-top: 14px; }

.feedback { margin-top: 18px; padding: 18px; border-radius: 16px; }
.feedback.is-correct { background: var(--success-soft); color: #0a6045; }
.feedback.is-wrong { background: var(--error-soft); color: #8f2b2b; }
.feedback-top { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.feedback h2 { font-size: 1rem; }
.feedback-answer { margin: 10px 0 0; color: var(--ink); font-size: 0.92rem; line-height: 1.7; }
.feedback-answer strong { font-size: 1.08rem; }
.next-button { min-width: 116px; min-height: 42px; padding: 0 14px; border: 0; border-radius: 11px; background: var(--ink); color: white; font-weight: 700; }
.letter-comparison { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 12px; }
.letter-comparison span { display: grid; min-width: 26px; height: 31px; place-items: center; border-radius: 6px; background: white; color: var(--ink); font-weight: 800; }
.letter-comparison span.mismatch { background: #ffd6d2; color: var(--error); }
.wrong-book-choice { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(198, 62, 62, 0.18); color: var(--ink); }
.wrong-book-choice strong, .wrong-book-choice span { display: block; }
.wrong-book-choice strong { font-size: 0.8rem; }
.wrong-book-choice span { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.wrong-book-choice > div:last-child { display: flex; gap: 6px; flex: 0 0 auto; }
.wrong-book-choice button { padding: 7px 10px; border-radius: 8px; font-size: 0.72rem; font-weight: 700; }
.add-wrong-button { border: 1px solid var(--error); background: var(--error); color: white; }
.skip-wrong-button { border: 1px solid var(--line); background: white; color: var(--muted); }
.keyboard-tip { margin: 15px 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }

.result-view { width: min(780px, 100%); margin: 0 auto; }
.result-card { padding: 38px; text-align: center; }
.result-card h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.result-summary { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 32px; max-width: 590px; margin: 15px auto 28px; }
.result-ring { --progress: var(--score); width: 180px; height: 180px; margin: 18px auto; background: conic-gradient(var(--blue) var(--score), #e8ebf3 0); }
.result-ring strong, .result-ring span { display: block; }
.result-ring strong { font-size: 2.1rem; }
.result-ring span { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.result-summary dl { grid-template-columns: repeat(3, 1fr); margin: 0; }
.result-summary dl div { padding: 15px 9px; border-left: 1px solid var(--line); }
.result-wrongs { margin: 10px 0 26px; text-align: left; }
.result-wrongs h2 { margin-bottom: 12px; }
.wrong-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wrong-chip { padding: 8px 11px; border-radius: 10px; background: var(--error-soft); color: #8f2b2b; font-size: 0.8rem; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.review-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.danger-text-button { padding: 9px 0; border: 0; background: transparent; color: var(--error); font-size: 0.8rem; font-weight: 700; }
.review-table-wrap { overflow: hidden; }
.review-tools { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.review-tools p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.review-tools .primary-button { min-height: 42px; }
.review-list { display: grid; }
.review-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.25fr) 80px 110px; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.review-word strong, .review-word span { display: block; }
.review-word span { margin-top: 4px; color: var(--muted); font-size: 0.76rem; }
.review-meaning { color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.review-count { font-size: 0.78rem; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--blue); }
.icon-button:hover { background: var(--blue-soft); }
.icon-button svg { width: 18px; }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-icon { display: grid; width: 70px; height: 70px; place-items: center; margin: 0 auto 20px; border-radius: 22px; background: var(--blue-soft); color: var(--blue); font-size: 1.8rem; }
.empty-state h2 { margin-bottom: 9px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); }

dialog { width: min(430px, calc(100vw - 36px)); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 30px 90px rgba(14, 24, 54, 0.3); }
dialog::backdrop { background: rgba(11, 18, 40, 0.58); backdrop-filter: blur(3px); }
dialog form { padding: 26px; }
dialog h2 { margin-bottom: 10px; }
dialog p { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 22px; }
.dialog-actions-three { grid-template-columns: repeat(3, 1fr); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(360px, calc(100vw - 44px)); padding: 13px 16px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 0.84rem; }

@media (max-width: 900px) {
  main { width: min(700px, 92vw); padding-top: 38px; }
  .home-grid { grid-template-columns: 1fr; }
  .progress-panel { position: static; }
  .progress-panel { display: block; }
}

@media (max-width: 640px) {
  .app-header { min-height: 66px; padding: 0 4vw; }
  .brand small { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .nav-button { min-height: 38px; padding: 0 11px; font-size: 0.82rem; }
  main { width: 92vw; padding: 30px 0 64px; }
  .home-heading, .review-heading { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  h1 { font-size: 2.1rem; }
  .streak-card { display: flex; width: 100%; align-items: baseline; gap: 5px; padding: 13px 17px; }
  .streak-card .streak-label { margin: 0 auto 0 0; }
  .streak-card strong { font-size: 1.45rem; }
  .setup-card, .progress-panel, .quiz-card, .result-card { padding: 20px; border-radius: 20px; }
  .mode-grid { grid-template-columns: 1fr; }
  .choice-card { display: grid; grid-template-columns: 42px 1fr; align-items: center; min-height: 82px; padding: 14px 16px; }
  .choice-card .choice-icon { grid-row: 1 / span 2; }
  .choice-card strong { margin-top: 0; }
  .choice-card small { margin-top: -8px; }
  .group-grid { grid-template-columns: 1fr; }
  .inline-settings { grid-template-columns: 1fr; }
  .progress-panel { display: block; }
  .progress-ring { width: 150px; height: 150px; }
  .progress-ring::before { width: 118px; height: 118px; }
  .choice-list { grid-template-columns: 1fr; }
  .question-area { min-height: 160px; }
  .quiz-card { padding: 19px; }
  .feedback-top { align-items: stretch; flex-direction: column; }
  .wrong-book-choice { align-items: stretch; flex-direction: column; }
  .next-button { width: 100%; }
  .result-summary { grid-template-columns: 1fr; gap: 0; }
  .result-summary dl div:first-child { border-left: 0; }
  .result-actions { grid-template-columns: 1fr; }
  .review-tools { align-items: stretch; flex-direction: column; }
  .review-row { grid-template-columns: 1fr auto; gap: 8px; }
  .review-meaning { grid-column: 1; }
  .review-count { grid-column: 1; }
  .row-actions { grid-column: 2; grid-row: 1 / span 3; align-items: center; }
  .dialog-actions-three { grid-template-columns: 1fr; }
}

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