/* MX Spot - visual system
   Layout: a slim bar, then either the map (full bleed, with a floating panel) or the rankings.
   Shape rule: controls and rows 10px, cards and panels 16px, chips and switches fully round.
   Colour rule: zinc neutrals and ONE accent (burnt orange). Circuits listed by the federation carry the accent,
   every other terrain stays neutral. */
@font-face { font-family: "Geist"; src: url("fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

:root {
  --bg: #f4f4f5;
  --surface: #fcfcfc;
  --surface-2: #ececee;
  --ink: #18181b;
  --muted: #5b5b63;
  --line: #e1e1e4;
  --accent: #c2410c;
  --accent-ink: #fffaf6;
  --accent-soft: #f7e3d8;
  --neutral-mark: #6f6f78;
  --me: #1d6ff2;
  --map-bg: #dfe3e8;
  --map-land: #f6f6f4;
  --map-border: #c9cbd1;
  --shadow: 0 1px 2px rgba(24, 24, 27, .06), 0 12px 32px rgba(24, 24, 27, .12);
  --body: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-ctl: 10px;
  --r-card: 16px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --panel-w: 420px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f11; --surface: #19191c; --surface-2: #232327; --ink: #f2f2f3; --muted: #a3a3ab; --line: #2d2d32;
    --accent: #ff7a3d; --accent-ink: #1c0e06; --accent-soft: #3a2015; --neutral-mark: #8f8f99; --me: #5b9dff;
    --map-bg: #0b0c0e; --map-land: #1b1b1f; --map-border: #35353b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f11; --surface: #19191c; --surface-2: #232327; --ink: #f2f2f3; --muted: #a3a3ab; --line: #2d2d32;
  --accent: #ff7a3d; --accent-ink: #1c0e06; --accent-soft: #3a2015; --neutral-mark: #8f8f99; --me: #5b9dff;
  --map-bg: #0b0c0e; --map-land: #1b1b1f; --map-border: #35353b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: currentColor; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }

/* ---------- top bar: one line, 60px */
.bar { display: flex; align-items: center; gap: 12px 20px; min-height: 60px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 18px/1 var(--display); font-stretch: 118%; letter-spacing: -.01em; white-space: nowrap; }
/* the logo: a track seen from above (drawn by pipeline/logo.py), on the accent tile */
.brand b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-ctl); background: var(--accent); color: var(--accent-ink); }
.brand b .ic { width: 30px; height: 30px; }
.tabs { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-weight: 500; color: var(--muted); transition: background-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 24, 27, .14); }
.tabs button:active { transform: scale(.97); }
.search { position: relative; flex: 1 1 220px; min-width: 0; max-width: 420px; margin-left: auto; }
.search > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--bg); padding: 0 12px 0 38px; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.search input::placeholder { color: var(--muted); }
.search input:focus { background: var(--surface); border-color: var(--ink); outline: none; }
.results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); max-height: min(60vh, 440px); overflow: auto; padding: 8px; animation: rise .22s var(--ease); }
.results h4 { margin: 8px 8px 4px; font: 500 13px/1.2 var(--body); color: var(--muted); }
.results button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 9px 8px; border-radius: var(--r-ctl); gap: 10px; align-items: baseline; }
.results button:hover, .results button:focus-visible { background: var(--surface-2); }
.results .sub { color: var(--muted); font-size: 13px; margin-left: auto; text-align: right; }
.results .none { padding: 12px 8px; color: var(--muted); }
.results .rider { padding: 8px 8px 2px; font-weight: 600; }
.results button.in { padding: 6px 8px 6px 20px; color: var(--muted); font-size: 14px; }
.results button.in .rk { min-width: 3.2em; color: var(--ink); font-weight: 550; font-variant-numeric: tabular-nums; }

