:root {
  --base: #0c0a09;
  --base-2: #120f0c;
  --surface: #17130f;
  --surface-2: #1f1a15;
  --surface-3: #2c251d;
  --red: #4a0e14;
  --red-bright: #8c1d26;
  --red-deep: #2a070b;
  --accent: #d9a734;
  --accent-soft: #e8c674;
  --gold: #f2cf5b;
  --silver: #c9d1e3;
  --bronze: #d9925b;
  --ink: #f4efe6;
  --muted: rgba(244,239,230,.68);
  --faint: rgba(244,239,230,.44);
  --rule: rgba(244,239,230,.12);
  --up: #5ee0a0;
  --down: #ff6b6b;
  /* Accent used as text or ink: the gold itself in the dark theme, a deeper gold in the light one. */
  --accent-ink: var(--accent);
  --accent-ink-soft: var(--accent-soft);
  --red-ink: #ff8a8e;
  --glass: rgba(12,10,9,.96);
  --scrim: rgba(6,5,4,.78);
  --shadow: rgba(0,0,0,.5);
  --row-alt: rgba(255,255,255,.012);
  --row-hover: rgba(217,167,52,.05);
  --row-me: rgba(217,167,52,.12);
  --rule-accent: rgba(217,167,52,.55);
  --swatch-edge: rgba(255,255,255,.18);
  --track: rgba(255,255,255,.14);
  --track-soon: rgba(244,239,230,.3);
  --plate: rgba(12,10,9,.62);
  --hero-grad: radial-gradient(120% 120% at 85% 0%, #8c1d26 0%, #4a0e14 34%, #2a070b 62%, #0c0a09 100%);
  --hero-stripe: rgba(255,255,255,.025);
  --hero-sub-ink: rgba(244,239,230,.85);
  --shade-grad: linear-gradient(90deg, var(--base-2) 35%, rgba(18,15,12,.55) 70%, rgba(18,15,12,.25) 100%);
  --panel-head-grad: linear-gradient(90deg, var(--red) 0%, var(--surface-2) 100%);
  --heat: 140,29,38;
  --chart-1: #d9a734;
  --chart-2: #5aa9ff;
  --chart-3: #5ee0a0;
  --chart-4: #ff8a5b;
  --chart-5: #d17bff;
  --chart-6: #f4efe6;
  --chart-7: #ff6b6b;
  --chart-8: #8fd3c7;
  --display: 'Anton', Impact, 'Arial Narrow Bold', sans-serif;
  --body: 'Work Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1320px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--base); color: var(--ink); scroll-padding-top: 90px; }
body { font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; background: var(--base); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, td, .tnum { font-variant-numeric: tabular-nums; }
main { flex: 1; outline: none; }
.loading { padding: 120px var(--gutter); text-align: center; font-family: var(--display); text-transform: uppercase; font-size: 28px; color: var(--faint); letter-spacing: .02em; }

/* ---------- header ---------- */
header.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: clamp(10px, 2vw, 28px); padding: 10px var(--gutter); background: var(--glass); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 0 0 auto; }
.brand-logo { display: grid; place-items: center; background: #f4f1e6; border-radius: 8px; padding: 3px 7px; }
.brand-logo img { display: block; height: 30px; width: auto; }
@media (max-width: 420px) { .brand-logo img { height: 24px; } }
.brand-txt { display: flex; flex-direction: column; line-height: .95; }
.brand-txt b { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .03em; }
.brand-txt i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); }
.main-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 9px 12px; white-space: nowrap; color: var(--muted); position: relative; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--ink); }
.main-nav a[aria-current="page"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; background: var(--accent); transform: skewX(-20deg); }
.search-btn { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 10px; cursor: pointer; color: var(--muted); flex: 0 0 auto; }
.search-btn:hover { border-color: var(--accent); color: var(--ink); }
.search-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.search-btn kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--rule); border-radius: 3px; padding: 0 5px; }
@media (max-width: 900px) {
  header.top { flex-wrap: wrap; padding-bottom: 0; }
  .main-nav { order: 3; flex-basis: 100%; margin: 0 calc(var(--gutter) * -1); padding: 0 calc(var(--gutter) - 12px); }
  .search-btn { margin-left: auto; }
  .search-btn span, .search-btn kbd { display: none; }
}

