/* ma-rando — interface */

:root {
  /* Le papier de la carte nationale suisse, son encre, et le jaune du balisage. */
  --bg: #eeebe4;
  --surface: #ffffff;
  --surface-2: #f7f5f0;
  --surface-3: #ebe7de;
  --ink: #16181a;
  --ink-2: #4e545a;
  --ink-3: #6f767d;
  --rule: #e0dcd2;
  --rule-strong: #c9c3b6;

  /* Jaune des poteaux de randonnée : réservé à la sélection et au temps. */
  --accent: #f2b705;
  --accent-ink: #16181a;
  --accent-soft: #fbf0d0;

  /* Bouton primaire : l'encre, pas l'accent — le jaune reste rare. */
  --solid: #2f4858;
  --solid-ink: #ffffff;
  --time: #2f4858;

  --up: #c2410c;
  --down: #1864ab;
  --ok: #2b7a3f;
  --danger: #b42318;
  --trace: #c8161d;
  --trace-solid: #e01e26;
  --chart-fill-top: rgba(224, 30, 38, 0.22);
  --chart-fill-bottom: rgba(224, 30, 38, 0.02);

  /* Contour des contrôles posés sur la carte : à 3:1 minimum sur le papier de
     la carte nationale, faute de quoi le blanc du bouton s'y fond. */
  --float-border: rgba(22, 24, 26, 0.5);
  --float-shadow: 0 1px 2px rgba(22, 24, 26, 0.14), 0 4px 12px -4px rgba(22, 24, 26, 0.3);

  --shadow-1: 0 1px 2px rgba(30, 25, 15, 0.06), 0 2px 6px -3px rgba(30, 25, 15, 0.12);
  --shadow-2: 0 2px 5px rgba(30, 25, 15, 0.08), 0 14px 36px -22px rgba(30, 25, 15, 0.45);

  --topbar-h: 52px;
  --bottom-h: 218px;
  --bandeau-meteo-h: 158px;  /* en-tête + chiffres + bandeau, profil préservé */
  --radius: 7px;
  --ease: 160ms cubic-bezier(0.2, 0, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101315;
    --surface: #191d21;
    --surface-2: #212730;
    --surface-3: #2a323b;
    --ink: #e9ecee;
    --ink-2: #a8b0b8;
    --ink-3: #8a939c;
    --rule: #2a3138;
    --rule-strong: #3b444d;

    --accent: #ffce00;
    --accent-ink: #16181a;
    --accent-soft: #3a3216;

    --solid: #d8e2e8;
    --solid-ink: #16181a;
    --time: #8ec5dd;

    --up: #ff922b;
    --down: #4dabf7;
    --ok: #51cf66;
    --danger: #ff6b6b;
    --trace: #ff6b6b;
    --trace-solid: #e01e26;
    --chart-fill-top: rgba(255, 107, 107, 0.24);
    --chart-fill-bottom: rgba(255, 107, 107, 0.02);

    /* Sur fond sombre, le contrôle tranche déjà : le contour reste plus léger. */
    --float-border: rgba(255, 255, 255, 0.22);
    --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 14px -4px rgba(0, 0, 0, 0.7);
    /* Sur fond sombre, le contrôle tranche déjà : le contour reste plus léger. */
  --float-border: rgba(255, 255, 255, 0.22);
  --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 14px -4px rgba(0, 0, 0, 0.7);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px -4px rgba(0, 0, 0, 0.7);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.6), 0 16px 40px -24px rgba(0, 0, 0, 1);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #101315;
  --surface: #191d21;
  --surface-2: #212730;
  --surface-3: #2a323b;
  --ink: #e9ecee;
  --ink-2: #a8b0b8;
  --ink-3: #8a939c;
  --rule: #2a3138;
  --rule-strong: #3b444d;

  --accent: #ffce00;
  --accent-ink: #16181a;
  --accent-soft: #3a3216;

  --solid: #d8e2e8;
  --solid-ink: #16181a;
  --time: #8ec5dd;

  --up: #ff922b;
  --down: #4dabf7;
  --ok: #51cf66;
  --danger: #ff6b6b;
  --trace: #ff6b6b;
  --trace-solid: #e01e26;
  --chart-fill-top: rgba(255, 107, 107, 0.24);
  --chart-fill-bottom: rgba(255, 107, 107, 0.02);

  /* Sur fond sombre, le contrôle tranche déjà : le contour reste plus léger. */
  --float-border: rgba(255, 255, 255, 0.22);
  --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 14px -4px rgba(0, 0, 0, 0.7);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px -4px rgba(0, 0, 0, 0.7);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.6), 0 16px 40px -24px rgba(0, 0, 0, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Barlow, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--trace);
  outline-offset: 2px;
  border-radius: 4px;
}
button, .track-item, .layer-chip { transition: background var(--ease), border-color var(--ease), color var(--ease); }
svg { width: 100%; height: 100%; fill: currentColor; }

/* ------------------------------------------------------------ barre haute */

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 10px 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; padding-left: 4px; }

.logo { width: 22px; height: 22px; flex: none; display: block; }
.logo svg { width: 100%; height: 100%; }

.project-name { display: flex; flex-direction: column; gap: 0; min-width: 0; }

#project-name {
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  width: 240px;
  max-width: 32vw;
  text-overflow: ellipsis;
}
#project-name:hover { border-color: var(--rule); }
#project-name:focus { border-color: var(--accent); background: var(--surface-2); outline: none; }

.save-state {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-left: 7px;
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
}
.save-state[data-state='saved'] { color: var(--ok); }
.save-state[data-state='saving'] { color: var(--ink-2); }
.save-state[data-state='dirty'] { color: var(--up); }

.tools { display: flex; align-items: center; gap: 7px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--solid);
  background: var(--solid);
  color: var(--solid-ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--ease), transform var(--ease);
}
/* `display` d'auteur l'emporte sur l'attribut `hidden` : il faut le redire. */
.btn[hidden] { display: none; }

/* La règle générale, apprise à nos dépens quatre fois : tout élément posé en
   flex ou grid écrase l'attribut `hidden` du navigateur. Celui-ci doit TOUJOURS
   gagner — c'est lui que le code utilise pour montrer ou cacher. */
[hidden] { display: none !important; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }

.btn.small { height: 27px; padding: 0 11px; font-size: 12.5px; border-radius: 6px; }

.btn.ghost {
  background: var(--surface);
  border-color: var(--rule-strong);
  color: var(--ink-2);
  font-weight: 500;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); filter: none; }

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent); }

.i-moon { display: none; }
:root[data-theme='dark'] .i-sun { display: none; }
:root[data-theme='dark'] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .i-sun { display: none; }
  :root:not([data-theme='light']) .i-moon { display: block; }
  :root[data-theme='light'] .i-sun { display: block; }
  :root[data-theme='light'] .i-moon { display: none; }
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.segmented button {
  height: 30px;
  padding: 0 11px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
  border-right: 1px solid var(--rule);
}
.segmented button:last-child { border-right: none; }
.segmented button:hover { background: var(--surface-2); color: var(--ink); }
.segmented button.on { background: var(--solid); color: var(--solid-ink); font-weight: 600; }

.select {
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.divider { width: 1px; height: 22px; background: var(--rule); flex: none; }

/* --------------------------------------------------------------- espace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    'left map'
    'left bottom';
}

.panel-left { grid-area: left; width: 264px; border-right: 1px solid var(--rule); }
.map-area { grid-area: map; position: relative; min-height: 0; }
.panel-bottom { grid-area: bottom; border-top: 1px solid var(--rule); }

body[data-panel-left='closed'] .panel-left { display: none; }
body[data-panel-right='closed'] .layer-rail { display: none; }

.panel { background: var(--surface); display: flex; flex-direction: column; min-height: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.panel-head h2 {
  margin: 0;
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.mini-btn {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.mini-btn:hover { background: var(--surface-3); color: var(--ink); }

/* Menu du bouton Exporter : deux formats, chacun avec sa ligne d'explication. */
#export-menu { position: fixed; }
#export-menu .mini-btn { text-align: left; padding: 7px 10px; white-space: normal; font-weight: 600; }
#export-menu .mini-btn i {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
}
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.panel-search { padding: 9px 10px; border-bottom: 1px solid var(--rule); flex: none; }
.panel-search input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
}

/* ---------------------------------------------------- panneau de gauche */

.app-title {
  font-family: Spectral, Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  padding: 1px 6px;
  max-width: 32vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library, .editor { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.library[hidden], .editor[hidden] { display: none; }

/* --- éditeur : la petite fenêtre du tracé en cours --- */

.editor { padding: 0; }

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--rule);
}
.editor-head h2 {
  margin: 0;
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.editor-fields { display: flex; flex-direction: column; gap: 5px; padding: 9px 10px; }
.editor-fields input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
}
.editor-fields input:first-child { font-weight: 600; }
.editor-fields input:focus { border-color: var(--accent); outline: none; }

.folder-picker { position: relative; }

