/* Splash screen, loading bar and the first-time intro. */

#splash {
  align-items: center; justify-content: center; gap: clamp(8px, 2.4dvh, 20px); overflow: hidden; text-align: center;
  background: linear-gradient(#4fb0ea, #bfe8ff 62%, #8fd07a 62%, #5fb85a);
}
.splash-sun {
  position: absolute; top: 8%; right: 12%; width: clamp(70px, 14vmin, 130px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #fff6c4 0 45%, #ffd75a 46% 70%, rgba(255, 215, 90, 0) 71%);
  animation: sunGlow 4s ease-in-out infinite alternate;
}
@keyframes sunGlow { to { transform: scale(1.08); } }
.splash-hills {
  position: absolute; inset: auto 0 38% 0; height: 22%;
  background:
    radial-gradient(60% 100% at 20% 100%, #7cc56d 0 60%, transparent 61%),
    radial-gradient(50% 90% at 75% 100%, #6dbb5f 0 60%, transparent 61%);
}
.splash-logo {
  position: relative; margin: 0; font-family: var(--display); font-weight: 400; letter-spacing: -.01em;
  font-size: clamp(2.6rem, 11vmin, 5.5rem); line-height: 1; color: var(--red);
  text-shadow: 0 4px 0 #fff, 0 8px 14px rgba(20, 30, 50, .25);
  animation: logoIn .9s cubic-bezier(.16, 1, .3, 1) both;
}
.splash-logo span { color: var(--ink); margin-left: .2em; }
@keyframes logoIn { from { transform: translateY(-40px) scale(.85); opacity: 0; } }
.splash-tag { text-shadow: 0 1px 0 rgba(255,255,255,.6); position: relative; margin: 0; font-family: var(--display); font-size: clamp(1rem, 3.4vmin, 1.5rem); color: var(--ink); animation: logoIn .9s .2s cubic-bezier(.16, 1, .3, 1) both; }

/* The loading bar is a little road. His car drives along it as things load. */
.loader { position: relative; width: min(560px, 82vw); height: 70px; margin-top: 8px; }
.loader-track {
  position: absolute; left: 0; right: 0; bottom: 6px; height: 22px; border-radius: 999px; overflow: hidden;
  background: var(--asphalt); box-shadow: inset 0 3px 4px rgba(0, 0, 0, .35), 0 2px 0 #fff;
}
.loader-track::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 3px; translate: 0 -50%;
  background: repeating-linear-gradient(90deg, var(--lane) 0 16px, transparent 16px 30px); opacity: .7;
}
.loader-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(#4cc274, var(--go)); transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.loader-flag {
  position: absolute; right: 0; top: 0; bottom: 0; width: 22px;
  background: conic-gradient(#fff 25%, #1c2333 0 50%, #fff 0 75%, #1c2333 0) 0 0 / 11px 11px;
}
.loader-car { position: absolute; left: 0; bottom: 14px; width: 110px; translate: -50% 0; transition: left .35s cubic-bezier(.2, .8, .2, 1); }
.loader-car svg { width: 100%; height: auto; display: block; }
.loader-text { text-shadow: 0 1px 0 rgba(255,255,255,.6); position: relative; margin: 0; min-height: 1.4em; font-weight: 700; font-size: clamp(1rem, 3vmin, 1.2rem); color: var(--ink); }
.splash-start { position: relative; animation: startPulse 1.4s ease-in-out infinite; }
.splash-start[hidden] { display: none; }
@keyframes startPulse { 50% { transform: scale(1.05); box-shadow: 0 10px 22px rgba(20, 30, 50, .3); } }
.splash-done .loader, .splash-done .loader-text { display: none; }

/* Intro */
#intro { align-items: center; justify-content: center; background: linear-gradient(var(--sky-top), var(--sky-bottom)); }
.intro-card {
  width: min(680px, 100%); background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(16px, 4dvh, 32px); display: flex; flex-direction: column; gap: clamp(10px, 3dvh, 22px); align-items: center; text-align: center;
}
.intro-card .mech { justify-content: center; }
.intro-card .mech .bubble { font-size: clamp(1.15rem, 3.6dvh, 1.5rem); max-width: 28ch; }
.intro-pic { height: clamp(70px, 22dvh, 150px); display: grid; place-items: center; }
.intro-pic svg { height: 100%; width: auto; max-width: 70vw; }
.intro-pic .i { width: clamp(64px, 18dvh, 120px); height: clamp(64px, 18dvh, 120px); color: var(--gold); }
.intro-nav { display: flex; align-items: center; gap: 14px; width: 100%; justify-content: space-between; }
.intro-nav .dots { display: flex; gap: 8px; }
.intro-nav .dots i { width: 12px; height: 12px; border-radius: 50%; background: #d9d1bf; }
.intro-nav .dots i.on { background: var(--go); }
.intro-skip { border: 2px solid #d9d1bf; border-radius: 999px; padding: 8px 18px; background: none; font-family: var(--display); font-size: 1.1rem; color: var(--ink-soft); min-height: 48px; }

/* Screens slide in gently, so moving around feels like driving somewhere. */
.screen[data-active] { animation: screenIn .32s cubic-bezier(.16, 1, .3, 1); }
#race[data-active], #splash[data-active] { animation: none; }
@keyframes screenIn { from { opacity: 0; transform: translateX(24px); } }

@media (max-height: 420px) {
  .splash-logo { font-size: clamp(2.6rem, 15vmin, 4.5rem); }
  #splash { gap: 14px; }
  .splash-start { margin-top: 6px; }
  .splash-tag { display: none; }
  .loader { height: 58px; }
  .loader-car { width: 86px; }
  .intro-pic { display: none; }
}
/* Calm mode (grown-ups' screen) */
body.calm .screen[data-active], body.calm .splash-logo, body.calm .splash-tag, body.calm .splash-start, body.calm .splash-sun { animation: none; }

