/* Race the Pin — Passthrough system, simplified.
   One accent: pin orange. Everything else neutral. */
:root {
  --marker: #E4531B; --marker-ink: #B23D12;
  --gold-soft: rgba(217,161,59,.14); --gold-ink: #9A6E1F;
  --ground: #E6E8EC;
  --surface: #FCFDFE; --surface-2: #F1F3F6;
  --ink: #171A21; --ink-2: #4A505C; --ink-3: #5F6672;
  --line: rgba(23,26,33,.10); --line-2: rgba(23,26,33,.17);
  --r-lg: 20px; --r: 16px;
  --shadow-sm: 0 1px 2px rgba(21,25,34,.08);
  --shadow: 0 1px 2px rgba(21,25,34,.08), 0 8px 20px rgba(21,25,34,.10), 0 24px 48px rgba(21,25,34,.10);
  --shadow-hover: 0 2px 4px rgba(21,25,34,.14), 0 20px 44px rgba(21,25,34,.2);
  --glass-bg: rgba(250,251,253,.62);
  --glass-ring: 0 1px 0 rgba(255,255,255,.6) inset, 0 0 0 1px rgba(23,26,33,.06), 0 12px 34px rgba(21,25,34,.14);
  --display: "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body); color: var(--ink); background: var(--ground);
  overflow: hidden; font-size: 14px; -webkit-font-smoothing: antialiased;
}

main { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }

/* ---------- floating glass header ---------- */
#bar {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  background: var(--glass-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--glass-ring); border-radius: 999px;
  padding: 9px 10px 9px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.kite {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--marker) 50%, #fff 50%);
  box-shadow: inset 0 0 0 2px rgba(23,26,33,.72);
}
.wordmark {
  font-family: var(--display); font-weight: 700; font-size: 17.5px;
  letter-spacing: -.01em; color: var(--ink); white-space: nowrap;
}
.wordmark i { font-style: normal; color: var(--marker); }
.bar-mid { display: flex; align-items: center; margin-left: auto; }
.demo-chip {
  font-family: var(--display); font-weight: 600; font-size: 12px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold-ink);
  box-shadow: inset 0 0 0 1px rgba(217,161,59,.4); cursor: help;
}
.drop-clock {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 16px;
}
.dc-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.62); }
.dc-time { font-family: var(--display); font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums; }
#railToggle { display: none; }

/* ---------- floating rail ---------- */
#rail {
  position: absolute; top: 78px; bottom: 16px; left: 14px; width: 392px; z-index: 20;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.intro { padding: 18px 18px 4px; }
.intro p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.intro p b { color: var(--ink); font-family: var(--display); font-weight: 700; }
.intro-free { font-size: 12.5px !important; color: var(--ink-3) !important; }
.tabs { display: flex; gap: 2px; padding: 4px 14px 0; flex: none; border-bottom: 1px solid var(--line); }
.tab {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  color: var(--ink-3); background: none; border: none; padding: 8px 9px 11px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--ink); border-bottom-color: var(--marker); }
.tab:focus-visible, button:focus-visible { outline: 2px solid var(--marker); outline-offset: 2px; }
.rail-body { flex: 1; overflow-y: auto; padding: 14px; background: var(--surface-2); }

/* ---------- cards ---------- */
.bib {
  background: var(--surface); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  cursor: pointer; transition: transform .14s ease, box-shadow .14s ease;
}
.bib:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover), inset 0 0 0 1px var(--line); }
.bib h3 {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: 16.5px;
  line-height: 1.22; letter-spacing: -.01em;
}
.bib .where { color: var(--ink-3); font-size: 12.5px; margin: 3px 0 10px; }
.bib .stats { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }
.bib .stats b { color: var(--ink); font-weight: 600; font-family: var(--display); font-size: 13px; }
.status { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px;
  line-height: 1.45; }
.status .open-word {
  font-family: var(--display); font-weight: 700; color: var(--marker-ink); font-size: 12.5px;
  letter-spacing: .04em; text-transform: uppercase;
}
.status .flagline b { font-weight: 600; }
.status .flagline.held { color: var(--ink-3); }
.small { font-size: 12px; color: var(--ink-3); }

.rail-h {
  font-family: var(--display); font-weight: 700; font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin: 18px 2px 9px;
}
.rail-h:first-child { margin-top: 2px; }

/* detail */
.back {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  background: none; border: none; color: var(--ink-3); cursor: pointer; padding: 0 0 12px;
}
.back:hover { color: var(--ink); }
.detail h2 { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.12;
  letter-spacing: -.015em; margin: 0 0 4px; }
.detail .where { color: var(--ink-3); font-size: 13px; }
.detail .statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.detail .statgrid.three { grid-template-columns: repeat(3, 1fr); }
.intro-line { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; }
.doc-link {
  display: block; margin-top: 10px; font-size: 12.5px; font-family: var(--display);
  font-weight: 600; color: var(--ink-2); text-decoration: none;
  padding: 10px 12px; background: var(--surface); border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.doc-link:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-sm); }
