@font-face {
  font-family: Manrope;
  src: url("./manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: Manrope;
  src: url("./manrope-latin-ext.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: Manrope;
  src: url("./manrope-cyrillic.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --turn { syntax: "<number>"; inherits: true; initial-value: 0; }

/* Tokens. Palette from DESIGN.md plus the mascot's car coral and road tones. */
:root {
  color-scheme: light;
  --paper: #f8f5eb;
  --white: #fffdf7;
  --ink: #192d35;
  --ink-2: #2b474f;
  --muted: #4d605e;
  --line: #d9d9c9;
  --line-2: #c6c8b4;
  --gold: #f8d774;
  --gold-deep: #d9a92f;
  --gold-soft: #fbebae;
  --mint: #d7e7ce;
  --mint-2: #bcd9ad;
  --green: #32654f;
  --green-deep: #234a39;
  --peach: #f8ddce;
  --coral: #963d2b;
  --coral-deep: #6f2a1c;
  --car: #ee6a4c;
  --asphalt: #33464e;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --lift: 0 4px 0 var(--line);
  --gutter: clamp(16px, 4.2vw, 44px);
  --header-h: 60px;
  --tab-h: 66px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.22, 1, .36, 1);
  font: 16px/1.55 Manrope, "Nirmala UI", system-ui, sans-serif;
  scrollbar-color: #9aa79b var(--paper);
  accent-color: var(--green);
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html.locked { overflow: hidden; }
::selection { background: var(--gold); color: var(--ink); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
body { margin: 0; overflow-x: clip; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding-block: 24px 56px; }
main:focus { outline: none; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.1; letter-spacing: -.03em; font-weight: 800; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3.3rem); }
h2 { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.8rem); }
p { color: var(--muted); }
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; }
dl, dd { margin: 0; }
.sr-only { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; position: absolute; white-space: nowrap; }
.shell { width: min(100% - 2 * var(--gutter), 1240px); margin-inline: auto; }
.narrow { max-width: 640px; }
.workspace { max-width: 1120px; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.chip { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 99px; background: var(--ink); color: var(--gold); font-size: .78rem; font-weight: 800; letter-spacing: .02em; vertical-align: middle; }
.count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding-inline: 8px; border-radius: 99px; background: var(--ink); color: var(--white); font-size: .85rem; font-weight: 800; letter-spacing: 0; }

/* Buttons are chunky and press down, like keys. */
.button { --edge: var(--line-2); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; width: fit-content; padding: 10px 18px; border: 2px solid transparent; border-radius: var(--r-md); text-decoration: none; font-weight: 800; line-height: 1.2; text-align: center; box-shadow: 0 4px 0 var(--edge); transition: transform 120ms var(--out), box-shadow 120ms var(--out), background-color 150ms ease, border-color 150ms ease; }
.button.big { min-height: 54px; padding-inline: 22px; font-size: 1.04rem; }
.button:not(:disabled):active { transform: translateY(4px); box-shadow: 0 0 0 var(--edge); }
.button:disabled { opacity: .5; box-shadow: none; transform: translateY(4px); }
.button .icon { transition: transform 200ms var(--spring); }
.primary { --edge: var(--gold-deep); background: var(--gold); border-color: var(--gold-deep); color: var(--ink); }
.dark { --edge: #0a171c; background: var(--ink); color: var(--white); border-color: var(--ink); }
.secondary, .header-link { background: var(--white); border-color: var(--line-2); }
.ghost { --edge: transparent; background: transparent; border-color: var(--ink); box-shadow: none; }
.success { --edge: var(--green-deep); background: var(--green); border-color: var(--green-deep); color: var(--white); }
.danger { --edge: var(--coral-deep); background: var(--coral); border-color: var(--coral-deep); color: var(--white); }
.text { --edge: transparent; background: transparent; color: var(--green); box-shadow: none; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); text-decoration: none; transition: border-color 150ms, transform 150ms var(--spring); }
.icon-button:active { transform: scale(.92); }
.round-go { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--ink); color: var(--gold); transition: transform 250ms var(--spring); }
@media (hover: hover) {
  .primary:hover:not(:disabled) { background: #f6cd55; }
  .dark:hover { background: var(--ink-2); }
  .secondary:hover:not(:disabled), .header-link:hover { border-color: var(--green); }
  .ghost:hover { background: var(--white); }
  .text:hover { background: var(--white); }
  .button:hover:not(:disabled) .icon:last-child { transform: translateX(3px); }
  .icon-button:hover { border-color: var(--green); }
}
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.install-button { min-height: 44px; padding: 8px 12px; gap: 7px; font-size: .9rem; }
.install-button .icon { width: 19px; height: 19px; flex: none; }

/* Header: sticky, compact on phones; sections live in the tab bar there. */
header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 2px solid var(--line); }
.header-inner { display: flex; height: var(--header-h); align-items: center; gap: 12px; }
.wordmark { display: inline-flex; align-items: center; min-width: 0; gap: 10px; line-height: 1.1; font-size: 1.05rem; font-weight: 800; text-decoration: none; margin-right: auto; }
.wordmark-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; color: var(--gold); background: var(--ink); border-radius: 11px; transition: transform 300ms var(--spring); }
.wordmark:hover .wordmark-icon { transform: rotate(-8deg) scale(1.06); }
.wordmark-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: none; }
.header-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.language { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border: 2px solid var(--line); border-radius: 99px; background: var(--white); font-weight: 800; font-size: .9rem; }
.language:focus-within { outline: 3px solid var(--green); outline-offset: 2px; }
.language select { position: absolute; inset: 0; width: 100%; opacity: 0; border: 0; }
.language-name { display: none; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--car); color: var(--white); font-weight: 800; text-decoration: none; box-shadow: 0 3px 0 #c9523a; transition: transform 200ms var(--spring); }
.avatar[aria-current] { outline: 3px solid var(--ink); outline-offset: 2px; }
.avatar:active { transform: scale(.92); }
.avatar.big { width: 72px; height: 72px; font-size: 2rem; box-shadow: 0 5px 0 #c9523a; }
.header-link { min-height: 40px; padding: 6px 14px; font-size: .9rem; box-shadow: 0 3px 0 var(--line-2); }

/* Bottom tab bar on phones. */
#tabbar { display: none; }
body[data-tabs="true"] #tabbar { display: block; position: fixed; inset: auto 0 0; z-index: 45; background: var(--white); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tab-h); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .72rem; font-weight: 800; text-decoration: none; line-height: 1.1; text-align: center; padding-inline: 4px; }
.tab .icon { width: 24px; height: 24px; transition: transform 250ms var(--spring); }
.tab[aria-current] { color: var(--ink); }
.tab[aria-current] .icon { transform: translateY(-2px) scale(1.12); }
.tab[aria-current]::before { content: ""; position: absolute; top: 6px; width: 46px; height: 32px; border-radius: 12px; background: var(--gold-soft); z-index: -1; animation: pop-in 300ms var(--spring); }
body[data-tabs="true"] main { padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); }
body[data-tabs="true"] footer { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }

footer { border-top: 2px solid var(--line); }
.footer-inner { display: flex; flex-direction: column; gap: 4px; padding-block: 16px; font-size: .84rem; color: var(--muted); }

/* Page entrance: one short orchestrated rise per screen. */
.page.enter > *, .enter-q .quiz-bar, .enter-q .question, .enter-q .coach, .enter-q .exam-side { animation: rise 520ms var(--out) both; animation-delay: calc(var(--n, 0) * 70ms); }
.page.enter > :nth-child(2) { --n: 1; } .page.enter > :nth-child(3) { --n: 2; } .page.enter > :nth-child(4) { --n: 3; } .page.enter > :nth-child(5) { --n: 4; }
.enter-q .question { animation-name: slide-in; --n: 1; }
.enter-q .coach, .enter-q .exam-side { --n: 2; }

.back { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; font-weight: 800; text-decoration: none; color: var(--green); margin-bottom: 6px; }
.back .icon { transition: transform 200ms var(--spring); }
.back:hover .icon { transform: translateX(-4px); }
.intro { margin-top: 10px; max-width: 62ch; font-size: 1.04rem; }

