/* Vantage Point. Every colour, face, radius, shadow and duration comes from the
   Vantage tokens in brand/tokens.css (loaded first). This file maps the app's
   own variables onto them, once for light (beige canvas) and once for dark
   (deep-green canvas). There is no third background colour. */

/* Light: beige canvas, paper cards, deep-green headings. */
:root {
  --bg: var(--surface-canvas);
  --card: var(--surface-paper);
  --ink: var(--text-body);
  --heading: var(--text-heading);
  /* Brand muted, nudged towards the body colour so it also passes AA on the canvas. */
  --muted: color-mix(in srgb, var(--text-muted) 80%, var(--text-body));
  --line: var(--surface-sunken); /* tracks and empty marks */
  --primary: var(--color-primary); /* primary fill: deep green */
  --primary-dark: var(--green-800);
  --on-primary: var(--bone);
  --accent: var(--petrol-500); /* petrol for fills and marks */
  --accent-dark: var(--petrol-700); /* petrol text on beige and paper */
  --accent-fill: var(--petrol-500); /* filled petrol buttons, bone text */
  --secondary-fill: var(--navy-900);
  --good: var(--color-success);
  --ok: var(--color-warning);
  --ok-text: var(--color-warning-onlight);
  --bad: var(--color-danger);
  /* The Engineering zone "De fabriek beter maken" (15 Nov): its own token, not --bad, so the zone does not borrow the
     error colour. Terracotta, burnt brick warmed with ochre (both brand hues); the dark value is lifted with bone as
     --bad is. The film kit carries the same two values (films/_kit/mapscene.mjs ZONE_VARS, tests/engmap.test.js). */
  --zone-better: color-mix(in srgb, var(--danger-500) 70%, var(--warn-500));
  --mark: rgba(168, 116, 51, 0.24); /* filler highlight: ochre wash */
  --tint: rgba(39, 111, 129, 0.1); /* petrol wash for quiet panels */
  --radius: var(--radius-md);
  color-scheme: light;
}

/* Dark: deep-green canvas, ramp cards, bone text. Applied by the system (Auto)
   or by the Dark setting; the two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--surface-canvas-inverse);
    --card: var(--surface-paper-inverse);
    --ink: var(--bone);
    --heading: var(--text-heading-inverse);
    --muted: var(--text-muted-inverse);
    --line: var(--surface-sunken-inverse);
    --primary: var(--petrol-500);
    --primary-dark: var(--petrol-700);
    --on-primary: var(--bone);
    --accent: var(--petrol-300);
    --accent-dark: var(--petrol-300);
    --accent-fill: var(--petrol-700);
    --secondary-fill: var(--navy-700);
    --good: var(--green-300);
    --ok: var(--warn-500);
    --ok-text: color-mix(in srgb, var(--warn-500) 70%, var(--bone));
    --bad: color-mix(in srgb, var(--danger-300) 60%, var(--bone));
    --zone-better: color-mix(in srgb, color-mix(in srgb, var(--danger-300) 70%, var(--warn-500)) 75%, var(--bone));
    --mark: rgba(168, 116, 51, 0.4);
    --tint: rgba(92, 159, 174, 0.12);
    --border-subtle: var(--border-subtle-inverse);
    --shadow-card: var(--shadow-card-inverse);
    --map-halo: var(--card); /* v17: the subject map's lit labels sit on the card colour */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--surface-canvas-inverse);
  --card: var(--surface-paper-inverse);
  --ink: var(--bone);
  --heading: var(--text-heading-inverse);
  --muted: var(--text-muted-inverse);
  --line: var(--surface-sunken-inverse);
  --primary: var(--petrol-500);
  --primary-dark: var(--petrol-700);
  --on-primary: var(--bone);
  --accent: var(--petrol-300);
  --accent-dark: var(--petrol-300);
  --accent-fill: var(--petrol-700);
  --secondary-fill: var(--navy-700);
  --good: var(--green-300);
  --ok: var(--warn-500);
  --ok-text: color-mix(in srgb, var(--warn-500) 70%, var(--bone));
  --bad: color-mix(in srgb, var(--danger-300) 60%, var(--bone));
  --zone-better: color-mix(in srgb, color-mix(in srgb, var(--danger-300) 70%, var(--warn-500)) 75%, var(--bone));
  --mark: rgba(168, 116, 51, 0.4);
  --tint: rgba(92, 159, 174, 0.12);
  --border-subtle: var(--border-subtle-inverse);
  --shadow-card: var(--shadow-card-inverse);
  --map-halo: var(--card);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text-base)/var(--leading-normal) var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); color: var(--heading); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); }
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 8px 16px 110px; display: flex; flex-direction: column; gap: 14px; animation: vp-fade var(--motion-base) var(--ease-entrance) both; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Motion: everything decelerates into place. No bounce, no overshoot. */
@keyframes vp-fade { from { opacity: 0; } }
@keyframes vp-rise { from { opacity: 0; transform: translateY(calc(var(--motion-stage-y) / 3)); } }
@keyframes vp-breathe { from { opacity: 1; } to { opacity: 0.45; } }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--heading); }
.brand-mark { width: 30px; height: 30px; display: block; flex: none; }
.mark-dark { display: none; }
:root[data-theme="dark"] .mark-light { display: none; }
:root[data-theme="dark"] .mark-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark-light { display: none; }
  :root:not([data-theme="light"]) .mark-dark { display: block; }
}
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: var(--tracking-tight); line-height: 1; }
h1.round-title { margin: 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 6px 10px 6px 2px; margin-left: -4px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 600; color: var(--heading);
}
.back-btn .ico { color: var(--accent-dark); font-size: 1.2rem; }
@media (hover: hover) { .back-btn:hover { background: var(--tint); } }
.round-title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--heading); display: flex; align-items: center; gap: 2px; min-width: 0; }
.icon-btn {
  border: 0; background: none; font-size: 1.2rem; padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted);
  min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; transition: color var(--motion-fast) var(--ease-standard);
}
@media (hover: hover) { .icon-btn:hover { color: var(--heading); } }
.icon-btn.small { font-size: 0.875rem; }
.streak { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 0.95rem; color: var(--muted); }
.streak.on { color: var(--accent-dark); }
/* The flame never stands alone: a short, quiet label says what the number counts. */
.streak-label { font-family: var(--font-body); font-size: var(--text-xs, 0.75rem); color: var(--muted); white-space: nowrap; }
.streak.big { font-size: 1.1rem; justify-content: center; gap: 6px; }
.streak.big span:last-child { font-family: var(--font-body); color: var(--muted); font-size: 0.9rem; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-card);
}
.card-title, .today-label {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; text-transform: uppercase;
  letter-spacing: var(--tracking-label); color: var(--muted); margin: 0 0 8px; line-height: 1.4;
}
.card-title:not(:first-child) { margin-top: 18px; }
.section-title { font-size: 1rem; margin: 8px 0 0; }

/* Buttons */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 13px 18px; font-weight: 600; letter-spacing: 0.01em; cursor: pointer;
  min-height: 44px; line-height: 1.3;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), opacity var(--motion-fast) var(--ease-standard);
}
.btn:active:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
@media (hover: hover) { .btn-primary:hover:not(:disabled) { background: var(--primary-dark); } }
.btn-big { width: 100%; font-size: 1.05rem; padding: 15px; }
.btn-ghost { background: transparent; border-color: var(--border-subtle); color: var(--heading); }
@media (hover: hover) { .btn-ghost:hover:not(:disabled) { background: var(--tint); } }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 8px 12px; font-size: 0.9rem; min-height: 44px; }
.file-btn { position: relative; cursor: pointer; display: inline-flex; align-items: center; }
.file-btn .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.import-confirm { margin: 12px 0 0; }
/* The daily lesson: the speaking home's one secondary card, outlined (only Today is filled). */
.btn-hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  padding: 16px 18px; text-align: left; border-radius: var(--radius);
  background: var(--card); color: var(--heading); border-color: var(--border-subtle); box-shadow: var(--shadow-card);
}
@media (hover: hover) { .btn-hero:hover:not(:disabled) { border-color: var(--accent); } }
.btn-hero .hero-title { font-size: 1.15rem; }
.btn-hero .hero-title .ico { color: var(--accent-dark); }
.btn-hero .hero-sub { color: var(--muted); opacity: 1; }
.hero-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; letter-spacing: var(--tracking-tight); display: flex; align-items: center; gap: 4px; }
.hero-sub { font-weight: 400; opacity: 0.85; font-size: 0.95rem; }

