/* ── Reset & variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:   #52b788;
  --green-d: #1f6b45;
  --red:     #e63946;
  --blue:    #4361ee;
  --orange:  #f4a261;
  --bg:      #111b11;
  --surf:    #192519;
  --surf2:   #223022;
  --text:    #e8f0e8;
  --muted:   #8aaa8a;
  --border:  rgba(255,255,255,0.08);
  --radius:  18px;
  --safe-b:  env(safe-area-inset-bottom, 0px);
  --safe-t:  env(safe-area-inset-top,    0px);
  --sheet-peek: 76px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

input, textarea, select {
  font-size: 16px;
}

/* ── Carte ─────────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

.leaflet-container {
  touch-action: none;
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: var(--safe-t);
  left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px;
  background: rgba(17, 27, 17, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  touch-action: pan-y;
  overscroll-behavior: contain;
}

#search-wrap {
  flex: 1 1 0%;   /* flex-basis: 0 → peut rétrécir sous sa taille intrinsèque */
  min-width: 0;   /* empêche le débordement du champ input */
  position: relative;
  display: flex;
  gap: 6px;
}

#search-input {
  flex: 1 1 0%;     /* peut rétrécir librement */
  min-width: 60px;  /* plancher raisonnable */
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
#search-input::placeholder { color: var(--muted); }
#search-input::-webkit-search-cancel-button { display: none; }

#search-btn,
#settings-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
#search-btn svg, #settings-btn svg { width: 18px; height: 18px; }

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  z-index: 300;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.result-item {
  padding: 13px 16px;
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}
.result-item:last-child { border-bottom: none; }
.result-item:active { background: var(--surf2); }

/* ── Bouton GPS (dans topbar) ──────────────────────────────────────────────── */
#locate-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  gap: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-d);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}
#locate-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
#locate-btn.locating { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Feuille basse ─────────────────────────────────────────────────────────── */
#sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--surf);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 30px rgba(0,0,0,0.5);
  max-height: 82vh;
  overflow: hidden; /* jamais de scroll sur le sheet lui-même */
  display: flex;
  flex-direction: column;
  /* Fermée par défaut : on garde une vraie poignée visible et stable */
  transform: translateY(calc(100% - var(--sheet-peek)));
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  touch-action: pan-y;
  overscroll-behavior: contain;
}
#sheet.open {
  transform: translateY(0);
}

/* Zone scrollable sous le handle — scroll désactivé quand la feuille est fermée */
#sheet-scroll {
  flex: 1;
  overflow: hidden; /* bloqué quand fermé : le handle ne peut plus disparaître */
  overscroll-behavior: contain;
  padding-bottom: var(--safe-b);
  min-height: 0;
}
#sheet.open #sheet-scroll {
  overflow-y: auto; /* scroll uniquement quand la feuille est ouverte */
}
#sheet-scroll::-webkit-scrollbar { width: 0; }

/* ── Handle — bouton natif pour compatibilité iOS Safari ──────────────────── */
#sheet-handle {
  width: 100%;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* reset styles bouton */
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.handle-bar {
  width: 38px; height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.handle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.chevron {
  width: 16px; height: 16px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
#sheet.open .chevron {
  transform: rotate(180deg);
}

/* ── Résumé du circuit ─────────────────────────────────────────────────────── */
#route-summary {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 14px 10px 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.stat-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Barre de surface ─────────────────────────────────────────────────────── */
#surface-bar {
  display: flex;
  height: 8px;
  margin: 0 16px 4px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surf2);
}
.bar-road  { background: var(--red);    transition: width .4s; }
.bar-cycle { background: var(--blue);   transition: width .4s; }
.bar-trail { background: var(--green);  transition: width .4s; }

#surface-legend {
  display: flex;
  gap: 14px;
  padding: 0 16px 10px;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.leg {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.leg::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
}
.leg-road::before  { background: var(--red); }
.leg-cycle::before { background: var(--blue); }
.leg-trail::before { background: var(--green); }

/* ── Corps de la feuille ───────────────────────────────────────────────────── */
#sheet-body {
  padding: 14px 16px 20px;
}

/* ── Onglets de mode ───────────────────────────────────────────────────────── */
#mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.tab.active {
  background: var(--green-d);
  border-color: var(--green-d);
  color: #fff;
  font-weight: 700;
}

/* ── Panneaux ──────────────────────────────────────────────────────────────── */
.hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 12px;
}
.hint em { font-style: normal; color: var(--text); }