/* Landing */
.landing { display: grid; gap: clamp(36px, 6vw, 72px); padding-top: 4px; }
.hero { display: grid; gap: 22px; align-items: center; }
.place { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 5px 6px 5px 6px; border-radius: 99px; background: var(--white); border: 2px solid var(--line); color: var(--ink); font-size: .9rem; font-weight: 800; margin-bottom: 16px; }
.place .flag { width: 26px; height: 18px; border-radius: 5px; }
.hero h1 { font-size: clamp(2.7rem, 1.4rem + 6vw, 5.8rem); line-height: .98; letter-spacing: -.045em; text-wrap: balance; }
.hero-intro { font-size: clamp(1.02rem, .95rem + .4vw, 1.25rem); max-width: 38ch; margin-block: 18px 26px; }
.hero-stage { position: relative; aspect-ratio: 640 / 520; border-radius: var(--r-xl); overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink); isolation: isolate; }
.hero-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-car { position: absolute; left: 36.5%; bottom: 7.5%; width: 30%; }
.learner-car { display: block; width: 100%; height: auto; }
.learner-car .car-beam { animation: beam 3s ease-in-out infinite; }
.hero-otter { position: absolute; right: 4%; bottom: 1%; width: 26%; }
.hero-stage .hero-balloon { position: absolute; right: 24%; top: 13%; max-width: 44%; padding: 8px 14px; border-radius: 20px; font-size: clamp(.78rem, .55rem + .9vw, 1.1rem); box-shadow: 4px 4px 0 var(--ink); transform-origin: 85% 100%; animation: comic-pop 600ms var(--spring) 1.3s both; }
.hero-stage .hero-balloon::after { left: auto; right: 24px; bottom: -12px; }
.hs-rays { animation: spin 40s linear infinite; }
.hs-clouds { animation: drift 60s linear infinite; }
.hs-sheep .hs-head { animation: graze 5s ease-in-out infinite; transform-box: fill-box; transform-origin: 0 50%; }
.hs-sheep-b .hs-head { animation-delay: -2.4s; }
.hs-smoke circle { animation: smoke 3.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.hs-smoke circle:nth-child(2) { animation-delay: 1.2s; } .hs-smoke circle:nth-child(3) { animation-delay: 2.4s; }
.hs-birds { animation: birds 9s ease-in-out infinite; }

.features { display: grid; gap: 14px; }
.feature { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto 1fr; column-gap: 16px; align-items: start; padding: 18px; border-radius: var(--r-lg); border: 2px solid var(--line); box-shadow: var(--lift); }
.feature-art { grid-row: span 2; }
.feature h2 { font-size: 1.2rem; margin-top: 4px; }
.feature p { font-size: .93rem; margin-top: 4px; color: var(--ink-2); }
.mint { background: var(--mint); }
.gold { background: var(--gold-soft); }
.peach { background: var(--peach); }
.paper { background: var(--white); }
.mode-art { width: 100%; height: auto; display: block; }
.art-check { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.2s ease-in-out infinite; }
.art-row-pick { animation: pick 3.2s ease-in-out infinite; }
.art-hand { transform-origin: 60px 50px; animation: spin 6s steps(60) infinite; }
.art-orbit { transform-origin: 60px 45px; animation: spin 9s linear infinite; }
.landing .mode-art, .mode-grid .mode-art { overflow: visible; }
.art-q { animation: float 3.6s ease-in-out infinite; }
.art-tick { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.4s ease-in-out infinite; }
.art-mark { transform-box: fill-box; transform-origin: 0 50%; animation: mark 3.4s ease-in-out infinite; }
.art-a { transform-box: fill-box; transform-origin: 30% 100%; animation: faq-pop 3.6s var(--spring) infinite; }


.languages h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-bottom: 14px; }
.language-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.language-chip { min-height: 44px; padding: 8px 16px; border-radius: 99px; border: 2px solid var(--line); background: var(--white); font-weight: 700; box-shadow: 0 3px 0 var(--line); transition: transform 150ms var(--out), box-shadow 150ms, border-color 150ms, background-color 150ms; }
.language-chip:active { transform: translateY(3px); box-shadow: none; }
.language-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--gold); box-shadow: 0 3px 0 #0a171c; }
@media (hover: hover) { .language-chip:hover { border-color: var(--green); } }

/* Country choice with vector flags. */
.country-grid { margin-top: 26px; display: grid; gap: 14px; }
.country-card { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 16px; width: 100%; padding: 16px; border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--white); text-align: left; box-shadow: var(--lift); transition: transform 200ms var(--out), border-color 150ms, box-shadow 200ms; }
.country-card.selected { border-color: var(--green); box-shadow: 0 4px 0 var(--green); }
.country-card:active { transform: translateY(4px); box-shadow: none; }
.flag-frame { position: relative; display: block; width: 84px; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; border: 2px solid var(--ink); flex: none; box-shadow: 0 3px 0 var(--ink); }
.flag-frame.big { width: 64px; }
.flag-frame .flag { width: 100%; height: 100%; display: block; }
.flag-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 45%, transparent 60%); translate: -120% 0; }
.country-card:hover .flag-frame::after, .page-head .flag-frame::after { animation: sheen 1.4s var(--out); }
.country-card:hover .flag-frame { animation: wave 1s ease-in-out; }
.country-text strong { display: block; font-size: 1.3rem; line-height: 1.2; }
.country-text .chip { margin-top: 6px; }
.country-card .round-go { transition: transform 250ms var(--spring); }
@media (hover: hover) { .country-card:hover { border-color: var(--green); } .country-card:hover .round-go { transform: translateX(4px); } }
.country-otter { display: block; width: 58px; }
.country-card:hover .country-otter { animation: wiggle 600ms ease; }
.inline-flag .flag { width: 24px; height: 16px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 8px; border: 1px solid var(--line-2); }

