/* Prospecteur — thème « terrain & laiton »
   Carte ancienne, laiton des vieilles boussoles, papier des levés d'état-major.
   Conçu pour un pouce et du plein soleil : gros contrastes, grosses cibles. */

:root {
  --parchemin: #f3ead8;
  --parchemin-fonce: #e9ddc4;
  --encre: #2b2118;
  --terre: #5a4632;
  --terre-claire: #8a7357;
  --laiton: #c9a227;
  --laiton-fonce: #8a6d1d;
  --laiton-pale: #f0e3b2;
  --cuivre: #b0653a;
  --bleu-gps: #1d6fb8;
  --orange-zone: #d97b29;
  --rouge-zone: #b3541e;
  --vert-ok: #3e7d4f;
  --ombre: 0 4px 18px rgba(43, 33, 24, .28);
  --ombre-douce: 0 2px 8px rgba(43, 33, 24, .16);
  --grain: repeating-linear-gradient(115deg, rgba(90, 70, 50, .028) 0 2px, transparent 2px 5px);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--sans);
  color: var(--encre);
  background: var(--parchemin);
  overscroll-behavior: none;
}

#carte {
  position: fixed; inset: 0;
  background: var(--parchemin-fonce);
  z-index: 1;
}

/* ---------- Barre du haut : la marque ---------- */

.barre-haut {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 500;
  pointer-events: none;
}

.marque {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(43, 33, 24, .92), rgba(43, 33, 24, .86));
  color: var(--parchemin);
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, .5);
  box-shadow: var(--ombre-douce);
  pointer-events: auto;
}

.marque-icone { width: 22px; height: 22px; color: var(--laiton); }

.marque-nom {
  font-family: var(--serif);
  font-size: 17px; letter-spacing: .4px;
}

.pastille {
  width: 9px; height: 9px; border-radius: 50%;
  background: #7fb069; box-shadow: 0 0 0 2px rgba(127, 176, 105, .25);
}
.pastille.hors-ligne { background: #c0574f; box-shadow: 0 0 0 2px rgba(192, 87, 79, .25); }

.bouton-rond {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, .5);
  background: linear-gradient(180deg, rgba(43, 33, 24, .92), rgba(43, 33, 24, .86));
  color: var(--parchemin);
  display: grid; place-items: center;
  box-shadow: var(--ombre-douce);
  cursor: pointer;
  pointer-events: auto;
}
.bouton-rond svg { width: 21px; height: 21px; }
.bouton-rond:active { transform: scale(.94); }

/* ---------- Barre du bas : curseur + actions ---------- */

.barre-bas {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  background: var(--parchemin);
  background-image: var(--grain);
  border: 1px solid rgba(90, 70, 50, .25);
  border-radius: 20px;
  box-shadow: var(--ombre);
  padding: 12px 14px 8px;
  z-index: 500;
}

.curseur-bloc {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 4px 8px;
}

.curseur-etiquette {
  font-size: 12px; font-weight: 600;
  color: var(--terre);
  white-space: nowrap;
}
.curseur-etiquette-1830 {
  font-family: var(--serif);
  font-size: 15px; font-weight: 700;
  color: var(--laiton-fonce);
  letter-spacing: .5px;
}

#curseur-1830 {
  flex: 1;
  appearance: none; -webkit-appearance: none;
  height: 34px;
  background: transparent;
  cursor: pointer;
  min-width: 0;
}
#curseur-1830::-webkit-slider-runnable-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #b9c9b2, #d9c9a2 55%, #c2a366);
  border: 1px solid rgba(90, 70, 50, .35);
}
#curseur-1830::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6c95c, var(--laiton) 55%, var(--laiton-fonce));
  border: 2.5px solid var(--parchemin);
  box-shadow: 0 1px 5px rgba(43, 33, 24, .4);
  margin-top: -10px;
}
#curseur-1830::-moz-range-track {
  height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #b9c9b2, #d9c9a2 55%, #c2a366);
  border: 1px solid rgba(90, 70, 50, .35);
}
#curseur-1830::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6c95c, var(--laiton) 55%, var(--laiton-fonce));
  border: 2.5px solid var(--parchemin);
  box-shadow: 0 1px 5px rgba(43, 33, 24, .4);
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border-top: 1px solid rgba(90, 70, 50, .18);
  padding-top: 6px;
}