/* Level / week */
.level-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.level-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-label);
  background: var(--tint); color: var(--accent-dark); padding: 4px 9px; border-radius: var(--radius-sm);
}
.level-badge.big { font-size: 0.85rem; padding: 8px 14px; align-self: center; }
.level-row .muted { font-family: var(--font-mono); font-size: 0.8rem; }
.bar { height: 6px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: var(--radius-sm); transition: width var(--motion-slow) var(--ease-entrance); }

/* Drill grid */
/* minmax(0, 1fr): a long drill name ("Spreekstructuren") must not push the grid past 320 px. */
.drill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drill {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; color: var(--ink);
  background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-card); cursor: pointer; min-width: 0;
  transition: border-color var(--motion-fast) var(--ease-standard);
}
@media (hover: hover) { .drill:hover:not(:disabled) { border-color: var(--accent); } }
.drill-icon { font-size: 1.35rem; color: var(--accent-dark); line-height: 1; }
.drill-name { font-weight: 600; color: var(--heading); max-width: 100%; hyphens: auto; overflow-wrap: break-word; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.pips i.on { background: var(--accent); }

/* Nav */
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border-subtle);
}
.nav-item {
  flex: 1; max-width: 180px; min-height: 52px; border: 0; background: none; padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.75rem; font-weight: 500; color: var(--muted);
  transition: color var(--motion-fast) var(--ease-standard);
}
.nav-item.active { color: var(--accent-dark); font-weight: 600; }
.nav-icon { font-size: 1.3rem; line-height: 1; }

/* Round */
.intro-card { text-align: center; }
.intro-card h1 { margin: 4px 0; font-size: 1.6rem; }
.intro-icon { font-size: 2.4rem; color: var(--accent-dark); line-height: 1; margin-top: 4px; }
.segmented { display: flex; background: var(--line); border-radius: var(--radius-md); padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: 0; background: transparent; padding: 10px; border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; min-height: 44px;
  color: var(--muted); transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.segmented button.on { background: var(--card); color: var(--heading); font-weight: 600; box-shadow: var(--shadow-card); }
.segmented button:disabled { opacity: 0.5; cursor: default; }
.prompt-card { text-align: center; padding: 22px 16px; }
.prompt-main { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; margin: 0; line-height: 1.25; color: var(--heading); letter-spacing: var(--tracking-tight); }
.prompt-sub { margin: 10px 0 0; color: var(--muted); }
.prompt-sub b { color: var(--ink); }
.bubble {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin: 12px 0 0; padding: 14px 16px; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
  background: var(--tint); color: var(--heading); display: inline-block;
}
.scaffold { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.chip {
  padding: 5px 10px; border-radius: var(--radius-sm); background: var(--line); font-weight: 500; font-size: 0.9rem; border: 1px solid var(--border-subtle);
}
.chip.word { background: var(--tint); transition: background-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard); }
.chip.word.hit { background: var(--good); border-color: var(--good); color: var(--bone); }
.chip.word.hit::before { content: '✓ '; }
.chip.filler { background: var(--mark); }
.rapid-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.rapid-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.rapid-dots i.on { background: var(--accent); }
.phase-label { text-align: center; font-weight: 600; color: var(--muted); font-size: 1.05rem; }
.phase-label.go { font-family: var(--font-display); color: var(--accent-dark); font-size: 1.5rem; }
.answer-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.ring-wrap { position: relative; width: 110px; height: 110px; margin: 0 auto; }
.answer-row .ring-wrap { width: 84px; height: 84px; margin: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 500; font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--heading); }
.live {
  min-height: 120px; max-height: 32dvh; overflow-y: auto; padding: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px dashed var(--border-subtle); font-size: 1.05rem;
}
.interim { color: var(--muted); }
.type-input {
  width: 100%; min-height: 150px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
  background: var(--card); resize: vertical; font-size: 1.05rem;
}
.type-input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.note {
  margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.9rem;
  background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ink); border: 1px solid var(--border-subtle);
}

/* Feedback */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
}
.stat b { font-family: var(--font-mono); font-weight: 500; font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--heading); }
.stat span { font-size: 0.7rem; color: var(--muted); line-height: 1.2; }
.stat.good b { color: var(--good); }
.stat.ok b { color: var(--ok-text); }
.stat.bad b { color: var(--bad); }
.transcript { margin: 0; white-space: pre-wrap; }
.transcript mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 2px; }
/* Vague words: a different colour from fillers, plus an underline (not colour alone). */
.vague { background: var(--tint); border-radius: 2px; padding: 0 2px;
  text-decoration: underline dashed var(--accent-dark); text-underline-offset: 3px; }
.words-note p { margin: 6px 0 0; }
.words-vague { margin: 10px 0 2px; font-weight: 600; }
.words-card .week-row span::first-letter { text-transform: none; }
.good-text { color: var(--good); font-weight: 600; margin: 0; }
audio { width: 100%; margin-top: 4px; }
.rate-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rate-btn {
  border: 1px solid var(--border-subtle); background: var(--card); border-radius: var(--radius-sm); padding: 8px 2px; cursor: pointer; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.7rem; color: var(--ink);
  transition: border-color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.rate-btn b { font-family: var(--font-mono); font-weight: 500; font-size: 1.1rem; }
.rate-btn.on { border-color: var(--accent); background: var(--tint); }
.scores { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 12px; }
@media (min-width: 480px) { .scores { grid-template-columns: 1fr 1fr; column-gap: 20px; } }
.score { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.coach-line { padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 8px; border: 1px solid var(--border-subtle); }
.coach-line.good { background: color-mix(in srgb, var(--good) 10%, var(--card)); }
.coach-line.work { background: var(--tint); }
/* Speech recognition check: quiet, compact. */
.misheard { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--border-subtle); font-size: 0.875rem; }
.misheard-title { margin: 0 0 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.misheard ul { margin: 0; padding: 0; list-style: none; }
.misheard li { overflow-wrap: anywhere; color: var(--muted); }
.misheard .heard { text-decoration: line-through; }
.misheard .likely { color: var(--ink); font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.transcript-fix { margin: -6px 0 6px; }
.transcript-fix-box { margin: 0 0 12px; }
.transcript-fix-box p { margin: 0 0 6px; }
.transcript-fix-box textarea { resize: vertical; }
.transcript-fix-box .row { align-items: center; gap: 16px; margin-top: 8px; }
.stronger { margin-top: 12px; }
.stronger summary { font-family: var(--font-display); font-weight: 600; color: var(--heading); cursor: pointer; min-height: 32px; }
.stronger p { font-family: var(--font-display); font-style: italic; }
.shimmer {
  height: 60px; border-radius: var(--radius-sm); background: var(--line);
  animation: vp-breathe var(--motion-scene) var(--ease-standard) infinite alternate;
}
.big-emoji, .done-mark { font-size: 2.4rem; color: var(--accent-dark); margin: 4px 0; line-height: 1; }

/* Done */
.screen.done { align-items: center; justify-content: center; text-align: center; padding-top: 10dvh; }
.done-mark { animation: vp-rise var(--motion-slow) var(--ease-entrance) both; }
.screen.done h1 { margin: 0; font-size: 1.8rem; }
.xp-big { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 500; color: var(--accent-dark); }

/* Progress */
.spark { display: block; width: 100%; height: 70px; }
.spark-line, .spark-base { vector-effect: non-scaling-stroke; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-line.invert { stroke: var(--heading); }
.spark-dot { fill: var(--heading); }
.spark-base { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 4; }
.levels { display: flex; flex-direction: column; gap: 8px; }
.level-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history { display: flex; flex-direction: column; }
.hist-item { border-top: 1px solid var(--border-subtle); padding: 10px 0; }
.hist-item summary { display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none; min-height: 44px; }
.hist-item summary::-webkit-details-marker { display: none; }
.hist-icon { color: var(--accent-dark); }
.hist-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hist-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; font-weight: 600; }
.hist-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* Debate */
.side-banner {
  margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  background: color-mix(in srgb, var(--good) 10%, var(--card)); color: var(--good); border: 1px solid var(--good);
}
.side-banner.against { background: color-mix(in srgb, var(--bad) 10%, var(--card)); color: var(--bad); border-color: var(--bad); }
.pop { animation: vp-rise var(--motion-base) var(--ease-entrance) both; }

/* Pause drill */
.pause-counters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.counter { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: var(--radius-sm); background: var(--line); border: 1px solid var(--border-subtle); }
.counter b { font-family: var(--font-mono); font-weight: 500; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.counter span { font-size: 0.8rem; font-weight: 500; }
.counter.good { background: color-mix(in srgb, var(--good) 10%, var(--card)); }
.counter.bad { background: color-mix(in srgb, var(--bad) 12%, var(--card)); color: var(--bad); }
.stats.two { grid-template-columns: 1fr 1fr; }

/* Story Chain */
.story-start { font-size: 1.2rem; }
.twist {
  margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 4px;
  background: var(--tint); border: 1px solid var(--border-subtle);
}
.twist small { color: var(--accent-dark); font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-label); font-size: 11px; }
.twist b { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--heading); }

/* Weekly review */
.week-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 0.95rem; }
.week-row span::first-letter { text-transform: uppercase; }
.week-row b { font-weight: 600; text-align: right; }
.week-row b.good { color: var(--good); }
.week-row b.bad { color: var(--bad); }
.focus { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--tint); border: 1px solid var(--border-subtle); }
.week-card .focus + .btn { margin-top: 10px; }

