/* playclosecall.com's home page: "Night Drive". Moonlit navy, real gameplay behind the title, and a road down the page
   that a toy car drives as you scroll. Plain CSS, no scripts (the site's Content-Security-Policy allows none):
   - Clips are animated AVIF in <img loading="lazy">, so a phone only fetches the ones it scrolls to. Each sits on its
     first frame (a WebP, also the clip's CSS background) and <picture> gives that still to reduced-motion users and to
     browsers without AVIF.
   - The reveals, the counting numbers and the stars run on scroll-driven animations where a browser has them; where
     it doesn't, everything is simply in place.
   - The "Motion" switch in the menu (a checkbox, read with :has()) stops the clips and the animation for anyone who
     wants the page still; prefers-reduced-motion does the same from the start. */

@font-face {
  font-family: 'Lilita One';
  font-display: swap;
  src: url('/fonts/lilita-one-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/nunito-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito';
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/nunito-latin-900-normal.woff2') format('woff2');
}

/* Animatable numbers for the counters. */
@property --n {
  syntax: '<integer>';
  inherits: false;
  initial-value: 0;
}

:root {
  --ink: #2a1d12;
  /* The game's night: navy ground, slate outlines, a near-black rim on coloured buttons (src/ui/night.css). */
  --night: #0c1430;
  --night-2: #131d40;
  --panel: #1b2442;
  --slate: #4a5680;
  --rim: #070b1c;
  --text: #eef2ff;
  --gold: #ffcc2e;
  --gold-text: #ffd23a;
  --spring: cubic-bezier(0.2, 1.6, 0.4, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--night);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.toy {
  font-family: 'Lilita One', sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* Lettering with the game's thick outline. */
.outlined {
  color: #fff;
  -webkit-text-stroke: 8px var(--rim);
  paint-order: stroke fill;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- The game's glossy buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  padding: 0 28px;
  border: 3.5px solid var(--rim);
  border-radius: 999px;
  color: #fff;
  font-family: 'Lilita One', sans-serif;
  font-size: 26px;
  text-decoration: none;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  background: radial-gradient(circle at 40% 20%, #7db8ff 0%, #3b8cf0 45%, #1f63c4 100%);
  box-shadow: 0 6px 0 #143f80, 0 10px 18px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.25s var(--spring), box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.4px;
  paint-order: stroke fill;
}

.btn:hover {
  transform: translateY(-3px) scale(1.05) rotate(-1.5deg);
}

.btn:active {
  transform: translateY(4px) scale(0.95);
  box-shadow: 0 2px 0 #143f80, 0 3px 6px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition-duration: 0.05s;
}

.btn.gold {
  background: radial-gradient(circle at 40% 20%, #fff0a0 0%, #ffcf2e 45%, #e79b00 100%);
  box-shadow: 0 6px 0 #a86a00, 0 10px 18px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.btn.gold:active {
  box-shadow: 0 2px 0 #a86a00, inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.btn.orange {
  background: radial-gradient(circle at 35% 28%, #ffc08a 0%, #ff8540 40%, #d9501a 100%);
  box-shadow: 0 6px 0 #8f3510, 0 10px 18px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.btn.orange:active {
  box-shadow: 0 2px 0 #8f3510, inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.btn.big {
  min-height: 74px;
  padding: 0 40px;
  font-size: 34px;
}

/* "Coming soon", stuck on a button until its store page is live. */
.soon {
  position: absolute;
  top: -14px;
  right: -12px;
  padding: 2px 9px;
  border: 2.5px solid var(--rim);
  border-radius: 9px;
  background: #ff5d70;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-text-stroke: 0;
  transform: rotate(8deg);
  transition: transform 0.3s var(--spring);
}

.btn:hover .soon {
  transform: rotate(-6deg) scale(1.15);
}

.round {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: 3.5px solid var(--rim);
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), 0 10px 16px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.3s var(--spring);
}

.round svg {
  width: 56%;
  height: 56%;
  fill: currentColor;
  filter: drop-shadow(0 2px 0 rgba(20, 40, 80, 0.45));
}

.pw-hint {
  background: radial-gradient(circle at 35% 28%, #fff1a8 0%, #ffcc2e 40%, #d99a00 100%);
}

.pw-rewind {
  background: radial-gradient(circle at 35% 28%, #c4b0ff 0%, #8a63f2 40%, #5a37c8 100%);
}

.pw-handbrake {
  background: radial-gradient(circle at 35% 28%, #ffc08a 0%, #ff8540 40%, #d9501a 100%);
}

.pw-jump {
  background: radial-gradient(circle at 35% 28%, #a8f3ec 0%, #2cc4b4 40%, #11877c 100%);
}

.pw-nitro {
  background: radial-gradient(circle at 35% 28%, #ffb3bc 0%, #ff5d70 40%, #c9283f 100%);
}

/* ---------- Menu ---------- */
nav {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 18px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  text-decoration: none;
  -webkit-text-stroke-width: 5px;
}

.brand img {
  width: 44px;
  height: 44px;
  border: 3px solid var(--rim);
  border-radius: 12px;
  transition: transform 0.35s var(--spring);
}

.brand:hover img {
  transform: rotate(-12deg) scale(1.1);
}

nav .links {
  margin-left: auto;
  display: flex;
  gap: 22px;
  font-weight: 900;
}

nav .links a {
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s;
}

nav .links a:hover {
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

/* The Motion switch: a checkbox, with its label as the button. */
.still-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.still {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--slate);
  border-radius: 50%;
  background: rgba(12, 20, 48, 0.7);
  cursor: pointer;
  transition: transform 0.25s var(--spring);
}

.still:hover {
  transform: scale(1.1);
}

.still svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.still .on,
.still-input:checked + .still .off {
  display: none;
}

.still-input:checked + .still .on {
  display: block;
}

.still-input:focus-visible + .still {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: min(100svh, 940px);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -3;
  background: var(--night) url('/clips/hero-wide.webp') center / cover no-repeat;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  to {
    transform: scale(1.16) translate(-2%, 1%);
  }
}

.veil {
  position: absolute;
  inset: 0;
  z-index: -2;
  /* Shade behind the lettering only, so the day sceneries keep their colour round it; fades into the menu above and
     the page below. */
  background:
    radial-gradient(ellipse 60% 42% at 50% 50%, rgba(8, 12, 30, 0.5), transparent 100%),
    linear-gradient(to bottom, rgba(12, 20, 48, 0.5), transparent 22%, transparent 66%, var(--night)),
    rgba(8, 12, 30, 0.14);
}

/* A headlight beam sweeping across now and then. */
.beam {
  position: absolute;
  z-index: -1;
  top: -20%;
  left: -60%;
  width: 60%;
  height: 140%;
  background: linear-gradient(100deg, transparent, rgba(255, 240, 170, 0.16) 44%, rgba(255, 240, 170, 0.28) 50%, rgba(255, 240, 170, 0.16) 56%, transparent);
  transform: skewX(-18deg);
  mix-blend-mode: screen;
  animation: sweep 7s ease-in-out 2.2s infinite;
}

/* (By translate, so it never costs a layout: 190% of the hero is 317% of the beam.) */
@keyframes sweep {
  0% {
    translate: 0 0;
  }

  40%,
  100% {
    translate: 317% 0;
  }
}

.hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-bottom: 90px;
  text-align: center;
  animation: shake 0.5s 0.55s both;
}

@keyframes shake {
  20% {
    transform: translate(-8px, 5px);
  }

  40% {
    transform: translate(7px, -6px);
  }

  60% {
    transform: translate(-5px, -3px);
  }

  80% {
    transform: translate(3px, 4px);
  }
}

.kicker {
  margin: 0 0 6px;
  color: #ffd84a;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  animation: rise-in 0.6s 1.1s both;
}

h1 {
  margin: 0;
  font-size: clamp(76px, 15vw, 210px);
  line-height: 0.85;
  -webkit-text-stroke-width: 14px;
  text-shadow: 0 10px 0 rgba(0, 0, 0, 0.45), 0 0 60px rgba(255, 210, 60, 0.35);
  transform: rotate(-3deg);
  animation: slam 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) 0.15s both;
}

h1 span {
  color: var(--gold-text);
}

@keyframes slam {
  from {
    transform: rotate(-3deg) scale(2.6);
    opacity: 0;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.tagline {
  margin: 22px 0 28px;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
  animation: rise-in 0.6s 1.25s both;
}

.ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 16px;
  animation: rise-in 0.6s 1.4s both;
}

.btn.glow::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  box-shadow: 0 0 0 10px rgba(255, 204, 46, 0.18), 0 0 50px rgba(255, 204, 46, 0.55);
  opacity: 0;
  pointer-events: none;
  animation: glow 2.2s ease-in-out 2s infinite;
}

@keyframes glow {
  50% {
    opacity: 1;
  }
}

.where {
  margin: 20px 0 0;
  font-size: 15px;
  opacity: 0.9;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 12px rgba(8, 12, 30, 0.8);
  animation: rise-in 0.6s 1.55s both;
}

.where a {
  font-weight: 900;
  text-underline-offset: 3px;
}

.cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 30px;
  height: 48px;
  margin-left: -15px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
}

.cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 6px;
  height: 10px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--gold-text);
  animation: cue 1.6s ease-in-out infinite;
}

@keyframes cue {
  60% {
    transform: translateY(16px);
    opacity: 0;
  }
}

/* Sections waiting to slide in sit off to the side: clipped, so a phone never scrolls sideways to them. (A clip, not
   hidden: the road's car stays sticky.) */
main {
  overflow-x: clip;
}

/* ---------- Counters ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px 20px;
  text-align: center;
}

.stat small {
  display: block;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.75;
}

.num {
  display: block;
  color: var(--gold-text);
  font-size: clamp(54px, 7vw, 88px);
  line-height: 1;
  -webkit-text-stroke: 8px var(--rim);
  paint-order: stroke fill;
  counter-reset: n var(--n);
}

.num::after {
  content: counter(n);
}

.n224 {
  --n: 224;
}

.n12 {
  --n: 12;
}

.n5 {
  --n: 5;
}

.n1 {
  --n: 1;
}

/* ---------- The track ---------- */
/* Every feature sits inside a loop of road, and each loop overlaps the next, so the two cross twice. One car drives the
   whole track as you scroll: down one side of a loop, round the corner, along the bottom, and through the crossing onto
   the next loop, with a close call (or a train, or a power-up) on the way.
   - Geometry, on .roadmap: --s how far each loop is shifted from the last, --r the corner radius of the road's centre
     line, --b the road's width, --o how far loops overlap. Each crossing sits on a straight only if --s >= --r plus half
     a car and --o >= --r + --b plus a car.
   - Odd loops are mirrored (scale: -1 1 on each layer), so every loop works in the same frame of its own: the car comes
     in on its right side, drives down it, rounds the bottom right corner, and runs left along the bottom to x = --s,
     where the next loop's right side crosses. Close calls happen where the next loop's top edge crosses the car's side.
   - Timing: each loop is a view timeline cut down to the middle line of the screen (view-timeline-inset: 50%), so
     "cover Y" is the moment a point Y down the loop passes mid-screen. Down the side, the car moves one for one with the
     scroll (translate), so it holds the middle of the screen; the corner and the run along the bottom follow the road's
     curve (offset-path) in the last --r of scroll.
   - Layers in each loop, stacked the same in every loop so no loop's road covers another's cars: road, crossing pads,
     traffic, the car, then stamps and bursts (unmirrored). */
.roadmap {
  --s: 160px;
  --r: 90px;
  --b: 52px;
  --o: 200px;
  --car: 56px;
  --u: calc(var(--car) / 62);
  position: relative;
  isolation: isolate;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 60px;
  margin-right: var(--s);
  padding: calc(var(--o) + 30px) calc(var(--b) + 50px) calc(var(--o) + 80px);
  view-timeline: --loop block;
  view-timeline-inset: 50%;
  /* Where the car joins this loop, and when it's a car's length short of the close-call crossing. */
  --y-in: calc(var(--o) - var(--b) / 2);
  --at: calc(100% - var(--o) + var(--b) / 2 - var(--car) * 1.1);
}

/* The first loop: the car waits near the top of its right side, ready to go. */
.stop:first-child {
  --y-in: calc(var(--b) / 2 + var(--r) + 20px);
}

.stop + .stop {
  margin-top: calc(-1 * var(--o));
}

.stop:nth-child(even) {
  margin-right: 0;
  margin-left: var(--s);
}

.track,
.pads,
.traffic,
.player,
.fx {
  position: absolute;
  inset: 0;
  container-type: size;
  pointer-events: none;
}

.track {
  z-index: 1;
}

.pads {
  z-index: 2;
}

.traffic {
  z-index: 3;
}

.player {
  z-index: 4;
}

.fx {
  z-index: 5;
}

.stop:nth-child(even) :is(.track, .pads, .traffic, .player) {
  scale: -1 1;
}

/* A loop's moving layers aren't styled or drawn while it's well off screen, so only the loops in view cost anything
   as the page scrolls. (Each layer already stands on its own; the clip at the loop's edge only trims a car leaving.) */
.pads,
.traffic,
.player,
.fx {
  content-visibility: auto;
}

/* The road: asphalt, red and white curbs on both edges, a dashed centre line. */
.ring,
.lane {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--r) + var(--b) / 2);
}

.ring {
  border: var(--b) solid #3a4256;
  box-shadow: 0 0 0 5px #f4f4f4, inset 0 0 0 5px #f4f4f4, 0 0 0 8px var(--rim), inset 0 0 0 8px var(--rim), 0 14px 40px rgba(0, 0, 0, 0.45);
}

.ring::before,
.ring::after {
  content: '';
  position: absolute;
  border: 5px dashed #e8402f;
}

.ring::before {
  inset: calc(-1 * var(--b) - 5px);
  border-radius: calc(var(--r) + var(--b) / 2 + 5px);
}

.ring::after {
  inset: 0;
  border-radius: calc(var(--r) - var(--b) / 2);
}

.lane {
  inset: calc(var(--b) / 2 - 1.5px);
  border: 3px dashed rgba(255, 255, 255, 0.7);
  border-radius: calc(var(--r) + 1.5px);
}

/* Crossing pads, as in the game: a yellow ring until the car is through, then green with a tick. The first is where
   the next loop's top edge crosses the car's side, the second where the car switches onto the next loop. */
.pad {
  position: absolute;
  width: calc(var(--b) * 1.35);
  aspect-ratio: 1;
  margin: calc(var(--b) * -0.675) 0 0 calc(var(--b) * -0.675);
  border-radius: 50%;
  background: #444e69;
  box-shadow: inset 0 0 0 4px rgba(255, 204, 46, 0.9), 0 0 0 3px var(--rim);
}

.pad::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #2f8a3a;
  box-shadow: inset 0 0 0 4px #7be07c;
  opacity: 0;
}

.pad::after {
  content: '';
  position: absolute;
  left: 34%;
  top: 22%;
  width: 22%;
  height: 40%;
  border: solid #fff;
  border-width: 0 5px 5px 0;
  rotate: 45deg;
  opacity: 0;
}

.pad.cross {
  left: calc(100% - var(--b) / 2);
  top: calc(100% - var(--o) + var(--b) / 2);
}

.pad.hand {
  left: calc(var(--s) + var(--b) / 2);
  top: calc(100% - var(--b) / 2);
}

/* The finish line, across the last loop's bottom road. */
.flag {
  position: absolute;
  left: calc(var(--s) + var(--b) / 2 + 30px);
  top: calc(100% - var(--b));
  width: 22px;
  height: var(--b);
  background: repeating-conic-gradient(#f4f4f4 0 25%, #15110d 0 50%) 0 0 / 11px 11px;
  box-shadow: 0 0 0 3px var(--rim);
}

/* Cars: the game's toy cars from above, nose to the right (the road turns them). --u is one unit of the sprites. */
.you,
.tr {
  position: absolute;
  background: center / 100% 100% no-repeat;
  will-change: transform;
}

.you {
  /* The road's lengths, for its run. */
  --top: calc(100cqw - var(--b) - 2 * var(--r));
  --arc: calc(1.5708 * var(--r));
  --side: calc(100cqh - var(--b) - 2 * var(--r));
  --d-in: calc(var(--top) + var(--arc) + var(--y-in) - var(--b) / 2 - var(--r));
  --d-corner: calc(var(--top) + var(--arc) + var(--side));
  --d-out: calc(var(--top) + 2 * var(--arc) + var(--side) + 100cqw - var(--b) - var(--r) - var(--s));
  left: 0;
  top: 0;
  width: calc(128 * var(--u));
  height: calc(40 * var(--u));
  background-image: url('/img/cars/you.svg');
  offset-path: inset(calc(var(--b) / 2) round var(--r));
  offset-anchor: 24% 50%;
  offset-rotate: auto;
  offset-distance: var(--d-in);
  opacity: 0;
}

.stop:first-child .you {
  opacity: 1;
}

/* Traffic on the next loop's top edge, parked up the street until the car comes. */
.tr {
  --reach: min(260px, calc((100cqw - var(--b) - var(--r) - var(--s)) * 0.45));
  left: calc(100% - var(--b) / 2);
  top: calc(100% - var(--o) + var(--b) / 2);
  width: calc(96 * var(--u));
  height: calc(40 * var(--u));
  margin: calc(-20 * var(--u)) 0 0 calc(-31 * var(--u));
  translate: calc(-1 * var(--reach)) 0;
}

.tr.blue {
  background-image: url('/img/cars/blue.svg');
}

.tr.teal {
  background-image: url('/img/cars/teal.svg');
}

.tr.yellow {
  background-image: url('/img/cars/yellow.svg');
}

.tr.purple {
  background-image: url('/img/cars/purple.svg');
}

/* Stamps and bursts, the right way round, on the side the car runs (the screen's right in odd loops, left in even). */
.stamp {
  position: absolute;
  right: calc(var(--b) + 26px);
  top: calc(100% - var(--o) - 70px);
  font-size: 46px;
  transform-origin: right center;
  rotate: -6deg;
  opacity: 0;
}

.stop:nth-child(even) .stamp {
  right: auto;
  left: calc(var(--b) + 26px);
  transform-origin: left center;
  rotate: 6deg;
}

.burst {
  position: absolute;
  left: calc(100% - var(--b) / 2);
  top: calc(100% - var(--o) + var(--b) / 2);
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border: 10px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  opacity: 0;
}

.stop:nth-child(even) .burst {
  left: calc(var(--b) / 2);
}

/* The game's stamp: gold lettering over its combo. */
.stamp {
  color: var(--gold-text);
  font-family: 'Lilita One', sans-serif;
  line-height: 0.95;
  text-align: center;
  white-space: nowrap;
  -webkit-text-stroke: 9px var(--rim);
  paint-order: stroke fill;
}

.stamp small {
  display: block;
  color: #ff8a2a;
  font-size: 0.5em;
  -webkit-text-stroke-width: 6px;
}

/* The first loop's hint: a fingertip on the waiting car, and what to do. */
.tap {
  position: absolute;
  right: calc(var(--b) / 2);
  top: var(--y-in);
  width: 54px;
  height: 54px;
  margin: -27px -27px 0 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(42, 29, 18, 0.4);
  animation: tap 1.4s ease-in-out infinite;
}

.tap b {
  position: absolute;
  right: 66px;
  top: 50%;
  translate: 0 -50%;
  padding: 4px 12px;
  border: 3px solid var(--rim);
  border-radius: 999px;
  background: var(--panel);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes tap {
  50% {
    scale: 0.82;
    opacity: 0.75;
  }
}

/* ---------- Each loop's own move ---------- */
/* Stamps by kind. */
.stamp.crash {
  color: #ff5d70;
}

.stamp.rew {
  color: #c4b0ff;
}

.stamp.nitro,
.stamp.brake {
  color: #ff8a2a;
}

/* 2. Thread the Needle: a second car crosses just behind this one. */
.tr.late {
  --reach: min(calc(260px + 2.6 * var(--car)), calc((100cqw - var(--b) - var(--r) - var(--s)) * 0.95));
}

/* 3. Drops: coins on the road, scooped as the car comes down. (--y is each coin's place down the loop; it means the same
   in top and in a timeline range, both measured on the loop's height.) */
.drop {
  position: absolute;
  left: calc(100% - var(--b) / 2);
  top: var(--y);
  width: calc(var(--b) * 0.62);
  aspect-ratio: 1;
  margin: calc(var(--b) * -0.31) 0 0 calc(var(--b) * -0.31);
  background: url('/img/cars/coin.svg') center / contain no-repeat;
}

.drop::after {
  content: '+2';
  position: absolute;
  left: -40%;
  bottom: 110%;
  color: var(--gold-text);
  font-family: 'Lilita One', sans-serif;
  font-size: 22px;
  -webkit-text-stroke: 5px var(--rim);
  paint-order: stroke fill;
  opacity: 0;
}

.drop.k1 {
  --y: calc(100% - var(--o) - 460px);
}

.drop.k2 {
  --y: calc(100% - var(--o) - 390px);
}

.drop.k3 {
  --y: calc(100% - var(--o) - 320px);
}

.drop.k4 {
  --y: calc(100% - var(--o) - 250px);
}

/* 4. The train: a rail across the loop. The car stops short of it (handbrake) while the train goes by, then goes. */
.train {
  --rail-off: calc(var(--o) + 140px);
  --stop-off: calc(var(--rail-off) + var(--b) / 2 + var(--car) * 0.75);
}

/* Room below the words and clip for the rail, at every width. */
.stop.train {
  padding-bottom: calc(var(--o) + 250px);
}

.rail {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - var(--rail-off));
  height: 30px;
  margin-top: -15px;
  background:
    linear-gradient(#c9ced8, #c9ced8) 0 6px / 100% 3px no-repeat,
    linear-gradient(#c9ced8, #c9ced8) 0 21px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #7a5536 0 8px, transparent 8px 22px);
}

.lamp {
  position: absolute;
  left: calc(100% - var(--b) - 22px);
  top: calc(100% - var(--rail-off) - 36px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 0 3px var(--rim), 0 0 16px 5px rgba(255, 59, 59, 0.7);
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.loco {
  --tw: calc(330 * var(--u));
  position: absolute;
  /* Its nose (294 units in) on the crossing at translate 0. */
  left: calc(100% - var(--b) / 2 - 294 * var(--u));
  top: calc(100% - var(--rail-off));
  width: var(--tw);
  height: calc(48 * var(--u));
  margin-top: calc(-24 * var(--u));
  background: url('/img/cars/train.svg') center / 100% 100% no-repeat;
  opacity: 0;
  will-change: transform;
}

.train .stamp {
  top: calc(100% - var(--rail-off) - 80px);
}

.train .stamp.brake {
  top: calc(100% - var(--rail-off) - 170px);
}

.train .burst {
  top: calc(100% - var(--rail-off));
}

/* The car's brake lights, and its nitro flame. */
.you::before,
.you::after {
  content: '';
  position: absolute;
  top: 50%;
  opacity: 0;
}

.you::after {
  left: -4%;
  width: 14%;
  height: 70%;
  margin-top: -14%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #ff2b2b, rgba(255, 43, 43, 0));
}

.you::before {
  right: 100%;
  width: 34%;
  height: 46%;
  translate: 6% -50%;
  border-radius: 50% 0 0 50%;
  background: radial-gradient(ellipse at 100% 50%, #fff6b8 0 18%, #ffb02e 40%, rgba(255, 80, 30, 0.85) 62%, rgba(255, 60, 30, 0) 75%);
}

/* 5. Power-ups: a truck the car can't miss. CRASH, REWIND, then a JUMP clean over it, and NITRO round the corner. */
.powerups {
  /* The crash: the car's centre this far up from the bottom, just short of the crossing. */
  --cy-off: calc(var(--o) - var(--b) / 2 + var(--car) * 0.9);
}

.tr.truck {
  width: calc(120 * var(--u));
  height: calc(44 * var(--u));
  margin: calc(-22 * var(--u)) 0 0 calc(-44 * var(--u));
  background-image: url('/img/cars/truck.svg');
}

.tint {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--r) + var(--b) / 2);
  background: rgba(138, 99, 242, 0.2);
  box-shadow: inset 0 0 120px rgba(138, 99, 242, 0.45);
  opacity: 0;
}

.spark {
  position: absolute;
  left: calc(100% - var(--b) / 2);
  top: calc(100% - var(--cy-off) + var(--car) * 0.5);
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  background: #ffd23a;
  clip-path: polygon(50% 0, 60% 35%, 98% 22%, 68% 50%, 100% 75%, 60% 64%, 50% 100%, 40% 64%, 2% 78%, 32% 50%, 0 24%, 40% 35%);
  opacity: 0;
}

.powerups .stamp.crash,
.powerups .stamp.rew {
  top: calc(100% - var(--o) - 170px);
}

.powerups .stamp.nitro {
  right: auto;
  left: 50%;
  top: calc(100% - var(--b) - 90px);
  transform-origin: center;
  translate: -50% 0;
  rotate: -4deg;
}

/* 6. Daily: the car drives under today's checkpoint (--arch-y down the loop; below the words and clip on phones). */
.daily {
  --arch-y: calc(100% - var(--o) - 360px);
}

.arch {
  position: absolute;
  left: calc(100% - var(--b) / 2);
  top: var(--arch-y);
  width: calc(var(--b) + 70px);
  margin: -26px 0 0 calc((var(--b) + 70px) / -2);
  padding: 2px 0 6px;
  border: 3px solid var(--rim);
  border-radius: 12px;
  background: linear-gradient(#ffa25a, #f0661e);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: 'Lilita One', sans-serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}

.arch small {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  -webkit-text-stroke-width: 3px;
}

.stop:nth-child(even) .arch {
  left: calc(var(--b) / 2);
}

/* 7. Showcase and the finish: camera flashes as the car goes by, then PERFECT LOOP! over the line (with room for it
   below the words and clip). */
.stop.finish {
  padding-bottom: calc(var(--b) + 290px);
}

.flash {
  position: absolute;
  left: calc(100% - var(--b) / 2);
  top: var(--y);
  width: 140px;
  height: 140px;
  margin: -70px 0 0 -70px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff, rgba(255, 255, 255, 0.6) 30%, rgba(255, 255, 255, 0));
  opacity: 0;
}

.flash.f1 {
  --y: calc(100% - var(--o) - 520px);
}

.flash.f2 {
  --y: calc(100% - var(--o) - 400px);
}

.flash.f3 {
  --y: calc(100% - var(--o) - 280px);
}

.finish .stamp {
  right: auto;
  left: 50%;
  top: calc(100% - var(--b) - 190px);
  font-size: clamp(28px, 8.4vw, 64px);
  transform-origin: center;
  translate: -50% 0;
}

.trophy {
  position: absolute;
  left: 50%;
  top: calc(100% - var(--b) - 92px);
  display: flex;
  gap: 8px;
  translate: -50% 0;
}

.trophy i {
  width: 46px;
  height: 46px;
  background: linear-gradient(160deg, #fff7b0, #ffd23a 45%, #f08a00);
  clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 61%, 80% 100%, 50% 79%, 20% 100%, 29% 61%, 0 38%, 37% 35%);
  opacity: 0;
}

.trophy i:nth-child(2) {
  width: 60px;
  height: 60px;
  margin-top: -10px;
}

/* ---------- What's in each loop ---------- */
.node {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.lvl {
  width: 52px;
  height: 52px;
  font-size: 26px;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  background: radial-gradient(circle at 35% 28%, #7db8ff 0%, #3b8cf0 40%, #1f63c4 100%);
}

.stars {
  display: flex;
  gap: 3px;
}

.stars i {
  position: relative;
  width: 22px;
  height: 22px;
  background: #3a4462;
  clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 61%, 80% 100%, 50% 79%, 20% 100%, 29% 61%, 0 38%, 37% 35%);
}

.stars i::after,
.lvl::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
}

.stars i::after {
  background: var(--gold-text);
}

.lvl {
  position: relative;
  isolation: isolate;
}

.lvl::before {
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #b8f0a8 0%, #3fae49 40%, #237a2c 100%);
}

/* (No content-visibility here: a loop's height must never change as its clip comes into view, or the car's timing would
   shift with it. The clips themselves still load lazily.) */
.media {
  grid-row: 1;
  grid-column: 1;
}

.copy {
  grid-row: 1;
  grid-column: 2;
  max-width: 440px;
}

.right {
  grid-template-columns: 1fr auto;
}

.right .media {
  grid-column: 2;
}

.right .copy {
  grid-column: 1;
  justify-self: end;
}

.copy h2 {
  margin: 12px 0 10px;
  text-wrap: balance;
  font-size: clamp(38px, 4.6vw, 58px);
  line-height: 1;
  -webkit-text-stroke-width: 9px;
}

.copy p {
  margin: 0 0 12px;
  font-size: 18px;
  opacity: 0.9;
}

.copy .btn {
  margin-top: 10px;
  white-space: nowrap;
}

.label {
  display: inline-block;
  padding: 4px 14px;
  border: 3px solid var(--rim);
  border-radius: 12px;
  background: var(--gold);
  color: #fff;
  font-size: 22px;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  transform: rotate(-4deg);
  transition: transform 0.35s var(--spring);
}

.stop:hover .label {
  transform: rotate(3deg) scale(1.12);
}

.label.green {
  background: #3fae49;
}

.label.red {
  background: #ff5d70;
}

.label.purple {
  background: #8a63f2;
}

.label.orange {
  background: #ff8540;
}

.label.pink {
  background: #e2477a;
}

.label.teal {
  background: #2cc4b4;
}

/* A phone playing a clip, its first frame showing until the clip arrives. */
.phone {
  position: relative;
  width: min(300px, 70vw);
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  border: 7px solid var(--rim);
  border-radius: 38px;
  background: #000 center / cover no-repeat;
  box-shadow: 0 0 0 2px var(--slate), 0 30px 60px rgba(0, 0, 0, 0.6);
  transform: rotate(-3deg);
  transition: transform 0.4s var(--spring);
}

.right .phone {
  transform: rotate(3deg);
}

.phone:hover {
  transform: rotate(0) scale(1.04);
}

.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-basics {
  background-image: url('/clips/basics.webp');
}

.clip-thread {
  background-image: url('/clips/thread.webp');
}

.clip-drops {
  background-image: url('/clips/drops.webp');
}

.clip-train {
  background-image: url('/clips/train.webp');
}

.clip-jump {
  background-image: url('/clips/jump.webp');
}

.clip-daily {
  background-image: url('/img/daily.webp');
}

.clip-showcase {
  background-image: url('/img/showcase.webp');
}

/* The daily's three screens, one after another. */
.slides img {
  position: absolute;
  inset: 0;
  animation: slide 9s infinite both;
}

.slides img:nth-child(2) {
  animation-delay: 3s;
}

.slides img:nth-child(3) {
  animation-delay: 6s;
}

.slides img:first-child {
  position: relative;
}

@keyframes slide {
  0% {
    opacity: 0;
    transform: scale(1.08);
  }

  6%,
  33% {
    opacity: 1;
    transform: none;
  }

  40%,
  100% {
    opacity: 0;
  }
}

/* The power-ups, each bouncing in turn. */
.powers {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 18px 0 6px;
  padding: 0;
  list-style: none;
}

.powers li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 70px;
  font-family: 'Lilita One', sans-serif;
  font-size: 15px;
  text-align: center;
}

.powers .round {
  width: 58px;
  height: 58px;
  animation: hop 3s ease-in-out infinite;
}

.powers li:nth-child(2) .round {
  animation-delay: 0.3s;
}

.powers li:nth-child(3) .round {
  animation-delay: 0.6s;
}

.powers li:nth-child(4) .round {
  animation-delay: 0.9s;
}

.powers li:nth-child(5) .round {
  animation-delay: 1.2s;
}

.powers li:hover .round {
  transform: translateY(-8px) rotate(-12deg) scale(1.15);
}

@keyframes hop {
  0%,
  80%,
  100% {
    translate: 0 0;
  }

  88% {
    translate: 0 -10px;
  }
}

/* ---------- Trailer ---------- */
.trailer {
  padding: 90px 0 30px;
  text-align: center;
}

.trailer .screen {
  max-width: 960px;
  margin: 0 auto;
  overflow: hidden;
  border: 4px solid var(--rim);
  border-radius: 20px;
  background: var(--rim);
  box-shadow: 0 0 0 2px var(--gold), 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 50px rgba(255, 204, 46, 0.25);
}

.trailer video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* ---------- Sceneries ---------- */
.sceneries {
  padding: 90px 0 40px;
  background: linear-gradient(var(--night-2), var(--night));
  text-align: center;
}

.trailer h2,
.sceneries h2,
.play h2 {
  margin: 0 0 10px;
  text-wrap: balance;
  font-size: clamp(42px, 6vw, 64px);
  line-height: 1;
  -webkit-text-stroke-width: 10px;
}

.sub {
  max-width: 620px;
  margin: 0 auto 40px;
  font-size: 18px;
  opacity: 0.9;
}

.scenes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scenes li {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--rim);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 0 0 2px var(--slate), 0 14px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s var(--spring);
}

.scenes li:nth-child(odd) {
  transform: rotate(-1.5deg);
}

.scenes li:nth-child(even) {
  transform: rotate(1.5deg);
}

.scenes li:hover {
  z-index: 1;
  transform: rotate(0) scale(1.05);
}

.scenes img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.scenes li:hover img {
  transform: scale(1.08);
}

.scenes span {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 24px;
  -webkit-text-stroke-width: 6px;
}

/* The night card: the moon, and its headlights' glow. */
.scenes .moon {
  box-shadow: 0 0 0 2px #8fa2e8, 0 0 40px rgba(143, 162, 232, 0.45), 0 14px 30px rgba(0, 0, 0, 0.4);
}

/* ---------- Where to play ---------- */
.play {
  position: relative;
  overflow: hidden;
  padding: 100px 0 110px;
  text-align: center;
}

.play::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240vmax;
  height: 240vmax;
  margin: -120vmax 0 0 -120vmax;
  background: repeating-conic-gradient(rgba(255, 210, 60, 0.07) 0 6deg, transparent 6deg 14deg);
  animation: spin 90s linear infinite;
}

.play > * {
  position: relative;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px 22px;
  margin-top: 10px;
}

.store {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px 14px 18px;
  border: 3.5px solid var(--rim);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 0 0 2px var(--slate), 0 8px 0 var(--rim);
  text-align: left;
  line-height: 1.1;
}

.store .round {
  width: 54px;
  height: 54px;
}

.store small {
  display: block;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.75;
}

.store b {
  font-family: 'Lilita One', sans-serif;
  font-weight: 400;
  font-size: 30px;
}

.store .soon {
  top: -12px;
  right: -14px;
}

/* A store that's open: a link, rimmed in gold. */
a.store {
  text-decoration: none;
  box-shadow: 0 0 0 2px var(--gold), 0 8px 0 var(--rim), 0 0 40px rgba(255, 204, 46, 0.35);
  transition: transform 0.3s var(--spring);
  -webkit-tap-highlight-color: transparent;
}

a.store:hover {
  transform: translateY(-4px) scale(1.04) rotate(-1deg);
}

a.store:hover .round {
  transform: rotate(-12deg) scale(1.12);
}

a.store:active {
  transform: translateY(3px) scale(0.97);
  transition-duration: 0.05s;
}

.play-note {
  max-width: 560px;
  margin: 34px auto 0;
  opacity: 0.85;
}

/* Coins about the stores, spinning. */
.coin {
  position: absolute;
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 0 14px rgba(255, 204, 46, 0.55));
}

.coin svg {
  display: block;
  width: 100%;
  height: 100%;
  animation: spin-y 1.8s linear infinite;
}

.coin.c1 {
  left: 8%;
  top: 18%;
  animation: bob 3s ease-in-out infinite;
}

.coin.c2 {
  right: 10%;
  top: 26%;
  width: 40px;
  height: 40px;
  animation: bob 3.6s ease-in-out 0.6s infinite;
}

.coin.c3 {
  right: 22%;
  bottom: 12%;
  animation: bob 2.8s ease-in-out 1.1s infinite;
}

.coin.c4 {
  left: 18%;
  bottom: 16%;
  width: 36px;
  height: 36px;
  animation: bob 3.2s ease-in-out 0.3s infinite;
}

@keyframes spin-y {
  to {
    transform: rotateY(360deg);
  }
}

@keyframes bob {
  50% {
    translate: 0 -14px;
  }
}

/* ---------- Footer ---------- */
footer {
  padding: 30px 0 40px;
  border-top: 2px solid var(--panel);
  color: #b8c4ec;
  font-size: 15px;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
}

/* ---------- On scroll, where the browser can tie animation to it ---------- */
@supports (animation-timeline: view()) {
  .num {
    animation: count linear both;
    animation-timeline: view();
    animation-range: entry 10% cover 40%;
  }

  @keyframes count {
    from {
      --n: 0;
    }
  }

  .media,
  .copy {
    animation: in-left linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 30%;
  }

  .right .media,
  .left .copy {
    animation-name: in-right;
  }

  @keyframes in-left {
    from {
      opacity: 0;
      translate: -60px 0;
      rotate: -4deg;
    }
  }

  @keyframes in-right {
    from {
      opacity: 0;
      translate: 60px 0;
      rotate: 4deg;
    }
  }

  .stars i,
  .stars i::after {
    animation: star-on linear both;
    animation-timeline: view();
  }

  .stars i::after {
    animation-name: show;
  }

  .stars i:nth-child(1) {
    animation-range: cover 30% cover 36%;
  }

  .stars i:nth-child(2) {
    animation-range: cover 36% cover 42%;
  }

  .stars i:nth-child(3) {
    animation-range: cover 42% cover 48%;
  }

  @keyframes star-on {
    to {
      scale: 1.25;
    }
  }

  .lvl,
  .lvl::before {
    animation: lvl-on linear both;
    animation-timeline: view();
    animation-range: cover 25% cover 35%;
  }

  .lvl::before {
    animation-name: show;
  }

  @keyframes show {
    to {
      opacity: 1;
    }
  }

  @keyframes lvl-on {
    50% {
      scale: 1.3;
    }
  }

  .scenes li,
  .store {
    animation: pop-in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }

  @keyframes pop-in {
    from {
      opacity: 0;
      scale: 0.7;
      translate: 0 60px;
    }
  }
}

/* ---------- The drive: the car, the traffic and the stamps, tied to the scroll ---------- */
/* Every feature it needs, so a browser with only some of them gets the parked board instead. (The animation shorthand
   resets timelines and ranges, so those come after it.) */
@supports (view-timeline: --a) and (view-timeline-inset: 50%) and (animation-range: cover 1px cover calc(100% - 1px)) and (offset-path: inset(1px round 1px)) {
  /* Down the side one for one with the scroll, then round the corner and along the bottom to the next loop; seen only
     on its own loop, and turning in from the last one. */
  .you {
    animation:
      you-side linear,
      you-run linear forwards,
      you-on linear,
      you-turn ease-out;
    animation-timeline: --loop, --loop, --loop, --loop;
    animation-range:
      cover var(--y-in) cover calc(100% - var(--b) / 2 - var(--r)),
      cover calc(100% - var(--b) / 2 - var(--r)) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(var(--y-in) + 60px);
  }

  /* The first loop's car waits in view before it sets off (the parked board shows it anyway), and goes at the hand-off. */
  .stop:first-child .you {
    opacity: 0;
    animation-name: you-side, you-run, you-on, none;
    animation-fill-mode: none, forwards, backwards, none;
  }

  .stop:last-child .you {
    animation-fill-mode: none, forwards, forwards, none;
  }

  @keyframes you-side {
    to {
      translate: 0 calc(100cqh - var(--b) / 2 - var(--r) - var(--y-in));
    }
  }

  /* (Back on the curve, the side run's translate lets go, whatever held it.) */
  @keyframes you-run {
    from {
      offset-distance: var(--d-corner);
      translate: 0 0;
    }

    to {
      offset-distance: var(--d-out);
      translate: 0 0;
    }
  }

  @keyframes you-on {
    from,
    to {
      opacity: 1;
    }
  }

  @keyframes you-turn {
    from {
      transform: rotate(-90deg);
    }
  }

  /* Traffic crosses just before the car gets there: it passes the crossing (70% of the way) when the car is a length
     short of it. */
  .tr {
    animation: tr-pass linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--at) - 220px) cover calc(var(--at) + 95px);
  }

  @keyframes tr-pass {
    from {
      translate: calc(-1 * var(--reach)) 0;
    }

    70% {
      translate: 0 0;
    }

    88% {
      opacity: 1;
    }

    to {
      translate: calc(var(--s) - var(--r)) 0;
      opacity: 0;
    }
  }

  .stamp {
    animation: stamp linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--at) + var(--car) * 0.6) cover calc(var(--at) + 460px);
  }

  @keyframes stamp {
    0% {
      opacity: 0;
      scale: 2.4;
    }

    6% {
      opacity: 1;
      scale: 0.9;
    }

    11% {
      scale: 1;
    }

    75% {
      opacity: 1;
    }

    100% {
      opacity: 0;
      scale: 1.06;
    }
  }

  .burst {
    animation: burst ease-out forwards;
    animation-timeline: --loop;
    animation-range: cover calc(var(--at) + var(--car) * 0.6) cover calc(var(--at) + 240px);
  }

  @keyframes burst {
    from {
      opacity: 1;
      scale: 0.2;
    }

    to {
      opacity: 0;
      scale: 1.7;
      border-width: 2px;
    }
  }

  /* A crossing turns green once the car is through it. */
  .pad::before,
  .pad::after {
    animation: tick linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--at) + var(--car) * 1.6) cover calc(var(--at) + var(--car) * 1.6 + 20px);
  }

  .pad.hand::before,
  .pad.hand::after {
    animation-range: cover calc(100% - var(--b) / 2) cover calc(100% - var(--b) / 2 + 20px);
  }

  @keyframes tick {
    to {
      opacity: 1;
    }
  }

  /* 2. The second car crosses a couple of lengths behind. */
  .tr.late {
    animation-range: cover calc(var(--at) + var(--car) * 2.4 - 220px) cover calc(var(--at) + var(--car) * 2.4 + 95px);
  }

  /* 3. Each coin goes as the car's nose reaches it. */
  .drop {
    animation: drop-get linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--y) - var(--car) * 0.5) cover calc(var(--y) - var(--car) * 0.5 + 70px);
  }

  .drop::after {
    animation: plus linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--y) - var(--car) * 0.5) cover calc(var(--y) - var(--car) * 0.5 + 110px);
  }

  @keyframes drop-get {
    to {
      scale: 1.9;
      translate: 0 -24px;
      opacity: 0;
    }
  }

  @keyframes plus {
    15%,
    70% {
      opacity: 1;
    }

    to {
      opacity: 0;
      translate: 0 -30px;
    }
  }

  /* 4. Brake for the train, hold while it passes, then catch up. */
  .train .you {
    animation:
      you-to-stop linear forwards,
      you-go linear,
      you-run linear forwards,
      you-on linear,
      you-turn ease-out;
    animation-timeline: --loop, --loop, --loop, --loop, --loop;
    animation-range:
      cover var(--y-in) cover calc(100% - var(--stop-off)),
      cover calc(100% - var(--stop-off) + 180px) cover calc(100% - var(--b) / 2 - var(--r)),
      cover calc(100% - var(--b) / 2 - var(--r)) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(var(--y-in) + 60px);
  }

  @keyframes you-to-stop {
    to {
      translate: 0 calc(100cqh - var(--stop-off) - var(--y-in));
    }
  }

  @keyframes you-go {
    from {
      translate: 0 calc(100cqh - var(--stop-off) - var(--y-in));
    }

    to {
      translate: 0 calc(100cqh - var(--b) / 2 - var(--r) - var(--y-in));
    }
  }

  .train .you::after {
    animation: lit linear both;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--stop-off) - 40px) cover calc(100% - var(--stop-off) + 190px);
  }

  @keyframes lit {
    10%,
    90% {
      opacity: 1;
    }
  }

  /* The train's nose reaches the road 20px into the stop and its tail clears it at 160. */
  .loco {
    animation: loco linear both;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--stop-off) - 100px) cover calc(100% - var(--stop-off) + 260px);
  }

  @keyframes loco {
    from {
      translate: calc(-0.5 * var(--b) - 0.7 * (var(--tw) + var(--b))) 0;
      opacity: 0;
    }

    10% {
      opacity: 1;
    }

    33.3% {
      translate: calc(-0.5 * var(--b)) 0;
    }

    72.2% {
      translate: calc(292 * var(--u) + 0.5 * var(--b)) 0;
    }

    90% {
      opacity: 1;
    }

    to {
      translate: calc(292 * var(--u) + 0.5 * var(--b) + 0.5 * (var(--tw) + var(--b))) 0;
      opacity: 0;
    }
  }

  .train .stamp.brake {
    animation-range: cover calc(100% - var(--stop-off) - 10px) cover calc(100% - var(--stop-off) + 200px);
  }

  .train .stamp:not(.brake),
  .train .burst {
    animation-range: cover calc(100% - var(--stop-off) + 160px) cover calc(100% - var(--stop-off) + 520px);
  }

  .train .burst {
    animation-range: cover calc(100% - var(--stop-off) + 160px) cover calc(100% - var(--stop-off) + 380px);
  }

  .train .pad.cross::before,
  .train .pad.cross::after {
    animation-range: cover calc(100% - var(--o) + var(--b)) cover calc(100% - var(--o) + var(--b) + 20px);
  }

  /* 5. Power-ups. Ahead of the scroll to the crash (so there's room for the rest before the next loop), stopped,
     wound back, then over the truck and round the corner on nitro. */
  .powerups .you {
    animation:
      you-crash linear forwards,
      you-rewind ease-in-out forwards,
      you-again linear,
      you-run linear forwards,
      you-on linear,
      you-turn ease-out,
      you-jump linear;
    animation-timeline: --loop, --loop, --loop, --loop, --loop, --loop, --loop;
    animation-range:
      cover var(--y-in) cover calc(100% - var(--cy-off) - 260px),
      cover calc(100% - var(--cy-off) - 210px) cover calc(100% - var(--cy-off) - 110px),
      cover calc(100% - var(--cy-off) - 50px) cover calc(100% - var(--cy-off) + 90px),
      cover calc(100% - var(--cy-off) + 90px) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(100% - var(--b) / 2),
      cover var(--y-in) cover calc(var(--y-in) + 60px),
      cover calc(100% - var(--cy-off) - 50px) cover calc(100% - var(--cy-off) + 90px);
  }

  @keyframes you-crash {
    to {
      translate: 0 calc(100cqh - var(--cy-off) - var(--y-in));
    }
  }

  @keyframes you-rewind {
    from {
      translate: 0 calc(100cqh - var(--cy-off) - var(--y-in));
    }

    to {
      translate: 0 calc(100cqh - var(--cy-off) - 150px - var(--y-in));
    }
  }

  @keyframes you-again {
    from {
      translate: 0 calc(100cqh - var(--cy-off) - 150px - var(--y-in));
    }

    to {
      translate: 0 calc(100cqh - var(--b) / 2 - var(--r) - var(--y-in));
    }
  }

  @keyframes you-jump {
    0%,
    60%,
    96%,
    100% {
      transform: none;
    }

    78% {
      transform: scale(1.6);
    }
  }

  .powerups .you::before {
    animation: lit linear both;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--cy-off) + 90px) cover calc(100% - var(--b) / 2 + 40px);
  }

  .tr.truck {
    animation: truck-in linear both, truck-back ease-in-out forwards, truck-on linear forwards;
    animation-timeline: --loop, --loop, --loop;
    animation-range:
      cover calc(100% - var(--cy-off) - 440px) cover calc(100% - var(--cy-off) - 260px),
      cover calc(100% - var(--cy-off) - 210px) cover calc(100% - var(--cy-off) - 110px),
      cover calc(100% - var(--cy-off) - 50px) cover calc(100% - var(--cy-off) + 90px);
  }

  @keyframes truck-in {
    from {
      translate: calc(-1 * var(--reach)) 0;
    }

    to {
      translate: 0 0;
    }
  }

  @keyframes truck-back {
    from {
      translate: 0 0;
    }

    to {
      translate: calc(var(--car) * -2.4) 0;
    }
  }

  @keyframes truck-on {
    from {
      translate: calc(var(--car) * -2.4) 0;
    }

    78% {
      translate: 0 0;
    }

    92% {
      opacity: 1;
    }

    to {
      translate: calc(var(--s) - var(--r)) 0;
      opacity: 0;
    }
  }

  .spark {
    animation: spark ease-out forwards;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--cy-off) - 262px) cover calc(100% - var(--cy-off) - 200px);
  }

  @keyframes spark {
    from {
      opacity: 1;
      scale: 0.3;
      rotate: 0deg;
    }

    to {
      opacity: 0;
      scale: 1.5;
      rotate: 40deg;
    }
  }

  .tint {
    animation: tint linear both;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--cy-off) - 215px) cover calc(100% - var(--cy-off) - 40px);
  }

  @keyframes tint {
    12%,
    80% {
      opacity: 1;
    }
  }

  .powerups .stamp.crash {
    animation-range: cover calc(100% - var(--cy-off) - 262px) cover calc(100% - var(--cy-off) - 150px);
  }

  .powerups .stamp.rew {
    animation-range: cover calc(100% - var(--cy-off) - 205px) cover calc(100% - var(--cy-off) - 45px);
  }

  .powerups .stamp:not(.crash, .rew, .nitro),
  .powerups .burst {
    animation-range: cover calc(100% - var(--cy-off) + 55px) cover calc(100% - var(--cy-off) + 360px);
  }

  .powerups .stamp.nitro {
    animation-range: cover calc(100% - var(--cy-off) + 90px) cover calc(100% - var(--b) / 2 + 220px);
  }

  .powerups .pad.cross::before,
  .powerups .pad.cross::after {
    animation-range: cover calc(100% - var(--cy-off) + 70px) cover calc(100% - var(--cy-off) + 90px);
  }

  /* 6. The checkpoint bounces as the car goes under. */
  .arch {
    animation: arch linear both;
    animation-timeline: --loop;
    animation-range: cover calc(var(--arch-y) - 40px) cover calc(var(--arch-y) + 60px);
  }

  @keyframes arch {
    50% {
      scale: 1.25;
      rotate: -4deg;
    }
  }

  /* 7. Flashes as the car passes each camera, then the finish. */
  .flash {
    animation: flash ease-out forwards;
    animation-timeline: --loop;
    animation-range: cover calc(var(--y) - 10px) cover calc(var(--y) + 90px);
  }

  @keyframes flash {
    from {
      opacity: 0.95;
      scale: 0.4;
    }

    to {
      opacity: 0;
      scale: 1.3;
    }
  }

  .finish .stamp {
    animation-range: cover calc(100% - var(--b) / 2 - 12px) cover calc(100% - var(--b) / 2 + 2000px);
  }

  @keyframes star-pop {
    from {
      opacity: 0;
      scale: 0;
      rotate: -60deg;
    }

    to {
      opacity: 1;
      scale: 1;
      rotate: 0deg;
    }
  }

  .trophy i {
    animation: star-pop ease-out both;
    animation-timeline: --loop;
    animation-range: cover calc(100% - var(--b) / 2) cover calc(100% - var(--b) / 2 + 40px);
  }

  .trophy i:nth-child(2) {
    animation-range: cover calc(100% - var(--b) / 2 + 30px) cover calc(100% - var(--b) / 2 + 70px);
  }

  .trophy i:nth-child(3) {
    animation-range: cover calc(100% - var(--b) / 2 + 60px) cover calc(100% - var(--b) / 2 + 100px);
  }

  /* The waiting car's fingertip goes once it's off. */
  .tap {
    animation: tap 1.4s ease-in-out infinite, tap-off linear both;
    animation-timeline: auto, --loop;
    animation-range: normal, cover calc(var(--y-in) - 80px) cover var(--y-in);
  }

  @keyframes tap-off {
    to {
      opacity: 0;
    }
  }
}