.bouton-action {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 6px;
  border: none; border-radius: 12px;
  background: transparent;
  color: var(--terre);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  min-height: 54px;
}
.bouton-action svg { width: 22px; height: 22px; }
.bouton-action:active { background: rgba(90, 70, 50, .12); }
.bouton-action.actif {
  background: var(--laiton-pale);
  color: var(--laiton-fonce);
  box-shadow: inset 0 0 0 1px rgba(138, 109, 29, .35);
}

/* ---------- Panneaux (bottom sheets) ---------- */

#voile {
  position: fixed; inset: 0;
  background: rgba(43, 33, 24, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  z-index: 900;
}
#voile.visible { opacity: 1; pointer-events: auto; }

.panneau {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: 82vh;
  background: var(--parchemin);
  background-image: var(--grain);
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(90, 70, 50, .25);
  border-bottom: none;
  box-shadow: 0 -6px 30px rgba(43, 33, 24, .35);
  transform: translateY(105%);
  transition: transform .3s cubic-bezier(.2, .8, .25, 1);
  z-index: 950;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.panneau.ouvert { transform: translateY(0); }

.panneau-tete {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(90, 70, 50, .18);
}
.panneau-tete h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px; font-weight: 700;
  color: var(--encre);
}
.panneau-fermer {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: rgba(90, 70, 50, .1);
  color: var(--terre); font-size: 15px;
  cursor: pointer;
}

.panneau-corps {
  padding: 14px 18px 18px;
  overflow-y: auto;
  font-size: 14.5px; line-height: 1.55;
  color: var(--encre);
}
.panneau-corps h3 {
  font-family: var(--serif);
  font-size: 16px; margin: 18px 0 6px;
  color: var(--terre);
}
.panneau-corps ul { margin: 6px 0; padding-left: 20px; }
.panneau-corps li { margin-bottom: 6px; }

.panneau-note { font-size: 12.5px; color: var(--terre-claire); }
.panneau-note.alerte { color: var(--rouge-zone); font-weight: 600; }

.pitch {
  font-family: var(--serif);
  font-size: 16px; font-style: italic;
  color: var(--terre);
}

