/* C.R.I. Picks — form-guide design system */

:root {
  --bg: #F1F2EE;
  --surface: #FFFFFF;
  --surface-2: #F7F8F5;
  --ink: #0F1B2A;
  --ink-2: #485263;
  --ink-3: #7A8391;
  --rule: #E3E5E0;
  --rule-strong: #CDD1CA;
  --navy: #13294B;
  --navy-ink: #FFFFFF;
  --gold: #A87A22;
  --gold-soft: #F5ECD9;
  --green: #1C774A;
  --green-soft: #E2F0E7;
  --red: #B03F2D;
  --focus: #2F6FDB;
  --shadow: 0 1px 2px rgba(15, 27, 42, .06), 0 2px 8px rgba(15, 27, 42, .04);

  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 6px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1017;
    --surface: #111822;
    --surface-2: #17202B;
    --ink: #E7EBF0;
    --ink-2: #A8B2BF;
    --ink-3: #788393;
    --rule: #1F2935;
    --rule-strong: #2D3947;
    --navy: #D6A84A;
    --navy-ink: #111822;
    --gold: #D6A84A;
    --gold-soft: #2A2415;
    --green: #45B57F;
    --green-soft: #12291E;
    --red: #E07662;
    --focus: #79A6F2;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0B1017;
  --surface: #111822;
  --surface-2: #17202B;
  --ink: #E7EBF0;
  --ink-2: #A8B2BF;
  --ink-3: #788393;
  --rule: #1F2935;
  --rule-strong: #2D3947;
  --navy: #D6A84A;
  --navy-ink: #111822;
  --gold: #D6A84A;
  --gold-soft: #2A2415;
  --green: #45B57F;
  --green-soft: #12291E;
  --red: #E07662;
  --focus: #79A6F2;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-ui);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex; align-items: center; gap: 28px;
  height: 60px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  flex: none;
}

.brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }

.brand-word {
  font-weight: 800;
  font-variation-settings: "wdth" 80;
  font-size: 19px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-word small {
  display: block;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 3px;
  font-variation-settings: "wdth" 100;
}

.main-nav { display: flex; gap: 4px; }

.main-nav a {
  text-decoration: none;
  font-weight: 550;
  font-size: 14px;
  color: var(--ink-2);
  padding: 8px 10px;
  border-radius: var(--radius);
}

.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search {
  display: flex; align-items: center; gap: 8px;
  width: 260px; height: 36px; padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-3);
}

.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: 0;
  font: inherit; font-size: 14px; color: var(--ink);
}

.search kbd {
  font: 500 11px var(--font-num);
  border: 1px solid var(--rule-strong); border-radius: 4px;
  padding: 1px 5px; color: var(--ink-3);
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; cursor: pointer; color: var(--ink-2);
}

.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
}

.btn-primary { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }

.menu-btn { display: none; }

/* ---------- Meeting header ---------- */

.meeting {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.meeting .wrap { padding-top: 28px; padding-bottom: 0; }

.eyebrow {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}

.meeting h1 {
  margin: 0;
  font-weight: 750;
  font-variation-settings: "wdth" 78;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.meeting-facts {
  display: flex; flex-wrap: wrap; gap: 0;
  margin: 18px 0 22px;
  padding: 0; list-style: none;
}

.meeting-facts li {
  padding: 0 22px 0 0; margin: 0 22px 8px 0;
  border-right: 1px solid var(--rule);
}

.meeting-facts li:last-child { border-right: 0; }

.meeting-facts .k {
  display: block; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}

.meeting-facts .v { font-size: 20px; font-weight: 500; }

/* ---------- Race rail ---------- */

.race-rail {
  display: flex; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter);
}

.race-rail::-webkit-scrollbar { display: none; }

.race-tab {
  flex: none;
  display: grid; gap: 1px;
  min-width: 84px;
  padding: 10px 12px 12px;
  border: 0; background: transparent; cursor: pointer;
  text-align: left;
  border-bottom: 3px solid transparent;
  color: var(--ink-2);
}

.race-tab:hover { color: var(--ink); background: var(--surface-2); }

.race-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--navy); }

