/* Traverse — feuille de style unique. Jetons repris des maquettes Phase B. */
:root {
  --violet: #8b3dff; --violet-fonce: #6b2fd6; --violet-texte: #5b2bb0; --violet-pale: #ece2ff; --violet-voile: #f3effa;
  --rose: #ff8fd0;
  --encre: #0b0b0a; --encre-2: #3b3934; --encre-3: #5d5a53;
  --papier: #f6f4ef; --carte: #ffffff; --trait: rgba(11,11,10,.08); --gris: #ebe8e1;
  --ok: #1d7a46; --alerte: #b3261e; --attention-fond: #fff3dc; --attention-trait: #f0c674; --attention-texte: #7a4b00;
  --nuit: #14213d;
  --rayon: 20px; --ombre: 0 1px 2px rgba(11,11,10,.06);
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
  --tabbar: calc(64px + var(--bas));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --encre: #f4f2ee; --encre-2: #d6d2ca; --encre-3: #a8a39a;
    --papier: #111013; --carte: #1c1b20; --trait: rgba(255,255,255,.09); --gris: #26242b;
    --violet-pale: #2c2140; --violet-texte: #c9a8ff; --violet-voile: #241c33; --violet-fonce: #b892ff;
    --attention-fond: #33270f; --attention-trait: #6d5422; --attention-texte: #f3d08a;
    --ombre: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--papier); color: var(--encre); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, system-ui, sans-serif; font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
a { color: var(--violet-fonce); text-decoration: none; }
button { font: inherit; color: inherit; }
.titre { font-family: Manrope, -apple-system, system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; }
.lecture { font-family: Newsreader, Georgia, serif; }
.sur { font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--encre-3); text-transform: uppercase; }
.discret { color: var(--encre-3); font-size: 13px; }
.pastille { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--violet-texte); background: var(--violet-pale); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.cache { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* boutons */
.btn { min-height: 56px; border: 0; border-radius: 16px; padding: 0 20px; font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.btn-plein { background: var(--violet); color: #fff; }
.btn-doux { background: var(--violet-voile); color: var(--encre); }
.btn-nuit { background: var(--nuit); color: #fff; }
.btn-large { width: 100%; }
.btn:disabled { opacity: .5; }
.rond { width: 52px; height: 52px; border-radius: 26px; border: 0; background: var(--carte); box-shadow: 0 2px 10px rgba(11,11,10,.18); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* écrans pleine page */
.ecran { position: fixed; inset: 0; overflow-y: auto; padding: calc(var(--haut) + 16px) 0 calc(var(--bas) + 24px); background: var(--papier); z-index: 20; -webkit-overflow-scrolling: touch; }
.entete { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; min-height: 44px; }
.marque img { flex-shrink: 0; }
.marque { display: flex; align-items: center; gap: 10px; font-family: Manrope, system-ui, sans-serif; font-weight: 800; font-size: 14px; line-height: 1.25; letter-spacing: .02em; }
h1.grand { margin: 18px 20px 14px; font-size: 32px; }
.bloc { margin: 0 16px; background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); }
.liste > * { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--trait); }
.liste > *:last-child { border-bottom: 0; }

/* carte voyage */
.carte-voyage { display: block; margin: 0 16px; border-radius: 22px; overflow: hidden; background: var(--carte); box-shadow: 0 1px 2px rgba(11,11,10,.06), 0 8px 24px rgba(11,11,10,.08); color: var(--encre); }
.carte-voyage .photo { position: relative; height: 240px; background: var(--gris); }
.carte-voyage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carte-voyage .compte { position: absolute; left: 14px; top: 14px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(11,11,10,.55); padding: 6px 10px; border-radius: 999px; }
.carte-voyage .texte { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.mini-voyages { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; padding: 0 16px; }
.mini-voyages a { background: var(--carte); border-radius: 16px; overflow: hidden; color: var(--encre); box-shadow: var(--ombre); }
.mini-voyages img { width: 100%; height: 104px; object-fit: cover; display: block; }
.mini-voyages div { padding: 10px 12px 12px; }

/* progression */
.barre { height: 10px; border-radius: 5px; background: var(--violet-pale); overflow: hidden; }
.barre > div { height: 100%; background: var(--violet); border-radius: 5px; transition: width .3s; }

/* application à onglets */
#app { position: fixed; inset: 0; }
.onglet { position: absolute; inset: 0 0 var(--tabbar) 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: calc(var(--haut) + 12px); padding-bottom: 24px; }
#onglet-carte { padding: 0; overflow: hidden; }
#carte { position: absolute; inset: 0; background: #e9e6df; }
nav.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar); padding-bottom: var(--bas); background: var(--carte); border-top: 1px solid var(--trait); display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); z-index: 10; }
nav.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--encre-3); font-size: 11.5px; font-weight: 500; }
nav.tabbar a[aria-current="page"] { color: var(--violet-fonce); font-weight: 600; }
nav.tabbar svg { width: 26px; height: 26px; }

