/* =========================================================================
   Prochaines courses — feuille de style
   Pensée d'abord pour le téléphone. Thème clair / sombre automatique.
   ========================================================================= */

:root {
  /* Couleurs de base (thème clair) */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --text: #15171c;
  --muted: #5b6270;
  --border: #e0e3e8;
  --border-strong: #b9bec8;
  --link: #1550c0;
  --live: #d6141b;
  --ok: #18794e;
  --ko: #b42318;
  --gold: #c99a06;
  --silver: #8a9099;
  --bronze: #a7652f;
  --badge-ink: #ffffff;
  --shadow: 0 1px 2px rgba(16, 20, 28, 0.06), 0 4px 14px rgba(16, 20, 28, 0.05);

  /* Une couleur par championnat (utilisée partout : étiquettes, cartes, onglets) */
  --c-f1: #d70f0f;
  --c-f2: #c2410c;
  --c-f3: #be185d;
  --c-wrc: #15803d;
  --c-motogp: #1d5fd1;
  --c-moto2: #0369a1;
  --c-moto3: #5b3fd6;

  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

/* Thème sombre : automatique selon le téléphone, ou forcé avec le bouton */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1014;
    --surface: #171a21;
    --surface-2: #222631;
    --text: #eceef2;
    --muted: #a0a8b6;
    --border: #2a2f3a;
    --border-strong: #4a5160;
    --link: #8ab4ff;
    --live: #ff4d4f;
    --ok: #4ade80;
    --ko: #ff8a80;
    --gold: #f2c94c;
    --silver: #c3c8d0;
    --bronze: #d6935a;
    --badge-ink: #0e1014;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --c-f1: #ff5a5a;
    --c-f2: #ff8a4c;
    --c-f3: #f472b6;
    --c-wrc: #4ade80;
    --c-motogp: #6ea0ff;
    --c-moto2: #38bdf8;
    --c-moto3: #a78bfa;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #222631;
  --text: #eceef2;
  --muted: #a0a8b6;
  --border: #2a2f3a;
  --border-strong: #4a5160;
  --link: #8ab4ff;
  --live: #ff4d4f;
  --ok: #4ade80;
  --ko: #ff8a80;
  --gold: #f2c94c;
  --silver: #c3c8d0;
  --bronze: #d6935a;
  --badge-ink: #0e1014;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --c-f1: #ff5a5a;
  --c-f2: #ff8a4c;
  --c-f3: #f472b6;
  --c-wrc: #4ade80;
  --c-motogp: #6ea0ff;
  --c-moto2: #38bdf8;
  --c-moto3: #a78bfa;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  overflow-x: hidden;
}
a {
  color: var(--link);
}
h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}
img,
svg {
  max-width: 100%;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.sep {
  color: var(--muted);
  margin: 0 0.35em;
}
.tbc {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus {
  left: 8px;
}
:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
}
.brand img {
  border-radius: 7px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------- Contenu ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  outline: none;
}
.page-head {
  margin: 8px 0 14px;
}
.page-head h1 {
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}
.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.section {
  margin-top: 26px;
}
.section__title {
  font-size: 1.15rem;
  margin-bottom: 10px;
}
.note {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn--ghost {
  background: transparent;
}

/* ---------- Étiquettes ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--badge-ink);
  background: var(--muted);
  white-space: nowrap;
}
.badge.c-f1 { background: var(--c-f1); }
.badge.c-f2 { background: var(--c-f2); }
.badge.c-f3 { background: var(--c-f3); }
.badge.c-wrc { background: var(--c-wrc); }
.badge.c-motogp { background: var(--c-motogp); }
.badge.c-moto2 { background: var(--c-moto2); }
.badge.c-moto3 { background: var(--c-moto3); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  color: var(--text);
  white-space: nowrap;
}
.tag--small {
  height: 18px;
  font-size: 0.7rem;
  margin-left: 6px;
  font-weight: 600;
}
.tag--light {
  border-color: currentColor;
}
.kind {
  font-size: 1rem;
  line-height: 1;
}
.flag {
  display: inline-block;
  width: 1.33em;
  height: 1em;
  border-radius: 2px;
  vertical-align: -0.12em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex: none;
  object-fit: cover;
}
.flag--unknown {
  text-align: center;
  font-size: 0.75em;
  line-height: 1.33em;
  background: var(--surface-2);
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 6px;
  align-self: stretch;
  min-height: 1.2em;
  border-radius: 3px;
  background: var(--team);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent);
  flex: none;
}
.num {
  display: inline-block;
  min-width: 1.9em;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--muted);
}
.medal {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
  color: #111;
}
.medal--1 { background: var(--gold); }
.medal--2 { background: var(--silver); }
.medal--3 { background: var(--bronze); color: #fff; }
.dnf {
  color: var(--ko);
  font-weight: 600;
}
.ok { color: var(--ok); }
.ko { color: var(--ko); }

/* ---------- EN DIRECT ---------- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--live);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
  flex: none;
}
.rel--live .live-dot {
  background: var(--live);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- Mise en avant (prochaine séance / en direct) ---------- */
.heroes {
  display: grid;
  gap: 12px;
}
.hero {
  display: block;
  position: relative;
  padding: 16px 16px 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--champ, var(--muted));
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, color-mix(in srgb, var(--champ) 14%, transparent), transparent 60%);
  pointer-events: none;
}
.hero--live {
  border-color: color-mix(in srgb, var(--live) 55%, var(--border));
}
.hero__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.hero__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.hero__title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero__sub {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.hero__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.hero__countdown {
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.hero--event {
  margin-bottom: 12px;
}
.countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}
.countdown--big {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--champ, var(--text));
}
.countdown--small {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Séances ---------- */
.day {
  margin-top: 22px;
}
.day__title {
  font-size: 0.95rem;
  margin: 18px 0 8px;
  color: var(--muted);
  font-weight: 700;
}
.day__title::first-letter {
  text-transform: uppercase;
}
.sessions {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.session {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px 12px 12px 14px;
  border-top: 1px solid var(--border);
  position: relative;
}
.session:first-child {
  border-top: 0;
}
.session::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--champ);
}
.session__time strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.session__time small {
  display: block;
  color: var(--muted);
}
.session__main {
  min-width: 0;
}
.session__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 650;
}
.session__event {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session__local {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}
.session__state {
  text-align: right;
  padding-top: 2px;
}
.state-done {
  font-size: 0.8rem;
  color: var(--muted);
}
.session--done {
  opacity: 0.62;
}
.session--live {
  background: color-mix(in srgb, var(--live) 8%, var(--surface));
}

/* ---------- Cartes ---------- */
.cards {
  display: grid;
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 18px;
  position: relative;
  overflow: hidden;
}
.event-card {
  display: block;
  color: var(--text);
  text-decoration: none;
}
.event-card::before,
.team-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--champ, var(--team));
}
.team-card::before {
  background: var(--team);
}
.event-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.event-card__dates {
  font-weight: 700;
}
.event-card__title {
  font-size: 1.1rem;
  margin: 6px 0 4px;
}
.event-card__place {
  margin: 0;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.event-card__place span:first-of-type {
  color: var(--text);
}
.event-card__tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.event-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.rel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  white-space: nowrap;
}
.rel--soon {
  background: color-mix(in srgb, var(--champ, var(--link)) 18%, var(--surface));
}
.rel--live {
  background: color-mix(in srgb, var(--live) 16%, var(--surface));
  color: var(--live);
}
.rel--past {
  color: var(--muted);
}
.podium-mini {
  list-style: none;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.podium-mini li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}