/* Without it: the board stands still, but the traffic keeps crossing. */
@supports not ((view-timeline: --a) and (view-timeline-inset: 50%) and (animation-range: cover 1px cover calc(100% - 1px)) and (offset-path: inset(1px round 1px))) {
  .tr {
    animation: tr-loop 5s linear infinite;
  }

  .stop:nth-child(even) .tr {
    animation-delay: -2.2s;
  }

  .tap b {
    display: none;
  }

  .loco {
    animation: loco-loop 7s linear infinite;
  }

  @keyframes loco-loop {
    from {
      translate: calc(-0.5 * var(--b) - 0.7 * (var(--tw) + var(--b))) 0;
      opacity: 0;
    }

    10%,
    85% {
      opacity: 1;
    }

    to {
      translate: calc(292 * var(--u) + 0.5 * var(--b) + 0.5 * (var(--tw) + var(--b))) 0;
      opacity: 0;
    }
  }

  @keyframes tr-loop {
    from {
      translate: calc(-1 * var(--reach)) 0;
      opacity: 0;
    }

    10%,
    85% {
      opacity: 1;
    }

    to {
      translate: calc(var(--s) - var(--r)) 0;
      opacity: 0;
    }
  }
}

/* ---------- Narrower windows: the same track, closer loops ---------- */
@media (max-width: 1059px) {
  .roadmap {
    --s: clamp(52px, 10vw, 110px);
    --r: clamp(34px, 6.5vw, 70px);
    --b: clamp(26px, 4.4vw, 44px);
    --o: clamp(104px, 18vw, 180px);
    --car: clamp(32px, 5vw, 50px);
    padding-inline: 12px;
  }

  .stop {
    gap: 0 32px;
    padding: calc(var(--o) + 24px) calc(var(--b) + 24px) calc(var(--o) + 70px);
  }

  .phone {
    width: clamp(180px, 26vw, 240px);
    border-radius: 30px;
  }

  .stamp {
    font-size: clamp(28px, 4.4vw, 44px);
  }
}