.detail .sg {
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px;
  padding: 9px 6px; text-align: center;
}
.detail .sg b { display: block; font-family: var(--display); font-weight: 700; font-size: 16px; }
.detail .sg span { font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.claim-card {
  background: var(--surface); border-radius: var(--r); padding: 15px 16px; margin-top: 4px;
  box-shadow: inset 0 0 0 2px var(--marker), var(--shadow-sm);
}
.claim-card.done { box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.claim-card h4 { margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 14px; }
.stamp-row { display: flex; gap: 8px; margin-top: 10px; }
.stamp {
  flex: 1; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 9px 4px;
  font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-3);
}
.stamp b { display: block; font-size: 16px; color: var(--ink); }

/* how */
.how p { line-height: 1.55; font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; }
.how p b { color: var(--ink); }

/* odometer */
#odometer {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 15;
  background: var(--glass-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--glass-ring); color: var(--ink-2); border-radius: 999px; padding: 9px 18px;
  font-size: 12.5px; white-space: nowrap;
}
#odometer b { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--ink);
  font-variant-numeric: tabular-nums; }

/* map chrome */
.maplibregl-popup-content {
  font-family: var(--body); border-radius: 12px; padding: 10px 13px; box-shadow: var(--shadow);
}
.pop-name { font-family: var(--display); font-weight: 600; font-size: 14px; }
.pop-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.maplibregl-ctrl-group { border-radius: 12px !important; box-shadow: var(--glass-ring) !important; }
.maplibregl-ctrl-top-right { top: 72px; }

/* ---------- mobile ---------- */
@media (max-width: 780px) {
  .dc-label { display: none; }
  #bar { left: 10px; right: 10px; top: 10px; gap: 8px; padding: 8px 8px 8px 12px; }
  .wordmark { font-size: 15px; }
  .drop-clock { padding: 7px 12px; }
  #railToggle {
    display: flex; flex-direction: column; gap: 4px; justify-content: center;
    background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2);
    border: none; border-radius: 999px; padding: 12px 11px; cursor: pointer;
  }
  #railToggle span { width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }
  #rail {
    top: 66px; bottom: 10px; left: 10px; right: auto; width: min(86vw, 380px);
    transform: translateX(calc(-100% - 20px)); transition: transform .22s ease;
  }
  body.rail-open #rail { transform: none; }
  #odometer { font-size: 11px; padding: 8px 12px; bottom: 10px; max-width: 94vw;
    overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- one-pin additions ---------- */
.brand-pin {
  width: 24px; height: 28px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 38'%3E%3Cpath d='M16 36C16 36 28 21.5 28 13a12 12 0 1 0-24 0c0 8.5 12 23 12 23z' fill='%23E4531B' stroke='%23171A21' stroke-width='2.4'/%3E%3Ccircle cx='16' cy='13' r='4.6' fill='%23fff'/%3E%3C/svg%3E") no-repeat center / contain;
}
.the-pin { position: relative; width: 46px; height: 58px; cursor: pointer; }
.the-pin .tp-body {
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 40'%3E%3Cpath d='M16 38C16 38 28 22.6 28 13.5a12 12 0 1 0-24 0C4 22.6 16 38 16 38z' fill='%23E4531B' stroke='%23171A21' stroke-width='2.2'/%3E%3Ccircle cx='16' cy='13.5' r='4.8' fill='%23fff'/%3E%3C/svg%3E") no-repeat center bottom / contain;
  filter: drop-shadow(0 4px 8px rgba(21,25,34,.35));
}
.the-pin .tp-ring {
  position: absolute; left: 50%; bottom: -4px; width: 34px; height: 12px;
  transform: translateX(-50%);
  border-radius: 50%; background: rgba(228,83,27,.28);
  animation: tp-pulse 2.2s ease-out infinite;
}
@keyframes tp-pulse {
  0%   { transform: translateX(-50%) scale(.6); opacity: .8; }
  70%  { transform: translateX(-50%) scale(1.7); opacity: 0; }
  100% { transform: translateX(-50%) scale(1.7); opacity: 0; }
}
.where-card {
  background: var(--surface); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--marker); margin-bottom: 14px;
}
.where-card h2 { font-family: var(--display); font-weight: 700; font-size: 21px;
  line-height: 1.2; letter-spacing: -.01em; margin: 2px 0 4px; }
.wc-btns { display: flex; gap: 8px; margin-top: 12px; }
.fbtn {
  font-family: var(--display); font-weight: 600; font-size: 13px; color: #fff;
  background: var(--ink); border: none; border-radius: 999px; padding: 9px 16px; cursor: pointer;
}
.fbtn:hover { background: #2A2F3A; }
.fbtn.ghost { background: var(--surface); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-2); }
.fbtn.ghost:hover { color: var(--ink); }
.board { background: var(--surface); border-radius: var(--r); padding: 6px 14px;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); margin-bottom: 8px; }
.lbrow { display: flex; align-items: baseline; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lbrow:last-child { border-bottom: none; }
.lb-n { font-family: var(--display); font-weight: 700; color: var(--ink-3); width: 16px; }
.lbrow:first-child .lb-n { color: var(--marker); }
.lb-who { flex: 1; }
.lb-dist { font-family: var(--display); font-weight: 700; }
