/* Layout: one column. Header + odometer, the drive scene, a stop strip, then the question card.
   One deliberate look: Kurzgesagt-style, the sky running through Lia's whole day, flat shapes, rounded type. */
:root {
  --bg: #14143a;
  --panel: #1f1f52;
  --panel-2: #2a2a66;
  --line: #3a3a7c;
  --fg: #f3f0ff;
  --muted: #a9a6d6;
  --accent: #ffd166;
  --teal: #2ec4b6;
  --pink: #ff5d8f;
  --good: #3ddc97;
  --bad: #ff5d73;
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, sans-serif;
  color-scheme: dark;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 60% at 50% 0%, #22225a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
.app {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* header */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.05; text-wrap: balance; }
.brand p { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.odo {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px;
}
.odo-num { font-family: var(--display); font-weight: 700; font-size: 1.6rem; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.odo-unit { color: var(--muted); font-weight: 700; font-size: .85rem; }

/* scene */
.stage {
  position: relative; overflow: hidden; border-radius: 22px;
  height: clamp(280px, 52vh, 540px);
  background: #17184a;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
}
#scene { display: block; width: 100%; height: 100%; }
.sign { font-family: var(--display); font-weight: 700; }
.script { font-family: "Great Vibes", cursive; }
.script2 { font-family: "Pacifico", cursive; }
.nightglow { opacity: calc(var(--night) * .55); transition: opacity 1.8s ease; }

.pan { transform: translateX(calc(var(--stop) * -1000px)); }
.pan-half { transform: translateX(calc(var(--stop) * -500px)); }
#sun { transform: translateY(calc((1 - var(--sun)) * 400px)); }
#stars { opacity: var(--night); }
#beam { opacity: calc(var(--night) * .8); }
.pan, .pan-half, #sun { transition: transform 1.8s cubic-bezier(.5, 0, .2, 1); }
#stars, #beam { transition: opacity 1.8s ease; }

.valance { animation: hue 6s linear infinite; }
@keyframes hue { 0%, 100% { fill: #ff5d8f; } 33% { fill: #2ec4b6; } 66% { fill: #ffd166; } }
.blink { fill: #ff5d73; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { fill: #5b8cff; } }

.wheel { transform-box: fill-box; transform-origin: center; }
.driving .wheel { animation: spin .45s linear infinite; }
.driving .body { animation: bob .28s ease-in-out infinite alternate; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { to { transform: translateY(-2px); } }
.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* the ending */
#party, #fireworks { opacity: 0; transition: opacity .8s ease; }
.party #party, .party #fireworks { opacity: 1; }
.party #driver { display: none; }
.burst { transform-box: fill-box; transform-origin: center; }
.party .burst { animation: burst 2.2s ease-out infinite both; }
@keyframes burst { 0% { transform: scale(.1); opacity: 0; } 10% { opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(1.1); opacity: 0; } }
.pony { transform-box: fill-box; transform-origin: 80% 10%; animation: sway 2.4s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-6deg); } to { transform: rotate(8deg); } }

.place { display: grid; gap: 2px; padding-inline: 4px; }
.place strong { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.2; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.fact { color: var(--muted); font-size: .9rem; }

/* stop strip */
.route { list-style: none; margin: 0; padding: 0 4px; display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
.route::before { content: ""; position: absolute; left: 8.33%; right: 8.33%; top: 9px; height: 4px; border-radius: 2px; background: var(--line); }
.route li { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--muted); font-size: .8rem; font-weight: 700; line-height: 1.2; }
.route li::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel); border: 4px solid var(--line); box-sizing: border-box; transition: background .4s, border-color .4s;
}
.route li.done::before { background: var(--teal); border-color: var(--teal); }
.route li.here { color: var(--fg); }
.route li.here::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px rgba(255, 209, 102, .25); }
@media (max-width: 560px) { .route li span { display: none; } }

/* question card */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(16px, 3vw, 26px); display: grid; gap: 16px;
}
.meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-weight: 800; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.light { display: inline-flex; gap: 5px; padding: 5px 7px; background: #0e0e2a; border-radius: 10px; }
.light i { width: 10px; height: 10px; border-radius: 50%; background: #34345e; }
.light[data-state="go"] i:nth-child(3) { background: var(--good); box-shadow: 0 0 10px var(--good); }
.light[data-state="stop"] i:nth-child(1) { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.q { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 3.2vw, 1.7rem); line-height: 1.25; text-wrap: balance; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .opts { grid-template-columns: 1fr; } }
.opts button {
  font: inherit; font-weight: 800; font-size: 1.05rem; text-align: left; color: var(--fg);
  background: var(--panel-2); border: 2px solid transparent; border-radius: 14px; padding: 14px 16px; cursor: pointer;
  min-width: 0; transition: transform .15s, border-color .15s, background .15s;
}
.opts button:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.opts button.right { background: rgba(61, 220, 151, .16); border-color: var(--good); color: var(--good); }
.opts button.wrong { background: rgba(255, 93, 115, .14); border-color: var(--bad); color: var(--bad); }
.opts button:disabled { cursor: default; }
.opts button:disabled:not(.right):not(.wrong) { opacity: .55; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 48px; }
.msg { margin: 0; font-weight: 800; min-width: 0; }
.msg.good { color: var(--good); }
.msg.bad { color: var(--bad); }
.next {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  background: var(--accent); color: #1b1b3f; border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer;
}
.next:hover { filter: brightness(1.06); }
.arrived { text-align: center; display: grid; gap: 10px; justify-items: center; padding-block: 8px; }
.arrived h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.2rem); text-wrap: balance; }
.arrived p { margin: 0; color: var(--muted); max-width: 46ch; }

/* new-day intro: zoom out to Earth, alarm, coffee, then dash back to the car */
#scene { transform-origin: 50% 60%; }
#scene.zoomout { transform: scale(.06); opacity: 0; transition: transform .9s ease-in, opacity .9s ease-in; }
#scene.dash { animation: dash .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes dash { from { transform: scale(2.4); filter: blur(6px); } to { transform: none; filter: none; } }
#scene.dash #car { animation: car-in .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes car-in { from { transform: translateX(-700px); } to { transform: none; } }

.intro { position: absolute; inset: 0; background: transparent; transition: opacity .45s ease-in, transform .45s ease-in, background .5s ease; }
.intro[data-step="earth"], .intro[data-step="clock"], .intro[data-step="coffee"] { background: #0b0c2a; }
.intro svg { display: block; width: 100%; height: 100%; }
.intro .space { opacity: 0; transition: opacity .5s ease; }
.intro[data-step="earth"] .space, .intro[data-step="clock"] .space, .intro[data-step="coffee"] .space { opacity: 1; }
.intro[data-step="go"] { opacity: 0; transform: scale(2.5); }
.step { opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; transition: opacity .45s ease, transform .6s cubic-bezier(.2, .9, .3, 1.2); }
.intro[data-step="earth"] .step-earth, .intro[data-step="clock"] .step-clock, .intro[data-step="coffee"] .step-coffee { opacity: 1; transform: none; }
.spin { animation: spin-earth 2.2s linear infinite; }
@keyframes spin-earth { to { transform: translateX(-600px); } }
.ring { transform-box: fill-box; transform-origin: center; }
.intro[data-step="clock"] .ring { animation: ring .09s linear infinite alternate; }
@keyframes ring { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.buzz { animation: blink-buzz .3s steps(1) infinite; }
@keyframes blink-buzz { 50% { opacity: 0; } }
.stream { transform-box: fill-box; transform-origin: top; transform: scaleY(0); }
.cup-fill { transform: translateY(80px); }
.steam { opacity: 0; }
.intro[data-step="coffee"] .stream { animation: pour 1.8s ease forwards; }
.intro[data-step="coffee"] .cup-fill { transition: transform 1.4s ease-in .25s; transform: translateY(14px); }
.intro[data-step="coffee"] .steam { animation: steam 1.2s ease-in-out .9s infinite; }
@keyframes pour { 0% { transform: scaleY(0); } 15%, 85% { transform: scaleY(1); } 100% { transform: scaleY(0); } }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px); } 50% { opacity: .6; } 100% { opacity: 0; transform: translateY(-14px); } }
.intro-caption {
  position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center;
  font-family: var(--display); font-weight: 600; font-size: clamp(1.1rem, 3vw, 1.6rem); color: var(--fg);
}
.intro-skip {
  position: absolute; right: 14px; top: 14px; font: inherit; font-weight: 800; font-size: .85rem;
  color: var(--fg); background: rgba(255, 255, 255, .12); border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .pan, .pan-half, #sun, #stars, #beam { transition: none; }
  .valance, .blink, .driving .wheel, .driving .body, .shake, .party .burst, .pony, .spin { animation: none; }
}