/* Sign-in */
.auth-wrap { max-width: 980px; }
.auth-card { display: grid; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--lift); overflow: hidden; }
.auth-cast { display: flex; align-items: flex-end; justify-content: center; padding: 18px 20px 4px; background: var(--gold-soft); border-bottom: 2px solid var(--line); }
.auth-cast .otter { width: 104px; }
.auth-body { padding: clamp(20px, 5vw, 44px); }
:is(#auth-form, #password-form) { display: grid; gap: 16px; margin-top: 22px; }
:is(#auth-form, #password-form) label { font-weight: 800; }
:is(#auth-form, #password-form) input { display: block; min-height: 52px; width: 100%; margin-top: 6px; background: var(--paper); border: 2px solid var(--line-2); border-radius: var(--r-md); padding: 10px 14px; font-size: 1rem; transition: border-color 150ms, background-color 150ms, box-shadow 150ms; }
:is(#auth-form, #password-form) input:focus { outline: none; border-color: var(--green); background: var(--white); box-shadow: 0 0 0 4px var(--mint); }
:is(#auth-form, #password-form) .button { width: 100%; margin-top: 4px; }
.auth-actions { display: grid; grid-auto-rows: 1fr; gap: inherit; }
.auth-actions .button { padding-inline: clamp(12px, 4vw, 22px); }
#auth-form .google-signin { background: #fff; }
#auth-form .google-signin img { height: auto; flex: none; }
.form-help, .auth-swap { font-size: .9rem; }
.auth-swap { margin-top: 18px; }
.auth-swap a { color: var(--green); font-weight: 800; }

/* Dashboard */
.page-head { display: flex; align-items: center; gap: 16px; }
.page-head .intro { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dash-grid { display: grid; gap: 16px; margin-top: 24px; }
.dash-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; border-radius: var(--r-xl); padding: clamp(20px, 3.5vw, 32px); border: 2px solid color-mix(in srgb, var(--ink) 12%, transparent); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 14%, transparent); overflow: hidden; text-decoration: none; color: inherit; }
.dash-card h2 { margin-bottom: 6px; }
.dash-card p { color: var(--ink-2); max-width: 46ch; }
.dash-card .actions { margin-top: auto; }
.dash-cast { position: absolute; right: 2%; bottom: -46px; width: clamp(96px, 20vw, 150px); }
.learn-card .dash-copy, .learn-card .actions, .learn-card .dash-progress { position: relative; z-index: 1; }
.learn-card .dash-copy { padding-right: clamp(80px, 22vw, 150px); }
.dash-progress { width: min(100%, 360px); display: grid; gap: 8px; font-size: .9rem; }
.dash-art { width: 92px; }
.stats-card { background: var(--white); flex-direction: row; align-items: center; flex-wrap: wrap; transition: transform 200ms var(--out), box-shadow 200ms; }
.stats-card:active { transform: translateY(4px); box-shadow: none; }
.stats-card .ring { width: 110px; }
.stats-card .dash-copy { flex: 1; min-width: 150px; }
.stats-card .round-go { position: absolute; top: 18px; right: 18px; }
@media (hover: hover) { .stats-card:hover .round-go { transform: translateX(4px) rotate(-8deg); } }
.mini-stats { display: flex; gap: 22px; margin-top: 6px; flex-wrap: wrap; }
.mini-stats dt { font-size: .84rem; color: var(--muted); }
.mini-stats dd { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }

/* Meters and rings animate through --p, set from JS so CSP stays strict. */
.meter { height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: calc(var(--p) * 1%); border-radius: inherit; background: var(--green); transition: --p 900ms var(--out); }
.ring { --p: 0; position: relative; display: grid; place-items: center; aspect-ratio: 1; flex: none; transition: --p 1100ms var(--out); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: color-mix(in srgb, var(--ink) 10%, transparent); }
.ring-fill { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p)); }
.ring-label { position: relative; display: grid; justify-items: center; line-height: 1.05; font-weight: 800; font-size: 1.1rem; text-align: center; }
.ring-label b { font-size: 1.7em; letter-spacing: -.03em; }
.ring-label small { font-size: .78em; color: var(--muted); }

/* Testing modes */
.mode-grid { margin-top: 24px; display: grid; gap: 14px; }
:is(.mode-card, .study-card) { border-radius: var(--r-xl); border: 2px solid color-mix(in srgb, var(--ink) 14%, transparent); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 16%, transparent); }
.mode-card { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 16px; width: 100%; padding: 18px; text-align: left; transition: transform 200ms var(--out), box-shadow 200ms; }
.mode-card:not(:disabled):active { transform: translateY(5px); box-shadow: none; }
.mode-card:disabled { opacity: .62; filter: saturate(.4); }
.mode-text strong { display: block; font-size: 1.25rem; line-height: 1.2; }
.mode-text > span { display: block; color: var(--ink-2); margin-top: 4px; }
.mode-tail { display: flex; align-items: center; gap: 10px; }
@media (hover: hover) { .mode-card:not(:disabled):hover .round-go { transform: translateX(4px); } .mode-card:not(:disabled):hover .mode-art:not(.study-icon) { animation: wiggle 600ms ease; } }

/* Study hub and shared lesson headings */
.study-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(10px, 4vw, 32px); align-items: center; margin-bottom: clamp(16px, 3vw, 28px); }
.study-heading h1 { font-size: clamp(1.62rem, 1.12rem + 2.3vw, 3rem); text-wrap: pretty; }
.study-heading .intro { font-size: clamp(.91rem, .87rem + .26vw, 1.04rem); margin-top: 6px; overflow-wrap: anywhere; }
.study-cast { position: relative; width: clamp(60px, 11vw, 94px); height: clamp(104px, 15vw, 146px); }
.study-cast svg { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.mode-grid.study-grid { margin-top: 0; grid-template-columns: minmax(0, 1fr); gap: clamp(12px, 1.8vw, 20px); }
.study-grid .mode-card { grid-template-columns: clamp(49px, 14vw, 70px) minmax(0, 1fr) auto; grid-template-rows: none; gap: clamp(9px, 2.5vw, 16px); padding: clamp(12px, 2.8vw, 20px); min-height: 116px; align-items: center; }
.study-grid a.mode-card { color: inherit; text-decoration: none; }
.study-grid .mode-art-wrap { width: 100%; grid-column: auto; }
.study-grid :is(.mode-text, .mode-tail) { align-self: center; }
.study-grid .mode-text { hyphens: auto; overflow-wrap: anywhere; }
.study-grid .mode-text strong { font-size: clamp(1rem, .94rem + .46vw, 1.28rem); }
.study-grid .mode-text > span { font-size: .92rem; line-height: 1.42; }
.study-grid .round-go { width: 30px; height: 30px; }
.study-grid .round-go .icon { width: 16px; height: 16px; }
.study-card { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; }
.study-grid .study-card .mode-card { padding-bottom: 4px; border: 0; background: transparent; box-shadow: none; }
.study-grid .mode-text > .study-progress { display: grid; gap: 6px; margin-top: 10px; font-size: .85rem; }
.study-restart { justify-self: start; min-height: 44px; margin: 0 10px 4px; padding: 4px 10px; font-size: .9rem; }
.study-jump { min-width: 0; }
.study-jump-links { display: none; gap: 8px; flex-wrap: wrap; }
.study-jump-links .button, .faq-tools .button { min-height: 44px; padding-inline: 12px; }
.study-jump-picker { width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px; font: inherit; font-weight: 750; color: var(--ink); background: var(--white); border: 2px solid var(--line); border-radius: var(--r-md); }
.study-jump :is(select, button):focus-visible { outline-offset: 2px; }

/* Pause off-screen artwork and leave quiet intervals between gestures. */
.speed-sign-face { transform-origin: 60px 67px; animation: study-sign-settle 4.8s ease-in-out -.4s infinite; }
.roundabout-sign-arrows { transform-origin: 60px 39px; animation: study-sign-turn 5.2s var(--out) -.4s infinite; }
.study-car-body { transform-origin: 60px 76px; animation: study-car-nod 5.4s ease-in-out -.5s infinite; }
.study-eye-open { animation: study-wink 5.4s step-end -.5s infinite; }
.study-eye-closed { opacity: 0; animation: study-wink-closed 5.4s step-end -.5s infinite; }
.study-icon:not(.is-visible) * { animation-play-state: paused; }
@keyframes study-sign-settle { 0%, 25%, 100% { transform: rotate(0); } 9% { transform: rotate(-6deg); } 17% { transform: rotate(2deg); } }
@keyframes study-sign-turn { 0%, 11% { transform: rotate(0); } 34%, 100% { transform: rotate(120deg); } }
@keyframes study-car-nod { 0%, 21%, 100% { transform: translateY(0); } 13% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes study-wink { 0%, 18%, 100% { opacity: 1; } 12% { opacity: 0; } }
@keyframes study-wink-closed { 0%, 18%, 100% { opacity: 0; } 12% { opacity: 1; } }

@media (min-width: 620px) {
  .mode-grid.study-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-grid .mode-card { grid-template: "art tail" 60px "copy copy" 1fr / minmax(0, 1fr) auto; gap: 12px; min-height: 174px; align-items: start; }
  .study-grid .mode-art-wrap { grid-area: art; width: 80px; }
  .study-grid .mode-text { grid-area: copy; align-self: start; }
  .study-grid .mode-tail { grid-area: tail; align-self: start; }
}
@media (min-width: 720px) {
  .study-jump-links { display: flex; }
  .study-jump-picker { display: none; }
}
@media (min-width: 980px) { .mode-grid.study-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.reading .answer { cursor: default; }
.reading .answer:not(.right) { opacity: .78; }

/* Common driving test questions */
.faq-tools { display: grid; gap: 10px; align-items: start; margin-bottom: 24px; }
.faq-tools > .button { justify-self: start; }
.faq-section + .faq-section { margin-top: 28px; }
.faq-section h2 { margin-bottom: 12px; scroll-margin-top: 85px; }
.faq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.faq-card { background: var(--white); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--lift); padding: 16px 18px; hyphens: auto; overflow-wrap: anywhere; animation: rise 420ms var(--out) both; animation-delay: calc(var(--i, 0) * 40ms + 150ms); transition: border-color 200ms; }
.faq-card.open { border-color: var(--green); }
.faq-q { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: start; }
.faq-q h3 { font-size: 1.08rem; line-height: 1.35; letter-spacing: -.01em; }
.faq-q .chip { grid-column: 2; justify-self: start; }
.faq-no { display: grid; place-items: center; min-width: 40px; height: 32px; padding-inline: 4px; border-radius: 10px; background: var(--gold-soft); border: 2px solid var(--gold-deep); font-weight: 800; font-size: .82rem; }
.faq-image { display: block; width: 100%; height: clamp(125px, 29vw, 200px); margin-top: 12px; object-fit: contain; border-radius: var(--r-md); background: var(--paper); }
.faq-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 6px 0 0; padding: 0; border: 0; background: none; color: var(--green); font-weight: 800; }
.faq-toggle .icon { transition: transform 250ms var(--spring); }
.faq-card.open .faq-toggle .icon { transform: rotate(90deg); }
.faq-a { padding: 12px 14px; border-radius: var(--r-md); background: var(--mint); color: var(--ink); animation: unfold 350ms var(--out); }
.faq-a p { color: var(--ink); }
.faq-empty { padding: 28px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); text-align: center; }
@media (min-width: 720px) { .faq-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (min-width: 980px) { .faq-tools { grid-template-columns: minmax(0, 1fr) auto; } }

/* Road sign handbook */
.signs-mode { background: var(--paper); }
.signs-tools { display: grid; gap: 12px; align-items: end; }
.signs-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-block: 12px 20px; font-size: .88rem; }
.signs-meta a { color: var(--green); text-decoration: underline; }
.signs-search { display: grid; min-width: 0; gap: 4px; font-size: .9rem; font-weight: 800; }
.signs-search input { width: 100%; min-height: 44px; padding: 8px 12px; color: var(--ink); background: var(--white); border: 2px solid var(--line); border-radius: var(--r-md); font: inherit; }
.signs-group h3 { margin-block: 18px 10px; font-size: 1.05rem; }
.signs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 0 0 12px; padding: 0; }
.signs-grid li { min-width: 0; }
.signs-card { --sign-height: clamp(80px, 22vw, 116px); display: grid; grid-template-rows: var(--sign-height) 1fr; place-items: center; gap: 8px; height: 100%; padding: 8px; text-align: center; background: white; color: var(--ink); border: 2px solid var(--line); border-radius: var(--r-md); overflow-wrap: anywhere; }
.signs-card img { max-width: 100%; max-height: 100%; object-fit: contain; }
.signs-card span { align-self: start; font-size: .92rem; line-height: 1.3; }
@media (min-width: 480px) { .signs-grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); } }
@media (min-width: 920px) { .signs-tools { grid-template-columns: minmax(0, 1fr) clamp(190px, 24vw, 258px); } }

