/* SayAble prototype.
   Two aesthetics, one token set. The STUDENT flow is playful — colour, rounded,
   chunky pressable buttons, motion. The TEACHER flow keeps the house style —
   square corners, monochrome, mono headings. Mode is switched by [data-mode] on
   <body>, and every colour/radius/font below is a variable so nothing needs
   per-component overrides. Light and dark are both first-class. All motion is
   gated behind prefers-reduced-motion at the bottom of this file. */

/* ── Tokens ────────────────────────────────────────────────────────────── */

:root {
  /* Playful palette — the only chromatic tokens in the app */
  --c-grass:       oklch(0.72 0.18 143);
  --c-grass-deep:  oklch(0.55 0.15 143);
  --c-sky:         oklch(0.66 0.15 245);
  --c-sky-deep:    oklch(0.50 0.14 245);
  --c-gold:        oklch(0.81 0.15 85);
  --c-gold-deep:   oklch(0.66 0.14 78);
  --c-flame:       oklch(0.70 0.18 45);
  --c-berry:       oklch(0.62 0.19 18);
  --c-berry-deep:  oklch(0.47 0.17 18);
  --c-grape:       oklch(0.62 0.18 302);

  /* Surfaces */
  --bg:            oklch(0.985 0.004 250);
  --bg-soft:       oklch(0.955 0.008 250);
  --card:          oklch(1 0 0);
  --fg:            oklch(0.26 0.02 255);
  --fg-muted:      oklch(0.53 0.02 255);
  --border:        oklch(0.90 0.01 255);
  --border-strong: oklch(0.78 0.015 255);
  --shadow-card:   0 1px 2px oklch(0.26 0.02 255 / 0.05), 0 8px 24px oklch(0.26 0.02 255 / 0.05);

  --ring: color-mix(in oklch, var(--c-sky) 40%, transparent);

  /* Ink for text sitting on a bright accent fill. Deliberately identical in both
     themes — the accent tokens stay light in dark mode, so dark ink stays correct. */
  --ink-on-bright: oklch(0.24 0.02 255);

  --font-play: "Nunito", ui-rounded, system-ui, sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-grass:       oklch(0.76 0.19 143);
    --c-grass-deep:  oklch(0.56 0.16 143);
    --c-sky:         oklch(0.72 0.15 245);
    --c-sky-deep:    oklch(0.52 0.14 245);
    --c-gold:        oklch(0.84 0.16 85);
    --c-gold-deep:   oklch(0.66 0.14 78);
    --c-flame:       oklch(0.75 0.18 45);
    --c-berry:       oklch(0.68 0.19 18);
    --c-berry-deep:  oklch(0.50 0.17 18);
    --c-grape:       oklch(0.70 0.18 302);

    --bg:            oklch(0.185 0.015 258);
    --bg-soft:       oklch(0.235 0.018 258);
    --card:          oklch(0.225 0.018 258);
    --fg:            oklch(0.95 0.005 250);
    --fg-muted:      oklch(0.70 0.012 252);
    --border:        oklch(0.33 0.02 258);
    --border-strong: oklch(0.46 0.02 258);
    --shadow-card:   0 1px 2px oklch(0 0 0 / 0.3), 0 10px 28px oklch(0 0 0 / 0.28);
  }
}

/* One visual family everywhere — same palette, same rounded shapes, same type.
   Teacher mode only tightens it: smaller radii, denser padding, no celebratory
   flourish. It should read as the pragmatic surface of the same app, not a
   different product. Monospace survives only for diagnostic readouts. */
body {
  --r: 18px;
  --r-sm: 12px;
  --r-pill: 999px;
  --font-body: var(--font-play);
  --font-head: var(--font-play);
  --head-track: -0.01em;
  --card-pad: 1.5rem;
  --row-gap: 1rem;
}
body[data-mode="teacher"] {
  --r: 14px;
  --r-sm: 10px;
  --card-pad: 1.15rem;
  --row-gap: 0.7rem;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--font-head);
  letter-spacing: var(--head-track);
  margin: 0;
}
h1 { font-weight: 900; }
h2, h3 { font-weight: 800; }

[hidden] { display: none !important; }

.shell {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.shell-narrow { max-width: 760px; }

/* One focus cue for the whole app — a soft ring, never a stacked outline. */
:focus { outline: none; }
:focus-visible { outline: none; }
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 4px var(--ring);
}

/* ── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.brand {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
/* Suffix, not a badge — it should read as part of the wordmark. */
.brand-beta {
  font-weight: 700;
  color: var(--fg-muted);
}
/* Equal cells that divide whatever width exists — never a scrolling filmstrip. */
.modes {
  display: flex;
  flex: 1;
  gap: 0.35rem;
  max-width: 390px;
  margin-left: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
}
.mode-tab {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: none;
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.mode-tab svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.mode-tab.is-active {
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 1px 3px oklch(0 0 0 / 0.12);
}
/* Three cells still divide the width; the label drops before the icon does and
   stays as the button's accessible name. */
@media (max-width: 560px) {
  .mode-tab { font-size: 0.76rem; }
}
@media (max-width: 470px) {
  .mode-tab span {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .mode-tab { padding: 0.5rem; }
  .brand { font-size: 1rem; }
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--card-pad);
  box-shadow: var(--shadow-card);
}

.card-hero { text-align: center; padding: 2.25rem 1.5rem; }

.hero-emoji {
  font-size: clamp(3rem, 12vw, 4.5rem);
  line-height: 1;
  margin-bottom: 0.5rem;
  animation: float 4.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(clamp(-8px, -1.4vh, -4px)) rotate(2deg); }
}

.eyebrow {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-sky);
  margin: 0 0 0.35rem;
}
.hero-note { color: var(--fg-muted); margin: 0.5rem 0 1.6rem; }

/* Screens rise in; distance scales with the viewport, not a fixed px. */
.screen { animation: rise 0.5s var(--ease-out) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(clamp(8px, 2vh, 20px)); }
  to   { opacity: 1; transform: none; }
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

/* The signature press: a solid face over a darker underside that compresses. */
.btn {
  --btn-face: var(--card);
  --btn-under: var(--border-strong);
  --btn-ink: var(--fg);
  --btn-lift: 4px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--btn-ink);
  background: var(--btn-face);
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.9rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 var(--btn-lift) 0 var(--btn-under);
  transition: transform 0.11s var(--ease-out), box-shadow 0.11s var(--ease-out),
              filter 0.15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:active:not(:disabled) {
  transform: translateY(var(--btn-lift));
  box-shadow: 0 0 0 var(--btn-under);
}
.btn:focus-visible { box-shadow: 0 var(--btn-lift) 0 var(--btn-under), 0 0 0 4px var(--ring); }
.btn:active:focus-visible { box-shadow: 0 0 0 var(--btn-under), 0 0 0 4px var(--ring); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  --btn-face: var(--bg-soft);
  --btn-under: var(--border);
  --btn-ink: var(--fg-muted);
}

.btn-go     { --btn-face: var(--c-grass); --btn-under: var(--c-grass-deep); --btn-ink: oklch(1 0 0); }
.btn-danger { --btn-face: var(--c-berry); --btn-under: var(--c-berry-deep); --btn-ink: oklch(1 0 0); }
.btn-ghost  { --btn-face: transparent; --btn-under: transparent; --btn-ink: var(--fg-muted);
              box-shadow: inset 0 0 0 2px var(--border); }
.btn-ghost:active:not(:disabled) { transform: translateY(2px); }
.btn-ghost:focus-visible { box-shadow: inset 0 0 0 2px var(--border), 0 0 0 4px var(--ring); }

/* Sticky action bar: sits in flow, so it reserves its own room. One rule owns
   the bottom gutter + safe-area inset so nothing ever sits flush to the edge. */
.actionbar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 0.9rem 0 calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.actionbar .btn { flex: 1; }
.actionbar .btn-ghost { flex: 0 1 32%; }

/* ── Stats strip ───────────────────────────────────────────────────────── */

.stats {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 620px;
  margin: 0 auto;
  padding: 0.9rem 1.1rem 0;
}
.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.95rem;
  flex: none;
}
.stat-ico { font-size: 1.05rem; line-height: 1; }
#stat-streak { color: var(--c-flame); }
.stat-num { font-variant-numeric: tabular-nums; }
.stat.bump { animation: bump 0.5s var(--ease-spring); }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-4deg); }
  100% { transform: scale(1); }
}