/* ---------- map view */
.view { min-height: 0; }
.carte { position: relative; height: 100%; }
.mapwrap { position: absolute; inset: 0; background: var(--map-bg); }
#map { position: absolute; inset: 0; }
.panel { position: absolute; z-index: 2; top: 12px; left: 12px; bottom: 12px; width: var(--panel-w); max-width: calc(100% - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.grab { display: none; }
/* one column that may shrink: without minmax(0, …) the widest child (two selects side by side) sets the width and runs off a phone screen */
.panel-head { padding: 14px 16px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.cats.chips { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease); }
.chip:hover { border-color: var(--ink); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.count { font-size: 13px; color: var(--muted); }
.picks { display: flex; gap: 8px; }
.picks select { flex: 1 1 0; min-width: 0; max-width: 100%; text-overflow: ellipsis; height: 36px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-ctl); padding: 0 8px; font-size: 14px; font-weight: 500; }
.champs select { width: calc(100% - 16px); margin: 0 8px 12px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-ctl); padding: 0 8px; font-size: 14px; font-weight: 500; }
.champs h3 + h3, .champs button + h3 { margin-top: 18px; }
.nat { color: var(--muted); font-size: 13px; }
.panel-body { overflow: auto; min-height: 0; flex: 1; }
.swap { animation: rise .26s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.list { list-style: none; margin: 0; padding: 6px 8px 12px; }
.list button { width: 100%; text-align: left; border: 0; background: none; padding: 8px; border-radius: var(--r-ctl); display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; transition: background-color .15s var(--ease), transform .15s var(--ease); }
.list button:hover, .list button:focus-visible { background: var(--surface-2); }
.list button:active { transform: scale(.99); }
.thumb { width: 44px; height: 44px; border-radius: var(--r-ctl); background: var(--surface-2); display: grid; place-items: center; color: var(--neutral-mark); }
.thumb.ffm { background: var(--accent-soft); color: var(--accent); }
.thumb svg { width: 100%; height: 100%; }
.thumb .ic { width: 18px; height: 18px; }
.list .txt { min-width: 0; display: grid; }
.list .name { font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.list .name .ic { color: var(--accent); width: 14px; height: 14px; vertical-align: -2px; margin-left: 4px; }
.list .place { color: var(--muted); font-size: 13px; }
.list .len { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.state { padding: 36px 20px; display: grid; gap: 10px; justify-items: start; color: var(--muted); }
.state strong { color: var(--ink); font-size: 16px; font-weight: 600; }
.state .ic { width: 26px; height: 26px; color: var(--neutral-mark); }
.sk { border-radius: var(--r-ctl); background: linear-gradient(100deg, var(--surface-2) 40%, var(--line) 50%, var(--surface-2) 60%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.sk-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 8px; align-items: center; }
.sk-row i { display: block; height: 44px; }
.sk-row span { display: grid; gap: 8px; }
.sk-row span i { height: 12px; }
.sk-row span i + i { width: 55%; }

.sheet { padding: 12px 16px 22px; display: grid; gap: 16px; }
.back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 8px 6px 4px; margin-left: -4px; border-radius: var(--r-ctl); color: var(--muted); font-weight: 500; justify-self: start; transition: background-color .15s var(--ease), color .15s var(--ease); }
.back:hover { background: var(--surface-2); color: var(--ink); }
.trace { border-radius: var(--r-card); background: var(--surface-2); color: var(--neutral-mark); aspect-ratio: 16 / 8; display: grid; place-items: center; overflow: hidden; }
.trace.ffm { background: var(--accent-soft); color: var(--accent); }
.trace svg { width: 100%; height: 100%; }
.sheet h2 { margin: 0; font: 750 26px/1.12 var(--display); font-stretch: 104%; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.sheet .where { color: var(--muted); margin-top: 6px; }
.status { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font-size: 13px; font-weight: 550; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.status.ffm { background: var(--accent-soft); color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.facts div { background: var(--bg); border-radius: var(--r-ctl); padding: 10px 12px; min-width: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.sheet h3 { margin: 4px 0 -6px; font: 600 15px/1.3 var(--body); }
.races { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.races button { width: calc(100% + 16px); margin-left: -8px; border: 0; background: none; text-align: left; padding: 9px 8px; border-radius: var(--r-ctl); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; transition: background-color .15s var(--ease); }
.races button:hover, .races button:focus-visible { background: var(--surface-2); }
.races .d { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.races .c { font-weight: 550; }
.races .ic { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 550; text-decoration: none; white-space: nowrap; transition: border-color .2s var(--ease), background-color .2s var(--ease), transform .15s var(--ease); }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.note { font-size: 13px; color: var(--muted); margin: 0; max-width: 65ch; }
.sources { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.cluster { width: var(--s, 34px); height: var(--s, 34px); border-radius: 999px; border: 0; background: var(--ink); color: var(--surface); font: 600 13px/1 var(--mono); display: grid; place-items: center; padding: 0; box-shadow: 0 0 0 5px color-mix(in srgb, var(--ink) 16%, transparent); transition: box-shadow .2s var(--ease); }
.cluster:hover { box-shadow: 0 0 0 8px color-mix(in srgb, var(--ink) 20%, transparent); }
/* the selected terrain: a larger dot in the terrain's own colour, still (only the visitor's position pulses) */
.pin { width: 22px; height: 22px; border-radius: 999px; background: var(--neutral-mark); border: 3px solid var(--surface); box-shadow: 0 2px 8px rgba(24, 24, 27, .35); pointer-events: none; }   /* no position here: the map library positions its markers itself */
.pin.ffm { background: var(--accent); }
@keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(2.6); opacity: 0; } }
/* the visitor's position: the one blue thing on the map, growing as the map zooms out (--k) */
.me { width: calc(18px * var(--k, 1)); height: calc(18px * var(--k, 1)); border-radius: 999px; background: var(--me); border: 3px solid var(--surface); box-shadow: 0 0 0 calc(7px * var(--k, 1)) color-mix(in srgb, var(--me) 22%, transparent), 0 2px 8px rgba(24, 24, 27, .35); pointer-events: none; z-index: 3; }
.me::after { content: ""; position: absolute; inset: -3px; border-radius: 999px; border: 2px solid var(--me); animation: ping 2.2s var(--ease) infinite; }
.city { font: 500 11.5px/1 var(--body); color: var(--muted); letter-spacing: .02em; pointer-events: none; white-space: nowrap; text-shadow: 0 0 3px var(--map-land), 0 0 3px var(--map-land); }
.legend { position: absolute; z-index: 1; left: calc(var(--panel-w) + 24px); bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; display: flex; gap: 16px; box-shadow: var(--shadow); }
.legend span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); }
.legend i.other { background: var(--neutral-mark); }
.locate { position: absolute; z-index: 1; right: 12px; bottom: 44px; box-shadow: var(--shadow); }
.toast { position: absolute; z-index: 3; left: 50%; top: 12px; transform: translateX(-50%); width: max-content; text-align: center; background: var(--ink); color: var(--surface); padding: 9px 15px; border-radius: var(--r-ctl); font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.maplibregl-ctrl-attrib { font: 11px/1.4 var(--body); }
.maplibregl-ctrl-group { border-radius: var(--r-ctl) !important; overflow: hidden; }

/* ---------- rankings view */
.classements { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); height: 100%; }
.champs { background: var(--surface); border-right: 1px solid var(--line); overflow: auto; padding: 16px 10px; min-width: 0; }
.champs h3 { margin: 0 8px 10px; font: 500 13px/1.3 var(--body); color: var(--muted); }
.champs button { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: baseline; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: var(--r-ctl); font-weight: 550; transition: background-color .15s var(--ease), color .15s var(--ease); }
.champs button small { color: var(--muted); font-weight: 400; white-space: nowrap; font-size: 12.5px; }
.champs button[aria-current="true"] { background: var(--ink); color: var(--surface); }
.champs button[aria-current="true"] small { color: inherit; opacity: .72; }
.champs button:hover:not([aria-current="true"]) { background: var(--surface-2); }
.champ-pick { display: none; }
.board { overflow: auto; min-width: 0; }
.board-in { max-width: 1120px; padding: 28px 32px 56px; display: grid; gap: 24px; }
.board h1 { margin: 0; font: 800 clamp(28px, 4.4vw, 46px)/1.02 var(--display); font-stretch: 122%; letter-spacing: -.02em; text-transform: uppercase; text-wrap: balance; }
.board .meta { color: var(--muted); margin: 8px 0 0; }
.rounds { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 8px; margin: 0; list-style: none; }
.rounds li { scroll-snap-align: start; flex: none; }
.round { height: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-card); padding: 12px 14px; text-align: left; display: grid; gap: 4px; align-content: start; width: 200px; color: inherit; transition: border-color .2s var(--ease), transform .15s var(--ease); }
.round .d { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.round .p { font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.round .go { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--accent); font-weight: 550; margin-top: 4px; }
button.round:hover { border-color: var(--ink); }
button.round:active { transform: scale(.98); }
.podium { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; }
.step { border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; display: grid; gap: 4px; align-content: end; min-width: 0; min-height: 132px; }
.step.first { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-height: 156px; }
.step .rk { font: 800 34px/1 var(--display); font-stretch: 125%; }
.step.first .rk { font-size: 46px; }
.step .who { font-weight: 600; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; margin-top: 6px; }
.step.first .who { font-size: 20px; }
.step .sub { font-size: 13px; opacity: .78; overflow-wrap: anywhere; }
.step .pts { font-size: 14px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 16px; align-items: end; justify-content: space-between; flex-wrap: wrap; }
.tools p { margin: 0; color: var(--muted); font-size: 14px; max-width: 65ch; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input { height: 38px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); padding: 0 12px; width: min(100%, 260px); font-size: 15px; transition: border-color .2s var(--ease); }
.field input:focus { border-color: var(--ink); outline: none; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th { font: 500 12.5px/1.2 var(--body); color: var(--muted); border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
tbody tr:hover td { background: var(--surface-2); }
td.pos { font: 800 17px/1 var(--display); font-stretch: 118%; width: 1%; }
tr.top td.pos { color: var(--accent); }
td.num { width: 1%; }
.plate { display: inline-grid; place-items: center; min-width: 3.1em; padding: 3px 7px; border: 1px solid var(--line); background: var(--bg); font: 500 13px/1.2 var(--mono); border-radius: var(--r-ctl); }
td.pts { font: 600 14px/1 var(--mono); text-align: right; }
th.pts, th.r, td.r { text-align: right; }
td.r { color: var(--muted); font: 400 13px/1 var(--mono); }
td.rider { font-weight: 550; }
td.club { color: var(--muted); white-space: normal; min-width: 170px; }
tbody tr.hit td { background: var(--accent-soft); }
.src { font-size: 13px; color: var(--muted); margin: 0; max-width: 75ch; }
.sk-board { display: grid; gap: 16px; }
.sk-board i { display: block; }


/* ---------- follow buttons, account, upcoming races */
.fav { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 999px; background: none; color: var(--muted); transition: background-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease); }
.fav:hover { background: var(--surface-2); color: var(--ink); }
.fav:active { transform: scale(.94); }
.fav.on { color: var(--accent); }
.fav.wide { display: inline-flex; gap: 7px; width: auto; height: 34px; padding: 0 13px 0 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.fav.wide:hover { border-color: var(--ink); background: var(--surface); }
.fav.wide.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sheet .actions { align-items: center; }
.races .race { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 7px 0; }
.board header .fav.wide { margin-top: 14px; }
.round.next { background: var(--accent-soft); border-color: transparent; }
.round.next .d { color: var(--accent); font-weight: 550; }
td.star, th.star { width: 1%; padding: 4px 8px 4px 0; position: sticky; right: 0; }
tbody td.star { background: var(--surface); }
tbody tr:nth-child(even) td.star { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
tbody tr:hover td.star { background: var(--surface-2); }
tbody tr.hit td.star { background: var(--accent-soft); }

.account, .donate, .theme { height: 40px; flex: none; position: relative; }
.theme { width: 40px; padding: 0; justify-content: center; }
/* in the bar only the account keeps a frame; support and theme are quiet controls so the bar reads as: search, then one button */
.bar .donate, .bar .theme { border-color: transparent; background: none; color: var(--muted); }
.bar .donate { padding: 0 10px; margin-right: -14px; }
.bar .theme { margin-right: -8px; }
.bar .donate .ic { color: var(--accent); }
.bar .donate:hover, .bar .theme:hover { border-color: transparent; background: var(--surface-2); color: var(--ink); }
/* the club that runs a track, with its logo when one was found */
.club { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-ctl); background: var(--surface-2); }
.club-logo { width: 56px; height: 56px; flex: none; object-fit: contain; border-radius: 10px; background: #fff; }
.club small { display: block; font-size: 12px; color: var(--muted); }
.club strong { font-weight: 600; overflow-wrap: anywhere; }
/* the aerial picture of a track in its sheet, and the viewer that opens on top of everything */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery.one { grid-template-columns: 1fr; }
.shot { position: relative; padding: 0; border: 0; border-radius: var(--r-ctl); overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 10; cursor: zoom-in; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.shot:hover img { transform: scale(1.04); }
.shot span { position: absolute; left: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px; background: rgba(15, 15, 17, .68); color: #fff; font-size: 12px; font-weight: 500; }
.credit { margin: -6px 0 0; font-size: 12px; color: var(--muted); }
.lightbox { padding: 0; border: 0; border-radius: var(--r-card); background: #0f0f11; color: #f4f4f5; width: min(96vw, 1100px); max-width: none; overflow: hidden; }
.lightbox::backdrop { background: rgba(15, 15, 17, .78); }
.lightbox figure { margin: 0; }
.lightbox img { display: block; width: 100%; height: auto; max-height: 82vh; object-fit: contain; background: #0f0f11; }
.lightbox figcaption { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 10px 16px 12px; font-size: 14px; }
.lightbox figcaption span:last-child { color: #a1a1aa; }
.lightbox .back { position: absolute; top: 10px; width: 40px; height: 40px; padding: 0; margin: 0; display: grid; place-items: center; border-radius: 999px; border: 0; background: rgba(15, 15, 17, .6); color: #fff; }
.lightbox .back:hover { background: rgba(15, 15, 17, .85); color: #fff; }
.lightbox .close { right: 10px; }
.lightbox .prev, .lightbox .next { top: calc(50% - 40px); }
.lightbox .prev { left: 10px; }
.lightbox .next { right: 10px; transform: scaleX(-1); }
/* language: a quiet code in the bar on wide screens, and a row in the account panel on every screen */
.lang { height: 40px; flex: none; padding: 0 8px; gap: 5px; font: 600 12px/1 var(--mono); letter-spacing: .04em; }
.bar .lang { border-color: transparent; background: none; color: var(--muted); margin-right: -14px; }
.bar .lang:hover { border-color: transparent; background: var(--surface-2); color: var(--ink); }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.lang-row .switch button { padding: 6px 14px; font-size: 14px; }
/* the page was written in another language than the visitor's: its texts stay hidden for the instant it takes to swap them */
.i18n-wait [data-i18n] { visibility: hidden; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 12px/20px var(--mono); text-align: center; }

.avenir { height: 100%; }
.avenir .board { height: 100%; }
.month { display: grid; gap: 10px; }
.month h2 { margin: 0; font: 700 20px/1.2 var(--display); font-stretch: 110%; letter-spacing: -.01em; text-transform: capitalize; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 14px; }
.event .date { display: grid; justify-items: center; gap: 2px; background: var(--bg); border-radius: var(--r-ctl); padding: 8px 0; }
.event .date b { font: 800 22px/1 var(--display); font-stretch: 118%; }
.event .date span { font-size: 12.5px; color: var(--muted); }
.event .what { display: grid; gap: 2px; min-width: 0; }
.event .what strong { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.event .what span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.event .what .who { font-size: 13px; }
.event .actions { justify-content: flex-end; align-items: center; }
.event .btn { height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.field select { height: 38px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); padding: 0 10px; width: min(100%, 300px); font-size: 15px; }

.sheet-dialog { width: min(460px, calc(100% - 24px)); max-height: min(86vh, 760px); padding: 22px 22px 24px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto; }
.sheet-dialog[open] { animation: rise .24s var(--ease); }
.sheet-dialog::backdrop { background: rgba(24, 24, 27, .45); }
.sheet-dialog .close { position: absolute; top: 14px; right: 14px; margin: 0; padding: 8px; }
#account-body { display: grid; gap: 16px; }
/* signed out: a wide two-panel dialog, pitch on the left, form on the right */
.sheet-dialog.auth { width: min(780px, calc(100% - 24px)); padding: 0; overflow: hidden; }
.sheet-dialog.auth #account-body { grid-template-columns: minmax(0, .85fr) minmax(0, 1fr); gap: 0; }
.pitch { background: var(--accent); color: var(--accent-ink); padding: 32px 28px; display: grid; gap: 22px; align-content: center; }
.pitch .mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-ctl); background: var(--accent-ink); color: var(--accent); }
.pitch .mark .ic { width: 40px; height: 40px; }
#account-body .pitch h2 { font: 800 30px/1.05 var(--display); font-stretch: 112%; letter-spacing: -.02em; padding: 0; text-wrap: balance; }
.pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pitch li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; font-weight: 500; line-height: 1.35; }
.pitch li .ic { width: 20px; height: 20px; margin-top: 1px; }
.auth-form { padding: 56px 28px 28px; display: grid; gap: 18px; align-content: start; }
.switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.switch button { border: 0; background: none; padding: 9px 10px; border-radius: 999px; font-weight: 550; color: var(--muted); transition: background-color .2s var(--ease), color .2s var(--ease); }
.switch button[aria-selected="true"], .switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 24, 27, .14); }
#account-body .auth-form form { gap: 16px; }
#account-body .auth-form .field { font-size: 14px; color: var(--ink); font-weight: 500; }
#account-body .auth-form .field input { height: 48px; padding: 0 14px; font-size: 16px; background: var(--bg); }
#account-body .auth-form .field input:focus { background: var(--surface); }
.btn.big { height: 48px; justify-content: center; font-size: 16px; width: 100%; }
.sheet-dialog.auth .close { background: var(--surface); border-radius: 999px; }
#account-body h2 { margin: 0; font: 750 24px/1.15 var(--display); font-stretch: 106%; letter-spacing: -.02em; padding-right: 40px; }
#account-body h3 { margin: 0 0 8px; font: 600 15px/1.3 var(--body); }
#account-body h4 { margin: 10px 0 2px; font: 500 13px/1.3 var(--body); color: var(--muted); }
#account-body section { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
#account-body form { display: grid; gap: 14px; }
#account-body .field input { width: 100%; height: 42px; }
.error { margin: 0; color: var(--accent); font-size: 14px; font-weight: 500; }
.favs, .inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.favs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.favs .go { border: 0; background: none; text-align: left; padding: 7px 8px; margin-left: -8px; border-radius: var(--r-ctl); font-weight: 500; overflow-wrap: anywhere; transition: background-color .15s var(--ease); }
.favs .go:hover { background: var(--surface-2); }
.inbox a { display: grid; gap: 2px; padding: 8px; margin: 0 -8px; border-radius: var(--r-ctl); color: inherit; text-decoration: none; transition: background-color .15s var(--ease); }
.inbox a:hover { background: var(--surface-2); }
.inbox strong { font-weight: 600; }
.inbox span { color: var(--muted); font-size: 14px; }
.actions.end { padding-top: 16px; border-top: 1px solid var(--line); justify-content: space-between; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover { border-color: var(--line); color: var(--ink); }

@media (max-width: 899px) {
  .app { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .brand span, .account span, .donate span { display: none; }
  .bar .lang { display: none; }
  .account, .donate { width: 40px; padding: 0; justify-content: center; }
  .account .badge { position: absolute; top: -6px; right: -6px; }
  .search { max-width: none; margin-left: 0; }
  /* phone: while searching, the field takes the whole bar and the results the whole width of the screen, one result per line */
  .bar.searching .donate, .bar.searching .theme, .bar.searching .account { display: none; }
  .results { position: fixed; left: 8px; right: 8px; top: 66px; max-height: min(52vh, 440px); }
  .results button:not(.in) { flex-direction: column; align-items: flex-start; gap: 1px; }
  .results button:not(.in) > span:first-child { font-weight: 550; }
  .results .sub { margin-left: 0; text-align: left; }
  input, select, textarea, .picks select { font-size: 16px; }      /* iOS zooms the whole page into any field with smaller text */
  .tabs { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; border-radius: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; }
  .tabs button { flex: 1; flex-direction: column; gap: 3px; padding: 5px 4px; font-size: 12px; border-radius: var(--r-ctl); }
  .tabs button .ic { width: 22px; height: 22px; }
  .tabs button[aria-selected="true"] { background: none; box-shadow: none; color: var(--accent); }
  .sheet-dialog.auth #account-body { grid-template-columns: minmax(0, 1fr); }
  .pitch { padding: 22px 20px; gap: 12px; }
  #account-body .pitch h2 { font-size: 24px; padding-right: 44px; }
  .pitch .mark, .pitch ul { display: none; }
  .auth-form { padding: 22px 20px 24px; }
  .event { grid-template-columns: 52px minmax(0, 1fr); }
  .event .actions { grid-column: 1 / -1; justify-content: flex-start; }
  /* phone: the map fills the screen and the list is a sheet over it, pulled by its grabber like a native iOS sheet.
     The sheet has the full height and is slid down with a transform; --ty is set by the script (68% until it runs). */
  .carte { overflow: hidden; }       /* the part of the sheet that is slid below the screen must not make the page scroll */
  .panel { top: 0; left: 0; right: 0; bottom: auto; height: 100%; width: auto; max-width: none; border-radius: var(--r-card) var(--r-card) 0 0; border-width: 1px 0 0;
    box-shadow: 0 -8px 28px rgba(24, 24, 27, .16); transform: translateY(var(--ty, 68%)); transition: transform .36s cubic-bezier(.2, .8, .2, 1); }
  .panel.dragging { transition: none; }
  .panel:not(.full) .panel-body { overflow: hidden; }
  .panel-body { overscroll-behavior: contain; }
  .grab { display: grid; place-items: center; height: 24px; flex: none; touch-action: none; cursor: grab; }
  .grab i { width: 38px; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 42%, transparent); }
  .grab:focus-visible { outline-offset: -4px; }
  .panel-head { padding-top: 2px; touch-action: none; }
  .legend, .sources { display: none; }
  .panel .chips { gap: 5px; }
  .panel .chip { padding: 5px 10px; }
  .locate { left: 12px; right: auto; top: 12px; bottom: auto; width: 40px; padding: 0; justify-content: center; }
  .locate span { display: none; }
  .classements { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .champs { display: none; }
  .champ-pick { display: grid; gap: 6px; padding: 12px 16px 0; font-size: 13px; color: var(--muted); }
  .champ-pick select { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); padding: 0 10px; font-size: 15px; }
  .board-in { padding: 18px 16px 40px; gap: 20px; }
  .podium { grid-template-columns: minmax(0, 1fr); }
  .step, .step.first { min-height: 0; }
  td.club, th.club { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