.podium-mini .medal {
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
}

/* ---------- Filtres, onglets ---------- */
.filters {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.chip--on {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.chip--champ {
  border-color: var(--champ);
}
.chip--champ.chip--on {
  background: var(--champ);
  border-color: var(--champ);
  color: var(--badge-ink);
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 12px 0;
  background: var(--surface-2);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.92rem;
  white-space: nowrap;
}
.tab--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.count {
  font-size: 0.75rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 7px;
}
.tab--active .count {
  background: var(--bg);
}

/* ---------- Tableaux ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.results th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results td {
  padding: 9px 8px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.results tr:first-child td {
  border-top: 0;
}
.results th:first-child,
.results td:first-child {
  padding-left: 12px;
  width: 44px;
}
.results td:last-child,
.results th:last-child {
  padding-right: 12px;
}
.results .c {
  text-align: center;
}
.results--race td:nth-child(3),
.results--race th:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}
.results--race td:nth-child(4),
.results--race th:nth-child(4) {
  text-align: right;
  width: 40px;
}
.results--compact td:first-child {
  width: auto;
}
.results .total td {
  font-weight: 700;
  background: var(--surface-2);
}
.who {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
.who__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.who__name {
  font-weight: 650;
}
.who__team {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who__team .flag {
  margin-right: 5px;
}
/* La colonne « Pilote » prend toute la place disponible, le reste s'adapte. */
.results td:has(> .who) {
  width: 100%;
  max-width: 0;
}
.results .num {
  min-width: 0;
  margin-right: 5px;
  font-size: 0.85em;
}
.driver-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
}
.driver-link:hover {
  color: var(--link);
}
.standings td:nth-child(n + 3) {
  white-space: nowrap;
}
.round-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  text-decoration: none;
  max-width: 9.5em;
}
.results .sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.results--driver td,
.results--driver th,
.results--tight td,
.results--tight th {
  padding-left: 5px;
  padding-right: 5px;
}
.results--driver th,
.results--tight th {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}
.results--driver .round-link {
  max-width: 7.6em;
}
.results td.grow {
  width: 100%;
  max-width: 0;
  overflow-wrap: anywhere;
}
.round-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Progression de la saison ---------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}
.progress__bar {
  height: 100%;
  border-radius: 999px;
  background: var(--champ, var(--text));
}
main:has(.tab--active .c-f1) { --champ: var(--c-f1); }
main:has(.tab--active .c-motogp) { --champ: var(--c-motogp); }