.encart-regle {
  background: var(--laiton-pale);
  border: 1px solid rgba(138, 109, 29, .4);
  border-left: 4px solid var(--laiton-fonce);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.encart-regle h3 { margin: 0 0 6px; color: var(--laiton-fonce); }
.encart-regle p { margin: 0; }

/* ---------- Choix du fond ---------- */

.choix-fond {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px; row-gap: 2px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  border: 1.5px solid rgba(90, 70, 50, .2);
  margin-bottom: 10px;
  cursor: pointer;
}
.choix-fond:has(input:checked) {
  border-color: var(--laiton-fonce);
  background: var(--laiton-pale);
}
.choix-fond input { position: absolute; opacity: 0; }
.choix-fond-carte {
  grid-row: 1 / span 2;
  width: 64px; height: 52px;
  border-radius: 9px;
  border: 1px solid rgba(90, 70, 50, .3);
}
.choix-fond-ortho {
  background: linear-gradient(135deg, #5d7d4a 0 35%, #7d9a58 35% 55%, #4a6b3d 55% 75%, #8aa060 75%);
}
.choix-fond-plan {
  background:
    linear-gradient(0deg, transparent 46%, #e8b04a 46% 54%, transparent 54%),
    linear-gradient(105deg, transparent 60%, #b8cfe0 60% 72%, transparent 72%),
    #f2efe9;
}
.choix-fond-nom { font-weight: 700; font-size: 15px; align-self: end; }
.choix-fond-detail { font-size: 12.5px; color: var(--terre-claire); align-self: start; }

/* ---------- Hors ligne ---------- */

.estimation {
  font-family: var(--serif);
  font-size: 17px; font-weight: 700;
  color: var(--laiton-fonce);
  margin: 4px 0 10px;
}

#nom-secteur {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(90, 70, 50, .3);
  background: rgba(255, 253, 247, .8);
  font-size: 15px; color: var(--encre);
  margin-bottom: 10px;
}
#nom-secteur:focus { outline: 2px solid var(--laiton); border-color: transparent; }

.bouton-principal {
  width: 100%;
  padding: 14px;
  border: none; border-radius: 14px;
  background: linear-gradient(180deg, #d4ad33, var(--laiton) 45%, #b18e1f);
  color: var(--encre);
  font-size: 16px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(138, 109, 29, .4), inset 0 1px 0 rgba(255, 255, 255, .35);
  cursor: pointer;
}
.bouton-principal:active { transform: translateY(1px); }
.bouton-principal:disabled { opacity: .55; cursor: default; }

#progression { display: none; margin-top: 12px; }
#progression.visible { display: block; }
.progression-fond {
  height: 12px; border-radius: 7px;
  background: rgba(90, 70, 50, .15);
  border: 1px solid rgba(90, 70, 50, .2);
  overflow: hidden;
}
#progression-barre {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--laiton), #d4ad33);
  transition: width .3s;
}
.progression-ligne {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
  font-size: 13px; color: var(--terre);
}
.bouton-lien {
  border: none; background: none;
  color: var(--rouge-zone); font-weight: 600; font-size: 13px;
  cursor: pointer; padding: 6px;
}

.secteur-ligne {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(90, 70, 50, .15);
}
.secteur-ligne strong { display: block; font-size: 14.5px; }
.secteur-ligne span { font-size: 12.5px; color: var(--terre-claire); }
.secteur-supprimer {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: rgba(179, 84, 30, .12);
  color: var(--rouge-zone);
  cursor: pointer; font-size: 14px;
}
.liste-vide { color: var(--terre-claire); font-style: italic; font-size: 13.5px; }

/* ---------- Accueil ---------- */

#accueil {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(90, 70, 50, .5), rgba(43, 33, 24, .93)),
    var(--encre);
  z-index: 1000;
  padding: 20px;
}
#accueil.visible { display: flex; }

.accueil-carte {
  width: 100%; max-width: 400px;
  background: var(--parchemin);
  background-image: var(--grain);
  border-radius: 24px;
  border: 1px solid rgba(201, 162, 39, .55);
  box-shadow: 0 12px 50px rgba(0, 0, 0, .5);
  padding: 30px 26px 22px;
  text-align: center;
}

.accueil-etape { display: none; min-height: 240px; }
.accueil-etape.active { display: block; }

.accueil-illu {
  width: 62px; height: 62px;
  color: var(--laiton-fonce);
  background: var(--laiton-pale);
  border-radius: 50%;
  padding: 14px;
  margin-bottom: 8px;
}

.accueil-etape h2 {
  font-family: var(--serif);
  font-size: 22px; margin: 8px 0 10px;
  color: var(--encre);
}
.accueil-etape p {
  font-size: 14.5px; line-height: 1.6;
  color: var(--terre);
  margin: 0;
  text-align: left;
}

.accueil-pied { margin-top: 20px; }
.accueil-points {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 14px;
}
.accueil-point {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(90, 70, 50, .25);
}
.accueil-point.actif { background: var(--laiton-fonce); }

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  bottom: calc(150px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(8px);
  max-width: min(86vw, 420px);
  background: rgba(43, 33, 24, .94);
  color: var(--parchemin);
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, .4);
  font-size: 13.5px;
  text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 1100;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Habillage Leaflet ---------- */

.leaflet-container { font-family: var(--sans); }

.leaflet-control-attribution {
  background: rgba(243, 234, 216, .85) !important;
  color: var(--terre-claire) !important;
  font-size: 10px !important;
  border-radius: 8px 0 0 0;
}
.leaflet-control-attribution a { color: var(--terre) !important; }

.popup-zone .leaflet-popup-content-wrapper {
  background: var(--parchemin);
  background-image: var(--grain);
  color: var(--encre);
  border-radius: 14px;
  border: 1px solid rgba(179, 84, 30, .45);
  box-shadow: var(--ombre);
}
.popup-zone .leaflet-popup-tip { background: var(--parchemin); }
.popup-zone .leaflet-popup-content { margin: 14px 16px; line-height: 1.5; }

.fiche-zone h3 {
  font-family: var(--serif);
  font-size: 16px; margin: 4px 0 2px;
}
.fiche-zone-badge {
  display: inline-block;
  background: var(--orange-zone);
  color: #fff;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.fiche-zone-sous { font-size: 12px; color: var(--terre-claire); margin: 0 0 8px; }
.fiche-zone p { font-size: 13px; margin: 7px 0; }
.fiche-zone-rappel {
  background: rgba(217, 123, 41, .12);
  border-radius: 8px; padding: 7px 9px;
}
.fiche-zone a {
  display: inline-block;
  margin-top: 4px;
  color: var(--laiton-fonce); font-weight: 600; font-size: 13px;
}

/* ---------- Divers ---------- */

@media (min-width: 720px) {
  .panneau {
    bottom: 18px;
    border-radius: 22px;
    border-bottom: 1px solid rgba(90, 70, 50, .25);
  }
}

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