/* High Notes — design system (see docs/design/visual-system.md). Dark-first, gold accent. */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg:#0c0b10; --bg-grad-1:#14111c; --bg-grad-2:#0c0b10;
  --surface:#131119; --surface-2:#1a1822; --surface-3:#232030;
  --overlay:rgba(12,11,16,.72);

  /* text */
  --text:#f4f2f8; --text-muted:#a9a5b8; --text-subtle:#76728a;
  --text-on-gold:#1a1205; --text-inverse:#131119;

  /* brand / accent (gold) */
  --accent:#ffd166; --accent-hover:#ffdc85; --accent-press:#f7b733;
  --accent-soft:rgba(255,209,102,.14); --accent-line:rgba(255,209,102,.34);

  /* lines */
  --border:rgba(255,255,255,.08); --border-strong:rgba(255,255,255,.14); --hairline:rgba(255,255,255,.06);

  /* status */
  --success:#4ade80; --success-bg:#11271b; --danger:#fb7185; --danger-bg:#2a141b; --info:#7cc0ff;

  /* focus */
  --focus-ring:#ffd166; --focus-ring-offset:#0c0b10;

  /* type */
  --font-display:"Bricolage Grotesque","Inter var",Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --font-sans:"Inter var",Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-mono:ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;
  --fs-xs:0.75rem; --fs-sm:0.875rem; --fs-base:1rem; --fs-md:1.125rem; --fs-lg:1.375rem;
  --fs-xl:1.75rem; --fs-2xl:2.25rem; --fs-3xl:3rem; --fs-4xl:clamp(2.75rem,7vw,4.5rem);
  --fs-msg:clamp(1.5rem,4.5vw,2.125rem);
  --lh-base:1.55; --lh-md:1.5; --lh-lg:1.3; --lh-xl:1.2; --lh-2xl:1.12;
  --fw-regular:400; --fw-medium:500; --fw-semibold:600; --fw-bold:700; --fw-display:800;
  --tracking-tight:-0.02em; --tracking-snug:-0.011em; --tracking-wide:0.04em;

  /* spacing */
  --space-1:0.25rem; --space-2:0.5rem; --space-3:0.75rem; --space-4:1rem; --space-5:1.25rem;
  --space-6:1.5rem; --space-8:2rem; --space-10:2.5rem; --space-12:3rem; --space-16:4rem;
  --space-20:5rem; --space-24:6rem; --space-32:8rem; --gutter:clamp(1.25rem,5vw,2rem);

  /* widths */
  --content:34.5rem; --content-wide:47.5rem; --content-marketing:75rem; --measure:66ch;

  /* radii */
  --radius-xs:6px; --radius-sm:10px; --radius-md:14px; --radius-lg:20px; --radius-xl:28px; --radius-pill:999px;

  /* elevation */
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:0 16px 48px rgba(0,0,0,.55);
  --shadow-inset-top:inset 0 1px 0 rgba(255,255,255,.05);
  --glow-gold:0 0 0 1px var(--accent-line),0 8px 40px rgba(255,209,102,.22);

  /* motion */
  --dur-fast:120ms; --dur-base:220ms; --dur-slow:420ms; --dur-celebrate:900ms;
  --ease-out:cubic-bezier(0.16,1,0.3,1);
  --ease-in-out:cubic-bezier(0.65,0,0.35,1);
  --ease-spring:cubic-bezier(0.34,1.56,0.64,1);
  --ease-emph:cubic-bezier(0.22,1,0.36,1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:#f7f5fb; --bg-grad-1:#fff6e3; --bg-grad-2:#f7f5fb;
  --surface:#ffffff; --surface-2:#f4f1f8; --surface-3:#ece9f1; --overlay:rgba(20,17,28,.42);
  --text:#17141f; --text-muted:#555067; --text-subtle:#756f86; --text-on-gold:#1a1205; --text-inverse:#ffffff;
  --accent:#e89c1c; --accent-hover:#d68c12; --accent-press:#c27d11;
  --accent-soft:rgba(232,156,28,.12); --accent-line:rgba(232,156,28,.30);
  --border:rgba(23,20,31,.10); --border-strong:rgba(23,20,31,.16); --hairline:rgba(23,20,31,.06);
  --success:#15924f; --success-bg:#e7f6ec; --danger:#e11d48; --danger-bg:#fdeaee; --info:#1d6fd6;
  --focus-ring:#e89c1c; --focus-ring-offset:#ffffff;
  --shadow-sm:0 1px 2px rgba(23,20,31,.06);
  --shadow-md:0 6px 20px rgba(23,20,31,.08);
  --shadow-lg:0 20px 56px rgba(23,20,31,.12);
  --shadow-inset-top:inset 0 1px 0 rgba(255,255,255,.7);
  --glow-gold:0 0 0 1px var(--accent-line),0 10px 44px rgba(232,156,28,.20);
}

