/* ---------- Fonts (self-hosted: no third-party requests) ---------- */
@font-face {
  font-family: "Young Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/young-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/jost-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/jost-latin-wght-italic.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #F5F8F2;
  --surface: #FFFFFF;
  --band: #E9F1E3;
  --ink: #1D2B24;
  --ink-2: #46564D;
  --line: #CAD8C2;

  /* Grammatical gender is the colour system */
  --der: #2458A6;
  --der-soft: #E3EBF8;
  --die: #F2B705;
  --die-ink: #8A5800;
  --die-display: #A87A00;
  --die-soft: #FDF1C7;
  --das: #277A43;
  --das-soft: #DDEFE2;

  --wrong: #B3261E;

  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Jost", "Segoe UI", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --r-s: 10px;
  --r-m: 18px;
  --r-l: 32px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-y: clamp(72px, 10vw, 128px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}

h1, h2, h3 { text-wrap: balance; }
p:lang(de), li:lang(de), dd:lang(de) { hyphens: auto; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
a { color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible {
  outline: 3px solid var(--der);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-s);
  text-decoration: none;
  transition: transform 160ms var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(76px); }

/* Gender colours used inline in German text */
.g-der { color: var(--der); }
.g-die { color: var(--die-ink); }
.g-das { color: var(--das); }

/* Speech-only controls disappear where speech synthesis is missing */
.no-speech .speak-only { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}
.btn:active { transform: scale(0.97); }

.btn--ink { background: var(--ink); color: #fff; }
.btn--line { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn--light { background: #fff; color: var(--ink); }
.btn--small { min-height: 44px; padding: 8px 18px; font-size: 0.95rem; }

.btn--line[aria-pressed="true"] { background: var(--ink); color: #fff; }

@media (hover: hover) and (pointer: fine) {
  .btn--ink:hover { background: #2E4238; }
  .btn--line:hover { background: var(--band); }
  .btn--line[aria-pressed="true"]:hover { background: #2E4238; }
  .btn--light:hover { background: var(--die-soft); }
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 10px;
  margin-inline: -10px;
  border: 0;
  background: none;
  border-radius: var(--r-s);
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn-text:active { transform: scale(0.97); }
.btn-text--strong { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .btn-text:hover { background: var(--band); }
}

.link-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 4px;
  font-weight: 500;
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .link-quiet:hover { text-decoration: underline; text-underline-offset: 4px; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 248, 242, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  max-width: 1320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand__mark { position: relative; width: 58px; height: 40px; }
.brand__face { position: absolute; width: 38px; height: 38px; top: 1px; }
.brand__face--gus { left: 0; }
.brand__face--dung { left: 22px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-family: var(--font-display); font-size: 1.3rem; }
.brand__sub { font-size: 0.85rem; color: var(--ink-2); }

.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav__links { display: flex; gap: 4px; }
.site-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  border-radius: var(--r-s);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .site-nav__links a:hover { background: var(--band); }
}
.site-nav__tools { display: flex; align-items: center; gap: 12px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang-switch__btn {
  min-width: 44px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out);
}
.lang-switch__btn:active { transform: scale(0.95); }
.lang-switch__btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .lang-switch__btn[aria-pressed="false"]:hover { background: var(--band); }
  .menu-toggle:hover { border-color: var(--ink); }
  .tabs__tab[aria-selected="false"]:hover { background: var(--surface); }
  .link-light:hover { color: var(--die); }
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), border-color 200ms ease;
}
.menu-toggle:active { transform: scale(0.97); }

/* ---------- Language switch crossfade ---------- */
[data-i18n] { transition: opacity 180ms ease, filter 180ms ease; }
.is-switching [data-i18n] { opacity: 0; filter: blur(2px); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 88px) var(--section-y); }

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.hero__copy { align-self: center; }

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 0.6rem + 4.2vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
}
.hero__line { display: block; }
.hero__title .g-die { color: var(--die-display); }

.hero__lead {
  max-width: 34em;
  margin-top: 28px;
  font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem);
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero__stage { position: relative; }

.scene {
  width: 100%;
  height: auto;
  aspect-ratio: 560 / 500;
  overflow: visible;
}

/* ---------- Quiz ---------- */
.quiz {
  position: relative;
  margin: -64px 0 0;
  width: 100%;
  padding: 24px 24px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(29, 43, 36, 0.35);
}

.quiz__title { font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; line-height: 1.2; }
.quiz__hint { margin-top: 4px; font-size: 1rem; color: var(--ink-2); }

.quiz__word {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: 2.25rem;
  line-height: 1.2;
}

.quiz__slot {
  display: inline-block;
  min-width: 2.6em;
  border-bottom: 3px solid var(--line);
  color: transparent;
  text-align: center;
  transition: color 200ms ease, border-color 200ms ease;
}
.quiz__slot.is-der { color: var(--der); border-color: var(--der); }
.quiz__slot.is-die { color: var(--die-ink); border-color: var(--die); }
.quiz__slot.is-das { color: var(--das); border-color: var(--das); }

.quiz__noun { display: inline-block; }

.quiz__choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 64px;
  padding: 8px 6px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}
.choice:active { transform: scale(0.97); }
.choice[aria-disabled="true"] { cursor: default; }
.choice[aria-disabled="true"]:active { transform: none; }

.choice__art { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2; }
.choice__friend { font-size: 0.85rem; color: var(--ink-2); }

.choice--der .choice__art { color: var(--der); }
.choice--die .choice__art { color: var(--die-ink); }
.choice--das .choice__art { color: var(--das); }

@media (hover: hover) and (pointer: fine) {
  .choice--der:not([aria-disabled="true"]):hover { border-color: var(--der); background: var(--der-soft); }
  .choice--die:not([aria-disabled="true"]):hover { border-color: var(--die); background: var(--die-soft); }
  .choice--das:not([aria-disabled="true"]):hover { border-color: var(--das); background: var(--das-soft); }
}

.choice.is-answer.choice--der { border-color: var(--der); background: var(--der-soft); }
.choice.is-answer.choice--die { border-color: var(--die); background: var(--die-soft); }
.choice.is-answer.choice--das { border-color: var(--das); background: var(--das-soft); }
.choice.is-wrong { border-color: var(--wrong); border-style: dashed; }
.choice.is-muted { opacity: 0.45; }

.quiz__feedback {
  min-height: 3.2em;
  margin-top: 14px;
  font-size: 1rem;
  line-height: 1.5;
}
.quiz__feedback b { font-weight: 600; }

.quiz__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.quiz__streak { font-size: 0.95rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
#quiz-next { margin-left: auto; margin-right: -10px; }

/* ---------- Page-load sequence (hero only, runs once) ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes actor-in {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: none; }
}
@keyframes bloom {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}
@keyframes peek {
  from { transform: translateY(70px); }
  to { transform: none; }
}
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}

.hero__line,
.hero__lead,
.hero__actions,
.quiz { animation: rise 700ms var(--ease-out) both; }
.hero__line:nth-child(1) { animation-delay: 80ms; }
.hero__line:nth-child(2) { animation-delay: 170ms; }
.hero__line:nth-child(3) { animation-delay: 260ms; }
.hero__lead { animation-delay: 380ms; }
.hero__actions { animation-delay: 460ms; }
.quiz { animation-delay: 1000ms; }

.actor { transform-box: fill-box; }
.actor--gus { animation: actor-in 800ms var(--ease-out) 200ms both; transform-origin: 50% 100%; }
.actor--dung { animation: actor-in 800ms var(--ease-out) 320ms both; transform-origin: 50% 100%; }
.actor--eddi { animation: peek 700ms var(--ease-out) 1100ms both; }

.petal {
  transform-box: fill-box;
  transform-origin: 50% 143%;
  animation: bloom 520ms var(--ease-spring) both;
}
.petals g:nth-child(1) .petal { animation-delay: 560ms; }
.petals g:nth-child(2) .petal { animation-delay: 590ms; }
.petals g:nth-child(3) .petal { animation-delay: 620ms; }
.petals g:nth-child(4) .petal { animation-delay: 650ms; }
.petals g:nth-child(5) .petal { animation-delay: 680ms; }
.petals g:nth-child(6) .petal { animation-delay: 710ms; }
.petals g:nth-child(7) .petal { animation-delay: 740ms; }
.petals g:nth-child(8) .petal { animation-delay: 770ms; }
.petals g:nth-child(9) .petal { animation-delay: 800ms; }
.petals g:nth-child(10) .petal { animation-delay: 830ms; }
.petals g:nth-child(11) .petal { animation-delay: 860ms; }
.petals g:nth-child(12) .petal { animation-delay: 890ms; }
.petals g:nth-child(13) .petal { animation-delay: 920ms; }
.petals g:nth-child(14) .petal { animation-delay: 950ms; }
.petals g:nth-child(15) .petal { animation-delay: 980ms; }
.petals g:nth-child(16) .petal { animation-delay: 1010ms; }

.blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 280ms ease-in-out 2.6s 1 both;
}
.blink--late { animation-delay: 3.9s; }

.gus-arm { transform-box: fill-box; transform-origin: 15% 88%; }
.dung-head { transform-box: fill-box; transform-origin: 50% 92%; }

/* ---------- Section scaffolding ---------- */
.section-head { max-width: 60rem; margin-bottom: clamp(36px, 5vw, 56px); }

.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1.4rem + 2.2vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.section-lead {
  margin-top: 16px;
  max-width: 38em;
  color: var(--ink-2);
  text-wrap: pretty;
}

.level-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6em;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* ---------- Levels path ---------- */
.levels {
  padding-block: var(--section-y);
  background: var(--band);
}

.path {
  --dot: 56px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  counter-reset: none;
}

/* The trail between badges draws once when it scrolls into view */
.path::before {
  content: "";
  position: absolute;
  top: calc(var(--dot) / 2 - 2px);
  left: calc(var(--dot) / 2);
  right: calc(25% - var(--dot) / 2);
  height: 4px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 14px, transparent 14px 24px);
  transform-origin: left center;
  transition: transform 1400ms var(--ease-in-out);
}
.js .path:not(.is-visible)::before { transform: scaleX(0); }

.stop { position: relative; }

.stop__badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--ink);
  font-weight: 600;
  font-size: 1.15rem;
  transition: transform 500ms var(--ease-spring), opacity 300ms ease, background-color 300ms ease, color 300ms ease;
}
.js .path:not(.is-visible) .stop__badge { transform: scale(0.85); opacity: 0; }
.path.is-visible .stop:nth-child(2) .stop__badge { transition-delay: 350ms; }
.path.is-visible .stop:nth-child(3) .stop__badge { transition-delay: 700ms; }
.path.is-visible .stop:nth-child(4) .stop__badge { transition-delay: 1050ms; }
.stop:last-child .stop__badge { background: var(--ink); color: #fff; }

.stop__name {
  margin-top: 20px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
}
.stop__can { margin-top: 8px; text-wrap: pretty; }

.stop__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1.5px solid var(--line);
  font-size: 0.95rem;
}
.stop__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  font-weight: 600;
  text-underline-offset: 4px;
}
.stop__meta dt { color: var(--ink-2); }
.stop__meta dd { font-weight: 500; }

/* ---------- Grammar ---------- */
.grammar { padding-block: var(--section-y); }

.tabs {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
}
.tabs__list {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--band);
}
.tabs__list--active {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  clip-path: inset(0 75% 0 0 round 999px);
  transition: clip-path 260ms var(--ease-out);
}
.tabs__list--active .tabs__tab { background: var(--ink); color: #fff; }

.tabs__tab {
  display: inline-grid;
  place-items: center;
  min-width: 72px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 200ms ease;
}

.grammar__panel { border-radius: var(--r-m); }
.grammar__panel:focus-visible { outline-offset: 6px; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.topics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
}
.topics__col { padding: 24px; }
.topics__col + .topics__col { border-left: 1.5px solid var(--line); }
.topics__head {
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
}
.topics ul { display: grid; gap: 8px; font-size: 1rem; line-height: 1.45; }
.topics li { padding-left: 16px; position: relative; }
.topics li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}
.topics i { font-style: italic; }