/* Roundabout lesson */
.roundabout-rule, .roundabout-case { margin-block: 20px; padding: clamp(14px, 3vw, 24px); border: 2px solid var(--line); border-radius: var(--r-lg); }
.roundabout-rule { background: var(--mint); }
.roundabout-rule p { margin-block: 8px; max-width: 72ch; }
.roundabout-rule a { color: var(--green); text-decoration: underline; }
.roundabout-legend, .roundabout-note { max-width: 72ch; }
.roundabout-case { background: var(--white); }
.roundabout-case h2 { margin-bottom: 12px; scroll-margin-top: 85px; }
.roundabout-variant { display: grid; gap: clamp(14px, 3vw, 24px); align-items: start; }
.roundabout-variant[hidden] { display: none; }
.roundabout-variant img { display: block; width: 100%; height: auto; aspect-ratio: auto 1.04; border-radius: var(--r-md); }
.roundabout-variant ol { margin: 0; padding: 0 12px 0 2.25em; background: var(--paper); border-radius: var(--r-md); }
.roundabout-variant li { padding: 10px 0 10px 3px; }
.roundabout-variant li + li { border-top: 1px solid var(--line); }
.roundabout-variant li::marker { color: var(--green); font-weight: 800; }
.roundabout-choices { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin-block: 12px; }
.roundabout-choices legend { margin-bottom: 6px; font-weight: 800; }
.roundabout-choices label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 2px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.roundabout-choices label:has(:checked) { background: var(--mint); border-color: var(--green); }
.roundabout-choices input { accent-color: var(--green); }
@media (max-width: 479px) { .roundabout-choices label { width: 100%; } }
@media (min-width: 820px) {
  .roundabout-variant { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}

/* Car control lesson */
.control-section { margin-block: clamp(20px, 4vw, 36px); }
.control-section h2, .control-manoeuvre h3 { margin-bottom: 8px; line-height: 1.16; scroll-margin-top: 85px; }
.control-section p { max-width: 73ch; }
.control-routines { display: grid; gap: 12px; list-style: none; margin: 14px 0 0; padding: 0; }
.control-routines li, .control-manoeuvre { background: var(--white); border: 2px solid var(--line); border-radius: var(--r-lg); padding: clamp(14px, 2vw, 22px); }
.control-routines h3 { font-size: 1.25rem; color: var(--green); }
.control-routines p { margin-block: 6px 9px; }
.control-routines p[lang="en"] { font-size: .88rem; color: var(--ink-2); }
.control-lesson :is(.control-routines, .control-sources) a { color: var(--green); text-decoration: underline; }
.control-key, .control-options, .control-stages, .control-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 12px; }
.control-key { align-items: center; padding: 0; list-style: none; gap: 8px 16px; font-size: .92rem; }
.control-key li { display: inline-flex; align-items: center; gap: 6px; }
.control-key li::before { content: ''; display: inline-block; width: 17px; height: 10px; border: 1px solid #526358; border-radius: 3px; background: var(--swatch, #5adcf3); }
.control-key li:nth-child(2) { --swatch: #eac6ff; }
.control-key li:nth-child(3) { --swatch: #a4dfeb; }
.control-key li:nth-child(4) { --swatch: #ffb03c; }
.control-key li:nth-child(5) { --swatch: #e6f295; }
.control-manoeuvre { margin-block: 14px; }
.control-manoeuvre h3 { font-size: clamp(1.25rem, 3vw, 1.65rem); }
.control-panel { display: grid; gap: clamp(12px, 3vw, 24px); align-items: start; }
.control-panel canvas { display: block; width: 100%; height: auto; border-radius: var(--r-md); }
.control-options { border: 0; padding: 0; }
.control-options legend { font-weight: 750; margin-bottom: 6px; }
.control-lesson .button { min-height: 44px; }
.control-lesson :is(.control-options, .control-stages) .button { padding: 5px 12px; }
.control-stages .button { min-width: 44px; }
.control-step { min-width: 0; padding: clamp(12px, 2vw, 16px); border-radius: var(--r-md); background: var(--paper); overflow-wrap: anywhere; }
.control-lesson [aria-current="step"], .control-options [aria-pressed="true"] { background: var(--mint); border-color: var(--green); }
.control-step h4 { margin-block: 4px 12px; font-size: 1.12rem; }
.control-step dl { margin: 0; }
.control-step dt { color: var(--green); font-weight: 800; }
.control-step dd { margin: 2px 0 11px; }
.control-sources { margin: 6px 0 0; padding-left: 1.35rem; }
@media (max-width: 375px) {
  .control-stages:has(button:nth-child(6)) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) { .control-routines { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 830px) {
  .control-panel { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
}

/* Account */
.profile-card { display: flex; align-items: center; gap: 18px; margin-block: 22px; padding: 20px; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--lift); }
.account-details { flex: 1; min-width: 0; }
.account-details > div { padding-block: 10px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; }
.account-details > div + div { border-top: 2px dashed var(--line); }
.account-details dd { min-width: 0; overflow-wrap: anywhere; }
.account-plan-until { display: block; color: var(--muted); font-size: .9rem; font-weight: 500; }
dt { color: var(--muted); }
dd { font-weight: 800; overflow-wrap: anywhere; }

/* Statistics */
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-block: 24px 16px; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 16px; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--lift); min-height: 120px; }
.tile dt { font-size: .88rem; }
.tile-ring { flex-direction: row; align-items: center; gap: 14px; }
.tile-ring .ring { width: 84px; }
.tile-ring .ring-label { font-size: .9rem; }
.tile-ring dd { font-size: 1.05rem; }
.big-num { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.8rem); line-height: 1.05; letter-spacing: -.03em; }
.activity { background: var(--white); border-radius: var(--r-xl); border: 2px solid var(--line); box-shadow: var(--lift); padding: clamp(16px, 3.5vw, 32px); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head p { margin-top: 4px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; }
.legend span::before { content: ""; width: .7em; height: .7em; border-radius: 3px; display: inline-block; margin-right: 6px; background: var(--mint-2); }
.legend span + span::before { background: var(--green); }
.chart-wrap { position: relative; padding-left: 28px; }
.chart-max { position: absolute; left: 0; top: -4px; font-size: .75rem; color: var(--muted); font-weight: 700; }
.chart-wrap svg { width: 100%; height: clamp(150px, 26vw, 240px); display: block; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-dasharray: 4 6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-col { animation: grow 700ms var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms + 150ms); transform-origin: 0 128px; }
.chart-hit { fill: transparent; }
.chart-total { fill: var(--mint-2); }
.chart-correct { fill: var(--green); }
.chart-col:hover .chart-total { fill: var(--gold); }
.chart-dates { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: 6px; padding-left: 28px; }
.chart-table { font-size: .88rem; margin-top: 10px; }
.chart-table summary { min-height: 44px; align-content: center; font-weight: 700; }
.chart-table table { width: 100%; border-collapse: collapse; }
.chart-table th, .chart-table td { padding: 7px; text-align: start; border-bottom: 1px solid var(--line); }

/* Question screens */
.quiz { max-width: 1240px; }
body[data-focus="true"] main { padding-top: 0; }
.quiz-bar { position: sticky; top: var(--header-h); z-index: 30; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; align-items: center; gap: 8px; padding-block: 10px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.quiz-meta { min-width: 0; display: grid; gap: 6px; }
.quiz-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.quiz-title h1 { font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-count { font-size: .82rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quiz-count b { color: var(--ink); }

.road { position: relative; height: 16px; border-radius: 99px; background: var(--asphalt); }
.road::before { content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; translate: 0 -50%; background: repeating-linear-gradient(90deg, rgba(255, 253, 247, .55) 0 10px, transparent 10px 18px); }
.road-fill { position: absolute; inset: 3px auto 3px 3px; width: calc((100% - 6px) * var(--p) / 100); min-width: 10px; border-radius: 99px; background: var(--gold); transition: --p 700ms var(--out); }
.road { transition: --p 700ms var(--out); }
.road-car { position: absolute; top: 50%; left: calc(var(--p) * 1%); width: 30px; translate: -50% -58%; transition: left 700ms var(--out); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }
.road-car .car-mini { display: block; width: 100%; animation: bob 600ms ease-in-out infinite alternate; }

.timer { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--gold-soft); border: 2px solid var(--gold-deep); font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.low { background: var(--peach); border-color: var(--coral); color: var(--coral); animation: pulse 1s ease-in-out infinite; }
.streak { display: inline-flex; align-items: center; gap: 3px; height: 40px; padding: 0 10px; border-radius: 12px; color: var(--muted); background: transparent; font-weight: 800; opacity: .35; transition: opacity 200ms; }
.streak.on { opacity: 1; background: var(--gold-soft); color: var(--ink); animation: bump 500ms var(--spring); }
.streak.on .icon { color: #e08a00; fill: #ffc634; }

.quiz-body { display: grid; gap: 16px; padding-top: 6px; }
.question { container-type: inline-size; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--lift); padding: clamp(16px, 3.5vw, 30px); }
.q-head h2 { text-wrap: pretty; font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem); line-height: 1.22; letter-spacing: -.02em; }
.question-image { height: auto; width: auto; max-width: 100%; max-height: min(34vh, 260px); object-fit: contain; margin: 16px auto 0; border-radius: 10px; }
.question-speech-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 10px; }
.question-speech-actions:empty { display: none; }
.question-speech { min-height: 44px; max-width: 100%; padding: 6px 12px; gap: 7px; font-size: .875rem; }
.question-speech span { min-width: 0; overflow-wrap: anywhere; }
.question-speech .icon { flex: 0 0 17px; width: 17px; height: 17px; }
.question-speech[aria-busy="true"] { border-color: var(--green); }
.q-answers { margin-top: 18px; }
@container (min-width: 700px) {
  .has-image .q-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
  .has-image .q-answers { margin-top: 0; }
  .has-image .question-image { max-height: 300px; margin-top: 22px; }
}
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; display: grid; gap: 10px; }
.answer { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border: 2px solid var(--line); min-height: 58px; padding: 10px 14px; border-radius: var(--r-md); background: var(--white); box-shadow: 0 3px 0 var(--line); cursor: pointer; transition: transform 140ms var(--out), border-color 150ms, background-color 150ms, box-shadow 140ms; animation: rise 420ms var(--out) both; animation-delay: calc(var(--i, 0) * 50ms + 120ms); }
.quiz:not(.enter-q) .answer { animation: none; }
.answer input { clip-path: inset(50%); position: absolute; width: 1px; height: 1px; }
.answer:has(input:focus-visible) { outline: 3px solid var(--green); outline-offset: 2px; }
.answer:has(input:not(:disabled)):active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.answer:not(.right, .wrong):has(input:checked) { border-color: var(--green); background: #edf3e5; box-shadow: 0 3px 0 var(--green); }
.answer:has(input:disabled) { cursor: default; }
.answer-text { min-width: 0; overflow-wrap: anywhere; }
.letter { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 2px solid var(--line); background: var(--paper); font-weight: 800; font-size: .88rem; transition: background-color 150ms, color 150ms, border-color 150ms; }
.answer:not(.right, .wrong):has(input:checked) .letter { background: var(--green); border-color: var(--green); color: var(--white); animation: pop-in 300ms var(--spring); }
.answer.right { border-color: var(--green); background: var(--mint); box-shadow: 0 3px 0 var(--green); animation: celebrate 600ms var(--spring); }
.answer.right .letter { background: var(--green); border-color: var(--green); color: var(--white); }
.answer.wrong { border-color: var(--coral); background: var(--peach); box-shadow: 0 3px 0 var(--coral); animation: shake 450ms ease; }
.answer.wrong .letter { background: var(--coral); border-color: var(--coral); color: var(--white); }
.answer-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--white); animation: pop-in 400ms var(--spring) .15s both; }
.answer.right .answer-mark { background: var(--green); }
.answer.wrong .answer-mark { background: var(--coral); }
@media (hover: hover) { .answer:has(input:not(:disabled)):hover { border-color: var(--green); } }
/* Comic balloon: the otter speaks in a hand-drawn balloon with an offset ink shadow. */
.comic { position: relative; display: grid; justify-items: start; gap: 6px; margin: 0; padding: 14px 18px; border: 3px solid var(--ink); border-radius: 26px; background: var(--white); color: var(--ink); box-shadow: 5px 5px 0 var(--ink); line-height: 1.38; isolation: isolate; }
.comic::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: radial-gradient(circle, currentColor 1.1px, transparent 1.5px) 0 0 / 9px 9px; opacity: .07; }
.comic::after { content: ""; position: absolute; width: 18px; height: 18px; left: 30px; bottom: -12px; rotate: 45deg; background: inherit; border: 3px solid var(--ink); border-width: 0 3px 3px 0; }
.comic strong { font-size: 1.08rem; line-height: 1.25; }
.comic-say { display: block; }
.comic-why { display: block; color: var(--ink-2); font-size: .95rem; }
.coach[data-mood="happy"] .comic { background: #f1f8ea; color: var(--green-deep); }
.coach[data-mood="sad"] .comic { background: #fdf0e8; color: var(--coral-deep); }
.coach .comic-say { color: var(--ink); }
.burst { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 10px; margin: 0 0 2px; border: 3px solid var(--ink); border-radius: 12px; font-weight: 800; font-size: 1rem; color: var(--white); box-shadow: 3px 3px 0 var(--ink); rotate: -3deg; animation: burst-in 600ms var(--spring) 120ms both; }
.burst.right { background: var(--green); }
.burst.wrong { background: var(--coral); }
.burst.info { background: var(--gold); color: var(--ink); }
.touch-hint { display: none; }
@media (hover: none) { .kbd-hint { display: none; } .touch-hint { display: inline; } }
.kbd-hint, .touch-hint { font-size: .9rem; color: var(--ink-2); }
.streak-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 6px; border-radius: 99px; background: var(--ink); color: var(--gold); font-size: .82rem; font-weight: 800; animation: bump 500ms var(--spring) .4s both; }
.dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
.coach[data-state="explain"] .coach-balloon, .coach[data-state="greet"] .coach-balloon { animation: comic-pop 520ms var(--spring) both; }

/* The otter and its balloon follow the question card, so they never cover it.
   On phones only the action button is fixed to the thumb zone. */
.coach { display: flex; align-items: flex-end; gap: 10px; scroll-margin-bottom: calc(var(--dock-h, 90px) + 20px); }
.coach-cast { width: 84px; flex: none; }
/* The tail must sit on a straight stretch of the edge, so the balloon keeps enough height for one. */
.coach-balloon { flex: 1; min-width: 0; min-height: 72px; align-content: center; border-radius: 22px; margin: 0 0 34px 10px; transform-origin: 0 80%; }
.coach-balloon::after { left: -12px; bottom: min(26px, calc(50% - 9px)); border-width: 0 0 3px 3px; }
.dock { position: fixed; z-index: 35; inset: auto 0 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--white); border-top: 2px solid var(--line); transition: background-color 250ms; }
.dock.is-right { background: var(--mint); border-color: var(--mint-2); }
.dock.is-wrong { background: var(--peach); border-color: #efc1aa; }
.action-bar { display: flex; align-items: center; gap: 10px; }
.action-bar .button { flex: 1; }
.quiz[data-mode="exam"] .action-bar .button { padding-inline: 10px; }
.quiz[data-mode="exam"] .action-bar [data-action="go"] span { display: none; }
.quiz[data-mode="exam"] .action-bar [data-action="go"] { flex: 0 0 52px; }
.map-toggle span { font-variant-numeric: tabular-nums; }
.quiz-body { padding-bottom: calc(var(--dock-h, 90px) + 16px); }
.exam-side { display: none; }
.quiz[data-mode="exam"] .jump-button { display: none; }
.jump-button { width: auto; min-width: 44px; padding: 0 10px; gap: 8px; display: inline-flex; align-items: center; font-weight: 800; font-size: .88rem; }
.jump-label { display: none; }
.sound-button[aria-pressed="false"] { color: var(--muted); }
.quiz-language { min-height: 44px; padding: 0 9px; gap: 4px; border-radius: 12px; }
.quiz-language .language-code { display: inline; }
.chunk-tabs button { position: relative; overflow: hidden; }
.chunk-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p) * 1%); background: var(--green); transition: --p 600ms var(--out); }
.chunk-tabs [aria-selected="true"] .chunk-bar { background: var(--gold); }
/* Phones only: the question screen takes over the whole viewport. */
@media (max-width: 719.98px) {
    body[data-focus="true"] header, body[data-focus="true"] footer { display: none; }
  .quiz-bar { top: 0; padding-top: calc(10px + env(safe-area-inset-top)); }
  .quiz-count-label { display: none; }
  .streak:not(.on) { display: none; }
  .tile-ring { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tile-ring .ring { width: 72px; }
  .tile { min-width: 0; padding: 14px; }
  .mode-card { grid-template-columns: 64px 1fr auto; gap: 12px; padding: 16px; }
  .feature { grid-template-columns: 76px 1fr; }
  .dash-cast { top: 12px; bottom: auto; right: 6px; width: 78px; }
  .learn-card .dash-copy { padding-right: 82px; }
}

/* Question map and quick jump sheet. */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; visibility: hidden; pointer-events: none; }
.sheet[data-open] { visibility: visible; pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(25, 45, 53, .45); opacity: 0; transition: opacity 250ms; }
.sheet[data-open] .sheet-backdrop { opacity: 1; }
.sheet-panel { position: relative; max-height: 86dvh; overflow: auto; overscroll-behavior: contain; padding: 8px var(--gutter) calc(20px + env(safe-area-inset-bottom)); background: var(--white); border-radius: var(--r-xl) var(--r-xl) 0 0; border-top: 3px solid var(--ink); translate: 0 100%; transition: translate 380ms var(--out); }
.sheet[data-open] .sheet-panel { translate: 0 0; }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 1.3rem; }
.sheet-foot { margin-top: 16px; }
.sheet-foot .button, .exam-side > .button { width: 100%; }
.jump { display: grid; gap: 14px; padding: 16px; margin-bottom: 16px; border-radius: var(--r-lg); background: var(--gold-soft); border: 2px solid var(--gold-deep); }
.jump-slider { position: relative; padding-top: 34px; }
.jump-slider input { width: 100%; height: 30px; accent-color: var(--ink); }
#jump-bubble { --k: 0; position: absolute; top: 0; left: calc(var(--k) * (100% - 24px) + 12px); translate: -50% 0; min-width: 40px; padding: 2px 8px; border-radius: 9px; background: var(--ink); color: var(--gold); font-weight: 800; font-size: .9rem; text-align: center; }
#jump-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; translate: -50% 0; rotate: 45deg; background: var(--ink); z-index: -1; }
.jump-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.jump-number { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.jump-number input { width: 92px; min-height: 48px; padding: 8px 12px; border: 2px solid var(--line-2); border-radius: var(--r-md); background: var(--white); font-weight: 800; font-size: 1.05rem; }
.jump-row .button { margin-left: auto; }
.chunk-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: thin; }
.chunk-tabs button { flex: none; min-height: 38px; padding: 6px 12px; border-radius: 99px; border: 2px solid var(--line); background: var(--white); font-weight: 800; font-size: .84rem; font-variant-numeric: tabular-nums; }
.chunk-tabs [aria-selected="true"] { background: var(--ink); color: var(--gold); border-color: var(--ink); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; }
.cell { min-height: 46px; padding: 0 4px; background: var(--white); border: 2px solid var(--line); border-radius: 11px; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 var(--line); transition: transform 120ms var(--out), box-shadow 120ms; }
.cell:active { transform: translateY(3px); box-shadow: none; }
.cell.done { background: var(--ink); color: var(--white); border-color: var(--ink); box-shadow: 0 3px 0 #0a171c; }
.cell.right { background: var(--mint); border-color: var(--green); box-shadow: 0 3px 0 var(--green); }
.cell.wrong { background: var(--peach); border-color: var(--coral); box-shadow: 0 3px 0 var(--coral); }
.cell[aria-current] { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .84rem; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cell-dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--line); background: var(--white); }
.cell-dot.done { background: var(--ink); border-color: var(--ink); }
.cell-dot.right { background: var(--mint); border-color: var(--green); }
.cell-dot.wrong { background: var(--peach); border-color: var(--coral); }
@media (hover: hover) { .cell:hover { border-color: var(--green); } }