/* ---------- ticker ---------- */
.ticker { display: flex; align-items: stretch; background: var(--red); border-bottom: 2px solid var(--accent); overflow: hidden; height: 34px; font-size: 13px; }
.ticker-tag { flex: 0 0 auto; background: var(--accent); color: #0c0a09; font-family: var(--display); text-transform: uppercase; letter-spacing: .05em; padding: 0 16px 0 var(--gutter); display: flex; align-items: center; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding-right: 24px; font-size: 15px; }
.ticker-track { flex: 1; overflow: hidden; position: relative; display: flex; align-items: center; }
.ticker-move { display: inline-flex; white-space: nowrap; animation: tick 70s linear infinite; padding-left: 16px; }
.ticker:hover .ticker-move { animation-play-state: paused; }
.ticker-move span { padding: 0 22px; position: relative; }
.ticker-move span::before { content: ''; position: absolute; left: -3px; top: 50%; width: 6px; height: 6px; background: var(--accent); transform: translateY(-50%) rotate(45deg); }
.ticker-move b { color: var(--accent-ink); font-weight: 700; }
.ticker-move a { text-decoration: none; }
.ticker-move a:hover { text-decoration: underline; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-move { animation: none; } * { transition: none !important; } }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.page { padding-block: clamp(24px, 4vw, 44px) 72px; }
.section { margin-top: clamp(28px, 4vw, 48px); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .g3, .g-main { grid-template-columns: minmax(0, 1fr); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2 { grid-template-columns: minmax(0, 1fr); } }

.kicker { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }
.h-display { font-family: var(--display); font-weight: 400; text-transform: uppercase; line-height: .95; letter-spacing: .005em; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(38px, 6.5vw, 76px); line-height: .92; margin-top: 6px; }
.page-head h1 em { font-style: normal; color: var(--accent-ink); }
.page-head p { color: var(--muted); max-width: 64ch; margin-top: 10px; }
.slab { display: inline-block; background: var(--accent); color: #0c0a09; font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .03em; padding: 3px 12px 2px; transform: skewX(-12deg); }
.slab > * , .slab span { display: inline-block; transform: skewX(12deg); }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-title h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(22px, 3vw, 30px); line-height: 1; display: flex; align-items: center; gap: 10px; }
.sec-title h2::before { content: ''; width: 6px; height: .9em; background: var(--accent); transform: skewX(-14deg); }
.sec-title a { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink-soft); text-decoration: none; white-space: nowrap; }
.sec-title a:hover { color: var(--accent-ink); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.panel-pad { padding: clamp(14px, 2.4vw, 22px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--panel-head-grad); border-bottom: 1px solid var(--rule); }
.panel-head h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 19px; letter-spacing: .01em; }
.panel-head a { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink-soft); text-decoration: none; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.note b { color: var(--ink); }
.dim { color: var(--faint); }
.gold { color: var(--accent-ink); }
.up { color: var(--up); }
.down { color: var(--down); }
.mono { font-family: var(--mono); }

/* ---------- controls ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 3px; gap: 2px; }
.seg a, .seg button { text-decoration: none; border: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 7px 14px; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg [aria-current="true"], .seg [aria-pressed="true"] { background: var(--accent); color: #0c0a09; }
select, input[type="search"], input[type="text"] { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; font-size: 14px; min-width: 0; }
select:hover, input:hover { border-color: rgba(217,167,52,.5); }
input[type="search"] { flex: 1 1 200px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #0c0a09; }
.chip small { font-weight: 500; opacity: .75; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #0c0a09; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.ghost:hover { border-color: var(--accent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-family: var(--mono); font-weight: 700; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 10px 10px; background: var(--base-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th[aria-sort="descending"]::after { content: ' ▼'; color: var(--accent-ink); }
th[aria-sort="ascending"]::after { content: ' ▲'; color: var(--accent-ink); }
td { padding: 8px 10px; border-top: 1px solid var(--rule); white-space: nowrap; }
.r { text-align: right; }
.c { text-align: center; }
tbody tr:nth-child(even) td { background: var(--row-alt); }
tbody tr:hover td { background: var(--row-hover); }
tr.me td { background: var(--row-me) !important; }
tr.cut td { border-top: 2px dashed var(--rule-accent); }
td.pts { font-family: var(--display); font-size: 18px; letter-spacing: .02em; }
td.tot { font-family: var(--display); font-size: 20px; color: var(--accent-ink); }
.rn { text-decoration: none; font-weight: 700; }
.rn:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.more-row td { text-align: center; padding: 12px; }
@media (max-width: 720px) { .hide-sm { display: none; } td, th { padding-left: 7px; padding-right: 7px; } }
@media (max-width: 1000px) { .hide-md { display: none; } }

.pos { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 5px; font-family: var(--display); font-size: 16px; background: var(--surface-3); border-radius: 4px; transform: skewX(-8deg); }
.pos > span { transform: skewX(8deg); }
.pos.p1 { background: var(--gold); color: #0c0a09; }
.pos.p2 { background: var(--silver); color: #0c0a09; }
.pos.p3 { background: var(--bronze); color: #0c0a09; }
.pos.eq::after { content: '='; font-size: 12px; margin-left: 1px; transform: skewX(8deg); }
.mv { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 11px; font-weight: 700; min-width: 34px; }
.mv.up::before { content: '▲'; font-size: 9px; }
.mv.down::before { content: '▼'; font-size: 9px; }
.mv.same::before { content: '●'; font-size: 7px; color: var(--faint); }
.mv.new { color: var(--accent-ink-soft); font-size: 9.5px; letter-spacing: .06em; }

.club { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 13px; color: var(--muted); max-width: 100%; }
.club:hover { color: var(--ink); }
.club i { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, var(--c1) 0 49%, var(--c2) 51% 100%); box-shadow: inset 0 0 0 1px var(--swatch-edge); }
.club.code span { font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; }
.cat { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); min-width: 26px; text-align: center; text-decoration: none; }
a.cat:hover { color: var(--accent-ink); }
.tag { display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: rgba(217,167,52,.14); color: var(--accent-ink-soft); white-space: nowrap; }
.tag.ok { background: rgba(94,224,160,.13); color: var(--up); }
.tag.red { background: rgba(255,90,95,.14); color: var(--red-ink); }
.tag.grey { background: var(--surface-3); color: var(--muted); }

.form { display: inline-flex; gap: 2px; }
.form i { width: 22px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-family: var(--mono); font-size: 9px; border-radius: 3px; background: var(--surface-3); color: var(--faint); }
.form i.best { background: rgba(217,167,52,.22); color: var(--accent-ink-soft); }
.form i.win { background: var(--accent); color: #0c0a09; font-weight: 700; }
.form i.none { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }

/* ---------- hero / home ---------- */
.hero { position: relative; overflow: hidden; background: var(--hero-grad); border-bottom: 1px solid var(--rule); }
.hero::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-62deg, transparent 0 60px, var(--hero-stripe) 60px 120px); pointer-events: none; }
.hero-inner { position: relative; padding-block: clamp(28px, 5vw, 56px); }
.hero h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(40px, 8vw, 104px); line-height: .9; margin: 12px 0 14px; }
.hero h1 em { font-style: normal; color: var(--accent-ink); }
.hero-sub { color: var(--hero-sub-ink); max-width: 60ch; font-size: clamp(15px, 1.8vw, 18px); }
.season-bar { margin-top: 22px; max-width: 720px; }
.season-bar .track { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.season-bar .track a { height: 10px; background: var(--track); transform: skewX(-20deg); display: block; }
.season-bar .track a.done { background: var(--accent); }
.season-bar .track a.wait { background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 6px); }
.season-bar .lbl { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); gap: 8px; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.stat-row > div { background: var(--surface); padding: 14px 16px; min-width: 0; }
.stat-row b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3.4vw, 40px); line-height: 1; }
.stat-row span { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-row small { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-row a { display: block; color: inherit; text-decoration: none; }
.stat-row a:hover b { color: var(--accent-ink); }

.matchday { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px; background: var(--rule); }
.winner { position: relative; padding: 18px; background: var(--surface); min-width: 0; text-decoration: none; display: block; overflow: hidden; }
.winner::after { content: ''; position: absolute; right: -30px; top: 0; bottom: 0; width: 120px; background: linear-gradient(135deg, var(--c1) 0 49%, var(--c2) 51% 100%); opacity: .35; transform: skewX(-18deg); }
.winner:hover { background: var(--surface-2); }
.winner .kicker { position: relative; z-index: 1; }
.winner h4 { position: relative; z-index: 1; font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(22px, 3vw, 32px); line-height: 1; margin: 8px 0 6px; }
.winner p { position: relative; z-index: 1; color: var(--muted); font-size: 13px; }
.winner .time { position: relative; z-index: 1; font-family: var(--display); font-size: 28px; color: var(--accent-ink); margin-top: 8px; display: block; }
@media (max-width: 520px) { .matchday { grid-template-columns: minmax(0, 1fr); } }

.mini-table td { padding: 7px 10px; white-space: normal; }
.mini-table td.r, .mini-table td.pts { white-space: nowrap; }
.mini-table td:first-child { width: 42px; }

.next-race { position: relative; background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 70%); border: 1px solid var(--rule); border-radius: 12px; padding: 18px; overflow: hidden; }
.next-race::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 180px; height: 180px; border: 22px solid rgba(217,167,52,.12); border-radius: 50%; }
.next-race h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(26px, 3.2vw, 36px); line-height: 1; margin: 8px 0; position: relative; z-index: 1; }
.count { display: flex; gap: 14px; margin-top: 12px; position: relative; z-index: 1; }
.count b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; color: var(--accent-ink); }
.count span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: block; }