/* Live conversation */
.convo-card { width: 100%; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius-lg); font-size: 1.05rem; line-height: 1.4; animation: vp-rise var(--motion-base) var(--ease-entrance) both; }
.msg-partner { align-self: flex-start; background: var(--card); border: 1px solid var(--border-subtle); border-bottom-left-radius: var(--radius-sm); }
.msg-user { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: var(--radius-sm); }
.msg.typing { color: var(--muted); animation: vp-breathe var(--motion-scene) var(--ease-standard) infinite alternate; }
.chat-controls { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.small-live { min-height: 64px; }
.mic.recording { background: var(--accent-fill); }

/* Boss round: the navy end of the ramp, as a deliberate second fill. */
.boss-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 18px 20px; text-align: left;
  border-radius: var(--radius-lg); background: var(--secondary-fill); color: var(--bone);
}

/* Modifiers */
.modifier-chip { margin: 10px 0 4px; padding: 10px 12px; border-radius: var(--radius-sm); text-align: left; display: flex; flex-direction: column; gap: 2px;
  background: var(--tint); border: 1px dashed var(--border-subtle); }
.modifier-chip b { font-weight: 600; }
.modifier-chip span { font-size: 0.9rem; color: var(--muted); }
.harder { align-self: center; }
.good-note { background: color-mix(in srgb, var(--good) 10%, var(--card)); }

/* Clean run */
.clean-chip { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 8px; padding: 5px 10px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-weight: 500; font-size: 0.8rem;
  background: var(--tint); color: var(--accent-dark); font-variant-numeric: tabular-nums; }

/* Personal bests */
.pb-card p, .highlights p { margin: 4px 0; font-weight: 600; }
.pb-card .ico, .highlights .ico { color: var(--accent-dark); }
.highlights { width: 100%; text-align: left; }
.done-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* Practice plan */
.plan-picker { display: flex; flex-direction: column; gap: 10px; text-align: left; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--border-subtle); background: var(--card); color: var(--ink); border-radius: var(--radius-sm); padding: 8px 12px; min-height: 44px; font-weight: 500; cursor: pointer; }
.chip-btn.on { border-color: var(--accent); background: var(--tint); color: var(--heading); }
.plan-custom { width: 100%; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--card); }

/* Streak freezes */
.freezes { margin-left: 6px; font-size: 0.9rem; color: var(--accent-dark); }
.break-card { display: flex; gap: 10px; align-items: flex-start; background: var(--card); }
.break-card p { margin: 0; flex: 1; }
.quick-btn { width: 100%; }

/* Quests */
.quest-card .card-title { margin: 0; }
.quest-card .level-row { align-items: flex-start; }
.quest-reward { font-family: var(--font-mono); font-size: 0.72rem; text-align: right; max-width: 55%; }
.quest { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; font-size: 0.95rem; }
/* Divider only between quests (the first quest follows the title row). */
button.quest-go { width: 100%; min-height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer; }
button.quest-go .muted.small { display: inline-flex; align-items: center; gap: 2px; }
@media (hover: hover) { button.quest-go:hover { background: var(--tint); } }
.quest + .quest { border-top: 1px solid var(--border-subtle); }
.quest .muted.small { font-family: var(--font-mono); font-size: 0.75rem; }
.quest-check { width: 22px; height: 22px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); display: grid; place-items: center; font-size: 0.85rem; color: var(--on-primary); }
.quest.done .quest-check { background: var(--accent-fill); border-color: var(--accent-fill); }
.quest.done span:nth-child(2) { color: var(--muted); text-decoration: line-through; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--heading); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-md); font-weight: 500; font-size: 0.9rem;
  box-shadow: var(--shadow-card); animation: toast-in var(--motion-base) var(--ease-entrance) both; width: max-content; max-width: min(92vw, 420px); text-align: center;
}
.toast.out { opacity: 0; transition: opacity var(--motion-base) var(--ease-exit); }
/* Own keyframes: vp-rise animates transform and would undo the centring. */
@keyframes toast-in { from { transform: translateX(-50%) translateY(calc(var(--motion-stage-y) / 3)); opacity: 0; } to { transform: translateX(-50%); } }


/* Welcome */
.welcome { justify-content: space-between; padding-top: calc(16px + env(safe-area-inset-top)); min-height: 100dvh; padding-bottom: 32px; }
.welcome-top { display: flex; justify-content: space-between; align-items: center; }
.small-seg button { padding: 6px 12px; }
.welcome-slide { text-align: center; padding: 0 8px; animation: vp-rise var(--motion-slow) var(--ease-entrance) both; }
.welcome-icon { font-size: 3rem; color: var(--accent-dark); line-height: 1; }
.welcome-slide .brand { flex-direction: column; gap: 14px; }
.welcome-slide .brand-mark { width: 84px; height: 84px; }
.welcome-slide .wordmark { font-size: 1.6rem; }
.welcome-slide h1 { font-size: 1.8rem; margin: 18px 0 8px; }
.welcome-slide p { font-size: 1.05rem; color: var(--muted); margin: 0; }
.welcome-dots { display: flex; justify-content: center; gap: 8px; }
.welcome-dots i { width: 8px; height: 4px; border-radius: 2px; background: var(--line); transition: width var(--motion-base) var(--ease-entrance); }
.welcome-dots i.on { background: var(--accent); width: 24px; }

/* Settings */
.field-label { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); margin: 14px 0 6px; }
.field-label:first-child { margin-top: 0; }
input[type="password"], input[type="text"], input[type="search"], input[type="date"], select, textarea.text-input {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--card); color: var(--ink);
}
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.saved { color: var(--good); font-weight: 500; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 2px; }

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

/* The hidden attribute must win over component display rules (e.g. .twist). */
[hidden] { display: none !important; }

/* Skill radar + calibration */
.radar { display: block; width: 100%; max-width: 340px; margin: 4px auto; }
.radar-grid { fill: none; stroke: var(--border-subtle); stroke-width: 1; }
.radar-shape { fill: var(--tint); stroke: var(--accent); stroke-width: 1.75; }
.radar-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; fill: var(--ink); }
.radar-label.dim { opacity: 0.55; }
.calib-card p { margin: 0; }

/* Journey milestones */
.journey { list-style: none; margin: 0; padding: 0; position: relative; }
.journey::before { content: ''; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 1px; background: var(--border-subtle); }
.ms { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; position: relative; }
.ms-dot { flex: none; width: 27px; height: 27px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--card); border: 1px solid var(--border-subtle); color: var(--on-primary); z-index: 1; font-size: 0.85rem; }
.ms.reached .ms-dot { background: var(--accent-fill); border-color: var(--accent-fill); }
.ms.next .ms-dot { border: 2px solid var(--accent); }
.ms-text { display: flex; flex-direction: column; gap: 1px; }
.ms-text b { font-weight: 600; }
.ms-text small { color: var(--muted); }
.ms.later { opacity: 0.6; }
.ms-next { color: var(--accent-dark) !important; font-weight: 500; }

/* Spoken-cue drills */
.cue-hint { margin: 8px 0 0; font-weight: 500; color: var(--accent-dark); text-align: center; }
.listen-statement { font-style: italic; }

/* Spaced re-attempts */
.review-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 16px 20px; border-radius: var(--radius-lg);
  border: 0; color: var(--bone); text-align: left; background: var(--accent-fill); font: inherit; cursor: pointer;
}

/* Adaptive lesson */
.reason-chip { margin: 6px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--tint); color: var(--ink); font-weight: 500; }

/* Structure frames */
.frame-name { margin: 10px 0 4px; font-weight: 600; text-align: center; color: var(--heading); }
.frame-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

/* Real-life scenarios */
.real-text { font-size: 1.25rem; }