/* ---------- Vocabulary ---------- */
.vocab {
  padding-block: var(--section-y);
  background: var(--surface);
  border-block: 1.5px solid var(--line);
}

.genders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.gender {
  --tone: var(--ink);
  --tint: var(--band);
  --accent: var(--ink);
  padding: 28px 24px 24px;
  border-radius: var(--r-l);
  background: var(--tint);
}
.gender--der { --tone: var(--der); --tint: var(--der-soft); --accent: var(--der); }
.gender--die { --tone: var(--die-ink); --tint: var(--die-soft); --accent: var(--die); }
.gender--das { --tone: var(--das); --tint: var(--das-soft); --accent: var(--das); }

.gender__face { width: 72px; height: 72px; }
.gender__name {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.2;
}
.gender__rule { margin-top: 4px; font-size: 1rem; color: var(--ink-2); }

.words { display: grid; gap: 8px; margin-top: 20px; }
.word {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1.5px solid transparent;
  border-radius: var(--r-s);
  background: var(--surface);
  text-align: left;
  font-size: 1.05rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), border-color 200ms ease;
}
.word:active { transform: scale(0.98); }
.word > span { min-width: 0; }
.word b { color: var(--tone); font-weight: 600; }
.word__en { font-size: 0.9rem; color: var(--ink-2); text-align: right; }
.word.is-speaking { border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .word:hover { border-color: var(--accent); }
}

