:root {
  --ink: #173d46;
  --muted: #58727a;
  --teal: #0f9fa2;
  --teal-dark: #087477;
  --mint: #bcebd2;
  --cream: #fffaf0;
  --coral: #ef6b58;
  --coral-dark: #b8443b;
  --gold: #ffc94e;
  --green: #39b86b;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 1080px; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #58d0cf; font-family: "Avenir Next Rounded", "Nunito", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, .trace-stage:focus-visible { outline: 4px solid #184d8f; outline-offset: 4px; }
[hidden] { display: none !important; }

.lesson, .race-world { width: 100%; height: 100%; }
.race-world { position: relative; isolation: isolate; min-height: 720px; overflow: hidden; background: #55cfd0 url("./assets/race-backdrop-01.webp") center / cover no-repeat; }
.world-wash { position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, rgba(221,255,250,.06), rgba(16,102,94,.12)), radial-gradient(circle at 50% 52%, rgba(255,250,230,.42), transparent 34%); }

.race-hud { position: absolute; z-index: 5; left: 24px; right: 24px; top: 18px; height: 72px; display: grid; grid-template-columns: 214px 1fr auto 254px; align-items: center; gap: 18px; }
.race-badge, .campaign-track, .difficulty-card, .scoreboard { border: 2px solid rgba(20,94,91,.15); background: rgba(255,253,246,.94); box-shadow: 0 7px 0 rgba(8,96,91,.16), 0 15px 34px rgba(12,76,73,.13); backdrop-filter: blur(8px); }
.race-badge { height: 66px; display: grid; align-content: center; padding: 10px 18px; border-radius: 20px; }
.race-badge span { color: var(--teal-dark); font-size: 10px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }
.race-badge strong { margin-top: 2px; font-size: 18px; }
.campaign-track { width: min(440px, 100%); height: 58px; display: flex; align-items: center; justify-self: center; justify-content: center; padding: 9px 20px; border-radius: 999px; }
.campaign-track i { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid #b9d8d2; border-radius: 50%; color: #688d88; background: white; font-size: 13px; font-style: normal; font-weight: 1000; transition: transform 150ms ease-out, background 150ms ease-out; }
.campaign-track b { width: 48px; height: 4px; border-radius: 999px; background: #c8ded9; }
.campaign-track i.is-current { transform: scale(1.13); border-color: var(--coral); color: white; background: var(--coral); box-shadow: 0 0 0 6px rgba(239,107,88,.15); }
.campaign-track i.is-complete { border-color: var(--teal); color: white; background: var(--teal); }
.campaign-track i.is-complete { font-size: 0; }.campaign-track i.is-complete::after { content: "✓"; font-size: 16px; }
.difficulty-card { width: 220px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 15px; border-radius: 18px; }
.difficulty-card span, .difficulty-card strong { font-size: 11px; font-weight: 900; }.difficulty-card span b { color: var(--coral-dark); font-size: 15px; }
.difficulty-card > i { grid-column: 1/-1; height: 7px; overflow: hidden; border-radius: 999px; background: #d6e8e3; }.difficulty-card > i b { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral)); transition: width 180ms ease-out; }
.scoreboard { height: 68px; display: flex; justify-self: end; align-items: stretch; padding: 6px; border-radius: 20px; }
.scoreboard > div { min-width: 75px; display: grid; place-content: center; text-align: center; }.scoreboard > div + div { border-left: 1px solid #d8e6e1; }
.scoreboard span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }.scoreboard strong { display: block; margin-top: 2px; color: var(--ink); font-size: 21px; line-height: 1; }.scoreboard strong:first-letter { color: var(--gold); }

.game-shell { position: absolute; z-index: 2; left: 24px; right: 24px; top: 106px; bottom: 22px; display: grid; grid-template-columns: 210px minmax(650px, 1fr) 190px; gap: 18px; }
.coach-lane, .pit-lane { min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; }
.coach-lane { justify-content: flex-end; padding-bottom: 28px; }
.speech-bubble { position: absolute; z-index: 4; left: 0; right: 0; top: 22px; min-height: 80px; display: grid; place-items: center; padding: 14px 16px; border: 3px solid #185c60; border-radius: 22px 22px 22px 7px; color: var(--ink); background: #fffdf6; box-shadow: 0 7px 0 rgba(16,93,91,.24), 0 14px 26px rgba(9,80,77,.14); font-size: 15px; font-weight: 1000; line-height: 1.25; text-align: center; }
.speech-bubble::after { position: absolute; left: 28px; bottom: -13px; width: 20px; height: 20px; content: ""; transform: rotate(45deg); border-right: 3px solid #185c60; border-bottom: 3px solid #185c60; background: #fffdf6; }
.sticker-art { overflow: hidden; padding: 7px; border: 1px solid rgba(29,74,68,.1); border-radius: 26px; background: #fffdf7; box-shadow: 0 11px 28px rgba(25,62,59,.16); }
.sticker-art img { display: block; width: 100%; border-radius: 19px; }
.mascot-sticker { width: 205px; transform-origin: 50% 90%; }.mascot-sticker img { aspect-ratio: 1; object-fit: cover; }
.sound-call { min-width: 150px; min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 13px; border: 2px solid #fff; border-radius: 999px; color: white; background: var(--teal-dark); box-shadow: 0 5px 0 #075456, 0 10px 20px rgba(6,75,73,.18); font-size: 13px; font-weight: 1000; transition: transform 140ms ease-out, box-shadow 140ms ease-out; }
.sound-call span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: var(--teal-dark); background: var(--gold); font-size: 16px; }.sound-call:active { transform: translateY(4px); box-shadow: 0 1px 0 #075456; }

.trace-card { min-width: 0; display: grid; grid-template-rows: auto minmax(390px, 1fr) 30px 76px; gap: 9px; padding: 20px 22px 18px; border: 3px solid rgba(255,255,255,.9); border-radius: 34px; background: rgba(255,253,246,.94); box-shadow: 0 10px 0 rgba(13,105,99,.24), 0 26px 60px rgba(7,69,67,.2); backdrop-filter: blur(10px); transition: box-shadow 160ms ease-out, transform 160ms ease-out; }
.challenge-heading { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 5px; }.challenge-heading > div:first-child { min-width: 0; }
.challenge-heading span { color: var(--teal-dark); font-size: 10px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }.challenge-heading h1 { margin: 3px 0 2px; font-size: clamp(28px, 2.6vw, 40px); line-height: 1; letter-spacing: -.04em; }.challenge-heading p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.word-strip { flex: 0 0 auto; display: flex; gap: 7px; padding: 7px; border-radius: 16px; background: #e9f6f1; }.word-strip i { width: 37px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: #6a8984; background: white; font-size: 20px; font-style: normal; font-weight: 1000; }.word-strip i.is-done { color: white; background: var(--teal); }.word-strip i.is-current { color: white; background: var(--coral); box-shadow: 0 0 0 4px rgba(239,107,88,.16); }

.trace-stage { position: relative; min-height: 390px; overflow: hidden; border: 3px solid #b6ded5; border-radius: 27px; background: radial-gradient(circle at 50% 45%, #fffdf8 0 30%, transparent 68%), linear-gradient(180deg,#e9fbf4,#d8f2e8); box-shadow: inset 0 5px 20px rgba(26,110,102,.08); touch-action: none; cursor: crosshair; }
.trace-stage::before { position: absolute; inset: 15px; content: ""; border: 2px dashed rgba(15,159,162,.15); border-radius: 20px; pointer-events: none; }
.trace-svg { width: 100%; height: 100%; display: block; overflow: visible; touch-action: none; }
.guide-path { fill: none; stroke: #b5d5d0; stroke-width: 48; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 15; }
.guide-path.is-current { stroke: #94c9c2; marker-end: url(#arrowHead); }
.guide-path.is-done { stroke: #d7e8e3; stroke-dasharray: none; }
.fill-path { fill: none; stroke: url(#letterGradient); stroke-width: 44; stroke-linecap: round; stroke-linejoin: round; filter: url(#trailGlow); }
.start-dot { fill: var(--green); stroke: white; stroke-width: 7; filter: drop-shadow(0 4px 0 rgba(15,101,60,.28)); }
.start-dot-ring { fill: none; stroke: rgba(57,184,107,.34); stroke-width: 7; }
.finish-flag { font-size: 34px; paint-order: stroke; stroke: white; stroke-width: 5px; }
.tap-dot { fill: #fff; stroke: var(--coral); stroke-width: 5; cursor: pointer; }.tap-dot.is-next { fill: var(--gold); stroke: #a86111; stroke-width: 6; }.tap-dot.is-done { fill: var(--teal); stroke: white; }
.tap-dot-number { fill: var(--ink); font-size: 16px; font-weight: 1000; pointer-events: none; text-anchor: middle; dominant-baseline: middle; }
.spark { fill: var(--gold); opacity: 0; transform-box: fill-box; transform-origin: center; animation: sparkPop 520ms ease-out; }
.start-callout { position: absolute; left: 50%; top: 50%; padding: 5px 9px; border-radius: 999px; color: white; background: var(--green); box-shadow: 0 3px 0 #247e4b; font-size: 9px; font-weight: 1000; letter-spacing: .1em; pointer-events: none; transform: translate(23px,-50%); }
.nudge { position: absolute; left: 50%; bottom: 13px; padding: 9px 14px; opacity: 0; transform: translate(-50%, 8px); border-radius: 999px; color: #753c2f; background: #ffe2ae; font-size: 12px; font-weight: 1000; pointer-events: none; transition: opacity 140ms ease-out, transform 140ms ease-out; }.nudge.is-showing { opacity: 1; transform: translate(-50%,0); }
.finish-reveal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 24px; opacity: 0; transform: scale(.88); border-radius: 24px; background: rgba(231,249,241,.94); pointer-events: none; transition: opacity 170ms ease-out, transform 170ms cubic-bezier(.2,.85,.25,1.2); }.finish-reveal.is-showing { opacity: 1; transform: scale(1); pointer-events: auto; }.reveal-sticker { width: 205px; transform: rotate(-3deg); }.finish-reveal span { color: var(--teal-dark); font-size: 11px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }.finish-reveal strong { display: block; max-width: 250px; margin-top: 4px; font-size: 33px; line-height: 1.05; }
.confetti { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; pointer-events: none; }.confetti i { position: absolute; width: 12px; height: 12px; opacity: 0; border-radius: 3px; background: var(--coral); animation: confettiBurst 760ms ease-out both; }.confetti i:nth-child(2n) { background: var(--teal); }.confetti i:nth-child(3n) { border-radius: 50%; background: var(--gold); }

.trace-meter { display: flex; align-items: center; gap: 10px; padding: 0 4px; }.trace-meter > i { height: 10px; flex: 1; overflow: hidden; border-radius: 999px; background: #dceae6; }.trace-meter > i b { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--green),var(--teal),var(--coral)); transition: width 100ms linear; }.trace-meter span { width: 74px; color: var(--teal-dark); font-size: 11px; font-weight: 1000; text-align: right; }
.action-area { min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.choice-grid { width: min(620px,100%); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }.choice, .primary { min-height: 60px; border: 2px solid #9bcfc5; border-radius: 18px; background: white; box-shadow: 0 6px 0 #8abdb4; font-weight: 1000; transition: transform 140ms ease-out, box-shadow 140ms ease-out, border-color 140ms ease-out; }.choice { padding: 8px 12px; font-size: 18px; }.choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }.choice:hover, .primary:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 8px 0 #78aaa2; }.choice:active, .primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #78aaa2; }
.primary { min-width: 255px; padding: 0 24px; border-color: #a43d35; color: white; background: var(--coral); box-shadow: 0 6px 0 var(--coral-dark); font-size: 16px; }.primary.is-teal { border-color: #076f72; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); }
.trace-hint { color: var(--muted); font-size: 13px; font-weight: 800; text-align: center; }

.pit-lane { justify-content: center; gap: 17px; }.friends-sticker { width: 185px; transform: rotate(2deg); }.trophy-sticker { width: 116px; transform: rotate(-3deg); }.tip-card { width: 178px; padding: 15px; border: 2px solid rgba(16,97,94,.15); border-radius: 20px; background: rgba(255,253,247,.95); box-shadow: 0 6px 0 rgba(13,104,99,.16); text-align: center; }.tip-card span { color: var(--coral-dark); font-size: 9px; font-weight: 1000; letter-spacing: .11em; text-transform: uppercase; }.tip-card strong { display: block; margin-top: 5px; font-size: 13px; line-height: 1.3; }
.toast { position: absolute; z-index: 30; left: 50%; bottom: 28px; max-width: 70%; padding: 10px 18px; opacity: 0; transform: translate(-50%,12px); border: 2px solid #9d5c10; border-radius: 999px; color: #603c13; background: #ffe28c; box-shadow: 0 5px 0 #b47b23, 0 12px 25px rgba(27,75,70,.2); pointer-events: none; font-size: 13px; font-weight: 1000; transition: opacity 150ms ease-out, transform 150ms ease-out; }.toast.is-showing { opacity: 1; transform: translate(-50%,0); }

.race-world.is-nudging .trace-card { animation: gentleNudge 360ms ease-out; }.coach-lane.is-cheering .mascot-sticker { animation: mascotCheer 660ms ease-out; }.coach-lane.is-oops .mascot-sticker { animation: mascotOops 390ms ease-out; }.trace-card.is-level-up { box-shadow: 0 10px 0 rgba(13,105,99,.24), 0 0 0 9px rgba(255,201,78,.27), 0 26px 60px rgba(7,69,67,.2); }

@keyframes sparkPop { 0% { opacity: 1; transform: scale(.2) rotate(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--sx),var(--sy)) scale(1.25) rotate(135deg); } }
@keyframes confettiBurst { 0% { opacity: 1; transform: translate(0,0) rotate(0) scale(.5); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--cx),var(--cy)) rotate(220deg) scale(1.1); } }
@keyframes gentleNudge { 0%,100% { transform: translateX(0); } 28% { transform: translateX(-6px); } 56% { transform: translateX(4px); } 78% { transform: translateX(-2px); } }
@keyframes mascotCheer { 0%,100% { transform: translateY(0) rotate(0); } 34% { transform: translateY(-19px) rotate(-4deg) scale(1.04); } 68% { transform: translateY(-5px) rotate(4deg); } }
@keyframes mascotOops { 0%,100% { transform: rotate(0); } 35% { transform: rotate(-4deg); } 70% { transform: rotate(4deg); } }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 1180px) {
  .race-hud { grid-template-columns: 190px 1fr auto 224px; gap: 12px; }.campaign-track b { width: 30px; }.game-shell { grid-template-columns: 180px minmax(640px,1fr) 155px; gap: 12px; }.mascot-sticker { width: 175px; }.friends-sticker { width: 150px; }.tip-card { width: 150px; }.pit-lane { gap: 12px; }
}
@media (max-height: 780px) {
  .race-hud { top: 12px; height: 62px; }.race-badge,.scoreboard { height: 60px; }.game-shell { top: 88px; bottom: 16px; }.trace-card { grid-template-rows: auto minmax(345px,1fr) 26px 67px; padding-top: 15px; }.challenge-heading { min-height: 62px; }.trace-stage { min-height: 345px; }.challenge-heading h1 { font-size: 30px; }.speech-bubble { top: 8px; min-height: 68px; }.mascot-sticker { width: 170px; }.friends-sticker { width: 142px; }.trophy-sticker { width: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .guide-path.is-current { marker-end: none; }.tap-dot { stroke-width: 7; }
}
