/* AlafeelGood — mobile d'abord, gros boutons, contraste élevé.
   Deux thèmes : « sombre » (défaut) et « soleil » (clair très contrasté pour le plein soleil). */
:root {
  --bg: #0B1220;
  --surface: #141D30;
  --surface2: #1E2A44;
  --bord: #2A3754;
  --texte: #F8FAFC;
  --texte2: #AEB9CE;
  --accent: #FFB020;
  --accent-texte: #0B1220;
  --accent-doux: rgba(255, 176, 32, 0.14);
  --ok: #22C55E;
  --alerte: #EF4444;
  --info: #38BDF8;
  --profil-fait: rgba(255, 176, 32, 0.75);
  --profil-reste: rgba(148, 163, 184, 0.32);
  --ombre: 0 6px 20px rgba(0, 0, 0, 0.35);
  --rayon: 18px;
  --onglets-h: 66px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
:root[data-theme="soleil"] {
  --bg: #FFFFFF;
  --surface: #F1F5F9;
  --surface2: #E2E8F0;
  --bord: #94A3B8;
  --texte: #000000;
  --texte2: #1E293B;
  --accent: #C2410C;
  --accent-texte: #FFFFFF;
  --accent-doux: rgba(194, 65, 12, 0.12);
  --ok: #15803D;
  --alerte: #B91C1C;
  --info: #0369A1;
  --profil-fait: rgba(194, 65, 12, 0.8);
  --profil-reste: rgba(51, 65, 85, 0.3);
  --ombre: 0 4px 14px rgba(15, 23, 42, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
.muet { color: var(--texte2); }
.petit { font-size: .85rem; }
.centre { text-align: center; }
.noscript { padding: 2rem; text-align: center; }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

#vue { min-height: 100%; padding-bottom: calc(var(--onglets-h) + var(--sab) + 16px); outline: none; }
body.plein-ecran #vue { padding-bottom: 0; height: 100%; }
body.plein-ecran #onglets { display: none; }
.chargement { padding: 3rem 1rem; text-align: center; color: var(--texte2); }

/* Micro-animations : entrée d'écran, retour au toucher */
.anim-entree { animation: entree .28s ease-out both; }
@keyframes entree { from { transform: translateY(12px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .anim-entree, .anneau-progres { animation: none !important; transition: none !important; } }

/* --- Barre d'onglets --- */
#onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--onglets-h) + var(--sab)); padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--bord);
}
#onglets a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--texte2); text-decoration: none; font-size: .76rem; font-weight: 700; position: relative;
}
#onglets svg { width: 26px; height: 26px; fill: currentColor; transition: transform .2s; }
#onglets a.actif { color: var(--accent); }
#onglets a.actif svg { transform: translateY(-2px) scale(1.1); }
#onglets a.actif::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); }

/* --- Mise en page générale --- */
.page { max-width: 860px; margin: 0 auto; padding: calc(16px + var(--sat)) 16px 16px; }
.entete { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.entete h1 { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bloc, .carte-info { background: var(--surface); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 14px; }
.carte-info.erreur { border: 2px solid var(--alerte); }
.ligne { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ligne.entre { justify-content: space-between; }
.deux-colonnes { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .deux-colonnes { grid-template-columns: 1fr 1fr; } }
.titre-section { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin: 22px 0 10px; }
.titre-section .ico { color: var(--accent); }
.titre-filtre { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; color: var(--texte2); margin: 4px 0 8px; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 14px; border: 0;
  background: var(--surface2); color: var(--texte); font: inherit; font-weight: 700; font-size: 1rem;
  text-decoration: none; cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform .12s, filter .12s, background .2s;
}
.btn:active, .btn-icone:active, .puce:active, .element:active, .carte-parcours:active, .lancer-rond:active { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primaire { background: var(--accent); color: var(--accent-texte); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.danger { background: transparent; box-shadow: inset 0 0 0 2px var(--alerte); color: var(--alerte); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.large { width: 100%; }
.btn.geant { min-height: 62px; font-size: 1.15rem; border-radius: 18px; }
.btn.compact { min-height: 42px; padding: 0 14px; font-size: .92rem; }
.btn .ico { width: 1.3em; height: 1.3em; }
.btn.occupe { position: relative; color: transparent !important; }
.btn.occupe::after { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--accent-texte); border-right-color: transparent; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.btn-icone {
  width: 48px; height: 48px; padding: 0; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--texte); border: 0; cursor: pointer; box-shadow: var(--ombre);
  transition: transform .12s, background .2s;
}
.btn-icone .ico { width: 24px; height: 24px; }
.btn-icone.actif { background: var(--accent); color: var(--accent-texte); }
.btn-icone.sombre { background: rgba(11, 18, 32, .82); color: #fff; }
.btn-icone.sombre.actif { background: var(--accent); color: var(--accent-texte); }
.boutons { display: flex; gap: 10px; flex-wrap: wrap; }
.boutons > .btn { flex: 1 1 140px; }

/* --- Formulaires (réduits au strict nécessaire) --- */
label.champ { display: block; margin-bottom: 14px; }
label.champ > span { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="search"], input[type="password"], input[type="email"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 14px;
  border: 2px solid var(--bord); background: var(--bg); color: var(--texte); font: inherit; font-size: 1rem;
}
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 40px; margin: 0; }
.curseur { margin: 6px 0 12px; }
.curseur .ligne b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.gros-val { font-size: 1rem; color: var(--texte2); }
.gros-val b { font-size: 1.8rem; color: var(--texte); font-variant-numeric: tabular-nums; }
.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 6px 0; border-bottom: 1px solid var(--bord); cursor: pointer; }
.interrupteur small { display: block; color: var(--texte2); font-size: .82rem; }
.interrupteur input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 54px; height: 32px; border-radius: 999px; flex: none;
  background: var(--surface2); position: relative; cursor: pointer; transition: background .2s; box-shadow: inset 0 0 0 2px var(--bord);
}
.interrupteur input[type="checkbox"]::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--texte2); transition: transform .2s, background .2s; }
.interrupteur input[type="checkbox"]:checked { background: var(--accent); box-shadow: none; }
.interrupteur input[type="checkbox"]:checked::after { transform: translateX(22px); background: var(--accent-texte); }

/* --- Puces et segments --- */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puces.defile-h { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; margin: 0 -2px 6px; }
.puces.defile-h::-webkit-scrollbar { display: none; }
.puce {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface2); color: var(--texte); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.puce.actif { background: var(--accent); color: var(--accent-texte); }
.puce.type .ico { color: var(--c); }
.puce.type.actif { background: var(--c); color: #0B1220; }
.puce.type.actif .ico { color: #0B1220; }
.groupe-filtre { margin-bottom: 12px; }
.segments { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface); padding: 4px; border-radius: 14px; }
.segments button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--texte2); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s; }
.segments button.actif { background: var(--accent); color: var(--accent-texte); }
.segments.larges { display: grid; width: 100%; margin: 14px 0; background: var(--surface); }
.segments.larges button { min-height: 58px; font-size: .86rem; flex-direction: column; gap: 2px; line-height: 1.1; }
.segments.larges button .ico { width: 22px; height: 22px; }
.segments.petit button { min-height: 36px; padding: 0 10px; font-size: .84rem; }
.section-reglages .segments { display: grid; width: 100%; margin-bottom: 12px; background: var(--bg); }
.compteur { background: var(--accent); color: var(--accent-texte); border-radius: 999px; padding: 0 8px; font-size: .8rem; margin-left: 6px; }

/* --- Accueil --- */
.heros { display: grid; grid-template-columns: 136px 1fr; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%); border-radius: 22px; padding: 16px; box-shadow: var(--ombre); }
.anneau { width: 136px; height: 136px; display: block; }
.anneau-progres { transition: stroke-dasharray .8s ease-out; }
@keyframes remplir { from { stroke-dasharray: 0 400; } }
.heros-infos .titre-section { margin: 0 0 10px; font-size: 1rem; }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.pastille-info { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: var(--bg); font-size: .86rem; font-weight: 600; white-space: nowrap; }
.pastille-info .ico { color: var(--texte2); }
.pastille-info b { font-weight: 800; }
.pastille-info.type { color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.pastille-info.type .ico, .pastille-info.diff .ico { color: var(--c); }
.pastille-info.diff { color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.heros .pastille-info { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.cta { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin: 14px 0 4px; }

.defile { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 16px 8px; margin: 0 -16px; scrollbar-width: none; }
.defile::-webkit-scrollbar { display: none; }
.rapide { position: relative; flex: 0 0 168px; scroll-snap-align: start; }
.rapide-corps { display: block; background: var(--surface); border-radius: var(--rayon); padding: 8px 8px 12px; color: inherit; text-decoration: none; height: 100%; }
.rapide-apercu { display: block; background: var(--bg); border-radius: 12px; margin-bottom: 8px; }
.rapide-apercu .apercu { width: 100%; height: 84px; display: block; }
.rapide .nom { display: block; font-weight: 700; font-size: .93rem; line-height: 1.25; margin: 0 4px 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rapide .meta { display: flex; gap: 8px; color: var(--texte2); font-size: .82rem; margin: 0 4px; font-weight: 600; }
.lancer-rond { position: absolute; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-texte); display: flex; align-items: center; justify-content: center; box-shadow: var(--ombre); transition: transform .12s; }
.lancer-rond .ico { width: 22px; height: 22px; margin-left: 3px; }
.rapide .lancer-rond { top: 58px; right: 14px; }

.etat-vide { text-align: center; background: var(--surface); border-radius: 22px; padding: 26px 18px; margin: 16px 0; list-style: none; }
.etat-vide .illu { width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-doux); color: var(--accent); }
.etat-vide .illu .ico { width: 52px; height: 52px; }
.etat-vide .boutons { justify-content: center; margin-top: 14px; }

.tuiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
@media (min-width: 640px) { .tuiles { grid-template-columns: repeat(4, 1fr); } }
.tuile { position: relative; background: var(--surface); border-radius: var(--rayon); padding: 14px; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; overflow: hidden; }
.tuile .libelle { color: var(--texte2); font-size: .82rem; font-weight: 700; }
.tuile .valeur { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.tuile .sous { color: var(--texte2); font-size: .8rem; }
.tuile-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); color: var(--c, var(--accent)); }
.tuile-ico .ico { width: 22px; height: 22px; }
.tuile.couleur::after { content: ""; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; background: var(--c); opacity: .09; }
.records .tuile-ico { --c: #FFB020; }
.sessions-compte { margin: 4px 2px 0; }

.graphique { position: relative; height: 210px; }
.graphique.petit { height: 170px; }
.graphique.profil { height: 180px; }

/* --- Listes --- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li + li { margin-top: 10px; }
.element {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 0; border-radius: var(--rayon);
  padding: 12px; color: inherit; text-decoration: none; font: inherit; cursor: pointer; min-height: 68px; transition: transform .12s;
}
.rond-type { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.rond-type .ico { width: 24px; height: 24px; }
.element .corps { flex: 1; min-width: 0; }
.element .nom { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.element .meta { color: var(--texte2); font-size: .84rem; display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; }
.element .meta .ico { width: 14px; height: 14px; margin-right: 2px; }
.element .droite { text-align: right; font-weight: 800; white-space: nowrap; font-size: 1.05rem; }
.element .droite small { display: block; font-weight: 600; color: var(--texte2); font-size: .78rem; }

/* --- Cartes de parcours --- */
.carte-parcours { position: relative; list-style: none; transition: transform .12s; }
.cp-lien { display: flex; gap: 12px; background: var(--surface); border-radius: var(--rayon); padding: 10px; color: inherit; text-decoration: none; border-left: 5px solid var(--diff); min-height: 116px; }
.cp-apercu { flex: none; width: 104px; border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cp-apercu .apercu { width: 104px; height: 96px; }
.cp-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding-right: 44px; }
.cp-haut { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cp-haut .petit { white-space: nowrap; }
.cp-haut .ico { width: 14px; height: 14px; }
.cp-corps .nom { font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-corps .pastilles { gap: 5px; }
.cp-corps .pastille-info { padding: 3px 8px; font-size: .8rem; background: var(--bg); }
.cp-corps .pastille-info .ico { width: 14px; height: 14px; }
.cp-corps .pastille-info.type { background: color-mix(in srgb, var(--c) 16%, transparent); }
.badge-diff { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--diff); }
.carte-parcours .lancer-rond { right: 10px; top: 50%; transform: translateY(-50%); }
.carte-parcours .lancer-rond:active { transform: translateY(-50%) scale(.94); }
.resultats-entete { margin: 6px 0 10px; }

/* --- Cartes Leaflet --- */
.carte { width: 100%; background: var(--surface2); }
.carte-recherche { height: 40vh; min-height: 250px; border-radius: 22px; overflow: hidden; position: relative; box-shadow: var(--ombre); }
.carte-fiche { height: 36vh; min-height: 230px; border-radius: 22px; overflow: hidden; box-shadow: var(--ombre); }
.leaflet-container { font: inherit; background: var(--surface2); }
.leaflet-bar { border: 0 !important; box-shadow: var(--ombre) !important; }
.leaflet-bar a, .leaflet-bar a:hover { width: 42px; height: 42px; line-height: 42px; font-size: 20px; background: var(--surface); color: var(--texte); border-color: var(--bord); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .78) !important; color: #222; }
.leaflet-control-attribution a { color: #0b5394; }
.pastille { border-radius: 50%; display: flex !important; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: #fff; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.55); }
.pastille.depart { background: #16A34A; }
.pastille.arrivee { background: #DC2626; }
.pastille.point { background: #FFB020; color: #0B1220; }
.pastille.choix { background: #2563EB; box-shadow: 0 0 0 6px rgba(37, 99, 235, .3), 0 1px 5px rgba(0,0,0,.5); }
.pastille.survol { background: #0B1220; border-color: #fff; }
.moi-fleche { background: none; border: 0; }
.moi-fleche .fleche { width: 40px; height: 40px; transition: transform .5s; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }

.barre-carte { position: absolute; z-index: 500; display: flex; gap: 8px; }
.barre-carte.haut { top: 10px; left: 10px; right: 10px; }
.barre-carte.bas-droite { right: 10px; bottom: 26px; flex-direction: column; }
.recherche-adresse { position: relative; flex: 1; }
.recherche-adresse .ico-champ { position: absolute; left: 14px; top: 13px; color: var(--texte2); z-index: 1; pointer-events: none; }
.recherche-adresse input { min-height: 48px; padding-left: 44px; border: 0; border-radius: 999px; box-shadow: var(--ombre); background: var(--surface); }
.suggestions { position: absolute; top: 54px; left: 0; right: 0; background: var(--surface); border-radius: 16px; overflow: hidden; z-index: 600; box-shadow: var(--ombre); }
.suggestions button { display: block; width: 100%; text-align: left; min-height: 50px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--bord); background: transparent; color: var(--texte); font: inherit; font-weight: 600; cursor: pointer; }
.suggestions button:last-child { border-bottom: 0; }
.suggestions small { color: var(--texte2); display: block; font-weight: 400; }
.astuce-carte { position: absolute; z-index: 450; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(11, 18, 32, .78); color: #fff; font-size: .8rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }

details.filtres { background: var(--surface); border-radius: var(--rayon); margin: 4px 0 8px; }
details.filtres > summary { min-height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 700; cursor: pointer; list-style: none; }
details.filtres > summary::-webkit-details-marker { display: none; }
details.filtres > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 3px solid var(--texte2); border-bottom: 3px solid var(--texte2); transform: rotate(45deg); transition: transform .2s; }
details.filtres[open] > summary::after { transform: rotate(-135deg); }
details.filtres .contenu { padding: 0 16px 14px; }

/* Rose des vents du générateur */
.rose { position: relative; width: 230px; height: 230px; margin: 4px auto 14px; }
.rose .puce { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; padding: 0; justify-content: center; margin: -28px 0 0 -28px; transform: rotate(var(--a)) translateY(-86px) rotate(calc(-1 * var(--a))); }
.rose .puce:active { transform: rotate(var(--a)) translateY(-86px) rotate(calc(-1 * var(--a))) scale(.94); }
.rose .centre-rose { --a: 0deg; transform: none; font-size: 1.3rem; background: var(--surface2); }
.rose .centre-rose:active { transform: scale(.94); }
.rose::before { content: ""; position: absolute; inset: 26px; border-radius: 50%; border: 2px dashed var(--bord); }

/* --- Fiche parcours / sortie --- */
.stats-vedette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stats-vedette.quatre { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .stats-vedette.quatre { grid-template-columns: repeat(4, 1fr); } }
.stats-vedette > div { background: var(--surface); border-radius: var(--rayon); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.stats-vedette span { color: var(--accent); }
.stats-vedette span .ico { width: 24px; height: 24px; }
.stats-vedette b { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.stats-vedette small { color: var(--texte2); font-weight: 600; font-size: .78rem; }
.lancer { margin-bottom: 14px; }
.stats-fiche { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.stat { background: var(--surface); border-radius: 14px; padding: 10px 6px; text-align: center; min-width: 0; }
.stat .v { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .l { font-size: .74rem; color: var(--texte2); font-weight: 600; }
.legende-pentes { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--texte2); margin-top: 8px; }
.legende-pentes i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }
.description { color: var(--texte2); line-height: 1.55; }
.actions-fiche { margin: 14px 0; }
.bravo-bandeau { display: flex; align-items: center; gap: 10px; background: var(--accent-doux); color: var(--accent); font-weight: 800; font-size: 1.1rem; padding: 14px 16px; border-radius: var(--rayon); margin-bottom: 14px; animation: entree .4s ease-out; }
.bravo-bandeau .ico { width: 28px; height: 28px; }

/* --- Création --- */
.ecran-creer { padding-bottom: 0 !important; }
.creer { display: flex; flex-direction: column; height: calc(100dvh - var(--onglets-h) - var(--sab)); }
.creer .carte { flex: 1; min-height: 200px; position: relative; }
.creer .panneau { background: var(--surface); border-radius: 22px 22px 0 0; margin-top: -18px; position: relative; z-index: 600; padding: 14px 12px 12px; box-shadow: 0 -6px 20px rgba(0,0,0,.25); }
.creer .stats-ligne { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: 6px; }
.creer .stats-ligne .v { font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.creer .stats-ligne .l { font-size: .72rem; color: var(--texte2); font-weight: 700; }
.creer .graphique { height: 92px; margin-bottom: 8px; }
.creer .outils { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.creer .outils .btn { min-height: 56px; padding: 4px; font-size: .8rem; flex-direction: column; gap: 2px; border-radius: 14px; }
.creer .barre-carte.bas-droite { bottom: 34px; }
.aide-creer { position: absolute; z-index: 500; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(11, 18, 32, .86); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 700; pointer-events: none; white-space: nowrap; box-shadow: var(--ombre); animation: flotte 2.4s ease-in-out infinite; }
@keyframes flotte { 50% { transform: translate(-50%, -58%); } }
.indicateur { position: absolute; z-index: 500; top: calc(10px + var(--sat)); left: 50%; transform: translateX(-50%); background: var(--surface); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: .9rem; box-shadow: var(--ombre); white-space: nowrap; }
.indicateur:empty { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  .creer { flex-direction: row; }
  .creer .panneau { width: 46%; max-width: 420px; overflow-y: auto; border-radius: 0; margin-top: 0; }
  .creer .graphique { height: 80px; }
  .creer .barre-carte.bas-droite { bottom: 20px; }
}

/* --- Modales et toasts --- */
.modale-fond { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; padding: 12px; padding-bottom: calc(12px + var(--sab)); animation: fondu .2s; }
@keyframes fondu { from { opacity: 0; } }
@media (min-width: 640px) { .modale-fond { align-items: center; } }
.modale { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 24px; padding: 20px; box-shadow: var(--ombre); animation: monte .25s ease-out; }
@keyframes monte { from { transform: translateY(30px); opacity: .5; } }
.modale-boutons { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modale-boutons .btn { flex: 1 1 120px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--onglets-h) + var(--sab) + 16px); transform: translate(-50%, 30px); z-index: 4000; opacity: 0; pointer-events: none; max-width: calc(100% - 32px); background: var(--texte); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 700; transition: .25s; text-align: center; box-shadow: var(--ombre); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { background: var(--alerte); color: #fff; border-radius: 16px; }
.toast.ok { background: var(--ok); color: #fff; }
body.plein-ecran .toast { bottom: calc(96px + var(--sab)); }

/* --- Réglages --- */
.section-reglages { background: var(--surface); border-radius: var(--rayon); padding: 10px 16px; margin-bottom: 14px; }
.section-reglages h2 { display: flex; align-items: center; gap: 8px; margin: 8px 0 10px; font-size: 1.05rem; }
.section-reglages h2 .ico { color: var(--accent); }
.section-reglages .btn { margin: 5px 0; justify-content: flex-start; }
.section-reglages .interrupteur:last-child { border-bottom: 0; }
.version { text-align: center; color: var(--texte2); font-size: .8rem; margin-top: 10px; }

/* ==========================================================
   VUE GPS DE COURSE — lisible d'un coup d'œil : 4 chiffres géants,
   le reste sur une 2e page (balayage). Portrait : carte en haut ;
   paysage : carte à gauche, compteurs à droite.
   ========================================================== */
.ecran-course { height: 100%; }
.course {
  position: fixed; inset: 0; background: var(--bg);
  display: grid; grid-template-rows: 38% auto 1fr; grid-template-columns: 100%; overflow: hidden;
}
.course .zone-carte { position: relative; overflow: hidden; background: var(--surface2); grid-row: 1; }
.course .progression { grid-row: 2; }
.course .compteurs { grid-row: 3; }
.course .rotateur { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transform-origin: 50% 50%; transition: transform .7s linear; }
.course .rotateur .carte { width: 100%; height: 100%; }
.course .bandeau-haut { position: absolute; top: calc(8px + var(--sat)); left: 8px; right: 8px; z-index: 600; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.course .bandeau-haut > * { pointer-events: auto; }
.course .etat-gps { background: rgba(11, 18, 32, .85); color: #fff; padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.course .gros .v.long { font-size: clamp(2rem, min(11vw, 7vh), 4.4rem); }
.course .gros .v.long span { letter-spacing: -.04em; }
.course .etat-gps.sim { background: #7C3AED; letter-spacing: .05em; font-size: .75rem; }
.course .etat-gps i { width: 10px; height: 10px; border-radius: 50%; background: #94A3B8; display: inline-block; }
.course .etat-gps.bon i { background: #22C55E; }
.course .etat-gps.moyen i { background: #FACC15; }
.course .etat-gps.mauvais i { background: #EF4444; animation: clignote 1s infinite; }
.course #etat-ecran { color: #FACC15; padding: 7px 9px; }
.course .boutons-carte { position: absolute; right: 8px; bottom: 22px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.course .alerte-trace {
  position: absolute; left: 8px; right: 8px; bottom: 22px; z-index: 650; display: none; margin-right: 60px;
  background: var(--alerte); color: #fff; font-weight: 800; font-size: 1.15rem; text-align: center;
  padding: 12px; border-radius: 16px; animation: clignote 1s infinite; align-items: center; justify-content: center; gap: 8px;
}
.course.hors-trace .alerte-trace { display: flex; }
.course.hors-trace .zone-carte { box-shadow: inset 0 0 0 6px var(--alerte); }
@keyframes clignote { 50% { opacity: .6; } }

.course .progression { padding: 10px 12px 6px; background: var(--bg); }
.course .barre { height: 14px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.course .barre > div { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #FFD166); transition: width .6s; }
.course .progression .txt { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; margin-top: 5px; font-variant-numeric: tabular-nums; gap: 6px; color: var(--texte2); }
.course .progression #p-pct { color: var(--texte); font-weight: 800; }

.course .compteurs { display: flex; flex-direction: column; min-height: 0; padding: 4px 10px calc(10px + var(--sab)); gap: 8px; overflow: hidden; }
.course .pages-cpt { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 10px; }
.course .pages-cpt::-webkit-scrollbar { display: none; }
.course .page-cpt { flex: 0 0 100%; scroll-snap-align: start; min-height: 0; display: grid; gap: 8px; }
.course .principaux { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.course .secondaires { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; align-content: stretch; }
.course .gros { background: var(--surface); border-radius: 18px; padding: 8px 12px; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.course .gros .l, .course .petit-cpt .l { display: flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--texte2); text-transform: uppercase; letter-spacing: .04em; }
.course .gros .l .ico { width: 15px; height: 15px; }
.course .gros .v { font-size: clamp(2.4rem, min(14vw, 8.5vh), 5.6rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; white-space: nowrap; transition: color .3s; }
.course .gros .v small { font-size: .3em; font-weight: 700; color: var(--texte2); margin-left: 4px; letter-spacing: 0; }
.course .gros.vitesse .v { color: var(--accent); font-size: clamp(2.8rem, min(17vw, 10vh), 6.4rem); }
.course .gros .s { font-size: .9rem; font-weight: 700; color: var(--texte2); font-variant-numeric: tabular-nums; }
.course .petit-cpt { background: var(--surface); border-radius: 14px; padding: 6px 10px; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.course .petit-cpt .v { font-size: clamp(1.2rem, 5.6vw, 1.9rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course .points-pages { display: flex; justify-content: center; gap: 6px; flex: none; }
.course .points-pages i { width: 8px; height: 8px; border-radius: 50%; background: var(--bord); transition: background .2s, width .2s; }
.course .points-pages i.actif { background: var(--accent); width: 22px; border-radius: 4px; }
.course .mini-profil { height: 58px; flex: none; background: var(--surface); border-radius: 14px; overflow: hidden; }
.course .mini-profil canvas { width: 100%; height: 100%; display: block; }
.course .commandes { display: flex; gap: 10px; flex: none; }
.course .commandes .btn { flex: 1; min-height: 64px; font-size: 1.2rem; border-radius: 18px; }
.course .pause-etat { text-align: center; font-weight: 800; color: var(--accent); flex: none; letter-spacing: .1em; font-size: .9rem; }
.course .pause-etat:empty { display: none; }
.course.en-pause .gros.vitesse .v { opacity: .4; }
.course.libre .avec-parcours { display: none !important; }

@media (orientation: landscape) {
  .course { grid-template-rows: auto 1fr; grid-template-columns: 54% 46%; }
  .course .zone-carte { grid-row: 1 / span 2; grid-column: 1; }
  .course .progression { grid-column: 2; grid-row: 1; padding: calc(8px + var(--sat)) 10px 2px; }
  .course .compteurs { grid-column: 2; grid-row: 2; padding: 4px 10px calc(8px + var(--sab)); gap: 6px; }
  .course .gros { padding: 4px 10px; border-radius: 14px; }
  .course .gros .v { font-size: clamp(2rem, min(7vw, 12vh), 4.6rem); }
  .course .gros.vitesse .v { font-size: clamp(2.3rem, min(8.5vw, 14vh), 5.2rem); }
  .course .petit-cpt .v { font-size: clamp(1rem, 4.6vh, 1.6rem); }
  .course .mini-profil { height: 44px; }
  .course .commandes .btn { min-height: 52px; font-size: 1.05rem; }
  .course .alerte-trace { font-size: 1rem; }
}
@media (orientation: landscape) and (max-height: 430px) {
  .course .mini-profil { display: none; }
  .course .gros .s { display: none; }
  .course .progression .txt { font-size: .8rem; margin-top: 3px; }
  .course .barre { height: 10px; }
}