/* Segmented progress — each cell is flex:1, so it fits any width. */
.progress { display: flex; flex: 1; gap: 5px; min-width: 0; }
.seg {
  flex: 1;
  height: 11px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.seg-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-grass);
  transition: width 0.6s var(--ease-out);
}
.seg.is-weak .seg-fill { background: var(--c-gold); }
.seg.is-skip .seg-fill { background: var(--border-strong); }

/* Back control: a bordered chip at tap height with a real icon — never an
   underlined arrow-glyph text link. Every screen that isn't a tab has one. */
.backchip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--fg-muted);
  background: var(--card);
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.45rem 0.9rem 0.45rem 0.7rem;
  margin-bottom: 0.8rem;
  min-height: 38px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border-strong);
  transition: transform 0.11s var(--ease-out), box-shadow 0.11s var(--ease-out), color 0.15s ease;
}
.backchip:hover { color: var(--fg); }
.backchip:active { transform: translateY(2px); box-shadow: 0 0 0 var(--border-strong); }
.backchip:focus-visible { box-shadow: 0 2px 0 var(--border-strong), 0 0 0 4px var(--ring); }
.backchip svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── Speech card ───────────────────────────────────────────────────────── */

.mic-zone { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }

.mic {
  position: relative;
  width: clamp(86px, 24vw, 108px);
  height: clamp(86px, 24vw, 108px);
  border: 0;
  border-radius: 50%; /* deliberate circle */
  background: var(--c-sky);
  color: oklch(1 0 0);
  cursor: pointer;
  box-shadow: 0 5px 0 var(--c-sky-deep);
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out),
              background 0.2s ease;
}
.mic:active { transform: translateY(5px); box-shadow: 0 0 0 var(--c-sky-deep); }
.mic:focus-visible { box-shadow: 0 5px 0 var(--c-sky-deep), 0 0 0 5px var(--ring); }
.mic svg {
  position: absolute; inset: 0; margin: auto;
  width: 42%; height: 42%;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.mic .stop-glyph { fill: currentColor; stroke: none; opacity: 0; }
.mic.is-live { background: var(--c-berry); box-shadow: 0 5px 0 var(--c-berry-deep); }
.mic.is-live .mic-glyph { opacity: 0; }
.mic.is-live .stop-glyph { opacity: 1; }
.mic:disabled { background: var(--bg-soft); color: var(--fg-muted); box-shadow: 0 5px 0 var(--border); cursor: not-allowed; }

/* Pulse anchors to the button itself, so it scales with it at every width. */
.mic-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--c-berry);
  opacity: 0;
  pointer-events: none;
}
.mic.is-live .mic-pulse { animation: pulse-ring 1.7s ease-out infinite; }
@keyframes pulse-ring {
  0%   { transform: scale(0.94); opacity: 0.75; }
  70%  { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

.mic-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin: 0;
}

.meter-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 0.45rem 0.8rem;
}
#meter { flex: 1; min-width: 0; height: 34px; display: block; }
.meter-status {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  white-space: nowrap;
  margin: 0;
}
.meter-status.live { color: var(--c-berry); font-weight: 700; }

.notice {
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  margin: 1rem 0 0;
}
.notice.is-error { color: var(--c-berry); background: color-mix(in oklch, var(--c-berry) 8%, transparent); }

/* ── Grading busy state ────────────────────────────────────────────────── */
/* A small crisp bar that MOVES along the top edge, in currentColor so it
   reads on any surface. Static fallback under reduced motion. */

.grading { position: relative; overflow: hidden; padding: 2.5rem 0 1.5rem; text-align: center; color: var(--fg-muted); }
.grading-bar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 28%;
  border-radius: var(--r-pill);
  background: currentColor;
  animation: travel 1.2s cubic-bezier(0.55, 0, 0.45, 1) infinite;
}
@keyframes travel {
  from { transform: translateX(-100%); }
  to   { transform: translateX(357%); }
}
.grading-text { font-family: var(--font-head); font-weight: 700; font-size: 0.92rem; margin: 0; }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}

/* ── Feedback ──────────────────────────────────────────────────────────── */

.verdict-row { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.1rem; }

.score-ring { position: relative; width: 104px; height: 104px; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track, .ring-fill {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
}
.ring-track { stroke: var(--bg-soft); }
.ring-fill {
  stroke: var(--c-grass);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.95s var(--ease-out), stroke 0.3s ease;
}
.score-ring.is-mid .ring-fill { stroke: var(--c-gold); }
.score-ring.is-low .ring-fill { stroke: var(--c-berry); }
.score-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
}