/* Results */
.results { max-width: 980px; }
.result-card { display: grid; gap: 8px; border-radius: var(--r-xl); padding: clamp(20px, 4vw, 36px); border: 2px solid color-mix(in srgb, var(--ink) 14%, transparent); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 16%, transparent); overflow: hidden; }
.result-card.win { background: var(--mint); }
.result-card.lose { background: var(--peach); }
.result-card.lose .ring-fill { stroke: var(--coral); }
.result-cast { display: grid; justify-items: center; gap: 14px; }
.result-cast .otter { width: clamp(100px, 22vw, 160px); }
.result-balloon { animation: comic-pop 600ms var(--spring) .5s both; transform-origin: 50% 100%; }
.result-balloon::after { left: 50%; translate: -50% 0; }
.result-main h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
.result-score { display: flex; align-items: center; gap: 18px; margin-block: 16px 20px; flex-wrap: wrap; }
.result-score .ring { width: clamp(120px, 30vw, 160px); }
.result-score .ring-label { font-size: 1.25rem; }
.result-score h2 { margin-bottom: 6px; }
.result-score p { color: var(--ink-2); }
.review { margin-top: 30px; }
.review h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.review-item { margin-bottom: 10px; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 3px 0 var(--line); animation: rise 420ms var(--out) both; animation-delay: calc(var(--i, 0) * 40ms + 300ms); overflow: hidden; }
.review-item summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; font-weight: 800; list-style: none; min-height: 60px; }
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary > .icon { transition: transform 250ms var(--spring); color: var(--muted); }
.review-item[open] summary > .icon { transform: rotate(90deg); }
.review-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--paper); }
.review-no { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--peach); color: var(--coral); }
.review-body { display: grid; gap: 10px; padding: 0 14px 16px; animation: unfold 350ms var(--out); }
.review-body .question-image { margin: 0 auto 4px; max-height: 200px; }
.pill { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--r-md); color: var(--ink); }
.pill small { display: block; color: var(--muted); font-weight: 700; font-size: .78rem; }
.pill.wrong { background: var(--peach); } .pill.wrong .icon { color: var(--coral); }
.pill.right { background: var(--mint); } .pill.right .icon { color: var(--green); }
.review-why { color: var(--ink-2); }