.list-rows a, .list-rows > div { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--rule); text-decoration: none; min-width: 0; }
.list-rows a:first-child, .list-rows > div:first-child { border-top: 0; }
.list-rows a:hover { background: var(--row-hover); }
.list-rows .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .big { font-family: var(--display); font-size: 20px; }
.list-rows .sub { display: block; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }

/* ---------- profile ---------- */
.profile-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); background: var(--base-2); }
.profile-hero .swatch { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 0 52%, var(--c1) 52% 70%, var(--c2) 70% 100%); opacity: .5; }
.profile-hero .shade { position: absolute; inset: 0; background: var(--shade-grad); }
.profile-hero .wrap { position: relative; padding-block: clamp(22px, 4vw, 44px); }
.profile-hero h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(40px, 7.5vw, 92px); line-height: .9; margin: 10px 0 12px; overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--muted); }
.profile-logo { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); max-height: 110px; max-width: 30%; filter: drop-shadow(0 4px 18px rgba(0,0,0,.45)); }
.profile-logo.plate { background: #fff; border-radius: 10px; padding: 8px; max-height: 96px; }
@media (max-width: 720px) { .profile-logo { display: none; } }
.big-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.big-stats > div { background: var(--plate); border: 1px solid var(--rule); border-left: 4px solid var(--accent); padding: 10px 16px 10px 14px; min-width: 116px; }
.big-stats b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 46px); line-height: 1; }
.big-stats b sup { font-size: .45em; vertical-align: top; margin-left: 2px; color: var(--accent-ink); }
.big-stats span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.big-stats a { text-decoration: none; }

