/* Relentless Spark: same race-bib look as "Same Finish Line". Granite, Tahoe blue, flagging-tape pink. */
:root {
  --bg: #eef2f1;
  --paper: #ffffff;
  --ink: #17201f;
  --muted: #5a6866;
  --line: #d3dcda;
  --lake: #1d6a84;
  --lake-soft: #dcecf1;
  --flag: #e0336f;
  --flag-soft: #fbe2eb;
  --pine: #2f5d50;
  --far: #b9cdd0;
  --near: #8fb0b5;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141918; --paper: #1d2423; --ink: #ecf1f0; --muted: #9aaaa7; --line: #2f3a38;
    --lake: #5fb3d0; --lake-soft: #18323b; --flag: #ff5c93; --flag-soft: #3a1d28; --pine: #7fbfa8;
    --far: #26343a; --near: #324650; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141918; --paper: #1d2423; --ink: #ecf1f0; --muted: #9aaaa7; --line: #2f3a38;
  --lake: #5fb3d0; --lake-soft: #18323b; --flag: #ff5c93; --flag-soft: #3a1d28; --pine: #7fbfa8;
  --far: #26343a; --near: #324650; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: 56px;
}
[hidden] { display: none !important; }

.ridge { margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))); height: 90px; }
.ridge svg { width: 100%; height: 100%; display: block; }
.ridge .far { fill: var(--far); }
.ridge .near { fill: var(--near); }
.ridge .snow { fill: var(--paper); }
.ridge .lake { fill: var(--lake); opacity: .7; }
.ridge .trail { fill: none; stroke: var(--flag); stroke-width: 2; stroke-dasharray: 4 5; }

.wrap { max-width: 560px; margin: 16px auto 0; display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: .01em; line-height: .95; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(3rem, 14vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 8vw, 2.4rem); }
h3 { font-size: 1.35rem; }
p { margin: 0; }
.eyebrow { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.flag { color: var(--flag); }
.lede { color: var(--muted); max-width: 60ch; }
.sig { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--flag); text-transform: uppercase; }
.note { font-size: .88rem; color: var(--muted); }

.bib {
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 24px 20px 20px;
  position: relative; display: flex; flex-direction: column; gap: 16px;
}
.bib::before, .bib::after {
  content: ""; position: absolute; top: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.bib::before { left: 10px; } .bib::after { right: 10px; }

.btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer;
  background: var(--flag); color: #fff; text-align: center; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: .88rem; text-decoration: underline; cursor: pointer; padding: 6px 2px; }
.link.danger { color: var(--flag); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.spread { justify-content: space-between; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid var(--lake); outline-offset: 2px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .92rem; }
input[type=text], input[type=password], textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 12px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
.pin { font-family: var(--mono); font-size: 2rem; letter-spacing: .4em; text-align: center; padding: 14px; }

/* trail map */
.trail { display: flex; flex-direction: column; gap: 0; position: relative; }
.trail::before { content: ""; position: absolute; left: 21px; top: 24px; bottom: 24px; border-left: 3px dashed var(--line); }
.stop {
  font: inherit; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 10px 0; position: relative; width: 100%;
}
.stop .dot {
  width: 44px; height: 44px; border-radius: 50%; background: var(--paper); border: 3px solid var(--lake);
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 1rem; color: var(--lake); z-index: 1;
}
.stop.done .dot { background: var(--lake); color: var(--paper); }
.stop .card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: border-color .15s; }
.stop:hover .card { border-color: var(--lake); }
.stop .name { font-family: var(--display); font-weight: 900; font-size: 1.4rem; text-transform: uppercase; line-height: 1; }
.stop .blurb { font-size: .9rem; color: var(--muted); }
.tag { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; align-self: flex-start; }
.tag.match, .tag.done { background: var(--lake-soft); color: var(--lake); }
.tag.diff, .tag.new { background: var(--flag-soft); color: var(--flag); }

.pill { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--lake-soft); color: var(--ink); border-radius: 8px; padding: 12px 14px; font-size: .92rem; }

.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.rules li::marker { color: var(--flag); }

/* questions */
.qblock { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.qblock:first-of-type { border-top: 0; padding-top: 0; }
.q { font-size: 1.15rem; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  font: inherit; text-align: left; background: var(--bg); color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 8px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.opt:hover { border-color: var(--lake); }
.opt:active { transform: scale(.99); }
.opt[aria-pressed="true"] { border-color: var(--flag); background: var(--flag-soft); }
.opt.lie { border-color: var(--flag); background: var(--flag-soft); }
.opt.truth { border-color: var(--line); }
.opt:disabled { cursor: default; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duo .opt { text-align: center; }
.vs { font-family: var(--display); font-weight: 900; font-size: 1.1rem; text-transform: uppercase; color: var(--muted); }

.cmp { display: flex; flex-direction: column; gap: 12px; }
.cmp-item { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > div { min-width: 0; font-size: .92rem; overflow-wrap: anywhere; }
.who { font-family: var(--mono); font-size: .68rem; color: var(--muted); display: block; text-transform: uppercase; letter-spacing: .06em; }
.big { font-family: var(--display); font-weight: 900; font-size: 4rem; line-height: .85; color: var(--flag); font-variant-numeric: tabular-nums; }

/* story */
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--flag); }
.story p { font-size: 1.05rem; line-height: 1.6; }
.story { display: flex; flex-direction: column; gap: 12px; }
.story mark { background: var(--flag-soft); color: var(--ink); padding: 0 3px; border-radius: 3px; font-weight: 700; }

/* register */
.entries { display: flex; flex-direction: column; gap: 10px; }
.entry { border-radius: 8px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; max-width: 92%; }
.entry.mine { align-self: flex-end; background: var(--flag-soft); border-color: transparent; }
.entry p { white-space: pre-wrap; overflow-wrap: anywhere; }

.ttl-round { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.ttl-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.radio { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.radio input { width: 18px; height: 18px; accent-color: var(--flag); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: .85rem; font-weight: 700; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.footer { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; padding-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: .9rem; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal { position: fixed; inset: 0; background: rgba(10, 16, 15, .55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal .bib { max-width: 460px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; }
.choice { font: inherit; text-align: left; background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); border-radius: 8px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.choice:hover { border-color: var(--lake); }
.choice.danger:hover { border-color: var(--flag); }
.choice strong { font-size: 1.02rem; }
.choice span { font-size: .88rem; color: var(--muted); }

@media (max-width: 380px) { .pair, .duo { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .opt, .toast, .stop .card { transition: none; } }