/* surcouches de la carte */
.flottant { position: absolute; z-index: 500; }
.selecteur { top: calc(var(--haut) + 10px); left: 12px; height: 48px; padding: 0 16px 0 12px; border: 0; border-radius: 24px; background: rgba(255,255,255,.95); color: #0b0b0a; box-shadow: 0 2px 10px rgba(11,11,10,.16); display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; max-width: calc(100% - 100px); }
.selecteur span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etat-carte { top: calc(var(--haut) + 66px); left: 12px; font-size: 12px; font-weight: 500; color: #0b0b0a; background: rgba(255,255,255,.92); padding: 6px 10px; border-radius: 999px; display: flex; gap: 6px; align-items: center; }
.outils { top: calc(var(--haut) + 10px); right: 12px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.outil { width: 56px; height: 62px; border: 0; border-radius: 16px; background: rgba(255,255,255,.95); color: #0b0b0a; box-shadow: 0 2px 10px rgba(11,11,10,.16); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; position: relative; cursor: pointer; }
.outil .nb { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--violet); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.gps-info { left: 12px; font-size: 12px; color: #0b0b0a; background: rgba(255,255,255,.92); padding: 6px 10px; border-radius: 10px; line-height: 1.35; }
.recentrer { right: 12px; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.recentrer svg path { fill: none; stroke: #8a857c; stroke-width: 1.8; stroke-linejoin: round; }
.recentrer.gps-actif { background: var(--violet); }
.recentrer.gps-actif svg path { fill: none; stroke: #fff; }
.recentrer.gps-actif.suit svg path { fill: #fff; }

/* bandeau d'enregistrement */
.bandeau-enr { top: calc(var(--haut) + 10px); left: 12px; right: 12px; background: var(--nuit); color: #fff; border-radius: 20px; padding: 12px 16px; box-shadow: 0 4px 16px rgba(11,11,10,.25); }
.bandeau-enr .chiffres { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 6px; }
.bandeau-enr b { font-family: Manrope, system-ui, sans-serif; font-size: 22px; font-weight: 800; display: block; }
.bandeau-enr small { color: #c9d1e3; font-size: 12px; }
.point-rouge { width: 10px; height: 10px; border-radius: 5px; background: #ff5a4e; display: inline-block; }
.enr-actif .selecteur, .enr-actif .etat-carte { display: none; }
.enr-actif .outils { top: calc(var(--haut) + 124px); }

/* feuille du bas (carte) */
.feuille-bas { left: 0; right: 0; bottom: 0; background: var(--carte); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px rgba(11,11,10,.12); padding: 8px 16px 14px; }
.poignee { width: 40px; height: 5px; border-radius: 3px; background: #d6d2ca; margin: 0 auto 8px; }
.etape-nav { display: flex; align-items: center; gap: 6px; }
.etape-nav button { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--encre); }
.etape-nav .centre { flex: 1; min-width: 0; text-align: center; }
.etape-titre { font-family: Manrope, system-ui, sans-serif; font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chiffres-etape { display: flex; gap: 16px; justify-content: center; font-size: 14px; color: var(--encre-2); margin-top: 2px; }
.chiffres-etape b { color: var(--encre); }
#profil { display: block; width: 100%; height: 56px; margin-top: 8px; }

/* panneaux modaux */
.voile { position: fixed; inset: 0; background: rgba(11,11,10,.35); z-index: 900; display: flex; align-items: flex-end; }
.panneau { width: 100%; max-height: 82vh; overflow-y: auto; background: var(--papier); border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--bas) + 20px); }
.panneau h2 { margin: 6px 4px 14px; font-size: 22px; }
.choix-grille { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.choix { border: 2px solid transparent; border-radius: 16px; background: var(--carte); padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; cursor: pointer; }
.choix .apercu { width: 100%; aspect-ratio: 1; border-radius: 10px; background-size: cover; background-position: center; }
.choix[aria-pressed="true"] { border-color: var(--violet); color: var(--violet-texte); }
.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--trait); }
.interrupteur:last-child { border-bottom: 0; }
.interrupteur input { appearance: none; width: 52px; height: 32px; border-radius: 16px; background: #d6d2ca; position: relative; flex: none; cursor: pointer; transition: background .2s; }
.interrupteur input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.interrupteur input:checked { background: var(--violet); }
.interrupteur input:checked::after { left: 23px; }
.legende-trait { display: inline-block; width: 26px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }

/* contenus des onglets */
.page-entete { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; min-height: 32px; font-size: 13px; font-weight: 600; color: var(--encre-2); }
.note-info { margin: 14px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--gris); display: flex; gap: 10px; font-size: 14px; line-height: 1.4; color: var(--encre-2); }
.note-alerte { margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--attention-fond); border: 1px solid var(--attention-trait); color: var(--attention-texte); display: flex; gap: 10px; font-size: 14px; line-height: 1.4; }
.niveau { width: 60px; height: 60px; border-radius: 14px; background: #ff9a1f; color: #0b0b0a; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.niveau b { font-family: Manrope, system-ui, sans-serif; font-size: 28px; line-height: 1; }
.niveau small { font-size: 11px; font-weight: 700; }
.section-titre { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 20px 8px; }
.section-titre h2 { margin: 0; font-size: 18px; }
.flotte-action { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + 12px); z-index: 9; box-shadow: 0 6px 18px rgba(139,61,255,.32); }
.espace-action { height: 84px; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 17px; background: var(--violet-pale); color: var(--violet-texte); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tuiles-meteo { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.tuiles-meteo > div { background: var(--papier); border-radius: 12px; padding: 10px; }
.tuiles-meteo b { font-family: Manrope, system-ui, sans-serif; font-size: 19px; font-weight: 800; display: block; }
.jours > div { display: grid; grid-template-columns: 72px 30px 1fr 74px; align-items: center; font-size: 14px; }
.segmente { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4px; background: var(--gris); padding: 4px; border-radius: 14px; margin: 16px 16px 0; }
.segmente button { min-height: 48px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; }
.segmente button[aria-pressed="true"] { background: var(--carte); box-shadow: 0 1px 3px rgba(11,11,10,.1); }

/* formulaire d'observation */
.methodes { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 16px 16px 0; }
.methodes button { min-height: 56px; border: 2px solid transparent; border-radius: 14px; background: var(--carte); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.methodes button[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-voile); color: var(--violet-texte); }
.champ { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait); }
.champ:last-child { border-bottom: 0; }
.pas { display: flex; align-items: center; gap: 10px; }
.pas button { width: 52px; height: 52px; border: 0; border-radius: 26px; background: var(--violet-voile); color: var(--violet-texte); font-size: 26px; cursor: pointer; }
.pas output { font-family: Manrope, system-ui, sans-serif; font-size: 26px; font-weight: 800; min-width: 44px; text-align: center; }
.oui-non { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; width: 150px; }
.oui-non button { min-height: 48px; border: 0; border-radius: 12px; background: var(--violet-voile); font-weight: 600; cursor: pointer; }
.oui-non button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.champ input[type=number], .champ input[type=text], textarea { font: inherit; font-size: 17px; border: 1px solid var(--trait); background: var(--papier); color: var(--encre); border-radius: 12px; padding: 10px 12px; width: 110px; text-align: right; }
textarea { width: 100%; text-align: left; min-height: 90px; }
.verdict { padding: 12px; border-radius: 12px; display: flex; gap: 10px; align-items: center; font-size: 14px; margin-top: 10px; }
.verdict.instable { background: #fdecea; color: #4a0d09; }
.verdict.stable { background: #e6f4ea; color: #0f3d22; }
.coche { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 15px; }
.coche input { width: 26px; height: 26px; accent-color: var(--violet); }

/* Leaflet : position et attribution */
.leaflet-control-attribution { font-size: 9.5px !important; background: rgba(255,255,255,.7) !important; }
.leaflet-control-zoom { display: none; }
.moi { width: 22px; height: 22px; border-radius: 11px; background: var(--violet); border: 3px solid #fff; box-shadow: 0 0 0 10px rgba(139,61,255,.18); }
.repere-etape { background: #fff; color: #0b0b0a; border-radius: 8px; padding: 3px 7px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.25); white-space: nowrap; transform: translate(-50%, -130%); display: inline-block; }

/* installation */
.installer { margin: 16px; padding: 14px 16px; border-radius: 16px; background: var(--violet-voile); font-size: 14px; line-height: 1.45; }
.installer ol { margin: 8px 0 0; padding-left: 20px; }


/* Mode terrain : navigation volontairement limitée, sans toucher aux données. */
.mode-terrain .tabbar a[data-onglet="arpenter"], .mode-terrain .tabbar a[data-onglet="neige"] { display: none; }
.mode-terrain .tabbar { grid-template-columns: repeat(2, 1fr); }
.tabbar a { min-height: 48px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.accueil-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 20px; }
.fiche-voyage { margin: 18px 20px; line-height: 1.55; }
.fiche-voyage summary { min-height: 48px; cursor: pointer; display: flex; align-items: center; font-weight: 600; }
.fiche-voyage a { min-height: 48px; display: inline-flex; align-items: center; }

/* Carte compacte : petites icônes, surfaces tactiles de 48 px. */
.selecteur { height:48px; border-radius:16px; font-size:13px; gap:6px; padding:0 12px; max-width:calc(100% - 82px); }
.etat-carte { top:calc(var(--haut) + 62px); max-width:calc(100% - 82px); font-size:10px; padding:4px 8px; }
.outils { right:10px; gap:4px; background:var(--carte); border-radius:16px; box-shadow:var(--ombre); }
.outil { width:48px; height:48px; border-radius:14px; box-shadow:none; background:transparent; }
.outil svg { width:21px; height:21px; }
.outil .nb { top:1px; right:1px; min-width:16px; height:16px; font-size:10px; }
#btn-plein-ecran { right:10px; top:calc(var(--haut) + 164px); background:var(--carte); box-shadow:var(--ombre); }
.enr-actif #btn-plein-ecran { top:calc(var(--haut) + 278px); }
#btn-enregistrer:disabled { opacity:.45; }
.feuille-bas { border-radius:16px 16px 0 0; padding:6px 8px 8px; }
#feuille-carte > .poignee, #profil { display:none; }
.etape-nav button { width:48px; height:48px; flex-shrink:0; }
.etape-titre { font-size:13px; }
.etape-nav .sur { font-size:10px; }
.chiffres-etape { font-size:12px; gap:12px; }
.recentrer { width:48px; height:48px; }
#enr-conseil { display:none; }
.bandeau-enr { right:70px; padding:8px 10px; border-radius:14px; }
.bandeau-enr b { font-size:16px; }
.bandeau-enr small { font-size:10px; }
.bandeau-enr > div:first-child { font-size:10px !important; }
.enr-actif .outils { top:calc(var(--haut) + 10px); }
.enr-actif #btn-plein-ecran { top:calc(var(--haut) + 164px); }
.carte-plein-ecran nav.tabbar { display:none; }
.carte-plein-ecran #onglet-carte { bottom:0; }
.carte-plein-ecran #onglet-carte > .flottant:not(#btn-plein-ecran) { display:none !important; }
.carte-plein-ecran #btn-plein-ecran { top:calc(var(--haut) + 10px); opacity:.65; }
