/* =============================================================================
   Rando Trottinette, design system « Liquid Glass » (Apple 2026, exécution sobre).
   Le verre est un matériau : blur + bord biseauté (highlight haut / ombre bas) + profondeur.
   La carte vit dessous, nette ; l'UI flotte dessus, dépolie. Accent unique : cyan canal.
   ============================================================================= */

:root {
  /* Accent signature : le cyan de l'eau des canaux / RAVeL. */
  --canal:        #3DA9C7;
  --canal-deep:   #1E7E9C;
  --canal-glow:   rgba(61, 169, 199, 0.55);

  /* Encre & neutres froids. */
  --ink:          #0E2A33;
  --ink-soft:     #3A5560;
  --ink-faint:    #6E8992;

  /* Verre clair (au-dessus d'une carte claire). */
  --glass-hi:     rgba(255, 255, 255, 0.62);
  --glass-lo:     rgba(255, 255, 255, 0.30);
  --glass-edge:   rgba(255, 255, 255, 0.75);
  --glass-shade:  rgba(14, 42, 51, 0.10);

  /* Sémantique portée. */
  --ok:           #2F9E6B;
  --warn:         #E0A43B;
  --danger:       #DB5B4B;

  /* Rayons généreux (squircle-like) & profondeur. */
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 13px;
  --shadow-float: 0 10px 34px rgba(14, 42, 51, 0.20), 0 2px 8px rgba(14, 42, 51, 0.12);
  --shadow-raise: 0 20px 60px rgba(14, 42, 51, 0.28);

  --blur: 22px;

  --font-body: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-num:  ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:         #EAF4F7;
    --ink-soft:    #B4CBD3;
    --ink-faint:   #7E99A2;
    --glass-hi:    rgba(28, 44, 52, 0.60);
    --glass-lo:    rgba(20, 34, 40, 0.34);
    --glass-edge:  rgba(255, 255, 255, 0.16);
    --glass-shade: rgba(0, 0, 0, 0.30);
    --shadow-float: 0 10px 34px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Chrome d'UI : pas de flash gris au tap ni de menu « copier » au appui long → sensation native. */
button, .chip, .toggle, .brand, .switch label, .sheet-handle, .details summary, .metric .k {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  /* iOS standalone : un élément `position:fixed` ne peint pas dans la safe-area du bas
     (barre home). Sans fond, la bande sous la carte apparaît blanche. On met le même
     crème que #map (les tuiles Voyager restent claires même en thème sombre) → la bande
     se fond dans la carte au lieu d'un blanc franc. */
  background: #eef0ea;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #eef0ea; /* crème doux « Apple Maps » sous les tuiles Voyager */
}
/* Affinage « Apple 2026 » du fond : on adoucit la saturation et on éclaircit
   légèrement les tuiles Voyager pour un rendu plus tendre et lisible.
   N'affecte que le fond (tile-pane) ; l'isochrone, le tracé et les marqueurs
   vivent dans d'autres panes et restent nets. */
.leaflet-tile-pane { filter: saturate(0.86) brightness(1.04) contrast(0.96); }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: saturate(0.8) brightness(0.92) contrast(0.98); }
}
/* Leaflet : coins/attribution discrets, cohérents avec le verre. */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.6) !important;
  backdrop-filter: blur(6px);
  font-size: 10px !important; border-radius: 8px 0 0 0;
}
.leaflet-bar a {
  background: var(--glass-hi) !important; color: var(--ink) !important;
  backdrop-filter: blur(10px); border-color: var(--glass-edge) !important;
}
.leaflet-bar { border-radius: 12px !important; overflow: hidden; box-shadow: var(--shadow-float); border: none !important; }