.race-tab .rn { font-weight: 750; font-size: 15px; font-variation-settings: "wdth" 85; }
.race-tab .rt { font: 500 12px var(--font-num); color: var(--ink-3); }
.race-tab .rf { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding-top: 24px; padding-bottom: 56px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Race card ---------- */

.race-head { padding: 20px 20px 16px; border-bottom: 1px solid var(--rule); }

.race-title {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px;
  margin: 0;
  font-weight: 750; font-variation-settings: "wdth" 80;
  font-size: 26px; line-height: 1.1;
}

.race-title .feature { color: var(--gold); font-size: 18px; font-weight: 650; }

.race-meta {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  margin: 10px 0 0; padding: 0; list-style: none;
  color: var(--ink-2); font-size: 14px;
}

.race-meta li { display: flex; align-items: center; gap: 6px; }
.race-meta .icon { width: 15px; height: 15px; color: var(--ink-3); }

.race-conditions {
  margin: 12px 0 0;
  font: 500 12.5px/1.45 var(--font-num);
  color: var(--ink-2);
  text-transform: uppercase;
}

.wagers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.wager {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-2);
}

/* Runner table — CSS grid rows so it reflows on phones */

.runners { list-style: none; margin: 0; padding: 0; }

.runner, .runners-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 2.3fr) 64px minmax(0, 1.5fr) 48px 52px 132px;
  column-gap: 14px;
  align-items: center;
  padding: 12px 20px;
}

.runners-head {
  padding-top: 10px; padding-bottom: 10px;
  font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}

.runners-head .r { text-align: right; }

.runner { border-bottom: 1px solid var(--rule); position: relative; }
.runner:last-child { border-bottom: 0; }
.runner.is-pick { background: linear-gradient(90deg, var(--gold-soft), transparent 60%); }
.runner.is-pick::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold);
}

/* Saddlecloth — standard racing colours by post */
.cloth {
  width: 34px; height: 38px;
  display: grid; place-items: center;
  border-radius: 4px;
  font: 700 17px var(--font-num);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}