.folder-btn {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.folder-btn:hover { border-color: var(--ink-3); }
.folder-btn.empty { color: var(--ink-3); }
.folder-btn .f-ico { width: 14px; height: 14px; flex: none; color: var(--ink-3); }
.folder-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.folder-btn .f-caret { width: 11px; height: 11px; flex: none; color: var(--ink-3); }

.folder-menu {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  box-shadow: var(--shadow-2);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 244px;
  overflow-y: auto;
}
.folder-menu[hidden] { display: none; }

.folder-option {
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 6px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-option:hover { background: var(--surface-3); }
.folder-option.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.folder-option.create {
  margin-top: 3px;
  border-top: 1px solid var(--rule);
  border-radius: 0 0 5px 5px;
  padding-top: 8px;
  color: var(--ink-2);
  font-weight: 500;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--rule);
}
.editor-bar .mini-btn { min-width: 30px; padding: 4px 6px; }
.mini-btn.icon { display: grid; place-items: center; height: 26px; }
.mini-btn.icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-bar .mini-btn:disabled { opacity: 0.35; cursor: default; }
.editor-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.point-list {
  /* La liste ne prend que la place de ses points : le bouton Terminer reste
     juste dessous, et remonte donc à mesure que le tracé se construit. */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.point-list li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 12.5px;
}
.point-list li:hover { background: var(--surface-2); border-color: var(--rule); }
.p-label { font-weight: 500; white-space: nowrap; }
.p-coord { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.p-act {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  line-height: 1;
  padding: 0;
}
.p-act:hover { background: var(--surface-3); color: var(--ink); }
.p-act.danger:hover { background: var(--danger); color: #fff; }

.btn.finish {
  margin: 6px 10px auto;   /* l'espace libre passe sous le bouton */
  justify-content: center;
  height: 38px;
  font-size: 14px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(22, 24, 26, 0.12), 0 0 0 4px var(--accent-soft);
}
.btn.finish:hover { filter: brightness(1.05); }
.btn.finish kbd {
  border-color: rgba(22, 24, 26, 0.28);
  background: rgba(22, 24, 26, 0.12);
  color: inherit;
  margin-left: 7px;
}

/* --- bibliothèque --- */

.head-actions { display: flex; align-items: center; gap: 3px; }

.icon-mini {
  width: 26px;
  height: 26px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.icon-mini svg { width: 100%; height: 100%; fill: none; }
.icon-mini:hover { background: var(--surface-3); color: var(--ink); }
.icon-mini.on { color: var(--trace); border-color: var(--rule-strong); background: var(--surface-2); }

.mini-btn.accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.mini-btn.accent:hover { background: var(--accent-soft); color: var(--accent); }

.track-list { flex: 1; overflow-y: auto; padding: 6px 6px 14px; display: flex; flex-direction: column; gap: 3px; }

/* --- zones de dépôt --- */

.drop-zone, .folder-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-radius: 8px;
  border: 1.5px dashed transparent;
  padding: 2px;
}
.drop-over { border-color: var(--accent); background: var(--accent-soft); }

/* Le trait d'insertion pendant la réorganisation d'un dossier. */
.track-item.drop-avant { box-shadow: 0 -2px 0 0 var(--trace); }
.track-item.drop-apres { box-shadow: 0 2px 0 0 var(--trace); }

.drop-hint {
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
  padding: 9px 8px;
  border: 1px dashed var(--rule-strong);
  border-radius: 6px;
  line-height: 1.35;
}

/* --- dossiers --- */

.folder-block {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 4px;
  margin-top: 8px;
}
.folder-block.drop-over { border-color: var(--accent); background: var(--accent-soft); }

.folder { display: flex; align-items: center; gap: 2px; }

.f-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  padding: 9px 4px 7px 8px;
  text-align: left;
}
.f-toggle:hover { color: var(--ink); }
.f-toggle .caret { font-size: 9px; transition: transform 0.15s; color: var(--ink-3); }
.folder.collapsed .f-toggle .caret { transform: rotate(-90deg); }
.f-toggle .f-icon { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.f-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Le poids du dossier, entre son titre et sa première course. */
.f-sum {
  padding: 0 10px 8px 35px;
  margin-top: -3px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Renommage en place, au double-clic sur le nom du dossier. */
.f-rename {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  padding: 1px 5px;
}

.f-count {
  font-size: 11px;
  color: var(--ink-3);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

.f-act {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 15px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity var(--ease), background var(--ease);
}
.folder:hover .f-act, .f-act:focus-visible { opacity: 1; }
.f-act:hover { background: var(--danger); color: #fff; }

/* --- une ligne de tracé --- */

.track-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  padding: 2px 5px 2px 2px;
  cursor: grab;
}
.track-item:hover { border-color: var(--rule); border-left-color: var(--rule-strong); }
.track-item.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-left-color: var(--accent);
}
.track-item.dragging { opacity: 0.45; cursor: grabbing; }

.t-eye {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  display: grid;
  place-items: center;
}
.t-eye svg { width: 14px; height: 14px; }
.t-eye.shown { color: var(--trace); }
.t-eye:hover { background: var(--surface-3); }

.t-body {
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 8px 2px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.t-name {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.t-stat { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.t-stat svg { width: 11px; height: 11px; flex: none; opacity: 0.8; }
.track-item.on .t-meta { color: var(--ink-2); }

.t-act {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  padding: 5px;
}
.t-act svg { width: 100%; height: 100%; fill: none; }
/* Jamais complètement invisible : une action ne doit pas dépendre du survol,
   qui n'existe pas au doigt et échappe à la navigation au clavier. */
.t-act { opacity: 0.45; transition: opacity var(--ease), background var(--ease); }
.track-item:hover .t-act, .track-item.on .t-act, .t-act:focus-visible { opacity: 1; }
.t-act:hover { background: var(--surface-3); color: var(--ink); }

.empty-note { padding: 18px 14px; color: var(--ink-3); font-size: 13px; text-align: center; line-height: 1.5; }

/* Trois gestes, bien visibles et centrés : hors ligne, visibilité, dossier. */
.panel-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--rule);
}
.panel-foot .icon-mini {
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 10px;
  border-color: var(--rule);
}

.tm-title {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------- barre des couches */

.layer-rail {
  position: absolute;
  top: 54px;
  left: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  /* Sur un petit écran, la colonne déborderait sous la carte : les pastilles
     passent alors sur une deuxième colonne au lieu de sortir du cadre. */
  flex-wrap: wrap;
  max-height: calc(100% - 116px);
  align-content: flex-start;
  /* La boîte du rail s'étend au-delà de ses pastilles : sans cette exception,
     cette surface invisible avalait les clics et les touchers destinés à la
     carte. Seules les pastilles reçoivent désormais les gestes. */
  pointer-events: none;
  gap: 6px;
  column-gap: 8px;
}

/* Le ciel en 3D : un calque au-dessus de la carte, transparent aux clics. */
.sky-sun {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  pointer-events: none;
}
.sky-sun .sky-label {
  font-size: 11.5px;
  font-weight: 600;
  fill: #8a5a00;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  text-anchor: middle;
}

/* Le pupitre du soleil : date, curseur des heures, lever et coucher. */
.sun-panel {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
}
.sun-panel input[type='date'] {
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  padding: 3px 6px;
}
.sun-panel input[type='range'] { width: 220px; accent-color: var(--accent); }
.sun-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 150px; }
.sun-info b { font-size: 15px; font-variant-numeric: tabular-nums; }
.sun-info span { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.sun-panel.night { border-color: var(--solid); }
.sun-panel.night .sun-info b { color: var(--solid); }

/* La poignée qui replie la colonne des itinéraires, à cheval sur le bord. */
.panel-handle {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  width: 17px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--float-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: var(--float-shadow);
  display: grid;
  place-items: center;
}
.panel-handle:hover { color: var(--ink); }
.panel-handle svg { width: 11px; height: 22px; }
body[data-panel-left='closed'] .panel-handle svg { transform: scaleX(-1); }

/* La rosace des versants, posée sous la recherche, à droite du rail. */
.aspect-rose {
  position: absolute;
  top: 54px;
  left: 60px;
  z-index: 9;
  width: 84px;
  height: 84px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  color: var(--ink-2);
  pointer-events: none;
}
.aspect-rose svg { width: 100%; height: 100%; display: block; }

.layer-chip {
  pointer-events: auto;
  position: relative;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 50%;
  border: 1px solid var(--float-border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--float-shadow);
  display: grid;
  place-items: center;
}
.layer-chip:hover { color: var(--ink); border-color: var(--ink-3); }
.layer-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-1), 0 0 0 3px var(--accent-soft);
}
.layer-chip svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* La porte d'entrée : voile plein écran au-dessus de la carte floutée. */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  width: min(400px, calc(100vw - 48px));
  padding: 38px 34px 30px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
}
.gate-logo svg { width: 52px; height: 52px; display: block; }
.gate-card h1 { font-size: 26px; letter-spacing: -0.5px; margin: 0; }
.gate-pitch { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.gate-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--rule-strong);
  border-radius: 10px;
  cursor: pointer;
}
.gate-google:hover { border-color: var(--accent); background: var(--surface-3); }
.gate-google svg { width: 18px; height: 18px; flex: none; }
.gate-skip {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gate-skip:hover { color: var(--ink); }
.gate-foot { font-size: 11px; color: var(--ink-3); margin: 0; }

/* Le tri des cabanes par nature, ouvert par appui long sur la pastille. */
.hut-picker {
  position: fixed;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  animation: menu-in 0.14s ease-out;
}
.hut-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 7px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.hut-opt svg { width: 19px; height: 19px; flex: none; opacity: 0.35; }
.hut-opt:hover { background: var(--surface-3); color: var(--ink-2); }
.hut-opt.on { color: var(--ink); font-weight: 600; }
.hut-opt.on svg { opacity: 1; }

/* La fenêtre d'administration : trois grands chiffres, puis le détail. */
.admin-totals {
  display: flex;
  gap: 26px;
  margin-bottom: 18px;
}
.admin-totals div { display: flex; flex-direction: column; }
.admin-totals b { font-size: 24px; line-height: 1.1; }
.admin-totals span { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--rule-strong);
}
.admin-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin-table td i { display: block; font-style: normal; font-size: 11px; color: var(--ink-3); }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Le compte : bouton de connexion, ou avatar rond une fois connecté. */
.account { display: flex; align-items: center; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
  background: var(--solid);
  color: var(--solid-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar:hover { border-color: var(--accent); }

#account-menu { position: fixed; }
#account-menu .who { display: flex; flex-direction: column; gap: 1px; padding: 2px 2px 6px; }
#account-menu .who b { font-size: 12.5px; }
#account-menu .who span { font-size: 11.5px; color: var(--ink-3); word-break: break-all; }

/* L'aide décrit chaque couche : icône, libellé, explication, légende. */
.help-layer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}
.help-layer:last-child { border-bottom: none; }
.help-layer svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink-2);
}
.help-layer strong { font-size: 12.5px; }
.help-layer em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.help-layer p { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.help-layer .legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.help-layer .legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Le nom sort à gauche au survol : la pastille reste muette au repos. */
.layer-chip .name {
  position: absolute;
  left: 46px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.layer-chip:hover .name, .layer-chip:focus-visible .name { opacity: 1; }
.layer-chip .name kbd {
  margin-left: 7px;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  padding: 1px 5px;
  font-size: 10.5px;
}

.layer-chip .pct {
  position: absolute;
  bottom: -1px;
  right: -1px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 4px;
  font-variant-numeric: tabular-nums;
}

.layer-chip.loading { opacity: 0.6; }

/* ---------------------------------------------------------------- carte */

#map { position: absolute; inset: 0; background: var(--surface-3); }

.maplibregl-ctrl-attrib {
  font-size: 10px;
  /* Toujours ouverte désormais : un vrai fond, sinon elle se noie dans la carte. */
  background: var(--surface) !important;
  border: 1px solid var(--float-border);
  border-radius: 6px;
  padding: 1px 8px;
  color: var(--ink-3);
}
.maplibregl-ctrl-bottom-right { z-index: 5; }

/* Le zoom se pose juste au-dessus du sélecteur de fond, même bord gauche. */
.maplibregl-ctrl-bottom-left { bottom: 52px; left: 0; z-index: 5; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0 0 0 10px; }

/* Le zoom suit le même contour que les autres contrôles de la carte. */
.maplibregl-ctrl-group {
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: var(--radius);
  box-shadow: var(--float-shadow);
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--rule); }
.maplibregl-ctrl-group button { width: 30px; height: 30px; }

/* MapLibre dessine ses icônes en noir quel que soit le thème : sur le fond
   sombre elles disparaîtraient. On les éclaircit, boussole comprise. */
:root[data-theme='dark'] .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
:root:not([data-theme='light']) .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(0.85);
}
:root[data-theme='light'] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: none; }

.map-search {
  position: absolute;
  top: 10px;
  left: 10px;
  /* Au-dessus du rail des couches, qui vient après dans le document : sinon
     les pastilles passent devant la liste des résultats. */
  z-index: 22;
  width: 320px;
  max-width: calc(100% - 20px);
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 34px;
  box-shadow: var(--float-shadow);
}
.map-search svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.map-search input { flex: 1; border: none; background: transparent; height: 100%; min-width: 0; }
.map-search input:focus { outline: none; }