/* --- Matériau verre : mixin appliqué par .glass ------------------------------ */
.glass {
  position: relative;
  background: linear-gradient(150deg, var(--glass-hi), var(--glass-lo));
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-md);
  /* Bord biseauté : highlight en haut, ombre en bas + ombre portée = épaisseur. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 var(--glass-shade),
    var(--shadow-float);
}
@media (prefers-color-scheme: dark) {
  .glass { box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    var(--shadow-float); }
}

/* Voile de contraste sous le texte posé sur du verre au-dessus de la carte. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,0.10), transparent 60%);
  pointer-events: none;
}

/* --- Barre de marque (haut) -------------------------------------------------- */
.brand {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); z-index: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 15px 9px 12px;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: radial-gradient(circle at 30% 25%, #66c6de, var(--canal-deep));
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), 0 2px 6px var(--canal-glow);
  display: grid; place-items: center; color: #fff;
}
.brand .mark svg { width: 17px; height: 17px; display: block; }
.brand h1 {
  margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1;
}
.brand span { display: block; font-size: 10.5px; color: var(--ink-faint); letter-spacing: .04em; text-transform: uppercase; margin-top: 3px; }

/* --- Bouton flottant filtres (mobile) --------------------------------------- */
.controls-toggle {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); z-index: 810;
  width: 46px; height: 46px; border: none; cursor: pointer;
  display: none; place-items: center; font-size: 19px; color: var(--ink);
  border-radius: 14px; padding: 0;
}