/* --- base --- */
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body {
  margin:0; background:var(--bg); color:var(--text);
  font:var(--fw-regular) var(--fs-base)/var(--lh-base) var(--font-sans);
  font-feature-settings:"cv11","ss01"; -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
h1,h2,h3 { font-family:var(--font-display); letter-spacing:var(--tracking-tight); line-height:var(--lh-xl); margin:.2em 0; }
h1 { font-size:var(--fs-2xl); font-weight:var(--fw-display); }
h2 { font-size:var(--fs-xl); font-weight:var(--fw-display); }
p { margin:0 0 var(--space-3); }
a { color:var(--accent); text-underline-offset:3px; }
:focus-visible { outline:2px solid var(--focus-ring); outline-offset:2px; border-radius:6px; }
::selection { background:var(--accent-soft); }

.wrap { max-width:var(--content); margin:0 auto; padding:var(--space-6) var(--gutter) var(--space-16); }
.wrap.wide { max-width:var(--content-wide); }
.center { text-align:center; }
.muted { color:var(--text-muted); }
.small { font-size:var(--fs-sm); }
code { font-family:var(--font-mono); background:var(--surface-2); padding:2px var(--space-2); border-radius:var(--radius-xs); border:1px solid var(--border); }

/* --- buttons --- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:var(--space-2);
  min-height:44px; padding:0 var(--space-5);
  font:var(--fw-semibold) var(--fs-base)/1 var(--font-sans); letter-spacing:-0.005em;
  background:var(--accent); color:var(--text-on-gold);
  border:1px solid transparent; border-radius:var(--radius-md);
  box-shadow:var(--shadow-inset-top),var(--shadow-sm);
  cursor:pointer; user-select:none; text-decoration:none;
  transition:transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out),
             box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast);
}
.btn:hover { background:var(--accent-hover); }
.btn:active { background:var(--accent-press); transform:translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-disabled="true"] { opacity:.45; cursor:not-allowed; transform:none; filter:grayscale(.2); }
/* .btn sets display:inline-flex, which beats the UA [hidden]{display:none} (same origin, higher
   specificity) — so a hidden .btn would still render. Re-assert it for the toggled buttons. */
.btn[hidden] { display:none; }
.btn.ghost { background:transparent; color:var(--text); border-color:var(--border-strong); box-shadow:none; }
.btn.ghost:hover { background:var(--surface-3); }
.btn.link { background:none; border:none; box-shadow:none; color:var(--text-muted); min-height:36px; padding:0 var(--space-2);
  font-weight:var(--fw-medium); text-decoration:underline; text-underline-offset:3px; }
.btn.link:hover { color:var(--text); background:none; }
.btn.big { width:100%; min-height:54px; font-size:var(--fs-md); margin-top:var(--space-5); }
.btn.small { min-height:36px; padding:0 var(--space-3); font-size:var(--fs-sm); border-radius:var(--radius-sm); }
.btn.small.ok { background:var(--success); color:#062313; }
.btn.small.warn { background:var(--danger); color:#2a0a10; }

/* --- forms --- */
label { display:block; margin:var(--space-4) 0; font-weight:var(--fw-semibold); font-size:var(--fs-sm); }
input, textarea, select {
  width:100%; min-height:48px; margin-top:var(--space-2); padding:var(--space-3) var(--space-4);
  font:var(--fw-regular) var(--fs-base)/1.4 var(--font-sans);
  color:var(--text); background:var(--surface-2);
  border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  transition:border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
input[type=number] { width:auto; }
input::placeholder, textarea::placeholder { color:var(--text-subtle); }
input:focus, textarea:focus, select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 4px var(--accent-soft); background:var(--surface); }
textarea { min-height:112px; resize:vertical; line-height:1.5; }
.field-error { color:var(--danger); font-size:var(--fs-sm); margin-top:var(--space-2); }

/* --- cards --- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:var(--space-5); margin:var(--space-3) 0; box-shadow:var(--shadow-inset-top),var(--shadow-sm); }
.card.status-approved { border-left:3px solid var(--success); }
.card.status-rejected { border-left:3px solid var(--danger); opacity:.62; }
.card.status-pending  { border-left:3px solid var(--accent); }
.card-head { display:flex; gap:var(--space-2); align-items:center; flex-wrap:wrap; }
.card-actions { display:flex; gap:var(--space-2); flex-wrap:wrap; margin-top:var(--space-3); align-items:center; }
.inline { display:inline; }
.row { display:inline-flex; align-items:center; gap:var(--space-2); }

/* moment editor rows */
.moment-row { border:1px solid var(--border); display:grid; gap:var(--space-2); }
.mrow-top { display:flex; gap:var(--space-2); align-items:center; }
.mrow-top .emoji-in { width:3.2rem; text-align:center; flex:none; }
.mrow-top input { margin-top:0; }
.moment-row textarea { min-height:60px; margin-top:0; }
.mrow-trigger { display:flex; gap:var(--space-3); align-items:center; flex-wrap:wrap; }
.mrow-trigger select, .mrow-trigger input[type=number] { width:auto; min-height:40px; margin-top:0; }
.chk { display:inline-flex; align-items:center; gap:var(--space-2); margin:0; font-weight:var(--fw-regular); font-size:var(--fs-sm); }
.chk input { width:auto; min-height:0; margin:0; accent-color:var(--accent); }

/* --- chips & tags --- */
.chip { display:inline-flex; align-items:center; gap:var(--space-2); min-height:44px; padding:0 var(--space-4);
  font:var(--fw-medium) var(--fs-sm)/1 var(--font-sans); color:var(--text); background:var(--surface-2);
  border:1px solid var(--border-strong); border-radius:var(--radius-pill); cursor:pointer;
  transition:background var(--dur-fast) var(--ease-out), border-color var(--dur-fast), transform var(--dur-fast); }
.chip:hover { background:var(--surface-3); border-color:var(--text-subtle); }
.chip:active { transform:scale(.97); }
.chip[aria-pressed="true"] { background:var(--accent-soft); border-color:var(--accent-line); }
.tag { display:inline-flex; align-items:center; gap:4px; padding:2px var(--space-2); font-size:var(--fs-xs); font-weight:var(--fw-medium);
  color:var(--text-muted); background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-xs); }
.tag.accent { color:var(--accent); border-color:var(--accent-line); background:var(--accent-soft); }

/* --- banners --- */
.banner { display:flex; gap:var(--space-3); align-items:flex-start; padding:var(--space-3) var(--space-4);
  border-radius:var(--radius-md); font-size:var(--fs-sm); border:1px solid var(--border); margin:var(--space-4) 0; }
.banner.ok { background:var(--success-bg); color:var(--success); border-color:color-mix(in srgb,var(--success) 30%,transparent); }
.banner.warn { background:var(--danger-bg); color:var(--danger); border-color:color-mix(in srgb,var(--danger) 30%,transparent); }
.banner.info { background:var(--accent-soft); color:var(--text); border-color:var(--accent-line); }

/* --- the stepper --- */
.step { animation:stepIn var(--dur-base) var(--ease-out) both; }
@keyframes stepIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.is-back .step { animation-name:stepInBack; }
@keyframes stepInBack { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.lede { font-size:var(--fs-md); line-height:var(--lh-md); color:var(--text); max-width:var(--measure); margin:var(--space-4) 0; }
.moment-emoji { font-size:clamp(2.5rem,9vw,3.25rem); line-height:1; text-align:center; margin:var(--space-4) 0 var(--space-2); }
.hint { color:var(--text-muted); margin:0 0 var(--space-5); }
.nav { display:flex; align-items:center; gap:var(--space-3); margin-top:var(--space-6); }
.nav .btn:last-child { margin-left:auto; }

/* progress dots — active is a gold dash */
.dots { display:flex; gap:var(--space-2); justify-content:center; margin-bottom:var(--space-6); flex-wrap:wrap; }
.dot { width:7px; height:7px; border-radius:var(--radius-pill); background:var(--border-strong);
  transition:width var(--dur-base) var(--ease-spring), background var(--dur-base) var(--ease-out); }
.dot.on, .dot.is-done { background:var(--accent); }
.dot.is-current { width:22px; background:var(--accent); }

/* --- media / recorder --- */
.media { margin:var(--space-3) 0; }
.rec { display:flex; gap:var(--space-2); align-items:center; flex-wrap:wrap; }
#recBtn.recording, .chip[data-state="recording"] { color:#fff; background:var(--danger-bg); border-color:var(--danger); }
#recBtn.recording::before, .chip[data-state="recording"]::before { content:""; width:9px; height:9px; border-radius:50%;
  background:var(--danger); box-shadow:0 0 0 0 rgba(251,113,133,.55); animation:recPulse 1.4s var(--ease-out) infinite; }
@keyframes recPulse { 0%{box-shadow:0 0 0 0 rgba(251,113,133,.55);} 70%{box-shadow:0 0 0 12px rgba(251,113,133,0);} 100%{box-shadow:0 0 0 0 rgba(251,113,133,0);} }
.attached { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-3); }
.attached-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:var(--space-2); font-weight:var(--fw-semibold); }
audio, video, img { max-width:100%; border-radius:var(--radius-sm); }
.attached audio, .attached video, .attached img { width:100%; margin-top:var(--space-2); display:block; }
audio { height:40px; }

