/* BeeTrack Live - styles partagés (spectateur + console) */
:root {
  --accent: #f59e0b;
  --accent-ink: #1c1203;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --line: #e4e1da;
  --ink: #17171a;
  --ink-2: #55555d;
  --ink-3: #8b8b93;
  --ok: #16a34a;
  --run: #2563eb;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012; --surface: #17181b; --surface-2: #1f2024; --line: #2b2c31;
    --ink: #f2f2f3; --ink-2: #b4b4bb; --ink-3: #7c7c85;
    --ok: #22c55e; --run: #60a5fa; --warn: #fbbf24; --bad: #f87171;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #17181b; --surface-2: #1f2024; --line: #2b2c31;
  --ink: #f2f2f3; --ink-2: #b4b4bb; --ink-3: #7c7c85;
  --ok: #22c55e; --run: #60a5fa; --warn: #fbbf24; --bad: #f87171;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* ---------- en-tête */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand .t { min-width: 0; }
.brand h1 { font-size: 16px; margin: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad);
}
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.live-pill.off { background: var(--surface-2); color: var(--ink-2); }
.live-pill.off i { animation: none; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; flex: none;
}

/* ---------- puces de courses */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- tuiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12.5px; color: var(--ink-2); }
.tile.run b { color: var(--run); } .tile.ok b { color: var(--ok); } .tile.bad b { color: var(--bad); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } .tile b { font-size: 21px; } }

.leaders { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.leader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; }
.leader .medal { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent); color: var(--accent-ink); flex: none; font-size: 13px; }
.leader .who { min-width: 0; }
.leader .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader .who small { color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 560px) { .leaders { grid-template-columns: 1fr; } }

