/* Layout: one phone-width column under a warm floodlight, timing-tower rows for the weekend. */
:root {
  --bg: #1b1418;
  --bg-2: #221a1f;
  --surface: #2a2026;
  --surface-2: #33272e;
  --line: #44353d;
  --fg: #f5e9dd;
  --muted: #b6a29a;
  --dim: #7f6d68;
  --amber: #f0a35e;
  --amber-deep: #d4793a;
  --rose: #e8958b;
  --mint: #93d0a9;
  --lamp: #ff4d3d;
  --tire: #141012;

  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 18px;
  --r-sm: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body {
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--f-body);
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 40% at 50% -6%, rgba(240,163,94,.22), transparent 70%),
    radial-gradient(40% 30% at 100% 30%, rgba(232,149,139,.08), transparent 70%),
    radial-gradient(50% 40% at 0% 90%, rgba(147,208,169,.05), transparent 70%);
}
.glow::after {
  content: ""; position: absolute; inset: 0; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(env(safe-area-inset-top, 0px) + 18px) calc(env(safe-area-inset-bottom, 0px) + 48px);
  display: flex; flex-direction: column; gap: 18px;
}

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 8.5vw, 44px); line-height: 1.02; }
h2 { font-size: clamp(20px, 5.4vw, 26px); line-height: 1.15; }
h3 { font-size: 16px; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font: 600 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--amber);
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 13px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; }
.brand .flag { width: 22px; height: 22px; border-radius: 6px; background:
  conic-gradient(var(--fg) 25%, var(--bg) 0 50%, var(--fg) 0 75%, var(--bg) 0) 0 0 / 11px 11px; border: 1px solid var(--line); }
.iconbtn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
}
.iconbtn:hover { color: var(--fg); }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- lap counter ---------- */
.laps { display: flex; flex-direction: column; gap: 10px; }
.laps-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.laps-num { font: 700 15px/1 var(--f-mono); color: var(--fg); }
.laps-num b { color: var(--amber); font-size: 22px; }
.laps-bar { display: grid; grid-template-columns: repeat(22, 1fr); gap: 3px; }
.laps-bar i { height: 8px; border-radius: 3px; background: var(--surface-2); transition: background .5s ease; }
.laps-bar i.on { background: var(--amber); box-shadow: 0 0 10px rgba(240,163,94,.35); }
.laps-bar i.on:nth-child(22) { background: var(--mint); }

/* ---------- hero / engineer ---------- */
.hero { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.hero h1 span { color: var(--amber); }
.engineer { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: end; }
.engineer svg.dog { width: 150px; height: auto; display: block; }
.bubble {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r) var(--r) var(--r) 6px; padding: 12px 14px; min-width: 0;
}
.bubble .who { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bubble p { font-size: 14.5px; line-height: 1.5; }
.wave { display: inline-flex; gap: 2px; align-items: center; height: 12px; }
.wave i { width: 2px; background: var(--amber); border-radius: 2px; animation: wave 1s ease-in-out infinite; height: 4px; }
.wave i:nth-child(2) { animation-delay: .15s } .wave i:nth-child(3) { animation-delay: .3s }
.wave i:nth-child(4) { animation-delay: .45s } .wave i:nth-child(5) { animation-delay: .6s }
@keyframes wave { 0%,100% { height: 3px } 50% { height: 12px } }


/* ---------- timing tower ---------- */
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 2px 0; }
.tower { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-2); }
.row {
  appearance: none; border: 0; background: transparent; color: inherit; text-align: left; font: inherit;
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  padding: 14px 14px; border-top: 1px solid var(--line); cursor: pointer; width: 100%;
}
.row:first-child { border-top: 0; }
.row:disabled { cursor: default; }
.row:not(:disabled):hover { background: var(--surface); }
.code {
  font: 700 12px/1 var(--f-mono); letter-spacing: .06em; text-align: center;
  padding: 7px 0; border-radius: 8px; background: var(--surface-2); color: var(--muted);
}
.row.open .code { background: var(--amber); color: var(--bg); }
.row.done .code { background: transparent; color: var(--mint); box-shadow: inset 0 0 0 1px var(--mint); }
.row .meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .meta b { font-weight: 600; }
.row .meta small { color: var(--dim); font-size: 13px; }
.status { font: 500 12px/1.2 var(--f-mono); color: var(--muted); text-align: right; white-space: nowrap; display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.status svg { width: 14px; height: 14px; }
.row.open .status { color: var(--amber); }
.row.done .status { color: var(--mint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 0 rgba(240,163,94,.6); animation: ping 1.6s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(240,163,94,.55) } 100% { box-shadow: 0 0 0 10px rgba(240,163,94,0) } }

/* ---------- pit lane teaser ---------- */
.pitlane {
  position: relative; overflow: hidden; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-2) 100%);
  padding: 18px; display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center;
}
.pitlane::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 14px, transparent 14px 28px); opacity: .55;
}
.qr-ghost { width: 96px; height: 96px; border-radius: 12px; background: var(--surface-2); padding: 0; position: relative; overflow: hidden; }
.qr-ghost canvas { width: 100%; height: 100%; filter: blur(10px); transform: scale(1.3); display: block; }
.qr-ghost .lock { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg); }
.qr-ghost .lock svg { width: 28px; height: 28px; filter: drop-shadow(0 0 6px var(--bg)); }
.pitlane .txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.countdown { font: 700 22px/1 var(--f-mono); color: var(--amber); font-variant-numeric: tabular-nums; }

