/* Choodoku - styles for every page under /choodoku/ (the privacy page keeps its own inline styles).
   Colours, sizes and keyframes follow the game's design spec (puzzle-game/design/DESIGN_SPEC.md). */

@font-face {
  font-family: "Fredoka";
  src: url("/choodoku/fonts/Fredoka.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/choodoku/fonts/Nunito.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

/* ---------- Tokens: day (light) ---------- */

:root {
  color-scheme: light;
  --bg: #FBF3E4;
  --text: #3B2A20;
  --muted: #8A6A55;
  --icon: #7A5B48;
  --accent-text: #C94A22;
  --surface: #FFFFFF;
  --surface-shadow: #EFE1C8;
  --bubble-text: #5A3E2E;
  --avatar-bg: #F6D9A8;
  --primary: #C94A22;
  --primary-shadow: #8E3113;
  --on-primary: #FFFFFF;
  --hint-bg: #FFF1D6;
  --hint-shadow: #EAD0A0;
  --divider: #F3E6CF;
  --dot-on: #E7A33E;
  --dot-off: #F3E6CF;
  --scrim: rgba(59, 42, 32, 0.5);
  --focus: #2F4A7A;

  --board-card: #EAD9B8;
  --board-shadow: #D9C39C;
  --tile: #FFF8EA;
  --tile-laid: #F4E6C8;
  --tile-flash: #FBD5C8;
  --fence: #8B5E3C;
  --fence-post: #6E4A2E;
  --next-ring: #E7A33E;
  --next-fill: #FFF0D2;

  --bed-edge: #D6C4A4;
  --bed: #E8DBC2;
  --sleeper: #B07A50;
  --sleeper-shade: #86573A;
  --sleeper-hi: #C99468;
  --rail-edge: #5B6371;
  --rail: #AAB3C0;
  --lit: #FFF4C8;
  --lit-rail: #FFD66B;

  --sign-border: #C94A22;
  --sign-fill: #FFFFFF;
  --sign-done: #C94A22;
  --sign-wrong: #FBD5C8;
  --sign-num: #7A2E13;
  --sign-num-done: #FFFFFF;
  --sign-shadow: rgba(94, 74, 64, 0.35);

  --loco-body: #E4572E;
  --loco-shade: #CC4A24;
  --loco-roof: #2F4A7A;
  --loco-window: #CFE8F3;
  --loco-lamp: #FFE9A6;
  --wheel-face: #E7A33E;
  --smoke: #FFFFFF;
  --zz: #7A5B48;

  --sky: #CFE8F3;
  --hill-far: #A8D08D;
  --hill-far2: #96C57B;
  --ground: #7DB966;
  --house: #FFF4E2;
  --window-lit: #9ED3E6;
  --on-ground: #22331B;

  --logo-doku: #2F4A7A;

  --night-only: none;
  --day-only: inline;
}

/* ---------- Tokens: night (dark) ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    color-scheme: dark;
    --bg: #141D33; --text: #F4E9D8; --muted: #A9B4CC; --icon: #D5DCEB; --accent-text: #FFB057;
    --surface: #22304D; --surface-shadow: #0B1222; --bubble-text: #EDE3D2; --avatar-bg: #2F3F63;
    --primary: #E7A33E; --primary-shadow: #A86F1E; --on-primary: #2A1C12;
    --hint-bg: #3A3A4E; --hint-shadow: #0B1222; --divider: #2B3A5C;
    --dot-on: #E7A33E; --dot-off: #2F3F63; --scrim: rgba(8, 12, 24, 0.6); --focus: #FFD978;
    --board-card: #1F2B47; --board-shadow: #0B1222; --tile: #2A3858; --tile-laid: #34456B;
    --tile-flash: #6B3A3A; --fence: #8B6A4A; --fence-post: #6E5238; --next-ring: #FFD978; --next-fill: #3A4A70;
    --bed-edge: #2C3550; --bed: #3A4564; --sleeper: #A98056; --sleeper-shade: #6A4E34; --sleeper-hi: #C69C6E;
    --rail-edge: #1C2233; --rail: #C9D1DE; --lit: #FFE7A8; --lit-rail: #FFD978;
    --sign-border: #E7A33E; --sign-fill: #2F3F63; --sign-done: #E7A33E; --sign-wrong: #6B3A3A;
    --sign-num: #FFE9C7; --sign-num-done: #2A1C12; --sign-shadow: rgba(0, 0, 0, 0.45);
    --loco-body: #D4502C; --loco-shade: #B2401F; --loco-roof: #243A63; --loco-window: #FFD978;
    --loco-lamp: #FFF4C8; --wheel-face: #B8A07C; --smoke: #C9D3E6; --zz: #C9D3E6;
    --sky: #1B2744; --hill-far: #2C3E5C; --hill-far2: #314566; --ground: #263A52; --house: #3A4A6B; --window-lit: #FFD978; --on-ground: #F4E9D8;
    --logo-doku: #3D7CC9;
    --night-only: inline; --day-only: none;
  }
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #141D33; --text: #F4E9D8; --muted: #A9B4CC; --icon: #D5DCEB; --accent-text: #FFB057;
  --surface: #22304D; --surface-shadow: #0B1222; --bubble-text: #EDE3D2; --avatar-bg: #2F3F63;
  --primary: #E7A33E; --primary-shadow: #A86F1E; --on-primary: #2A1C12;
  --hint-bg: #3A3A4E; --hint-shadow: #0B1222; --divider: #2B3A5C;
  --dot-on: #E7A33E; --dot-off: #2F3F63; --scrim: rgba(8, 12, 24, 0.6); --focus: #FFD978;
  --board-card: #1F2B47; --board-shadow: #0B1222; --tile: #2A3858; --tile-laid: #34456B;
  --tile-flash: #6B3A3A; --fence: #8B6A4A; --fence-post: #6E5238; --next-ring: #FFD978; --next-fill: #3A4A70;
  --bed-edge: #2C3550; --bed: #3A4564; --sleeper: #A98056; --sleeper-shade: #6A4E34; --sleeper-hi: #C69C6E;
  --rail-edge: #1C2233; --rail: #C9D1DE; --lit: #FFE7A8; --lit-rail: #FFD978;
  --sign-border: #E7A33E; --sign-fill: #2F3F63; --sign-done: #E7A33E; --sign-wrong: #6B3A3A;
  --sign-num: #FFE9C7; --sign-num-done: #2A1C12; --sign-shadow: rgba(0, 0, 0, 0.45);
  --loco-body: #D4502C; --loco-shade: #B2401F; --loco-roof: #243A63; --loco-window: #FFD978;
  --loco-lamp: #FFF4C8; --wheel-face: #B8A07C; --smoke: #C9D3E6; --zz: #C9D3E6;
  --sky: #1B2744; --hill-far: #2C3E5C; --hill-far2: #314566; --ground: #263A52; --house: #3A4A6B; --window-lit: #FFD978; --on-ground: #F4E9D8;
  --logo-doku: #3D7CC9;
  --night-only: inline; --day-only: none;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}
h1, h2, h3 {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}
p { margin: 0; }
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.night-only { display: var(--night-only); }
.day-only { display: var(--day-only); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Solid offset shadows, no blur - the game's "toy" look. */
.chunky {
  background: var(--surface);
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--surface-shadow);
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--surface-shadow);
  color: var(--icon);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.theme-toggle:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-shadow); }
