/* Public results site. Always dark: the local board's palette (app.py
   DISPLAY_HTML / CLASSES_HTML / SESSION_SUMMARY_HTML). */
:root {
  --bg: #0b0f14;
  --panel: #121924;
  --panel-2: #131a22;
  --text: #f4f6f8;
  --accent: #9fd3ff;
  --muted: #7f93a8;
  --dim: #51637a;
  --faint: #3c4a58;
  --line: #243140;
  --line-2: #1b2530;
  --tr: #ef4444;
  --tr-dark: #7f1010;
  --sb: #7dd3fc;
  --sb-dark: #0c4a6e;
  --pb: #4ade80;
  --up: #16a34a;
  --down: #ef4444;
  --star: #facc15;
  --warn: #f0a94e;
  --active: #1d2a38;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.4;
}
a { color: var(--accent); }
main { padding: 12px 16px 8px; max-width: 1100px; margin: 0 auto; }
.num, .t, .time, .stat-num, .numcol, .b-value { font-variant-numeric: tabular-nums; }
.empty { color: var(--faint); }
.anon { color: var(--muted); font-style: italic; }
.empty-state { color: var(--muted); font-size: 14px; padding: 14px 0; margin: 0; }
.notice { padding: 28px 0; font-size: 17px; }
.notice a { display: inline-flex; align-items: center; min-height: 44px; }
#status { color: var(--dim); font-size: 13px; padding: 0 16px 24px; max-width: 1100px; margin: 0 auto; min-height: 1em; }
.page-title { font-size: 22px; font-weight: 600; color: var(--accent); margin: 6px 0 10px; }
h2 { font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }

/* Header and nav */
header.site { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
header.site .brand {
  display: block; padding: 10px 16px 0; font-size: 20px; font-weight: 600; color: var(--accent);
  text-decoration: none; max-width: 1100px; margin: 0 auto;
}
header.site nav {
  display: flex; gap: 2px; overflow-x: auto; padding: 0 10px; max-width: 1100px; margin: 0 auto;
  scrollbar-width: none;
}
header.site nav::-webkit-scrollbar { display: none; }
header.site nav a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  color: var(--muted); text-decoration: none; font-size: 15px; border-bottom: 2px solid transparent; white-space: nowrap;
}
header.site nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Buttons, segmented controls */
button { font: inherit; color: inherit; }
.class-filter, .seg, .tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.class-filter button, .seg button, .tabs button, .more {
  min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 6px; cursor: pointer;
  color: var(--accent); background: transparent; border: 2px solid var(--line); font-size: 15px;
}
.class-filter button.on, .seg button.on, .tabs button[aria-selected="true"] {
  background: var(--active); box-shadow: inset 0 0 0 1px currentColor;
}
.tabs { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
/* Class filter: one line on a phone. Buttons share the width equally;
   height stays 44px for tapping. Scrolls sideways only if a club has
   too many classes to fit. */
.class-filter { flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.class-filter::-webkit-scrollbar { display: none; }
.class-filter button { flex: 1 1 0; min-width: 40px; max-width: 88px; padding: 0 4px; font-size: 14px; white-space: nowrap; }
/* Many classes (a meet): each button as wide as its label; on a wide screen they wrap. */
.class-filter.many button { flex: 0 0 auto; max-width: none; padding: 0 8px; }
@media (min-width: 640px) { .class-filter.many { flex-wrap: wrap; } }
.more { display: block; margin: 8px 0; }

/* Class chip */
.cls {
  display: inline-block; min-width: 44px; text-align: center; color: var(--accent); background: transparent;
  border: 2px solid var(--line); border-radius: 5px; padding: 0 6px; line-height: 1.35; font-size: 15px; white-space: nowrap;
}
button.cls { min-height: 36px; cursor: pointer; }
.cls.none { color: var(--dim); border-style: dashed; }

/* Board */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table.board { font-size: 20px; }
table.board th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; padding: 10px 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.board td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sort-active { color: var(--accent); }
th.sort-active::after { content: " \25be"; font-size: 11px; }
td.numcol { color: var(--muted); font-size: 16px; width: 1%; white-space: nowrap; padding-right: 4px; }
/* Run time (gate drop): sized to its content, 4px from the run number; under it on a phone */
table.board th.timecol { width: 1%; padding-left: 0; }
table.board:not(.narrow) th:first-child { padding-right: 4px; }
td.timecol { width: 1%; white-space: nowrap; padding-left: 0; color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
td.numcol .at { display: block; font-size: 11px; color: var(--muted); }
/* Key line (sec 7.2): right of the class filter; its own line above the chips on a phone */
.filter-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.filter-row .class-filter { flex: 1 1 auto; min-width: 0; }
.key { font-size: 12px; color: var(--muted); white-space: nowrap; margin: 4px 0 10px auto; }
.key .k-sb { color: var(--sb); }
.key .k-pb { color: var(--pb); }
.key .k-tr { color: var(--tr); }
tr.banner td.b-label .b-date { text-transform: none; letter-spacing: 0; font-size: 11px; }
td.club { color: var(--accent); font-size: 15px; }
td.rider { overflow-wrap: break-word; }
tr.banner td { padding: 3px 10px; font-size: 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
tr.banner.sb td { border-bottom: 2px solid var(--line); padding-bottom: 6px; }
tr.banner td.b-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
tr.banner.tr td.b-value { color: var(--tr); font-weight: 700; }
tr.banner.sb td.b-value { color: var(--sb); font-weight: 700; }
tr.banner .holder { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 6px; }
td.c-tr { color: var(--tr); font-weight: 700; }
td.c-sb { color: var(--sb); font-weight: 700; }
td.c-pb { color: var(--pb); }
@media (prefers-reduced-motion: no-preference) {
  table.board td.c-tr { animation: trPulse 1s ease-in-out infinite; }
  table.board td.c-sb { animation: sbPulse 1s ease-in-out infinite; }
}
@keyframes trPulse { 0%, 100% { color: var(--tr); } 50% { color: var(--tr-dark); } }
@keyframes sbPulse { 0%, 100% { color: var(--sb); } 50% { color: var(--sb-dark); } }
table.board.narrow { font-size: 18px; }
table.board.narrow td, table.board.narrow th { padding-left: 6px; padding-right: 6px; }

/* By class */
.crow { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .crow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cpanel { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.chead { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; border-bottom: 1px solid var(--line); }
.chead .name { font-size: 17px; font-weight: 700; }
.chead .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.cbest { display: flex; gap: 12px; padding: 4px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cbest b { color: var(--sb); }
.cpanel table { font-size: 16px; }
.cpanel th { text-align: left; color: var(--dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; }
.cpanel td { padding: 4px 8px; border-top: 1px solid var(--line-2); white-space: nowrap; }
.cpanel td.r { overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 100%; }
.cpanel td.t, .cpanel th.t { text-align: right; width: 80px; }
.cpanel .more { margin: 6px 10px 10px; }

/* Summary */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; }
.stat-num { font-size: 28px; font-weight: 650; line-height: 1.1; }
.stat-label { margin-top: 6px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.class-rows { display: flex; flex-direction: column; gap: 8px; }
.class-row { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 14px; display: grid; grid-template-columns: 170px 1fr; gap: 14px; }
.class-row h3 { margin: 0; font-size: 15px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.class-row h3 .meta { color: var(--muted); font-size: 12px; font-weight: 400; }
.tops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tops h4 { margin: 2px 0 3px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tops ol { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.tops li { display: flex; gap: 5px; line-height: 1.6; }
.tops li .p { color: var(--dim); width: 12px; flex: none; }
.tops li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tops li .v { font-variant-numeric: tabular-nums; }
.tops li.none { color: var(--dim); }
@media (max-width: 760px) {
  .class-row { grid-template-columns: 1fr; }
  .tops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
table.riders, table.lb { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; font-size: 15px; }
table.riders th, table.lb th {
  text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-2);
}
table.riders td, table.lb td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
table.riders .num, table.lb .num { text-align: right; }
.footnote { font-size: 12px; color: var(--dim); }
@media (max-width: 639.98px) {
  table.riders th, table.lb th, table.riders td, table.lb td { padding: 8px 6px; }
  table.riders, table.lb { font-size: 14px; }
}

/* Sessions */
ul.dates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
ul.dates a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none; background: var(--panel);
}

/* Leaderboard */
.selectors { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.sel { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.sel select {
  min-height: 44px; min-width: 130px; font: inherit; font-size: 15px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
}
.caption { color: var(--muted); font-size: 13px; margin: 6px 0; }
table.lb td.time { font-weight: 600; }
table.lb th.mv, table.lb td.mv { width: 26px; padding-left: 8px; padding-right: 0; text-align: center; }
.mv-arrow { width: 17px; height: 17px; vertical-align: middle; }
.mv-arrow.up polygon { fill: var(--up); }
.mv-arrow.down polygon { fill: var(--down); }
.mv-arrow text { font-size: 12px; font-weight: 800; fill: #fff; }
.mv-arrow text.sm { font-size: 9px; }
.mv-new { color: var(--star); font-size: 14px; line-height: 1; vertical-align: middle; }
.mv-key .k-up { color: var(--up); }
.mv-key .k-down { color: var(--down); }
.mv-key .k-new { color: var(--star); }
.mv-key { margin: 4px 0 8px; white-space: normal; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.lb td.date { color: var(--muted); white-space: nowrap; }

/* Embed: no header, tight margins */
body.embed main { padding: 8px; }
body.embed #status { display: none; }
.embed-back { margin: 0 0 4px; font-size: 14px; }
.embed-back a { display: inline-flex; align-items: center; min-height: 44px; }
.embed-title { font-size: 18px; color: var(--accent); margin: 0 0 6px; }
.embed-foot { font-size: 13px; margin: 8px 0 0; }
.embed-foot a { display: inline-flex; align-items: center; min-height: 44px; }

/* Reviewer page (2.3.0): one column, phone first. */
.rv-pick { margin: 4px 0 8px; max-width: 260px; }
.rv-pick select { min-height: 44px; }
.rv-message { background: var(--panel); border: 1px solid var(--warn); border-radius: 8px; padding: 10px 12px; margin: 8px 0; color: var(--warn); }
.rv-run { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; margin: 10px 0; }
.rv-run h3 { margin: 0; padding: 10px 12px 8px; font-size: 17px; border-bottom: 1px solid var(--line-2); }
.rv-run .rv-n { color: var(--muted); font-weight: 500; }
.rv-run .rv-meta { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 4px; }
ul.rv-splits { list-style: none; margin: 0; padding: 0; }
.rv-split { padding: 6px 12px; border-top: 1px solid var(--line-2); }
.rv-split:first-child { border-top: 0; }
.rv-main { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.rv-point { flex: 1 1 auto; color: var(--muted); font-size: 14px; }
.rv-time { font-size: 20px; font-weight: 600; min-width: 84px; text-align: right; }
.rv-split.flagged .rv-time { color: var(--muted); text-decoration: line-through; }
.rv-act { flex: none; width: 96px; text-align: right; }
.rv-btn {
  min-height: 44px; min-width: 84px; padding: 0 12px; border-radius: 6px; cursor: pointer;
  color: var(--accent); background: transparent; border: 2px solid var(--line); font-size: 15px;
}
.rv-btn.primary { background: var(--active); border-color: var(--accent); }
.rv-flag { color: var(--tr); font-size: 14px; padding-bottom: 4px; }
.rv-note { color: var(--muted); }
.rv-req { font-size: 14px; padding-bottom: 6px; }
.rv-req.pending { color: var(--warn); }
.rv-req.applied { color: var(--pb); }
.rv-req.rejected { color: var(--muted); }
.rv-wait { color: var(--muted); }
.rv-stale { display: block; color: var(--tr); }
dialog.rv-dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  width: min(440px, calc(100vw - 24px)); padding: 16px; margin: auto auto 12px;
}
dialog.rv-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.rv-sheet h2 { margin: 0 0 6px; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); }
.rv-sheet .rv-what { margin: 0 0 10px; color: var(--muted); }
.rv-sheet fieldset { border: 0; margin: 0 0 8px; padding: 0; }
.rv-sheet legend { font-size: 12px; color: var(--muted); padding: 0; }
.rv-reason { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.rv-reason input { width: 20px; height: 20px; flex: none; }
.rv-notefield { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.rv-notefield input {
  min-height: 44px; padding: 0 10px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.rv-buttons { display: flex; gap: 8px; justify-content: flex-end; }