.verdict-copy { min-width: 0; }
.verdict-head { font-family: var(--font-head); font-weight: 900; font-size: 1.35rem; margin: 0; }
.verdict-sub { color: var(--fg-muted); font-size: 0.88rem; margin: 0.1rem 0 0; }
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem 1.2rem; margin-bottom: 1.3rem; }
.bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.3rem;
}
.bar-track { height: 9px; background: var(--bg-soft); border-radius: var(--r-pill); overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-sky);
  transition: width 0.75s var(--ease-out);
}

.list-head { font-family: var(--font-head); font-weight: 800; font-size: 0.78rem; letter-spacing: 0.04em; margin: 0 0 0.35rem; }

/* Which engine produced the numbers — diagnostic, so monospace earns its place. */
.engine-badge {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-muted);
  margin: 0 0 0.4rem;
}
.engine-line {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.6;
  color: var(--fg-muted);
  margin: 1.4rem 0 0;
}

/* ── Summary ───────────────────────────────────────────────────────────── */

.sum-tiles { display: flex; gap: 0.7rem; margin: 1.4rem 0; }
.tile {
  flex: 1;
  min-width: 0;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 0.85rem 0.5rem;
}
.tile-num {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tile-cap { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-muted); }

.sum-list { list-style: none; margin: 0 0 1.2rem; padding: 0; text-align: left; }
.sum-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.sum-row .sum-q { flex: 1; min-width: 0; }
.sum-row .sum-score { font-family: var(--font-head); font-weight: 900; font-variant-numeric: tabular-nums; }
.sum-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c-grass); }
.sum-dot.is-mid { background: var(--c-gold); }
.sum-dot.is-low { background: var(--c-berry); }
.sum-dot.is-skip { background: var(--border-strong); }

.teacher-note { font-size: 0.8rem; color: var(--fg-muted); margin: 0 0 1.3rem; }
.sum-actions { display: grid; gap: 0.6rem; }

/* ── Teacher view ──────────────────────────────────────────────────────── */

.t-head { margin-bottom: 1.3rem; }
.t-head h1 { font-size: 1.5rem; }
.t-sub { color: var(--fg-muted); font-size: 0.88rem; margin: 0.35rem 0 0; max-width: 56ch; }

.t-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.3rem; }
@media (max-width: 520px) { .t-row { grid-template-columns: 1fr; } }
.t-field { display: block; }
.t-label {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.3rem;
}

/* Keep the native select — it opens the platform picker on a phone — and
   restyle it. The chevron is a real element so it inherits currentColor. */
.select-wrap { position: relative; display: block; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.55rem 2.2rem 0.55rem 0.7rem;
}
.select-chev {
  position: absolute;
  right: 0.7rem; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  pointer-events: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--fg-muted);
}

.t-row-tight { grid-template-columns: 1fr 90px; margin-bottom: 0; }
.t-field-narrow { min-width: 0; }

.t-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--card);
  padding: var(--card-pad);
  display: grid;
  gap: 0.9rem;
}

.t-input, .t-textarea {
  width: 100%;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg-soft);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: 0.5rem 0.7rem;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.t-textarea { resize: vertical; }
.t-input:hover, .t-textarea:hover { background: var(--bg); }
.t-input:focus-visible, .t-textarea:focus-visible {
  background: var(--bg);
  border-color: var(--c-sky);
  box-shadow: 0 0 0 3px var(--ring);
}
.t-input-emoji { text-align: center; font-size: 1.2rem; }

.t-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-muted);
  margin: -0.4rem 0 0;
}
.t-foot {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-muted);
  margin: 1.6rem 0 0;
}

/* Compact buttons in the same family as the student ones — rounded and
   pressable, just smaller and with a shorter lift. Pragmatic, not toy-like. */