.chase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .chase-grid { grid-template-columns: minmax(0, 1fr); } }
.chase { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 16px; overflow: hidden; min-width: 0; }
.chase::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--accent)); }
.chase.threat { --accent: var(--down); --accent-ink: var(--down); }
.chase.safe { --accent: var(--up); --accent-ink: var(--up); }
.chase h4 { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
.chase .who { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 22px; line-height: 1.05; margin: 8px 0 2px; overflow-wrap: anywhere; }
.chase .who a { text-decoration: none; }
.chase .who a:hover { color: var(--accent-ink); }
.chase .gap { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 8px; }
.chase .gap b { font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1; }
.chase .gap span { font-size: 13px; color: var(--muted); }
.chase p { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.chase p + p { margin-top: 6px; }
.chase p b { color: var(--ink); }
.need { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.need > div { background: var(--base-2); border-radius: 8px; padding: 8px 12px; flex: 1 1 110px; }
.need b { display: block; font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.05; color: var(--accent-ink); }
.need span { font-size: 11px; color: var(--muted); }

.race-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rc { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; text-decoration: none; display: block; min-width: 0; }
a.rc:hover { border-color: rgba(217,167,52,.6); }
.rc.counted { border-color: rgba(217,167,52,.45); background: linear-gradient(160deg, rgba(217,167,52,.1), var(--surface) 55%); }
.rc.dnr { background: transparent; border-style: dashed; }
.rc .rc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.rc .rc-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .rc-date { font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .04em; }
.rc .rc-pts { font-family: var(--display); font-size: 34px; line-height: 1; margin-top: 8px; }
.rc .rc-pts small { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 4px; letter-spacing: .06em; }
.rc .rc-line { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.rc .rc-line b { color: var(--ink); font-weight: 600; }

.chart-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 14px 8px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--faint); font-family: var(--mono); font-size: 10px; }
.chart .lbl-strong { fill: var(--ink); font-family: var(--display); font-size: 13px; }
.chart .gl { stroke: var(--rule); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }

.nem { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.nem:first-child { border-top: 0; }
.nem .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); min-width: 86px; }
.nem .grow { flex: 1; min-width: 0; }
.nem .grow a { font-weight: 700; text-decoration: none; }
.nem .grow a:hover { color: var(--accent-ink); }
.nem .grow small { display: block; color: var(--faint); font-size: 12px; }

/* ---------- h2h ---------- */
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--rule); }
.vs-side { position: relative; padding: 18px; background: var(--surface); overflow: hidden; min-width: 0; }
.vs-side::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--c1) 0 49%, var(--c2) 51% 100%); opacity: .18; }
.vs-side > * { position: relative; }
.vs-side.b { text-align: right; }
.vs-side h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(22px, 3.6vw, 40px); line-height: .95; margin: 8px 0; overflow-wrap: anywhere; }
.vs-side h2 a { text-decoration: none; }
.vs-mid { display: flex; align-items: center; justify-content: center; background: var(--accent); color: #0c0a09; font-family: var(--display); font-size: clamp(22px, 3vw, 34px); padding: 0 clamp(10px, 2vw, 22px); }
.vs-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 12px; text-align: center; }
.vs-score b { font-family: var(--display); font-weight: 400; font-size: clamp(48px, 8vw, 96px); line-height: 1; }
.vs-score span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, auto) minmax(0, 1fr); gap: 0; }
.cmp > div { padding: 9px 12px; border-top: 1px solid var(--rule); }
.cmp .l { text-align: right; }
.cmp .m { text-align: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.cmp .win { color: var(--accent-ink); font-weight: 700; }
.picker { position: relative; flex: 1 1 240px; }
.picker input { width: 100%; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; max-height: 300px; overflow: auto; box-shadow: 0 12px 30px var(--shadow); }
.picker-list button { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; background: none; border: 0; padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--rule); }
.picker-list button:hover, .picker-list button.on { background: rgba(217,167,52,.1); }