.cloth[data-n="1"] { background: #D2232A; color: #fff; }
.cloth[data-n="2"] { background: #FFFFFF; color: #111; }
.cloth[data-n="3"] { background: #1F4FA8; color: #fff; }
.cloth[data-n="4"] { background: #F5D32B; color: #111; }
.cloth[data-n="5"] { background: #138A43; color: #fff; }
.cloth[data-n="6"] { background: #111111; color: #F5D32B; }
.cloth[data-n="7"] { background: #F07E1E; color: #111; }
.cloth[data-n="8"] { background: #F39CC0; color: #111; }
.cloth[data-n="9"] { background: #3FC1C9; color: #111; }
.cloth[data-n="10"] { background: #6B2D8F; color: #fff; }
.cloth[data-n="11"] { background: #8D8F93; color: #C1121F; }
.cloth[data-n="12"] { background: #A6D13A; color: #111; }
.cloth[data-n="13"] { background: #6B4226; color: #fff; }
.cloth[data-n="14"] { background: #7A1F2B; color: #F5D32B; }

.horse-name {
  margin: 0;
  font-weight: 700; font-variation-settings: "wdth" 84;
  font-size: 16.5px; line-height: 1.2; letter-spacing: .01em;
}

.horse-name a { text-decoration: none; }
.horse-name a:hover { text-decoration: underline; text-underline-offset: 3px; }

.pick-badge {
  display: inline-block; vertical-align: 2px;
  margin-left: 8px;
  font: 700 10px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid currentColor; border-radius: 3px;
  padding: 3px 5px;
}

.pick-badge.lbl-contender { color: var(--green); }
.pick-badge.lbl-longshot { color: var(--ink-3); }

.horse-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.horse-sub .num { font-size: 12px; }

.qg {
  margin: 5px 0 0; font-size: 13px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.form { font: 600 15px var(--font-num); letter-spacing: .08em; }
.form .f1 { color: var(--green); }
.form .f23 { color: var(--ink); }
.form .fx { color: var(--ink-3); font-weight: 500; }
.form .none { color: var(--ink-3); font: 500 12px var(--font-ui); letter-spacing: 0; }

.connections { font-size: 14px; line-height: 1.35; }
.connections .j { font-weight: 600; }
.connections .t { color: var(--ink-3); font-size: 13px; }

.wt, .ml { text-align: right; font-size: 14px; }
.ml { font-weight: 600; }

.cri { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 8px; }
.cri-bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.cri-bar span { display: block; height: 100%; background: var(--ink-3); border-radius: 3px; }
.is-pick .cri-bar span { background: var(--gold); }
.cri-val { text-align: right; font-size: 14px; font-weight: 600; }
.cri-na { color: var(--ink-3); font-size: 13px; text-align: right; }

.label-sm { display: none; }

.card-note {
  padding: 12px 20px; font-size: 12.5px; color: var(--ink-3);
  border-top: 1px solid var(--rule); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Sidebar ---------- */

.side { display: grid; gap: 16px; align-content: start; }

.side h2 {
  margin: 0; padding: 14px 16px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
}

.side h2 small { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 12px; }

.list { list-style: none; margin: 0; padding: 4px 0; }

.list li { display: flex; align-items: center; gap: 12px; padding: 9px 16px; }
.list li + li { border-top: 1px solid var(--rule); }

.list .race-no {
  flex: none; width: 30px;
  font: 600 12px var(--font-num); color: var(--ink-3);
}

.list .who { flex: 1; min-width: 0; }
.list .who b { display: block; font-weight: 650; font-size: 14px; font-variation-settings: "wdth" 88; }
.list .who span { display: block; font-size: 12.5px; color: var(--ink-3); }
.list .stat { font: 600 14px var(--font-num); }

.list button.row-link {
  all: unset; display: contents; cursor: pointer;
}

.list li.clickable { cursor: pointer; }
.list li.clickable:hover { background: var(--surface-2); }

/* ---------- Home balance: race + meeting tables left, record + picks right ---------- */

.main-col { display: grid; gap: 20px; align-content: start; min-width: 0; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .duo { grid-template-columns: minmax(0, 1fr); padding: 0 var(--gutter); } .duo .panel { border-radius: var(--radius); border: 1px solid var(--rule); } }
@media (min-width: 1101px) {
  .layout > .side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; scrollbar-width: thin; }
}
.meet-table { box-shadow: inset 0 3px 0 var(--navy), var(--shadow); }
.meet-table > h2 { padding-top: 16px; }
.mt-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; letter-spacing: .06em; }
.mt-title .icon { width: 17px; height: 17px; color: var(--gold); }
.meet-table > h2 small { font-weight: 600; color: var(--ink-3); }
.list.compact li { padding: 7px 16px; }
.list.compact .who b { font-size: 13.5px; }
.list.compact .pos { min-width: 24px; height: 24px; font-size: 12.5px; }
.list li.extra { display: none; }
.list.show-all li.extra { display: flex; }
.list-more {
  display: block; width: 100%; padding: 10px 16px; border: 0; border-top: 1px solid var(--rule);
  background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 650; cursor: pointer; text-align: left;
  border-radius: 0 0 var(--radius) var(--radius);
}
.list-more:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- CRI record panel ---------- */

.record { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold), var(--shadow); }
.rec-lead { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.rec-v { font-size: 38px; font-weight: 750; font-variation-settings: "wdth" 82; color: var(--gold); line-height: 1; }
.rec-k { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.rec-k .muted { font-weight: 500; font-size: 12.5px; }
.rec-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 16px 10px; }
.rec-pair div { padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); }
.rec-v2 { display: block; font-size: 20px; font-weight: 700; }
.rec-k2 { font-size: 12px; color: var(--ink-3); }
.rec-ranks { list-style: none; margin: 0; padding: 4px 16px 6px; display: grid; gap: 6px; }
.rec-ranks li { display: grid; grid-template-columns: 92px 1fr 32px; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.rec-ranks .bar { width: auto; }
.rec-ranks .bar span { background: var(--gold); }
.rec-ranks li.out .bar span { background: var(--ink-3); }
.rec-ranks b { text-align: right; font-size: 13px; }
.rec-foot { margin: 0; padding: 8px 16px 12px; font-size: 13px; }
.rec-foot a { color: var(--ink); }
.race-meta .cri-hit { color: var(--green); font-weight: 650; }
.race-meta .cri-hit .icon { color: var(--green); }
.race-meta .cri-miss { color: var(--ink-3); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between;
  padding-top: 24px; padding-bottom: 28px;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { text-decoration: none; color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }

.loading { padding: 40px 20px; color: var(--ink-3); }

.muted { color: var(--ink-3); }

.empty {
  display: grid; gap: 4px;
  padding: 36px 20px; color: var(--ink-3); text-align: center;
}
.empty b { color: var(--ink); font-weight: 650; }

/* ---------- Results ---------- */

.lead { display: flex; align-items: center; gap: 6px; }

.pos {
  display: inline-grid; place-items: center;
  min-width: 28px; height: 28px; padding: 0 4px;
  border-radius: 4px;
  font: 700 14px var(--font-num);
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--rule);
}
.pos-1 { color: var(--gold); background: var(--gold-soft); border-color: var(--gold); }
.pos-2, .pos-3 { color: var(--ink); }
.pos-x { color: var(--ink-3); font-size: 11px; font-weight: 600; }

.runner.is-result, .runners-head.is-result {
  grid-template-columns: 76px minmax(0, 2.3fr) 64px minmax(0, 1.5fr) 48px 52px 132px;
}

.race-tab .rf-done { color: var(--green); }

.list .stat small { color: var(--ink-3); font-weight: 500; }
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.connections a, .horse-name a, .data-table a { text-decoration: none; }
.connections a:hover, .data-table a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Search ---------- */

.search-wrap { position: relative; }

.search-results {
  position: absolute; z-index: 30; top: 42px; right: 0;
  width: min(380px, calc(100vw - 32px));
  margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(15, 27, 42, .16);
  max-height: 70vh; overflow-y: auto;
}

.search-results a {
  display: grid; grid-template-columns: 58px 1fr; column-gap: 10px;
  padding: 8px 12px; text-decoration: none;
}
.search-results li.active a, .search-results a:hover { background: var(--surface-2); }
.search-results .sr-type {
  grid-row: span 2; align-self: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.search-results b { font-weight: 650; font-size: 14px; }
.search-results .sr-meta { font: 500 12px var(--font-num); color: var(--ink-3); }
.search-results .sr-empty { padding: 12px; color: var(--ink-3); font-size: 14px; }

#search-btn { display: none; }

/* ---------- Page header + stat tiles ---------- */

.page-head { background: var(--surface); border-bottom: 1px solid var(--rule); }
.page-head .wrap { padding-top: 28px; padding-bottom: 24px; }
.page-head h1 {
  margin: 0; font-weight: 750; font-variation-settings: "wdth" 78;
  font-size: clamp(28px, 4.6vw, 42px); line-height: 1.05;
}
.page-head .sub { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; }
.page-head .sub a { color: var(--ink); }

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0; margin-top: 22px;
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.tile { padding: 12px 16px; background: var(--surface); border-right: 1px solid var(--rule); }
.tile:last-child { border-right: 0; }
.tile .k { display: block; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.tile .v { display: block; margin-top: 2px; font: 600 22px var(--font-num); }
.tile .v.gold { color: var(--gold); }

.stack { display: grid; gap: 20px; padding-top: 24px; padding-bottom: 56px; }

.panel > h2, .section-title {
  margin: 0; padding: 14px 20px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.panel > h2 small { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 12px; }
.panel > p.lede { margin: 0; padding: 12px 20px 0; color: var(--ink-2); font-size: 14px; }

/* ---------- Data tables ---------- */

.table-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; white-space: nowrap;
  padding: 10px 12px; background: var(--surface-2);
  font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table .r { text-align: right; }
.data-table .num { white-space: nowrap; }
.data-table .name { font-weight: 650; font-variation-settings: "wdth" 88; }
.data-table button.sort { all: unset; cursor: pointer; }
.data-table button.sort[aria-pressed="true"] { color: var(--ink); }

.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar { width: 80px; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ink-3); }
.bar.gold span { background: var(--gold); }
.bar.green span { background: var(--green); }

.chip {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; border: 1px solid var(--rule-strong); color: var(--ink-2);
  white-space: nowrap;
}
.chip.gold { color: var(--gold); border-color: var(--gold); }
.chip.green { color: var(--green); border-color: var(--green); }
.chip.red { color: var(--red); border-color: var(--red); }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }

/* ---------- Tabs + toolbar ---------- */

.tabs { display: flex; gap: 2px; margin-top: 18px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 10px 14px; font-weight: 650; font-size: 14px; color: var(--ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--navy); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.toolbar .search { width: 280px; display: flex; }
.toolbar select, .field input {
  height: 36px; padding: 0 10px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--rule-strong); border-radius: var(--radius);
}
.toolbar label { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }

/* ---------- Forms ---------- */

.form-card { max-width: 440px; margin: 32px auto 64px; }
.form-card .body { padding: 20px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input { height: 42px; font-size: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notice { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; border: 1px solid var(--rule-strong); }
.notice.ok { border-color: var(--green); background: var(--green-soft); }
.notice.err { border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; justify-content: center; height: 42px; }
.link-btn { all: unset; cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }

/* ---------- Text pages ---------- */

.prose { max-width: 760px; padding: 8px 24px 28px; font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.prose h2 {
  margin: 28px 0 8px; font-size: 20px; font-weight: 700; font-variation-settings: "wdth" 85;
  color: var(--ink); letter-spacing: 0; text-transform: none; padding: 0; border: 0; display: block;
}
.prose h3 { margin: 18px 0 4px; font-size: 16px; color: var(--ink); }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose a { color: var(--ink); }
.prose strong { color: var(--ink); }
.prose .updated { font-size: 13px; color: var(--ink-3); }
.callout { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 12px 16px; margin: 16px 0; color: var(--ink); border-radius: 0 var(--radius) var(--radius) 0; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 20px; }
.video { display: grid; gap: 8px; }
.video .frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe, .video .frame button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .frame button { cursor: pointer; padding: 0; background: #000 center / cover no-repeat; }
.video .frame button::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 64px; height: 44px; margin: -22px 0 0 -32px;
  border-radius: 10px; background: rgba(0, 0, 0, .75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 26px no-repeat;
}
.video h3 { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.35; }
.video p { margin: 0; font-size: 13px; color: var(--ink-3); }

.h2h-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; padding: 20px; }
.h2h-pick .vs { font-weight: 800; color: var(--ink-3); padding-bottom: 10px; }
.h2h-pick .search-wrap .search { width: 100%; display: flex; }
.h2h-pick .search-results { left: 0; right: auto; width: 100%; }
@media (max-width: 760px) { .h2h-pick { grid-template-columns: 1fr; } .h2h-pick .vs { padding: 0; } }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .search { width: 200px; }
}

@media (max-width: 900px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: grid; position: absolute; top: 60px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 14px;
  }
  .menu-btn { display: inline-grid; }
  .header-tools .search, .header-tools > .btn { display: none; }
  #search-btn { display: inline-grid; }
  body.search-open .header-tools .search-wrap {
    position: absolute; top: 60px; left: 0; right: 0; padding: 10px var(--gutter);
    background: var(--surface); border-bottom: 1px solid var(--rule);
  }
  body.search-open .header-tools .search { display: flex; width: 100%; }
  body.search-open .search-results { top: 56px; left: var(--gutter); right: var(--gutter); width: auto; }
  .main-nav.open .nav-only-mobile { display: block; }
}

.main-nav .nav-only-mobile { display: none; }

#race { align-self: start; }

@media (max-width: 760px) {
  .runners-head { display: none; }

  .runner {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas:
      "cloth horse ml"
      "cloth conn cri"
      ".     form form";
    column-gap: 12px; row-gap: 6px;
    padding: 14px var(--gutter);
    align-items: start;
  }

  .runner .lead { grid-area: cloth; flex-direction: column; align-items: center; gap: 4px; }
  .runner .cloth { width: 32px; height: 36px; font-size: 16px; }
  .runner.is-result { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { border-bottom: 1px solid var(--rule); }
  .tile:nth-child(2n) { border-right: 0; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar .search { width: 100%; }
  .data-table th:first-child, .data-table td:first-child { padding-left: var(--gutter); }
  .runner .horse { grid-area: horse; }
  .runner .connections { grid-area: conn; font-size: 13.5px; }
  .runner .form { grid-area: form; font-size: 13px; }
  .runner .wt { display: none; }
  .runner .ml { grid-area: ml; }
  .runner .cri { grid-area: cri; display: flex; justify-content: flex-end; align-items: baseline; gap: 0; }
  .runner .cri-bar { display: none; }
  .runner.is-pick .cri-val { color: var(--gold); }
  .qg { white-space: normal; }
  .label-sm {
    display: inline; font: 600 10.5px var(--font-ui); letter-spacing: .06em;
    text-transform: uppercase; color: var(--ink-3); margin-right: 6px;
  }
  .race-head { padding: 16px var(--gutter) 14px; }
  .race-title { font-size: 23px; }
  .card-note { padding: 12px var(--gutter); }
  .meeting-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .meeting-facts li { padding: 0; margin: 0; border: 0; }
  .meeting-facts li:last-child { grid-column: 1 / -1; }
  .meeting-facts .v { font-size: 17px; }
  .site-header .wrap { gap: 12px; }
  .brand-word small { display: none; }
  .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .layout { padding-left: 0; padding-right: 0; gap: 16px; }
  .side { padding: 0 var(--gutter); }
  .side .panel { border-radius: var(--radius); border: 1px solid var(--rule); }
}