.search-results {
  position: absolute;
  top: 38px;
  /* Débordement d'un pixel de chaque côté : la bordure du champ décalait la
     liste, et le rail des couches laissait dépasser un liseré. */
  left: -1px;
  right: -1px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}
.search-results button:hover, .search-results button.on { background: var(--accent-soft); color: var(--accent); }
.search-results i { font-style: normal; color: var(--ink-3); font-size: 11.5px; display: block; }

/* La barre du bas à gauche : fonds de carte et bascule du relief, même hauteur. */
.map-bottom-left {
  position: absolute;
  bottom: 12px;
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.basemap-switch {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--float-shadow);
}
.basemap-switch button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.basemap-switch button:hover { background: var(--surface-3); color: var(--ink); }
.basemap-switch button.on { background: var(--solid); color: var(--solid-ink); font-weight: 600; }

.map-hint {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--ink);
  color: var(--bg);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  pointer-events: none;
  white-space: nowrap;
}

.coord-readout {
  /* Vit dans la pile des contrôles MapLibre (bas-droite) : l'empilement et
     les marges viennent d'elle, plus de hauteur devinée ni de chevauchement. */
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--float-shadow);
  pointer-events: none;
}

.view-3d {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: var(--radius);
  box-shadow: var(--float-shadow);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}
.view-3d svg { width: 15px; height: 15px; flex: none; }
.view-3d:hover { color: var(--ink); }

/* --------------------------------------------------------------- profil */

/* Quand la météo d'un parcours s'affiche, le panneau s'agrandit d'autant :
   sans cela, le bandeau prenait sa hauteur sur le dos du profil, qui devenait
   une ligne plate illisible. */
body.meteo-parcours { --bottom-h: calc(218px + var(--bandeau-meteo-h)); }
/* Repliée, la météo ne coûte que la ligne de son titre. */
body.meteo-repliee { --bottom-h: calc(218px + 30px); }

.panel-bottom {
  height: var(--bottom-h);
  display: grid;
  grid-template-columns: 292px 244px minmax(0, 1fr);
  /* Sans ligne explicite, la ligne implicite prend la hauteur du contenu et
     déborde le panneau : le profil passait sous le bas de la fenêtre. */
  grid-template-rows: minmax(0, 1fr);
  position: relative;
}
.panel-bottom > * { min-height: 0; }
body[data-panel-bottom='closed'] .panel-bottom { height: 30px; }
body[data-panel-bottom='closed'] .stats,
body[data-panel-bottom='closed'] .settings,
body[data-panel-bottom='closed'] .chart-wrap { display: none; }

.panel-handle {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 15px;
  border: 1px solid var(--rule);
  border-top: none;
  border-radius: 0 0 7px 7px;
  background: var(--surface);
  cursor: pointer;
  z-index: 4;
  padding: 0;
}
.panel-handle::after {
  content: '';
  display: block;
  width: 20px;
  height: 2px;
  margin: 5px auto 0;
  border-radius: 2px;
  background: var(--rule-strong);
}
.panel-handle:hover::after { background: var(--accent); }

.stats {
  border-right: 1px solid var(--rule);
  padding: 13px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* Le nom du tracé, là où l'on lit ses chiffres. */
.bottom-title {
  font-family: Spectral, Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottom-title.empty { color: var(--ink-3); font-weight: 500; }

/* Les réglages : leur propre colonne, plus rien d'empilé sous les chiffres. */
.settings {
  border-right: 1px solid var(--rule);
  padding: 11px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

/* Les trois chiffres qui décident d'une course, lisibles d'un coup d'œil. */
.stats-main {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.stats-main .stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stats-main b .u {
  font-family: Barlow, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 2px;
}

.stats-main .k {
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stats-main b {
  font-family: Spectral, Georgia, serif;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.stats-main .up b { color: var(--up); }

.stats-main .time b { color: var(--time); }

/* Second rang : présent, mais visiblement secondaire. */
.stats-side {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.stats-side b { color: var(--ink-2); font-weight: 600; }

.control { display: flex; flex-direction: column; gap: 3px; }
.control .k {
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  gap: 5px;
  align-items: baseline;
}
.control .k em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
  font-size: 11.5px;
}
.control input[type='range'] { width: 100%; accent-color: var(--accent); height: 18px; margin: 0; }

.stats-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 2px; }
.stats-actions .mini-btn { flex: 1; text-align: center; }

.chart-wrap { position: relative; padding: 4px 6px 4px 0; min-width: 0; display: flex; flex-direction: column; }
.chart-wrap #chart { flex: 1; min-height: 0; }

/* Le bandeau du bas se lit en trois temps : chaque bloc porte son titre. */
.sect-titre {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
}
.chart-wrap .sect-titre { padding-left: 46px; }
/* Sur mobile, la feuille a déjà son en-tête : pas de titres en plus. */
body[data-mobile='1'] .sect-titre { display: none; }
#chart {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  /* Le doigt sur le profil pilote le curseur, jamais le défilement. */
  touch-action: none;
}


/* ------------------------------------------------------------- rythme */

.method-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--surface-2);
  margin-top: 2px;
}
.method-group button {
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.method-group button:hover { color: var(--ink); background: var(--surface-3); }
.method-group button.on { background: var(--solid); color: var(--solid-ink); font-weight: 600; }

.pace-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--surface-2);
  margin-top: 2px;
}
.pace-group button {
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}
.pace-group button:hover { color: var(--ink); background: var(--surface-3); }
.pace-group button.on { background: var(--solid); color: var(--solid-ink); font-weight: 600; }

/* ------------------------------------------------- curseur de dessin */

/* Le curseur natif est masqué en mode tracé : cette pastille le remplace et
   annonce ce que le prochain clic va poser. */
body[data-mode='route'] .maplibregl-canvas,
body[data-mode='line'] .maplibregl-canvas { cursor: none; }

.draw-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 12;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  will-change: transform;
}
.draw-cursor[hidden] { display: none; }

.draw-cursor .dot {
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  background: var(--trace-solid);
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
  flex: none;
  animation: cursor-in 0.18s ease-out;
}
/* Le tracé libre se signale par un contour en pointillés. */
body[data-mode='line'] .draw-cursor .dot { border-style: dashed; }

.draw-cursor .tag {
  margin-left: -4px;
  background: var(--trace-solid);
  color: #fff;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: cursor-in 0.18s ease-out;
}

@keyframes cursor-in { from { opacity: 0; transform: scale(0.7); } }

/* Halo qui bat sur le point de départ tant que le tracé n'a qu'un point. */
@keyframes ping {
  0% { transform: scale(1); opacity: 0.55; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

/* ---------------------------------------------------- menu du tracé */

.trace-menu {
  position: absolute;
  z-index: 20;
  width: 232px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  box-shadow: var(--shadow-2);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: menu-in 0.14s ease-out;
}
.trace-menu[hidden] { display: none; }

@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }

.trace-menu input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  font-weight: 600;
}
.trace-menu input:focus { border-color: var(--accent); outline: none; }

.trace-menu .facts {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}
.trace-menu .facts b { color: var(--ink); font-weight: 600; }

.trace-menu .row { display: flex; gap: 5px; }
.trace-menu .row .mini-btn { flex: 1; justify-content: center; text-align: center; }

/* --------------------------------------------------------------- modale */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 8, 6, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal[hidden] { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 11px 18px;
  border-bottom: 1px solid var(--rule);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body {
  overflow-y: auto;
  padding: 16px 18px 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px 26px;
}
.modal-body section:last-child { grid-column: 1 / -1; }
.modal-body h3 {
  margin: 0 0 8px;
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.modal-body p { margin: 0 0 8px; color: var(--ink-2); max-width: 68ch; font-size: 13px; }
.modal-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; align-items: baseline; }
.modal-body dt { white-space: nowrap; }
.modal-body dd { margin: 0; color: var(--ink-2); font-size: 13px; }

kbd {
  display: inline-block;
  min-width: 19px;
  text-align: center;
  padding: 1px 5px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: 'Barlow Semi Condensed', Barlow, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}

/* ------------------------------------------------------ confirmation */

.confirm-pop {
  position: fixed;
  z-index: 300;
  width: 232px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  box-shadow: var(--shadow-2);
  padding: 11px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: pop-in 0.12s ease-out;
}
.confirm-pop[hidden] { display: none; }

@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } }

.confirm-pop .c-message { font-size: 13px; font-weight: 600; line-height: 1.35; }
.confirm-pop .c-detail { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.confirm-pop .c-row { display: flex; gap: 5px; margin-top: 6px; }
.confirm-pop .mini-btn { flex: 1; text-align: center; padding: 5px 0; }

.mini-btn.solid-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}
.mini-btn.solid-danger:hover { filter: brightness(1.08); background: var(--danger); color: #fff; }

/* --------------------------------------------------------------- toasts */

.toast-stack {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  animation: rise 0.18s ease-out;
  max-width: 78vw;
}
.toast.warn { background: var(--up); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'map' 'bottom';
  }
  .panel-left {
    position: absolute;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: min(80vw, 300px);
    z-index: 40;
    box-shadow: var(--shadow-2);
  }
  body[data-panel-left='closed'] .panel-left { display: none; }
  .panel-bottom { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .stats, .settings { border-right: none; border-bottom: 1px solid var(--rule); }
  #project-name { width: 150px; }
  #btn-import, #btn-export, .divider { display: none; }
  .map-search { width: calc(100% - 20px); }
}


/* =================================================================== mobile
   Le téléphone reçoit la même application, réorganisée : la carte occupe tout
   l'écran, la bibliothèque devient un tiroir, le dessin passe par les boutons
   flottants ou l'appui long. L'ordinateur ne voit rien de tout ceci. */

.fabs { display: none; }

body[data-mobile='1'] .topbar { display: none; }
body[data-mobile='1'] .panel-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: auto;
  max-height: 34vh;
  overflow-y: auto;
  border-top: 1px solid var(--rule-strong);
  box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.14);
  transform: translateY(105%);
  transition: transform 0.22s ease-out;
}
body[data-mobile='1'].sheet-open .panel-bottom { transform: none; }

/* La bibliothèque : un tiroir par-dessus la carte. */
body[data-mobile='1'] .panel-left {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  width: min(270px, 72vw);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
  transform: translateX(-105%);
  transition: transform 0.22s ease-out;
  display: flex !important;
}
body[data-mobile='1'].lib-open .panel-left { transform: none; }

/* Le voile : invisible, il couvre la carte quand le tiroir est ouvert et
   referme d'un toucher — le geste que tout le monde essaie en premier. */
.lib-scrim { display: none; }
body[data-mobile='1'].lib-open .lib-scrim {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(16, 19, 21, 0.18);
}
body[data-mobile='1'] .panel-handle { display: none; }

/* La carte plein écran, des cibles tactiles plus grandes. */
body[data-mobile='1'] .workspace {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
  height: 100dvh;
}
body[data-mobile='1'] .map-area { grid-column: 1; grid-row: 1; }
body[data-mobile='1'] .map-hint { display: none; }
body[data-mobile='1'].sheet-open .fabs { bottom: calc(34vh + 18px); }
body[data-mobile='1'] .layer-chip { width: 42px; height: 42px; }
body[data-mobile='1'] .layer-chip .name { display: none; }
body[data-mobile='1'] .basemap-switch button { padding: 8px 12px; }
body[data-mobile='1'] .view-3d { padding: 0 13px; }
body[data-mobile='1'] .coord-readout { display: none; }
body[data-mobile='1'] .sun-panel {
  top: auto;
  bottom: 108px;
  flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  justify-content: center;
}
body[data-mobile='1'] .sun-panel input[type='range'] { width: min(320px, 62vw); }