/* ── Liste des waypoints ───────────────────────────────────────────────────── */
#wp-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 8px;
}
.wp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.wp-icon { font-size: 16px; flex-shrink: 0; }
.wp-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wp-del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.wp-del:active { color: var(--red); }

.departure-history {
  margin: 9px 0 2px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}
.departure-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.departure-history-list {
  display: grid;
  gap: 7px;
  max-height: 39px;
  overflow: hidden;
  padding-right: 2px;
}
.departure-history.expanded .departure-history-list {
  max-height: 170px;
  overflow-y: auto;
}
.departure-history-list::-webkit-scrollbar { width: 0; }
.departure-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
}
.departure-chip {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(82,183,136,0.35);
  border-radius: 8px;
  background: rgba(82,183,136,0.1);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.departure-chip:active {
  background: rgba(82,183,136,0.22);
}
.departure-delete,
.departure-clear,
.departure-toggle {
  border: 1px solid rgba(230,57,70,0.32);
  background: rgba(230,57,70,0.08);
  color: var(--red);
  cursor: pointer;
}
.departure-delete {
  width: 34px; height: 32px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
}
.departure-clear,
.departure-toggle {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.departure-toggle {
  margin-left: auto;
  border-color: rgba(82,183,136,0.35);
  background: rgba(82,183,136,0.08);
  color: var(--green);
}
.departure-delete:active,
.departure-clear:active,
.departure-toggle:active {
  background: rgba(230,57,70,0.18);
}
.departure-toggle:active {
  background: rgba(82,183,136,0.18);
}

/* ── Label au-dessus des steppers ─────────────────────────────────────────── */
.input-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 10px 0 0;
  text-align: center;
}

/* ── Sélecteur de distance ─────────────────────────────────────────────────── */
.input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 8px 0 4px;
}
.btn-round {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surf2);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-round:active { background: var(--green-d); }
.dist-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#dist-val {
  font-size: 48px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -2px;
  min-width: 72px;
  text-align: center;
}
.dist-unit {
  font-size: 18px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Sélecteur de pas d'incrémentation (± 1 km / ± 5 km) ─────────────────── */
.dist-step-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 6px;
}
.dist-step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-right: 4px;
}
.btn-step {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surf2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-step:active {
  background: var(--green-d);
  color: #fff;
}
.btn-step-active {
  border-color: rgba(82, 183, 136, 0.6);
  background: rgba(82, 183, 136, 0.18);
  color: var(--green);
}

/* ── Point de départ (non-supprimable dans la liste) ──────────────────────── */
.wp-dep {
  border-color: rgba(82, 183, 136, 0.4);
  background: rgba(31, 107, 69, 0.25);
}
.wp-dep .wp-name { color: var(--green); font-weight: 600; }

/* ── Boutons ───────────────────────────────────────────────────────────────── */
#calc-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

#calc-actions .btn-primary,
#calc-actions .btn-secondary,
#calc-actions .btn-ghost {
  margin-top: 0;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 14px;
  background: var(--green-d);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: opacity .15s;
}
.btn-primary:active { opacity: .8; }

.btn-secondary {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 14px;
  background: #74c69d;
  border: none;
  border-radius: 14px;
  color: #062013;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: opacity .15s;
}
.btn-secondary:active { opacity: .82; }

.btn-ghost {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.btn-ghost:active { background: var(--surf2); }

.btn-tag {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 20px;
  color: var(--green);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-tag:active { background: var(--green-d); color: #fff; }

/* ── Actions tracé (Effacer + GPX) ────────────────────────────────────────── */
#route-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
#route-actions .btn-ghost {
  margin-top: 0;
}
#reverse-loop-btn {
  grid-column: 1 / -1;
}

.loop-choices {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.loop-choice {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border: 1px solid color-mix(in srgb, var(--loop-color) 34%, rgba(255,255,255,0.12));
  border-left: 5px solid var(--loop-color);
  border-radius: 8px;
  background: rgba(255,255,255,0.055);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--loop-color) 18%, transparent), rgba(255,255,255,0.045) 42%),
    rgba(255,255,255,0.055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.loop-choice.active {
  background: rgba(255,255,255,0.12);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--loop-color) 30%, transparent), rgba(255,255,255,0.1) 48%),
    rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
  border-color: color-mix(in srgb, var(--loop-color) 58%, rgba(255,255,255,0.3));
  border-left-color: var(--loop-color);
}
.loop-choice-num {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--loop-color);
  border: 3px solid var(--loop-color);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}