/* Dialog */
#dialog { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; margin: auto 0 0; }
#dialog::backdrop { background: rgba(25, 45, 53, .45); animation: fade 200ms; }
#dialog[open] { animation: sheet-up 350ms var(--out); }
.dialog-card { display: grid; justify-items: center; gap: 14px; padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom)); background: var(--white); border-radius: var(--r-xl) var(--r-xl) 0 0; border-top: 3px solid var(--ink); text-align: center; }
.dialog-cast .otter { width: 96px; }
.dialog-card p { color: var(--ink); font-size: 1.1rem; font-weight: 700; max-width: 34ch; }
.dialog-card .actions { width: 100%; justify-content: center; }
.dialog-card .button { flex: 1; max-width: 220px; }
.install-guide h2 { font-size: 1.25rem; }
.install-guide ol { margin: 0; padding-inline-start: 1.3em; text-align: start; }
.install-guide li + li { margin-top: 8px; }
/* Loading */
.loading { display: grid; justify-items: center; gap: 10px; padding-block: 60px; }
.loading-road { position: relative; width: 160px; height: 14px; border-radius: 99px; background: var(--asphalt); }
.loading-road .car-mini { position: absolute; top: -12px; width: 30px; animation: loader 1.4s ease-in-out infinite alternate; }
main[aria-busy="true"] { cursor: progress; }
html:has(main[aria-busy="true"]) header::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 3px; width: 30%; background: var(--gold-deep); animation: busy 900ms ease-in-out infinite; }

#notice { position: fixed; z-index: 80; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: min(440px, calc(100% - 24px)); padding: 12px 18px; border-radius: var(--r-md); background: var(--ink); color: var(--white); box-shadow: 0 4px 0 #0a171c; font-weight: 700; translate: -50% 140%; opacity: 0; transition: translate 350ms var(--spring), opacity 250ms; }
#notice.visible { translate: -50% 0; opacity: 1; }
body[data-tabs="true"] #notice { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
body[data-focus="true"] #notice { bottom: calc(100px + env(safe-area-inset-bottom)); }

.confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall 2.4s cubic-bezier(.25, .6, .4, 1) forwards; }

/* Otter inspector. Arms are two-segment and rotate around the shoulder and elbow in SVG units.
   [data-pose] sets the angles through custom properties, [data-mood] sets the face. */
.otter { display: block; width: 100%; height: auto; overflow: visible; }
.otter-head { overflow: hidden; }
.tochka { pointer-events: none; }
.otter .o-brow { transition: transform 300ms var(--spring); }
.otter .o-body { transform-origin: 215px 818px; animation: o-breathe 3.4s ease-in-out infinite; }
.otter .o-shadow { transform-box: fill-box; transform-origin: center; animation: o-shadow 3.4s ease-in-out infinite; }
.otter .o-head { transform-origin: 215px 386px; transform: rotate(var(--hr, 0deg)); transition: transform 500ms var(--spring); }
.otter .o-torso { transform-origin: 215px 660px; }
.otter .o-arm-a { transform-origin: 100px 432px; transform: rotate(var(--a1, 9deg)); }
.otter .o-arm-b { transform-origin: 340px 432px; transform: rotate(var(--a2, -9deg)); }
.otter .o-fore-a { transform-origin: 84px 518px; transform: rotate(var(--f1, -14deg)); }
.otter .o-fore-b { transform-origin: 356px 518px; transform: rotate(var(--f2, 14deg)); }
.otter .o-arm, .otter .o-fore { transition: transform 500ms var(--spring); animation: o-pose-in 600ms var(--spring); }
.otter .o-tail { transform-origin: 122px 712px; animation: o-tail 2.8s ease-in-out infinite; }
.otter .o-ear { transform-box: fill-box; transition: transform 300ms var(--spring); }
.otter .o-ear-l { transform-origin: 80% 80%; } .otter .o-ear-r { transform-origin: 20% 80%; }
.otter .o-eye { transition: transform 300ms var(--out), opacity 150ms; }
.otter .o-lid { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: o-blink 4.8s infinite; }
.otter .o-joy, .otter .o-grin, .otter .o-frown, .otter .o-oh, .otter .o-tear, .otter .o-sweat,
.otter .o-sparks, .otter .o-book, .otter .o-thumb, .otter .o-glint { opacity: 0; transition: opacity 200ms; }
.otter .o-blush { opacity: .4; transition: opacity 200ms; }
.otter .o-brow { transform-box: fill-box; transform-origin: center; }
.otter .o-sparks path { transform-box: fill-box; transform-origin: center; }
/* Head turns: features slide with parallax (nose most, mask less, cap least); the far eye narrows. */
.otter .o-face { transform: translateX(calc(var(--turn, 0) * 32px)); transition: transform 500ms var(--spring); }
.otter .o-nose { transform: translateX(calc(var(--turn, 0) * 13px)); transition: transform 500ms var(--spring); }
.otter .o-mask { transform: translateX(calc(var(--turn, 0) * 17px)); transition: transform 500ms var(--spring); }
.otter .o-tuft, .otter .o-cap { transform: translateX(calc(var(--turn, 0) * 7px)); transition: transform 500ms var(--spring); }
.otter .o-ear-l { translate: calc(var(--turn, 0) * 8px) 0; } .otter .o-ear-r { translate: calc(var(--turn, 0) * 8px) 0; }
.otter .o-eye, .otter .o-joy { transform-box: fill-box; transform-origin: center; }
.otter .o-eye-l, .otter .o-joy-l { scale: calc(1 - max(0, -1 * var(--turn, 0)) * .14) 1; }
.otter .o-eye-r, .otter .o-joy-r { scale: calc(1 - max(0, var(--turn, 0)) * .14) 1; }
[data-turn="left"] { --turn: -1; } [data-turn="right"] { --turn: 1; } [data-turn="front"] { --turn: 0; }
.otter .o-fist { opacity: 0; transition: opacity 150ms; }
[data-pose="thumb"] .o-arm-b .o-fist { opacity: 1; }
[data-pose="thumb"] .o-arm-b .o-paw { opacity: 0; }

/* Faces */
[data-mood="happy"] .o-eye { opacity: 0; }
[data-mood="happy"] .o-joy, [data-mood="happy"] .o-grin, [data-mood="happy"] .o-sparks { opacity: 1; }
[data-mood="happy"] .o-smile { opacity: 0; }
[data-mood="happy"] .o-blush, [data-mood="shy"] .o-blush { opacity: .85; }
[data-mood="happy"] .o-sparks path { animation: o-spark 1.4s var(--spring) both; }
[data-mood="happy"] .o-sparks path:nth-child(2) { animation-delay: .12s; } [data-mood="happy"] .o-sparks path:nth-child(3) { animation-delay: .24s; } [data-mood="happy"] .o-sparks path:nth-child(4) { animation-delay: .36s; }
[data-mood="happy"][data-pose="thumb"] .o-eye-l { opacity: 1; }
[data-mood="happy"][data-pose="thumb"] .o-joy-l { opacity: 0; }
[data-mood="think"] .o-eye { transform: translate(8px, -8px); }
[data-mood="think"] .o-lid { animation: none; }
[data-mood="think"] .o-brow-r { transform: translateY(-10px) rotate(8deg); }
[data-mood="think"] .o-smile { opacity: 0; }
[data-mood="think"] .o-oh { opacity: 1; }
[data-mood="sad"] .o-eye { transform: translateY(6px); }
[data-mood="sad"] .o-lid { animation: none; transform: scaleY(.38); }
[data-mood="sad"] .o-brow-l { transform: translateY(-4px) rotate(-18deg); } [data-mood="sad"] .o-brow-r { transform: translateY(-4px) rotate(18deg); }
[data-mood="sad"] .o-smile { opacity: 0; }
[data-mood="sad"] .o-frown { opacity: 1; }
[data-mood="sad"] .o-tear { opacity: 1; animation: o-tear 1.8s ease-in infinite .5s; }
[data-mood="sad"] .o-ear-l { transform: rotate(-28deg); } [data-mood="sad"] .o-ear-r { transform: rotate(28deg); }
[data-mood="shy"] .o-lid { animation: none; transform: scaleY(1); }
.auth-cast[data-mood="think"] .o-eye { transform: translate(calc(var(--look, 0) * 18px - 8px), 8px); }

