:root {
  --bg: #F8FAFC; --card: #FFFFFF; --ink: #0F172A; --muted: #475569; --line: #E2E8F0;
  --brand: #0B3B60; --brand2: #0E7490; --accent: #D97706; --soft: #F0F9FF; --warm: #FFF7ED;
  --gold: #FBBF24; --ok: #166534; --okbg: #DCFCE7;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --card: #111A2E; --ink: #E8EEF7; --muted: #9FB0C7; --line: #22314D;
    --soft: #0F2236; --warm: #2A1D0E; --okbg: #12301F; --ok: #86EFAC;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  overflow-x: hidden;
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ── Header ───────────────────────────────────── */
.top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.top .wrap { display: flex; align-items: center; gap: 14px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--gold); line-height: 1; margin-bottom: 2px; }
.brand span { line-height: 1.05; font-size: 15px; }
.nav { margin-left: auto; display: flex; gap: 2px; }
.nav a { color: #D8ECFA; font-weight: 700; font-size: 14px; padding: 8px 11px; border-radius: 10px; }
.nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.18); color: #fff; }
.nav .app { background: var(--gold); color: #78350F; }
.nav .app:hover { background: #FCD34D; color: #78350F; }
@media (max-width: 640px) {
  .brand span { display: none; }
  .nav a { padding: 8px 8px; font-size: 13px; }
  .nav .hide-sm { display: none; }
}

/* ── Hero / search ─────────────────────────────── */
.bleed { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); padding-left: 16px; padding-right: 16px; }
.hero { background: linear-gradient(160deg, var(--brand) 0%, #0A5A7A 100%); color: #fff; padding: 34px 0 40px; }
.hero .kicker { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.8px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 900; margin: 6px 0 8px; }
.hero p { color: #BAE6FD; margin: 0 0 20px; font-size: 17px; max-width: 640px; }
.searchbox { position: relative; max-width: 640px; }
.searchbox input {
  width: 100%; font: inherit; font-size: 18px; padding: 16px 18px 16px 50px; border-radius: 16px;
  border: 3px solid transparent; background: #fff; color: #0F172A; outline: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.searchbox input:focus { border-color: var(--gold); }
.searchbox .mag { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); font-size: 20px; pointer-events: none; }
.hint { color: #BAE6FD; font-size: 13px; margin-top: 10px; }
.heroStats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 22px; }
.heroStats b { display: block; font-size: 24px; font-weight: 900; }
.heroStats span { font-size: 12px; font-weight: 700; color: #BAE6FD; letter-spacing: .4px; }

/* ── Layout bits ───────────────────────────────── */
main { padding: 22px 0 50px; min-height: 60vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.pad { padding: 16px; }
.sec { margin: 26px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec h2 { font-size: 20px; font-weight: 900; }
.sec a { font-weight: 800; font-size: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 40px 10px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--brand); cursor: pointer;
}
.chip:hover { text-decoration: none; border-color: var(--brand2); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .chip { color: var(--ink); } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { font: inherit; font-weight: 800; font-size: 14px; padding: 8px 16px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand2); color: #fff; }
select, .field {
  font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
}
.btn {
  display: inline-block; font: inherit; font-weight: 800; font-size: 15px; padding: 11px 18px; border-radius: 13px;
  border: 0; background: var(--brand); color: #fff; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.alt { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn.gold { background: var(--gold); color: #78350F; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Search results ───────────────────────────── */
.people { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 14px; }
.person { display: flex; align-items: center; gap: 12px; padding: 13px 14px; color: var(--ink); }
.person:hover { text-decoration: none; border-color: var(--brand2); transform: translateY(-1px); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-weight: 900; font-size: 15px; flex: none; }
.person b { display: block; font-size: 16px; }
.person small { color: var(--muted); font-weight: 600; }
.person .go { margin-left: auto; color: var(--brand2); font-weight: 900; font-size: 22px; }
.inhero .people .person { background: #fff; color: #0F172A; }
.inhero .note { color: #BAE6FD; margin-top: 14px; font-size: 14px; }

/* ── Race cards ───────────────────────────────── */
.racecard { display: block; padding: 14px 16px; color: var(--ink); }
.racecard:hover { text-decoration: none; border-color: var(--brand2); transform: translateY(-1px); }
.racecard .d { font-size: 12px; font-weight: 800; color: var(--accent); letter-spacing: .5px; text-transform: uppercase; }
.racecard b { display: block; font-size: 17px; margin: 2px 0 6px; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; color: var(--brand); background: var(--soft); border-radius: 999px; padding: 3px 9px; margin: 0 4px 4px 0; }
@media (prefers-color-scheme: dark) { .tag { color: #BAE6FD; } }

/* ── Race results table ───────────────────────── */
.racehead { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 18px 20px; }
.racehead .d { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.racehead h1 { font-size: clamp(24px, 5vw, 34px); font-weight: 900; margin: 4px 0; }
.racehead p { margin: 0; color: #BAE6FD; font-weight: 600; }
.racehead .acts { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.controls .grow { flex: 1; min-width: 180px; }
.rows { overflow: hidden; }
.row {
  display: grid; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
  grid-template-columns: 44px minmax(0, 1fr) 84px 54px 70px 62px 86px;
}
.row:last-child { border-bottom: 0; }
.row.head { background: var(--soft); font-size: 11px; font-weight: 900; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; padding: 9px 14px; }
.row.p1 { background: #FFFBEB; box-shadow: inset 4px 0 0 #F59E0B; }
.row.p2 { background: #F8FAFC; box-shadow: inset 4px 0 0 #94A3B8; }
.row.p3 { background: #FFF7ED; box-shadow: inset 4px 0 0 #EA580C; }
@media (prefers-color-scheme: dark) {
  .row.p1 { background: #2A2108; } .row.p2 { background: #1A2438; } .row.p3 { background: #2A1B10; }
}
.rank { text-align: center; font-weight: 900; font-size: 15px; color: var(--brand); }
.rank .medal { font-size: 24px; line-height: 1; }
.rank .bubble { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 15px; background: var(--soft); font-size: 13px; padding: 0 6px; }
.nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm a { color: var(--ink); }
.sub { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono { font-variant-numeric: tabular-nums; }
.pace, .bib, .gen { font-size: 14px; color: var(--muted); font-weight: 700; }
.time { text-align: right; font-weight: 900; font-size: 18px; color: var(--brand); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .time, .rank { color: #7DD3FC; } }
.pill {
  display: inline-block; font-size: 12px; font-weight: 900; padding: 3px 9px; border-radius: 999px;
  background: var(--soft); color: var(--brand); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.pill.p1 { background: #FDE68A; color: #92400E; border-color: #F59E0B; }
.pill.p2 { background: #E2E8F0; color: #334155; border-color: #94A3B8; }
.pill.p3 { background: #FED7AA; color: #9A3412; border-color: #EA580C; }
.cam { text-decoration: none; margin-left: 6px; }
.m-only { display: none; }
@media (max-width: 760px) {
  .row { grid-template-columns: 40px minmax(0, 1fr) 76px; padding: 11px 12px; }
  .row .pace, .row .bib, .row .gen, .row .div { display: none; }
  .row.head .pace, .row.head .bib, .row.head .gen, .row.head .div { display: none; }
  .m-only { display: block; }
  .time { font-size: 17px; }
}

/* ── Career page ──────────────────────────────── */
.cband { background: var(--brand); color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 22px 22px 18px; }
.cband .k { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.8px; }
.cband h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 900; margin: 4px 0; }
.cband .since { color: #BAE6FD; font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { background: rgba(255,255,255,.15); border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: 13px; }
.badge.gold { background: var(--gold); color: #78350F; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 18px 8px; }
.stats div { text-align: center; padding: 0 4px; }
.stats b { display: block; font-size: clamp(22px, 5vw, 32px); font-weight: 900; color: var(--brand); }
.stats span { font-size: 12px; font-weight: 800; color: var(--muted); }
.stats .acc b { color: var(--accent); }
@media (prefers-color-scheme: dark) { .stats b { color: #7DD3FC; } .stats .acc b { color: #FBBF24; } }
.prog { padding: 0 22px 16px; }
.track { height: 9px; border-radius: 999px; background: #E0F2FE; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; background: var(--brand2); }
.prog small { display: block; margin-top: 6px; color: var(--brand2); font-weight: 800; }
.honors { padding: 0 18px 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.honor { background: var(--warm); border: 1px solid #FED7AA; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 800; color: #9A3412; margin: 3px; }
@media (prefers-color-scheme: dark) { .honor { color: #FDBA74; border-color: #5B3A17; } }
.csec { border-top: 1px solid var(--line); padding: 18px 22px; }
.csec h3 { font-size: 14px; font-weight: 900; letter-spacing: .3px; margin-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar i { display: block; width: 70%; max-width: 34px; background: #7DD3FC; border-radius: 5px 5px 0 0; }
.bar.best i { background: var(--brand); }
.bar em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 3px; }
.bar u { text-decoration: none; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 5px; }
.prs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pr { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.pr b { font-size: 12px; font-weight: 900; color: var(--brand2); letter-spacing: .6px; }
.pr .t { font-size: 26px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.pr .m { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.story { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.story div small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.story div b { font-size: 15px; }
.hist .row { grid-template-columns: 92px minmax(0, 1fr) 64px 84px 88px; }
.hist .row .sub { white-space: normal; }
@media (max-width: 760px) {
  .hist .row { grid-template-columns: 1fr 70px 84px; }
  .hist .row .h-pl, .hist .row .h-ag { display: none; }
  .hist .row .h-date { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: var(--accent); }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 20px; }

/* ── Hall of Fame ─────────────────────────────── */
.hofhero { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.hofhero .k { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.8px; }
.hofhero h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 900; margin: 4px 0; }
.hofhero p { color: #BAE6FD; margin: 0; font-weight: 600; }
.hofhero .heroStats { margin-top: 16px; }
.tabs { display: flex; background: #E2E8F0; border-radius: 14px; padding: 4px; margin-bottom: 16px; max-width: 520px; }
@media (prefers-color-scheme: dark) { .tabs { background: #1A2742; } }
.tabs button { flex: 1; font: inherit; font-weight: 800; font-size: 14px; padding: 10px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
@media (prefers-color-scheme: dark) { .tabs button.on { color: #7DD3FC; } }
.board { padding: 10px; margin-bottom: 16px; }
.board h3 { font-size: 16px; font-weight: 900; margin: 6px 8px 8px; }
.lb { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 12px; color: var(--ink); }
.lb:hover { background: var(--soft); text-decoration: none; }
.lb.top { background: #FFFBEB; }
@media (prefers-color-scheme: dark) { .lb.top { background: #2A2108; } }
.lb .r { width: 38px; text-align: center; font-weight: 900; color: var(--brand); }
.lb .r .medal { font-size: 24px; }
.lb .n { flex: 1; min-width: 0; }
.lb .n b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .n small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.lb .v { text-align: right; font-weight: 900; font-size: 20px; color: var(--brand); font-variant-numeric: tabular-nums; }
.lb .v small { display: block; font-size: 10px; font-weight: 800; color: var(--muted); }
@media (prefers-color-scheme: dark) { .lb .v, .lb .r { color: #7DD3FC; } }

/* ── App band + footer ────────────────────────── */
.appband { background: linear-gradient(135deg, #0E7490, #0B3B60); color: #fff; border-radius: var(--radius); padding: 22px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 30px; }
.appband h3 { font-size: 22px; font-weight: 900; }
.appband p { margin: 4px 0 0; color: #BAE6FD; }
.appband .btns { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; }
footer a { font-weight: 700; }

/* ── Embeds (inside the main website) ─────────── */
body.embed { background: transparent; }
body.embed main { padding: 0; min-height: 0; }
body.embed .wrap { padding: 0 2px; max-width: none; }
.embed .hero { border-radius: 16px; padding: 22px 0 26px; }
.embed .hero .wrap { padding: 0 20px; }
.embed .hero h1 { font-size: 26px; }
.embed .people { grid-template-columns: 1fr; }
.skel { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--line), var(--soft), var(--line)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