.theme-toggle svg { width: 24px; height: 24px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 56px 0 72px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  grid-template-areas: "intro demo" "rules demo";
  gap: 36px 56px;
}
.intro { grid-area: intro; align-self: end; max-width: 520px; }
.demo { grid-area: demo; align-self: center; }
.rules { grid-area: rules; align-self: start; }
.logo { display: block; width: min(100%, 470px); height: auto; margin-left: -14px; }
.logo .lg-choo { fill: #E4572E; }
.logo .lg-doku { fill: var(--logo-doku); }
.logo .pufflet { transform-box: fill-box; transform-origin: center; animation: tt-bob 2.4s ease-in-out infinite; }
.logo .pufflet:nth-of-type(2) { animation-delay: 0.4s; }
.logo .pufflet:nth-of-type(3) { animation-delay: 0.8s; }
.tagline {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: clamp(24px, 3.2vw, 32px);
  line-height: 1.2;
  margin-top: 6px;
  text-wrap: balance;
}
.lede {
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  max-width: 34em;
  text-wrap: pretty;
}
.cta-row { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 26px 10px 20px;
  border-radius: 22px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 0 var(--primary-shadow);
  text-decoration: none;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  line-height: 1.1;
}
.store-btn svg { width: 30px; height: 30px; flex: none; fill: currentColor; }
.store-btn small { display: block; font-family: "Nunito", sans-serif; font-weight: 800; font-size: 13px; opacity: 0.85; }
.store-btn span { font-size: 21px; }
.store-btn.alt { background: var(--surface); color: var(--text); box-shadow: 0 6px 0 var(--surface-shadow); }
.store-btn.alt svg { fill: #6BAF5C; }
a.store-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--primary-shadow); }
a.store-btn.alt:active { box-shadow: 0 1px 0 var(--surface-shadow); }