/* --- composer: method picker → item list --- */
/* The pieces a supporter has added to one moment (text / voice / photo / video). */
.item-list { list-style:none; padding:0; margin:var(--space-4) 0 0; display:grid; gap:var(--space-2); }
.item { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-3);
  animation:stepIn var(--dur-fast) var(--ease-out) both; }
.item-head { display:flex; justify-content:space-between; align-items:center; gap:var(--space-2); }
.item-head .btn.link { min-height:28px; }
.item audio, .item video, .item img { width:100%; margin-top:var(--space-2); display:block; }
.item p { margin:var(--space-2) 0 0; }
/* The active text / voice input, or the picker row of chips. */
.compose { margin:var(--space-4) 0 0; display:grid; gap:var(--space-2); }
.compose textarea { margin-top:0; }
.compose .nav { margin-top:0; }
#composer .rec { margin-top:var(--space-4); }

/* --- review list --- */
/* the emphasized ("featured") moment — the Wall */
.featured-callout { background:var(--accent-soft); border:1px solid var(--accent-line); border-radius:var(--radius-md);
  padding:var(--space-3) var(--space-4); margin-bottom:var(--space-4); font-size:var(--fs-sm); color:var(--text); }
.step.featured .moment-emoji { filter:drop-shadow(0 6px 18px rgba(255,209,102,.35)); }
.step.featured h2 { color:var(--accent); }
.review-nudge { background:var(--accent-soft); border:1px solid var(--accent-line); border-radius:var(--radius-md);
  padding:var(--space-3) var(--space-4); margin:var(--space-3) 0; font-size:var(--fs-sm); }