.vocab__notes {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px 40px;
  margin-top: 36px;
  max-width: 64rem;
  color: var(--ink-2);
}
.vocab__notes p:first-child { color: var(--ink); font-weight: 500; }
.vocab__notes p:nth-child(3) { grid-column: 1 / -1; font-size: 0.95rem; }

/* ---------- Stories ---------- */
.stories { padding-block: var(--section-y); }

.stories__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.scene-card {
  padding: clamp(20px, 3vw, 32px);
  background: var(--band);
  border-radius: var(--r-l);
}
.scene-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.scene-card__episode { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; color: var(--ink-2); }
.scene-card__title { margin-top: 6px; font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
.scene-card__tools { display: flex; flex-wrap: wrap; gap: 8px; }

.dialogue { display: grid; gap: 14px; }

.line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: start;
  gap: 12px;
}
.line--dung { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.line__face { width: 44px; height: 44px; margin-top: 4px; }

.line__bubble {
  padding: 12px 16px;
  background: var(--surface);
  border: 1.5px solid transparent;
  border-radius: 4px var(--r-m) var(--r-m) var(--r-m);
  transition: border-color 200ms ease;
}
.line--gus .line__bubble { box-shadow: inset 4px 0 0 var(--der); }
.line--dung .line__bubble { box-shadow: inset 4px 0 0 var(--die); }
.line--eddi .line__bubble, .line--fritz .line__bubble { box-shadow: inset 4px 0 0 var(--das); }
.line--man .line__bubble, .line--woman .line__bubble, .line--plain .line__bubble { box-shadow: inset 4px 0 0 var(--ink-2); }
.line.is-speaking .line__bubble { border-color: var(--ink); }

.line__who { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.line__de { font-size: 1.1rem; }
.line__de .g-der, .line__de .g-die, .line__de .g-das { font-weight: 600; }
.line__en { margin-top: 4px; font-size: 0.95rem; color: var(--ink-2); }
.line__en:not([hidden]) { animation: panel-in 200ms var(--ease-out); }

.line__play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: 6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.line__play:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .line__play:hover { background: var(--surface); }
}

.episodes__title { font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.episodes__list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding-block: 16px;
  border-bottom: 1.5px solid var(--line);
}
.episodes__list li:first-child { border-top: 1.5px solid var(--line); }
.episodes__list .level-tag { margin-top: 3px; }
.episodes__name { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.3; }
.episodes__name a { text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
@media (hover: hover) and (pointer: fine) {
  .episodes__name a:hover { color: var(--der); }
}
.scene-card__more { margin-top: 20px; }
.episodes__text { margin-top: 2px; font-size: 0.98rem; color: var(--ink-2); }

/* ---------- Practice ---------- */
.practice {
  padding-block: var(--section-y);
  background: var(--band);
}
.practice__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.features { display: grid; gap: 22px; margin-top: 32px; }
.features dt { font-weight: 600; font-size: 1.1rem; }
.features dd { margin-top: 2px; color: var(--ink-2); max-width: 32em; }

.progress-demo {
  padding: 24px;
  background: var(--surface);
  border-radius: var(--r-l);
  border: 1.5px solid var(--line);
}
.progress-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.progress-table caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 12px;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.progress-table thead th {
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
}
.progress-table tbody th { padding: 14px 12px 14px 0; text-align: left; font-weight: 500; }
.progress-table td { padding: 14px 0; width: 48%; }
.progress-table tbody tr + tr > * { border-top: 1px solid var(--line); }

.bar {
  display: inline-block;
  vertical-align: middle;
  width: calc(100% - 4.5em);
  height: 8px;
  border-radius: 4px;
  background: var(--band);
  overflow: hidden;
}
.bar__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: var(--das);
  transform: scaleX(var(--v, 0));
  transform-origin: left center;
}
.score {
  display: inline-block;
  width: 4.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- Closing ---------- */
.closing {
  padding-block: var(--section-y);
  background: var(--ink);
  color: #fff;
  text-align: center;
}
.closing__inner { display: flex; flex-direction: column; align-items: center; }
.closing__faces { display: flex; gap: 4px; margin-bottom: 28px; }
.closing__faces svg { width: 64px; height: 64px; }
.closing__title {
  max-width: 18em;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem);
  line-height: 1.1;
  text-wrap: balance;
}
.closing__text { margin-top: 16px; max-width: 32em; color: #C9D6CE; }
.closing__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 32px;
}
.link-light {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  font-weight: 500;
  text-underline-offset: 4px;
  transition: color 200ms ease;
}
.closing :focus-visible { outline-color: var(--die); }

/* ---------- Footer ---------- */
.site-footer { padding-block: 28px; font-size: 0.95rem; color: var(--ink-2); }
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .site-footer__links a:hover { text-decoration: underline; text-underline-offset: 4px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .site-nav { gap: 16px; }
  .site-nav__links a { padding-inline: 8px; }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topics__col + .topics__col { border-left: 0; }
  .topics__col:nth-child(even) { border-left: 1.5px solid var(--line); }
  .topics__col:nth-child(n + 3) { border-top: 1.5px solid var(--line); }
}

@media (max-width: 1279px) {
  .menu-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 32px -24px rgba(29, 43, 36, 0.3);
    transform-origin: top center;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms;
  }
  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s;
  }
  .site-nav__links { flex-direction: column; gap: 0; }
  .site-nav__links a { width: 100%; min-height: 48px; font-size: 1.1rem; }
  .site-nav__tools { flex-wrap: wrap; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line); }
  .site-nav__tools .btn { flex: 1 1 100%; }

}