/* ---------- Demo (the playable route) ---------- */

.demo { width: 100%; max-width: 460px; justify-self: center; }
.demo-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 12px;
}
.demo-title { font-size: 24px; }
.demo-sub { font-size: 14px; font-weight: 800; color: var(--muted); }
.demo-timer { font-variant-numeric: tabular-nums; }

.bubble-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: 3px solid var(--surface);
  overflow: hidden;
  position: relative;
}
.avatar svg { position: absolute; left: -13px; top: 2px; width: 76px; height: 61px; overflow: visible; }
.bubble {
  flex: 1;
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--surface-shadow);
  color: var(--bubble-text);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
}

.board-wrap { position: relative; }
.board {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  overflow: visible;
}
.board:focus-visible { outline-offset: 6px; border-radius: 28px; }
.board .b-card { fill: var(--board-card); }
.board .b-card-shadow { fill: var(--board-shadow); }
.board .tile { fill: var(--tile); transition: fill 0.15s ease; }
.board .tile.laid { fill: var(--tile-laid); }
.board .tile.flash { fill: var(--tile-flash); }
.board .cell.shake { animation: tt-shake 0.4s ease-in-out 1; transform-box: fill-box; }
.board .next-glow { fill: var(--next-fill); stroke: var(--next-ring); stroke-width: 3; animation: tt-glow 1.5s ease-in-out infinite; }
.fence line.rail { stroke: var(--fence); stroke-width: 5; stroke-linecap: round; }
.fence circle { fill: var(--fence-post); }