/* Poses: greeting */
[data-pose="wave"] { --a2: -100deg; --f2: -95deg; --hr: -5deg; --turn: .55; }
[data-pose="wave"] .o-fore-b { animation: o-pose-in 600ms var(--spring), o-wave 380ms ease-in-out 550ms 6 alternate; }
[data-pose="idle"], [data-pose="hello"] { animation: o-look 8s ease-in-out infinite; }
[data-pose="hello"] .o-arm-b { animation: o-hello-arm 7s var(--out) infinite 1.2s; }
[data-pose="hello"] .o-fore-b { animation: o-hello-fore 7s ease-in-out infinite 1.2s; }
[data-pose="hello"] .o-head { animation: o-hello-head 7s ease-in-out infinite 1.2s; }
/* Praise */
[data-pose="jump"] { --a1: 100deg; --f1: 92deg; --a2: -101deg; --f2: -97deg; --turn: 0; }
[data-pose="jump"] .o-body { animation: o-hop 700ms var(--spring) 2, o-breathe 3.4s ease-in-out 1.4s infinite; }
[data-pose="jump"] .o-shadow { animation: o-hop-shadow 700ms var(--spring) 2; }
[data-pose="thumb"] { --a2: -18deg; --f2: 102deg; --hr: 6deg; --turn: .4; }
[data-pose="thumb"] .o-glint { animation: o-glint 1.2s ease .5s both; }
[data-pose="clap"] { --a1: -15deg; --f1: -85deg; --a2: 15deg; --f2: 85deg; --turn: -.2; }
[data-pose="clap"] .o-fore-a { animation: o-pose-in 500ms var(--spring), o-clap-a 200ms ease-in-out 450ms 8 alternate; }
[data-pose="clap"] .o-fore-b { animation: o-pose-in 500ms var(--spring), o-clap-b 200ms ease-in-out 450ms 8 alternate; }
[data-pose="clap"] .o-body { animation: o-bounce 400ms ease-in-out 4, o-breathe 3.4s ease-in-out 1.6s infinite; }
[data-pose="glasses"] { --a2: -143deg; --f2: -52deg; --hr: -4deg; --turn: .35; }
[data-pose="glasses"] .o-glint { animation: o-glint 1.2s ease .45s 2 both; }
[data-pose="glasses"] .o-torso { animation: o-proud 900ms var(--spring) both; }
/* Sorrow */
[data-pose="sigh"] { --a1: 4deg; --a2: -4deg; --hr: 7deg; --turn: -.35; }
[data-pose="sigh"] .o-body { animation: o-slump 800ms ease both, o-sigh 3.2s ease-in-out .8s infinite; }
[data-pose="sigh"] .o-sweat { opacity: 1; animation: o-tear 1.6s ease-in infinite .3s; }
[data-pose="facepalm"] { --a1: -163deg; --f1: 4deg; --hr: -6deg; --turn: -.45; }
[data-pose="facepalm"] .o-tear { opacity: 0; }
[data-pose="shrug"] { --a1: 45deg; --f1: 75deg; --a2: -45deg; --f2: -75deg; }
[data-pose="shrug"] .o-head { animation: o-shake 520ms ease-in-out 3; }
/* Thinking, holding the rule book, hiding the eyes */
[data-pose="think"] { --a2: 86deg; --f2: 90deg; --hr: -5deg; --turn: .7; }
[data-pose="book"] { --a1: 6deg; --f1: -68deg; --a2: -6deg; --f2: 68deg; --turn: -.25; }
[data-pose="book"] .o-book { opacity: 1; }
[data-pose="shy"] { --a1: -162deg; --f1: 5deg; --a2: 173deg; --f2: -3deg; --hr: 4deg; --turn: 0; }

@keyframes o-pose-in { from { transform: rotate(0deg); } }
@keyframes o-look { 0%, 18%, 100% { --turn: 0; } 26%, 42% { --turn: -.8; } 52%, 66% { --turn: .8; } 76%, 90% { --turn: 0; } }
@keyframes o-breathe { 50% { transform: translateY(-5px) scale(1.006, .994); } }
@keyframes o-shadow { 50% { transform: scaleX(.94); } }
@keyframes o-tail { 50% { transform: rotate(-12deg); } }
@keyframes o-blink { 0%, 92%, 100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
@keyframes o-wave { to { transform: rotate(calc(var(--f2) + 30deg)); } }
@keyframes o-hello-arm { 0%, 60%, 100% { transform: rotate(0deg); } 8%, 50% { transform: rotate(-100deg); } }
@keyframes o-hello-fore { 0%, 60%, 100% { transform: rotate(0deg); } 10%, 20%, 30%, 40%, 50% { transform: rotate(-95deg); } 15%, 25%, 35%, 45% { transform: rotate(-65deg); } }
@keyframes o-hello-head { 0%, 55%, 100% { transform: rotate(0deg); } 10%, 48% { transform: rotate(-6deg); } }
@keyframes o-hop { 0% { transform: none; } 18% { transform: scale(1.06, .93); } 50% { transform: translateY(-70px) scale(.97, 1.04); } 78% { transform: scale(1.06, .94); } 100% { transform: none; } }
@keyframes o-hop-shadow { 50% { transform: scaleX(.6); opacity: .07; } }
@keyframes o-bounce { 50% { transform: translateY(-14px); } }
@keyframes o-clap-a { to { transform: rotate(calc(var(--f1) + 14deg)); } }
@keyframes o-clap-b { to { transform: rotate(calc(var(--f2) - 14deg)); } }
@keyframes o-glint { 0% { opacity: 0; transform: translateX(-6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateX(10px); } }
@keyframes o-proud { 50% { transform: scale(1.05, .98); } }
@keyframes o-slump { to { transform: translateY(10px) scale(1.015, .97); } }
@keyframes o-sigh { 0%, 100% { transform: translateY(10px) scale(1.015, .97); } 50% { transform: translateY(14px) scale(1.02, .96); } }
@keyframes o-shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes o-spark { 0% { transform: scale(0) rotate(0); } 60% { transform: scale(1.3) rotate(40deg); } 100% { transform: scale(1) rotate(72deg); } }
@keyframes o-tear { 0% { transform: translateY(-6px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(34px); opacity: 0; } }

/* ---------- Tablet: sections move to the header, cards pair up ---------- */
@media (min-width: 720px) {
  :root { --header-h: 68px; }
  main { padding-block: 32px 72px; }
  body[data-tabs="true"] #tabbar { display: none; }
  body[data-tabs="true"] main { padding-bottom: 72px; }
  body[data-tabs="true"] footer { padding-bottom: 0; }
  body[data-tabs="true"] #notice { bottom: 16px; }
  .topnav { display: flex; gap: 4px; margin-right: 8px; }
  body[data-tabs="true"] .wordmark-label, body[data-focus="true"] .wordmark-label { display: none; }
  .topnav-link { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 14px; border-radius: 12px; font-weight: 800; font-size: .94rem; text-decoration: none; color: var(--muted); transition: color 150ms, background-color 150ms; }
  .topnav-link .icon { width: 20px; height: 20px; }
  .topnav-link[aria-current] { color: var(--ink); background: var(--gold-soft); }
  .topnav-link[aria-current]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -13px; height: 3px; border-radius: 3px; background: var(--ink); }
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; min-height: 60px; }
  .hero-intro { margin-block: 22px 30px; }
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feature { grid-template-columns: 1fr; grid-template-rows: auto; padding: 22px; }
  .feature-art { grid-row: auto; width: 110px; margin-bottom: 10px; }
  .feature:hover .mode-art { animation: wiggle 600ms ease; }
  .country-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .auth-card { grid-template-columns: .9fr 1.1fr; }
  .auth-cast { border-bottom: 0; border-right: 2px solid var(--line); align-items: center; padding: 30px; }
  .auth-cast .otter { width: min(190px, 56%); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .learn-card { grid-column: 1 / -1; min-height: 280px; }
  .dash-cast { right: 4%; bottom: -60px; width: min(150px, 22%); }
  .learn-card .dash-copy { padding-right: 0; max-width: 58%; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-card { grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; align-items: start; padding: 26px; min-height: 260px; }
  .mode-art-wrap { width: 120px; grid-column: 1 / -1; }
  .mode-text { align-self: end; }
  .mode-tail { align-self: end; }
  .stat-tiles { grid-template-columns: repeat(4, 1fr); }
  .tile-ring { flex-direction: column; align-items: flex-start; }
  .flag-frame.big { width: 84px; }
  /* Quiz: the otter and its balloon sit under the card, next to the controls. */
  body[data-focus="true"] main { padding-top: 8px; }
  .dock { position: static; display: contents; }
  .quiz-body { padding-bottom: 0; }
  .coach-cast { width: 110px; }
  .action-bar { justify-content: flex-end; }
  .action-bar .check-button, .action-bar [data-action="next"] { flex: 0 0 auto; min-width: 220px; }
  .quiz .question { margin-bottom: 0; }
  .quiz[data-mode="exam"] .action-bar .button { flex: 0 0 auto; }
  .quiz[data-mode="exam"] .action-bar [data-action="go"] span { display: inline; }
  .quiz[data-mode="exam"] .action-bar [data-action="go"] { flex: 0 0 auto; }
  .quiz[data-mode="exam"] .action-bar { justify-content: flex-start; flex-wrap: wrap; }
  .quiz[data-mode="exam"] .finish-inline { margin-left: auto; }
  .quiz-title h1 { font-size: 1.25rem; }
  .jump-label { display: inline; }
  .quiz-language { display: none; }
  .road { height: 18px; }
  /* Sheets and dialogs become centred cards. */
  .sheet { align-items: center; justify-items: center; padding: 24px; }
  .sheet-panel { width: min(640px, 100%); max-height: 80dvh; border-radius: var(--r-xl); border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink); padding: 22px 26px 26px; translate: 0 0; scale: .92; opacity: 0; transition: scale 300ms var(--spring), opacity 200ms; }
  .sheet[data-open] .sheet-panel { scale: 1; opacity: 1; }
  .sheet-grip { display: none; }
  #dialog { width: min(460px, calc(100% - 32px)); margin: auto; }
  #dialog[open] { animation: pop-in 350ms var(--spring); }
  .dialog-card { border-radius: var(--r-xl); border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink); padding: 26px; }
  .result-card { grid-template-columns: auto 1fr; align-items: center; gap: clamp(16px, 4vw, 40px); }
  .result-cast { order: 2; }
}

/* ---------- Desktop: side columns for the coach and the exam map ---------- */
@media (min-width: 1100px) {
  .hero { grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: clamp(32px, 4vw, 64px); }
  .landing { padding-top: 16px; }
  .language-name { display: inline; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .language-code { display: none; }
  body[data-tabs="true"] .wordmark-label, body[data-focus="true"] .wordmark-label { display: inline; }
  .language { padding: 0 14px; }
  .dash-grid { grid-template-columns: 1.4fr 1fr; grid-template-rows: auto auto; }
  .learn-card { grid-column: 1; grid-row: 1 / span 2; min-height: 420px; }
  .dash-cast { width: min(170px, 30%); right: 6%; bottom: -70px; }
  .learn-card .dash-copy { max-width: 62%; }
  .quiz-body.with-coach { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; column-gap: 24px; }
  .quiz-body.with-map { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; column-gap: 24px; }
  .with-coach .question, .with-map .question { grid-column: 1; grid-row: 1; }
  .with-coach .action-bar, .with-map .action-bar { grid-column: 1; grid-row: 2; }
  .with-coach .coach { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 96px); flex-direction: column-reverse; align-items: stretch; gap: 22px; }
  .coach-cast { width: 170px; align-self: center; }
  .coach-balloon { margin: 0; transform-origin: 50% 100%; }
  .coach-balloon::after { left: 50%; bottom: -12px; translate: -50% 0; border-width: 0 3px 3px 0; }
  .coach-balloon .comic-why { max-height: 42vh; overflow: auto; }
  .exam-side { display: grid; gap: 14px; grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 96px); padding: 20px; background: var(--white); border: 2px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--lift); }
  .exam-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .exam-side-head h2 { font-size: 1.15rem; }
  .exam-side-head span { font-size: .88rem; color: var(--muted); }
  .exam-side .map-grid { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .exam-side .cell { min-height: 34px; font-size: .82rem; border-radius: 9px; }
  .exam-side .map-legend { margin-top: 0; }
  .quiz[data-mode="exam"] .jump-button, .quiz[data-mode="exam"] .map-toggle, .quiz[data-mode="exam"] .finish-inline { display: none; }
}
@media (min-width: 1440px) {
  .shell { width: min(100% - 2 * var(--gutter), 1320px); }
}

