/* Component styles. Owned by the architect; do not edit in work packages.
   Markup for every component is shown in styleguide.html. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.55;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: var(--text-3xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 0.18em; }
button { font: inherit; color: inherit; }
/* Keyboard focus: a real outline (it survives forced-colours mode and does not fight the box-shadow
   states of options and cards). Never remove it; make it fit with outline-offset instead. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.ipa { font-family: var(--font-ipa); font-variant-ligatures: none; }
.ipa--slashes::before, .ipa--slashes::after { content: "/"; color: var(--ink-faint); margin: 0 0.06em; }
mark.hl { background: none; color: var(--cls, var(--accent)); font-weight: 700; }
.muted { color: var(--ink-soft); }
.eyebrow {
  font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
}
.lede { font-family: var(--font-serif); font-size: var(--text-lg); color: var(--ink-soft); max-width: 34rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.center { text-align: center; }
.rule { border: 0; border-top: var(--rule) solid var(--line); margin: var(--s-6) 0; }

/* ---------- Page frame ---------- */
.site-header {
  border-bottom: var(--rule) solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.site-header__inner {
  max-width: var(--page-width); margin: 0 auto; padding: var(--s-3) var(--gutter);
  display: flex; align-items: center; gap: var(--s-4);
}
.brand {
  display: inline-flex; align-items: baseline; gap: var(--s-2);
  font-family: var(--font-serif); font-weight: 700; font-size: var(--text-lg);
  color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap;
}
.brand__mark { font-family: var(--font-ipa); color: var(--accent); font-weight: 400; }
.nav { display: flex; gap: var(--s-1); }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: var(--text-sm); font-weight: 500;
  padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm);
}
.nav a:hover { color: var(--ink); background: var(--paper-sunk); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.theme-toggle {
  border: var(--rule) solid var(--line); background: none; cursor: pointer;
  width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--ink-soft); font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
/* The toggle's text glyph is hidden; a half-filled disc is drawn instead so it never depends on font fallback. */
.theme-toggle { font-size: 0; position: relative; flex: none; padding: 0; }
.theme-toggle::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 0.95rem; height: 0.95rem; border-radius: 50%; border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.page { max-width: var(--page-width); margin: 0 auto; padding: var(--s-7) var(--gutter) var(--s-8); }
.page-head { margin-bottom: var(--s-6); }
.page-head > * + * { margin-top: var(--s-3); }
.site-footer {
  max-width: var(--page-width); margin: 0 auto; padding: var(--s-5) var(--gutter) var(--s-7);
  border-top: var(--rule) solid var(--line); color: var(--ink-faint); font-size: var(--text-sm);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 2.75rem; padding: 0 var(--s-5);
  border: var(--rule) solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper-raised); color: var(--ink);
  font-weight: 600; font-size: var(--text-md); text-decoration: none; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { border-color: var(--ink-soft); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.btn--ghost { background: none; border-color: transparent; color: var(--ink-soft); padding: 0 var(--s-3); }
.btn--ghost:hover { color: var(--ink); background: var(--paper-sunk); border-color: transparent; }
.btn--danger { color: var(--wrong); }
.btn--lg { min-height: 3.25rem; font-size: var(--text-lg); padding: 0 var(--s-6); }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* Round play button. Content is a ▶ glyph (or "½×" text for the slow variant). */
.play {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: var(--rule) solid var(--line-strong); background: var(--paper-raised);
  color: var(--ink); cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 0 0 0 0.12em;
  position: relative;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.play:hover { border-color: var(--ink-soft); }
.play--lg { width: 4.25rem; height: 4.25rem; font-size: 1.35rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.play--lg:hover { filter: brightness(1.06); border-color: var(--accent); }
.play--sm { width: 2rem; height: 2rem; font-size: 0.7rem; }
.play--slow { padding: 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.02em; }
.play.is-playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.play.is-playing::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  border: 2px solid var(--accent); animation: pulse 900ms var(--ease) infinite;
}
.play-spacer { width: 2.5rem; flex: none; }
@keyframes pulse { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.45); opacity: 0; } }

/* ---------- Sound-class tag and legend ---------- */
.tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cls, var(--ink-soft));
}
.tag::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--cls, var(--ink-faint)); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); padding: 0; margin: 0; list-style: none; }