/* create-event slug field */
.slug-row { display:flex; align-items:center; gap:var(--space-2); margin-top:var(--space-2); }
.slug-row input { margin-top:0; }

/* organizer share card (link + QR) */
.share-card { display:flex; gap:var(--space-5); align-items:center; justify-content:space-between; flex-wrap:wrap; }
.share-card .share-info { flex:1 1 220px; min-width:0; }
.share-card .share-url { display:flex; align-items:center; gap:var(--space-2); flex-wrap:wrap; }
.share-card .share-url code { font-size:var(--fs-sm); color:var(--accent); overflow-wrap:anywhere; word-break:break-all; max-width:100%; }
.share-card .qr { width:140px; height:140px; flex-shrink:0; border-radius:var(--radius-md); background:#fff; padding:8px; }

ul.review { list-style:none; padding:0; }
ul.review li { display:flex; justify-content:space-between; gap:var(--space-3); align-items:center;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:var(--space-3) var(--space-4); margin:var(--space-2) 0; }

/* "what you sent" recap — done screen + return visit (read-only) */
.card.recap { text-align:left; }
.card.recap h3 { margin:0 0 var(--space-2); font-size:var(--fs-md); }
.sent-list { list-style:none; padding:0; margin:0; display:grid; gap:var(--space-2); }
.sent-list li { display:flex; gap:var(--space-2); align-items:baseline; flex-wrap:wrap;
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:var(--space-2) var(--space-3); }
.sent-list .tag { flex:none; }

/* confirm-before-send sheet (bottom sheet on mobile, centered dialog on wider screens) */
.sheet-backdrop { position:fixed; inset:0; z-index:60; display:flex; align-items:flex-end; justify-content:center;
  padding:var(--gutter); background:var(--overlay); backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px);
  animation:fadeIn var(--dur-fast) var(--ease-out) both; }
.sheet { width:100%; max-width:var(--content); background:var(--surface); border:1px solid var(--border-strong);
  border-radius:var(--radius-lg); padding:var(--space-6); box-shadow:var(--shadow-lg);
  animation:sheetUp var(--dur-base) var(--ease-spring) both; }
.sheet h2 { margin-top:0; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes sheetUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:none; } }
@media (min-width:640px) { .sheet-backdrop { align-items:center; } }

/* --- send celebration --- */
.celebrate { animation:bloom var(--dur-celebrate) var(--ease-spring) both; }
@keyframes bloom { 0%{transform:scale(.6);opacity:0;} 55%{opacity:1;} 100%{transform:scale(1);opacity:1;} }
.bloom-glow { position:fixed; inset:0; pointer-events:none; z-index:1;
  background:radial-gradient(circle at 50% 38%, var(--accent-soft), transparent 55%); animation:glowOut var(--dur-celebrate) var(--ease-out) both; }
@keyframes glowOut { 0%{opacity:0;transform:scale(.7);} 40%{opacity:1;} 100%{opacity:0;transform:scale(1.2);} }
.confetti { position:fixed; top:-12px; width:8px; height:12px; border-radius:2px; pointer-events:none; z-index:2; will-change:transform,opacity; }
@keyframes confettiFall { to { transform:translateY(105vh) rotate(540deg); opacity:0; } }

