/* 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;
  --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; }
.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;
}
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%; }
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 td.date { color: var(--muted); white-space: nowrap; }

/* Embed: no header, tight margins */
body.embed main { padding: 8px; }
body.embed #status { display: none; }
.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; }