/* ---------- Symbol card (the visual benchmark) ---------- */
.symbol-card {
  background: var(--paper-raised);
  border: var(--rule) solid var(--line);
  border-top: 4px solid var(--cls, var(--line-strong));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--s-5) var(--s-5) var(--s-6);
}
.symbol-card__top { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.symbol-card__count { font-size: var(--text-sm); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.symbol-card__hero { text-align: center; padding: var(--s-4) 0 var(--s-5); }
.symbol-card__symbol {
  font-family: var(--font-ipa); font-size: var(--text-symbol); line-height: 1.05; font-weight: 400;
  color: var(--ink); letter-spacing: -0.01em; margin: 0;
}
.symbol-card__symbol::before, .symbol-card__symbol::after {
  content: "/"; color: var(--line-strong); font-size: 0.55em; vertical-align: 0.18em; margin: 0 0.12em;
}
.symbol-card__keyword { font-family: var(--font-serif); font-size: var(--text-lg); color: var(--ink-soft); margin-top: var(--s-1); }
.symbol-card__keyword b { color: var(--ink); }
.symbol-card__listen { display: flex; justify-content: center; align-items: center; gap: var(--s-4); margin-top: var(--s-5); }
.symbol-card__body { border-top: var(--rule) solid var(--line); padding-top: var(--s-5); display: grid; gap: var(--s-5); }
.symbol-card__section > .eyebrow { display: block; margin-bottom: var(--s-2); }
.symbol-card__howto { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.5; }
.symbol-card__mistake {
  border-left: 3px solid var(--cls, var(--accent)); padding: var(--s-1) 0 var(--s-1) var(--s-4);
  color: var(--ink-soft); font-family: var(--font-serif);
}
.symbol-card--compact { padding: var(--s-4); box-shadow: none; }
.symbol-card--compact .symbol-card__symbol { font-size: var(--text-symbol-md); }
.symbol-card--compact .symbol-card__hero { padding: var(--s-2) 0 var(--s-4); }

/* ---------- Mouth diagram (side view) and its figure ---------- */
.articulation { display: grid; grid-template-columns: minmax(0, 15rem) 1fr; gap: var(--s-5); align-items: start; margin: 0; }
.articulation__figure { margin: 0; display: grid; gap: var(--s-2); }
.articulation__caption { font-size: var(--text-sm); color: var(--ink-soft); }
.articulation__key { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); list-style: none; margin: 0; padding: 0; font-size: var(--text-xs); color: var(--ink-faint); }
.articulation__key li { display: inline-flex; align-items: center; gap: var(--s-1); }
.articulation__key svg { width: 1.4rem; height: 0.8rem; flex: none; }
.articulation__text { display: grid; gap: var(--s-4); align-content: start; }
.symbol-card--compact .articulation { grid-template-columns: minmax(0, 11rem) 1fr; gap: var(--s-4); }

.mouth { display: block; width: 100%; height: auto; border: var(--rule) solid var(--line); border-radius: var(--radius-lg); background: var(--paper); cursor: pointer; }
.mouth .tissue { fill: var(--paper-sunk); }
.mouth .air { fill: var(--paper); }
.mouth .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mouth .line--soft { stroke: var(--line-strong); stroke-width: 1.5; }
.mouth .tongue { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.mouth .lip { fill: var(--accent-soft); }
.mouth .tooth { fill: var(--paper-raised); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.mouth .velum-edge { fill: none; stroke: var(--ink); stroke-width: 13; stroke-linecap: round; }
.mouth .velum { fill: none; stroke: var(--paper-sunk); stroke-width: 9.5; stroke-linecap: round; }
.mouth .contact { fill: var(--cls, var(--accent)); }
.mouth .airflow { fill: none; stroke: var(--c-voiced); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 7; }
.mouth .voice { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mouth .voice--off { stroke: var(--line-strong); }
.mouth-key .contact { fill: var(--cls, var(--accent)); }
.mouth-key .airflow { fill: none; stroke: var(--c-voiced); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 7; }
.mouth-key .voice { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mouth-key .voice--off { stroke: var(--line-strong); }
.mouth:hover { border-color: var(--line-strong); }
/* Motion only while the sound plays: the air dots travel, the voice mark trembles, the contact dot pulses. */
.mouth.is-speaking .airflow { animation: air-travel 700ms linear infinite; }
.mouth.is-speaking .voice:not(.voice--off) { animation: voice-buzz 90ms steps(2) infinite; }
.mouth.is-speaking .contact { animation: contact-pulse 900ms var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes air-travel { to { stroke-dashoffset: -9; } }
@keyframes voice-buzz { from { transform: translateY(-1px); } to { transform: translateY(1px); } }
@keyframes contact-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.5); } }

/* Word list: word · /ipa/ · play */
.word-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0 var(--s-5); }
.word {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0; border-bottom: var(--rule) dotted var(--line);
}
.word__text { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 700; }
.word__ipa { font-family: var(--font-ipa); font-size: var(--text-lg); color: var(--ink-soft); }
.word__ipa::before, .word__ipa::after { content: "/"; color: var(--line-strong); }

/* Minimal pairs: two words facing each other */
.pair-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.pair {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3);
  background: var(--paper); border: var(--rule) solid var(--line); border-radius: var(--radius); padding: var(--s-2) var(--s-3);
}
.pair__side { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.pair__side > span { display: grid; line-height: 1.25; }
.pair__vs { color: var(--ink-faint); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- Chart ---------- */
.chart-group + .chart-group { margin-top: var(--s-6); }
.chart-group__title { display: flex; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-3); }
.chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: var(--s-2); }
.chart-cell {
  position: relative; display: grid; place-items: center; gap: 0;
  aspect-ratio: 1 / 1; padding: var(--s-2) var(--s-1);
  background: var(--paper-raised); border: var(--rule) solid var(--line); border-bottom: 3px solid var(--cls, var(--line-strong));
  border-radius: var(--radius); cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.chart-cell:hover { transform: translateY(-2px); border-color: var(--cls, var(--line-strong)); }
.chart-cell__symbol { font-family: var(--font-ipa); font-size: var(--text-symbol-sm); line-height: 1; }
.chart-cell__word { font-size: var(--text-xs); color: var(--ink-faint); }
.chart-cell.is-playing, .chart-cell[aria-pressed="true"] { background: var(--cls-soft, var(--paper-sunk)); border-color: var(--cls, var(--line-strong)); }
/* learning state dot, top-right: data-state="unseen" | "weak" | "strong" */
.chart-cell[data-state]::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; }
.chart-cell[data-state="unseen"]::after { border: 1px solid var(--line-strong); }
.chart-cell[data-state="weak"]::after { background: var(--wrong); }
.chart-cell[data-state="strong"]::after { background: var(--right); }

/* ---------- Dashboard ---------- */
.hero { padding-bottom: var(--s-6); border-bottom: var(--rule) solid var(--line); margin-bottom: var(--s-6); }
.hero > * + * { margin-top: var(--s-4); }
.hero__symbols { font-family: var(--font-ipa); font-size: var(--text-xl); color: var(--ink-faint); letter-spacing: 0.12em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.stat { border: var(--rule) solid var(--line); border-radius: var(--radius); padding: var(--s-3) var(--s-4); background: var(--paper-raised); }
.stat__value { font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }

.progress { height: 6px; background: var(--paper-sunk); border-radius: 3px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 300ms var(--ease); }

.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.day-card {
  display: grid; grid-template-columns: 3.25rem 1fr auto; align-items: center; gap: var(--s-4);
  padding: var(--s-4); background: var(--paper-raised); border: var(--rule) solid var(--line);
  border-radius: var(--radius-lg); color: inherit; text-decoration: none;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.day-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.day-card__num {
  width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center;
  border: var(--rule) solid var(--line-strong); font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 700;
}
.day-card__title { font-family: var(--font-serif); font-weight: 700; font-size: var(--text-lg); }
.day-card__symbols { font-family: var(--font-ipa); color: var(--ink-soft); font-size: var(--text-md); letter-spacing: 0.06em; word-spacing: 0.2em; }
.day-card__status { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; text-align: right; }
.day-card[data-status="done"] .day-card__num { background: var(--right); border-color: var(--right); color: var(--paper-raised); }
.day-card[data-status="done"] .day-card__status { color: var(--right); }
.day-card[data-status="current"] { border-color: var(--accent); box-shadow: var(--shadow); }
.day-card[data-status="current"] .day-card__num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-card[data-status="current"] .day-card__status { color: var(--accent); }
.day-card[data-status="upcoming"] { background: none; border-style: dashed; }
.day-card[data-status="upcoming"] .day-card__num,
.day-card[data-status="upcoming"] .day-card__title { color: var(--ink-faint); }

/* ---------- Lesson stepper ---------- */
.stepper { display: flex; gap: var(--s-1); list-style: none; margin: 0 0 var(--s-6); padding: 0; border-bottom: var(--rule) solid var(--line); overflow-x: auto; overflow-y: hidden; }
.stepper__step {
  display: inline-flex; align-items: center; gap: var(--s-2); white-space: nowrap;
  padding: var(--s-3) var(--s-3); border: 0; background: none; cursor: pointer;
  color: var(--ink-faint); font-size: var(--text-sm); font-weight: 600; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.stepper__step:hover { color: var(--ink); }
.stepper__step:focus-visible { outline-offset: -3px; }   /* the stepper scrolls: an outside ring would be clipped */
.stepper__n {
  width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-grid; place-items: center;
  border: var(--rule) solid currentColor; font-size: var(--text-xs); font-variant-numeric: tabular-nums;
}
.stepper__step[aria-current="step"] { color: var(--ink); border-bottom-color: var(--accent); }
.stepper__step[aria-current="step"] .stepper__n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper__step[data-done="true"] .stepper__n { background: var(--right); border-color: var(--right); color: var(--paper-raised); }
.stepper__step[disabled] { opacity: 0.4; cursor: not-allowed; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.pager__pos { color: var(--ink-faint); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

/* Reading-lesson note (day 6) */
.note { background: var(--paper-raised); border: var(--rule) solid var(--line); border-radius: var(--radius-lg); padding: var(--s-5); }
.note > * + * { margin-top: var(--s-3); }
.note p { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.55; max-width: 36rem; }

/* ---------- Quiz ---------- */
.quiz { display: grid; gap: var(--s-5); }
.quiz__meta { display: grid; gap: var(--s-2); }
.quiz__count { display: flex; justify-content: space-between; font-size: var(--text-sm); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.quiz__ask { font-family: var(--font-serif); font-size: var(--text-lg); color: var(--ink-soft); text-align: center; }
.quiz__prompt {
  display: grid; place-items: center; gap: var(--s-3); min-height: 11rem; padding: var(--s-5);
  background: var(--paper-raised); border: var(--rule) solid var(--line); border-radius: var(--radius-lg);
}
.quiz__prompt-symbol { font-family: var(--font-ipa); font-size: var(--text-symbol-md); line-height: 1.1; }
.quiz__prompt-symbol::before, .quiz__prompt-symbol::after { content: "/"; color: var(--line-strong); font-size: 0.6em; vertical-align: 0.15em; margin: 0 0.1em; }
.quiz__prompt-hint { font-size: var(--text-sm); color: var(--ink-faint); }

.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
.options--two { grid-template-columns: repeat(2, 1fr); }
.option {
  position: relative; display: grid; place-items: center; gap: var(--s-1); min-height: 5.5rem;
  padding: var(--s-3) var(--s-4); cursor: pointer; text-align: center;
  background: var(--paper-raised); border: var(--rule) solid var(--line-strong); border-radius: var(--radius-lg);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.option:hover { border-color: var(--ink-soft); }
.option:active { transform: translateY(1px); }
.option__key {
  position: absolute; top: 8px; left: 10px; font-size: var(--text-xs); color: var(--ink-faint);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.option__symbol { font-family: var(--font-ipa); font-size: 2.4rem; line-height: 1.1; }
.option__word { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 700; line-height: 1.2; }
.option__ipa { font-family: var(--font-ipa); color: var(--ink-soft); }
.option__ipa::before, .option__ipa::after { content: "/"; color: var(--line-strong); }
.option__audio { font-size: 1.3rem; }        /* ▶ glyph for audio options */
.option__label { font-size: var(--text-sm); color: var(--ink-soft); font-weight: 600; }
.option.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper-sunk); }
.option.is-playing .option__audio { color: var(--accent); }
.option.is-correct { border-color: var(--right); box-shadow: inset 0 0 0 1px var(--right); background: var(--right-soft); }
.option.is-wrong { border-color: var(--wrong); box-shadow: inset 0 0 0 1px var(--wrong); background: var(--wrong-soft); animation: shake 260ms var(--ease); }
.option.is-dimmed { opacity: 0.45; }
.option[disabled] { cursor: default; }
.option[disabled]:hover { border-color: var(--line-strong); }
.option.is-correct[disabled]:hover { border-color: var(--right); }
.option.is-wrong[disabled]:hover { border-color: var(--wrong); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }

.quiz__feedback {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--radius); min-height: 3.75rem;
  border: var(--rule) solid var(--line); background: var(--paper-raised);
}
.quiz__feedback[data-result="right"] { border-color: var(--right); background: var(--right-soft); }
.quiz__feedback[data-result="wrong"] { border-color: var(--wrong); background: var(--wrong-soft); }
.quiz__verdict { font-weight: 700; }
.quiz__feedback[data-result="right"] .quiz__verdict { color: var(--right); }
.quiz__feedback[data-result="wrong"] .quiz__verdict { color: var(--wrong); }
.quiz__explain { font-family: var(--font-serif); color: var(--ink-soft); }

/* ---------- Result ---------- */
.result { text-align: center; display: grid; gap: var(--s-4); justify-items: center; padding: var(--s-6) 0; }
.result__score { font-family: var(--font-serif); font-size: clamp(4rem, 18vw, 6.5rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.result__score small { font-size: 0.4em; color: var(--ink-faint); font-weight: 400; }
.result[data-pass="true"] .result__score { color: var(--right); }
.result[data-pass="false"] .result__score { color: var(--wrong); }
.result__missed { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.result__misses { display: grid; gap: var(--s-2); list-style: none; margin: 0; padding: 0; font-family: var(--font-serif); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 2.25rem; padding: 0 var(--s-3);
  border: var(--rule) solid var(--line-strong); border-bottom: 2px solid var(--cls, var(--line-strong));
  border-radius: var(--radius); background: var(--paper-raised); font-family: var(--font-ipa); font-size: var(--text-lg);
  color: inherit; text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--cls, var(--ink-soft)); }

/* Skill breakdown rows (exam) */
.breakdown { width: 100%; max-width: 26rem; display: grid; gap: var(--s-3); text-align: left; }
.breakdown__row { display: grid; gap: var(--s-1); }
.breakdown__label { display: flex; justify-content: space-between; font-size: var(--text-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Certificate (exam pass) */
.certificate {
  width: 100%; text-align: center; padding: var(--s-7) var(--s-5);
  border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 5px;
  background: var(--paper-raised); margin: var(--s-3) 0;
}
.certificate > * + * { margin-top: var(--s-3); }
.certificate__title { font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: 700; }
.certificate__symbols { font-family: var(--font-ipa); color: var(--accent); font-size: var(--text-xl); letter-spacing: 0.1em; }

/* ---------- Forms (practice setup) ---------- */
.field { border: 0; padding: 0; margin: 0; }
.field > legend, .field > label.field__label { padding: 0; margin-bottom: var(--s-2); }
.choices { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 var(--s-4);
  border: var(--rule) solid var(--line-strong); border-radius: var(--radius); background: var(--paper-raised); font-weight: 600;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Empty / notice */
.notice { border: var(--rule) dashed var(--line-strong); border-radius: var(--radius); padding: var(--s-4); color: var(--ink-soft); }

dialog.sheet {
  border: var(--rule) solid var(--line); border-radius: var(--radius-lg); background: var(--paper);
  color: var(--ink); padding: var(--s-4); width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
}
dialog.sheet::backdrop { background: rgba(20, 17, 13, 0.55); }
.sheet__close { display: flex; justify-content: flex-end; margin-bottom: var(--s-2); }

/* ---------- Vertical rhythm helpers (late in the file so they beat component margin resets) ---------- */
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }

.stack > dialog, .stack-lg > dialog { margin: auto; }

/* ---------- Live class ---------- */
.class-bar {
  position: sticky; top: 3.6rem; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-5);
  background: var(--paper-raised); border: var(--rule) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.class-code {
  font-family: var(--font-serif); font-weight: 700; font-size: var(--text-2xl); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  padding: var(--s-2) var(--s-3); border: 2px solid var(--ink); border-radius: var(--radius);
}
.class-bar__title { flex: 1; min-width: 10rem; display: grid; gap: 2px; }
.class-bar__title b { font-family: var(--font-serif); font-size: var(--text-lg); }
.class-stage { min-height: 50vh; display: grid; gap: var(--s-5); align-content: start; }
.class-big { font-family: var(--font-ipa); font-size: var(--text-symbol); line-height: 1.05; text-align: center; margin: 0; }
.class-big::before, .class-big::after { content: "/"; color: var(--line-strong); font-size: 0.55em; vertical-align: 0.18em; margin: 0 0.12em; }
.class-words { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.class-word {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4); background: var(--paper-raised); border: var(--rule) solid var(--line); border-radius: var(--radius-lg);
}
.class-word__text { font-family: var(--font-serif); font-weight: 700; font-size: var(--text-2xl); }
.class-word__ipa { font-family: var(--font-ipa); font-size: var(--text-xl); color: var(--ink-soft); }
.class-word__ipa::before, .class-word__ipa::after { content: "/"; color: var(--line-strong); }
.class-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.class-pair .class-word { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: var(--s-5) var(--s-3); }
.class-copy {
  width: 100%; min-height: 10rem; resize: vertical; padding: var(--s-3);
  font: var(--text-sm)/1.5 var(--font-ipa); color: var(--ink); background: var(--paper-raised);
  border: var(--rule) solid var(--line-strong); border-radius: var(--radius);
}

/* ---------- Chinese action hints (js/ui/hints.js) ---------- */
/* Hidden unless the page switched them on: <html data-hints="on">. The chart page never does. */
.hint { display: none; font-family: var(--font-ui); font-size: var(--text-sm); font-weight: 500; letter-spacing: 0.04em; color: var(--ink-soft); }
html[data-hints="on"] .hint { display: inline; }
html[data-hints="on"] .symbol-card__hero > .hint,
html[data-hints="on"] .quiz__ask > .hint { display: block; margin-top: var(--s-1); }
html[data-hints="on"] .symbol-card__hero > .hint { margin-top: var(--s-3); }
html[data-hints="on"] .hint--block { display: block; flex-basis: 100%; }
/* Coach-led page: the coach speaks Chinese, so a hint is one small quiet line. */
html[data-hint-scope="class"] .hint { font-size: var(--text-xs); letter-spacing: 0.02em; }
.hint-toggle { font-size: var(--text-sm); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }

/* "Press Space" is for keyboards; touch screens get a tap cue. */
.tap-hint { display: none; }
@media (pointer: coarse), (hover: none) {
  .kbd-hint { display: none; }
  .tap-hint { display: inline; }
}

/* ---------- Small screens ---------- */
@media (max-width: 34rem) {
  .page { padding-top: var(--s-5); }
  .site-header__inner { gap: var(--s-2); }
  .stepper { gap: 0; justify-content: space-between; }
  .stepper__step { padding: var(--s-3) var(--s-1); gap: var(--s-1); font-size: var(--text-xs); }
  .stepper__n { width: 1.25rem; height: 1.25rem; }
  .brand__name { display: none; }
  .nav a { padding: var(--s-2); }
  .symbol-card { padding: var(--s-4); }
  .articulation, .symbol-card--compact .articulation { grid-template-columns: 1fr; }
  .articulation__figure { max-width: 15rem; margin: 0 auto; }
  .stats { gap: var(--s-2); }
  .stat { padding: var(--s-2) var(--s-3); }
  .stat__value { font-size: var(--text-xl); }
  .day-card { grid-template-columns: 2.75rem 1fr; gap: var(--s-3); }
  .day-card__num { width: 2.75rem; height: 2.75rem; font-size: var(--text-lg); }
  .day-card__status { grid-column: 2; text-align: left; }
  .pair { grid-template-columns: 1fr 1fr; }
  .pair__vs { display: none; }
  .class-bar { top: 3.3rem; padding: var(--s-2) var(--s-3); }
  .class-code { font-size: var(--text-xl); }
  .class-word { grid-template-columns: 1fr auto; }
  .class-word__ipa { grid-column: 1; grid-row: 2; font-size: var(--text-lg); }
  .class-word .play { grid-row: 1 / span 2; grid-column: 2; }
  .class-word__text { font-size: var(--text-xl); }
  .option { min-height: 4.75rem; padding: var(--s-3) var(--s-2); }
  .option__word { font-size: var(--text-lg); }
}

/* Phones: every frequently tapped control gets a hit area of at least 44 x 44 CSS px. The glyph and the
   drawn circle keep their size; a transparent ::before grows the target (inset is measured from inside the 1px border), and the gaps between
   neighbours are wider than the growth, so targets never overlap. */
@media (max-width: 600px) {
  .play:not(.play--lg)::before { content: ""; position: absolute; inset: -3px; }
  .play.play--sm::before { inset: -7px; }
  .nav a, .brand { min-height: 2.75rem; display: inline-flex; align-items: center; }
  .brand { min-width: 2.75rem; }
  .theme-toggle { width: 2.75rem; height: 2.75rem; }
  .stepper__step { min-height: 2.75rem; }
  .chip { min-height: 2.75rem; }
  .pager { gap: var(--s-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .site-header, .site-footer, .btn, .play { display: none !important; }
  body { background: #fff; }
}