.trk .bed-edge { fill: none; stroke: var(--bed-edge); stroke-linecap: round; stroke-linejoin: round; }
.trk .bed { fill: none; stroke: var(--bed); stroke-linecap: round; stroke-linejoin: round; }
.trk .sl-shade { fill: var(--sleeper-shade); }
.trk .sl { fill: var(--sleeper); }
.trk .sl-hi { fill: var(--sleeper-hi); }
.trk .rail-edge { fill: none; stroke: var(--rail-edge); stroke-linecap: round; stroke-linejoin: round; }
.trk .rail { fill: none; stroke: var(--rail); stroke-linecap: round; stroke-linejoin: round; }
.trk .lit { fill: none; stroke: var(--lit); stroke-linecap: round; stroke-linejoin: round; opacity: 0.45; }
.trk .lit-rail { fill: none; stroke: var(--lit-rail); stroke-linecap: round; stroke-linejoin: round; }
.trk .lamp-glow { fill: #FFC96B; opacity: 0.3; animation: tt-glow 2.6s ease-in-out infinite; }

.station .sign-shadow { fill: var(--sign-shadow); }
.station .sign { fill: var(--sign-fill); stroke: var(--sign-border); stroke-width: 3; }
.station .num { fill: var(--sign-num); font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 18px; text-anchor: middle; }
.station.done .sign { fill: var(--sign-done); }
.station.done .num { fill: var(--sign-num-done); }
.station.wrong .sign { fill: var(--sign-wrong); }
.station .sign-g { transform-box: fill-box; transform-origin: center bottom; }
.station.next .sign-g { animation: tt-bounce 1.6s ease-in-out infinite; }
.station.done .sign-g { animation: tt-pop 0.3s ease-out 1; }
.station.wrong .sign-g { animation: tt-shake 0.45s ease-in-out 1; }
.station .rider { transform-box: fill-box; transform-origin: center bottom; animation: tt-hop 0.4s ease-out 1, tt-bob 2.6s ease-in-out 0.4s infinite; }
.station.next .rider { animation: tt-hop 0.4s ease-out 1, tt-wiggle 0.9s ease-in-out 0.4s infinite; }
.station.done .rider { display: none; }
.station .plat-glow { fill: #FFD978; opacity: 0.35; animation: tt-glow 2.4s ease-in-out infinite; }

/* Characters (shared by the board, the avatar, the passenger parade and the closing scene) */
.loco .l-body { fill: var(--loco-body); }
.loco .l-shade { fill: var(--loco-shade); }
.loco .l-roof { fill: var(--loco-roof); }
.loco .l-window { fill: var(--loco-window); }
.loco .l-lamp { fill: var(--loco-lamp); stroke: #3B2A20; stroke-width: 1.2; }
.loco .l-wheel { fill: var(--wheel-face); }
.loco .l-smoke { fill: var(--smoke); transform-box: fill-box; transform-origin: center; }
.loco .l-z { fill: var(--zz); font-family: "Fredoka", sans-serif; font-weight: 700; }
.loco .anim-body { transform-box: fill-box; transform-origin: center bottom; }
.loco .anim-eyes { transform-box: fill-box; transform-origin: center; }
.loco .glow18 { animation: tt-glow 1.8s ease-in-out infinite; }
.loco .glow20 { animation: tt-glow 2s ease-in-out infinite; }
.loco .glow26 { animation: tt-glow 2.6s ease-in-out infinite; }
.loco .heart { transform-box: fill-box; transform-origin: center; animation: tt-float 1.1s ease-out infinite; }
.loco .heart + .heart { animation-delay: 0.45s; }
.loco .zz { animation: tt-zz 2.2s ease-out infinite; }
.loco .zz + .zz { animation-delay: 1.1s; }
.wagon .w-wheel { fill: var(--wheel-face); }
.wagon .w-rider { transform-box: fill-box; transform-origin: center bottom; animation: tt-bob 2.4s ease-in-out infinite; }
.wagon.cheer .w-rider { animation-duration: 0.45s; }
.wagon .w-pop { transform-box: fill-box; transform-origin: center bottom; animation: tt-pop 0.35s ease-out 1; }
.wagon .w-lamp-glow { fill: #FFD978; opacity: 0.35; animation: tt-glow 2.2s ease-in-out infinite; }

.hud { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--surface-shadow);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.chip .muted { color: var(--muted); }
.chip-riders { display: inline-flex; gap: 2px; }
.chip-riders svg { width: 22px; height: 22px; overflow: visible; }

.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.tool {
  height: 68px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 5px 0 var(--surface-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.tool svg { width: 24px; height: 24px; fill: none; stroke: var(--icon); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tool.hint { background: var(--hint-bg); box-shadow: 0 5px 0 var(--hint-shadow); }
.tool.hint svg { stroke: #B7791F; }
.tool.hint svg .bulb { fill: #FFD66B; }
.tool:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-shadow); }
.tool.hint:active { box-shadow: 0 1px 0 var(--hint-shadow); }
.tool:disabled { opacity: 0.45; cursor: default; transform: none; }

/* Win card over the board */
.win {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 28px;
  background: var(--scrim);
  animation: tt-fade-in 0.3s ease-out 1;
}
.win[hidden] { display: none; }
.win-card {
  width: min(300px, 100%);
  padding: 20px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 6px 0 var(--surface-shadow);
  text-align: center;
  animation: tt-rise 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) 1;
}
.win-card h3 { font-size: 28px; font-weight: 700; }
.win-riders { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 12px 0 6px; }
.win-riders svg { width: 30px; height: 30px; overflow: visible; animation: tt-bounce 0.8s ease-in-out infinite; }
.win-stats { font-size: 14px; font-weight: 800; color: var(--muted); }
.win-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.btn {
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 16px;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 0 var(--primary-shadow); }
.btn-secondary { background: var(--surface); color: var(--text); box-shadow: 0 4px 0 var(--surface-shadow), inset 0 0 0 2px var(--divider); }
.btn:active { transform: translateY(3px); box-shadow: none; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 28px; }
.confetti i {
  position: absolute;
  top: 0;
  border-radius: 2px;
  animation: tt-confetti 1.6s ease-in 1 both;
}

/* ---------- Rules (next to the demo) ---------- */

.rules { margin: 0; display: grid; gap: 14px; padding: 0; list-style: none; }
.rules li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.rules .sign-num {
  width: 38px;
  height: 36px;
  border-radius: 12px;
  border: 3px solid var(--sign-border);
  background: var(--sign-fill);
  color: var(--sign-num);
  box-shadow: 0 3px 0 var(--sign-shadow);
  display: grid;
  place-items: center;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}
.rules li:last-child .sign-num { background: var(--sign-done); color: var(--sign-num-done); }
.rules p { padding-top: 5px; }

/* ---------- Sections ---------- */

.section { padding: 72px 0; }
.section-title { font-size: clamp(30px, 4vw, 42px); max-width: 18em; }
.section-lede { margin-top: 10px; color: var(--muted); font-size: 18px; max-width: 36em; }

.modes { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px; margin-top: 32px; }
.mode { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.mode h3 { font-size: 22px; }
.mode p { color: var(--muted); font-size: 16px; }
.mode-art { margin-top: auto; padding-top: 12px; }
.week { display: flex; gap: 6px; }
.week span { width: 16px; height: 16px; border-radius: 8px; background: var(--dot-off); }
.week span.on { background: var(--dot-on); }
.chapter-bar { height: 12px; border-radius: 6px; background: var(--divider); overflow: hidden; }
.chapter-bar span { display: block; width: 35%; height: 100%; border-radius: 6px; background: #E7A33E; }
.chapter-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.infinity { width: 44px; height: 22px; fill: none; stroke: var(--icon); stroke-width: 2; stroke-linecap: round; }

/* Passenger parade */
.parade {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
  padding: 0;
  list-style: none;
}
.rider-btn {
  width: 100%;
  padding: 16px 8px 12px;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--surface-shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.rider-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-shadow); }
.rider-btn svg { width: 64px; height: 64px; overflow: visible; }
.rider-btn .hop { animation: tt-hop 0.4s ease-out 1; transform-box: fill-box; transform-origin: center bottom; }
.rider-name { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 17px; line-height: 1.2; }
.rider-kind { font-size: 13px; font-weight: 800; color: var(--muted); }
.parade-note { margin-top: 18px; font-size: 14px; font-weight: 800; color: var(--muted); }

/* Feature list */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 36px;
  margin-top: 32px;
  padding: 0;
  list-style: none;
}
.features li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.features .f-icon {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--surface-shadow);
  display: grid;
  place-items: center;
}
.features .f-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--icon); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.features h3 { font-size: 19px; }
.features p { margin-top: 3px; color: var(--muted); font-size: 16px; }

/* ---------- Closing scene + footer ---------- */

.finale { position: relative; margin-top: 40px; }
.finale-copy { text-align: center; padding: 0 20px 28px; }
.finale-copy h2 { font-size: clamp(28px, 4vw, 40px); }
.finale-copy p { margin-top: 8px; color: var(--muted); }
.finale-copy .cta-row { justify-content: center; margin-top: 22px; }
.scene { display: block; width: 100%; height: 240px; background: var(--sky); }
.scene .s-hill1 { fill: var(--hill-far); }
.scene .s-hill2 { fill: var(--hill-far2); }
.scene .s-ground { fill: var(--ground); }
.scene .s-house { fill: var(--house); }
.scene .s-window { fill: var(--window-lit); }
.scene .star { fill: #FFF4D6; animation: tt-twinkle 2.8s ease-in-out infinite; }

footer {
  background: var(--ground);
  color: var(--on-ground);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  padding: 4px 20px 26px;
}
footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
footer .sep { margin: 0 10px; opacity: 0.5; }
footer span { white-space: nowrap; }

/* ---------- Responsive ---------- */

@media (max-width: 940px) {
  .hero { padding-top: 76px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "demo" "rules"; gap: 40px; }
  .intro { max-width: 600px; margin: 0 auto; text-align: center; }
  .logo { margin: 0 auto; }
  .lede { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
  .rules { width: 100%; max-width: 460px; justify-self: center; }
  .modes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .modes .mode:first-child { grid-column: 1 / -1; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .theme-toggle { top: 14px; right: 16px; }
  .hero { padding: 72px 0 48px; }
  .section { padding: 52px 0; }
  .modes { grid-template-columns: minmax(0, 1fr); }
  .parade { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .features { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .tools { gap: 10px; }
  .store-btn { width: 100%; justify-content: center; }
  .scene { height: 200px; }
}

/* ---------- Keyframes (design/reference/anim.css) ---------- */

@keyframes tt-blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.08); } }
@keyframes tt-puff { 0% { transform: translate(0, 0) scale(0.35); opacity: 0; } 15% { opacity: 0.95; } 100% { transform: translate(-8px, -26px) scale(1.45); opacity: 0; } }
@keyframes tt-chug { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes tt-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes tt-pop { 0% { transform: scale(0.2); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes tt-float { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-30px) scale(1.1); opacity: 0; } }
@keyframes tt-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
@keyframes tt-twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes tt-glow { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.95; } }
@keyframes tt-hop { 0% { transform: translateY(14px) scale(0.6); opacity: 0; } 45% { transform: translateY(-8px) scale(1.05); opacity: 1; } 75% { transform: translateY(0) scale(1); } 88% { transform: translateY(-2px); } 100% { transform: translateY(0); opacity: 1; } }
@keyframes tt-confetti { 0% { transform: translateY(-30px) rotate(0deg); opacity: 1; } 100% { transform: translateY(400px) rotate(600deg); opacity: 0; } }
@keyframes tt-rise { 0% { transform: translateY(46px) scale(0.96); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes tt-zz { 0% { transform: translate(0, 0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(10px, -20px); opacity: 0; } }
@keyframes tt-bounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-7px); } 55% { transform: translateY(0); } 72% { transform: translateY(-2.5px); } }
@keyframes tt-wiggle { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
@keyframes tt-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Reduce Motion: no looping idle motion; one-shot feedback stays but is shorter (DESIGN_SPEC §8). */
@media (prefers-reduced-motion: reduce) {
  .logo .pufflet, .station .rider, .station.next .rider, .station.next .sign-g,
  .wagon .w-rider, .loco .anim-body, .loco .anim-eyes, .loco .l-smoke, .loco .heart, .loco .zz,
  .win-riders svg, .scene .star { animation: none !important; }
  .board .next-glow, .trk .lamp-glow, .station .plat-glow, .wagon .w-lamp-glow,
  .loco .glow18, .loco .glow20, .loco .glow26 { animation: none; opacity: 0.8; }
  .win-card { animation: tt-fade-in 0.3s ease-out 1; }
  .board .cell.shake, .station.wrong .sign-g { animation-duration: 0.25s; }
}