/* ---------- club table heatmap ---------- */
.heat td.h { text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 6px 4px; min-width: 34px; }
.heat td.h span { display: inline-block; min-width: 26px; padding: 3px 0; border-radius: 4px; }
.heat td.h.na span { color: var(--faint); font-weight: 500; }
.heat th.h { text-align: center; padding-left: 4px; padding-right: 4px; }
.heat th.h a { text-decoration: none; }
.heat th.h a:hover { color: var(--accent-ink); }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 76px; gap: 10px; align-items: center; font-size: 13px; }
.bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.bar .bt { height: 16px; background: var(--base-2); border-radius: 3px; overflow: hidden; }
.bar .bt i { display: block; height: 100%; background: linear-gradient(90deg, var(--red-bright), var(--accent)); transform-origin: left; }
.bar .bv { text-align: right; font-family: var(--mono); font-size: 12px; }

/* ---------- podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; align-items: end; gap: 8px; }
.pod { text-align: center; text-decoration: none; min-width: 0; }
.pod .nm { font-weight: 700; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .cl { font-size: 12px; color: var(--faint); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .tm { font-family: var(--display); font-size: 20px; color: var(--accent-ink); display: block; margin: 2px 0 6px; }
.pod .step { font-family: var(--display); font-size: 34px; color: #0c0a09; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; border-radius: 6px 6px 0 0; }
.pod.p1 .step { background: var(--gold); height: 92px; }
.pod.p2 .step { background: var(--silver); height: 66px; }
.pod.p3 .step { background: var(--bronze); height: 48px; }
.pod:hover .nm { color: var(--accent-ink); }

/* ---------- info pages ---------- */
.prose { max-width: 78ch; font-size: 15.5px; line-height: 1.65; }
.prose p, .prose ul, .prose ol, .prose table, .prose figure, .prose blockquote { margin: 0 0 14px; }
.prose h2, .prose h3, .prose h4 { font-family: var(--display); font-weight: 400; text-transform: uppercase; margin: 26px 0 10px; line-height: 1.05; }
.prose h2 { font-size: 28px; } .prose h3 { font-size: 22px; } .prose h4 { font-size: 18px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose a { color: var(--accent-ink-soft); }
.prose img { height: auto; border-radius: 8px; }
.prose table { border: 1px solid var(--rule); border-radius: 8px; display: block; overflow-x: auto; }
.prose td { white-space: normal; }
.prose strong, .prose b { color: var(--ink); }
.info-nav { display: flex; flex-direction: column; gap: 2px; }
.info-nav a { text-decoration: none; padding: 9px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 14px; }
.info-nav a:hover { color: var(--ink); background: var(--surface); }
.info-nav a[aria-current="page"] { background: var(--surface-2); color: var(--accent-ink); }
.source-note { margin-top: 26px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface); font-size: 13px; color: var(--muted); border-radius: 0 8px 8px 0; }
.source-note a { color: var(--accent-ink-soft); }
.news-item { display: block; padding: 14px 16px; border-top: 1px solid var(--rule); text-decoration: none; }
.news-item:first-child { border-top: 0; }
.news-item:hover { background: rgba(217,167,52,.04); }
.news-item time { font-family: var(--mono); font-size: 11px; color: var(--accent-ink-soft); letter-spacing: .06em; text-transform: uppercase; }
.news-item b { display: block; font-size: 16px; margin-top: 3px; }