/* ---------- radio list ---------- */
.radios { display: flex; flex-direction: column; gap: 8px; }
.radio-row {
  appearance: none; font: inherit; color: inherit; text-align: left; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg-2); cursor: pointer;
}
.radio-row:disabled { cursor: default; opacity: .55; }
.radio-row .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--amber); flex: none; }
.radio-row .ic svg { width: 16px; height: 16px; }
.radio-row .meta { min-width: 0; display: flex; flex-direction: column; }
.radio-row small { color: var(--dim); font-size: 13px; }
.radio-row.new .ic { background: var(--amber); color: var(--bg); }

/* ---------- cards & buttons ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
  font: 600 15px/1 var(--f-body); padding: 15px 18px; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #2a1608; }
.btn.primary:hover { background: #f5b072; }
.btn.ghost { background: transparent; }
.btn.big { font: 800 18px/1 var(--f-display); padding: 20px; letter-spacing: .04em; text-transform: uppercase; width: 100%; }
.btn[hidden] { display: none; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns .btn { flex: 1 1 auto; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.field { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0; font: 500 17px/1 var(--f-body); color: var(--fg); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px;
}
.input:focus { border-color: var(--amber); outline: none; }
.note { font-size: 14px; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--line); }
.note.ok { color: var(--mint); border-style: solid; border-color: rgba(147,208,169,.4); }
.note.bad { color: var(--rose); border-color: rgba(232,149,139,.4); }
.shake { animation: shake .4s ease; }
@keyframes shake { 20%,60% { transform: translateX(-6px) } 40%,80% { transform: translateX(6px) } }

/* ---------- stage view ---------- */
.stage-head { display: flex; flex-direction: column; gap: 12px; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font: 500 14px var(--f-body); cursor: pointer; padding: 6px 0; }
.back svg { width: 16px; height: 16px; }
.steps-dots { display: flex; gap: 6px; }
.steps-dots i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); }
.steps-dots i.on { background: var(--amber); }
.steps-dots i.cur { background: var(--fg); }
.step-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lap-chip { font: 700 11px/1 var(--f-mono); letter-spacing: .08em; color: var(--amber); border: 1px solid rgba(240,163,94,.4); border-radius: 999px; padding: 6px 9px; white-space: nowrap; }
.riddle-text { font-size: 17px; line-height: 1.6; max-width: 62ch; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  appearance: none; font: 500 15px/1.3 var(--f-body); color: var(--fg); text-align: left;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; min-height: 58px;
}
.opt:hover { border-color: var(--dim); }
.opt.right { border-color: var(--mint); background: rgba(147,208,169,.12); color: var(--mint); }
.opt.wrong { border-color: var(--rose); color: var(--rose); }
.qcount { font: 500 12px var(--f-mono); color: var(--dim); }