/* My real week */
.rw-text { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.rw-event, .rw-home { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rw-event + .rw-event { border-top: 1px solid var(--border-subtle); padding-top: 10px; margin-top: 10px; }
.rw-event p, .rw-home p { margin: 0; }
.rw-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.rw-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.rw-card-title { font-weight: 600; color: var(--heading); }
.rw-invite { width: 100%; }
.realweek select, .realweek input[type="date"], .text-input { width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--card); color: var(--ink); font: inherit; margin-bottom: 6px; }
.rw-learned + .rw-learned { border-top: 1px solid var(--border-subtle); padding-top: 8px; }
.rw-learned p { margin: 2px 0; overflow-wrap: anywhere; }
.rw-rating { font-family: var(--font-mono); font-weight: 500; color: var(--accent-dark); }

/* Pace over time + one fix */
.pace-bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; margin: 8px 0; }
.pace-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 2px; }
.pace-bar i { display: block; width: 100%; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--accent); }
.pace-bar small { color: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.fix-options { display: flex; flex-wrap: wrap; gap: 8px; }
.fix-options .on, .fix-own .on { border-color: var(--accent); background: var(--tint); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-chip.on { border-color: var(--accent); background: var(--tint); }
.skill-chip.on::before { content: '✓ '; }
.fix-own { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.fix-own .text-input { margin: 0; }
.fix-chip { margin: 6px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--tint); font-weight: 500; }

/* Headings get focus on navigation (for screen readers); no ring for that. */
[tabindex="-1"]:focus { outline: none; }
.rw-share { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }

/* Weekly reset */
.week-options { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.week-option { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.week-option.on { border-color: var(--accent); background: var(--tint); }
.week-option small { display: block; font-weight: 400; }
.week-icon { font-size: 1.4rem; color: var(--accent-dark); line-height: 1; }
.week-btn { width: 100%; }

/* Word budget */
.budget-chip { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 8px; padding: 5px 10px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-weight: 500; font-size: 0.85rem; background: var(--tint); }
.budget-chip.near { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.budget-chip.over { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

/* Under pressure */
.cue-text.interrupt { color: var(--bad); animation: vp-rise var(--motion-base) var(--ease-entrance) both; }

/* Shadowing */
.shadow-model { font-family: var(--font-display); font-style: italic; }
.shadow-card .btn { width: 100%; margin-top: 6px; }

/* Friend rating */
.friend-row { margin-bottom: 12px; }
.friend-link { word-break: break-all; }

/* Self-explanation before the stronger version */
.self-q { margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--tint); border: 1px solid var(--border-subtle); }
.self-q .row { display: flex; gap: 8px; margin-top: 6px; }
.self-fix { margin: 10px 0 0; }

/* Mastery and level pills: mono labels, small radii. */
.mastery, .pill {
  /* Status, not a control: plain mono text, no chip, so nothing invites a tap. */
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; padding: 0; border-radius: 0; margin: 2px 0; background: none !important;
  text-transform: uppercase; letter-spacing: var(--tracking-label); line-height: 1.4;
}
.mastery.m-learn { background: var(--line); color: var(--muted); }
.mastery.m-practise { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok-text); }
.mastery.m-own { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill { background: var(--tint); color: var(--accent-dark); }
.friend-latest { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.friend-line { margin: 2px 0 0; font-family: var(--font-display); font-style: italic; overflow-wrap: anywhere; }

/* Today: one next thing */
.today-card { border-color: var(--border-subtle); }
.today-label { margin: 0; }
.today-what { font-family: var(--font-display); margin: 6px 0 4px; font-size: 1.35rem; font-weight: 600; color: var(--heading); letter-spacing: var(--tracking-tight); line-height: 1.25; }
.today-what .ico { color: var(--accent-dark); }
.today-go { width: 100%; margin-top: 8px; }
/* Every disclosure: one chevron, pointing right when closed and down when open. */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before, .module-link::before {
  content: ''; display: inline-block; vertical-align: middle; flex: none; justify-self: center;
  width: 7px; height: 7px; margin: 0 8px 2px 2px; border-right: 1.5px solid var(--accent-dark); border-bottom: 1.5px solid var(--accent-dark);
  transform: rotate(-45deg); transition: transform var(--motion-fast) var(--ease-standard);
}
details[open] > summary::before { transform: rotate(45deg); }
/* Speaking home: four labelled bands (Vandaag, Oefenen, Uitdagen, Echt en terugkijken). */
.band { display: flex; flex-direction: column; gap: 10px; }
.band + .band { margin-top: 10px; }
.band-title {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; text-transform: uppercase;
  letter-spacing: var(--tracking-label); color: var(--muted); margin: 0; line-height: 1.4;
}
.band .programme-card .btn { width: 100%; }
.band .programme-card .prog-stop { width: auto; }
.band .rw-entry, .band .lb-entry { margin-top: 0; }
/* Single cards in a band read as rows: icon left, name and line beside it. */
.band .convo-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px 14px; }
.band .convo-card .drill-icon { grid-row: span 2; }
.band .programme-card .prog-intro { margin: 4px 0 10px; }
/* Quests and the practice drills fold shut under the next round; the summary says what is inside. */
.speak-fold > .fold-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.speak-fold > .fold-head::before { flex: none; }
.speak-fold > .fold-head .card-title { margin: 0; flex: 1; }
.speak-fold[open] > .fold-head { margin-bottom: 8px; }
.quest-card > .fold-head { flex-wrap: wrap; row-gap: 0; padding: 6px 0; }
.quest-card .quest-reward { flex-basis: 100%; max-width: none; text-align: left; padding-left: 22px; }
.practice-fold.card { padding: 10px 14px; }
.practice-fold .drill-groups { margin-top: 4px; }
.speak-home .review-card {
  padding: 12px 16px; background: var(--card); color: var(--heading); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card);
}
.speak-home .review-card .hero-title { font-size: 1.05rem; }
.speak-home .review-card .hero-title .ico { color: var(--accent-dark); }
.speak-home .review-card .hero-sub { color: var(--muted); opacity: 1; }
.speak-home .btn-hero { padding: 12px 16px; }
/* The weekly boss round is outlined too: the next round stays the only filled button. */
.speak-home .boss-card {
  padding: 12px 16px; border-radius: var(--radius); background: var(--card); color: var(--heading);
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card);
}
@media (hover: hover) { .speak-home .boss-card:hover:not(:disabled) { border-color: var(--accent); } }
.speak-home .boss-card .hero-title { font-size: 1.05rem; }
.speak-home .boss-card .hero-title .ico { color: var(--accent-dark); }
.speak-home .boss-card .hero-sub { color: var(--muted); opacity: 1; }
/* A thin progress bar (decorative; the text beside it carries the number). */
.pbar { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
/* Drill groups fold open; the summary names the group and its progress. */
.drill-groups { display: flex; flex-direction: column; gap: 8px; }
.drill-group { border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--card); }
.drill-group[open] { border-color: var(--accent); }
.group-head { min-height: 52px; display: grid; grid-template-columns: auto 1fr auto; column-gap: 6px; row-gap: 6px; align-items: center; padding: 10px 14px; }
.group-head::before { grid-row: span 2; }
.group-name { font-weight: 600; color: var(--heading); font-size: 1.02rem; }
.group-meta { font-family: var(--font-mono); font-size: 0.75rem; justify-self: end; }
.group-head .pbar { grid-column: 2 / 4; }
.drill-group > .drill-grid { padding: 0 10px 10px; }
/* Course homes: tracks fold open, with progress in the header. */
.track { padding-top: 4px; padding-bottom: 4px; }
.track-head { display: grid; grid-template-columns: auto 1fr; column-gap: 2px; row-gap: 4px; align-items: center; min-height: 52px; padding: 8px 0; }
.track-head::before { grid-row: span 3; }
.track-head > * { grid-column: 2; }
.track > .track-head .card-title { margin: 0; }
.track-meta { font-family: var(--font-mono); font-size: 0.75rem; }
.track[open] > .track-head { margin-bottom: 2px; }
.module-meta .pbar { width: 56px; }
/* Begrippen and Mijn echte week: one compact row under the next step. */
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-row .btn { margin: 0; min-height: 44px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 4px; }

/* Micro-lessons and situation finder */
details.tip { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint); border: 1px solid var(--border-subtle); text-align: left; }
details.tip summary { cursor: pointer; font-weight: 600; color: var(--heading); min-height: 28px; }
details.tip p { margin: 6px 0 0; }
.tip-before { color: var(--muted); }
details.finder summary { cursor: pointer; font-weight: 600; color: var(--heading); list-style: none; min-height: 44px; display: flex; align-items: center; gap: 6px; }
details.finder summary::-webkit-details-marker { display: none; }
.finder-row { padding: 8px 0; }
.finder-row + .finder-row { border-top: 1px solid var(--border-subtle); }
.finder-label { margin: 0 0 6px; font-weight: 600; }
.finder-drills { display: flex; flex-wrap: wrap; gap: 6px; }
.prog-stop { margin-top: 10px; }

/* Subjects and courses */
/* Due questions on a course home: secondary, outlined in petrol. */
.due-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 14px 18px; text-align: left;
  border-radius: var(--radius); border-color: var(--accent); background: var(--card); color: var(--heading); font: inherit; cursor: pointer;
}
.due-card .hero-title { font-size: 1.15rem; }
.due-card .hero-title .ico { color: var(--accent-dark); }
.due-card .hero-sub { color: var(--muted); opacity: 1; }
.subject-bar { display: flex; gap: 6px; padding: 10px 16px 0; max-width: 560px; margin: 0 auto; width: 100%; }
.subject-tab {
  flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--muted);
  border-radius: var(--radius-sm); font: inherit; font-weight: 500; font-size: 0.9rem; cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
/* Selected subject: outlined and tinted, so the screen's one filled button stays the only fill. */
.subject-tab { min-width: 0; padding: 0 8px; }
/* 320 px: three tabs with an icon and a word each overflowed by about 23 px. Tighter bar and tabs, tabs sized by their word; 44 px tall, the label stays 0.85rem. */
@media (max-width: 359px) {
  .subject-bar { gap: 4px; padding-left: 10px; padding-right: 10px; }
  .subject-tab { flex: 1 1 auto; gap: 4px; padding: 0 6px; font-size: 0.85rem; }
}
.subject-tab.on { border-color: var(--accent); background: var(--tint); color: var(--heading); font-weight: 600; }
.subject-tab.on .ico { color: var(--accent-dark); }
.track .card-title { margin-bottom: 6px; }
.module { border-top: 1px solid var(--border-subtle); padding: 8px 0; }
.module:first-of-type { border-top: 0; }
.module-row { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 2px; row-gap: 2px; min-height: 44px; align-content: center; align-items: center; }
.module-row::before { grid-row: span 2; }
.module-row > * { grid-column: 2; }
.module > .module-blurb, .module > .lesson-list, .module > .btn { margin-left: 19px; }
.module-row::-webkit-details-marker { display: none; }
.module-row .module-title, .module-row .module-en-line { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.module-row .module-en-line { font-size: 0.8rem; line-height: 1.25; color: var(--muted, inherit); font-style: italic; }
.module-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--heading); }
/* A title is never cut off: phones get a slightly smaller title (fits one line at 390 px),
   and below 375 px a title or its English line may take a second line, balanced, never a third. */