/* ---------- search dialog ---------- */
dialog#searchDlg { margin: 8vh auto auto; width: min(640px, calc(100vw - 24px)); max-height: 80vh; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 14px; padding: 0; overflow: hidden; box-shadow: 0 30px 80px var(--shadow); }
dialog#searchDlg::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.sd-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--rule); background: var(--base-2); }
.sd-head input { flex: 1; font-size: 18px; padding: 10px 12px; background: var(--surface); }
.sd-close { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; padding: 0 12px; cursor: pointer; font-family: var(--mono); font-size: 12px; }
.sd-results { overflow-y: auto; max-height: calc(80vh - 70px); }
.sd-results a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--rule); text-decoration: none; }
.sd-results a:hover, .sd-results a.on { background: rgba(217,167,52,.09); }
.sd-results .grow { flex: 1; min-width: 0; }
.sd-results .grow small { display: block; font-size: 12px; color: var(--faint); }
.sd-group { padding: 8px 14px 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
.sd-empty { padding: 22px 14px; color: var(--faint); text-align: center; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); background: var(--base-2); padding: 32px var(--gutter) 28px; }
.foot-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; font-size: 13.5px; color: var(--muted); }
.foot-inner p + p { margin-top: 8px; }
.foot-inner a { color: var(--accent-ink-soft); }
.foot-title { font-family: var(--display); text-transform: uppercase; font-size: 18px; color: var(--ink); }
.foot-links { display: flex; flex-direction: column; gap: 6px; }
.foot-links a { text-decoration: none; color: var(--muted); }
.foot-links a:hover { color: var(--accent-ink); }
@media (max-width: 720px) { .foot-inner { grid-template-columns: minmax(0, 1fr); } }
.powered-by { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 26px auto 0; text-decoration: none; opacity: .75; width: max-content; }
.powered-by:hover { opacity: 1; }
.powered-by span { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.powered-by img { border-radius: 8px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px); opacity: 0; background: var(--accent); color: #0c0a09; font-weight: 700; padding: 10px 16px; border-radius: 6px; transition: all .25s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 28px; text-align: center; color: var(--faint); }
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.season-pick { flex: 0 0 auto; padding: 7px 8px; font-size: 13px; font-weight: 700; }
.season-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 8px var(--gutter); background: var(--surface-2); border-bottom: 1px solid var(--rule); font-size: 13.5px; color: var(--muted); text-align: center; }
.season-note b { color: var(--ink); }
.season-note button { background: var(--accent); color: #0c0a09; border: 0; border-radius: 6px; padding: 5px 10px; font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.sec-title > a:not(.btn) { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink-soft); text-decoration: none; }
@media (max-width: 900px) { .season-pick { margin-left: auto; } .season-pick + .search-btn { margin-left: 0; } }

/* ---------- sussex masters league ---------- */
.brand img { display: block; width: 40px; height: 40px; }
.brand-txt i { color: var(--accent-ink); }
.home-link { flex: 0 0 auto; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: none; white-space: nowrap; }
.home-link:hover { color: var(--accent-ink); }
.season-pick { flex: 0 0 auto; padding: 7px 8px; font-size: 13px; font-weight: 700; }
.season-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 8px var(--gutter); background: var(--surface-2); border-bottom: 1px solid var(--rule); font-size: 13.5px; color: var(--muted); text-align: center; }
.season-note b { color: var(--ink); }
.season-note a { background: var(--accent); color: #0c0a09; border-radius: 6px; padding: 5px 10px; font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; text-decoration: none; }
.brand a { display: flex; align-items: center; text-decoration: none; }
.hl-short { display: none; }
/* On phones the header's first row is brand, Home, season, search; the nav gets its own row. */
@media (max-width: 900px) { .home-link { margin-left: auto; } .home-link + .season-pick, .live-link + .season-pick, .season-pick + .search-btn { margin-left: 0; } .hl-long { display: none; } .hl-short { display: inline; } }
.sec-title > a:not(.btn) { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink-soft); text-decoration: none; }
.season-bar .track a.soon { background: transparent; box-shadow: inset 0 0 0 1px var(--track-soon); }