/* ---------- Fiche week-end ---------- */
.event-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 5px solid var(--champ);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.event-head h1 {
  font-size: 1.5rem;
  margin: 8px 0 2px;
  letter-spacing: -0.01em;
}
.event-head__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.event-head__place {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 6px 0 2px;
}
.event-head__dates {
  margin: 0;
  font-weight: 700;
}
.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.status--live {
  background: color-mix(in srgb, var(--live) 12%, var(--surface));
}
.status--done {
  font-weight: 700;
}
.podium-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.podium-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--team);
  border-radius: var(--radius-sm);
}
.podium-list li div {
  display: flex;
  flex-direction: column;
}
.facts {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts > div {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.facts > div:first-child {
  border-top: 0;
}
.facts dt {
  color: var(--muted);
  font-size: 0.9rem;
}
.facts dd {
  margin: 0;
}
.facts dd .swatch {
  display: inline-block;
  height: 1em;
  vertical-align: -0.12em;
  margin-right: 4px;
}
.facts dd .flag {
  margin-right: 4px;
}
.facts--inline {
  border: 0;
  background: transparent;
  margin: 8px 0;
}
.facts--inline > div {
  padding: 4px 0;
  border: 0;
  grid-template-columns: 110px 1fr;
}
.entrants {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.entrants li {
  background: var(--surface);
  padding: 9px 12px;
}

/* ---------- Pilotes ---------- */
.driver-grid {
  display: grid;
  gap: 10px;
}
.driver-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.driver-card__num {
  display: grid;
  place-items: center;
  height: 56px;
  border-radius: 10px;
  background: var(--team);
  color: var(--team-ink);
  font-size: 1.45rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 15%, transparent);
}
.driver-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.driver-card__name {
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.driver-card__team {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.driver-card__pts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.95rem;
}
.driver-card__pts small {
  color: var(--muted);
}
.driver-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--team) 0%, color-mix(in srgb, var(--team) 55%, #000) 100%);
  color: var(--team-ink);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.driver-hero__num {
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 1.6ch;
  text-align: center;
}
.driver-hero h1 {
  font-size: 1.45rem;
  font-weight: 500;
  margin: 6px 0 2px;
}
.driver-hero h1 strong {
  font-weight: 900;
}
.driver-hero p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.driver-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.driver-hero .tag {
  border-color: currentColor;
  color: inherit;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stat__value {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Écuries / circuits ---------- */
.team-card__name {
  font-size: 1.1rem;
}
.team-card__drivers {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.team-card__drivers li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}
.circuit-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
}
.track-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px dashed var(--border-strong);
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
  padding: 4px;
}
.circuit-card__name {
  font-size: 1.02rem;
}
.circuit-card p {
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.circuit-card__events {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: grid;
  gap: 4px;
}
.circuit-card__events a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--text);
}

/* ---------- Menu « Plus » et sources ---------- */
.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.menu li + li {
  border-top: 1px solid var(--border);
}
.menu a {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  min-height: 56px;
}
.menu a span {
  color: var(--muted);
  font-size: 0.88rem;
}
.source-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}
.source-card h3 {
  font-size: 1rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.source-card p {
  margin: 4px 0;
}

/* ---------- Écran de mot de passe ---------- */
body.locked .bottom-nav,
body.locked .footer,
body.locked #theme-btn {
  display: none;
}
.lock {
  max-width: 360px;
  margin: 48px auto 0;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  text-align: center;
}
.lock__icon {
  font-size: 2.2rem;
}
.lock h1 {
  font-size: 1.4rem;
}
.lock p {
  margin: 0;
}
.lock input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}
.lock__error {
  color: var(--ko);
  font-weight: 600;
}
.btn--primary {
  background: var(--c-f1);
  border-color: var(--c-f1);
  color: var(--badge-ink);
  min-height: 48px;
}

/* ---------- Pied de page ---------- */
.footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.footer p {
  margin: 6px 0;
}
.footer-warning {
  color: var(--ko);
  font-weight: 600;
}

/* ---------- Navigation du bas ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 650;
  min-width: 0;
}
.bottom-nav svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bottom-nav a.active {
  color: var(--text);
}
.bottom-nav a.active svg {
  stroke: var(--c-f1);
}
.bottom-nav span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ---------- Écrans plus larges ---------- */
@media (min-width: 560px) {
  .driver-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stats {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .heroes {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(560px, 100%);
    transform: translateX(-50%);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
  }
}
@media (max-width: 380px) {
  .session {
    grid-template-columns: 50px 1fr auto;
    gap: 8px;
  }
  .countdown--small {
    display: none;
  }
}