/* Les boutons flottants, au-dessus du sélecteur de fond. */
body[data-mobile='1'] .fabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: absolute;
  right: 12px;
  bottom: 64px;
  z-index: 25;
  /* Le conteneur est transparent au doigt : sans cela, ses espaces vides
     avalaient les touchers destinés à la carte (arrêts, parkings, tracés).
     Seuls les boutons eux-mêmes reçoivent les gestes. */
  pointer-events: none;
}
body[data-mobile='1'] .fabs > * { pointer-events: auto; }
.fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--float-border);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.fab svg { width: 24px; height: 24px; }

/* Le bouton de géolocalisation, habillé comme les autres boutons flottants. */
.fab-geo {
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  overflow: hidden;
  box-shadow: var(--shadow-2);
  margin: 0 !important;
  float: none !important;
}
.fab-geo button {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}
.fab-geo .maplibregl-ctrl-icon { transform: scale(1.25); }
.fab.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.fab.danger { color: var(--danger); }

/* Le bouton « Tracer » : LE point d'entrée du dessin sur mobile — étiqueté
   et coloré pour qu'on ne puisse pas le manquer. */
body[data-mobile='1'] .fabs { align-items: flex-end; }
.fab.fab-draw {
  width: auto;
  border-radius: 999px;
  padding: 0 18px 0 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.fab.fab-draw svg { width: 20px; height: 20px; }

/* Le « + Itinéraire » du tiroir n'a pas de sens sur mobile : il lançait le
   dessin derrière un tiroir resté ouvert. Le bouton « Tracer » fait foi. */
body[data-mobile='1'] #btn-new-2 { display: none; }

/* Le compte, flottant en haut à droite quand la barre d'outils a disparu. */
body[data-mobile='1'] .avatar { box-shadow: var(--shadow-2); }



body[data-mobile='1'] .panel-bottom { max-height: 48vh; }
/* Les trois zones du panneau (chiffres, réglages, profil) s'empilent au lieu
   de se partager une largeur qui n'existe pas sur un téléphone. */
body[data-mobile='1'] .panel-bottom { display: block; }
body[data-mobile='1'] .panel-bottom > * { width: auto; }
body[data-mobile='1'] .chart-wrap { min-height: 150px; }
body[data-mobile='1'].sheet-open .fabs { bottom: calc(48vh + 18px); }



/* Le rappel discret : un simple bouton posé en bas d'écran, jamais intrusif. */
.install-nudge {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 45;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  cursor: pointer;
}
.install-nudge[hidden] { display: none; }

/* Le mode d'emploi, plein écran : seul recours quand aucune boîte native
   n'existe (Safari). Fond sombre, texte clair, une flèche qui pointe le
   geste — la simplicité prime sur tout le reste ici. */
/* La fenêtre « Cartes hors ligne » : la liste de ce qui est gardé. */
.zones-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 24, 28, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.zones-card {
  background: var(--surface);
  border-radius: 16px;
  width: min(440px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.zones-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 6px;
}
.zones-head h2 { font-size: 18px; margin: 0; }
.zones-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.zones-close svg { width: 16px; height: 16px; }
.zones-body { padding: 0 18px 8px; overflow-y: auto; }
.zones-body h3 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 14px 0 4px;
}
.zones-vide { font-size: 13px; color: var(--ink-3); margin: 4px 0 8px; line-height: 1.45; }
.zone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.zone-row:last-child { border-bottom: none; }
.zone-tap { cursor: pointer; }
.zone-etat { flex: none; width: 20px; text-align: center; color: var(--ink-3); }
.zone-etat.ok { color: var(--up); font-weight: 700; }
.zone-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-detail { flex: none; font-size: 12px; color: var(--ink-3); }
.zone-suppr {
  flex: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.zone-suppr:hover { color: var(--danger); background: var(--surface-2); }
.zone-suppr svg { width: 17px; height: 17px; }
.zones-add {
  margin: 8px 18px 16px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #f2b705;
  color: #201a05;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* Le partage de position : le bouton passe au vert tant qu'il diffuse. */
.panel-foot .icon-mini.suivi-actif { background: var(--ok, #2e7d32); border-color: var(--ok, #2e7d32); color: #fff; }
.fab.suivi-actif {
  /* Sans cette ligne, l'onde se cale sur la colonne entière des boutons
     plutôt que sur le bouton : elle paraissait énorme et décentrée. */
  position: relative;
  background: var(--ok, #2e7d32);
  border-color: var(--ok, #2e7d32);
  color: #fff;
}
.fab.suivi-actif::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--ok, #2e7d32);
  animation: suivi-pouls 2.6s ease-out infinite;
  pointer-events: none;
}
/* Une onde sobre : elle déborde à peine du bouton et s'efface vite. */
@keyframes suivi-pouls {
  0% { transform: scale(1); opacity: 0.45; }
  65%, 100% { transform: scale(1.28); opacity: 0; }
}

.suivi-card { gap: 0; }

/* Le compteur d'épinglés, dans l'en-tête : on voit d'un coup ce qu'il reste. */
.compteur {
  margin-left: 7px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  color: var(--ink-3);
  vertical-align: middle;
}
.compteur.plein { background: #f2b705; border-color: #f2b705; color: #201a05; }

/* Le réglage des filtres épinglés : une ligne, une étoile. */
.couche-ligne {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-bottom: 7px;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 11px;
  background: var(--surface-2);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.couche-ligne.on { border-color: #f2b705; background: var(--surface); }
.couche-ico { width: 22px; height: 22px; flex: none; color: var(--ink-2); }
.couche-ligne.on .couche-ico { color: var(--ink); }
.couche-texte { flex: 1; min-width: 0; }
.couche-texte b { display: block; font-size: 14px; color: var(--ink); }
.couche-texte i { font-style: normal; font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.couche-etoile { flex: none; display: grid; place-items: center; color: var(--ink-3); }
.couche-etoile svg { width: 21px; height: 21px; }
.couche-etoile.on { color: #f2b705; }
.couche-etoile.on svg path { fill: #f2b705; }

/* La pastille des autres couches se distingue des filtres eux-mêmes. */
.layer-chip.autres { border-style: dashed; }
.layer-chip.autres.on { background: var(--ink); color: #fff; border-style: solid; }

/* La seconde colonne se range contre la première. */
.layer-rail[hidden] { display: none; }
.rail-autres { display: none; }
body[data-mobile='1'] .rail-autres { display: flex; left: 60px; }
.suivi-intro { margin: 2px 0 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.suivi-cible {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  margin-bottom: 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
}
.suivi-cible:hover { border-color: var(--trace); }
/* La fenêtre peut lister vingt itinéraires : elle défile sans manger l'écran. */
.suivi-card .zones-body { max-height: min(58vh, 460px); }
.suivi-cible b { display: block; font-size: 14.5px; color: var(--ink); }
.suivi-cible i { font-style: normal; font-size: 12px; color: var(--ink-3); }
.suivi-lien {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  margin-bottom: 10px;
}
.suivi-actions { display: flex; gap: 9px; margin-bottom: 12px; }
.suivi-actions .btn { flex: 1; }
.suivi-etat { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.suivi-stop {
  width: 100%;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid var(--danger, #c8161d);
  background: none;
  color: var(--danger, #c8161d);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* La bande d'alerte météo : couleur du niveau, texte court, croix pour ranger. */
.meteo-bande {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: stretch;
  max-width: min(560px, calc(100% - 20px));
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  color: #fff;
  background: #e8820c;
}
.meteo-bande[hidden] { display: none; }
.meteo-bande.n1, .meteo-bande.n2 { background: #f2b705; color: #201a05; }
.meteo-bande.n3 { background: #e8820c; }
.meteo-bande.n4 { background: #c8161d; }
.meteo-bande.n5 { background: #6a1b9a; }
.meteo-corps {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 13px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.meteo-corps svg { flex: none; width: 20px; height: 20px; }
.meteo-texte { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.meteo-texte b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meteo-texte i { font-style: normal; font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meteo-fermer {
  flex: none;
  width: 42px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .12);
  border: 0;
  color: inherit;
  cursor: pointer;
}
.meteo-fermer svg { width: 16px; height: 16px; }

/* Le journal de la carte, dans l'état de l'application. */
.journal { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; line-height: 1.35; max-height: 190px; overflow-y: auto; }
.journal span { display: inline-block; min-width: 118px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* La bande « pas de réseau » : ardoise, pas rouge — c'est une information,
   pas un danger. Elle se place sous la bande météo si celle-ci est là. */
.reseau-bande {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100% - 20px));
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-2);
}
.reseau-bande[hidden] { display: none; }
.reseau-bande svg { flex: none; width: 20px; height: 20px; }
.reseau-bande span { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.reseau-bande b { font-size: 13.5px; }
.reseau-bande i { font-style: normal; font-size: 11.5px; opacity: .8; }
body.meteo-visible .reseau-bande { top: 62px; }
body[data-mobile='1'] .reseau-bande { top: 64px; left: 8px; right: 8px; transform: none; max-width: none; }
body[data-mobile='1'].meteo-visible .reseau-bande { top: 118px; }
body[data-mobile='1'].reseau-panne .layer-rail { top: 118px; }
body[data-mobile='1'].reseau-panne.meteo-visible .layer-rail { top: 172px; }

/* Sur mobile, elle se glisse sous la rangée des fonds et pousse le rail. */
body[data-mobile='1'] .meteo-bande { top: 64px; left: 8px; right: 8px; transform: none; max-width: none; }
body[data-mobile='1'].meteo-visible .layer-rail { top: 118px; max-height: calc(100% - 200px); }
body[data-mobile='1'].meteo-visible .aspect-rose { top: 118px; }

/* --- La prévision du parcours : en-tête, chiffres clés, bandeau --- */

/* Le bloc météo, détaché du profil : fond propre, filet net, marge au-dessus.
   On doit voir d'un coup d'œil que c'est une autre information. */
.meteo-bloc {
  flex: none;
  margin-top: 7px;
  border-top: 2px solid var(--rule-strong);
  background: var(--surface-2);
  border-radius: 8px 8px 0 0;
}
.meteo-bloc[hidden] { display: none; }

/* L'en-tête du bloc : c'est lui qui replie et déplie, là où on le cherche. */
.meteo-entete {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 12px 5px 10px;
  background: none;
  border: 0;
  color: var(--ink-3);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.meteo-entete .chevron { width: 15px; height: 15px; flex: none; transition: transform 0.15s; }
.meteo-bloc.replie .meteo-entete .chevron { transform: rotate(-90deg); }
.meteo-entete:hover { color: var(--ink-2); }
.meteo-bloc.replie .meteo-course,
.meteo-bloc.replie .meteo-bandeau { display: none; }

/* Une seule ligne, jamais deux : le graphique a besoin de sa hauteur. Ce qui
   ne tient pas défile latéralement plutôt que de repousser la courbe. */
.chart-tete { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.chart-tete .sect-titre { margin-bottom: 0; flex: none; }
.meteo-course {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 2px 14px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.meteo-course::-webkit-scrollbar { display: none; }
.meteo-course[hidden] { display: none; }

.depart { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-3); flex: none; }
.depart svg { width: 15px; height: 15px; }
.depart input {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px dashed var(--rule-strong);
  padding: 1px 0;
  width: auto;
  min-width: 46px;
}
/* Le champ « heure » dessine sa propre horloge : elle ferait doublon avec la
   nôtre, qui est à la fois plus petite et dans le langage de l'app. */
.depart input::-webkit-calendar-picker-indicator { display: none; }
.depart input::-webkit-inner-spin-button,
.depart input::-webkit-clear-button { display: none; }

.meteo-cles { display: flex; align-items: baseline; gap: 14px; flex-wrap: nowrap; min-width: 0; }
.meteo-cle { display: inline-flex; align-items: baseline; gap: 5px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.meteo-cle b { font-size: 13px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.meteo-cle i { font-style: normal; }
.meteo-cle.attention b { color: #e8820c; }
.meteo-cle.alerte b { color: var(--danger); }
.meteo-cle.calme b { color: var(--ok); }
/* La mention du modèle vit dans l'infobulle du bandeau, pas dans la ligne. */
.meteo-cle.muet { display: none; }
/* Mais une raison d'absence, elle, doit se lire. */
.meteo-cle.muet-visible { color: var(--ink-3); font-style: italic; }

/* Sur ordinateur, le bouton météo prend l'allure des outils de la carte. */
.fab.outil-carte {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  height: auto;
  padding: 0 11px;
  border-radius: var(--radius);
  border: 1px solid var(--float-border);
  background: var(--surface);
  box-shadow: var(--float-shadow);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}
.fab.outil-carte svg { width: 15px; height: 15px; flex: none; }
.fab.outil-carte:hover { color: var(--ink); }

/* Le bouton météo de la colonne de droite, armé en jaune pendant le pointage. */
.fab.suivi-actif, .fab#fab-meteo.on { color: #fff; }
.fab#fab-meteo.on { background: #f2b705; border-color: #f2b705; color: #201a05; }
body.meteo-pointage .maplibregl-canvas { cursor: crosshair; }

/* Mêmes marges que le graphique : chaque colonne tombe où l'on sera. */
.meteo-bandeau {
  flex: none;
  display: flex;
  padding: 2px 14px 3px 46px;
}
.chart-wrap #chart { min-height: 120px; }
.meteo-bandeau[hidden] { display: none; }
.meteo-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px 1px;
  border-radius: 7px;
}
.meteo-col svg { width: 19px; height: 19px; color: var(--ink-2); }
.meteo-col .heure { font-style: normal; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meteo-col .deg { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meteo-col .vent { font-style: normal; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meteo-col .vent.fort { color: #e8820c; font-weight: 700; }
.meteo-col .hors { font-style: normal; color: var(--ink-3); }

/* La météo d'un point : le graphique 48 h, dans une fenêtre assez large. */
.m48-card { width: min(780px, 100%); max-height: min(92vh, 640px); }
.m48-card .zones-head h2 span { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 6px; font-variant-numeric: tabular-nums; }
.m48-card .zones-body { padding-bottom: 14px; }
.m48-durees { display: flex; gap: 0; margin: 0 0 10px; border: 1px solid var(--rule-strong); border-radius: 9px; overflow: hidden; width: fit-content; }
.m48-durees button { border: none; background: transparent; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.m48-durees button + button { border-left: 1px solid var(--rule-strong); }
.m48-durees button.on { background: var(--ink); color: var(--surface); }
.m48-lecture {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 1fr 1fr 1.1fr;
  gap: 4px;
  margin: 2px 0 10px;
  font-variant-numeric: tabular-nums;
}
.m48-lecture div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}
.m48-lecture i { font-style: normal; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m48-lecture b { font-size: 16px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-mobile='1'] .m48-lecture div { padding: 5px 5px; }
body[data-mobile='1'] .m48-lecture b { font-size: 14.5px; }
/* Le graphique déborde sur la marge de la fenêtre : plus de largeur, plus de détail. */
.m48-graphe { width: calc(100% + 24px); margin: 0 -12px; }
.m48-svg { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.m48-attente { margin: 40px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.m48-nuit { fill: var(--ink); fill-opacity: 0.055; }
.m48-minuit { stroke: var(--rule-strong); stroke-width: 1; }
.m48-grille { stroke: var(--rule); stroke-width: 1; }
.m48-base { stroke: var(--rule-strong); stroke-width: 1; }
.m48-gel { stroke: #1f6fd1; stroke-width: 1; stroke-dasharray: 4 3; stroke-opacity: 0.7; }
.m48-titre { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.m48-separation { stroke: var(--rule-strong); stroke-width: 1; }
.m48-axe { font-size: 10px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.m48-unite { font-size: 9.5px; fill: var(--ink-3); }
.m48-jour { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.m48-extreme { font-size: 11px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; font-variant-numeric: tabular-nums; }
.m48-picto { color: var(--ink-2); }
.m48-curseur { stroke: var(--ink); stroke-width: 1; stroke-opacity: 0.45; }
.m48-point { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.m48-legende { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 11.5px; color: var(--ink-2); }
.m48-legende span { display: inline-flex; align-items: center; gap: 5px; }
.m48-legende i { display: inline-block; width: 12px; height: 9px; border-radius: 2px; }
.m48-legende i.thermo { background: linear-gradient(90deg, #1f6fd1, #2b9a6a, #e0a100, #d9480f); width: 18px; }
.m48-legende i.trait { height: 0; border-top: 2.2px solid #2f4858; border-radius: 0; width: 16px; }
.m48-legende i.pointille { height: 0; border-top: 1.8px dashed #5f9ea0; border-radius: 0; width: 16px; }
.m48-astro { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.m48-astro b { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.m48-astro span { display: inline-flex; align-items: center; gap: 4px; }
.m48-astro svg { width: 19px; height: 19px; color: var(--ink-2); flex: none; }

/* Sur mobile, le bandeau respire un peu moins. */
body[data-mobile='1'] .meteo-bandeau { padding-left: 46px; padding-right: 10px; }
body[data-mobile='1'] .meteo-cles { gap: 11px; }
/* Sur mobile la feuille est étroite : le titre laisse la place aux chiffres. */
body[data-mobile='1'] .chart-tete .sect-titre { display: none; }

/* L'interrupteur de la vérification météo, en tête de la fenêtre. */
.meteo-interrupteur {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 11px;
  background: var(--surface-2);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.meteo-interrupteur .bascule {
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--rule-strong);
  position: relative;
  transition: background .15s;
}
.meteo-interrupteur .bascule::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: left .15s;
}
.meteo-interrupteur.on .bascule { background: var(--ok, #2b7a3f); }
.meteo-interrupteur.on .bascule::after { left: 21px; }
.meteo-reafficher { display: block; width: 100%; margin: 0 0 12px; }

/* Le détail : un bloc par alerte, liseré de la couleur du niveau. */
.meteo-alerte { border-left: 4px solid #e8820c; padding: 8px 12px 10px; margin-bottom: 12px; background: var(--surface-2); border-radius: 0 10px 10px 0; }
.meteo-alerte.n1, .meteo-alerte.n2 { border-color: #f2b705; }
.meteo-alerte.n3 { border-color: #e8820c; }
.meteo-alerte.n4 { border-color: #c8161d; }
.meteo-alerte.n5 { border-color: #6a1b9a; }
.meteo-alerte-tete { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.meteo-alerte-tete b { font-size: 15px; }
.meteo-alerte-tete .niveau { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.meteo-quand { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.meteo-texte-officiel { font-size: 13.5px; line-height: 1.5; margin: 8px 0 4px; color: var(--ink); }
.meteo-lien { display: inline-block; margin-top: 6px; margin-right: 12px; font-size: 13px; font-weight: 600; color: var(--time); }

/* La bulle d'une piste de ski. */
.bulle-piste { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.ps-tete { display: flex; align-items: center; gap: 9px; }
.ps-tete > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.ps-tete b { font-size: 14.5px; }
.ps-tete i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.ps-pastille { flex: none; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 7px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.ps-faits { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ps-faits span { background: var(--surface-2); border-radius: 999px; padding: 2px 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ps-extras { color: var(--ink-2); }
.ps-source { font-size: 9.5px; color: var(--ink-3); }

/* La note durable de la couche avalanches : ardoise, comme une information. */
.toast.av-note { background: var(--ink); color: #fff; opacity: 1; }

.av-demo { background: #6a1b9a; color: #fff; font-weight: 700; font-size: 11.5px; padding: 4px 8px; border-radius: 6px; text-align: center; }

/* La bulle du danger d'avalanches. */
.bulle-av { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; line-height: 1.4; }
.av-tete { display: flex; align-items: center; gap: 9px; }
.av-tete b { font-size: 15px; }
.av-pastille {
  display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 6px;
  border-radius: 7px; font-weight: 800; font-size: 15px; color: #1a1a1a; border: 1px solid rgba(0,0,0,.25);
  background: #cfcfcf;
}
.av-pastille.n1 { background: #ccff66; } .av-pastille.n2 { background: #ffff00; }
.av-pastille.n3 { background: #ff9900; } .av-pastille.n4 { background: #ff0000; color: #fff; }
.av-pastille.n5 { background: repeating-conic-gradient(#ff0000 0 25%, #1a1a1a 0 50%) 0 0 / 10px 10px; color: #fff; text-shadow: 0 0 3px #000; }
.av-ligne { color: var(--ink-2); }
.av-ligne.muet { color: var(--ink-3); font-size: 11.5px; }
.av-problemes { margin: 2px 0; padding-left: 16px; color: var(--ink); }
.av-problemes li { margin: 2px 0; }
.av-echelle { position: relative; display: flex; margin: 6px 0 0; border-radius: 6px; }
.av-case { flex: 1; height: 22px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: rgba(0,0,0,.55); }
.av-case:first-child { border-radius: 6px 0 0 6px; }
.av-case:last-child { border-radius: 0 6px 6px 0; }
.av-case.n1 { background: #ccff66; } .av-case.n2 { background: #ffff00; } .av-case.n3 { background: #ff9900; }
.av-case.n4 { background: #ff0000; color: rgba(255,255,255,.8); }
.av-case.n5 { background: repeating-conic-gradient(#ff0000 0 25%, #1a1a1a 0 50%) 0 0 / 8px 8px; color: #fff; }
.av-case.actif { outline: 2.5px solid #1a1a1a; outline-offset: 1px; z-index: 1; color: #000; font-size: 13px; transform: scaleY(1.18); }
.av-case.n4.actif, .av-case.n5.actif { color: #fff; }
.av-repere { position: absolute; bottom: -9px; width: 0; height: 0; margin-left: -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 7px solid #1a1a1a; }
.av-mots { display: flex; margin: 9px 0 2px; }
.av-mots span { flex: 1; text-align: center; font-size: 9.5px; color: var(--ink-3); }
.av-problemes li span { display: block; color: var(--ink-2); margin-top: 1px; }
.av-liens a { font-weight: 700; color: var(--time); }
.av-source { font-size: 9.5px; color: var(--ink-3); opacity: .85; }
.av-source a { color: inherit; }

/* La bulle d'un arrêt ou d'un parking touché sur la carte. */
.osm-bulle { display: flex; flex-direction: column; gap: 3px; padding: 2px 2px 0; }
.osm-bulle b { font-size: 14.5px; line-height: 1.25; }
.osm-bulle i { font-style: normal; font-size: 12px; color: var(--ink-3); }
/* La bulle doit passer DEVANT le rail de filtres et les boutons flottants,
   sinon les pastilles la recouvrent à moitié. */
.maplibregl-popup { z-index: 45; }
.maplibregl-popup-content { border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22); }

/* Les prochains départs : trois lignes discrètes, jamais tapageuses. */
.osm-horaires {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-3);
}
.osm-horaires b { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.osm-horaires em { font-style: normal; }

.osm-bulle a {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f2b705;
  color: #201a05;
  font-weight: 700;
  font-size: 13.5px;
  text-align: center;
  text-decoration: none;
}

/* --- Mode dessin : la carte d'abord --- */

/* Pendant le tracé, la recherche et les coordonnées s'effacent. Le choix du
   fond (carte, photo, hiver), le relief et les filtres restent : ils servent
   pendant qu'on dessine (choix d'Elio). */
body[data-editing='yes'] .map-search,
body[data-editing='yes'] #btn-loupe,
body[data-editing='yes'] .coord-readout { display: none; }

/* Les deux gestes du tracé : valider, abandonner. */
.editor-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 10px 0 4px;
}
.draft-act {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.draft-act svg { width: 24px; height: 24px; }
.draft-act:hover { transform: translateY(-1px); }
.draft-act.ok { background: #f2b705; border-color: #f2b705; color: #201a05; }
.draft-act.ko:hover { color: var(--danger); border-color: var(--danger); }

/* En bas pendant le dessin : quatre informations, pictogramme et mot. */
.draft-figures { display: none; }
/* Le bandeau du bas se réorganise pendant le dessin : les quatre chiffres
   en bandeau, le profil dessous, plein cadre. */
body[data-editing='yes'] .panel-bottom {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
body[data-editing='yes'] .draft-figures {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 46px;
  padding: 12px 18px 8px;
  border-bottom: 1px solid var(--rule);
}
body[data-editing='yes'] .draft-figures[hidden] { display: none; }
/* Le bloc habituel et les réglages laissent la place aux quatre chiffres. */
body[data-editing='yes'] .stats,
body[data-editing='yes'] .settings { display: none; }
.draft-figures span { display: inline-flex; align-items: baseline; gap: 8px; }
.draft-figures svg { width: 17px; height: 17px; align-self: center; color: var(--ink-3); }
.draft-figures i {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.draft-figures b { font-size: 19px; font-weight: 700; color: var(--ink); }
.draft-figures .up b { color: var(--up); }
.draft-figures .time b { color: var(--time); }

/* En dessin, le nom disparaît de l'en-tête : les chevrons prennent le milieu
   de la feuille et la croix reste à droite. */
body[data-mobile='1'].mode-dessin .sheet-head {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface);
}
body[data-mobile='1'].mode-dessin .sheet-head { grid-template-columns: 46px 1fr; }
body[data-mobile='1'].mode-dessin .sheet-toggle { grid-column: 1; justify-self: start; }
body[data-mobile='1'].mode-dessin .sheet-figures { grid-column: 2; }
/* En dessin, la croix de la feuille ferait doublon avec le grand ✗ de la carte. */
body[data-mobile='1'].mode-dessin .sheet-head-row { display: none; }

/* Les quatre chiffres au centre de l'en-tête : fins, lisibles, sans étiquette. */
.sheet-figures { display: none; }
body[data-mobile='1'] .sheet-figures {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 21.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
}
body[data-mobile='1'] .sheet-figures[hidden] { display: none; }
.sheet-figures span { display: inline-flex; align-items: center; gap: 4px; }
.sheet-figures b { font-weight: 700; }
.fig-pic { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.sheet-figures .up b { color: var(--up); }
.sheet-figures .down b { color: var(--ink-3); }
.sheet-figures .time b { color: var(--time); }

/* Dépliée en dessin : le profil vient tout de suite après les chiffres,
   les réglages ensuite. Le bloc statistiques ferait doublon. */
body[data-mobile='1'].mode-dessin .panel-bottom {
  display: flex;
  flex-direction: column;
}
body[data-mobile='1'].mode-dessin .sheet-head { order: 0; }
body[data-mobile='1'].mode-dessin .chart-wrap { order: 1; min-height: 190px; }
body[data-mobile='1'].mode-dessin .settings { order: 2; }
body[data-mobile='1'].mode-dessin .stats { display: none; }

/* En mode dessin : on garde le choix du fond (carte, photo, hiver), le relief
   et les filtres de gauche — utiles pendant le tracé (choix d'Elio). La
   recherche, le compte, l'aide et l'invitation à installer s'effacent. */
body[data-mobile='1'].mode-dessin .map-search,
body[data-mobile='1'].mode-dessin #btn-loupe,
body[data-mobile='1'].mode-dessin .install-nudge,
body[data-mobile='1'].mode-dessin #account,
body[data-mobile='1'].mode-dessin #btn-help,
body[data-mobile='1'].mode-dessin #fab-library { display: none; }

/* Pendant le cadrage, la carte seule : boutons et filtres s'effacent. */
body.zone-pick .fabs,
body.zone-pick .install-nudge,
body.zone-pick .layer-rail,
body.zone-pick .map-bottom-left,
body.zone-pick .topbar-mini { visibility: hidden; }

/* La petite fenêtre de nommage à la validation d'un tracé. */
#name-modal { align-items: flex-start; padding-top: 16px; }
.name-card { padding: 18px; gap: 12px; width: min(360px, 100%); }
.name-card h2 { font-size: 17px; margin: 0; }
.name-final {
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  padding: 10px 12px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  width: 100%;
}
.name-final:focus { border-color: var(--trace); }
.name-actions { display: flex; justify-content: flex-end; gap: 10px; }
.name-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}
.name-folder { appearance: auto; }

/* Le cadrage d'une zone : le rectangle est fixe, la carte glisse dessous. */
.zone-cadre {
  position: fixed;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(78vw, 640px);
  height: min(50vh, 520px);
  z-index: 45;
  pointer-events: none;
  border: 2px dashed #c8161d;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(20, 24, 28, 0.32);
}
.zone-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 46;
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  min-width: 240px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
}
.zone-est { font-size: 13px; color: var(--ink-2); }
.zone-actions { display: flex; gap: 10px; }
.zone-go { background: #f2b705; border-color: #f2b705; font-weight: 700; }
.zone-go:disabled { opacity: 0.45; cursor: not-allowed; }

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 19, 21, 0.92);
  color: #f4f1ea;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.install-modal[hidden] { display: none; }
.install-modal-body {
  max-width: 380px;
  text-align: center;
}
.install-modal-body h2 { font-size: 22px; margin: 0 0 16px; }
.install-modal-body p { font-size: 15px; line-height: 1.6; margin: 0; color: rgba(244, 241, 234, 0.88); }
.install-modal-body p b { color: #fff; }

.install-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.install-close:hover { background: rgba(255, 255, 255, 0.2); }

/* La flèche : discrète, animée, elle pointe vers le coin où se trouve le
   geste à faire — en haut à droite sur Android, en bas sur iPhone. */
.install-arrow {
  position: fixed;
  width: 90px;
  height: 90px;
  color: #ffce00;
  opacity: 0;
  animation: install-arrow-in 0.5s ease-out 0.2s forwards, install-arrow-bob 1.6s ease-in-out 0.7s infinite;
}
.install-arrow.top { top: 64px; right: 18px; transform: scale(1, 1); }
.install-arrow.bottom { bottom: 78px; left: 50%; transform: translateX(-50%) rotate(90deg) scaleX(-1); }
@keyframes install-arrow-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes install-arrow-bob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -8px; }
}

/* Le téléchargement d'une région, dans le panneau des couches. */
.offline-btn {
  position: absolute;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  height: 34px;
  bottom: 12px;
  left: 336px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: var(--radius);
  box-shadow: var(--float-shadow);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.offline-btn svg { width: 15px; height: 15px; flex: none; }
.offline-btn:hover { color: var(--ink); }
body[data-mobile='1'] .offline-btn { display: none; }


/* ------------------------------------------------- bas d'écran mobile
   Trois étages nets au lieu d'un empilement qui se chevauche :
   les commandes, puis l'échelle, puis l'attribution tout en bas. */

/* La rangée des commandes vit EN HAUT sur mobile : le bas reste libre pour
   la feuille des infos de randonnée. Elle défile horizontalement plutôt que
   de déborder sur un écran étroit. */
body[data-mobile='1'] .map-bottom-left {
  top: 12px;
  bottom: auto;
  left: 8px;
  right: 8px;
  max-width: none;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  align-items: center;
}
/* L'avatar ferme la rangée, poussé à droite. */
body[data-mobile='1'] #map-bottom-left .account { position: static; margin-left: auto; }
body[data-mobile='1'] #map-bottom-left .avatar { width: 38px; height: 38px; }
body[data-mobile='1'] .loupe-carte { padding: 0 11px; }
/* L'aide n'a plus de bouton sur la carte : elle est dans le menu du compte. */
body[data-mobile='1'] #btn-help { display: none; }

/* La recherche se déplie par-dessus la rangée, et rien d'autre ne bouge. */
body[data-mobile='1'] .map-search { display: none; }
body[data-mobile='1'].recherche-ouverte .map-search {
  display: flex;
  top: 12px;
  left: 8px;
  right: 8px;
  width: auto;
  z-index: 30;
}
body[data-mobile='1'].recherche-ouverte .map-bottom-left { visibility: hidden; }
/* Fermer la recherche : séparée de la croix native, qui ne fait qu'effacer. */
.search-fermer { display: none; }
body[data-mobile='1'] .search-fermer {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 100%;
  margin-right: -10px;
  border: none;
  border-left: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
}
body[data-mobile='1'] .search-fermer svg { width: 16px; height: 16px; color: inherit; }
body[data-mobile='1'] .map-bottom-left::-webkit-scrollbar { display: none; }
body[data-mobile='1'] .basemap-switch { flex: none; }
body[data-mobile='1'] .basemap-switch button { padding: 7px 11px; }
body[data-mobile='1'] .view-3d { flex: none; height: 36px; }

/* Étage 2 et 3 — l'échelle et l'attribution partagent une bande propre,
   posée tout en bas, sans fond opaque qui masquerait la carte. */
body[data-mobile='1'] .maplibregl-ctrl-bottom-right {
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 2px;
}
body[data-mobile='1'] .maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 !important; }
body[data-mobile='1'] .maplibregl-ctrl-attrib {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 82%, transparent) !important;
}
body[data-mobile='1'] .maplibregl-ctrl-scale {
  font-size: 9px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-radius: 5px;
}

/* La boussole est déménagée dans la rangée du haut : son coin d'origine
   ne sert plus à rien sur mobile. */
body[data-mobile='1'] .maplibregl-ctrl-bottom-left { display: none; }
body[data-mobile='1'] .fab-compass {
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  overflow: hidden;
  box-shadow: var(--shadow-2);
  margin: 0 !important;
  float: none !important;
  display: grid;
  place-items: center;
}
body[data-mobile='1'] .fab-compass button {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}
body[data-mobile='1'] .fab-compass .maplibregl-ctrl-icon { transform: scale(1.3); }

/* Le bas d'écran est libre : la colonne des boutons s'en approche, en
   laissant juste la place de l'échelle et de l'attribution. */
body[data-mobile='1'] .fabs { bottom: 40px; }
body[data-mobile='1'].sheet-open .fabs { bottom: calc(48vh + 18px); }

/* L'invitation à installer prend toute la largeur au ras du bord, et le reste
   du bas d'écran remonte le temps qu'elle est là : aucun recouvrement. */
body[data-mobile='1'] .install-nudge { bottom: 40px; left: 12px; right: 76px; transform: none; width: auto; }
/* La feuille des infos prime : le rappel s'efface tant qu'elle est ouverte. */
body[data-mobile='1'].sheet-open .install-nudge { display: none; }

/* Le rail des couches démarre sous la rangée des commandes et s'arrête avant
   le bas : au besoin il passe sur une deuxième colonne. */
body[data-mobile='1'] .layer-rail {
  top: 66px;
  max-height: calc(100% - 148px);
}
body[data-mobile='1'] .aspect-rose { top: 66px; left: 64px; }
body[data-mobile='1'] .sun-panel {
  top: 64px;
  bottom: auto;
  left: 62px;
  right: 8px;
  transform: none;
  max-width: none;
}
body[data-mobile='1'] .update-bar { top: auto; bottom: 44px; }
/* Pupitre du soleil ouvert : le rail descend d'un étage pour lui laisser
   toute la largeur — sa deuxième colonne visait le même espace. */
body[data-mobile='1'].sun-open .layer-rail {
  top: calc(74px + var(--sun-h, 90px));
  max-height: calc(100% - 158px - var(--sun-h, 90px));
}
body[data-mobile='1'].sun-open .aspect-rose { top: calc(74px + var(--sun-h, 90px)); }
body[data-mobile='1'] .sun-panel { left: 8px; z-index: 12; }

/* Sur un téléphone, on zoome à deux doigts : les boutons + et − ne servent
   qu'à encombrer. La boussole, elle, reste utile en relief. */
body[data-mobile='1'] .maplibregl-ctrl-zoom-in,
body[data-mobile='1'] .maplibregl-ctrl-zoom-out { display: none; }


/* La bannière de mise à jour : visible, jamais bloquante. */
.update-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
}
.update-bar[hidden] { display: none; }


/* Le bouton d'installation de la porte d'entrée. */
.gate-essai { margin: 4px 0 -6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.gate-prix { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.gate-prix b { color: var(--ink); font-size: 13.5px; }
.gate-install { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 4px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.gate-install svg { width: 14px; height: 14px; }
.gate-install:hover { color: var(--ink); }
.gate-install[hidden] { display: none; }


/* Le hors ligne se pilote depuis le tiroir des itinéraires sur mobile. */


/* La feuille à deux étages : « mini » ne montre que l'en-tête (nom + chevrons),
   « ouverte » montre tout. On passe de l'un à l'autre d'un glissement ou d'un
   toucher sur les chevrons. */
.sheet-head { display: none; }
body[data-mobile='1'] .sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  touch-action: none;
  cursor: grab;
  /* Collé en haut : en faisant défiler la feuille, on garde sous le pouce les
     chevrons et la croix — sinon fermer obligeait à remonter tout le contenu. */
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface);
}
/* Un filet n'apparaît que lorsque le contenu passe dessous. */
body[data-mobile='1'].sheet-open .sheet-head { border-bottom: 1px solid var(--rule); }
/* Chevrons, titre et croix sur une seule ligne : la feuille reste fine. */
body[data-mobile='1'] .sheet-toggle {
  display: grid;
  flex: none;
  margin: 0;
  width: 46px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: var(--surface-3);
}
.sheet-head-row {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sheet-head-row b {
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-toggle {
  place-items: center;
  color: var(--ink-2);
  cursor: pointer;
}
.sheet-toggle svg { width: 20px; height: 20px; transition: transform 0.2s; }

/* La croix : elle désélectionne la randonnée et la feuille s'efface. */
.sheet-close {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sheet-close svg { width: 17px; height: 17px; }
.sheet-close:hover { color: var(--danger); border-color: var(--danger); }
body[data-mobile='1'].sheet-open .sheet-toggle svg { transform: rotate(180deg); }

/* L'étage mini : la feuille dépasse juste de la hauteur de son en-tête. */
body[data-mobile='1'].sheet-mini .panel-bottom { transform: translateY(calc(100% - var(--feuille-mini, 140px))); }
body[data-mobile='1'].sheet-mini .fabs { bottom: calc(var(--feuille-mini, 140px) + 14px); }
/* Sur mobile, le titre du bloc stats doublonne celui de l'en-tête de feuille. */
body[data-mobile='1'] .bottom-title { display: none; }
body[data-mobile='1'].sheet-mini .install-nudge { display: none; }
body[data-mobile='1'].lib-open .install-nudge { display: none; }


/* Le menu contextuel d'un itinéraire doit passer DEVANT le tiroir (z 40) :
   c'est depuis le tiroir qu'on l'ouvre sur mobile. */
body[data-mobile='1'] .trace-menu { z-index: 60; }

/* ============================================================ radar pluie */
.fab#fab-radar.on { background: #1f5fc4; border-color: #1f5fc4; color: #fff; }
.radar-panel {
  position: absolute;
  top: 54px;
  right: 12px;
  z-index: 12;
  width: min(440px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 10px 6px;
  background: var(--surface);
  border: 1px solid var(--float-border);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
}
.radar-panel[hidden] { display: none; }
.radar-ligne { display: flex; align-items: center; gap: 8px; }
.radar-play, .radar-mini-btn {
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.radar-play { width: 34px; height: 34px; border: none; background: #1f5fc4; color: #fff; }
.radar-play:disabled { opacity: 0.45; cursor: default; }
.radar-mini-btn { width: 30px; height: 30px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2); }
.radar-mini-btn.alerte { color: var(--danger); border-color: var(--danger); }
.radar-panel.infos #radar-infos { background: var(--surface-2); color: var(--ink); }
.radar-play svg, .radar-mini-btn svg { width: 15px; height: 15px; }
.radar-play .icone-pause { display: none; }
.radar-panel.lecture .radar-play .icone-pause { display: block; }
.radar-panel.lecture .radar-play .icone-play { display: none; }
.radar-temps { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.radar-heure {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* La frise : une grille horaire sur toute la largeur, le curseur par-dessus. */
.radar-frise { position: relative; height: 42px; }
.radar-grille { position: absolute; inset: 0; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--rule); overflow: hidden; }
.rg-passe { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(31, 95, 196, 0.09); }
.rg-trait { position: absolute; top: 17px; bottom: 13px; width: 1px; background: var(--rule-strong); opacity: 0.6; }
.rg-trait.six { top: 14px; bottom: 12px; opacity: 1; }
.rg-trait.minuit { top: 0; bottom: 0; background: var(--ink-3); opacity: 0.55; }
.rg-heure { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 9.5px; line-height: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rg-jour { position: absolute; top: 1px; transform: translateX(-50%); font-size: 10.5px; font-weight: 600; line-height: 13px; color: var(--ink-2); white-space: nowrap; }
.rg-maintenant { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #c92a2a; }
.radar-frise input[type='range'] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: grab; touch-action: none; }
.radar-frise input[type='range']::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.radar-frise input[type='range']::-moz-range-track { height: 100%; background: transparent; }
.radar-frise input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 42px; border-radius: 4px; background: #1f5fc4; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.radar-frise input[type='range']::-moz-range-thumb { width: 6px; height: 40px; border-radius: 4px; background: #1f5fc4; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.radar-frise input[type='range']:disabled { opacity: 0.4; }
/* La prévision se distingue du radar mesuré : l'heure passe en italique bleu. */
.radar-panel.mode-prevision .radar-heure { font-style: italic; color: #1747b5; }
.radar-legendes { display: flex; flex-direction: column; gap: 5px; }
.radar-legende { display: flex; align-items: flex-end; gap: 3px; }
.radar-classe { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radar-classe i { display: block; height: 7px; border-radius: 2px; }
.radar-classe b { font-size: 10px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.radar-classe em { font-style: normal; font-size: 9.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radar-unite { flex: none; font-size: 9.5px; color: var(--ink-3); padding-bottom: 1px; }
.radar-legende-neige { align-items: center; gap: 6px; }
.radar-legende-neige .radar-classe { flex: 0 0 34px; }
.radar-neige-titre { font-size: 10px; font-weight: 600; color: var(--ink-2); }
/* Les explications : fermées par défaut, ouvertes par le bouton « i ». */
.radar-details { display: none; border-top: 1px solid var(--rule); padding-top: 6px; }
.radar-panel.infos .radar-details { display: block; }
.radar-etat { margin: 0 0 4px; font-size: 11.5px; color: var(--ink-2); }
.radar-etat:empty { display: none; }
.radar-etat.erreur { color: var(--danger); font-weight: 600; }
/* Pendant le radar, le panneau du soleil ne se superpose pas. */
body.radar-actif .sun-panel { top: 172px; }
/* Sur mobile, le panneau du radar se centre sous l'en-tête, pleine largeur. */
/* Une alerte météo affichée garde sa place : le radar passe dessous. */
body.meteo-visible .radar-panel { top: 64px; }

/* Le radar sur téléphone : une barre compacte en bas, entre le bord gauche et
   la colonne de boutons de droite, au-dessus de la rangée de « Tracer ». La
   légende et les explications ne s'ouvrent qu'avec le bouton « i », vers le
   haut. Elle suit les boutons quand la feuille d'itinéraire s'ouvre. */
body[data-mobile='1'] .radar-panel {
  top: auto;
  left: 8px;
  right: 8px;
  width: auto;
  bottom: 34px;
  padding: 7px 8px 6px;
}
/* En mode radar, le bas de l'écran lui appartient : les boutons flottants et
   le rappel d'installation s'effacent, la frise prend toute la largeur. */
body[data-mobile='1'].radar-actif .fabs,
body[data-mobile='1'].radar-actif #install-nudge,
body[data-mobile='1'].soleil-actif .fabs,
body[data-mobile='1'].soleil-actif #install-nudge { display: none !important; }
body[data-mobile='1'] .radar-panel .radar-frise { order: 3; }
body[data-mobile='1'] .radar-panel .radar-ligne { order: 4; }
body[data-mobile='1'] .radar-panel .radar-legendes { order: 1; display: none; }
body[data-mobile='1'] .radar-panel .radar-details { order: 2; border-top: none; padding-top: 0; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
body[data-mobile='1'] .radar-panel.infos .radar-legendes { display: flex; }
body[data-mobile='1'].sheet-open .radar-panel { bottom: calc(48vh + 84px); }
body[data-mobile='1'].sheet-mini .radar-panel { bottom: calc(var(--feuille-mini, 140px) + 80px); }
/* L'icône du radar (ondes vers un nuage) occupe plus de place dans la pastille. */
.fab#fab-radar:not(.outil-carte) svg { width: 31px; height: 31px; }
.fab#fab-radar.outil-carte svg { width: 18px; height: 18px; }

/* Le choix d'activité : trois icônes (à pied, VTT électrique, VTT). */
.activite-icones { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--rule); }
.activite-icones button {
  width: 34px; height: 30px; border: none; border-radius: 7px; background: transparent;
  color: var(--ink-3); display: grid; place-items: center; cursor: pointer;
}
.activite-icones button svg { width: 21px; height: 21px; }
.activite-icones button:hover { color: var(--ink); }
.activite-icones button.on { background: var(--solid); color: var(--solid-ink); }
.draft-figures .activite-icones { margin-left: -12px; align-self: center; }
/* Pendant le dessin, les chiffres restent sur une ligne malgré le sélecteur. */
body[data-editing='yes'] .draft-figures { gap: 26px; }
.draft-figures span { flex: none; white-space: nowrap; }
/* Sur téléphone, les quatre chiffres prennent toute la largeur de l'en-tête :
   le choix d'activité a sa propre rangée, centrée dessous, en dessin seulement. */
.activite-feuille { display: none; }
body[data-mobile='1'].mode-dessin .activite-feuille {
  display: inline-flex;
  grid-column: 1 / -1;
  justify-self: center;
  margin: 2px 0 2px;
}
.activite-feuille button { width: 34px; height: 28px; }
/* En dessin sur téléphone : les quatre chiffres sur deux rangées de deux —
   sur une seule, le temps sortait de l'écran sur les petites largeurs. */
body[data-mobile='1'].mode-dessin .sheet-figures {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: space-evenly;
  column-gap: 14px;
  row-gap: 2px;
  font-size: 20px;
}
body[data-mobile='1'].mode-dessin .sheet-figures[hidden] { display: none; }
/* L'éclair du VTT électrique, détouré : un liseré de la couleur du fond le
   détache du cadre du vélo. */
.activite-icones .eclair { stroke: var(--surface-2); stroke-width: 2.4px; paint-order: stroke; stroke-linejoin: round; }
.activite-icones button.on .eclair { stroke: var(--solid); }
/* Dans les réglages, les trois activités se partagent toute la largeur. */
#activite-group { display: flex; width: 100%; }
#activite-group button { flex: 1; }
.radar-flocon { width: 15px; height: 15px; vertical-align: -3px; margin-left: 2px; }

/* ============================================================ mode météo */
/* Les boutons Météo et Radar d'origine ne s'affichent plus : leurs pastilles
   vivent dans la colonne météo, ouverte par le bouton « Météo » du haut. */
#fab-meteo, #fab-radar { display: none !important; }
body.mode-meteo #layer-rail,
body.mode-meteo #layer-rail-autres { display: none !important; }
/* En mode météo, on ne trace pas : le bouton « Tracer » s'efface (l'appui long donne la météo). */
body.mode-meteo #fab-draw { display: none !important; }
#btn-meteo-mode.on { background: var(--solid); color: var(--solid-ink); border-color: var(--solid); }
.basemap-switch .bascule-fond { font-weight: 600; color: var(--ink); min-width: 74px; }
body[data-mobile='1'] .basemap-switch .bascule-fond { min-width: 0; }

/* La bulle d'une station de neige : la hauteur en grand. */
.neige-hs { font-size: 26px; font-weight: 700; line-height: 1.1; color: #1f4fb0; margin: 6px 0 4px; }
.neige-hs span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); }

/* La neige fraîche : la même présentation que le radar — la frise des dix
   jours en pleine largeur, la tranche (24, 48 ou 72 h jusqu'à 7 h) en bloc
   à faire glisser, et dessous la durée, la période et la croix. */
.neige-panel {
  position: absolute; top: 54px; right: 12px; z-index: 12;
  width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 6px;
  padding: 7px 8px 6px;
  background: var(--surface); border: 1px solid var(--float-border); border-radius: 12px; box-shadow: var(--float-shadow);
}
.neige-panel[hidden] { display: none; }
body.radar-actif .neige-panel { top: 176px; }
.nf-ligne { display: flex; align-items: center; gap: 8px; }
.nf-durees { display: flex; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; flex: none; }
.nf-durees button { border: none; background: transparent; padding: 5px 10px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.nf-durees button + button { border-left: 1px solid var(--rule-strong); }
.nf-durees button.on { background: var(--ink); color: var(--surface); }
.nf-periode { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.nf-periode.prevue { font-style: italic; color: #1747b5; }
.nf-frise { position: relative; height: 42px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; display: grid; grid-template-columns: repeat(10, 1fr); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.nf-jour { position: relative; z-index: 2; pointer-events: none; border: none; border-left: 1px solid var(--rule); background: transparent; font: inherit; font-size: 11px; line-height: 1.15; color: var(--ink-2); padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.nf-jour span { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nf-jour:first-child { border-left: none; }
.nf-jour.hors { color: var(--ink-3); opacity: 0.45; }
/* La période : un bloc qui couvre toute la hauteur de la frise, à faire glisser. */
.nf-bande { position: absolute; top: 2px; bottom: 2px; background: rgba(50, 150, 180, 0.28); border-radius: 4px; border: 2px solid #0670b0; pointer-events: none; z-index: 1; }
.nf-maintenant { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #c92a2a; pointer-events: none; z-index: 3; }
.nf-source { margin: 0; font-size: 11.5px; color: var(--danger); }
.nf-source:empty { display: none; }
#nf-legende .radar-classe b { font-size: 9.5px; }
#nf-legende .radar-classe i { height: 5px; }
body[data-mobile='1'] .neige-panel { top: auto; left: 8px; right: 8px; width: auto; bottom: 34px; }
body[data-mobile='1'].radar-actif .neige-panel { bottom: 150px; }
body[data-mobile='1'].sheet-open .neige-panel { bottom: calc(48vh + 84px); }
body[data-mobile='1'].sheet-mini .neige-panel { bottom: calc(var(--feuille-mini, 140px) + 80px); }
body[data-mobile='1'] .nf-jour { font-size: 10px; }
/* Comme pour le radar : le bas de l'écran appartient au panneau. */
body[data-mobile='1'].neige-actif .fabs,
body[data-mobile='1'].neige-actif #install-nudge { display: none !important; }

/* La bulle d'une webcam : l'image en direct, pleine largeur. */
.webcam-bulle img { display: block; width: 100%; max-height: 190px; object-fit: cover; border-radius: 8px; margin: 4px 0 2px; cursor: zoom-in; background: var(--surface-2); }

/* Le soleil : le panneau du radar, avec sa propre légende en ligne. */
.soleil-panel.lecture .radar-play .icone-pause { display: block; }
.soleil-panel.lecture .radar-play .icone-play { display: none; }
.soleil-panel .radar-play { background: #d9a400; }
.soleil-panel .radar-frise input[type='range']::-webkit-slider-thumb { background: #d9a400; }
.soleil-panel .radar-frise input[type='range']::-moz-range-thumb { background: #d9a400; }
.soleil-legende { display: flex; gap: 7px; align-items: center; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.soleil-legende span { display: inline-flex; align-items: center; gap: 3px; }
.soleil-legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
body.radar-actif .soleil-panel { top: 176px; }

/* La flèche de cap remplace le point bleu quand le téléphone a une boussole. */
.cap-fleche { display: none; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); pointer-events: none; }
/* Un bleu soutenu, un liseré blanc fin et une ombre : lisible même sur un fond clair. */
.cap-fleche svg { width: 100%; height: 100%; fill: #0b57d0; stroke: #fff; stroke-width: 1; stroke-linejoin: round; filter: drop-shadow(0 1px 2.5px rgba(0, 0, 0, 0.5)); }
.maplibregl-user-location-dot.avec-cap { background: transparent; }
.maplibregl-user-location-dot.avec-cap::before, .maplibregl-user-location-dot.avec-cap::after { display: none; }
.maplibregl-user-location-dot.avec-cap .cap-fleche { display: block; }
.maplibregl-user-location-dot-stale .cap-fleche svg { fill: #9aa0a6; }

/* Plusieurs webcams au même endroit : une liste qui défile dans la bulle. */
.webcam-bulle.plusieurs { max-height: 60vh; overflow-y: auto; }
.webcam-bloc { display: flex; flex-direction: column; gap: 3px; }
.webcam-bloc + .webcam-bloc { border-top: 1px solid var(--rule); padding-top: 8px; margin-top: 6px; }

/* Publier un tracé sur Rando Facile (administrateur) */
.rf-voile { position: fixed; inset: 0; z-index: 100; background: rgba(22, 24, 26, .45); display: grid; place-items: center; padding: 16px; }
.rf-boite { background: var(--surface); color: var(--ink); border-radius: 10px; padding: 18px; width: min(420px, 100%); box-shadow: var(--shadow-2); display: grid; gap: 10px; }
.rf-boite h3 { margin: 0; font-size: 17px; }
.rf-boite p { margin: 0; color: var(--ink-2); font-size: 14px; }
.rf-boite label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.rf-boite select, .rf-boite input { font: inherit; padding: 7px 8px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.rf-boite .row { display: flex; gap: 8px; justify-content: flex-end; }
.rf-boite .rf-ok { background: var(--solid); border-color: var(--solid); color: var(--solid-ink); font-weight: 600; }

/* La connexion Apple : bouton noir, selon les règles d'Apple. */
.gate-apple { background: #000; color: #fff; border-color: #000; margin-top: 8px; }
.gate-apple svg { color: #fff; }
.gate-apple:hover, .gate-apple:focus-visible { background: #2a2a2a; border-color: #2a2a2a; color: #fff; }
.trace-menu .mini-btn.danger { color: var(--danger); }

/* La visite guidée : voile sombre, élément présenté découpé en clair, bulle. */
.visite { position: fixed; inset: 0; z-index: 1000; }
.visite-trou { position: fixed; box-shadow: 0 0 0 200vmax rgba(10, 14, 18, 0.68); border-radius: 12px; transition: all .25s ease; pointer-events: none; outline: 2px solid rgba(255, 255, 255, 0.85); }
.visite-bulle { position: fixed; background: var(--surface); color: var(--ink); border-radius: 14px; padding: 14px 16px 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35); transition: left .25s ease, top .25s ease; }
.visite-compte { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .04em; }
.visite-bulle h3 { margin: 3px 0 5px; font-size: 17px; }
.visite-bulle p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.visite-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.visite-espace { flex: 1; }
.visite-actions button { border: none; border-radius: 9px; padding: 8px 13px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.visite-passer { background: transparent; color: var(--ink-3); padding-left: 0 !important; }
.visite-prec, .visite-perso { background: var(--surface-2); color: var(--ink); }
.visite-suiv, .visite-suiv-style { background: #e01e26 !important; color: #fff !important; }