/* club tables: match points per match, category heat */
.heat td.h { text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 6px 4px; min-width: 38px; }
.heat td.h span { display: inline-block; min-width: 28px; padding: 3px 2px; border-radius: 4px; }
.heat td.h.na span { color: var(--faint); font-weight: 500; }
td.mp { font-family: var(--display); font-size: 20px; color: var(--accent-ink); }

/* events on a match page */
.ev { margin-top: 12px; }
.ev .panel-head .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.ev table td { white-space: normal; }
.ev td.perf { font-family: var(--mono); white-space: nowrap; }
.ev tr.gap td { border-top: 2px solid var(--rule); }
.ev .guests td { color: var(--muted); font-size: 13px; }
.squad { font-size: 12px; color: var(--faint); display: block; }
.club-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.empty-season { padding: clamp(28px, 6vw, 64px) 0; }
.vs-side select { display: block; width: 100%; max-width: 100%; margin-top: 8px; font-size: 13px; }
@media (max-width: 420px) {
  header.top { gap: 8px; }
  .brand { gap: 6px; }
  .brand img { width: 32px; height: 32px; }
  .brand-txt b { font-size: 18px; }
  .brand-txt i { font-size: 9px; letter-spacing: .1em; }
  .home-link { font-size: 11px; letter-spacing: .04em; }
  .season-pick { padding: 6px 4px; font-size: 12px; }
  .search-btn { padding: 6px 8px; }
}
.live-link { flex: 0 0 auto; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); text-decoration: none; white-space: nowrap; }
.live-link:hover { color: var(--accent-ink-soft); }
@media (max-width: 420px) { .live-link { font-size: 11px; letter-spacing: .04em; } }
@media (max-width: 380px) {
  header.top { gap: 6px; }
  .hl-arrow { display: none; }
  .season-pick { padding: 5px 2px; }
  .search-btn { padding: 6px; }
}