.btn-quiet, .btn-solid-quiet, .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.5rem 0.95rem;
  min-height: 40px;
  background: var(--bg-soft);
  color: var(--fg);
  box-shadow: 0 2px 0 var(--border-strong);
  transition: transform 0.11s var(--ease-out), box-shadow 0.11s var(--ease-out),
              filter 0.15s ease;
}
.btn-quiet:hover, .btn-icon:hover, .btn-solid-quiet:hover { filter: brightness(1.04); }
.btn-quiet:active, .btn-icon:active, .btn-solid-quiet:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--border-strong);
}
.btn-quiet:focus-visible, .btn-icon:focus-visible {
  box-shadow: 0 2px 0 var(--border-strong), 0 0 0 4px var(--ring);
}
.btn-solid-quiet {
  background: var(--c-grass);
  color: oklch(1 0 0);
  box-shadow: 0 3px 0 var(--c-grass-deep);
}
.btn-solid-quiet:active { box-shadow: 0 0 0 var(--c-grass-deep); transform: translateY(3px); }
.btn-solid-quiet:focus-visible { box-shadow: 0 3px 0 var(--c-grass-deep), 0 0 0 4px var(--ring); }
.btn-quiet svg, .btn-solid-quiet svg, .btn-icon svg {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.btn-icon { padding: 0.45rem; min-width: 38px; }
.btn-icon.is-armed {
  background: color-mix(in oklch, var(--c-berry) 15%, transparent);
  color: var(--c-berry);
  box-shadow: 0 2px 0 var(--c-berry-deep);
  padding: 0.45rem 0.8rem;
}

.t-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.3rem; }
.t-actions .btn-solid-quiet { margin-left: auto; }

/* ── Practice mode ─────────────────────────────────────────────────────── */

#p-stat-reps { color: var(--c-grape); }

.set-grid { display: grid; gap: 0.7rem; text-align: left; }
.set-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  font: inherit;
  font-family: var(--font-head);
  text-align: left;
  cursor: pointer;
  background: var(--bg-soft);
  color: var(--fg);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: 0.85rem 1rem;
  transition: border-color 0.16s ease, transform 0.12s var(--ease-out);
}
.set-card:hover { border-color: var(--c-sky); }
.set-card:active { transform: translateY(2px); }
.set-card:focus-visible { border-color: var(--c-sky); box-shadow: 0 0 0 4px var(--ring); }
.set-emoji { font-size: 1.6rem; line-height: 1; flex: none; }
.set-copy { min-width: 0; }
.set-name { display: block; font-weight: 800; font-size: 0.98rem; }
.set-meta { display: block; font-weight: 600; font-size: 0.78rem; color: var(--fg-muted); }

.p-instruction {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 0 0 0.5rem;
}

/* Target phrase as word chips — each one can be marked independently. */
.target {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.35rem;
  margin-bottom: 1.5rem;
}
.word {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.1rem, 3.9vw, 1.4rem);
  line-height: 1.25;
  border-radius: var(--r-sm);
  padding: 0.1rem 0.4rem;
  background: transparent;
  transition: background 0.3s ease, color 0.3s ease;
}
.word.is-hit  { background: color-mix(in oklch, var(--c-grass) 20%, transparent); }
.word.is-near { background: color-mix(in oklch, var(--c-gold) 26%, transparent); }
.word.is-miss { background: color-mix(in oklch, var(--c-berry) 16%, transparent); }
.word .heard {
  font-size: 0.62em;
  font-weight: 700;
  color: var(--fg-muted);
  font-style: italic;
}

.p-readout { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; }
.readout {
  flex: 1;
  min-width: 0;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.6rem;
  text-align: center;
}
.readout-num {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.readout-cap { font-size: 0.68rem; color: var(--fg-muted); font-weight: 600; }

.p-heard-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--fg-muted);
  margin: 0 0 0.2rem;
}
.p-heard {
  font-size: 0.95rem;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  margin: 0 0 1.1rem;
}
.p-heard.is-empty { color: var(--fg-muted); font-style: italic; }

.p-notes { list-style: none; margin: 0 0 1.1rem; padding: 0; font-size: 0.9rem; }
.p-notes li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.35rem;
}
.p-notes li::before { content: "→"; position: absolute; left: 0; color: var(--c-sky); font-weight: 900; }

.p-caveat {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
  margin: 0;
}

.p-work { margin-bottom: 1.2rem; text-align: left; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.work-chip {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  background: color-mix(in oklch, var(--c-gold) 22%, transparent);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.65rem;
}

/* ── Confetti overlay ──────────────────────────────────────────────────── */

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  display: none;
}
#confetti.is-active { display: block; }

/* ── Reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* Keep the busy state legible without movement: a static leading bar. */
  .grading-bar { animation: none; transform: none; }
  .dots::after { animation: none; content: "…"; }
  .hero-emoji { animation: none; }
}