@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__stage { max-width: 560px; margin-inline: auto; width: 100%; }
  .quiz { margin: -48px auto 0; }

  .path { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
  .path::before { display: none; }

  .genders { grid-template-columns: 1fr; max-width: 560px; }
  .vocab__notes { grid-template-columns: 1fr; }

  .stories__layout { grid-template-columns: 1fr; }
  .practice__inner { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .brand__sub { display: none; }
  .brand__mark { width: 50px; height: 34px; }
  .brand__face { width: 32px; height: 32px; }
  .brand__face--dung { left: 18px; }
  .menu-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .menu-toggle { padding: 8px 12px; }

  .hero__actions .btn { flex: 1 1 100%; }
  .quiz { padding: 20px 18px 12px; margin-top: -32px; }
  .quiz__word { font-size: 1.9rem; }

  .path { grid-template-columns: 1fr; row-gap: 36px; }
  .stop { display: grid; grid-template-columns: var(--dot) 1fr; column-gap: 18px; }
  .stop > * { grid-column: 2; }
  .stop__badge { grid-column: 1; grid-row: 1 / span 4; }
  .stop__name { margin-top: 8px; }

  .topics { grid-template-columns: 1fr; }
  .topics__col:nth-child(even) { border-left: 0; }
  .topics__col + .topics__col { border-top: 1.5px solid var(--line); }
  .tabs { display: block; }
  .tabs__list { justify-content: space-between; }
  .tabs__tab { min-width: 0; flex: 1; }

  .scene-card { padding: 20px 14px; }
  .line { grid-template-columns: 44px minmax(0, 1fr); column-gap: 10px; row-gap: 0; }
  .line__face { width: 40px; height: 40px; justify-self: center; }
  .line__bubble { grid-column: 2; grid-row: 1 / span 2; }
  .line__play { grid-column: 1; grid-row: 2; margin-top: 2px; }
  .scene-card__tools { width: 100%; }
  .scene-card__tools .btn { flex: 1 1 100%; }

  .progress-demo { padding: 18px; }
  .progress-table td { width: 44%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__line, .hero__lead, .hero__actions, .quiz,
  .actor--gus, .actor--dung, .actor--eddi, .petal {
    animation: fade-only 200ms ease both !important;
    animation-delay: 0ms !important;
  }
  .blink { animation: none; }
  .path::before { transition: none; transform: scaleX(1); }
  .stop__badge, .js .path:not(.is-visible) .stop__badge { transition: opacity 200ms ease; transition-delay: 0ms !important; transform: none; }
  .line__en:not([hidden]) { animation: fade-only 150ms ease; }
  .is-switching [data-i18n] { filter: none; }
  .btn:active, .btn-text:active, .choice:active, .word:active, .line__play:active,
  .lang-switch__btn:active, .menu-toggle:active { transform: none; }
  .site-nav, .site-nav.is-open { transform: none; }
}
@keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }

.grammar__more { margin-top: 28px; }