/* ---------- games ---------- */
.gantry { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px; background: var(--tire); border-radius: 14px; border: 1px solid var(--line); }
.lamp-col { display: flex; flex-direction: column; gap: 8px; align-items: center; background: #0b0809; padding: 8px 0; border-radius: 10px; }
.lamp { width: min(11vw, 46px); aspect-ratio: 1; border-radius: 50%; background: #2b1414; box-shadow: inset 0 -4px 8px rgba(0,0,0,.5); transition: background .05s; max-width: 100%; }
.lamp-col.on .lamp { background: radial-gradient(circle at 40% 35%, #ff9d8f, var(--lamp) 55%, #a8160c); box-shadow: 0 0 18px rgba(255,77,61,.7), inset 0 -4px 8px rgba(0,0,0,.3); }
.readout { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 6px 0; }
.readout .big { font: 700 44px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.readout .big small { font-size: 16px; color: var(--muted); }
.best { font: 500 12px var(--f-mono); color: var(--dim); }
.gas { touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.car-wrap { display: grid; place-items: center; background: var(--tire); border: 1px solid var(--line); border-radius: 14px; padding: 16px; position: relative; overflow: hidden; }
.car-wrap::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 38px, rgba(245,233,221,.04) 38px 40px); }
.car { width: min(62vw, 230px); height: auto; position: relative; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.wheel { cursor: pointer; }
.wheel rect.t { fill: #0a0708; stroke: var(--line); stroke-width: 2; transition: fill .15s; }
.wheel.s1 rect.t { fill: #3a2a20; }
.wheel.s2 rect.t { fill: #5a3a22; stroke: var(--amber); }
.wheel.s3 rect.t { fill: #0a0708; stroke: var(--mint); stroke-width: 3; }
.wheel .band { fill: none; stroke: var(--line); stroke-width: 3; }
.wheel.s3 .band { stroke: var(--mint); }
.wheel .hint { fill: var(--amber); font: 700 14px var(--f-mono); text-anchor: middle; }
.wheel.s3 .hint { fill: var(--mint); }

.bar-wrap { display: grid; place-items: center; background: var(--tire); border: 1px solid var(--line); border-radius: 14px; padding: 18px 10px 10px; }
.barbell { width: min(80vw, 300px); height: auto; overflow: visible; }
.barbell .lift { transition: transform .12s ease-out; }
.barbell.up .lift { transform: translateY(-34px); }
.reps-count { font: 700 44px/1 var(--f-mono); }
.reps-count small { font-size: 18px; color: var(--muted); }

/* ---------- radio screen ---------- */
.radio-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.radio-card .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; background: var(--amber); color: #2a1608; }
.radio-card .head b { font: 800 14px var(--f-display); letter-spacing: .06em; text-transform: uppercase; }
.radio-card .head .wave i { background: #2a1608; }
.radio-card .body { padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.radio-card .from { font: 700 20px/1.2 var(--f-display); }
.radio-text { font-size: 18px; line-height: 1.6; min-height: 5em; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--amber); vertical-align: -3px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }

/* ---------- gate ---------- */
.gate { min-height: calc(100vh - 140px); min-height: calc(100svh - 80px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.gate h1 { font-size: clamp(38px, 12vw, 64px); }
.gate .num { font: 800 clamp(90px, 30vw, 170px)/.85 var(--f-display); color: transparent; -webkit-text-stroke: 2px var(--amber); letter-spacing: -.04em; }
.gate .dogline { display: flex; align-items: flex-end; gap: 14px; }
.gate .dogline svg { width: 150px; height: auto; flex: none; }
@media (max-height: 760px) {
  .gate { gap: 14px; }
  .gate .num { font-size: clamp(64px, 22vw, 110px); }
  .gate h1 { font-size: clamp(32px, 10vw, 48px); }
  .gate .dogline svg { width: 110px; }
}

/* ---------- finish ---------- */
.checker { height: 72px; border-radius: 12px; border: 1px solid var(--line);
  background: conic-gradient(var(--fg) 25%, var(--tire) 0 50%, var(--fg) 0 75%, var(--tire) 0) 0 0 / 36px 36px;
  animation: flag 1.2s linear infinite paused; }
.checker.go { animation-play-state: running; }
@keyframes flag { to { background-position: 36px 0; } }

.letter {
  background: var(--fg); color: #2b1d20; border-radius: var(--r); padding: 26px 22px 24px;
  display: flex; flex-direction: column; gap: 14px; position: relative;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
}
.letter h2 { color: #2b1d20; }
.letter p { font-size: 17px; line-height: 1.65; max-width: 62ch; }
.letter .sign { font: 600 15px var(--f-body); color: var(--amber-deep); padding-top: 4px; }
.letter .stamp { position: absolute; top: 18px; right: 18px; width: 54px; height: 54px; border-radius: 50%; border: 2px dashed var(--amber-deep); display: grid; place-items: center; font: 800 16px var(--f-display); color: var(--amber-deep); transform: rotate(12deg); }
.letter h2 { padding-right: 64px; }

.qr-real { background: var(--fg); border-radius: var(--r); padding: 18px; display: grid; place-items: center; }
.qr-real img { width: min(78vw, 320px); height: auto; border-radius: 6px; display: block; image-rendering: pixelated; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

.dev { position: fixed; right: max(10px, env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--surface-2); border: 1px solid var(--amber); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font: 500 12px var(--f-mono); max-width: 240px; }
.dev button { font: 500 12px var(--f-mono); background: var(--bg-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.dev.min > :not(:first-child) { display: none; }
.dev .r { display: flex; gap: 6px; flex-wrap: wrap; }

.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: .001; transform: translateY(8px) } to { opacity: 1; transform: none } }

@media (max-width: 380px) {
  .options { grid-template-columns: 1fr; }
  .engineer { grid-template-columns: 88px 1fr; }
  .engineer svg.dog { width: 88px; }
  .pitlane { grid-template-columns: 76px 1fr; }
  .qr-ghost { width: 76px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================
   FX LAYER: live background, mascot, transitions, intro
   ===================================================== */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.glow { z-index: 0; }

/* ---------- mascot ---------- */
svg.dog { overflow: visible; }
.dog .d-all, .dog .d-head, .dog .d-ear, .dog .d-tail, .dog .lid, .dog .d-body, .dog .d-shadow, .dog .d-spark, .dog .d-spark path { transform-box: fill-box; }
.dog .d-tail { transform-origin: 0% 100%; animation: wag2 1.1s ease-in-out infinite; }
@keyframes wag2 { 0%,100% { transform: rotate(-10deg) } 50% { transform: rotate(16deg) } }
.dog .d-body { transform-origin: 50% 100%; animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scaleY(1) } 50% { transform: scaleY(1.035) } }
.dog .d-head { transform-origin: 82% 80%; transition: transform .35s cubic-bezier(.3,1.6,.5,1); animation: look 7s ease-in-out infinite; }
@keyframes look { 0%,40%,100% { transform: rotate(0) } 46%,62% { transform: rotate(-4deg) } 68% { transform: rotate(2deg) } }
.dog .d-ear { transform-origin: 30% 4%; transition: transform .35s ease; animation: earflop 7s ease-in-out infinite; }
@keyframes earflop { 0%,44%,100% { transform: rotate(0) } 50% { transform: rotate(-7deg) } 56% { transform: rotate(4deg) } }
.dog .lid { transform-origin: 50% 0%; transform: scaleY(0); animation: blink 4.8s infinite; }
@keyframes blink { 0%,91%,97%,100% { transform: scaleY(0) } 93.5% { transform: scaleY(1) } }
.dog .d-tongue { opacity: 0; transition: opacity .2s; }
.dog .d-spark path { opacity: 0; transform-origin: 50% 50%; }
.dog .d-shadow { transform-origin: 50% 50%; }

.dog.happy .d-all { animation: hop .45s cubic-bezier(.3,.8,.4,1) 2; }
@keyframes hop { 0%,100% { transform: translateY(0) } 45% { transform: translateY(-16px) } }
.dog.happy .d-shadow { animation: shadowhop .45s ease 2; }
@keyframes shadowhop { 45% { transform: scaleX(.75); opacity: .15 } }
.dog.happy .d-tail { animation-duration: .22s; }
.dog.happy .d-tongue { opacity: 1; }
.dog.happy .d-head { animation: none; transform: rotate(-9deg); }
.dog.happy .d-ear { animation: none; transform: rotate(-18deg); }
.dog.happy .d-spark path { animation: spark .9s ease-out both; }
.dog.happy .d-spark path:nth-child(2) { animation-delay: .08s } .dog.happy .d-spark path:nth-child(3) { animation-delay: .16s } .dog.happy .d-spark path:nth-child(4) { animation-delay: .22s }
@keyframes spark { 0% { opacity: 0; transform: scale(.2) rotate(0) } 35% { opacity: 1; transform: scale(1.2) rotate(40deg) } 100% { opacity: 0; transform: scale(.6) rotate(90deg) translateY(-10px) } }

.dog.sad .d-head { animation: none; transform: rotate(9deg) translateY(3px); }
.dog.sad .d-ear { animation: none; transform: rotate(14deg); }
.dog.sad .d-tail { animation: none; transform: rotate(48deg); transition: transform .3s; }
.dog.sad .d-all { animation: sadshake .4s ease; }
@keyframes sadshake { 25% { transform: translateX(-3px) } 75% { transform: translateX(3px) } }

.dog.talk .d-head { animation: nod .28s ease-in-out 4; }
@keyframes nod { 50% { transform: rotate(-5deg) translateY(1px) } }

.engineer.mini { grid-template-columns: 104px 1fr; align-items: center; }
.engineer.mini svg.dog { width: 104px; }
.engineer.mini .bubble p { font-size: 14px; }
.bubble.pop { animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 0% { transform: scale(.94) } 100% { transform: scale(1) } }

/* ---------- transitions ---------- */
#wipe { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; visibility: hidden; }
#wipe.run { visibility: visible; }
.w-panel {
  position: absolute; top: -10%; bottom: -10%; left: -20vw; width: 150vw;
  transform: translateX(-160vw) skewX(-14deg);
  background:
    linear-gradient(90deg, transparent 0, var(--amber) 0 2.2vw, var(--bg) 2.2vw 3vw, var(--fg) 3vw 3.8vw, var(--bg) 3.8vw calc(100% - 3.8vw), var(--amber-deep) calc(100% - 3.8vw) calc(100% - 2.6vw), var(--bg) calc(100% - 2.6vw) calc(100% - 2vw), var(--amber) calc(100% - 2vw));
}
#wipe.run .w-panel { animation: wipe .82s cubic-bezier(.7,0,.3,1) forwards; }
@keyframes wipe {
  0% { transform: translateX(-160vw) skewX(-14deg); }
  44%, 52% { transform: translateX(-5vw) skewX(-14deg); }
  100% { transform: translateX(150vw) skewX(-14deg); }
}
.wrap.enter > * { animation: enterIn .55s cubic-bezier(.2,.8,.2,1) both; }
.wrap.enter > *:nth-child(2) { animation-delay: .04s } .wrap.enter > *:nth-child(3) { animation-delay: .08s }
.wrap.enter > *:nth-child(4) { animation-delay: .12s } .wrap.enter > *:nth-child(5) { animation-delay: .16s }
.wrap.enter > *:nth-child(n+6) { animation-delay: .2s }
@keyframes enterIn { from { opacity: .001; transform: translateX(36px); filter: blur(6px) } to { opacity: 1; transform: none; filter: none } }

/* ---------- intro ---------- */
body.intro-on { overflow: hidden; }
.intro { position: fixed; inset: 0; z-index: 90; background: #0e0a0c; color: var(--fg); transition: opacity .6s ease, transform .6s ease; }
.intro::before { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 45% at 50% 40%, rgba(240,163,94,.10), transparent 70%); }
.intro.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.i-stage { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px)); }
.intro.shake .i-stage { animation: ishake .45s ease; }
@keyframes ishake { 15% { transform: translate(-6px, 3px) } 35% { transform: translate(5px, -4px) } 55% { transform: translate(-4px, 2px) } 75% { transform: translate(3px, -1px) } }
.i-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 3; }
.i-skip { background: none; border: 1px solid var(--line); color: var(--muted); font: 500 13px var(--f-body); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.i-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; position: relative; z-index: 2; text-align: center; }
.i-gantry { display: flex; gap: clamp(8px, 2.6vw, 18px); padding: 14px clamp(10px, 3vw, 20px); background: #060405; border-radius: 16px; border: 1px solid #2a1f24; box-shadow: 0 30px 80px -30px rgba(0,0,0,.9); transition: opacity .5s ease, transform .5s ease; }
.i-col { display: flex; flex-direction: column; gap: 10px; padding: 10px 8px; background: #120d0f; border-radius: 12px; }
.i-col span { width: clamp(30px, 10vw, 58px); aspect-ratio: 1; border-radius: 50%; background: #2a1212; box-shadow: inset 0 -5px 10px rgba(0,0,0,.6); transition: background .06s, box-shadow .06s; }
.i-col.on span { background: radial-gradient(circle at 40% 35%, #ffb3a6, #ff4d3d 55%, #a3140b); box-shadow: 0 0 34px 6px rgba(255,77,61,.55), inset 0 -5px 10px rgba(0,0,0,.25); }
.i-ready { display: flex; flex-direction: column; gap: 14px; align-items: center; width: min(100%, 360px); transition: opacity .4s ease; }
.i-hint { color: var(--muted); font-size: 14px; }
.intro.running .i-ready { opacity: 0; pointer-events: none; }
.intro.go .i-gantry { opacity: .15; transform: scale(.9); }

.i-car { position: absolute; left: 0; top: 58%; width: min(90vw, 620px); z-index: 4; transform: translateX(-120%); pointer-events: none; filter: drop-shadow(0 18px 20px rgba(0,0,0,.6)); }
.i-car svg { width: 100%; height: auto; display: block; }
.i-car .spin { transform-box: fill-box; transform-origin: center; animation: spin .12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.intro.go .i-car { animation: fly 1.05s cubic-bezier(.55,0,.35,1) forwards; }
@keyframes fly { 0% { transform: translateX(-110%) skewX(0) } 45% { transform: translateX(10vw) skewX(-6deg) } 100% { transform: translateX(110vw) skewX(-10deg) } }
.i-streaks { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.i-streaks i { position: absolute; left: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(240,163,94,.7), rgba(245,233,221,.9)); opacity: 0; transform: translateX(-100%); }
.intro.go .i-streaks i { animation: streak .7s cubic-bezier(.5,0,.3,1) .25s forwards; }
@keyframes streak { 0% { opacity: 0; transform: translateX(-100%) } 30% { opacity: 1 } 100% { opacity: 0; transform: translateX(240%) } }
.i-flash { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(circle at 60% 58%, rgba(255,214,170,.85), rgba(240,163,94,.25) 40%, transparent 70%); opacity: 0; }
.intro.flash .i-flash { animation: flash .9s ease-out; }
@keyframes flash { 0% { opacity: 0 } 15% { opacity: 1 } 100% { opacity: 0 } }

.i-title { display: none; flex-direction: column; align-items: center; gap: 12px; }
.intro.titled .i-title { display: flex; }
.intro.titled .i-gantry { display: none; }
.i-22 { width: min(70vw, 300px); height: auto; overflow: visible; }
.i-22 text { font: 800 140px/1 var(--f-display); fill: transparent; stroke: var(--amber); stroke-width: 2.5; stroke-dasharray: 700; stroke-dashoffset: 700; animation: draw 1.6s cubic-bezier(.6,0,.2,1) forwards, fillin .8s ease 1.3s forwards; letter-spacing: -6px; }
@keyframes draw { to { stroke-dashoffset: 0 } }
@keyframes fillin { to { fill: rgba(240,163,94,.12) } }
.i-h { font-size: clamp(30px, 9vw, 52px); line-height: 1.05; opacity: 0; animation: rise .8s cubic-bezier(.2,.8,.2,1) .6s forwards; }
.i-sub { color: var(--muted); opacity: 0; animation: rise .8s ease 1s forwards; }
.i-enter { width: min(100%, 320px); margin-top: 10px; opacity: 0; animation: rise .7s ease 1.5s forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  .i-22 text { stroke-dashoffset: 0; fill: rgba(240,163,94,.12); }
  .i-h, .i-sub, .i-enter { opacity: 1; }
  .dog .lid { transform: scaleY(0); }
}