@media (max-width: 479px) {
  .module-row .module-title { font-size: 0.9375rem; }
}
@media (max-width: 374px) {
  .module-row .module-title, .module-row .module-en-line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; text-wrap: balance; overflow-wrap: anywhere; }
}
.module-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.module-meta .muted.small { font-family: var(--font-mono); font-size: 0.75rem; }
.module-blurb { margin: 6px 0; }
/* v17: the module screen */
.module-link { all: unset; box-sizing: border-box; width: 100%; list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 2px; row-gap: 2px; min-height: 44px; align-content: center; align-items: center; }
.module-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.module-link::before { grid-row: span 2; }
.module-link > * { grid-column: 2; }
.module-screen { display: flex; flex-direction: column; gap: 14px; }
.module-screen .lesson-back { align-self: flex-start; }
.module-head { display: flex; flex-direction: column; gap: 2px; }
.module-screen-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; letter-spacing: var(--tracking-tight); color: var(--heading); overflow-wrap: anywhere; hyphens: auto; }
.module-en-line { margin: 0; font-size: 0.95rem; }
.term-en.module-en-line { color: var(--muted); }
.module-field { margin: 4px 0 0; font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.module-intro-title { margin: 0 0 6px; }
.module-intro-text, .module-blurb-text { margin: 0; line-height: 1.55; }
.module-screen .topics { margin: 0; }
.module-screen .path-end { margin: 0; }
.module-screen .module-continue { width: 100%; margin-top: 4px; }
.lesson-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.lesson-row { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lesson-row .ico { color: var(--muted); }
.lesson-row.passed .ico { color: var(--good); }
/* Topic modules: one row per topic, four level chips. State is an icon plus a
   tint, never colour alone; the suggested chip gets a ring, not a fill. */
.module > .module-continue { margin-left: 19px; }
.topics { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 10px; }
.topic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.topic-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; color: var(--heading); }
.topic-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.lesson .card { margin-bottom: 12px; }
.teach-text { font-size: 1.06rem; line-height: 1.6; margin: 8px 0; }
.teach-text p { margin: 0 0 0.8em; }
.teach-text p:last-child { margin-bottom: 0; }
button.term { all: unset; cursor: pointer; color: inherit; text-decoration: underline dotted var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
button.term[aria-expanded="true"] { color: var(--accent-dark); }
button.term:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
.term-en { color: var(--accent-dark); font-style: italic; }
.teach-text .term-def { margin: -0.4em 0 0.8em; padding: 8px 12px; background: var(--tint); border-radius: 6px; }
/* Quotes and what people say: a hairline box in Fraunces italic, no coloured edge. */
.said { margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--border-subtle); background: var(--tint); border-radius: var(--radius-sm); font-family: var(--font-display); font-style: italic; color: var(--heading); }
.dots { display: flex; gap: 6px; margin: 6px 0; }
.dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.dots i.on { background: var(--accent); }
.quiz-q { font-weight: 600; font-size: 1.05rem; margin: 6px 0 10px; color: var(--heading); }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  min-height: 48px; padding: 10px 14px; text-align: left; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.opt:active { border-color: var(--accent); background: var(--tint); }
@media (hover: hover) { .opt:hover { border-color: var(--accent); background: var(--tint); } }
.quiz-num-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.quiz-num { max-width: 180px; margin: 0; }
.quiz-unit { font-family: var(--font-mono); font-weight: 500; color: var(--muted); }
.quiz-progress { font-family: var(--font-mono); margin: 0 0 4px; }
.review-row { border-top: 1px solid var(--border-subtle); padding: 8px 0; }
.review-row .quiz-q { margin: 0 0 4px; }
.review-row.ok .mark { color: var(--good); }
.review-row.miss .mark { color: var(--bad); }
/* v16: the guess back as the last question: guess → now → right answer */
.quiz-guess { margin: 0 0 6px; }
.guess-steps { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 2px; }
.guess-step.ok .ico { color: var(--good); }
.guess-step.miss .ico { color: var(--bad); }
.example-ask { margin: 10px 0 6px; }
.reveal { border-top: 1px dashed var(--border-subtle); padding-top: 8px; }
.lesson-done { text-align: center; }
.xp-line { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 500; color: var(--accent-dark); margin: 6px 0; }
.load-error .row { display: flex; gap: 8px; flex-wrap: wrap; }
.lesson > .btn { width: 100%; margin-bottom: 8px; }
.lesson > .today-label { margin: 4px 0 -4px; }
.sit-answer { width: 100%; margin: 8px 0; }
.mic-btn { margin-bottom: 4px; }
.rubric-line { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.rubric-line input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.rubric-result { margin: 4px 0; }
.rubric-result.ok .ico { color: var(--good); }
.rubric-result.miss .ico { color: var(--bad); }
.sit-mine { white-space: pre-wrap; }
.pb-answer { width: 100%; margin: 8px 0; }
.ctx-input, .eb-text { width: 100%; margin: 8px 0; }
.scene-new { margin: 4px 0 8px; }
details.explain-back > summary { font-family: var(--font-display); font-weight: 600; color: var(--heading); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.pb-they { margin: 4px 0 8px; font-weight: 600; color: var(--heading); white-space: pre-wrap; }
.glossary input[type=search] { width: 100%; margin-bottom: 12px; }
.term { padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.term:first-of-type { border-top: 0; }
.term b { font-weight: 600; color: var(--heading); }
.term p { margin: 2px 0 0; }
.strip { display: flex; align-items: flex-end; gap: 4px; height: 52px; }
.strip i { flex: 1; background: var(--line); border-radius: 2px; }
.strip i.on { background: var(--accent); }
.explain { margin-top: 10px; }
.explain-ask { display: flex; flex-direction: column; gap: 6px; }
.timing-line { display: flex; align-items: center; justify-content: center; gap: 2px; font-family: var(--font-mono); font-size: 0.8rem; }
.figure-wrap { margin: var(--space-4, 16px) 0 0; }
.figure-frame { display: block; width: 100%; aspect-ratio: 1 / 1.05; border: 1px solid var(--line); border-radius: var(--radius-md, 6px); background: var(--card); }
.figure-wrap figcaption { margin-top: 6px; }
.figure-wrap { position: relative; }
.figure-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 4px); left: 4px; z-index: 2; min-width: 44px; min-height: 44px; padding: 0; background: var(--card); }
.figure-close[hidden] { display: none; }
/* Full screen, asked for by the figure's corner button: the frame fills the screen. */
.figure-wrap.figure-full { position: fixed; inset: 0; z-index: 1000; margin: 0; display: flex; flex-direction: column; background: var(--card); padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.figure-wrap.figure-full .figure-frame { flex: 1; height: auto !important; aspect-ratio: auto; border: 0; border-radius: 0; }
.figure-wrap.figure-full figcaption { display: none; }
html.figure-full-open, html.figure-full-open body { overflow: hidden; }
/* On a phone the figure takes the card's full width and asks for its own height. */
@media (max-width: 479px) {
  .card .figure-wrap:not(.figure-full) { margin-left: -16px; margin-right: -16px; }
  .card .figure-wrap:not(.figure-full) .figure-frame { border-left: 0; border-right: 0; border-radius: 0; }
  .card .figure-wrap:not(.figure-full) figcaption { padding: 0 16px; }
}
.film-wrap { margin: var(--space-3, 12px) 0 0; }
.film-btn { width: 100%; min-height: 44px; }
.film-box { margin-top: var(--space-3, 12px); }
/* The film reports its own height; until then 16:10 plus captions and controls. */
.film-frame { display: block; width: 100%; aspect-ratio: 16 / 17; border: 0; border-radius: var(--radius-md, 6px); background: var(--card); }
/* The Film step (v14b): the video in place of the reading, "Lees mee" under it. */
.film-step .film-stage .film-box { margin-top: 0; }
.film-video-wrap { margin: 0; }
.film-video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-md, 6px); background: #0d252b; }
.film-note { margin: 8px 0 0; }
/* Video captions: Chrome's default is 5% of the video height (about 11 px on a phone);
   the app's caption rule is 16 px. */
.film-video::cue { font-size: 16px; line-height: 1.35; }
/* On a phone a film in a card runs edge to edge (16px screen gutter + 1px card
   border + 16px card padding): at 390 px the 640-unit stage is then 390 px wide,
   so the films' 20-unit stage text renders at 12.2 px instead of 11.1 px. */
@media (max-width: 479px) {
  .card .film-box.figure-wrap, .card .film-video-wrap { margin-left: -33px; margin-right: -33px; }
  .card .film-box .film-frame, .card .film-video-wrap .film-video { border-radius: 0; }
}
.film-keep { margin-top: 6px; }
.read-along { margin: var(--space-3, 12px) 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint); border: 1px solid var(--border-subtle); }
.read-along > summary { font-weight: 600; min-height: 28px; }
.read-scene { margin-top: 10px; }
.read-title { margin: 0 0 4px; font-size: 0.95rem; }
.read-scene p { margin: 0 0 8px; line-height: 1.5; }
.read-scene .term-in { font-weight: 650; color: var(--accent-dark); }

/* Start screen: one compact today card per subject. */
.start-title { margin: 6px 0 0; font-size: 1.6rem; }
.start-meta { margin: -6px 0 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.78rem; }
.start-meta .ico { color: var(--accent-dark); }
.start-cards { display: flex; flex-direction: column; gap: 12px; }
.start-card {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); color: var(--ink); border-color: var(--border-subtle); box-shadow: var(--shadow-card); font: inherit; font-weight: 400;
}
@media (hover: hover) { .start-card:not(.btn-primary):hover:not(:disabled) { border-color: var(--accent); } }
.start-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.start-subject, .start-done {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-label);
  display: inline-flex; align-items: center; gap: 2px; color: var(--muted);
}
.start-done { color: var(--good); }
.start-what { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--heading); letter-spacing: var(--tracking-tight); line-height: 1.25; overflow-wrap: anywhere; }
.start-what .ico { color: var(--accent-dark); }
.start-why { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.start-open { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; font-weight: 600; color: var(--accent-dark); font-size: 0.95rem; }
.start-card.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.start-card.btn-primary .start-subject, .start-card.btn-primary .start-why, .start-card.btn-primary .start-done,
.start-card.btn-primary .start-what, .start-card.btn-primary .start-what .ico, .start-card.btn-primary .start-open { color: var(--on-primary); }
.start-card.btn-primary .start-why { opacity: 0.85; }

/* Lesson step indicator: Guess · Read · Example · Check. */
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 4px; }
.lesson-place { margin: 0 0 6px; font-family: var(--font-mono); font-size: 0.75rem; }
.step {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px 8px; text-align: center;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 3px solid var(--line);
}
.step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-done { color: var(--accent-dark); border-bottom-color: var(--accent); }
.step-jump { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 32px; width: 100%; }
.step-jump:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.guess-review { margin-top: 12px; }