/* ---------- onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

/* ---------- barre d'outils */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .search { flex: 1 1 220px; position: relative; }
.toolbar input, .toolbar select, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; min-height: 40px;
}
.toolbar select { width: auto; flex: 0 1 auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- classement */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.board table { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.board td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board tbody tr { cursor: pointer; }
.board tbody tr:hover { background: var(--surface-2); }
.rk { font-weight: 800; font-size: 16px; width: 48px; font-variant-numeric: tabular-nums; }
.bib { display: inline-block; min-width: 40px; text-align: center; font-weight: 700; font-size: 12.5px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.runner b { display: block; }
.runner small { color: var(--ink-2); font-size: 12.5px; }
.flag { font-size: 11px; color: var(--ink-3); margin-left: 4px; font-weight: 600; }
.where b { display: block; font-weight: 600; }
.where small { color: var(--ink-2); font-size: 12.5px; }
.time b { font-variant-numeric: tabular-nums; }
.gap { color: var(--ink-3); font-size: 12.5px; display: block; font-variant-numeric: tabular-nums; }
.star { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--ink-3); padding: 4px; line-height: 1; }
.star.on { color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.running { background: color-mix(in srgb, var(--run) 14%, transparent); color: var(--run); }
.badge.finished { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.dnf, .badge.dsq { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.badge.dns, .badge.waiting { background: var(--surface-2); color: var(--ink-2); }
.badge.late { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.more { display: block; width: 100%; padding: 12px; border: 0; background: var(--surface-2); cursor: pointer; font-weight: 600; color: var(--ink-2); }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }

@media (max-width: 720px) {
  .board thead { display: none; }
  .board table, .board tbody, .board tr, .board td { display: block; }
  .board tr { display: grid; grid-template-columns: 42px 1fr auto; grid-template-areas: "rk who time" "rk where time"; gap: 0 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .board td { padding: 0; border: 0; }
  .board td.rk { grid-area: rk; align-self: center; }
  .board td.runner { grid-area: who; min-width: 0; }
  .board td.runner b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .board td.where { grid-area: where; }
  .board td.where b { display: inline; font-weight: 500; font-size: 13px; }
  .board td.where small { display: none; }
  .board td.time { grid-area: time; text-align: right; align-self: center; }
  .board td.col-bib, .board td.col-star { display: none; }
}

/* ---------- postes */
.cps { display: grid; gap: 10px; }
.cp {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; text-align: left; width: 100%;
}
.cp .km { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.cp .km small { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.cp .bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.cp .bar i { display: block; height: 100%; background: var(--accent); }
.cp .right { text-align: right; font-size: 13px; }
.cp .right b { font-size: 18px; display: block; font-variant-numeric: tabular-nums; }
.kind { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-left: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.profile svg { display: block; width: 100%; height: auto; }
.profile .area { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.profile .grid { stroke: var(--line); stroke-width: 1; }
.profile text { fill: var(--ink-3); font-size: 10px; }
.profile .cpline { stroke: var(--ink-3); stroke-dasharray: 2 3; }
.profile .cpname { fill: var(--ink-2); font-size: 10px; font-weight: 600; }

/* ---------- carte */
#map { height: min(70vh, 620px); border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.map-pin { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---------- panneau coureur */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 51; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  right: 0; top: 0; bottom: 0; width: min(560px, 100%); transform: translateX(100%); transition: transform .25s ease;
  border-left: 1px solid var(--line);
}
.sheet.open { transform: none; }
@media (max-width: 640px) {
  .sheet { top: auto; left: 0; width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; transform: translateY(100%); border-left: 0; }
}
.sheet-head { position: sticky; top: 0; background: var(--bg); padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; z-index: 2; }
.sheet-head h2 { margin: 0; font-size: 19px; line-height: 1.2; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-body { padding: 14px 16px 30px; display: grid; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis .tile b { font-size: 20px; }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; position: relative; }
.progress i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.splits { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.splits th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.splits td { padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: top; }
.splits tr.future td { color: var(--ink-3); }
.splits tr.next td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.up { color: var(--ok); font-size: 11.5px; font-weight: 700; } .down { color: var(--bad); font-size: 11.5px; font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; min-height: 40px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }

/* ---------- bandeau démo */
.demo-bar {
  background: #17171a; color: #f2f2f3; font-size: 13px;
}
.demo-bar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.demo-bar input[type=range] { flex: 1 1 160px; accent-color: var(--accent); }
.demo-bar a { color: var(--accent); font-weight: 600; }

footer.foot { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 30px 16px 40px; }
footer.foot a { color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 80; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }

/* ---------- mode intégré (iframe) */
body.embed .top { position: static; }
body.embed footer.foot { padding: 10px; }

/* =====================================================================
   Structure « application » : menu latéral, recherche globale, rail de classement
   ===================================================================== */
.wrap-wide { max-width: 1480px; margin: 0 auto; padding: 0 16px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.ev-title { text-decoration: none; display: grid; min-width: 0; flex: 0 1 auto; max-width: 260px; }
.ev-title span { font-weight: 800; font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.ev-title small { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-select { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; max-width: 240px; min-height: 40px; border-left: 4px solid var(--accent); }
.gsearch { position: relative; flex: 1; min-width: 0; }
.gsearch input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 16px 10px 40px; min-height: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8b93' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center; }
.gresults { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow: hidden; z-index: 40; max-height: 70vh; overflow-y: auto; }
.gresults a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.gresults a:last-child { border-bottom: 0; }
.gresults a:hover, .gresults a.active { background: var(--surface-2); }
.gresults .grow { flex: 1; min-width: 0; }
.gresults b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gresults small { color: var(--ink-2); font-size: 12.5px; }
.burger { display: none; }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr) 270px; gap: 22px; align-items: start; padding-top: 18px; padding-bottom: 30px; }
.sidenav { position: sticky; top: 82px; display: grid; gap: 2px; }
.sidenav a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.sidenav a:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.sidenav h4 { margin: 14px 12px 4px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.sidenav .count { margin-left: auto; font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.sidenav-foot { margin: 16px 12px 0; font-size: 12px; }
.rail { position: sticky; top: 82px; display: grid; gap: 12px; }
.rail h3 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.mini-rank { display: grid; gap: 2px; }
.mini-rank a { display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 8px; align-items: center; padding: 6px 4px; text-decoration: none; border-radius: 8px; font-size: 13.5px; }
.mini-rank a:hover { background: var(--surface-2); }
.mini-rank b { font-size: 15px; }
.mini-rank .nm { min-width: 0; }
.mini-rank .nm span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mini-rank .nm small { color: var(--ink-3); font-size: 11.5px; }
.mini-rank .t { font-variant-numeric: tabular-nums; font-size: 12.5px; text-align: right; }

@media (max-width: 1280px) { .shell { grid-template-columns: 210px minmax(0, 1fr); } .rail { display: none; } }
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .burger { display: grid; }
  .sidenav { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: 280px; background: var(--bg); padding: 16px 10px; overflow-y: auto; transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--line); align-content: start; }
  .sidenav.open { transform: none; }
  .nav-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 59; display: none; }
  .nav-bg.open { display: block; }
  .ev-title { max-width: 150px; }
  .race-select { max-width: 150px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .ev-title { flex: 1; max-width: none; }
  .gsearch { order: 5; flex-basis: 100%; }
  .race-select { order: 4; max-width: none; flex: 1; }
  #themeBtn { display: none; }
}

/* ---------- briques communes */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 92px; height: 92px; font-size: 30px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--ring, var(--line)); }
.fl { font-size: 15px; line-height: 1; }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-top: 3px; }
.status.finished { background: var(--ok); color: #fff; }
.status.running { background: var(--run); color: #fff; }
.status.dnf, .status.dsq { background: var(--bad); color: #fff; }
.status.dns, .status.waiting { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.status.late { background: var(--warn); color: #fff; }
.bibbox { display: inline-grid; place-items: center; min-width: 46px; padding: 4px 6px; border: 2px solid var(--ink); border-radius: 6px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface); position: relative; }
.bibbox::before, .bibbox::after { content: ""; position: absolute; top: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
.bibbox::before { left: 3px; } .bibbox::after { right: 3px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); text-decoration: none; font-size: 14px; margin-bottom: 10px; }
.page-title { text-align: center; margin: 4px 0 14px; }
.page-title h2 { margin: 6px 0 0; font-size: clamp(22px, 3.2vw, 34px); letter-spacing: -.01em; text-transform: uppercase; line-height: 1.1; }
.state-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.state-pill.done { background: var(--ok); color: #fff; }
.state-pill.live { background: var(--bad); color: #fff; }
.state-pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.state-pill.soon { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; padding: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.facts div { text-align: center; }
.facts span { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.facts b { font-size: 15px; font-variant-numeric: tabular-nums; }
.facts .ok span, .facts .ok b { color: var(--ok); } .facts .bad span, .facts .bad b { color: var(--bad); } .facts .run span, .facts .run b { color: var(--run); }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.section > h3 { margin: 0 0 12px; font-size: 20px; text-align: center; text-transform: uppercase; letter-spacing: .02em; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

/* ---------- accueil : cartes des courses */
.banner { border-radius: 20px; padding: 26px 24px; margin-bottom: 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 92%, #000) 0%, color-mix(in srgb, var(--accent) 55%, #1d4ed8) 100%); }
.banner h2 { margin: 0; font-size: clamp(24px, 4vw, 40px); text-transform: uppercase; letter-spacing: -.01em; line-height: 1.05; }
.banner p { margin: 8px 0 0; opacity: .92; font-weight: 500; }
.banner svg { position: absolute; right: -10px; bottom: -6px; width: 55%; opacity: .25; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); border-top: 5px solid var(--c, var(--accent)); display: grid; gap: 10px; align-content: start; }
.rcard h3 { margin: 0; font-size: 20px; text-transform: uppercase; text-align: center; line-height: 1.15; }
.rcard .when { text-align: center; font-size: 13px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; }
.rcard .kv { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.rcard .kv span { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.rcard .kv b { font-size: 14px; text-transform: uppercase; }
.rcard .counts { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; }
.rcard .counts span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.rcard .counts b { font-variant-numeric: tabular-nums; }
.rcard .pill-top { justify-self: center; margin-top: -4px; }

/* ---------- classement façon tableau riche */
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { text-align: left; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 10px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.rtable td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable tbody tr { cursor: pointer; }
.rtable tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.rtable tbody tr:hover { background: var(--surface-2); }
.rk3 { display: grid; grid-template-columns: auto auto; gap: 0 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.rk3 .big { grid-row: span 3; font-size: 22px; font-weight: 800; color: var(--ink); min-width: 34px; font-variant-numeric: tabular-nums; }
.rk3 .g { font-weight: 700; color: var(--ink); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .nm { min-width: 0; }
.who .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .nm small { display: block; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.tcell b { font-variant-numeric: tabular-nums; }
.tcell small { display: block; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.heart { border: 0; background: none; cursor: pointer; font-size: 20px; color: var(--ink-3); padding: 4px; line-height: 1; }
.heart.on { color: var(--bad); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 10px 4px; font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.pager select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 6px; }
.pager button { border: 0; background: none; font-size: 18px; cursor: pointer; padding: 2px 6px; color: var(--ink); }
.pager button:disabled { color: var(--ink-3); cursor: default; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 10px; }
.filters select, .filters input { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; min-height: 38px; }
.filters input { min-width: 200px; }
@media (max-width: 760px) {
  .rtable thead { display: none; }
  .rtable tr { display: grid; grid-template-columns: 54px 1fr auto; grid-template-areas: "rk who t" "rk who h"; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .rtable td { border: 0; padding: 2px 4px; }
  .rtable td.c-rk { grid-area: rk; } .rtable td.c-who { grid-area: who; min-width: 0; }
  .rtable td.c-t { grid-area: t; text-align: right; } .rtable td.c-h { grid-area: h; text-align: right; }
  .rtable td.c-cat, .rtable td.c-nat, .rtable td.c-x { display: none; }
  .rk3 .sub { display: none; }
  .who .bibbox { display: none; }
  .who .nm small { max-width: 52vw; }
}

/* ---------- fiche coureur */
.rhead { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.rhead h2 { margin: 4px 0 6px; font-size: clamp(24px, 4vw, 38px); line-height: 1.05; letter-spacing: -.01em; }
.ractions { display: flex; gap: 16px; flex-wrap: wrap; }
.ractions button { border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; padding: 4px 0; }
.ractions button.on { color: var(--bad); }
.infoline { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 14px 0; font-weight: 600; color: var(--ink-2); }
.infoline > * + *::before { content: ""; }
.rstats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rstats h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.rstats .ranks { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; }
.rstats .ranks b { font-size: 26px; font-variant-numeric: tabular-nums; }
.rstats .ranks span { color: var(--ink-2); font-weight: 600; margin-left: 4px; }
.rstats .info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 14px; font-size: 13.5px; }
.rstats .info span { color: var(--ink-3); font-weight: 700; font-size: 11.5px; text-transform: uppercase; display: block; }
.rstats .info b { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .rhead { grid-template-columns: 1fr; justify-items: center; text-align: center; } .ractions { justify-content: center; } .rstats { grid-template-columns: 1fr; } }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th { text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); padding: 8px 6px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.ptable td { padding: 9px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ptable td.tl { width: 64px; position: relative; color: var(--ink-3); font-size: 11.5px; text-align: right; padding-right: 22px; }
.ptable td.tl::after { content: ""; position: absolute; right: 7px; top: 0; bottom: 0; width: 2px; background: var(--ok); }
.ptable td.tl::before { content: ""; position: absolute; right: 3px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--ok); z-index: 1; }
.ptable tr.fut td { color: var(--ink-3); font-style: italic; }
.ptable tr.fut td.tl::after, .ptable tr.fut td.tl::before { background: var(--line); }
.ptable tr.nx td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ptable .km { color: var(--ink-3); margin-right: 8px; white-space: nowrap; }
@media (max-width: 640px) { .ptable .c-dplus, .ptable .c-spd { display: none; } .ptable td.tl { width: 30px; padding-right: 16px; font-size: 0; } }
.charts svg { display: block; width: 100%; height: auto; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart-lbl { fill: var(--ink-2); font-size: 11px; font-weight: 700; }
.bar-bad { fill: var(--bad); } .bar-run { fill: var(--run); } .bar-lbl { fill: var(--ink); font-size: 10.5px; font-weight: 700; }

/* ---------- statistiques */
.kpi4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 640px) { .kpi4 { grid-template-columns: repeat(2, 1fr); } }
.hbars { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar .tr { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; position: relative; }
.hbar .tr i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.hbar .tr i.ok { background: var(--ok); }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .hbar { grid-template-columns: 100px 1fr 56px; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.mapbox { height: 420px; border-radius: 14px; border: 1px solid var(--line); z-index: 0; }
.cmp-add { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.chipx { display: inline-flex; gap: 8px; align-items: center; border: 2px solid var(--c); border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 600; font-size: 13.5px; }
.chipx button { border: 0; background: var(--surface-2); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }
.mini-rank .nm .status, .mini-rank .nm .fl { display: inline-block; }
.rail .section > h3 { font-size: 12px; text-align: left; letter-spacing: .08em; color: var(--ink-3); margin: 0; }
@media (max-width: 640px) { .demo-bar .wrap-wide > span:nth-of-type(1) { display: none; } .demo-bar .wrap-wide { gap: 8px; } }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar:has(img) { background: var(--surface-2); }
.notif { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.notif.on { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.notif small { font-size: 12.5px; }
.icon-btn.lang { font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.ractions a { color: var(--ink-2); font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; padding: 4px 0; }
.msg { font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.badge { display: inline-flex; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge.late { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.dnf { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.toast { max-width: min(92vw, 440px); text-align: center; line-height: 1.35; }
.slope-legend { display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-2); margin-left: 10px; flex-wrap: wrap; }
.slope-legend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-left: 4px; }
.grid-2 > * { min-width: 0; overflow-x: auto; }
.cam { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.cam iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.camchips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.camchip { display: grid; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; text-decoration: none; min-width: 150px; background: var(--surface-2); }
.camchip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.camchip small { color: var(--ink-2); }
.m3d { position: fixed; inset: 0; z-index: 90; background: #000; display: grid; grid-template-rows: auto 1fr; }
.m3d-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
#map3d { width: 100%; height: 100%; }
.m3d-cp span { display: inline-block; background: rgba(17,17,17,.8); color: #fff; font: 700 11px/1.2 system-ui, sans-serif; padding: 3px 6px; border-radius: 6px; white-space: nowrap; transform: translateY(-14px); }
.m3d-pin { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font: 800 11px system-ui, sans-serif; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.m3d-pin.lead { background: #f59e0b; } .m3d-pin.fav { background: #e11d48; } .m3d-pin.me { background: #2563eb; width: 32px; height: 32px; }