/* ---------- light theme ---------- */
/* Same layout, flipped ink: dark ink on white, deep red and gold accents. Set by the small
   script in results.html, which reads the reader's choice from localStorage before the page
   paints. The league home page reads the same choice. */
:root[data-theme="light"] {
  --base: #ffffff;
  --base-2: #f8f3ec;
  --surface: #ffffff;
  --surface-2: #faf5ee;
  --surface-3: #eee5d8;
  --silver: #aab4cb;
  --bronze: #c2794a;
  --ink: #1c1210;
  --muted: rgba(28,18,16,.7);
  --faint: rgba(28,18,16,.52);
  --rule: rgba(28,18,16,.14);
  --up: #12804a;
  --down: #c62026;
  --accent-ink: #8a6200;
  --accent-ink-soft: #7a5600;
  --red-ink: #b3181d;
  --glass: rgba(255,255,255,.94);
  --scrim: rgba(28,18,16,.45);
  --shadow: rgba(28,18,16,.18);
  --row-alt: rgba(28,18,16,.028);
  --row-hover: rgba(217,167,52,.14);
  --row-me: rgba(217,167,52,.28);
  --rule-accent: rgba(160,116,0,.6);
  --swatch-edge: rgba(28,18,16,.18);
  --track: rgba(28,18,16,.14);
  --track-soon: rgba(28,18,16,.3);
  --plate: rgba(255,255,255,.72);
  --hero-grad: radial-gradient(120% 120% at 85% 0%, #f2c9cc 0%, #f8e0df 30%, #fdf3ef 60%, #ffffff 100%);
  --hero-stripe: rgba(140,29,38,.045);
  --hero-sub-ink: rgba(28,18,16,.78);
  --shade-grad: linear-gradient(90deg, var(--base-2) 35%, rgba(255,255,255,.5) 70%, rgba(255,255,255,.15) 100%);
  --panel-head-grad: linear-gradient(90deg, #f3d9da 0%, var(--surface-2) 100%);
  --heat: 200,62,72;
  --chart-1: #b08200;
  --chart-2: #1b6fd0;
  --chart-3: #12804a;
  --chart-4: #c2531f;
  --chart-5: #8a3fc0;
  --chart-6: #1c1210;
  --chart-7: #c62026;
  --chart-8: #138a80;
}
/* Blocks that stay dark red whatever the theme, so their own text stays light. */
.ticker, .next-race {
  --ink: #f4efe6;
  --muted: rgba(244,239,230,.68);
  --faint: rgba(244,239,230,.44);
  --rule: rgba(244,239,230,.12);
  --accent-ink: var(--accent);
  --accent-ink-soft: var(--accent-soft);
  color: var(--ink);
}

/* ---------- light / dark switch ---------- */
/* Small square in the header, right-hand end: sun in the dark theme, moon in the light one. */
.theme-btn { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; color: var(--muted); cursor: pointer; }
.theme-btn:hover { border-color: var(--accent); color: var(--ink); }
.theme-btn svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .moon { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: block; }
@media print { .theme-btn { display: none; } }
@media (max-width: 420px) { .theme-btn { width: 32px; height: 32px; } }