.loop-choice-main,
.loop-choice-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.loop-choice-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.loop-choice-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}
.loop-choice-side {
  align-items: flex-end;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.loop-choice-road,
.loop-choice-access {
  color: var(--red);
  font-weight: 800;
}
.loop-part-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: -3px;
  margin-bottom: 3px;
  padding-left: 47px;
}
.loop-part-choice {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(82, 183, 136, 0.32);
  border-radius: 8px;
  background: rgba(82, 183, 136, 0.11);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.loop-part-choice span,
.loop-part-choice strong,
.loop-part-choice small {
  display: block;
  min-width: 0;
}
.loop-part-choice span {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}
.loop-part-choice strong {
  margin-top: 2px;
  font-size: 12px;
}
.loop-part-choice small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.loop-part-choice.active {
  background: rgba(82, 183, 136, 0.24);
  border-color: var(--green);
}
@media (max-width: 420px) {
  .loop-choice {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .loop-choice-side {
    grid-column: 2;
    align-items: flex-start;
    white-space: normal;
  }
  .loop-part-actions {
    padding-left: 0;
  }
}

/* ── Bouton suivi GPS ──────────────────────────────────────────────────────── */
#track-btn.tracking {
  border-color: var(--green);
  color: var(--green);
}

/* ── Section circuits sauvegardés ─────────────────────────────────────────── */
#saved-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.saved-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 7px;
  cursor: pointer;
}
.saved-item:active { background: var(--surf); }
.saved-info { flex: 1; min-width: 0; }
.saved-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.saved-del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px;
}
.saved-del:active { color: var(--red); }
.empty-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
}

/* ── Modale paramètres ─────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: flex-end;
  padding-bottom: var(--safe-b);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.modal[hidden] { display: none; }

.modal-box {
  background: var(--surf);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 20px 24px;
  width: 100%;
}
.modal-box h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}
.modal-box input {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  outline: none;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Loading ───────────────────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#loading[hidden] { display: none; }
#loading p { font-size: 15px; color: var(--text); }

.spinner {
  width: 52px; height: 52px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 700;
  background: rgba(20,35,20,0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s, transform .25s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Marqueurs Leaflet custom ──────────────────────────────────────────────── */
.lf-wp {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  background: var(--green-d);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.lf-wp.start { background: var(--green); }
.lf-user {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #4fc3f7;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(79,195,247,0.3);
}
.lf-loop-handle {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 4px solid var(--loop-color);
  background: #fff;
  color: var(--loop-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.48), 0 4px 14px rgba(0,0,0,0.5);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.lf-loop-handle.selected {
  width: 52px; height: 52px;
  background: var(--loop-color);
  color: #fff;
  border-color: #fff;
  font-size: 21px;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.55), 0 5px 16px rgba(0,0,0,0.58);
}
.lf-loop-arrow {
  width: 50px; height: 50px;
  background: transparent;
  color: var(--loop-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(var(--loop-angle));
  -webkit-text-stroke: 2.5px #fff;
  text-shadow: none;
  filter: none;
  pointer-events: none;
}
.lf-loop-arrow.selected {
  width: 58px; height: 58px;
  font-size: 44px;
  -webkit-text-stroke-width: 3px;
  filter: none;
}

.leaflet-popup {
  max-width: calc(100vw - 28px) !important;
}
.leaflet-popup-content-wrapper {
  max-width: calc(100vw - 28px) !important;
  border-radius: 10px;
}
.leaflet-popup-content {
  max-width: calc(100vw - 84px) !important;
  margin: 11px 34px 11px 12px !important;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.leaflet-popup-close-button {
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 20px !important;
}

/* Masquer les contrôles Leaflet par défaut (on a notre propre bouton) */
.leaflet-control-zoom { display: none !important; }

/* ── Utilitaire ────────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   Bouton compte utilisateur (topbar) — V20 Firebase
═══════════════════════════════════════════════════════════════════════════ */
#auth-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, border-color 0.2s;
}
#auth-btn svg { width: 18px; height: 18px; }

/* État connecté : teinte verte */
#auth-btn.auth-btn--active {
  background: var(--green-d);
  border-color: var(--green);
  color: #fff;
}

/* Initiale de l'email */
#auth-initial {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

/* ── Indicateur de sync (point coloré en bas à droite du bouton) ─────────── */
.sync-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  background: transparent;
  transition: background 0.3s;
}
.sync-dot--ok      { background: #52b788; }
.sync-dot--syncing { background: #f4a261; animation: pulse 1s ease-in-out infinite; }
.sync-dot--error   { background: #e63946; }
.sync-dot--off     { background: transparent; }

/* ═══════════════════════════════════════════════════════════════════════════
   Overlay modal authentification
═══════════════════════════════════════════════════════════════════════════ */
#auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#auth-panel {
  width: 100%;
  max-width: 380px;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}
#auth-panel::-webkit-scrollbar { width: 0; }

/* ── Header de la modal ── */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.auth-close {
  width: 32px; height: 32px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* ── Onglets connexion / inscription ── */
.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--surf2);
  border-radius: 12px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
}
.auth-tab--active {
  background: var(--green-d);
  color: #fff;
}

/* ── Formulaires ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--green); }
.auth-input::placeholder { color: var(--muted); }

.auth-submit {
  margin-top: 4px;
  width: 100%;
}
.auth-link {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 6px;
}

/* ── Erreurs ── */
.auth-error {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.4);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #ff6b6b;
}