/* Bouton « ma position en direct » (flottant, coin bas-droit au-dessus du zoom). */
.locate-btn {
  position: fixed; z-index: 500;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 44px; height: 44px; border: none; cursor: pointer;
  display: grid; place-items: center; color: var(--ink); border-radius: 13px; padding: 0;
}
.locate-btn svg { width: 20px; height: 20px; }
.locate-btn[aria-pressed="true"] { color: #fff; background: var(--canal); }
.locate-btn[aria-pressed="true"] svg { color: #fff; }

/* Bouton « mode navigation » (carte orientée), empilé au-dessus de « ma position ». */
.nav-lock {
  position: fixed; z-index: 500;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(148px + env(safe-area-inset-bottom));
  width: 44px; height: 44px; border: none; cursor: pointer;
  display: grid; place-items: center; color: var(--ink); border-radius: 13px; padding: 0;
}
.nav-lock svg { width: 19px; height: 19px; transition: transform .2s; }
.nav-lock[aria-pressed="true"] { color: #fff; background: var(--canal); }
.nav-lock[aria-pressed="true"] svg { color: #fff; }

/* --- Panneau de contrôle (filtres) ------------------------------------------ */
.controls {
  position: fixed; z-index: 480;
  top: calc(66px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  width: 300px; max-width: calc(100vw - 28px);
  padding: 14px; overflow-y: auto;
  max-height: calc(100vh - 84px);                                  /* repli navigateurs sans dvh */
  max-height: calc(100dvh - 84px - env(safe-area-inset-top));
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 12px;
}

/* Poignée de feuille (bottom sheet) : visible seulement en mobile (voir media query). */
.sheet-handle {
  display: none; flex: none; align-self: center;
  position: sticky; top: 0; z-index: 1;
  width: 40px; height: 5px; margin: 0 auto 2px; border-radius: 999px;
  background: var(--ink-faint); opacity: .5; cursor: grab; touch-action: none;
}

/* Voile modal derrière la feuille de filtres (mobile). */
.scrim {
  position: fixed; inset: 0; z-index: 790;
  background: rgba(14, 42, 51, 0.28);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }
/* Liste groupée façon Réglages iOS 2026 (Liquid Glass) : sections titrées, conteneurs
   translucides à coins arrondis, rangées séparées par un filet fin, cibles ≥ 44 px. */
.grp { display: flex; flex-direction: column; gap: 6px; }
/* Titre de section : DOMINANT (plus grand + plus gras que les libellés de rangée). */
.grp-title {
  margin: 0 0 0 4px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--ink);
}
.group {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--glass-edge);
  border-radius: 16px; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
@media (prefers-color-scheme: dark) {
  .group { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
}
.row {
  display: flex; align-items: center; gap: 11px;
  min-height: 44px; padding: 7px 13px;
  border-bottom: 1px solid rgba(14, 42, 51, 0.09);
}
.row:last-child { border-bottom: none; }
@media (prefers-color-scheme: dark) { .row { border-color: rgba(255, 255, 255, 0.09); } }

.row-ic { flex: none; width: 22px; height: 22px; color: var(--canal-deep); }
.row-ic svg { width: 22px; height: 22px; display: block; }
@media (prefers-color-scheme: dark) { .row-ic { color: #79d6ee; } }

.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* Libellé de rangée : SUBORDONNÉ au titre + jamais sur 2 lignes (ellipsis en secours). */
.row-label { font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 11.5px; color: var(--ink-faint); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-start .row-label { font-family: var(--font-num); font-weight: 600; font-size: 13px; letter-spacing: -.01em; }

/* Paire segmentée « Ma position / Sur la carte ». */
.row-seg { gap: 6px; padding: 8px; }
.seg {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 8px; border-radius: 12px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, 0.5); border: 1px solid var(--glass-edge);
  cursor: pointer; transition: background .15s, color .15s, transform .1s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) { .seg { background: rgba(255, 255, 255, 0.08); } }
.seg:active { transform: scale(.97); }
.seg[aria-pressed="true"] { background: var(--canal); border-color: var(--canal-deep); color: #fff; box-shadow: 0 3px 12px var(--canal-glow); }
.seg-ic { width: 16px; height: 16px; flex: none; }
/* Sélecteur véhicule (3 segments) : libellés un peu plus serrés pour tenir sur une ligne. */
.seg.veh { min-width: 0; padding: 0 4px; font-size: 12px; white-space: nowrap; }

/* Rangée interrupteur (toute la rangée cliquable) et rangée saisie. */
.row-toggle { cursor: pointer; }
.row-toggle .row-label { flex: 1; min-width: 0; }
.row-input .row-label { flex: 1; min-width: 0; }

/* Rangée-lien (ex. « Statistiques » admin) : toute la rangée cliquable, chevron à droite. */
.row[hidden] { display: none; } /* display:flex écrase l'attribut hidden sinon */
.row-link { text-decoration: none; color: inherit; cursor: pointer; }
.row-link .row-label { font-weight: 600; }
.row-chevron { flex: none; font-size: 20px; color: var(--ink-faint); line-height: 1; }

/* Bouton d'action textuel en fin de rangée (ex. « Déconnexion » dans la rangée Compte). */
.row-account .row-label { font-weight: 600; }
.row-action {
  flex: none; border: none; background: none; cursor: pointer; padding: 6px 2px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--canal-deep);
}
.row-action:active { opacity: .6; }
@media (prefers-color-scheme: dark) { .row-action { color: #79d6ee; } }

/* Rangée saisie géocodage (champ borderless + bouton « ma position » optionnel). */
.row-geo input[type="search"] {
  flex: 1; min-width: 0; border: none; background: none; padding: 0; margin: 0;
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.row-geo input::placeholder { color: var(--ink-faint); }
.row-geo input:focus { outline: none; }
.row-geo input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.geo-loc {
  flex: none; width: 30px; height: 30px; padding: 0; border: none; cursor: pointer;
  display: grid; place-items: center; border-radius: 9px; color: var(--canal-deep);
  background: rgba(61,169,199,0.12);
}
.geo-loc svg { width: 17px; height: 17px; }
.geo-loc:active { transform: scale(.94); }
@media (prefers-color-scheme: dark) { .geo-loc { color: #79d6ee; } }

/* Option « Aller simple » (sous les champs Départ/Arrivée) : n'est active qu'avec une
   adresse d'arrivée saisie ; grisée et non cliquable sinon. */
.group-oneway { margin-top: 6px; }
.row-oneway { cursor: pointer; }
.row-oneway .row-main { flex: 1; min-width: 0; }
.row-oneway[aria-disabled="true"] { opacity: .5; cursor: default; }
.row-oneway[aria-disabled="true"] .toggle input { cursor: default; }

/* Suggestions de géocodage (liste groupée tappable). */
.geo-results {
  list-style: none; margin: 0; padding: 0;
  background: rgba(255, 255, 255, 0.55); border: 1px solid var(--glass-edge);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-float);
}
.geo-results[hidden] { display: none; }
@media (prefers-color-scheme: dark) { .geo-results { background: rgba(28, 44, 52, 0.85); } }
.geo-results li {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; cursor: pointer;
  font-size: 13px; color: var(--ink);
  border-bottom: 1px solid rgba(14, 42, 51, 0.08);
}
.geo-results li:last-child { border-bottom: none; }
.geo-results li:hover, .geo-results li[aria-selected="true"] { background: rgba(61, 169, 199, 0.12); }
@media (prefers-color-scheme: dark) { .geo-results li { border-color: rgba(255,255,255,0.08); } }
.geo-results .g-ic { flex: none; width: 15px; height: 15px; color: var(--canal-deep); }
.geo-results .g-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { display: inline-flex; align-items: center; gap: 6px; }
.row-value input[type="number"] {
  width: 60px; text-align: right; padding: 7px 9px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}
@media (prefers-color-scheme: dark) { .row-value input[type="number"] { background: rgba(255, 255, 255, 0.08); } }
.row-value em { font-style: normal; font-family: var(--font-num); font-size: 11.5px; color: var(--ink-faint); min-width: 34px; }

.btn.block { display: flex; width: 100%; justify-content: center; margin-top: 2px; }

input[type="time"], input[type="number"], select {
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,0.35); border: 1px solid var(--glass-edge);
  border-radius: var(--r-sm); padding: 9px 11px; width: 100%;
}
@media (prefers-color-scheme: dark) {
  input[type="time"], input[type="number"], select { background: rgba(255,255,255,0.06); color: var(--ink); }
}
input[type="number"] { font-family: var(--font-num); }

/* Puces catégories */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 6px 11px 6px 8px; border-radius: 999px; cursor: pointer; user-select: none;
  border: 1px solid var(--glass-edge); background: rgba(255,255,255,0.28); color: var(--ink-soft);
  transition: background .15s, color .15s, border-color .15s;
}
.chip-ic { width: 15px; height: 15px; flex: none; } /* glyphe monochrome = couleur du texte (currentColor) */
.chip[aria-pressed="true"] {
  background: var(--canal); border-color: var(--canal-deep); color: #fff;
  box-shadow: 0 2px 8px var(--canal-glow);
}

/* Interrupteur (style iOS) */
.toggle { position: relative; width: 42px; height: 25px; flex: none; }
.toggle input { position: absolute; z-index: 2; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--glass-shade);
  border: 1px solid var(--glass-edge); transition: background .18s;
  pointer-events: none; /* laisse passer le clic vers l'input dessous */
}
.toggle .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
}
.toggle input:checked + .track { background: var(--canal); }
.toggle input:checked + .track::after { transform: translateX(17px); }

/* --- Pastille batterie / portée : le héros ---------------------------------- */
.battery {
  position: fixed; z-index: 520;   /* au-dessus des boutons flottants (nav/position, z 500) quand la pastille est dépliée */
  left: calc(14px + env(safe-area-inset-left));
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: 340px; max-width: calc(100vw - 28px); padding: 16px 18px 15px;
}
.battery .head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: default;
}
.battery .chev { display: none; color: var(--ink-faint); font-size: 12px; transition: transform .2s; }
.battery .title { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.battery .verdict-tag {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em;
}
.verdict-tag.ok     { background: rgba(47,158,107,.16); color: var(--ok); }
.verdict-tag.warn   { background: rgba(224,164,59,.18); color: var(--warn); }
.verdict-tag.danger { background: rgba(219,91,75,.18);  color: var(--danger); }
.verdict-tag.idle   { background: var(--glass-shade); color: var(--ink-faint); }

.gauge { margin: 14px 0 10px; }
.gauge svg { width: 100%; height: 46px; display: block; overflow: visible; }

/* Profil altimétrique (sous la jauge) */
.elevation { margin: 4px 0 0; padding: 0; }
.elevation[hidden] { display: none; }
.elevation svg { width: 100%; height: 54px; display: block; overflow: visible; }

.battery .readout { display: flex; gap: 16px; flex-wrap: wrap; }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric .v { font-family: var(--font-num); font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.metric .k { font-size: 10.5px; color: var(--ink-faint); letter-spacing: .03em; }
.metric .v small { font-size: 11px; color: var(--ink-faint); font-weight: 500; }
.metric.neg .v { color: var(--danger); }

.battery .foot { margin-top: 12px; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
/* Faits (ligne discrète) + avertissements (empilés, colorés), remplace le paragraphe fourre-tout. */
.battery .facts { margin-top: 11px; font-size: 11.5px; color: var(--ink-faint); line-height: 1.6; }
.battery .warns { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.4; }

/* Actions itinéraire (export GPX) */
.battery-actions { margin-top: 12px; display: flex; gap: 8px; }
.battery-actions[hidden] { display: none; } /* sinon display:flex écrase l'attribut hidden */
.battery-actions .btn { font-size: 12.5px; }

/* Feuille de route : liste des arrêts cliquable, distances cumulées */
.roadmap-h { margin: 12px 0 6px; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.roadmap { list-style: none; margin: 0; padding: 0; max-height: 176px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 2px; }
.roadmap li { display: flex; align-items: center; gap: 9px; padding: 5px 7px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.roadmap li:hover, .roadmap li:focus-visible { background: rgba(61,169,199,.12); }
.roadmap .n {
  flex: none; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: var(--canal); color: #fff; font: 700 11px/1 var(--font-num);
}
.roadmap li.dest .n { background: var(--canal-deep); box-shadow: 0 0 0 2px var(--canal-glow); }
.roadmap .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink); }
.roadmap .km { flex: none; font-family: var(--font-num); font-size: 11.5px; color: var(--ink-faint); }
.battery .foot b { color: var(--ink); font-weight: 700; }
.battery .foot .alert { color: var(--warn); }
.battery .recharge { display: inline-flex; align-items: center; gap: 5px; color: var(--canal-deep); font-weight: 600; }
@media (prefers-color-scheme: dark) { .battery .recharge { color: #79d6ee; } }

.battery .spec {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.5) 48%, transparent 66%);
}
.battery.pulse .spec { animation: sweep .9s ease-out 1; }
@keyframes sweep { from { opacity: .0; transform: translateX(-30%); } 25% { opacity: .9; } to { opacity: 0; transform: translateX(30%); } }

/* --- Détail POI / résultat (info-bulle marqueur enrichie via panneau) -------- */
.poi-card { min-width: 210px; font-family: var(--font-body); color: var(--ink); }
.poi-card h3 { margin: 0 0 4px; font-size: 15px; letter-spacing: -.01em; }
.poi-card .cat { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--canal-deep); font-weight: 700; }
.poi-card .meta { margin: 8px 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.poi-card .status { font-weight: 700; }
.poi-card .status.open { color: var(--ok); }
.poi-card .status.closed { color: var(--danger); }
.poi-card .status.unknown { color: var(--warn); }
.poi-card .note { font-size: 12px; color: var(--ink-faint); font-style: italic; margin: 6px 0; }
.poi-card .actions { display: flex; gap: 8px; margin-top: 10px; }

.btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: var(--r-sm); padding: 9px 13px; border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,0.4); color: var(--ink); transition: transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--canal); border-color: var(--canal-deep); color: #fff; box-shadow: 0 3px 12px var(--canal-glow); }
.btn.primary.ok { background: var(--ok); border-color: var(--ok); box-shadow: 0 3px 12px rgba(47,158,107,.4); }
.btn.ghost { background: transparent; }

/* --- Focus visible & mouvement réduit --------------------------------------- */
:focus-visible { outline: 2.5px solid var(--canal); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .battery.pulse .spec { display: none; }
}

/* --- Marqueurs POI façon Apple Maps ----------------------------------------- */
/* Pastille blanche à anneau coloré par catégorie ; l'atteignabilité se lit à la
   vivacité (net = atteignable, désaturé/estompé = hors zone). */
/* Pastille pleine colorée + glyphe SVG blanc (style Apple Maps), anneau blanc fin. */
.poi-dot {
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c, #9aa0a8);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(14,42,51,.28), 0 3px 8px rgba(14,42,51,.22);
  transition: transform .12s ease, box-shadow .12s ease;
}
.poi-dot svg { width: 14px; height: 14px; display: block; }
.poi-dot.far     { filter: saturate(.12) brightness(1.04); opacity: .6; box-shadow: 0 1px 3px rgba(14,42,51,.16); }
/* Bande limite (v2) : atteignabilité pas encore tranchée → halo pointillé, plein conservé. */
.poi-dot.pending { outline: 1.6px dashed var(--c); outline-offset: 1.5px; }
.poi-dot.visited { opacity: .45; }
.poi-dot.selected {
  transform: scale(1.22);
  box-shadow: 0 0 0 4px var(--canal-glow), 0 4px 12px rgba(14,42,51,.32);
  z-index: 1000;
}
/* Palette catégories, teintes douces harmonisées (esprit Apple Maps). */
.cat-classe     { --c: #8E63CE; }
.cat-patrimoine { --c: #B07A45; }
.cat-nature     { --c: #42A85F; }
.cat-musee      { --c: #D2609B; }
.cat-plan_eau   { --c: #3E8FD0; }
.cat-terril     { --c: #7E7C88; }
.cat-terrasse   { --c: #E1873C; }
.cat-loisir     { --c: #E45C68; }
.cat-ferme      { --c: #8FA53E; }
.cat-velo       { --c: #2FA9A0; }
/* Pastille de regroupement (clustering) : cercle cyan + nombre, clic pour zoomer. */
.cluster {
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--canal); color: #fff; border: 2.5px solid #fff;
  font: 700 13px/1 var(--font-num);
  box-shadow: 0 1px 3px rgba(14,42,51,.35), 0 3px 9px rgba(14,42,51,.24);
  transition: transform .1s ease;
}
.cluster:hover { transform: scale(1.06); }
.cluster-l { font-size: 14px; background: var(--canal-deep); }

/* Marqueur de départ = maison (glissable). */
.start-home {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--ink); color: #fff; border: 2.5px solid #fff;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(14,42,51,.5);
}
.start-home svg { width: 15px; height: 15px; display: block; }

/* Position en direct (GPS) : point bleu type « you are here » + halo. */
.live-dot {
  width: 100%; height: 100%; border-radius: 50%;
  background: #2A7DE1; border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px rgba(42,125,225,.35), 0 1px 4px rgba(0,0,0,.4);
}
.live-dot::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  background: rgba(42,125,225,.22); animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; opacity: .3; } }
/* Cône de direction (mode navigation) : faisceau qui part de la position vers le regard.
   La rotation est portée par --cone (angle écran) ; le sommet est au centre de l'icône. */
.nav-cone {
  width: 100%; height: 100%; pointer-events: none;
  transform-origin: 50% 50%; transform: rotate(var(--cone, 0deg));
  transition: transform .12s linear; will-change: transform;
}
.nav-cone svg { display: block; }
@media (prefers-reduced-motion: reduce) { .nav-cone { transition: none; } }
/* Arrêts numérotés d'une boucle « intéressante » (ordre de passage) */
.tour-stop {
  width: 100%; height: 100%; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--canal-deep); box-shadow: 0 1px 4px rgba(14,42,51,.45);
  display: grid; place-items: center;
  font: 700 12px/1 var(--font-num); color: var(--canal-deep);
}
.tour-stop.dest {
  background: var(--canal-deep); border-color: #fff; color: #fff;
  box-shadow: 0 0 0 3px var(--canal-glow), 0 1px 4px rgba(14,42,51,.45);
}

/* Toast */
.toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 1000; /* au-dessus de la feuille (800) et du voile (790) : sinon invisible sur mobile */
  padding: 11px 18px; font-size: 13px; font-weight: 600; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* --- Responsive mobile : la feuille de filtres devient un « bottom sheet » iOS -- */
@media (max-width: 640px) {
  .controls-toggle { display: grid; }

  /* Feuille ancrée en bas, coins arrondis, glisse depuis le bas (transform animé).
     Reste dans le DOM (pas display:none) pour animer + garder le focus gérable via inert. */
  .controls {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: 100%;
    border-radius: 26px 26px 0 0;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    max-height: 86vh; max-height: 86dvh; gap: 14px; z-index: 800;
    transform: translateY(102%);
    transition: transform .34s cubic-bezier(.32, .72, 0, 1);
    pointer-events: none;
  }
  .controls.open { transform: none; pointer-events: auto; }
  .sheet-handle { display: block; }

  /* Cibles tactiles plus généreuses (Apple HIG ~44px). */
  .chip { padding: 9px 13px 9px 10px; font-size: 12.5px; }
  .btn { padding: 11px 14px; }

  .battery {
    left: 10px; right: 10px; width: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
  /* Replié par défaut : simple barre (titre + verdict), la carte reste dégagée.
     Un tap sur l'en-tête déplie ; un tracé déplie automatiquement (voir app.js). */
  .battery .head { cursor: pointer; }
  .battery .chev { display: inline-block; }
  .battery.collapsed .chev { transform: rotate(180deg); }
  .battery.collapsed .gauge,
  .battery.collapsed .readout,
  .battery.collapsed .elevation,
  .battery.collapsed .foot,
  .battery.collapsed .battery-actions { display: none; }
  .brand span { display: none; }

  /* Zoom natif au pinch → on masque les boutons +/- pour un rendu carte épuré. */
  .leaflet-control-zoom { display: none; }
}

/* Le voile n'existe qu'en mode feuille (mobile). */
@media (min-width: 641px) { .scrim { display: none !important; } }

/* --- Portail d'authentification (connexion / inscription) ------------------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 1200; /* au-dessus de tout (feuille 800, toast 1000) */
  display: grid; place-items: center; padding: 24px;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 80% at 50% -10%, var(--canal-glow), transparent 60%),
    var(--bg, #eef0ea);
  overflow-y: auto;
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: 100%; max-width: 380px; border-radius: var(--r-lg, 22px);
  padding: 26px 22px 20px; display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.auth-brand .mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 30% 25%, #66c6de, var(--canal-deep));
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), 0 3px 10px var(--canal-glow);
}
.auth-brand .mark svg { width: 24px; height: 24px; }
.auth-brand h1 { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.auth-brand p { margin: 0; font-size: 12px; color: var(--ink-faint); }

.auth-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 13px; background: var(--glass-lo); border: 1px solid var(--glass-edge); }
.auth-tabs[hidden] { display: none; } /* display:flex écrase l'attribut hidden sinon */
.auth-tab {
  flex: 1; font-family: var(--font-body); font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 0; background: transparent; color: var(--ink-soft); padding: 8px 6px; border-radius: 10px;
  transition: background .15s, color .15s;
}
.auth-tab.is-active { background: var(--canal); color: #fff; box-shadow: 0 2px 8px var(--canal-glow); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field[hidden] { display: none; } /* sinon display:flex écrase l'attribut hidden (invite = register only) */
.auth-field span { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); padding-left: 2px; }
.auth-field input {
  font-family: var(--font-body); font-size: 16px; /* ≥16px : pas de zoom auto iOS au focus */
  color: var(--ink); background: rgba(255,255,255,0.5); border: 1px solid var(--glass-edge);
  border-radius: var(--r-sm, 12px); padding: 11px 13px; width: 100%;
}
.auth-field input:focus { outline: none; border-color: var(--canal); box-shadow: 0 0 0 3px var(--canal-glow); }
.auth-error { margin: 0; font-size: 13px; font-weight: 600; color: #C0392B; text-align: center; }
.auth-error[hidden] { display: none; }
.auth-info { margin: 0; font-size: 13px; font-weight: 600; color: var(--canal-deep); text-align: center; line-height: 1.45; }
.auth-info[hidden] { display: none; }
.auth-form .btn { padding: 12px; font-size: 14px; }
.auth-links { display: flex; justify-content: center; }
.auth-link {
  border: none; background: none; cursor: pointer; padding: 2px 4px;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600; color: var(--canal-deep);
}
.auth-link[hidden] { display: none; }
.auth-link:active { opacity: .6; }
.auth-note { margin: 0; font-size: 11.5px; color: var(--ink-faint); text-align: center; line-height: 1.5; }

@media (prefers-color-scheme: dark) {
  .auth-field input { background: rgba(255,255,255,0.08); }
  .auth-error { color: #FF8A80; }
  .auth-info, .auth-link { color: #79d6ee; }
}