/* Short landscape phones: keep the stage and bars from crowding the question. */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2.4rem; }
  .question-image { max-height: 160px; }
}

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes pop-in { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes float { 50% { transform: translateY(-8px) rotate(-1.5deg); } }
@keyframes drive-in { from { transform: translateY(-46%) scale(.3); opacity: 0; } }
@keyframes car-bob { to { transform: translateY(-1.5px); } }
@keyframes beam { 0%, 80%, 100% { opacity: .9; } 88% { opacity: .2; } }
@keyframes comic-pop { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 60% { opacity: 1; transform: scale(1.05) rotate(1.5deg); } 100% { transform: none; } }
@keyframes burst-in { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.18) rotate(4deg); } 100% { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translateX(-640px); } }
@keyframes dash { to { stroke-dashoffset: -56; } }
@keyframes graze { 0%, 55%, 100% { transform: rotate(0); } 65%, 85% { transform: rotate(32deg); } 75% { transform: rotate(26deg); } }
@keyframes smoke { 0% { transform: translate(0, 8px) scale(.5); opacity: 0; } 30% { opacity: .9; } 100% { transform: translate(10px, -14px) scale(1.3); opacity: 0; } }
@keyframes birds { 50% { transform: translate(-30px, 8px); } }
@keyframes faq-pop { 0%, 35% { transform: scale(.6); opacity: 0; } 50%, 90% { transform: scale(1); opacity: 1; } 100% { transform: scale(.6); opacity: 0; } }
@keyframes mark { 0%, 15% { transform: scaleX(0); } 40%, 85% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes sway { 50% { transform: rotate(4deg); } }
@keyframes draw { 0%, 20% { stroke-dashoffset: 1; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes pick { 0%, 25% { fill: #eeeee3; } 40%, 90% { fill: #d7e7ce; } }
@keyframes wiggle { 25% { transform: rotate(-6deg) scale(1.05); } 60% { transform: rotate(5deg) scale(1.05); } }
@keyframes sheen { to { translate: 120% 0; } }
@keyframes wave { 25% { transform: perspective(300px) rotateY(-14deg) skewY(-2deg); } 60% { transform: perspective(300px) rotateY(10deg) skewY(1.5deg); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes bob { to { transform: translateY(-2px); } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes bump { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes celebrate { 0% { transform: scale(1); } 35% { transform: scale(1.03) translateY(-3px); } 100% { transform: scale(1); } }
@keyframes shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }
@keyframes unfold { from { opacity: 0; transform: translateY(-8px) scaleY(.92); } }
@keyframes bar-up { from { transform: translateY(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes loader { from { left: 0; } to { left: calc(100% - 30px); } }
@keyframes busy { from { left: -30%; } to { left: 100%; } }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: .9; } }
@keyframes glow { 50% { opacity: .12; } }

/* Phones and tablets scroll by touch, like native apps: no visible scrollbars, scrolling still works. */
@media (max-width: 1099.98px), (pointer: coarse) {
  html, .sheet-panel, .chunk-tabs, .comic-why { scrollbar-width: none; }
  html::-webkit-scrollbar, .sheet-panel::-webkit-scrollbar, .chunk-tabs::-webkit-scrollbar, .comic-why::-webkit-scrollbar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .m-lid { transform: scaleY(0); }
}

/* Account administration uses the same surfaces as the student's dashboard. */
#password-form + .actions { margin-top: 14px; }
.admin-panel { margin-top: 20px; padding: clamp(14px, 3vw, 28px); background: var(--white); border: 2px solid var(--line); border-radius: var(--r-lg); }
.admin-panel h2 { margin-bottom: 12px; }
.admin-table { overflow-x: auto; padding-bottom: 5px; }
.admin-table table { width: 100%; border-collapse: collapse; text-align: left; }
.admin-table :is(th, td) { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.admin-table th[scope="row"] { overflow-wrap: anywhere; }
.admin-table .button { white-space: nowrap; }
.admin-pages, .admin-course { margin-top: 16px; }
.admin-student-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-student-head h2 { margin-bottom: 4px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)); gap: 12px; }
.admin-stats dd, .billing-history li { overflow-wrap: anywhere; }
.billing-form { display: grid; gap: 12px; margin-block: 12px; }
.billing-form .button { justify-self: start; }
.billing-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); gap: 12px; }
.billing-form label { display: grid; align-content: start; gap: 4px; min-width: 0; font-weight: 700; }
.billing-form :is(input:not([type="hidden"]), select) {
  font: inherit; font-weight: 500; width: 100%; min-width: 0; min-height: 44px;
  padding: 8px 10px; border: 2px solid var(--line); border-radius: var(--r-md);
  color: var(--ink); background: var(--white);
}
.admin-search { grid-template-columns: minmax(0, 360px) auto; align-items: end; justify-content: start; }
.billing-fold { border-top: 1px solid var(--line); padding-block: 6px; margin-top: 6px; }
.billing-fold > summary { cursor: pointer; min-height: 44px; padding-block: 10px; font-weight: 800; overflow-wrap: anywhere; }
.billing-fold > p { max-width: 70ch; margin-block: 4px 12px; }
.billing-heading { margin-top: 20px; margin-bottom: 6px; }
.billing-history { margin-block: 8px 12px; padding-inline-start: 20px; }
.billing-history li { margin-bottom: 6px; }
.billing-actions { margin-top: 12px; }
.billing-actions:empty, .billing-form output:empty { display: none; }
.billing-form output { font-weight: 800; }
.billing-result { margin-block: 10px; }
.google-fold > summary { cursor: pointer; min-height: 44px; padding-block: 10px; font-weight: 800; }
.google-form, .google-form label { display: grid; gap: 8px; }
.google-form { max-width: 24rem; margin-top: 12px; }
.google-form input {
  min-width: 0; min-height: 44px; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--white); border: 2px solid var(--line); border-radius: var(--r-md);
}
.google-form button { justify-self: start; }
#reset-result p { margin-top: 15px; padding: 10px 12px; border-radius: var(--r-md); background: var(--gold-soft); color: var(--ink); overflow-wrap: anywhere; }
#reset-result code { display: inline-block; font-weight: 800; user-select: all; }