/* ── Vue connecté ── */
.auth-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surf2);
  border-radius: 14px;
  padding: 14px;
}
.auth-avatar {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.auth-user-details { display: flex; flex-direction: column; gap: 3px; }
.auth-user-email {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.auth-sync-status {
  font-size: 12px;
  color: var(--green);
}
.auth-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.auth-logout-btn {
  color: var(--red) !important;
  border-color: rgba(230, 57, 70, 0.3) !important;
}
.auth-logout-btn:active { background: rgba(230, 57, 70, 0.1) !important; }

/* ── V21 — Zones d'exclusion ─────────────────────────────────────────── */
.lf-exclusion {
  width: 32px;
  height: 32px;
  background: #e63946;
  border: 3px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
.lf-exclusion:hover { transform: scale(1.15); }
.lf-exclusion-community {
  background: #f4a261; /* orange pour les zones communautaires */
  cursor: default;
  border-color: #fff;
}

/* ── V22 — Popup d'actions sur les marqueurs d'exclusion ───────────── */
.excl-popup-wrap .leaflet-popup-content-wrapper {
  padding: 4px 2px;
  border-radius: 10px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.3);
  min-width: 210px;
}
.excl-popup-wrap .leaflet-popup-content { margin: 4px 0; }
.excl-popup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px;
}
.excl-popup button {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid #ddd;
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  white-space: nowrap;
  transition: background 0.12s;
}
.excl-popup button:hover { background: #f0f0f0; }
.excl-popup-del   { color: #e63946; border-color: rgba(230,57,70,0.4); }
.excl-popup-del:hover { background: rgba(230,57,70,0.08) !important; }
.excl-popup-share { color: #e07b2a; border-color: rgba(244,162,97,0.5); }
.excl-popup-share:hover { background: rgba(244,162,97,0.12) !important; }

/* ── V21 — Toggle zones communautaires ─────────────────────────────── */
#community-excl-wrap {
  margin: 8px 0 2px 0;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.community-excl-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #ccc;
  line-height: 1.3;
}
.community-excl-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #f4a261;
  cursor: pointer;
}

/* ── V21 — Bouton rename ───────────────────────────────────────────── */
.saved-ren {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  opacity: 0.6;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.saved-ren:hover { opacity: 1; }

/* ── V21 — Bouton recalculer ────────────────────────────────────────── */
.btn-recalc {
  color: #4895ef;
  border-color: #4895ef;
  font-weight: 600;
}
.btn-recalc:hover { background: rgba(72,149,239,0.12); }

/* ── V21 — Hint exclusion ───────────────────────────────────────────── */
.hint-excl {
  font-size: 0.78rem;
  color: #e05252;
  margin-top: 2px;
}

/* ── V21 — Import GPX ───────────────────────────────────────────────── */
#gpx-import-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.gpx-import-label {
  cursor: pointer;
  font-size: 0.85rem;
}

/* ── V21 — RGPD ─────────────────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2a3f2a;
}
.auth-link-small {
  background: none;
  border: none;
  color: #888;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.auth-link-small:hover { color: #aaa; }

#rgpd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 3001;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#rgpd-panel {
  background: #1a2e1a;
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  color: #e8f5e9;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.rgpd-content h3 {
  color: #81c784;
  font-size: 0.9rem;
  margin: 16px 0 6px;
}
.rgpd-content p, .rgpd-content li {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c8e6c9;
  margin: 4px 0;
}
.rgpd-content ul {
  padding-left: 18px;
}
.rgpd-content a { color: #81c784; }
.rgpd-version {
  text-align: center;
  color: #555 !important;
  font-size: 0.72rem !important;
  margin-top: 16px !important;
}

/* ── V21 — Attribution fond de carte ────────────────────────────────── */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.75) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 4px 0 0 0 !important;
}