/* ---------- Phones and narrow windows ---------- */
@media (max-width: 860px) {
  .hero-bg {
    background-image: url('/clips/hero-tall.webp');
  }

  nav .links {
    display: none;
  }

  .still {
    margin-left: auto;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
    row-gap: 22px;
  }

  .scenes {
    grid-template-columns: 1fr 1fr;
  }
}

/* One column inside each loop: the words, then the phone. */
@media (max-width: 639px) {
  .stop,
  .right {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: calc(var(--o) + 18px) calc(var(--b) + 14px) calc(var(--o) + 64px);
  }

  .media,
  .right .media {
    grid-row: 2;
    grid-column: 1;
    justify-self: center;
  }

  .copy,
  .right .copy {
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
  }

  .phone {
    width: min(220px, 100%);
  }

  .tap b {
    font-size: 11px;
  }

  .daily {
    --arch-y: calc(100% - var(--o) - 34px);
  }

  .arch {
    width: calc(var(--b) + 22px);
    margin-left: calc((var(--b) + 22px) / -2);
    font-size: 13px;
    -webkit-text-stroke-width: 3px;
  }

  .arch small {
    display: none;
  }
}

@media (max-width: 520px) {
  .btn.big {
    min-height: 64px;
    padding: 0 30px;
    font-size: 28px;
  }

  .copy h2 {
    -webkit-text-stroke-width: 7px;
  }

  .copy p {
    font-size: 16.5px;
  }

  .copy .btn {
    min-height: 52px;
    padding: 0 20px;
    font-size: 21px;
  }

  .copy .btn svg {
    width: 22px;
    height: 22px;
  }

  .scenes {
    gap: 12px;
  }

  .scenes span {
    font-size: 18px;
    -webkit-text-stroke-width: 5px;
  }

  .store b {
    font-size: 26px;
  }

  /* The coins keep to the corners, clear of the heading. */
  .coin.c1 {
    left: 3%;
    top: 5%;
  }

  .coin.c2 {
    right: 4%;
    top: 8%;
  }

  .coin.c3 {
    right: 6%;
    bottom: 4%;
  }

  .coin.c4 {
    left: 6%;
    bottom: 5%;
  }
}

/* ---------- Still: the Motion switch off, or reduced motion asked for ---------- */
/* Everything settles where it ends up (a paused scroll reveal would leave its element hidden), and the clips give way
   to their first frames (each clip's background). */
html:has(#still:checked) *,
html:has(#still:checked) *::before,
html:has(#still:checked) *::after {
  animation: none !important;
  transition: none !important;
}

html:has(#still:checked) .clip img,
html:has(#still:checked) .slides img:not(:first-child) {
  visibility: hidden;
}

/* The board parks: the car waits at the start of the first loop. */
html:has(#still:checked) .stop:first-child .you {
  opacity: 1;
}

@supports not selector(:has(*)) {
  .still {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .still {
    display: none;
  }

  .slides img:not(:first-child) {
    display: none;
  }

  .stop:first-child .you {
    opacity: 1;
  }
}
