:root {
  color-scheme: light;
  --ink: #18332f;
  --ink-soft: #58706b;
  --paper: #f7f5ee;
  --white: #fffefa;
  --line: #d9ddd6;
  --coral: #ef5b3f;
  --coral-dark: #d9472e;
  --yellow: #f7ca55;
  --mint: #b8ddca;
  --green: #2e9b70;
  --red: #d94f42;
  --shadow: 0 20px 60px rgb(24 51 47 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, rgb(247 202 85 / 22%), transparent 28rem),
    radial-gradient(circle at 92% 88%, rgb(184 221 202 / 34%), transparent 30rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Noto Sans", sans-serif;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgb(24 51 47 / 12%);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--coral);
  color: white;
  font-family: "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 26px;
  font-weight: 800;
  transform: rotate(-3deg);
  box-shadow: 4px 4px 0 var(--yellow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  gap: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 0 14px;
  border: 1px solid rgb(24 51 47 / 12%);
  border-radius: 999px;
  background: rgb(255 254 250 / 65%);
  color: var(--ink-soft);
  font-size: 12px;
}

.stat-pill b {
  color: var(--ink);
  font-size: 14px;
}

main {
  flex: 1;
}

.view {
  animation: view-in 320ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.setup-view {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(490px, 1.1fr);
  gap: clamp(54px, 8vw, 110px);
  align-items: center;
  min-height: 670px;
  padding: 58px 0 64px;
}

.hero-copy {
  align-self: start;
  padding-top: 86px;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--coral-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero-copy h1 {
  max-width: 600px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 5.2vw, 74px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-copy h1 em {
  position: relative;
  color: var(--coral);
  font-weight: 500;
}

.hero-copy h1 em::after {
  content: "";
  position: absolute;
  left: 4%;
  right: -2%;
  bottom: -8px;
  height: 9px;
  border-top: 3px solid var(--yellow);
  border-radius: 50%;
  transform: rotate(-1deg);
}

.hero-description {
  max-width: 470px;
  margin: 34px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.75;
}

.setup-card,
.question-card,
.result-card {
  border: 1px solid rgb(24 51 47 / 12%);
  background: rgb(255 254 250 / 92%);
  box-shadow: var(--shadow);
}

.setup-card {
  padding: 32px;
  border-radius: 28px;
}

fieldset {
  min-width: 0;
  margin: 0 0 27px;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

legend span {
  margin-right: 9px;
  color: var(--coral);
  font-family: Georgia, serif;
  font-style: italic;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

.lesson-select {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.lesson-select b,
.lesson-select small {
  display: block;
}

.lesson-select b {
  font-size: 14px;
}

.lesson-select small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.lesson-select-control {
  min-width: 108px;
  max-width: 145px;
  padding: 7px 25px 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.lesson-option,
.mode-option,
.round-options label {
  cursor: pointer;
}

.lesson-option {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  transition: 160ms ease;
}

.lesson-option:has(input:checked) {
  border-color: var(--ink);
  background: #f1f6f0;
}

.lesson-option input,
.mode-option input,
.round-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lesson-check {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1.5px solid #b8c3bd;
  border-radius: 7px;
  color: transparent;
  font-size: 13px;
  font-weight: 900;
}

.lesson-option input:checked + .lesson-check {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.lesson-option b,
.lesson-option small {
  display: block;
}

.lesson-option b {
  font-size: 14px;
}

.lesson-option small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.form-error {
  min-height: 0;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 12px;
}

.form-error:empty {
  margin: 0;
}

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

.mode-option {
  display: grid;
  grid-template-columns: 44px 1fr 18px;
  gap: 13px;
  align-items: center;
  min-height: 66px;
  padding: 10px 15px 10px 10px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  transition: 160ms ease;
}

.mode-option:has(input:checked) {
  border-color: var(--coral);
  background: #fff7f2;
  box-shadow: 0 6px 16px rgb(239 91 63 / 9%);
}

.mode-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.mode-icon-kanji { background: #fde1d7; color: #b63b26; }
.mode-icon-reading { background: #dcefe5; color: #17664c; }
.mode-icon-meaning { background: #fff0bd; color: #74540d; }

.mode-copy b,
.mode-copy small {
  display: block;
}

.mode-copy b {
  font-size: 14px;
}

.mode-copy small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.radio-dot {
  width: 18px;
  height: 18px;
  border: 1.5px solid #b8c3bd;
  border-radius: 50%;
}

.mode-option input:checked ~ .radio-dot {
  border: 5px solid var(--coral);
}

.round-fieldset {
  margin-bottom: 24px;
}

.round-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.round-options span {
  min-height: 39px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.round-options input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.primary-button,
.secondary-button,
.next-button {
  min-height: 51px;
  border-radius: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 0;
  background: var(--coral);
  color: white;
  box-shadow: 0 9px 0 #c33f2a;
}

.primary-button:hover,
.next-button:hover {
  background: var(--coral-dark);
  transform: translateY(-1px);
}

.primary-button:active,
.next-button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #c33f2a;
}

.primary-button span,
.next-button span {
  font-size: 20px;
}

.keyboard-note {
  margin: 19px 0 0;
  color: #7c8e89;
  text-align: center;
  font-size: 11px;
}

kbd {
  min-width: 20px;
  display: inline-block;
  margin: 0 2px;
  padding: 2px 5px;
  border: 1px solid #c9d0cb;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 10px;
}

.quiz-view {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: 48px 0 72px;
}

.quiz-toolbar {
  display: grid;
  grid-template-columns: 48px 1fr 64px;
  gap: 20px;
  align-items: center;
  margin-bottom: 28px;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  font-size: 22px;
  cursor: pointer;
}

.quiz-progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.quiz-progress-copy b {
  color: var(--ink);
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e4df;
}

.progress-track span {
  width: 10%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), #f18c54);
  transition: width 300ms ease;
}

.live-streak {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #ead496;
  border-radius: 14px;
  background: #fff8df;
  font-size: 18px;
}

.live-streak b {
  font-size: 14px;
}

.question-card {
  position: relative;
  min-height: 540px;
  padding: 48px;
  border-radius: 30px;
  text-align: center;
}

.question-instruction {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-prompt {
  min-height: 146px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 0;
  padding: 12px;
  font-family: "BIZ UDPGothic", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif;
  font-size: clamp(48px, 8vw, 78px);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.question-prompt.long-prompt {
  font-size: clamp(32px, 5vw, 48px);
}

.lesson-badge {
  width: max-content;
  margin: -4px auto 31px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #e8f1ec;
  color: #557268;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: left;
}

.choice-button {
  min-height: 78px;
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px 17px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  color: var(--ink);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: 140ms ease;
}

.choice-button:hover:not(:disabled) {
  border-color: #8fa39d;
  background: #f6faf6;
  transform: translateY(-2px);
}

.choice-button:focus-visible,
.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.next-button:focus-visible {
  outline: 3px solid rgb(239 91 63 / 28%);
  outline-offset: 3px;
}

.choice-number {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid #ced5d0;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.choice-text {
  font-size: 14px;
  font-weight: 700;
}

.choice-button.correct {
  border-color: var(--green);
  background: #e9f7f0;
}

.choice-button.correct .choice-number {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.choice-button.wrong {
  border-color: var(--red);
  background: #fcecea;
}

.choice-button.wrong .choice-number {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.choice-button:disabled {
  cursor: default;
}

.choice-button:disabled:not(.correct, .wrong) {
  opacity: 0.52;
}

.feedback-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid;
  border-radius: 18px;
  text-align: left;
}

.feedback-panel.is-correct {
  border-color: #9bd1b8;
  background: #e9f7f0;
}

.feedback-panel.is-wrong {
  border-color: #edb6ae;
  background: #fcecea;
}

.feedback-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 17px;
  font-weight: 900;
}

.is-correct .feedback-icon { background: var(--green); }
.is-wrong .feedback-icon { background: var(--red); }
.is-correct .feedback-icon::after { content: "✓"; }
.is-wrong .feedback-icon::after { content: "×"; }

.feedback-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.feedback-heading b {
  font-size: 15px;
}

.star-word-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid #d7c67a;
  border-radius: 50%;
  background: #fffdf2;
  color: #b18a00;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease;
}

.star-word-button:hover {
  transform: scale(1.1);
  background: #fff8df;
}

.star-word-button[aria-pressed="true"] {
  background: #fff3b8;
}

.star-word-button[aria-pressed="true"]:hover {
  background: #ffe885;
}

.star-word-button:active {
  transform: scale(0.95);
}

.question-card .star-word-button {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  margin-left: 0;
}

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

.answer-details > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 11px 13px;
  border: 1px solid rgb(24 51 47 / 10%);
  border-radius: 11px;
  background: rgb(255 255 255 / 66%);
}

.answer-details dt {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.answer-details dd {
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#answerTerm,
#answerReading {
  font-family: "BIZ UDPGothic", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif;
}

#answerRomaji {
  font-style: italic;
}

.next-button {
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 21px;
  border: 0;
  background: var(--coral);
  color: white;
  box-shadow: 0 5px 0 #c33f2a;
}

.result-view {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 68px 0 84px;
}

.result-card {
  padding: 48px;
  border-radius: 30px;
  text-align: center;
}

.result-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46px;
  letter-spacing: -0.035em;
}

.result-message {
  margin: 12px 0 30px;
  color: var(--ink-soft);
}

.result-score {
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 34px;
  border: 13px solid #f7d36d;
  border-radius: 50%;
  background: #fffaf0;
}

.result-score span {
  font-family: Georgia, serif;
  font-size: 42px;
  font-weight: 700;
}

.result-score small {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 470px;
  margin: 0 auto 32px;
}

.result-stats > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  column-gap: 7px;
  padding: 4px 14px;
  border-right: 1px solid var(--line);
}

.result-stats > div:last-child {
  border-right: 0;
}

.result-stats b {
  font-size: 24px;
}

.result-stats small {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.correct-dot,
.wrong-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.correct-dot { background: var(--green); }
.wrong-dot { background: var(--red); }

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secondary-button {
  border: 1.5px solid var(--line);
  background: white;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--ink);
  background: #f3f6f3;
}

.secondary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

footer {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgb(24 51 47 / 12%);
  color: #7c8e89;
  font-size: 11px;
}

footer i {
  margin-left: 6px;
  color: var(--ink-soft);
  font-family: "Yu Mincho", serif;
  font-size: 13px;
}

.lesson-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  margin: 20px 0 10px;
  text-transform: uppercase;
  border-bottom: 1.5px solid rgb(24 51 47 / 8%);
  padding-bottom: 4px;
}

.lesson-section-title:first-of-type {
  margin-top: 4px;
}

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

/* --- HEADER NAVIGATION TABS --- */
.header-nav {
  display: flex;
  gap: 4px;
  background: rgb(24 51 47 / 6%);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgb(24 51 47 / 8%);
}

.nav-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: 160ms ease;
  font-family: inherit;
}

.nav-tab:hover {
  color: var(--ink);
}

.nav-tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 2px 6px rgb(24 51 47 / 6%);
}

/* --- VOCABULARY LIST LOOKUP VIEW --- */
.vocab-list-view {
  padding: 40px 0 60px;
}

.vocab-list-header {
  margin-bottom: 30px;
}

.vocab-list-header h2 {
  font-family: Georgia, serif;
  font-size: 32px;
  margin: 0 0 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.vocab-list-description {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 24px;
}

.vocab-filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-select,
.form-input {
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: 160ms ease;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--ink);
}

.form-select {
  min-width: 180px;
  cursor: pointer;
}

.search-group {
  flex: 1;
  min-width: 260px;
}

.vocab-table-wrapper {
  border: 1px solid rgb(24 51 47 / 12%);
  border-radius: 20px;
  background: rgb(255 254 250 / 92%);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 16px;
}

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.vocab-table th,
.vocab-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgb(24 51 47 / 8%);
}

.vocab-table th {
  background: rgb(24 51 47 / 4%);
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vocab-table tr:last-child td {
  border-bottom: none;
}

.vocab-table tbody tr {
  transition: 100ms ease;
}

.vocab-table tbody tr:hover {
  background: rgb(24 51 47 / 2%);
}

.vocab-table td b {
  font-size: 16px;
  font-family: "Yu Gothic", "Noto Sans JP", sans-serif;
  color: var(--ink);
  font-weight: 500;
}

.vocab-table td .reading-text {
  font-family: "Yu Gothic", "Noto Sans JP", sans-serif;
}

.vocab-table td .romaji-text {
  color: var(--ink-soft);
  font-size: 12px;
}

.vocab-table td .lesson-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: rgb(24 51 47 / 6%);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}


@media (max-width: 900px) {
  .setup-view {
    grid-template-columns: 1fr;
    gap: 42px;
    padding-top: 42px;
  }

  .hero-copy {
    padding-top: 0;
    text-align: center;
  }

  .hero-description {
    margin-right: auto;
    margin-left: auto;
  }

  .setup-card {
    width: min(590px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 12px;
    min-height: auto;
  }

  .header-nav {
    width: 100%;
    justify-content: center;
  }


  .brand-mark {
    width: 42px;
    height: 42px;
  }

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

  .header-stats .stat-pill:first-child {
    display: none;
  }

  .stat-pill {
    padding: 0 10px;
    font-size: 0;
  }

  .stat-pill span,
  .stat-pill b {
    font-size: 13px;
  }

  .hero-copy h1 {
    font-size: clamp(42px, 13vw, 62px);
  }

  .setup-card,
  .question-card,
  .result-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

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

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

  .lesson-option {
    min-height: 58px;
  }

  .quiz-view {
    padding-top: 28px;
  }

  .quiz-toolbar {
    grid-template-columns: 42px 1fr 49px;
    gap: 10px;
  }

  .question-card {
    min-height: 500px;
  }

  .question-card .star-word-button {
    top: 16px;
    right: 16px;
  }

  .question-prompt {
    min-height: 130px;
    font-size: 54px;
  }

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

  .choice-button {
    min-height: 62px;
  }

  .feedback-panel {
    grid-template-columns: 1fr;
  }

  .answer-details {
    grid-template-columns: 1fr;
  }

  .answer-details > div {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .next-button {
    grid-column: 1;
    grid-row: auto;
    justify-content: center;
  }

  .result-card h2 {
    font-size: 38px;
  }

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

  .result-stats > div {
    padding: 4px 8px;
  }

  footer {
    justify-content: center;
    text-align: center;
  }

  footer span:last-child {
    display: none;
  }
}

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