/* ── V25 — Toggle "Dénivelé sans importance" ─────────────────────────── */
#elev-toggle-wrap {
  margin: 2px 0 4px 0;
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.elev-toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #ccc;
  line-height: 1.3;
}
.elev-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--green);
  cursor: pointer;
}

/* Section D+ grisée quand dénivelé ignoré */
#elev-section.elev-ignored {
  opacity: 0.35;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Sélecteur VTT / Gravel
═══════════════════════════════════════════════════════════════════════════ */
.bike-type-row {
  display: flex;
  gap: 8px;
  margin: 6px 0 4px;
}
.btn-bike {
  flex: 1;
  padding: 10px 8px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-bike.active {
  background: var(--green-d);
  border-color: var(--green-d);
  color: #fff;
  font-weight: 700;
}
.btn-bike:not(.active):active {
  background: var(--surf);
}

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Nouveaux boutons topbar (Aide, Feedback)
═══════════════════════════════════════════════════════════════════════════ */
#help-btn,
#feedback-btn {
  width: 40px; height: 40px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
#help-btn svg,
#feedback-btn svg { width: 18px; height: 18px; }
#help-btn:active,
#feedback-btn:active { background: var(--green-d); color: #fff; border-color: var(--green); }

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Mode invité
═══════════════════════════════════════════════════════════════════════════ */
.auth-guest-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}
.auth-guest-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-guest-divider::before,
.auth-guest-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-guest-btn {
  width: 100%;
  display: block;
  padding: 13px 16px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1.5px solid rgba(255,255,255,0.22) !important;
  border-radius: 14px !important;
  color: var(--text) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  margin-top: 0 !important;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.auth-guest-btn:active {
  background: rgba(255,255,255,0.12) !important;
  border-color: rgba(255,255,255,0.38) !important;
}
.auth-guest-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

/* Bannière mode invité (dans le sheet) */
#guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 16px 10px;
  padding: 8px 12px;
  background: rgba(244,162,97,0.12);
  border: 1px solid rgba(244,162,97,0.35);
  border-radius: 10px;
  font-size: 12px;
  color: var(--orange);
}
#guest-banner-connect {
  background: none;
  border: 1px solid var(--orange);
  border-radius: 8px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
#guest-banner-connect:active { background: rgba(244,162,97,0.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Modale Aide / Guide
═══════════════════════════════════════════════════════════════════════════ */
#help-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: stretch;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
}
#help-panel {
  width: 100%;
  max-width: 520px;
  background: var(--surf);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* iOS safe-area : évite que la barre de statut/Dynamic Island recouvre le header */
  padding-top: var(--safe-t);
}
@media (min-width: 600px) {
  #help-overlay { align-items: center; padding: 16px; }
  #help-panel { border-radius: 20px; max-height: 90vh; }
}
.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.help-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
#help-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 24px;
}
#help-content::-webkit-scrollbar { width: 0; }
.help-section {
  margin-top: 20px;
}
.help-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--green);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.help-section-title span { font-size: 16px; }
.help-section p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 6px;
}
.help-section strong { color: var(--text); }
.help-section ul {
  padding-left: 16px;
  margin: 4px 0 6px;
}
.help-section li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 2px;
}

/* Bloc installation PWA — mis en valeur */
.help-install {
  margin-top: 20px;
  background: rgba(82,183,136,0.1);
  border: 1px solid rgba(82,183,136,0.35);
  border-radius: 14px;
  padding: 16px;
}
.help-install-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-install-sub {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  margin: 10px 0 4px;
}
.help-install p, .help-install li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 3px;
}
.help-install ul { padding-left: 16px; }
.help-install-note {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(244,162,97,0.1);
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Modale Feedback
═══════════════════════════════════════════════════════════════════════════ */
#feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#feedback-panel {
  width: 100%;
  max-width: 400px;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}