/* --- race view (the stage) --- */
body.race { background:radial-gradient(140% 60% at 50% 0%, #161019, transparent 60%), var(--bg); min-height:100dvh; }
/* pre-race masthead: who + which race + a live countdown to the gun time */
.race-head { margin-bottom:var(--space-6); }
.race-head h1 { margin-bottom:var(--space-1); }
.race-meta { margin:0 0 var(--space-2); }
.countdown { margin:0; color:var(--accent); font-weight:var(--fw-semibold); font-variant-numeric:tabular-nums; }
.countdown[hidden] { display:none; }
.race .current { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl);
  padding:clamp(1.5rem,6vw,2.5rem); margin:var(--space-6) 0; min-height:46vh;
  display:flex; flex-direction:column; justify-content:center;
  transition:box-shadow var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.race .current.is-live { box-shadow:var(--glow-gold); }
/* held breath: the panel arrives, then its glow swells once and settles (single iteration — battery on a 5-7hr course) */
.race .current.deliver { animation:breathIn var(--dur-slow) var(--ease-out) both, breathHold 1400ms var(--ease-in-out) var(--dur-slow) 1; }
@keyframes breathIn { from { opacity:0; transform:scale(.985); } to { opacity:1; transform:none; } }
@keyframes breathHold { 0%,100% { box-shadow:var(--glow-gold); } 50% { box-shadow:0 0 0 1px var(--accent-line),0 12px 56px rgba(255,209,102,.34); } }

/* stage focus: when a message is live the rest of the trail recedes to near-dark so one thing is lit.
   #status is intentionally NOT dimmed — it carries the 'no more messages — keep going' line. */
.race.stage-focus #counter, .race.stage-focus #keepsake { opacity:.12; pointer-events:none; transition:opacity var(--dur-slow) var(--ease-out); }
/* the 'next message' control demotes to a quiet gold dash that dawns in only after she's had time to read */
.race.stage-focus #nextBtn { background:none; border:none; box-shadow:none; min-height:44px;
  color:var(--accent); text-decoration:underline; text-underline-offset:6px;
  opacity:0; animation:nextDawn var(--dur-slow) var(--ease-out) 2500ms forwards; }
@keyframes nextDawn { to { opacity:.7; } }
/* during the mis-tap cooldown the dash visibly recedes (overrides nextDawn's held opacity) */
.race.stage-focus #nextBtn[disabled] { animation:none; opacity:.3; }
@media (prefers-reduced-motion: reduce) { .race.stage-focus #nextBtn { animation:none; opacity:.7; } }
.current.hidden, .hidden { display:none; }
.from { color:var(--accent); font-weight:var(--fw-semibold); margin:0 0 var(--space-3); }
.msg { font:var(--fw-semibold) var(--fs-msg)/1.25 var(--font-display); letter-spacing:var(--tracking-snug); }
/* the moment a message belongs to, as a quiet timeline marker (stage + keepsake cards) */
.moment-chip { display:inline-flex; align-self:center; margin:0 0 var(--space-4); padding:var(--space-1) var(--space-3);
  font:var(--fw-medium) var(--fs-xs)/1 var(--font-sans); letter-spacing:var(--tracking-wide); text-transform:uppercase;
  color:var(--accent); background:var(--accent-soft); border:1px solid var(--accent-line); border-radius:var(--radius-pill); }
.moment-chip[hidden] { display:none; }
.keepsake .card .moment-chip { margin:0 0 var(--space-2); align-self:flex-start; }
.race .controls { display:flex; gap:var(--space-3); justify-content:center; }
.race .controls .btn { min-height:56px; }
.heart-wait { font-size:2rem; text-align:center; animation:heartPulse 2.4s var(--ease-in-out) infinite; }
@keyframes heartPulse { 50% { opacity:.45; transform:scale(.94); } }

/* pre-race setup: download + delivery mode */
.setup { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:var(--space-5); margin:var(--space-6) 0; text-align:left; box-shadow:var(--shadow-inset-top),var(--shadow-sm); }
.setup .btn { width:100%; }
/* once everything's cached for offline, the status flips to a calm green 'you're safe' badge and the
   download button recedes — reassurance without shouting (it persists across a dead-zone reload). */
#setup[data-saved] #dlStatus { display:flex; align-items:center; justify-content:center; gap:var(--space-2);
  margin-top:var(--space-3); padding:var(--space-3) var(--space-4); font-weight:var(--fw-semibold);
  color:var(--success); background:var(--success-bg);
  border:1px solid color-mix(in srgb, var(--success) 32%, transparent); border-radius:var(--radius-md); }
#setup[data-saved] #dlBtn { opacity:.7; }
.modes { border:none; padding:0; margin:var(--space-4) 0 0; }
.modes legend { padding:0 0 var(--space-2); }
.mode { display:flex; gap:var(--space-3); align-items:flex-start; margin:0; padding:var(--space-3);
  border:1px solid var(--border); border-radius:var(--radius-md); margin-bottom:var(--space-2); cursor:pointer;
  font-weight:var(--fw-regular); transition:border-color var(--dur-fast), background var(--dur-fast); }
.mode:hover { border-color:var(--border-strong); }
.mode input { width:auto; min-height:0; margin:3px 0 0; accent-color:var(--accent); }
.mode:has(input:checked) { border-color:var(--accent-line); background:var(--accent-soft); }
.mode span { font-size:var(--fs-sm); color:var(--text-muted); }
.mode span strong { color:var(--text); font-weight:var(--fw-semibold); }
#playBtn { margin-top:var(--space-4); }

/* keepsake list */
.keepsake { margin-top:var(--space-10); }
.keepsake h2 { font-size:var(--fs-lg); }
.keepsake .card { text-align:left; }
.keepsake .card .from { font-size:var(--fs-sm); }

/* finish: she taps 'I finished' at the line → a quiet celebration + the keepsake promoted to a
   permanent scrapbook of every voice. One single-iteration bloom — no looping motion. */
.finish-cta { margin-top:var(--space-4); }
.finish { margin-top:var(--space-8); }
.finish h2 { font:var(--fw-display) var(--fs-msg)/1.12 var(--font-display); letter-spacing:var(--tracking-tight); margin:0 0 var(--space-2); }
.finish-bloom { font-size:2.8rem; margin:0 0 var(--space-3); animation:bloom var(--dur-celebrate) var(--ease-spring) both; }
@keyframes bloom { from { opacity:0; transform:scale(.4); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) { .finish-bloom { animation:none; } }

/* --- supporter voice page (vertical checkpoints) --- */
body.supporter { background:radial-gradient(120% 60% at 50% 0%, #161019, transparent 60%), var(--bg); }
.cheer-head { margin:var(--space-6) 0; }
.cheer-head .lead { color:var(--text-muted); max-width:36ch; margin:var(--space-3) auto 0; }
.namefield { max-width:var(--content); margin:0 auto var(--space-6); }
.namefield input.flash { border-color:var(--danger); box-shadow:0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent);
  animation:flashField .5s var(--ease-in-out) 2; }
@keyframes flashField { 50% { box-shadow:0 0 0 7px color-mix(in srgb, var(--danger) 28%, transparent); } }
#checkpoints { display:flex; flex-direction:column; gap:var(--space-4); }
.cp { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:var(--space-5); box-shadow:var(--shadow-inset-top),var(--shadow-sm); }
.cp.featured { border-color:var(--accent-line); box-shadow:var(--glow-gold); }
.cp-head { display:flex; gap:var(--space-3); align-items:flex-start; }
.cp-emoji { font-size:1.6rem; line-height:1; }
.cp-text { flex:1; }
.cp-text h2 { font-size:var(--fs-md); margin:0; }
.cp-star { font-size:1.15rem; }
.rec { margin-top:var(--space-4); }
.rec-go { width:100%; min-height:52px; }
/* compact recorder row: live meter + pause/resume + start-over + delete + Save */
.rec-bar { display:flex; align-items:center; gap:var(--space-2); flex-wrap:wrap; }
.rec-bar[hidden] { display:none; } /* display:flex would otherwise beat the UA [hidden] rule */
.rec-meter { display:inline-flex; align-items:center; gap:var(--space-2); flex:1 1 auto; min-width:72px;
  font-variant-numeric:tabular-nums; font-weight:var(--fw-semibold); color:var(--text); }
.rec-dot { width:11px; height:11px; border-radius:50%; background:var(--danger); animation:recPulse 1.2s var(--ease-in-out) infinite; }
.rec[data-state="paused"] .rec-dot { animation:none; opacity:.4; }
@keyframes recPulse { 50% { opacity:.3; } }
.icbtn { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:0;
  font-size:1.05rem; background:var(--surface-2); color:var(--text); border:1px solid var(--border-strong);
  border-radius:var(--radius-sm); cursor:pointer; transition:background var(--dur-fast) var(--ease-out); }
.icbtn:hover { background:var(--surface-3); }
.rec-bar .rec-save { min-height:44px; padding:0 var(--space-5); }
.rec-note { margin-top:var(--space-2); color:var(--danger); }
.rec-sent { margin:0; text-align:center; color:var(--success); font-weight:var(--fw-semibold); }

/* --- athlete wall (merged play + manage) --- */
body.wall { background:radial-gradient(120% 60% at 50% 0%, #161019, transparent 60%), var(--bg); }
.wall-head { margin:var(--space-4) 0 var(--space-6); }
.wall-actions { margin:var(--space-4) 0; }
.wall-actions .btn.big { max-width:24rem; margin:0 auto; }
.memos { display:flex; flex-direction:column; gap:var(--space-2); margin-top:var(--space-3); }
.memo { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-2) var(--space-3);
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); }
.memo .play { flex:0 0 auto; min-width:48px; }
.memo-from { flex:1; font-weight:var(--fw-medium); }
.memo-del { margin-left:auto; }
.memo-confirm { margin-left:auto; display:flex; align-items:center; gap:var(--space-2); flex-wrap:wrap; justify-content:flex-end; }
/* .icbtn is display:inline-flex, which beats UA [hidden]{display:none} — re-assert it for toggling. */
.icbtn[hidden] { display:none; }

/* --- race view: full-screen, one-checkpoint-at-a-time focus mode (slideshow) --- */
body.rv-on { overflow:hidden; }
.rv { position:fixed; inset:0; z-index:60; display:flex; align-items:stretch; justify-content:center;
  background:radial-gradient(125% 80% at 50% -10%, #1b1430, var(--bg) 65%);
  padding:max(var(--space-6), env(safe-area-inset-top)) var(--gutter) max(var(--space-6), env(safe-area-inset-bottom));
  animation:fadeIn .25s ease both; overscroll-behavior:contain; }
.rv[hidden] { display:none; }
.rv-close { position:absolute; top:max(var(--space-4), env(safe-area-inset-top)); right:var(--gutter);
  width:40px; height:40px; border-radius:var(--radius-pill); border:1px solid var(--border-strong);
  background:var(--surface); color:var(--text-muted); font-size:1.05rem; cursor:pointer; z-index:2; }
.rv-close:hover { background:var(--surface-3); color:var(--text); }
.rv-screen { position:relative; width:100%; max-width:30rem; margin:auto; display:flex; flex-direction:column;
  gap:var(--space-5); min-height:0; animation:breathIn .3s ease both; }
.rv-top { display:flex; align-items:center; gap:var(--space-3); padding-right:48px; }
.rv-count { font-size:var(--fs-sm); color:var(--text-subtle); font-variant-numeric:tabular-nums; }
.rv-dots { flex:1; display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.rv-dot { width:7px; height:7px; border-radius:var(--radius-pill); background:var(--surface-3); transition:background .2s,transform .2s; }
.rv-dot.on { background:var(--accent); transform:scale(1.35); }
.rv-body { display:flex; flex-direction:column; align-items:center; gap:var(--space-4); text-align:center;
  overflow-y:auto; min-height:0; }
.rv-emoji { font-size:clamp(3rem,16vw,5rem); line-height:1; }
.rv-emoji.big { font-size:clamp(4rem,22vw,7rem); animation:bloom .5s ease both; }
.rv-label { font-size:var(--fs-2xl); margin:0; }
.rv-sub { margin:0; }
.rv-memos { width:100%; display:flex; flex-direction:column; gap:var(--space-2); }
.rv-memo { display:flex; flex-direction:column; padding:var(--space-2) var(--space-3);
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); text-align:left;
  transition:border-color .25s ease, box-shadow .25s ease; }
.rv-memo.heard { opacity:.6; }
.rv-memo.playing { opacity:1; border-color:var(--accent-line); box-shadow:var(--glow-gold); }
.rv-memo-head { display:flex; align-items:center; gap:var(--space-3); }
.rv-memo .play { flex:0 0 auto; min-width:48px; }
.rv-from { flex:1; font-weight:var(--fw-medium); }
.rv-time { font-size:var(--fs-sm); color:var(--text-muted); font-variant-numeric:tabular-nums;
  opacity:0; transition:opacity .2s ease; }
.rv-memo.playing .rv-time { opacity:1; }
.rv-check { color:var(--accent); min-width:1rem; text-align:right; }
/* The seek expands inside the playing row (smooth pop-out), collapsed + inert otherwise. */
.rv-mseek { max-height:0; opacity:0; margin-top:0; overflow:hidden; pointer-events:none;
  transition:max-height .28s ease, opacity .28s ease, margin-top .28s ease; }
.rv-memo.playing .rv-mseek { max-height:48px; opacity:1; margin-top:var(--space-2); pointer-events:auto; }
.rv-seek { width:100%; height:34px; margin:0; accent-color:var(--accent); background:transparent;
  cursor:pointer; touch-action:none; }
.rv-seek:disabled { opacity:.5; }
.rv-empty { padding:var(--space-4) 0; margin:0; }
.rv-hint { display:flex; align-items:center; justify-content:center; gap:var(--space-2); margin:var(--space-3) 0 0;
  color:var(--text-subtle); font-size:var(--fs-sm); }
.rv-hint .l { display:inline-block; animation:rvNudgeL 1.6s ease-in-out infinite; }
.rv-hint .r { display:inline-block; animation:rvNudgeR 1.6s ease-in-out infinite; }
@keyframes rvNudgeL { 0%,100% { transform:translateX(0); opacity:.45; } 50% { transform:translateX(-5px); opacity:1; } }
@keyframes rvNudgeR { 0%,100% { transform:translateX(0); opacity:.45; } 50% { transform:translateX(5px); opacity:1; } }
.rv-lift { margin-top:var(--space-2); border-style:dashed; }
.rv-lift.on { border-style:solid; border-color:var(--accent-line); color:var(--accent); box-shadow:var(--glow-gold); }
.rv-nav { display:flex; gap:var(--space-3); margin-top:auto; padding-top:var(--space-4); }
.rv-nav .btn { flex:1; min-height:54px; }
.rv-intro, .rv-end { align-items:center; justify-content:center; text-align:center; }
.rv-introbody, .rv-endbody { display:flex; flex-direction:column; align-items:center; gap:var(--space-4); margin:auto 0; }
.rv-introbody .btn.big, .rv-endbody .btn.big { max-width:20rem; }
.rv-kicker { text-transform:uppercase; letter-spacing:.18em; font-size:var(--fs-xs); color:var(--accent); margin:0; }
.rv-title { font-size:var(--fs-3xl); margin:0; }
.rv-confettis { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:0; }
.rv-confetti { position:absolute; top:-8vh; width:9px; height:14px; border-radius:2px; opacity:.95;
  animation:confettiFall 2.6s linear infinite; }
.rv-end > *:not(.rv-confettis) { position:relative; z-index:1; }
@media (prefers-reduced-motion:reduce) { .rv, .rv-screen, .rv-emoji.big, .rv-confetti, .rv-hint .l, .rv-hint .r { animation:none; } }

/* --- marketing nav + footer --- */
.nav-bar { position:sticky; top:0; z-index:50; display:flex; align-items:center; justify-content:space-between;
  height:60px; padding:0 var(--gutter); background:color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter:saturate(140%) blur(14px); -webkit-backdrop-filter:saturate(140%) blur(14px);
  border-bottom:1px solid transparent; transition:border-color var(--dur-base) var(--ease-out); }
.nav-bar.is-scrolled { border-bottom-color:var(--hairline); }
.brand { display:inline-flex; align-items:center; gap:var(--space-2); font:var(--fw-bold) var(--fs-md)/1 var(--font-display);
  letter-spacing:var(--tracking-tight); color:var(--text); text-decoration:none; }
.brand .mark { width:26px; height:26px; }
.footer { border-top:1px solid var(--hairline); padding:var(--space-12) var(--gutter); color:var(--text-subtle); font-size:var(--fs-sm); text-align:center; }
.footer a { color:var(--text-muted); text-decoration:none; }
.footer a:hover { color:var(--text); }

/* --- marketing landing --- */
body.home { background:radial-gradient(120% 80% at 50% -10%, var(--bg-grad-1), transparent 60%), var(--bg); }
.shell { max-width:var(--content-marketing); margin:0 auto; padding:0 var(--gutter); }
.hero { text-align:center; padding:var(--space-20) 0 var(--space-16); max-width:var(--measure); margin:0 auto; }
.eyebrow { text-transform:uppercase; letter-spacing:var(--tracking-wide); font-size:var(--fs-xs); font-weight:var(--fw-semibold); color:var(--text-subtle); }
.hero h1 { font-size:var(--fs-4xl); line-height:1.02; margin:var(--space-4) 0; }
.hero .sub { font-size:var(--fs-md); color:var(--text-muted); max-width:52ch; margin:0 auto var(--space-8); }
.cta-row { display:flex; gap:var(--space-3); justify-content:center; flex-wrap:wrap; }
.hero-mock { margin:var(--space-16) auto 0; max-width:24rem; }
.mock-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl); padding:var(--space-6);
  box-shadow:var(--glow-gold); text-align:left; }
.mock-card .from { font-size:var(--fs-sm); }
.mock-card .mock-msg { font:var(--fw-semibold) var(--fs-lg)/1.3 var(--font-display); margin:var(--space-2) 0 var(--space-4); }
.section { padding:var(--space-16) 0; border-top:1px solid var(--hairline); }
.section h2 { font-size:var(--fs-2xl); text-align:center; }
.section .lead { color:var(--text-muted); text-align:center; max-width:48ch; margin:var(--space-3) auto var(--space-8); }
.moment-strip { display:flex; gap:var(--space-3); justify-content:center; flex-wrap:wrap; }
.moment-pill { display:inline-flex; align-items:center; gap:var(--space-2); padding:var(--space-2) var(--space-4);
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-pill); font-size:var(--fs-sm); }
.steps3 { display:grid; gap:var(--space-4); grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.steps3 .card { margin:0; }
.steps3 .num { display:inline-flex; width:32px; height:32px; align-items:center; justify-content:center; border-radius:var(--radius-pill);
  background:var(--accent-soft); color:var(--accent); font-weight:var(--fw-bold); margin-bottom:var(--space-2); }
.quote-card { max-width:36rem; margin:0 auto; }
.quote-card .mock-msg { font-size:var(--fs-xl); }

/* scroll reveal */
.reveal { opacity:0; transform:translateY(16px); transition:opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.in-view { opacity:1; transform:none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important; scroll-behavior:auto !important; }
  .reveal { opacity:1; transform:none; }
}
@media (prefers-reduced-data: reduce) {
  body.home, body.race { background:var(--bg); }
}
