:root {
  --bg: #f3e6cf;
  --bg-2: #ead6b3;
  --card: #fbf3e4;
  --line: #e0c9a3;
  --text: #3b2a1a;
  --muted: #7a6248;
  --rust: #c4452d;
  --orange: #e08a3c;
  --sun: #f2b84b;
  --teal: #2f7f7a;
  --sage: #6f8a5a;
  --topo: rgba(122, 98, 72, .12);
  --speed: 1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: Rye, Georgia, serif; font-weight: 400; margin: 0; }
a { color: inherit; }

/* Nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-family: Rye, serif; font-size: 18px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--rust); box-shadow: 0 0 0 3px var(--card); }
.nav nav { display: flex; gap: 20px; }
.nav nav a { text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; opacity: .75; }
.nav nav a:hover { opacity: 1; }

/* Hero */
.hero { position: relative; height: 100vh; min-height: 620px; overflow: hidden; }
.sky { position: absolute; inset: 0; background: linear-gradient(#f7ecd8 0%, #f6dfb8 50%, #f1c98f 78%); }
.sun {
  position: absolute; left: 68%; top: 34%; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, #fff6dc 0 45%, #fbe2a4 46% 60%, transparent 61%);
  box-shadow: 0 0 120px 40px rgba(250, 214, 140, .55);
  animation: shimmer 6s ease-in-out infinite alternate;
}
@keyframes shimmer { to { transform: scale(1.06); } }

.layer { position: absolute; left: 0; width: 3200px; display: flex; bottom: 24%; }
.layer svg { width: 1600px; height: 100%; flex: none; display: block; }
.mesas { height: 230px; animation: scroll calc(90s / var(--speed)) linear infinite; }
.dunes { height: 120px; animation: scroll calc(40s / var(--speed)) linear infinite; }
.roadside { height: 150px; bottom: calc(24% - 4px); animation: scroll calc(14s / var(--speed)) linear infinite; z-index: 2; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* Heat haze over the horizon */
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 24%; height: 60px; z-index: 1;
  background: linear-gradient(transparent, rgba(247, 236, 216, .45));
  animation: haze 3s ease-in-out infinite alternate;
}
@keyframes haze { to { opacity: .4; transform: scaleY(1.2); } }

.road { position: absolute; left: 0; right: 0; bottom: 0; height: 24%; background: linear-gradient(#5a4636, #3f3026); z-index: 2; }
.road-edge { height: 8px; background: #d9b98a; }
.road-lines {
  position: absolute; left: 0; right: 0; top: 46%; height: 6px;
  background: repeating-linear-gradient(90deg, var(--sun) 0 70px, transparent 70px 140px);
  animation: dash calc(.5s / var(--speed)) linear infinite;
}
@keyframes dash { to { background-position: -140px 0; } }

.car-wrap { position: absolute; left: 50%; bottom: calc(24% - 30px); width: min(400px, 78vw); transform: translateX(-62%); z-index: 4; }
.car { width: 100%; display: block; animation: bounce .35s ease-in-out infinite alternate; filter: drop-shadow(0 10px 8px rgba(59, 42, 26, .35)); }
@keyframes bounce { to { transform: translateY(-3px); } }
.wheel { animation: spin calc(.35s / var(--speed)) linear infinite; transform-origin: 0 0; }
@keyframes spin { to { rotate: 360deg; } }
.dust { position: absolute; left: 0; bottom: 4%; }
.dust span {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(217, 185, 138, .8);
  animation: dust 1s ease-out infinite;
}
.dust span:nth-child(2) { animation-delay: .25s; }
.dust span:nth-child(3) { animation-delay: .5s; }
.dust span:nth-child(4) { animation-delay: .75s; }
@keyframes dust {
  from { transform: translate(10px, 0) scale(.4); opacity: .9; }
  to { transform: translate(-120px, -30px) scale(2.6); opacity: 0; }
}

.hero-copy { position: absolute; top: 14%; left: 0; right: 0; z-index: 5; text-align: center; padding: 0 16px; }
.kicker { margin: 0 0 10px; color: var(--rust); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; font-size: 13px; }
.hero h1 {
  font-size: clamp(38px, 7.5vw, 92px); line-height: 1.05; color: var(--text);
  text-shadow: 3px 3px 0 var(--orange), 6px 6px 0 rgba(196, 69, 45, .25);
  animation: rise .9s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.lede { max-width: 560px; margin: 18px auto 24px; font-size: 18px; color: #5a4430; animation: rise .9s .15s cubic-bezier(.2, .8, .2, 1) both; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; animation: rise .9s .3s cubic-bezier(.2, .8, .2, 1) both; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 13px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: 800 15px Inter, sans-serif; text-decoration: none; color: var(--card);
  background: var(--rust);
  box-shadow: 0 4px 0 #8f2f1d;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #8f2f1d; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--text); }
.btn.small { padding: 9px 16px; font-size: 13px; }
.btn[aria-disabled="true"] { cursor: default; }

.hud {
  position: absolute; right: 24px; bottom: 26%; z-index: 5; width: 170px;
  background: rgba(251, 243, 228, .9); border-radius: 16px; padding: 10px 12px 4px;
  box-shadow: 0 8px 24px rgba(59, 42, 26, .18);
}

/* Fuel gauge (drawn by app.js) */
.gauge { width: 100%; display: block; overflow: visible; }
.gauge .arc { fill: none; stroke: var(--line); stroke-width: 14; stroke-linecap: round; }
.gauge .arc-low { fill: none; stroke: var(--rust); stroke-width: 14; stroke-linecap: round; }
.gauge .arc-fill { fill: none; stroke: var(--teal); stroke-width: 14; stroke-linecap: round; transition: stroke .4s; }
.gauge .tick { stroke: var(--muted); stroke-width: 2; }
.gauge .lbl { fill: var(--text); font: 400 18px Rye, serif; }
.gauge .needle { transition: transform .9s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 100px 105px; }
.gauge .needle line { stroke: var(--rust); stroke-width: 4; stroke-linecap: round; }
.gauge .hub { fill: var(--text); }
.gauge .pct { fill: var(--text); font: 800 15px Inter, sans-serif; }
.gauge .icon { fill: var(--muted); color: var(--muted); }
.gauge .pump-screen { fill: var(--card); }
.gauge.low .arc-fill { stroke: var(--rust); }
.gauge.low .icon { fill: var(--rust); color: var(--rust); animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Sections */
section:not(.hero) { padding: 90px 24px; max-width: 1120px; margin: 0 auto; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(30px, 4.5vw, 48px); }
.section-head p { color: var(--muted); margin: 10px auto 0; max-width: 600px; }

/* Race dashboard */
.dash { display: grid; grid-template-columns: 1.2fr 1fr 1fr; grid-template-rows: auto auto; gap: 14px; margin-bottom: 18px; }
.fuel-card { grid-row: span 2; background: var(--card); border-radius: 18px; padding: 16px 22px; border: 1px solid var(--line); text-align: center; }
.fuel-card .gauge { max-width: 260px; margin: 6px auto 0; }
.fuel-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stat { background: var(--card); border-radius: 16px; padding: 16px 18px; border: 1px solid var(--line); }
.stat-label { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.stat-value { display: block; font: 800 28px Inter, sans-serif; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 20px; }

.map-card { background: var(--card); border-radius: 22px; padding: 18px; border: 1px solid var(--line); }
.map { width: 100%; display: block; }
.coast { fill: rgba(122, 98, 72, .45); font: 400 14px Rye, serif; letter-spacing: .2em; }
.route { fill: none; stroke: #5a4636; stroke-width: 16; stroke-linecap: round; }
.route-center { fill: none; stroke: var(--sun); stroke-width: 2; stroke-dasharray: 10 10; opacity: .8; }
.route-done { fill: none; stroke: var(--sun); stroke-width: 6; stroke-linecap: round; opacity: .9; }
.stop .pump-body { fill: #b9a283; transition: fill .4s; }
.stop .pump-screen { fill: var(--card); }
.stop .pump-hose { stroke: #b9a283; transition: stroke .4s; }
.stop text { fill: var(--muted); font: 600 13px Inter, sans-serif; transition: fill .4s; }
.stop.reached .pump-body { fill: var(--teal); }
.stop.reached .pump-hose { stroke: var(--teal); }
.stop.reached text { fill: var(--text); font-weight: 800; }
.stop .pump { transform-box: fill-box; transform-origin: center bottom; }
.stop.pop .pump { animation: pop .7s ease-out; }
@keyframes pop { 40% { transform: scale(1.5); } }
.car-glow { fill: rgba(196, 69, 45, .25); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { r: 26; fill: rgba(196, 69, 45, .08); } }
.map-car-body rect:first-child { stroke: var(--card); stroke-width: 2.5; }
#map-car.reverse .map-car-body rect:first-child { fill: #8f1d12; }

.progress { height: 10px; border-radius: 99px; background: var(--bg-2); margin-top: 14px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--rust)); border-radius: inherit; }
.progress-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; }
#progress-pct { color: var(--text); font-weight: 800; }

.demo { margin-top: 20px; padding: 16px 18px; border-radius: 16px; border: 2px dashed var(--line); }
.demo label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.demo input { width: 100%; accent-color: var(--rust); }
.demo-buttons { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.demo[hidden] { display: none; }

/* Gas station list */
.stop-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.stop-list li {
  background: var(--card); border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  transition: border-color .4s;
}
.stop-list .pump-icon { width: 30px; height: 34px; flex: none; }
.stop-list .pump-icon .pump-body, .stop-list .pump-icon .pump-hose { transition: fill .4s, stroke .4s; }
.stop-list .pump-icon .pump-body { fill: #b9a283; }
.stop-list .pump-icon .pump-hose { stroke: #b9a283; }
.stop-list .pump-icon .pump-screen { fill: var(--card); }
.stop-list .info { flex: 1; }
.stop-list .city { font-weight: 800; }
.stop-list .meta { color: var(--muted); font-size: 13px; }
.stop-list .badge { font: 800 12px Inter, sans-serif; padding: 4px 8px; border-radius: 8px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.stop-list li.reached { border-color: var(--teal); }
.stop-list li.reached .pump-body { fill: var(--teal); }
.stop-list li.reached .pump-hose { stroke: var(--teal); }
.stop-list li.reached .badge { background: var(--teal); color: var(--card); }

/* How */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--card); border-radius: 18px; padding: 24px; border: 1px solid var(--line); }
.step-num { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font: 400 18px Rye, serif; color: var(--card); background: var(--rust); }
.step h3 { font-size: 20px; margin: 14px 0 6px; }
.step p { color: var(--muted); margin: 0; }

/* Contract address + race status */
.ca {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 8px 10px 8px 8px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(251, 243, 228, .85); color: var(--text); font: 600 14px Inter, sans-serif;
  animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.ca[hidden] { display: none; }
.ca-label { background: var(--text); color: var(--card); border-radius: 999px; padding: 2px 8px; font-weight: 800; font-size: 12px; }
.ca-copy { color: var(--rust); font-weight: 800; }
.section-head .race-status { display: inline-block; margin-top: 16px; padding: 8px 14px; border-radius: 999px; background: var(--teal); color: var(--card); font-weight: 600; font-size: 14px; }
.section-head .race-status[hidden] { display: none; }

/* Finish line: the scenery stops and the car parks in L.A. */
.finished .layer, .finished .road-lines, .finished .wheel, .finished .car { animation-play-state: paused; }
.finished .dust { display: none; }
.finish-line {
  position: absolute; left: 28%; bottom: 0; width: 34px; height: 24%; z-index: 3;
  background: conic-gradient(var(--card) 25%, var(--text) 0 50%, var(--card) 0 75%, var(--text) 0) 0 0 / 17px 17px;
  opacity: 0; transition: opacity .6s;
}
.finished .finish-line { opacity: 1; }
.finish-banner {
  position: absolute; left: 50%; top: 56%; z-index: 6;
  transform: translate(-50%, 20px) scale(.9); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--card); text-decoration: none;
  font: 400 clamp(16px, 2.6vw, 24px) Rye, serif; padding: 12px 22px; border-radius: 14px; white-space: nowrap;
  transition: opacity .6s .4s, transform .6s .4s cubic-bezier(.2, .8, .2, 1.4);
}
.finished .finish-banner { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }

/* Mystery: what happens at the finish line stays sealed until $5M */
.mystery-band {
  background: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent) 0 0 / 160px 140px,
              radial-gradient(1px 1px at 90px 90px, #fff, transparent) 0 0 / 160px 140px,
              linear-gradient(#2a2346, #1b1630);
  color: #f3e6cf;
  overflow: hidden;
}
.mystery { text-align: center; }
.mystery h2 { font-size: clamp(32px, 5vw, 56px); color: #fbf3e4; }
.mystery p { color: #e9dcc3; font-size: 18px; max-width: 560px; margin: 12px auto 0; }
.mystery .kicker { color: var(--sun); }
.envelope {
  position: relative; width: 220px; height: 140px; margin: 0 auto 34px;
  background: #f3e6cf; border-radius: 8px; box-shadow: 0 20px 40px rgba(0, 0, 0, .35);
  animation: hover 3s ease-in-out infinite;
}
.env-flap {
  position: absolute; inset: 0 0 auto 0; height: 80px;
  background: #e7d3b0; clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 8px 8px 0 0;
}
.env-seal {
  position: absolute; left: 50%; top: 52px; width: 54px; height: 54px; transform: translateX(-50%);
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d9593a, var(--rust) 60%, #8f2f1d);
  color: #fbf3e4; font: 400 28px Rye, serif;
  animation: seal 2s ease-in-out infinite;
}
.env-stamp {
  position: absolute; right: -18px; bottom: 10px; transform: rotate(-12deg);
  border: 3px solid var(--rust); color: var(--rust); padding: 2px 8px; border-radius: 6px;
  font: 400 15px Rye, serif; text-transform: uppercase; background: rgba(243, 230, 207, .9);
}
@keyframes hover { 50% { transform: translateY(-10px) rotate(-1.5deg); } }
@keyframes seal { 50% { box-shadow: 0 0 0 10px rgba(196, 69, 45, .25); } }

/* Finish */
.finish { text-align: center; }
.finish h2 { font-size: clamp(30px, 4.5vw, 48px); margin-top: 18px; }
.finish p { color: var(--muted); max-width: 520px; margin: 12px auto 0; font-size: 18px; }
.flag {
  width: 120px; height: 72px; margin: 0 auto;
  background: conic-gradient(var(--card) 25%, var(--text) 0 50%, var(--card) 0 75%, var(--text) 0) 0 0 / 24px 24px;
  border-radius: 4px; transform-origin: left center;
  animation: wave 1.6s ease-in-out infinite;
  box-shadow: 0 6px 18px rgba(59, 42, 26, .2);
}
@keyframes wave { 50% { transform: skewY(-6deg) scaleX(.94); } }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 24px 40px; text-align: center; color: var(--muted); font-size: 13px; background: var(--bg-2); }
.footer p { max-width: 720px; margin: 6px auto; }
.footer .socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; margin-bottom: 14px; }
.footer .socials a { color: var(--text); font-weight: 700; font-size: 15px; text-decoration: none; border-bottom: 2px solid currentColor; }
.footer .socials a:hover { opacity: .75; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translate(-50%, 120px);
  background: var(--teal); color: var(--card); font: 400 16px Rye, serif;
  padding: 12px 20px; border-radius: 14px; box-shadow: 0 10px 30px rgba(59, 42, 26, .3);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* Mobile */
@media (max-width: 760px) {
  .nav { padding: 12px 16px; }
  .nav nav { display: none; }
  .hero { min-height: 600px; }
  .hero-copy { top: 12%; }
  .lede { font-size: 16px; }
  .sun { left: 60%; top: 40%; width: 120px; height: 120px; }
  .car-wrap { transform: translateX(-55%); }
  .hud { display: none; }
  section:not(.hero) { padding: 64px 16px; }
  .dash { grid-template-columns: 1fr 1fr; }
  .fuel-card { grid-column: span 2; grid-row: auto; }
  .stat-value { font-size: 22px; }
  .stat-value.small { font-size: 16px; }
  .map-card { padding: 10px; }
  .stop text { font-size: 22px; }
  .stop.minor text { display: none; }
  .steps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Launch splash: shown before the coin exists, removed once token.json has an address */
body.launching { overflow: hidden; }
.launch {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 120%, #f1c98f 0%, #f6dfb8 45%, var(--bg) 80%);
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.launch[hidden] { display: none; }
.launch-inner { width: 100%; max-width: 760px; text-align: center; display: grid; justify-items: center; gap: 14px; }
.launch .kicker { margin: 0; }
.launch h1 {
  margin: 0; font-size: clamp(36px, 8vw, 84px); line-height: 1.05; color: var(--text); text-wrap: balance;
  text-shadow: 3px 3px 0 var(--orange), 6px 6px 0 rgba(196, 69, 45, .25);
}
.launch-date { margin: 0; font: 400 clamp(18px, 3.4vw, 26px) Rye, serif; color: var(--rust); }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 520px; margin-top: 6px; }
.countdown div {
  background: var(--text); color: var(--card); border-radius: 12px; padding: 12px 4px 8px;
  display: grid; gap: 2px; box-shadow: 0 5px 0 #1f160d;
}
.countdown span { font: 400 clamp(30px, 8vw, 54px) Rye, serif; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown small { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #e9dcc3; }
.launch-note { margin: 4px 0 0; max-width: 520px; font-size: 17px; color: #5a4430; }
.launch-car { width: min(320px, 80%); }
.launch-car svg { width: 100%; display: block; }
.launch-car .wheel { animation: spin .6s linear infinite; }
.launch .btn.ghost { margin-top: 4px; }
.lights { display: flex; gap: 10px; }
.lights span { width: 18px; height: 18px; border-radius: 50%; background: #5a4430; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.lights span.on { background: var(--rust); box-shadow: 0 0 12px var(--rust); }
.lights.go span { background: var(--teal); box-shadow: 0 0 12px var(--teal); }
@media (prefers-reduced-motion: reduce) { .launch-car .wheel { animation: none; } }
