:root {
  --bg: #0b1020;
  --bg-raised: #10172d;
  --bg-card: #131b34;
  --panel: rgba(16, 23, 45, 0.96);
  --line: #243050;
  --text: #e7ecf6;
  --muted: #8b95b2;
  --soft: #aab3cc;
  --accent: #5eead4;
  --accent-ink: #052e29;
  --violet: #a78bfa;
  --danger: #f87171;
  --warn: #fbbf24;
  --gold: #fbbf24;
  --ice: #7dd3fc;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}

/* Finger colors, used by keys, hands and hints */
.f-pinky  { --fc: #f472b6; }
.f-ring   { --fc: #c084fc; }
.f-middle { --fc: #60a5fa; }
.f-index  { --fc: #34d399; }
.f-thumb  { --fc: #fbbf24; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(120% 60% at 50% -10%, #17214a 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
body[data-view="arcade"] { overflow: hidden; }

a { color: inherit; }
button { font-family: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  font: 600 12px/1.5 var(--mono);
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.sound-btn .waves,
.sound-btn .cross { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sound-btn[aria-pressed="true"] .waves,
.sound-btn[aria-pressed="false"] .cross { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: 600 16px var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary kbd { border-color: rgba(5, 46, 41, 0.3); background: rgba(5, 46, 41, 0.12); color: var(--accent-ink); }

.link-btn {
  margin-top: 16px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); text-decoration: underline; }
.link-btn.armed { color: var(--danger); font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

/* Stars */
.stars { display: inline-flex; gap: 2px; }
.star svg { display: block; width: 16px; height: 16px; fill: var(--line); }
.star.on svg { fill: var(--gold); }

/* ================= Home (lesson map) ================= */

.home {
  max-width: 1120px;
  margin: 0 auto;
  padding-block: 28px 48px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; color: var(--muted); }

.logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 800 20px var(--sans);
  box-shadow: 0 4px 0 #2bb9a5, 0 10px 30px rgba(94, 234, 212, 0.25);
}

.head-actions { display: flex; align-items: center; gap: 10px; }

.star-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  font-family: var(--mono);
}
.star-total svg { width: 18px; height: 18px; fill: var(--gold); }

.touch-note {
  display: none;
  margin: 20px 0 0;
  padding: 10px 14px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--warn);
  font-weight: 600;
}
@media (hover: none) and (pointer: coarse) {
  .touch-note { display: block; }
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-top: 26px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.hero-card:hover { transform: translateY(-2px); }
.hero-title { font-size: 24px; font-weight: 700; }
.hero-sub { color: var(--soft); font-size: 14px; }

.continue-card {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.2), rgba(94, 234, 212, 0.04) 60%), var(--bg-card);
  border-color: rgba(94, 234, 212, 0.45);
}
.continue-card:hover { box-shadow: 0 10px 40px rgba(94, 234, 212, 0.18); }
.continue-card .eyebrow { color: var(--accent); }

.arcade-card {
  background:
    repeating-linear-gradient(100deg, transparent 0 22px, rgba(150, 180, 255, 0.05) 22px 23px),
    linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(167, 139, 250, 0.04) 60%), var(--bg-card);
  border-color: rgba(167, 139, 250, 0.45);
}
.arcade-card:hover { box-shadow: 0 10px 40px rgba(167, 139, 250, 0.2); }
.arcade-card .eyebrow { color: var(--violet); }

/* ---------- Smart practice, speed test & progress panel ---------- */
.drills { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.drill-card {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(251, 191, 36, 0.03) 60%), var(--bg-card);
  border-color: rgba(251, 191, 36, 0.4);
}
.drill-card:hover { box-shadow: 0 10px 40px rgba(251, 191, 36, 0.16); }
.drill-card .eyebrow { color: var(--gold); }

.stats-panel {
  margin-top: 28px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--bg-raised);
}
.stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.stats-head h2 { margin: 0; font-size: 21px; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-card); }
.chip-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.chip strong { font: 600 15px var(--mono); }
.stats-body { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-top: 16px; }
.stats-box { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); }
.stats-box .label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.st-chart svg { display: block; width: 100%; height: 150px; }
.st-chart .grid { stroke: var(--line); stroke-width: 1; }
.st-chart .axis { fill: var(--muted); font: 11px var(--mono); }
.st-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.st-chart .dot { fill: var(--accent); }
.st-chart .empty { fill: var(--muted); font: 13px var(--sans); }
.legend { margin-left: 8px; font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin: 0 3px 0 8px; border-radius: 3px; vertical-align: -1px; }
.lg-good { background: hsl(150 60% 40%); }
.lg-weak { background: hsl(0 65% 50%); }
.lg-none { background: #1e2742; }
.stats-box { container-type: inline-size; }
/* Size the heatmap keys from the box itself: 15 key widths + 14 gaps (10% of a key each) = 16.4 keys. */
.keyboard.heat { --u: clamp(12px, calc(100cqw / 16.6), 40px); margin: 0; }
.keyboard.heat .kb-label { font-size: calc(var(--u) * 0.3); }
.keyboard.heat .key { background: #1e2742; border-color: transparent; color: var(--soft); box-shadow: none; }
.keyboard.heat .key.rated { background: var(--heat); color: #fff; }
.keyboard.heat .kb-shift { display: none; }

@media (max-width: 760px) {
  .drills, .stats-body { grid-template-columns: 1fr; }
}

/* ---------- duggu.uk link, coins ---------- */
.site-bar { margin: -10px 0 14px; font-size: 13px; }
.site-bar a { color: var(--muted); text-decoration: none; }
.site-bar a:hover { color: var(--text); text-decoration: underline; }

.coin-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  background: var(--bg-raised);
  font-family: var(--mono);
}
.coin {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4 0 16%, #fbbf24 46%, #d97706 100%);
  box-shadow: inset 0 0 0 2px rgba(146, 64, 14, 0.45);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ================= The trail (world map) ================= */

.trail { margin-top: 32px; }
.trail-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.trail-intro h2 { margin: 0; font-size: 21px; }
.trail-intro p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.preview-note {
  margin: 0 0 14px;
  padding: 8px 14px;
  border: 1px dashed rgba(94, 234, 212, 0.5);
  border-radius: 12px;
  background: rgba(94, 234, 212, 0.07);
  color: var(--soft);
  font-size: 14px;
}
.preview-note strong { color: var(--accent); }
.preview-note .link-btn { margin: 0 0 0 6px; padding: 0 4px; color: var(--accent); }

.world-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--bg-raised); }
.world { position: relative; isolation: isolate; min-height: 400px; }

/* Each place's colours; used by its band of scenery and by the stops inside it. */
.t-meadow    { --place: #86efac; }
.t-mountains { --place: #c7d2fe; }
.t-caves     { --place: #d8b4fe; }
.t-harbour   { --place: #7dd3fc; }
.t-city      { --place: #fcd34d; }
.t-sky       { --place: #f9a8d4; }

.region { position: absolute; left: 0; right: 0; overflow: hidden; }
.region.t-meadow    { background: linear-gradient(180deg, #173f2b 0%, #1c4a32 55%, #1a4630 100%); }
.region.t-mountains { background: linear-gradient(180deg, #1c2550 0%, #26336a 70%, #2b3a78 100%); }
.region.t-caves     { background: linear-gradient(180deg, #17122c 0%, #120e22 60%, #1a1433 100%); }
.region.t-harbour   { background: linear-gradient(180deg, #0f2e47 0%, #0f3b58 50%, #0c3350 100%); }
.region.t-city      { background: linear-gradient(180deg, #21183a 0%, #2a1d44 60%, #1c1530 100%); }
.region.t-sky       { background: linear-gradient(180deg, #13214f 0%, #1a2a66 55%, #2a2470 100%); }
.region .decor, .region .decor svg { position: absolute; top: 0; left: 0; display: block; }

.region-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 20px 22px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.region-title { min-width: 0; max-width: 560px; }
.region-head .eyebrow { color: var(--place); }
.region-head h3 { margin: 2px 0 0; font-size: 24px; letter-spacing: -0.01em; }
.region-head p { margin: 4px 0 0; color: var(--soft); font-size: 14px; }
.region-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(5, 8, 20, 0.5);
  font: 600 13px var(--mono);
  text-shadow: none;
}
.region-chip svg { width: 13px; height: 13px; fill: currentColor; }
.region-chip.locked { color: var(--muted); font-family: var(--sans); }

.video-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  background: rgba(8, 12, 26, 0.6);
  color: var(--text);
  font: inherit;
  text-align: left;
  text-shadow: none;
  cursor: pointer;
}
.video-chip:hover { background: rgba(251, 191, 36, 0.16); }
.video-chip-play { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); }
.video-chip-play svg { width: 16px; height: 16px; margin-left: 2px; fill: #0b1020; }
.video-chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.video-chip-text strong { font-size: 14px; }
.video-chip-text small { color: var(--muted); font-size: 12px; }

/* The path itself: a wide dirt track, the part already walked, and dotted footsteps. */
.trail-svg { position: absolute; top: 0; left: 0; z-index: 1; overflow: visible; pointer-events: none; }
.trail-bed, .trail-walked, .trail-steps { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trail-bed { stroke: rgba(254, 243, 199, 0.13); stroke-width: 26; }
.trail-walked { stroke: rgba(253, 224, 71, 0.3); stroke-width: 26; }
.trail-steps { stroke: rgba(255, 255, 255, 0.55); stroke-width: 4; stroke-dasharray: 0.1 14; }

/* Stops: one per lesson. */
.stop {
  position: absolute;
  z-index: 3;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.stop-dot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: #2a3152;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.35);
  font: 800 18px var(--mono);
  transition: transform 0.15s;
}
.stop:hover .stop-dot { transform: scale(1.08); }
.stop.done .stop-dot { background: var(--place); border-color: #fff; color: #0b1020; }
.stop.open .stop-dot { background: #fff; color: #0b1020; }
.stop.current .stop-dot { animation: stop-glow 1.6s ease-in-out infinite; }
@keyframes stop-glow {
  0%, 100% { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(94, 234, 212, 0.6); }
  50% { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 0 0 14px rgba(94, 234, 212, 0); }
}
.stop.locked { cursor: default; }
.stop.locked .stop-dot { background: #20263f; border-color: rgba(255, 255, 255, 0.25); color: var(--muted); }
.stop.locked:hover .stop-dot { transform: none; }
.stop-lock svg { display: block; width: 18px; height: 18px; fill: currentColor; }
.stop:focus-visible { outline: none; }
.stop:focus-visible .stop-dot { outline: 3px solid var(--accent); outline-offset: 3px; }

.stop-label {
  position: absolute;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: max-content;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(8, 12, 26, 0.74);
  text-align: left;
  transform: translateY(-50%);
}
.label-right .stop-label { left: calc(100% + 12px); align-items: flex-start; }
.label-left .stop-label { right: calc(100% + 12px); align-items: flex-end; text-align: right; }
.label-left .lesson-keys { justify-content: flex-end; }
.stop-title { font-size: 15px; font-weight: 700; line-height: 1.25; }
.stop.locked .stop-label { opacity: 0.7; }
.stop-locked { color: var(--muted); font-size: 12px; }

.trail-end { position: absolute; z-index: 3; width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.end-dot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #fbbf24 55%, #d97706);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(251, 191, 36, 0.45);
  color: #78350f;
}
.end-dot svg { width: 30px; height: 30px; }
.end-sub { color: var(--soft); font-size: 13px; }

/* The avatar stands on top of its stop; world.js moves it with transform (and nudges the label of the
   stop before it out of the way when they would meet, so the avatar never hides that lesson's stars). */
.avatar { position: absolute; top: 0; left: 0; z-index: 4; width: 0; height: 0; pointer-events: none; }
.avatar svg {
  position: absolute;
  left: -21px;
  top: -80px;
  width: 42px;
  height: 57px;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.avatar.face-left svg { transform: scaleX(-1); }
.av-shirt { fill: var(--avatar-shirt, #f97316); }
.av-cap { fill: var(--avatar-cap, #ef4444); }
.av-body, .leg-l, .leg-r { transform-box: view-box; }
.av-body { transform-origin: 20px 52px; animation: av-idle 2.4s ease-in-out infinite; }
.leg-l, .leg-r { transform-origin: 20px 37px; }
.avatar.walking .av-body { animation: av-bob 0.33s ease-in-out infinite alternate; }
.avatar.walking .leg-l { animation: av-leg 0.33s ease-in-out infinite alternate; }
.avatar.walking .leg-r { animation: av-leg 0.33s ease-in-out infinite alternate-reverse; }
@keyframes av-idle { 50% { transform: translateY(-1.5px); } }
@keyframes av-bob { to { transform: translateY(-3px); } }
@keyframes av-leg { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }

@media (max-width: 640px) {
  .region-head { padding: 16px 16px 0; }
  .region-head h3 { font-size: 20px; }
  .stop-title { font-size: 14px; }
}

.up-next {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}
.lesson-keys { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.lesson-keys kbd { color: var(--fc, var(--text)); border-color: color-mix(in srgb, var(--fc, #8b95b2) 55%, transparent); }
.practice { color: var(--muted); font-size: 13px; }

/* Coins on the finish screen */
.finish-coins { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: 18px 0 0; }
.finish-coins .coin { width: 22px; height: 22px; }
.finish-coins strong { color: var(--gold); font: 700 20px var(--mono); }
.coin-math { flex-basis: 100%; color: var(--muted); font-size: 13px; }

.home-foot { margin-top: 40px; text-align: center; }

.home-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  max-width: calc(100% - 32px);
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.home-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= Lesson ================= */

.lesson {
  max-width: 1040px;
  margin: 0 auto;
  padding-block: 16px 28px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.lesson-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.lesson-name { flex: 1; min-width: 180px; }
.lesson-name h1 { margin: 2px 0 0; font-size: 22px; }

.toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.pill {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pill:hover { color: var(--text); }
.pill[aria-pressed="true"] { color: var(--accent); border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.08); }
.pill[aria-pressed="true"]::before { content: "✓ "; }

.lesson-body { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

/* ---------- Read aloud: the guide's speech bubble and settings ---------- */
.coach-pill[aria-expanded="true"] { color: var(--text); border-color: var(--violet); background: rgba(167, 139, 250, 0.12); }
.coach-pill.off { opacity: 0.7; text-decoration: line-through; text-decoration-thickness: 1px; }
.coach-face {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(167, 139, 250, 0.16);
  border: 1px solid rgba(167, 139, 250, 0.45);
  font-size: 22px;
  line-height: 1;
}
.coach-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 14px 6px 8px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.12), rgba(167, 139, 250, 0.03));
  border: 1px solid rgba(167, 139, 250, 0.3);
}
.coach-bubble[hidden] { display: none; }
.coach-bubble p { margin: 0; color: var(--soft); font-size: 14.5px; line-height: 1.4; }
.coach-bubble strong { color: var(--violet); }
.coach-bubble.talking .coach-face { animation: coach-bob 0.6s ease-in-out infinite alternate; }
@keyframes coach-bob { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-3px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .coach-bubble.talking .coach-face { animation: none; } }

.coach-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: 16px;
  background: var(--bg-card);
}
.coach-panel[hidden] { display: none; }
.coach-panel-head { display: flex; align-items: center; gap: 12px; }
.coach-panel-head .coach-face { width: 48px; height: 48px; font-size: 27px; }
.coach-panel h2 { margin: 0; font-size: 18px; }
.coach-who { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.coach-row { display: grid; gap: 6px; }
.coach-row input[type="range"] { width: min(100%, 320px); accent-color: var(--violet); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn:hover { color: var(--text); border-color: var(--muted); }
.seg-btn[aria-pressed="true"] { color: var(--text); border-color: var(--violet); background: rgba(167, 139, 250, 0.18); }
.coach-note { margin: 0; color: var(--muted); font-size: 13px; }
.coach-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card);
}
.tip p { flex: 1; min-width: 220px; margin: 0; color: var(--soft); }
.tip-keys { display: flex; align-items: center; gap: 8px; }
.big-key {
  min-width: 38px;
  padding: 4px 10px;
  font-size: 18px;
  color: var(--fc, var(--text));
  border-color: var(--fc, var(--line));
  background: color-mix(in srgb, var(--fc, #ffffff) 12%, transparent);
}

.meters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; }
.meter { display: flex; flex-direction: column; gap: 2px; }
.meter .value { font: 600 22px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.meter small { font-size: 13px; color: var(--muted); }

.progress {
  flex: 1;
  min-width: 160px;
  height: 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #a7f3d0);
  transition: width 0.2s ease-out;
}

.text-box {
  --line-h: 62px;
  position: relative;
  height: calc(3 * var(--line-h));
  padding: 0 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-card);
  font: 500 34px var(--mono);
}

.lines { transition: transform 0.25s ease-out; }

.line {
  display: flex;
  height: var(--line-h);
  white-space: pre;
}

.char {
  position: relative;
  display: inline-block;
  line-height: var(--line-h);
  color: #7f8aa8;
  border-radius: 6px;
}
.char.correct { color: var(--accent); }
.char.fixed { color: var(--warn); }
.char.current {
  color: var(--text);
  background: rgba(94, 234, 212, 0.14);
  box-shadow: inset 0 -4px 0 var(--accent);
}
.char.error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.18);
  box-shadow: inset 0 -4px 0 var(--danger);
}
/* The key that was pressed by mistake, shown above the letter */
.char[data-typed]::after {
  content: attr(data-typed);
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 4px;
  border-radius: 4px;
  background: var(--danger);
  color: #2a0909;
  font: 700 11px/16px var(--sans);
}
.char.shake { animation: shake 0.25s; }

.start-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  transition: opacity 0.3s;
}
.start-hint.gone { opacity: 0; }

.caps-warn {
  align-self: center;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  font-weight: 600;
}

.finger-hint {
  min-height: 30px;
  margin: 0;
  color: var(--soft);
  font-size: 17px;
  text-align: center;
}
.finger-hint kbd { font-size: 15px; }
.finger-name { color: var(--fc); font-weight: 700; }
.hint-done { color: var(--accent); font-weight: 700; }

/* On-screen keyboard. Every row is 15 key-widths wide, so the rows line up. */
.keyboard {
  --u: clamp(14px, min(calc((100vw - 72px) / 16), calc((100vh - 560px) / 5.6)), 48px);
  --gap: calc(var(--u) * 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  margin-top: 4px;
  user-select: none;
}
.kb-row { display: flex; gap: var(--gap); }

.key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: calc(var(--w) * var(--u) + (var(--w) - 1) * var(--gap));
  height: var(--u);
  border: 1px solid color-mix(in srgb, var(--fc) 32%, transparent);
  border-radius: calc(var(--u) * 0.18);
  background: color-mix(in srgb, var(--fc) 11%, #141c36);
  color: #c9d1e6;
  font: 600 calc(var(--u) * 0.36) / 1 var(--sans);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.kb-shift, .kb-base { font-size: calc(var(--u) * 0.27); line-height: 1.15; }
.kb-shift { color: var(--muted); }
.kb-label { font-size: calc(var(--u) * 0.25); color: var(--muted); font-weight: 600; }
.key.bump::after {
  content: "";
  position: absolute;
  bottom: calc(var(--u) * 0.14);
  width: 28%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.6;
}
.key.next {
  z-index: 1;
  background: var(--fc);
  border-color: var(--fc);
  color: #0b1020;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc) 35%, transparent), 0 0 24px color-mix(in srgb, var(--fc) 60%, transparent);
  animation: pulse 1.1s ease-in-out infinite;
}
.key.next .kb-shift, .key.next .kb-label { color: rgba(11, 16, 32, 0.7); }
.key.pressed { animation: press 0.18s ease-out; }
.key.wrong { animation: wrong-key 0.4s ease-out; }

@keyframes pulse {
  50% { transform: translateY(-2px) scale(1.04); }
}
@keyframes press {
  40% { transform: translateY(2px); box-shadow: none; filter: brightness(1.3); }
}
@keyframes wrong-key {
  0%, 60% { background: var(--danger); border-color: var(--danger); color: #2a0909; }
}

/* Hands */
.hands { width: min(360px, 70vw); margin: 0 auto; }
.hands svg { display: block; width: 100%; height: auto; }
.palm { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.14); stroke-width: 2; }
.finger {
  fill: color-mix(in srgb, var(--fc) 10%, #10172d);
  stroke: color-mix(in srgb, var(--fc) 55%, transparent);
  stroke-width: 2;
  transition: fill 0.15s;
}
.finger.active { fill: var(--fc); filter: drop-shadow(0 0 8px var(--fc)); }

/* Lesson results */
.overlay.fixed { position: fixed; z-index: 60; }

.big-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.big-stars .star { animation: star-pop 0.5s both; }
.big-stars .star svg { width: 46px; height: 46px; }
.big-stars .star.on svg { filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.5)); }
@keyframes star-pop {
  from { transform: scale(0.2) rotate(-40deg); opacity: 0; }
  70% { transform: scale(1.2); opacity: 1; }
  to { transform: scale(1); }
}

.results.three { grid-template-columns: repeat(3, 1fr); }
.results small { font-size: 13px; color: var(--muted); }

.trouble {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 18px;
}
.trouble-key { color: var(--danger); font: 600 14px var(--mono); }
.trouble-key kbd { font-size: 15px; }

#confetti { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti linear forwards;
}
@keyframes confetti {
  to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); }
}

/* ================= Arcade: Word Rain ================= */

.arcade {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.hud {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.stats { display: flex; flex-wrap: wrap; gap: 32px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.stat .label { display: block; }
.stat .value { font: 600 22px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.mult { margin-left: 8px; font-size: 14px; color: var(--muted); transition: color 0.2s; }
.mult.hot { color: var(--gold); }
.lives { letter-spacing: 2px; color: var(--danger); }
.heart.lost { color: var(--line); }
.controls { display: flex; gap: 8px; }
.arcade:not([data-state="playing"]) #pauseBtn { visibility: hidden; }

#field {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% -10%, #1a2552 0%, var(--bg) 60%);
}

#rain, #words, #effects, #frost, #flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.drop {
  position: absolute;
  top: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(150, 180, 255, 0.22));
  animation: drop linear infinite;
}
@keyframes drop {
  from { transform: translateY(-140px); }
  to   { transform: translateY(100vh); }
}

.word {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 10px;
  font: 500 22px/1.2 var(--mono);
  white-space: nowrap;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  will-change: transform;
  transition: color 0.25s, border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
}
.word .done { color: var(--accent); }
.word.danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.45); }
.word.gold { color: var(--gold); border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.1); }
.word.ice { color: var(--ice); border-color: rgba(125, 211, 252, 0.55); background: rgba(125, 211, 252, 0.1); }
.word.gold::before { content: "★"; margin-right: 6px; }
.word.ice::before { content: "❄"; margin-right: 6px; }
.word.target {
  z-index: 1;
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.12);
  box-shadow: 0 0 22px rgba(94, 234, 212, 0.28);
}
/* Words are positioned with transform, so the "wrong key" cue must not animate transform. */
.word.wrong { animation: wrong-word 0.25s; }
@keyframes wrong-word {
  30% { background-color: rgba(248, 113, 113, 0.35); border-color: var(--danger); }
}

#ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(248, 113, 113, 0.7) 20%, rgba(248, 113, 113, 0.7) 80%, transparent);
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.4);
}

.typed {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 24px var(--mono);
}
.typed .done { color: var(--accent); }
.typed .rest { color: var(--muted); }
.typed .hint { font: 15px var(--sans); color: var(--muted); }
.typed .caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin: 0 1px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.typed.shake { animation: shake 0.3s; }
.arcade.shake { animation: shake 0.35s; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes shake {
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.shard {
  position: absolute;
  font: 500 22px/1.2 var(--mono);
  color: var(--accent);
  animation: fly 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.shard.gold { color: var(--gold); }
.shard.ice { color: var(--ice); }
.shard.crumble { color: var(--danger); animation: crumble 0.8s ease-in forwards; }
.shard.fizzle { color: var(--muted); animation: fizzle 0.6s ease-out forwards; }

@keyframes fly {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(0.6); opacity: 0; }
}
@keyframes crumble {
  to { transform: translate(calc(var(--dx) * 0.4), 70px) rotate(var(--r)); opacity: 0; }
}
@keyframes fizzle {
  to { transform: scale(0.4); opacity: 0; }
}

.popup {
  position: absolute;
  font: 700 18px var(--mono);
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  animation: rise 0.9s ease-out forwards;
}
@keyframes rise {
  from { transform: translate(-50%, 0); opacity: 1; }
  to   { transform: translate(-50%, -44px); opacity: 0; }
}

#frost {
  opacity: 0;
  transition: opacity 0.5s;
  background: rgba(125, 211, 252, 0.05);
  box-shadow: inset 0 0 140px rgba(125, 211, 252, 0.35);
}
#frost.on { opacity: 1; }

#flash { opacity: 0; }
#flash.hurt { background: radial-gradient(120% 60% at 50% 100%, rgba(248, 113, 113, 0.5), transparent 70%); animation: flash 0.45s ease-out; }
#flash.gold { background: radial-gradient(circle, rgba(251, 191, 36, 0.45), transparent 70%); animation: flash 0.6s ease-out; }
#flash.ice  { background: rgba(125, 211, 252, 0.25); animation: flash 0.5s ease-out; }
@keyframes flash {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.toast {
  position: absolute;
  top: 32%;
  left: 50%;
  transform: translate(-50%, -50%);
  font: 800 clamp(28px, 6vw, 48px) var(--sans);
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--violet);
  text-shadow: 0 0 30px rgba(167, 139, 250, 0.5);
  opacity: 0;
  pointer-events: none;
}
.toast.gold { color: var(--gold); text-shadow: 0 0 30px rgba(251, 191, 36, 0.5); }
.toast.ice { color: var(--ice); text-shadow: 0 0 30px rgba(125, 211, 252, 0.5); }
.toast.show { animation: toast 1.5s ease-out; }
@keyframes toast {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%); }
}

/* ================= Overlays & panels (shared) ================= */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(8px);
}

.panel {
  width: min(540px, 100%);
  padding: 32px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.panel.small { width: min(360px, 100%); }
.panel h2 { margin: 0 0 6px; font-size: 30px; }

.title {
  margin: 0;
  font: 800 clamp(40px, 9vw, 60px)/1 var(--sans);
  letter-spacing: -0.02em;
}
.title span { color: var(--accent); }

.tagline, .sub { margin: 10px 0 0; color: var(--muted); }

.difficulty {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 26px 0 14px;
}
.diff {
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: 600 16px var(--sans);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.diff small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.diff:hover { border-color: var(--muted); }
.diff.selected { border-color: var(--accent); background: rgba(94, 234, 212, 0.1); }

.best { margin: 0; color: var(--muted); }
.best strong { color: var(--text); font-family: var(--mono); }

.help {
  margin: 26px 0 0;
  padding: 18px 0 0;
  list-style: none;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}
.tag.gold { color: var(--gold); }
.tag.ice { color: var(--ice); }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: #2b1d00;
  font-size: 13px;
  font-weight: 700;
}

.results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0 0;
}
.results div {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.results dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.results dd { margin: 4px 0 0; font: 600 24px var(--mono); }

/* ================= Home: games & video tiles ================= */

.games { display: grid; gap: 12px; }
.hero .drills { grid-template-columns: 1fr; margin-top: 0; } /* practice and test stack beside the continue card */

/* ---------- Games ---------- */
.game-zone { margin-top: 32px; }
.zone-head { margin-bottom: 14px; }
.zone-head h2 { margin: 0; font-size: 21px; }
.zone-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.game-zone .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.game-card { flex-direction: row; align-items: center; gap: 16px; padding: 16px 20px; }
.game-card .hero-title { display: block; font-size: 20px; }
.game-card .hero-sub { display: block; }
.game-icon { font-size: 34px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }

.balloon-card {
  background:
    radial-gradient(circle at 88% 15%, rgba(244, 114, 182, 0.3), transparent 45%),
    linear-gradient(135deg, rgba(251, 113, 133, 0.18), rgba(96, 165, 250, 0.08) 60%), var(--bg-card);
  border-color: rgba(244, 114, 182, 0.45);
}
.balloon-card:hover { box-shadow: 0 10px 40px rgba(244, 114, 182, 0.2); }
.balloon-card .eyebrow { color: #f9a8d4; }

/* The six newer games: one colour theme each (moonlit heist, lighthouse beam, ice, stage lights, curtain, night sky). */
.tiptoe-heist-card {
  background:
    radial-gradient(circle at 88% 18%, rgba(224, 231, 255, 0.28), transparent 22%),
    linear-gradient(135deg, rgba(129, 140, 248, 0.22), rgba(30, 27, 75, 0.2) 60%), var(--bg-card);
  border-color: rgba(129, 140, 248, 0.45);
}
.tiptoe-heist-card:hover { box-shadow: 0 10px 40px rgba(129, 140, 248, 0.22); }
.tiptoe-heist-card .eyebrow { color: #a5b4fc; }

.harbour-signals-card {
  background:
    conic-gradient(from 200deg at 92% 10%, transparent 0deg, rgba(251, 191, 36, 0.22) 18deg, transparent 40deg),
    linear-gradient(135deg, rgba(251, 146, 60, 0.18), rgba(14, 116, 144, 0.12) 60%), var(--bg-card);
  border-color: rgba(251, 146, 60, 0.45);
}
.harbour-signals-card:hover { box-shadow: 0 10px 40px rgba(251, 146, 60, 0.2); }
.harbour-signals-card .eyebrow { color: #fdba74; }

.snowflake-studio-card {
  background:
    radial-gradient(circle at 86% 20%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(56, 189, 248, 0.05) 60%), var(--bg-card);
  border-color: rgba(125, 211, 252, 0.5);
}
.snowflake-studio-card:hover { box-shadow: 0 10px 40px rgba(125, 211, 252, 0.22); }
.snowflake-studio-card .eyebrow { color: var(--ice); }

.follow-me-orchestra-card {
  background:
    radial-gradient(ellipse at 50% -20%, rgba(253, 230, 138, 0.22), transparent 55%),
    linear-gradient(135deg, rgba(251, 113, 133, 0.2), rgba(167, 139, 250, 0.08) 60%), var(--bg-card);
  border-color: rgba(251, 113, 133, 0.45);
}
.follow-me-orchestra-card:hover { box-shadow: 0 10px 40px rgba(251, 113, 133, 0.2); }
.follow-me-orchestra-card .eyebrow { color: #fda4af; }

.stringalong-theatre-card {
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 14px, rgba(0, 0, 0, 0.12) 14px 22px),
    linear-gradient(135deg, rgba(220, 38, 38, 0.26), rgba(251, 191, 36, 0.06) 65%), var(--bg-card);
  border-color: rgba(239, 68, 68, 0.45);
}
.stringalong-theatre-card:hover { box-shadow: 0 10px 40px rgba(239, 68, 68, 0.2); }
.stringalong-theatre-card .eyebrow { color: #fca5a5; }

.domino-moonshot-card {
  background:
    radial-gradient(circle at 87% 22%, rgba(254, 243, 199, 0.5), rgba(251, 191, 36, 0.18) 9%, transparent 24%),
    linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(15, 23, 42, 0.3) 60%), var(--bg-card);
  border-color: rgba(250, 204, 21, 0.4);
}
.domino-moonshot-card:hover { box-shadow: 0 10px 40px rgba(250, 204, 21, 0.18); }
.domino-moonshot-card .eyebrow { color: #fde68a; }

.video-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.video-btn svg { width: 14px; height: 14px; fill: currentColor; }
.video-btn:hover { background: rgba(251, 191, 36, 0.2); }

/* ================= Video lesson player ================= */

body.video-open { overflow: hidden; }

.video-modal:focus { outline: none; } /* it takes focus when it opens, only so keys go to the video */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(4, 6, 14, 0.88);
  backdrop-filter: blur(6px);
}
.video-wrap { width: min(980px, 100%); }
.video-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.video-top h2 { margin: 2px 0 0; font-size: 22px; }

.player {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #070b18;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.player:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; }
.player:fullscreen .v-stage { width: min(100vw, calc((100vh - 60px) * 16 / 9)); margin: 0 auto; }

/* The stage is 16:9; everything inside is sized in cqw (1% of the stage width) so it scales like a video. */
.v-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  container-type: inline-size;
  background: radial-gradient(120% 90% at 50% 0%, #1b2756 0%, #0b1020 65%);
  cursor: pointer;
  user-select: none;
}
.v-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8cqw;
  width: 100%;
  height: 13cqw;
  padding-top: 1.5cqw;
}
.v-chapter { font: 700 1.25cqw var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.v-headline { font: 700 3.4cqw/1.25 var(--sans); white-space: nowrap; }
.v-headline .hl { color: var(--accent); }
.v-headline .arrow { color: var(--muted); }
.v-headline .fname { color: var(--fc); }
.v-headline .cap {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 0.2cqw solid var(--fc);
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--fc) 14%, transparent);
  color: var(--fc);
  font-family: var(--mono);
  text-align: center;
}
.v-headline .typed-done { color: var(--accent); font-family: var(--mono); }
.v-headline .typed-rest { color: var(--muted); font-family: var(--mono); }
.v-headline .typed-caret {
  display: inline-block;
  width: 0.12em;
  height: 1em;
  vertical-align: -0.12em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.v-tips { display: flex; gap: 1.2cqw; }
.v-tip {
  padding: 0.5cqw 1.3cqw;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  font: 600 1.7cqw var(--sans);
  animation: tip-in 0.4s both;
}
@keyframes tip-in { from { opacity: 0; transform: translateY(8px) scale(0.9); } }

.v-stage .keyboard { --u: 4.4cqw; --gap: calc(var(--u) * 0.1); margin-top: 1cqw; transition: opacity 0.4s; }
.v-stage .hands { width: 26cqw; margin: 1.2cqw auto 0; transition: opacity 0.4s; }
.v-stage.faded .keyboard, .v-stage.faded .hands { opacity: 0.18; }
.v-stage .key { transition: background-color 0.25s, color 0.25s, box-shadow 0.25s, opacity 0.25s, transform 0.12s; }
.v-stage .key.v-lit {
  background: var(--fc);
  border-color: var(--fc);
  color: #0b1020;
  box-shadow: 0 0 0 0.25cqw color-mix(in srgb, var(--fc) 35%, transparent), 0 0 2cqw color-mix(in srgb, var(--fc) 55%, transparent);
}
.v-stage .key.v-lit .kb-shift, .v-stage .key.v-lit .kb-label { color: rgba(11, 16, 32, 0.7); }
.v-stage .key.v-press { transform: translateY(0.25cqw) scale(0.92); filter: brightness(1.25); }
.v-stage .key.v-dim { opacity: 0.3; }
.v-stage .key.v-ring::before {
  content: "";
  position: absolute;
  inset: -0.6cqw;
  border: 0.3cqw solid var(--fc);
  border-radius: calc(var(--u) * 0.3);
  animation: ring-pulse 1.2s ease-out infinite;
}
@keyframes ring-pulse {
  from { transform: scale(0.9); opacity: 1; }
  to { transform: scale(1.35); opacity: 0; }
}

.v-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8cqw;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(94, 234, 212, 0.12), transparent 60%);
  animation: card-in 0.6s both;
}
.v-card .eyebrow { font-size: 1.5cqw; color: var(--accent); }
.v-card h3 { margin: 0; font: 800 6cqw/1.05 var(--sans); letter-spacing: -0.02em; }
.v-card p { margin: 0; color: var(--soft); font-size: 2.2cqw; }
.v-card .actions { margin-top: 2cqw; }
@keyframes card-in { from { opacity: 0; transform: scale(0.96); } }

.v-caption {
  position: absolute;
  left: 50%;
  bottom: 1.4cqw;
  width: max-content;
  max-width: 94%;
  margin: 0;
  padding: 0.5cqw 1.3cqw;
  transform: translateX(-50%);
  border-radius: 0.6cqw;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 500 1.75cqw/1.35 var(--sans);
  text-align: center;
}

.v-bigplay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 9cqw;
  height: 9cqw;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0b1020;
  box-shadow: 0 1cqw 4cqw rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.v-bigplay:hover { transform: scale(1.06); }
.v-bigplay svg { width: 45%; height: 45%; fill: currentColor; }
.v-bigplay .icon-play { margin-left: 8%; }
.v-bigplay .icon-replay { display: none; fill: none; }
.v-bigplay.replay .icon-play { display: none; }
.v-bigplay.replay .icon-replay { display: block; }

.v-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #0d1326;
}
.v-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}
.v-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.v-btn svg { width: 20px; height: 20px; fill: currentColor; }
.v-btn[aria-pressed="false"] { opacity: 0.4; }
.v-text-btn { width: auto; height: auto; padding: 2px 6px; border: 1.5px solid currentColor; border-radius: 4px; font: 800 12px var(--sans); }
#vPlay .icon-pause, .player.playing #vPlay .icon-play { display: none; }
.player.playing #vPlay .icon-pause { display: block; }
.v-time { min-width: 92px; color: var(--soft); font: 600 13px var(--mono); }
.v-seek {
  flex: 1;
  min-width: 80px;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) var(--p, 0%), rgba(255, 255, 255, 0.15) var(--p, 0%));
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.v-seek::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.4);
  -webkit-appearance: none;
}
.v-seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.v-voice-menu { display: inline-flex; gap: 6px; width: auto; padding: 0 10px; font: 600 13px var(--sans); }
.v-voice-menu[aria-expanded="true"] { background: rgba(94, 234, 212, 0.12); color: var(--accent); }

.v-voice-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card);
}
.v-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.v-voice-field { flex: 1 1 260px; }
.v-field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text);
  font: 14px var(--sans);
}
.v-speed { display: grid; grid-template-columns: repeat(3, auto); gap: 6px; }
.v-speed button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  font: 600 13px var(--sans);
  cursor: pointer;
}
.v-speed button:hover { color: var(--text); border-color: var(--muted); }
.v-speed button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: rgba(94, 234, 212, 0.1); }
.v-preview { padding: 9px 16px; font-size: 14px; }
.v-preview svg { width: 14px; height: 14px; fill: currentColor; }
.v-preview:disabled { opacity: 0.5; cursor: default; }
.v-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }

.v-keys-help { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.v-chapters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.v-chapter-btn {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--soft);
  font-size: 13px;
  cursor: pointer;
}
.v-chapter-btn:hover { border-color: var(--muted); color: var(--text); }
.v-chapter-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(94, 234, 212, 0.08); }
.v-chapter-time { color: var(--muted); font-family: var(--mono); }

/* ================= Game: Balloon Pop ================= */

.balloons {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
body[data-view="balloons"] { overflow: hidden; }
.balloons:not([data-state="playing"]) .pause-btn { visibility: hidden; }
.balloons.shake { animation: shake 0.35s; }

.bp-field {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: linear-gradient(180deg, #0c1533 0%, #1d2b64 42%, #5b3a8c 74%, #f08a5d 100%);
}
.bp-sky, #bpBalloons, #bpDarts, #bpEffects, #bpFlash { position: absolute; inset: 0; pointer-events: none; }

.bp-stars {
  position: absolute;
  inset: 0 0 50% 0;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 20%, #fff, transparent),
    radial-gradient(1px 1px at 22% 55%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 37% 12%, #fff, transparent),
    radial-gradient(1px 1px at 52% 40%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 66% 18%, #fff, transparent),
    radial-gradient(1px 1px at 79% 62%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 91% 30%, #fff, transparent);
  opacity: 0.7;
  animation: twinkle 3.5s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: 0.25; } }

.bp-sun {
  position: absolute;
  left: 50%;
  bottom: -160px;
  width: 460px;
  height: 460px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 140, 0.9) 0%, rgba(255, 160, 90, 0.4) 35%, transparent 70%);
}

.bp-cloud {
  position: absolute;
  left: 0;
  width: 180px;
  height: 52px;
  border-radius: 60px;
  background: #fff;
  filter: blur(2px);
  animation: cloud linear infinite;
}
.bp-cloud::before, .bp-cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.bp-cloud::before { left: 26px; top: -38px; width: 78px; height: 78px; }
.bp-cloud::after { right: 22px; top: -52px; width: 100px; height: 100px; }
@keyframes cloud {
  from { transform: translateX(-280px) scale(var(--s)); }
  to   { transform: translateX(calc(100vw + 80px)) scale(var(--s)); }
}

.bp-hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 130px; pointer-events: none; }
.hill-back { fill: #2c1f52; }
.hill-front { fill: #160f2e; }

/* Balloons */
.balloon { position: absolute; left: 0; top: 0; width: 70px; will-change: transform; }
.balloon-sway {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 100%;
  animation: sway 2.6s ease-in-out infinite alternate;
}
@keyframes sway {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}
.balloon-body {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 84px;
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.8) 0 5%, rgba(255, 255, 255, 0.2) 13%, transparent 32%),
    radial-gradient(circle at 72% 82%, rgba(0, 0, 0, 0.25), transparent 55%),
    var(--bc);
  box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.25);
}
.balloon-letter {
  font: 800 34px/1 var(--sans);
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 10px rgba(0, 0, 0, 0.25);
}
.balloon-knot {
  width: 12px;
  height: 9px;
  margin-top: -2px;
  background: var(--bc);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: brightness(0.85);
}
.balloon-string {
  width: 2px;
  height: 56px;
  border-radius: 2px;
  background: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.1));
  transform-origin: top;
  animation: string 1.6s ease-in-out infinite alternate;
}
@keyframes string {
  from { transform: rotate(7deg); }
  to   { transform: rotate(-7deg); }
}
.balloon.targeted .balloon-body {
  box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.18), 0 0 0 4px rgba(255, 255, 255, 0.75), 0 0 26px rgba(255, 255, 255, 0.6);
}
.balloon-body::before {
  position: absolute;
  top: -6px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0b1020;
  font-size: 14px;
}
.balloon.star .balloon-body::before { content: "★"; color: var(--gold); }
.balloon.heart .balloon-body::before { content: "♥"; color: #fb7185; }
.balloon.bomb .balloon-body::before { content: "💣"; }
.balloon.star .balloon-body { animation: star-glow 0.8s ease-in-out infinite alternate; }
@keyframes star-glow {
  to { box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.18), 0 0 34px rgba(251, 191, 36, 0.95); }
}

/* Cannon */
.cannon { position: absolute; left: 50%; bottom: 12px; width: 92px; height: 92px; margin-left: -46px; }
.barrel {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 26px;
  height: 58px;
  margin-left: -13px;
  border-radius: 13px 13px 6px 6px;
  background: linear-gradient(90deg, #475569, #a5b4c8 45%, #334155);
  box-shadow: 0 0 0 2px #1e293b;
  transform-origin: 50% 100%;
  transition: transform 0.12s ease-out;
}
.barrel-ring { position: absolute; top: 6px; left: -3px; right: -3px; height: 8px; border-radius: 4px; background: var(--accent); }
.cannon-base {
  position: absolute;
  left: 50%;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 80px;
  height: 44px;
  margin-left: -40px;
  border-radius: 40px 40px 10px 10px;
  background: linear-gradient(180deg, #5eead4, #14b8a6);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 6px 18px rgba(0, 0, 0, 0.4);
}
.cannon-star { color: #052e29; font-size: 20px; }
.wheel {
  position: absolute;
  bottom: 0;
  width: 22px;
  height: 22px;
  border: 4px solid #a5b4c8;
  border-radius: 50%;
  background: #1e293b;
}
.wheel.left { left: 10px; }
.wheel.right { right: 10px; }
.cannon.firing .cannon-base, .cannon.firing .wheel { animation: recoil 0.18s ease-out; }
.cannon.firing .barrel::after {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #fde68a 40%, transparent 70%);
  animation: muzzle 0.2s ease-out forwards;
}
.cannon.jammed { animation: shake 0.3s; }
@keyframes recoil { 40% { transform: translateY(4px); } }
@keyframes muzzle {
  from { transform: scale(0.4); opacity: 1; }
  to   { transform: scale(1.5); opacity: 0; }
}

.dart {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 6px;
  margin: -3px 0 0 -13px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 60%, #fde68a);
  box-shadow: 0 0 12px #fde68a, 0 0 4px #fff;
}

/* Pop effects */
.bp-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 4px solid var(--c);
  border-radius: 50%;
  animation: bp-ring 0.45s ease-out forwards;
}
@keyframes bp-ring { to { transform: scale(6); opacity: 0; border-width: 1px; } }
.bp-shred {
  position: absolute;
  width: 10px;
  height: 7px;
  margin: -4px 0 0 -5px;
  border-radius: 3px 3px 6px 1px;
  background: var(--c);
  animation: bp-shred 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes bp-shred { to { transform: translate(var(--dx), calc(var(--dy) + 40px)) rotate(var(--r)); opacity: 0; } }
.bp-letter {
  position: absolute;
  font: 900 40px var(--sans);
  color: #fff;
  text-shadow: 0 0 16px var(--c), 0 2px 0 rgba(0, 0, 0, 0.3);
  animation: bp-letter 0.7s ease-out forwards;
}
@keyframes bp-letter {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to   { transform: translate(-50%, -130%) scale(1.8); opacity: 0; }
}
.bp-points {
  position: absolute;
  font: 800 20px var(--mono);
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  animation: rise 0.9s ease-out forwards;
}
.bp-word {
  position: absolute;
  font: 900 30px var(--sans);
  color: #fff;
  -webkit-text-stroke: 2px #f472b6;
  white-space: nowrap;
  animation: bp-word 0.8s ease-out forwards;
}
@keyframes bp-word {
  0%   { transform: translate(-50%, -50%) rotate(-8deg) scale(0.4); opacity: 0; }
  25%  { transform: translate(-50%, -50%) rotate(-8deg) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -90%) rotate(-8deg) scale(1); opacity: 0; }
}
.bp-miss {
  position: absolute;
  font: 800 22px var(--mono);
  color: var(--danger);
  animation: rise 0.7s ease-out forwards;
}
.bp-escaped {
  position: absolute;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(248, 113, 113, 0.92);
  color: #2a0909;
  font: 700 14px var(--sans);
  white-space: nowrap;
  animation: bp-escaped 1.3s ease-out forwards;
}
@keyframes bp-escaped {
  0%   { opacity: 0; transform: translate(-50%, -10px); }
  15%  { opacity: 1; transform: translate(-50%, 0); }
  80%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}

#bpFlash { opacity: 0; }
#bpFlash.hurt { background: radial-gradient(120% 60% at 50% 0%, rgba(248, 113, 113, 0.5), transparent 70%); animation: flash 0.45s ease-out; }
#bpFlash.boom { background: radial-gradient(circle, rgba(255, 255, 255, 0.7), rgba(251, 191, 36, 0.35) 40%, transparent 75%); animation: flash 0.6s ease-out; }
.toast.heart { color: #fb7185; text-shadow: 0 0 30px rgba(251, 113, 133, 0.5); }

.bp-legend {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  max-width: calc(50% - 70px);
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.65);
  color: var(--soft);
  font-size: 12px;
}
.bp-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--fc);
  vertical-align: -1px;
}

.bp-title-balloons { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; }
.mini-balloon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 48px;
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.6) 0 8%, transparent 30%), var(--fc);
  color: #fff;
  font: 800 20px var(--sans);
  animation: bob 2.4s ease-in-out infinite alternate;
}
.mini-balloon:nth-child(2) { animation-delay: -0.8s; }
.mini-balloon:nth-child(3) { animation-delay: -1.6s; }
@keyframes bob { to { transform: translateY(-8px) rotate(4deg); } }
.modes { grid-template-columns: repeat(2, 1fr); }
.tag.heart { color: #fb7185; }

/* ================= Small screens ================= */

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .bp-legend { display: none; }
  .text-box { --line-h: 46px; padding: 0 16px; font-size: 24px; }
  .meters { gap: 10px 20px; }
  .meter .value { font-size: 18px; }
}

@media (max-width: 560px) {
  .v-controls { gap: 4px; padding: 8px 10px; }
  .v-time { min-width: 0; font-size: 11px; }
  .v-seek { min-width: 40px; }
  .v-btn-text, .v-keys-help { display: none; }
  .hud { padding: 8px 12px; }
  .stats { gap: 16px; }
  .stat { min-width: 0; }
  .stat .value { font-size: 18px; }
  .panel { padding: 24px 18px; }
  .difficulty { grid-template-columns: 1fr; }
  .results { grid-template-columns: repeat(2, 1fr); }
  .results.three { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  /* Gentle drifting (clouds, balloon sway) stays; fast motion, shaking and confetti are turned off. */
  #rain, #confetti { display: none; }
  .arcade.shake, .balloons.shake, .typed.shake, .char.shake, .key.next, .cannon.jammed { animation: none; }
  .stop.current .stop-dot, .av-body, .leg-l, .leg-r { animation: none !important; }
}