#feedback-panel::-webkit-scrollbar { width: 0; }
.feedback-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.feedback-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.feedback-type-btn span:first-child { font-size: 22px; }
.feedback-type-btn.active {
  border-color: var(--green);
  color: var(--text);
  background: rgba(82,183,136,0.15);
}
#feedback-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}
#feedback-textarea:focus { border-color: var(--green); }
#feedback-textarea::placeholder { color: var(--muted); }
.feedback-char-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: -8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Overlay guidage navigation
═══════════════════════════════════════════════════════════════════════════ */
#guidance-overlay {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 120px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
#guidance-card {
  background: rgba(17,27,17,0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: auto;
  min-width: 180px;
}
#guidance-arrow-wrap {
  font-size: 52px;
  line-height: 1;
  transition: transform 0.4s ease;
  color: var(--green);
  margin-bottom: 2px;
}
#guidance-dist-remaining {
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.5px;
}
#guidance-dist-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#guidance-stop-btn {
  pointer-events: auto;
  background: rgba(230,57,70,0.15);
  border: 1px solid rgba(230,57,70,0.4);
  border-radius: 12px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  cursor: pointer;
}
#guidance-stop-btn:active { background: rgba(230,57,70,0.3); }

/* Bouton de démarrage guidage dans le panneau boucle */
#guidance-start-btn {
  margin-top: 6px;
  background: rgba(82,183,136,0.12);
  border-color: rgba(82,183,136,0.4);
  color: var(--green);
  font-weight: 700;
}
#guidance-start-btn:active { background: var(--green-d); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   V23 — Layout desktop (écran large)
═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  :root {
    --sidebar-w: 360px;
    --topbar-h: 62px;
  }

  /* La carte occupe la partie droite */
  #map {
    left: var(--sidebar-w);
  }

  /* Le sheet devient un panneau latéral fixe toujours ouvert */
  #sheet {
    left: 0;
    right: auto;
    top: var(--topbar-h);
    bottom: 0;
    width: var(--sidebar-w);
    transform: none !important;
    max-height: calc(100vh - var(--topbar-h));
    border-radius: 0;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 16px rgba(0,0,0,0.4);
  }

  /* Contenu toujours scrollable */
  #sheet-scroll {
    overflow-y: auto !important;
  }

  /* Masquer la poignée (inutile sur desktop) */
  #sheet-handle {
    display: none;
  }

  /* Topbar : étend toute la largeur — z-index élevé pour que le dropdown de
     recherche s'affiche au-dessus de la sidebar (z-index 200) */
  #topbar {
    left: 0;
    right: 0;
    z-index: 300;
  }

  /* Toast centré sur la partie carte */
  #toast {
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
  }

  /* Modales centrées sur l'écran complet */
  #auth-overlay,
  #rgpd-overlay,
  #help-overlay,
  #feedback-overlay {
    left: 0;
    right: 0;
  }

  /* Guidage : centré sur la partie carte */
  #guidance-overlay {
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
  }

  /* Loading : centré sur la partie carte */
  #loading {
    left: var(--sidebar-w);
  }

  /* Badge GPS — sur la partie carte */
  #gps-active-badge {
    left: calc(var(--sidebar-w) + 12px);
  }
}

/* ── Champ mot de passe avec bouton œil ───────────────────────────────────── */
.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-password-wrap .auth-input {
  flex: 1;
  padding-right: 44px;
}
.btn-eye {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  transition: color 0.15s;
}
.btn-eye:hover { color: var(--text); }
.btn-eye svg { width: 18px; height: 18px; }
.btn-eye.eye-visible { color: var(--green); }

/* ── Badge GPS actif (flottant sur la carte) ──────────────────────────────── */
#gps-active-badge {
  position: fixed;
  top: calc(var(--topbar-h, 56px) + 10px);
  right: 12px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(20, 40, 20, 0.92);
  border: 1.5px solid var(--green);
  border-radius: 22px;
  padding: 7px 10px 7px 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.45);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
}
#gps-active-badge[hidden] { display: none; }
.gps-badge-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green);
  animation: gps-pulse 1.3s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes gps-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}
.gps-badge-label { white-space: nowrap; }
#gps-badge-stop {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 8px;
  transition: color 0.15s;
}
#gps-badge-stop:hover { color: var(--red); }