/* Use it this week: the plan on the done card, and the check-back. */
.plan-card { margin-top: 12px; }
.plan-label { display: block; font-weight: 600; color: var(--heading); margin: 0 0 8px; }
.plan-card .text-input { margin: 0; resize: vertical; }
.plan-card .muted { margin: 6px 0 0; }
.apply-opts { margin-bottom: 10px; }
.opt.chosen { border-color: var(--accent); background: var(--tint); font-weight: 600; }
.apply .said { margin-top: 8px; }
/* Before the meeting: link a course topic to a real event. */
details.rw-topic { margin: 4px 0 8px; }
details.rw-topic > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent-dark); font-weight: 600; }
.rw-refresh { margin-top: 6px; }
/* Hint: secondary, once per question; marked again in the review. */
.quiz-hint:not(.on) { display: none; }
.quiz-hint { margin: 0 0 12px; padding: 10px 12px; background: var(--tint); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.quiz-hint p { margin: 0 0 4px; }
.quiz-hint p:last-child { margin-bottom: 0; }
.quiz-hint .hint-title { font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.quiz-hint .hint-step { font-family: var(--font-mono); font-size: 0.95rem; color: var(--heading); overflow-wrap: anywhere; }
.opt.struck, .opt.struck:disabled { text-decoration: line-through; color: var(--muted); opacity: 0.6; cursor: default; border-color: var(--border-subtle); background: var(--card); }
.hint-mark { margin: 0 0 4px; color: var(--accent-dark); font-weight: 600; }
.mono-line { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; }
.step-current { color: var(--heading); font-weight: 700; border-bottom-color: var(--primary); }

/* Settings groups. */
.settings-group { display: flex; flex-direction: column; gap: 8px; }
.settings-slot:empty { display: none; }
.group-title { font-size: 1.1rem; margin: 6px 0 0; }
.toggle-row { border-top: 1px solid var(--border-subtle); margin-top: 12px; padding-top: 8px; }
.toggle-row p { margin: 0; }
.install-btn { margin-bottom: 8px; }

/* First run. */
.welcome-skip { min-width: 44px; }
.welcome-slide .welcome-count { margin: 18px 0 0; font-size: var(--text-xs); }
.welcome-slide .welcome-count + h1 { margin-top: 6px; }
.welcome-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.welcome-list li { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0; } /* plain list: not tappable, so no card look */
.welcome-list b { color: var(--heading); }
.welcome-list .muted { font-size: 0.95rem; }
.welcome-list-icon { color: var(--accent-dark); font-size: 1.25rem; line-height: 1; padding-top: 2px; }
.welcome-slide .welcome-list .muted { color: var(--muted); }
.begin-btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: var(--space-2, 8px) 0 var(--space-1, 4px); }
.begin-main { font-size: 1.15rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.begin-sub { font-size: 0.85rem; opacity: 0.85; }
.start-or { margin: var(--space-3, 12px) 0 var(--space-2, 8px); }
.start-card.suggested { border-color: var(--accent); }
.mastery + .mastery::before, .pill + .mastery::before, .mastery + .muted::before, .pill + .muted::before { content: '· '; color: var(--muted); }

/* Polish round: first-time-user fixes. Hover styles above sit in @media (hover: hover), so a tap leaves no sticky hover. */
.rw-entry { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; margin-top: var(--space-2, 8px); }
.rw-entry-title { display: inline-flex; align-items: center; gap: 4px; }
.rw-entry-title .ico { color: var(--accent-dark); }
.rw-topic-line { margin: 2px 0 0; display: flex; align-items: center; gap: 4px; }
.quiz-actions { display: flex; flex-direction: column; gap: var(--space-2, 8px); margin-top: var(--space-3, 12px); }
.quiz-actions .btn { width: 100%; }
.quiz-picked { margin: 8px 0 0; }
.plan-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.plan-saved { color: var(--good); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; min-height: 1.2em; }
.sticky-cta { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); }

/* Terugluisteren: kept recordings and the listen-back exercise */
.lb-entry { margin-top: 0; }
.lb-intro { margin: 0 0 4px; }
.lb-group .lb-item + .lb-item { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.lb-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lb-body { margin: 4px 0 6px; overflow-wrap: anywhere; }
.lb-actions { align-items: center; }
.lb-delete { flex: none; min-width: 44px; min-height: 44px; }
.lb-player { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lb-audio { width: 100%; }
.lb-speed { align-self: flex-start; }
.lb-speed button { min-width: 64px; min-height: 40px; }
.lb-check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.lb-check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.lb-gap { margin: 10px 0 0; }
.lb-fix-options { margin-top: 8px; }
.lb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.lb-col { min-width: 0; }
.lb-col-head { margin: 0 0 4px; font-size: 0.9rem; }
.lb-col .lb-player .lb-speed button { min-width: 0; padding-inline: 8px; }
.lb-transcript { font-size: 0.9rem; overflow-wrap: anywhere; }
.lb-compare mark, .record-ask mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 2px; }
.mod-from { display: inline-flex; align-items: center; gap: 4px; color: var(--muted, inherit); }
.listen-calib { display: block; }
.rec-row { margin-top: 4px; }

/* ---- v16 flair ----
   Every colour is an existing variable; every duration a motion token. The
   rendered default is the end state, animations only run from the start
   value, so reduced motion (which kills animation above) loses nothing. */
@keyframes vp-light { from { opacity: 0.35; } }
@keyframes vp-draw { from { stroke-dashoffset: var(--draw-from, 100); } }

/* The guide: Andon, a stack light. Housing in hairline heading, tones from the card. */
.guide { display: inline-flex; flex: none; line-height: 0; }
.guide-svg { height: 100%; width: auto; overflow: visible; }
.guide-32 { height: 32px; }
.guide-64 { height: 64px; }
.guide-svg path, .guide-svg ellipse { stroke: var(--heading); stroke-width: 0.35; stroke-linejoin: round; }
.guide-svg .g-halo { fill: var(--line); stroke: none; opacity: 0.6; }
.guide-svg .t-top { fill: var(--card); }
.guide-svg .t-left { fill: color-mix(in srgb, var(--line) 55%, var(--card)); }
.guide-svg .t-right { fill: var(--line); }
.guide-svg .g-screw { fill: var(--heading); }
.guide-svg .g-seg .t-top { fill: color-mix(in srgb, var(--line) 40%, var(--card)); }
.guide-svg .g-seg.on .t-top { fill: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.guide-svg .g-seg.on .t-left { fill: var(--accent); }
.guide-svg .g-seg.on .t-right { fill: color-mix(in srgb, var(--accent) 75%, var(--heading)); }
.guide-svg .g-seg.warn .t-top { fill: color-mix(in srgb, var(--ok) 70%, var(--card)); }
.guide-svg .g-seg.warn .t-left { fill: var(--ok); }
.guide-svg .g-seg.warn .t-right { fill: color-mix(in srgb, var(--ok) 75%, var(--heading)); }
.guide-svg .g-seg.on, .guide-svg .g-seg.warn { animation: vp-light var(--motion-base) var(--ease-entrance) both; }
.guide-svg.s-celebrate .g-mid { animation-delay: var(--motion-stagger); }
.guide-svg.s-celebrate .g-top { animation-delay: calc(2 * var(--motion-stagger)); }
.guide-line { display: flex; gap: 10px; align-items: center; margin: 8px 0 0; }
.guide-line p { margin: 0; }

/* The learning path: levels as stops on a line, per topic. */
.path { display: flex; align-items: flex-start; margin-top: 8px; }
.path-cell { flex: 0 0 auto; width: 62px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.path-line { flex: 1 1 6px; min-width: 6px; height: 2px; margin-top: 21px; background: var(--line); }
.path-line.on { background: var(--accent); }
.path-line-more { height: 0; background: none; border-top: 2px dashed var(--line); }
.path-stop { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--card); }
.path-stop::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); transition: border-color var(--motion-fast) var(--ease-standard); }
.path-stop.s-passed::before, .path-stop.s-owned::before { background: var(--accent); border-color: var(--accent); }
.path-stop.s-next::before { border-color: var(--accent); }
.path-stop .ico { position: relative; width: 16px; height: 16px; }
.path-stop:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
@media (hover: hover) { .path-stop.s-todo:hover::before { border-color: var(--accent); } }
.path-label { font-size: 0.7rem; line-height: 1.15; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.path-stop.s-next + .path-label { color: var(--ink); }
.path-next { font-family: var(--font-mono); font-size: 0.66rem; color: var(--accent-dark); }
/* v17 Task 19: the info button under a level stop (pulled up over the label's spare space; the target stays 44 px), and the opener cards. */
.path-info { width: 44px; height: 44px; margin-top: -8px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); cursor: pointer; border-radius: 50%; }
.path-info .ico { width: 18px; height: 18px; }
.path-info[aria-expanded="true"] { color: var(--accent-dark); }
.path-info:focus-visible, .opener-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
@media (hover: hover) { .path-info:hover { color: var(--accent-dark); } }
.opener-slot:empty { display: none; }
.opener-inline { margin: 6px 0 0; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--card); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.opener-inline .opener-title { margin: 0; font-size: 0.95rem; color: var(--heading); }
.opener-title:focus { outline: none; }
.opener-text { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.opener-inline .opener-close { min-height: 44px; }
.opener-card { display: block; }
.opener-card .opener-title { margin: 0; color: var(--heading); font-size: 1.1rem; }
.opener-card .opener-plain { display: flex; flex-direction: column; gap: 10px; }
.opener-card .guide-say { font-size: 1rem; }
.opener-begin { margin-top: 12px; }
.path-stub { margin-top: 13px; padding-left: 4px; font-size: 0.75rem; color: var(--muted); }
.path-flag { margin-top: 11px; padding-left: 2px; display: inline-flex; align-items: center; color: var(--accent-dark); }
.path-flag .ico-check { width: 0.9em; height: 0.9em; margin-left: -2px; }

/* Medal seal: form tells the tier (ring, double ring, solid disc), the word always beside it. */
.medal { display: inline-flex; align-items: center; gap: 6px; }
.seal-wrap { display: inline-flex; line-height: 0; }
.seal { width: 24px; height: 24px; overflow: visible; }
.medal-56 .seal { width: 56px; height: 56px; }
.seal-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.seal-ring.thin { stroke-width: 1; }
.seal-ring.thick { stroke-width: 2; }
.seal-fill { fill: var(--accent); stroke: var(--accent); stroke-width: 1; }
.seal-check { fill: none; stroke: var(--card); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seal-none { fill: none; stroke: var(--line); stroke-width: 1.5; }
.medal-word { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-dark); }
.medal-none .medal-word { color: var(--muted); text-transform: none; letter-spacing: 0; }
.medal-56 .medal-word { font-size: 0.8rem; }
.seal .draw { stroke-dasharray: 100; --draw-from: 100; animation: vp-draw var(--motion-scene) var(--ease-entrance) both; }
.seal .seal-fill.draw { animation: vp-fade var(--motion-scene) var(--ease-entrance) both; }
.path-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 4px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.title-tag { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; color: var(--accent-dark); }

/* Daily goal ring: 40 px, 3 px stroke, track and petrol arc, butt caps; the number beside it. */
.goal-ring { display: inline-flex; align-items: center; gap: 6px; }
.gring-wrap { display: inline-flex; line-height: 0; }
.gring { width: 40px; height: 40px; }
.goal-ring-sm .gring { width: 24px; height: 24px; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 3; }
.ring-arc { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: butt; }
.goal-ring-sm .ring-track, .goal-ring-sm .ring-arc { stroke-width: 4; }
.ring-arc.grow { animation: vp-draw var(--motion-slow) var(--ease-entrance) both; }
.ring-check { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ring-check.grow { animation: vp-fade var(--motion-base) var(--ease-entrance) var(--motion-slow) both; }
.goal-num { font-size: 0.8rem; color: var(--ink); }
.start-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.start-head-row .start-title { margin: 0; }
.start-goal { display: inline-flex; align-items: center; gap: 10px; }
.start-flame { display: inline-flex; align-items: center; gap: 2px; font-size: 0.8rem; color: var(--muted); }
.start-flame.on { color: var(--ok-text); }
.start-head-wrap .start-meta { margin-top: 4px; }
.flair-note { display: flex; align-items: center; gap: 6px; }
.week-rings { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-ring { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week-day { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); }
.top .title-tag { margin-right: auto; margin-left: 4px; }
.start-subject .title-tag { font-size: 0.7rem; }
.title-card .card-title .title-tag { font-size: 0.8rem; }

/* The celebration: one composed moment inside the done card. */
.celebrate-head { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin-bottom: 4px; }
.celebrate .xp-rise { animation: vp-rise var(--motion-slow) var(--ease-entrance) both; }
.celebrate-big { margin: 10px 0 4px; }
.celebrate-title .celebrate-kicker { margin: 0; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); animation: vp-rise var(--motion-slow) var(--ease-entrance) both; }
.celebrate-title .celebrate-name { margin: 2px 0 0; animation: vp-rise var(--motion-slow) var(--ease-entrance) var(--motion-stagger) both; }
.celebrate-medal { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.celebrate-medal .medal { flex-direction: column; }
.celebrate-medal .medal-word { animation: vp-fade var(--motion-slow) var(--ease-entrance) var(--motion-slow) both; }
.celebrate-medal .celebrate-name, .celebrate-goal { margin: 0; font-weight: 500; color: var(--heading); }
.quiet-line { margin: 2px 0; color: var(--muted); }
.guide-say { margin: 6px 0 0; }
.review-head { display: flex; align-items: center; gap: 10px; }
.review-head .card-title { margin: 0; }
.goal-left { margin: -4px 0 0; }

/* v17: the subject map. One isometric picture per subject; every fill is a class, so both themes work.
   Areas are soft washes of the theme colours, objects use the same three tones as the guide. */
.subject-map-wrap { width: 100%; max-width: 640px; margin: 0 auto; }
.subject-map { display: block; width: 100%; height: auto; -webkit-tap-highlight-color: transparent; }
.subject-map .map-zone-area { fill: color-mix(in srgb, var(--zone, var(--line)) 30%, var(--card)); stroke: color-mix(in srgb, var(--zone, var(--line)) 55%, var(--card)); stroke-width: 1; }
.subject-map .map-zone-label { fill: var(--heading); font: 600 14px/1 var(--font-body, system-ui, sans-serif); letter-spacing: 0.01em; }
.subject-map .z-lifecycle { --zone: var(--accent); }
.subject-map .z-people { --zone: var(--ok); }
.subject-map .z-portfolio { --zone: var(--primary); }
.subject-map .z-it { --zone: var(--secondary-fill); }
.subject-map .map-road { fill: none; stroke: color-mix(in srgb, var(--heading) 30%, var(--card)); stroke-width: 26; stroke-linecap: butt; }
.subject-map .map-road-line { fill: none; stroke: var(--card); stroke-width: 2; stroke-dasharray: 8 7; }
.subject-map .map-place { cursor: pointer; outline: none; }
.subject-map .map-hit { fill: transparent; stroke: none; pointer-events: all; }
.subject-map .map-place:hover .map-hit { fill: color-mix(in srgb, var(--heading) 7%, transparent); }
.subject-map .map-place.is-next .map-hit { stroke: var(--accent); stroke-width: 2.5; fill: color-mix(in srgb, var(--accent) 12%, transparent); }
/* after the next-place rule (same specificity): focus shows on the marked place too */
.subject-map .map-place:focus-visible .map-hit { stroke: var(--heading); stroke-width: 3; }
.subject-map .map-label { fill: var(--heading); font: 500 15px/1 var(--font-body, system-ui, sans-serif); pointer-events: none; }
.subject-map .map-place.is-lit .map-label, .subject-map .map-place.is-next .map-label { stroke: var(--map-halo, none); stroke-width: 6px; stroke-linejoin: round; paint-order: stroke fill; }
.subject-map .map-obj path { stroke: var(--heading); stroke-width: 0.5; stroke-linejoin: round; }
.subject-map .p-top { fill: color-mix(in srgb, var(--zone, var(--line)) 22%, var(--card)); }
.subject-map .p-left { fill: color-mix(in srgb, var(--zone, var(--line)) 40%, var(--card)); }
.subject-map .p-right { fill: color-mix(in srgb, var(--zone, var(--line)) 55%, var(--card)); }
.subject-map .t-top { fill: var(--card); }
.subject-map .t-left { fill: color-mix(in srgb, var(--line) 55%, var(--card)); }
.subject-map .t-right { fill: var(--line); }
.subject-map .m-top { fill: color-mix(in srgb, var(--zone, var(--accent)) 60%, var(--card)); }
.subject-map .m-left { fill: var(--zone, var(--accent)); }
.subject-map .m-right { fill: color-mix(in srgb, var(--zone, var(--accent)) 75%, var(--heading)); }
.subject-map .map-road-arrow { fill: color-mix(in srgb, var(--heading) 30%, var(--card)); }
/* The Engineering zones (Task 13). They start with .subject-map-wrap, not .subject-map, so the film kit does not
   carry them into the Projects films; an Engineering film asks for them with mapStyles(css, 'eng'), which
   rewrites exactly these five rules to start with .subject-map (films/_kit/mapscene.mjs). */
.subject-map-wrap .z-run { --zone: var(--accent); }
.subject-map-wrap .z-better { --zone: var(--zone-better); }
.subject-map-wrap .z-making { --zone: var(--primary); }
.subject-map-wrap .z-energy { --zone: var(--ok); }
.subject-map-wrap .z-digital { --zone: var(--secondary-fill); }
/* v273: the phone layout (map.phone, drawn by subjectMap when the card is under 460 px): a 300-unit sheet, so 10.6 units
   are 11.4 px at 390 and 9.0 px at 320, three places to a row. These rules start with .subject-map-wrap, so the films do not carry them. */
.subject-map-wrap .subject-map-phone { max-width: 400px; margin: 0 auto; }
.subject-map-wrap .subject-map-phone .map-label { font-size: 10.6px; }
.subject-map-wrap .subject-map-phone .map-zone-label { font-size: 10.6px; }
.subject-map-wrap .subject-map-phone .map-road { stroke-width: 11; }
.subject-map-wrap .subject-map-phone .map-road-line { stroke-width: 1.5; stroke-dasharray: 5 5; }

/* v17: the map first on a subject home, and the field films under the next step */
.map-card { padding-bottom: 12px; }
.map-card .map-hint { margin: 0 0 8px; }
.field-films { display: grid; gap: 8px; }
.field-film { display: grid; gap: 4px; }
.field-film-title { font-weight: 600; color: var(--heading); }
/* The map sits inside the card's content box at every width, with the same inset
   as the card's text. (It once bled to the screen edge with margin 0 -33px, which
   ran the zones past the card's edges and, at 320 px, scrolled the page sideways.)
   At 390 px it is 324 px wide: every place is still 58 px or more (checkMap's 44 px). */

/* Andon visible (v17 Task 8): greets on the home screens, presents the module intro.
   Decoration plus one line, never a button; the row keeps its height when the line goes. */
.guide-72 { height: 72px; }
.guide-80 { height: 80px; }
.guide-96 { height: 96px; }
.guide-greeting { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 6px 0 4px; }
.guide-greeting .goal-line { flex: 1 1 100%; margin: -4px 0 0; }
.guide-figure { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.guide-name { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--heading); line-height: 1.2; }
/* The line sits in a speech bubble whose tail points at the tower. */
.guide-greeting .guide-say, .guide-intro .guide-say { position: relative; margin: 0; flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--card); font-size: 1rem; line-height: 1.4; color: var(--heading); overflow-wrap: anywhere; }
.guide-greeting .guide-say::before, .guide-intro .guide-say::before { content: ''; position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; margin-top: -6px; transform: rotate(45deg); background: var(--card); box-shadow: -1px 1px 0 var(--border-subtle); }
@keyframes vp-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
/* On track: the bottom light burns the brand success green (--good), as a
   running andon does; petrol stays for the milestone lights. */
.guide-svg.st-ok .g-seg.g-low.on .t-top { fill: color-mix(in srgb, var(--good) 70%, var(--card)); }
.guide-svg.st-ok .g-seg.g-low.on .t-left { fill: var(--good); }
.guide-svg.st-ok .g-seg.g-low.on .t-right { fill: color-mix(in srgb, var(--good) 75%, var(--heading)); }
.guide-svg .g-seg.blink { animation: vp-blink calc(2 * var(--motion-slow)) ease-in-out 3; }
.guide-intro { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.guide-intro-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.guide-intro .module-intro-title { margin: 0; }
.guide-intro .guide-say { margin-top: 8px; }
.guide-greeting .guide, .guide-intro .guide { pointer-events: none; }
