/* ═══════════════════════════════════════════
   FRANCE MOCHE — Styles globaux
   Esthétique : planche technique, noir & blanc
   ═══════════════════════════════════════════ */

:root {
  --noir: #1a1a1a;
  --papier: #f5f2ec;
  --gris: #8a8480;
  --rouge: #a04030;
  --font: 'Courier New', 'Courier', monospace;
}

/* ── Reset ── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ── */

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--papier);
  color: var(--noir);
  font-family: var(--font);
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--noir);
  text-decoration: underline;
}

a:hover {
  color: var(--gris);
}

/* ── Utilitaires ── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cache {
  display: none;
}

.separateur {
  color: var(--gris);
  letter-spacing: 0.3em;
  margin: 0.8rem 0;
  font-size: 0.7rem;
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Écrans ── */

.ecran {
  display: none;
  min-height: 100vh;
}

.ecran--actif {
  display: flex;
}

/* ── ACCUEIL ── */

#ecran-accueil {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.accueil-contenu {
  width: min(90vw, 500px);
}

.titre-principal {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: 0.15em;
  line-height: 1.1;
}

.sous-titre {
  font-size: clamp(0.7rem, 1.8vw, 0.85rem);
  color: var(--gris);
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
}

/* Champ de recherche */

.recherche-conteneur {
  position: relative;
  margin: 2.5rem 0;
}

.champ-recherche {
  width: 100%;
  padding: 0.8rem 0;
  border: none;
  border-bottom: 1px solid var(--noir);
  background: transparent;
  color: var(--noir);
  font-family: var(--font);
  font-size: clamp(0.85rem, 2vw, 1rem);
  text-align: center;
  outline: none;
  letter-spacing: 0.02em;
}

.champ-recherche::placeholder {
  color: var(--gris);
  opacity: 1;
}

.champ-recherche:focus {
  border-bottom-width: 2px;
}

/* Suggestions / autocomplétion */

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  list-style: none;
  border: 1px solid var(--noir);
  border-top: none;
  background: var(--papier);
  z-index: 1000;
  display: none;
  max-height: 250px;
  overflow-y: auto;
}

.suggestions.ouverte {
  display: block;
}

.suggestions li {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-size: clamp(0.7rem, 1.6vw, 0.85rem);
  text-align: left;
  border-bottom: 1px solid rgba(26, 26, 26, 0.1);
}

.suggestions li:last-child {
  border-bottom: none;
}

.suggestions li:hover,
.suggestions li.active {
  background: var(--noir);
  color: var(--papier);
}

.suggestions li .suggestion-detail {
  display: block;
  font-size: 0.7em;
  color: var(--gris);
  margin-top: 0.15rem;
}

.suggestions li:hover .suggestion-detail,
.suggestions li.active .suggestion-detail {
  color: rgba(245, 242, 236, 0.6);
}

/* Footer accueil */

.accueil-footer {
  margin-top: 3rem;
  font-size: clamp(0.6rem, 1.4vw, 0.72rem);
  color: var(--gris);
  line-height: 1.8;
}

.accueil-footer a {
  color: var(--gris);
}

/* ── SÉLECTION DE ZONE ── */

#ecran-zone {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.zone-contenu {
  width: min(95vw, 900px);
  padding: 1.5rem 1rem 2rem;
}

.zone-header {
  text-align: center;
  margin-bottom: 1rem;
}

.titre-zone {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.15em;
}

.zone-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.zone-commune {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
}

.zone-instruction {
  font-size: clamp(0.65rem, 1.5vw, 0.78rem);
  color: var(--gris);
  font-style: italic;
}

.zone-carte-cadre {
  position: relative;
  border: 1px solid var(--noir);
  padding: 2px;
  width: min(85vw, 700px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.zone-map-container {
  width: 100%;
  height: 100%;
  background: var(--papier);
}

/* Cadre viseur superposé sur la carte */
.zone-carte-cadre::after {
  content: '';
  position: absolute;
  inset: 16px;
  border: 2px solid var(--noir);
  pointer-events: none;
  z-index: 800;
  opacity: 0.6;
}

/* Coins du viseur (traits épais aux 4 angles) */
.zone-coin {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 801;
  pointer-events: none;
}

.zone-coin::before,
.zone-coin::after {
  content: '';
  position: absolute;
  background: var(--noir);
}

/* Traits horizontaux des coins */
.zone-coin::before {
  height: 2px;
  width: 20px;
}

/* Traits verticaux des coins */
.zone-coin::after {
  width: 2px;
  height: 20px;
}

.zone-coin--hg { top: 14px; left: 14px; }
.zone-coin--hg::before { top: 0; left: 0; }
.zone-coin--hg::after { top: 0; left: 0; }

.zone-coin--hd { top: 14px; right: 14px; }
.zone-coin--hd::before { top: 0; right: 0; }
.zone-coin--hd::after { top: 0; right: 0; }

.zone-coin--bg { bottom: 14px; left: 14px; }
.zone-coin--bg::before { bottom: 0; left: 0; }
.zone-coin--bg::after { bottom: 0; left: 0; }

.zone-coin--bd { bottom: 14px; right: 14px; }
.zone-coin--bd::before { bottom: 0; right: 0; }
.zone-coin--bd::after { bottom: 0; right: 0; }

/* Assombrir légèrement les bords hors cadre */
.zone-ombre {
  position: absolute;
  inset: 2px;
  z-index: 799;
  pointer-events: none;
  box-shadow: inset 0 0 0 14px rgba(245, 242, 236, 0.45);
}

.zone-surface {
  position: absolute;
  bottom: 22px;
  left: 22px;
  background: var(--papier);
  border: 1px solid var(--noir);
  padding: 0.4rem 0.7rem;
  font-size: clamp(0.7rem, 1.6vw, 0.82rem);
  z-index: 1000;
  pointer-events: none;
  letter-spacing: 0.03em;
}

.zone-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.btn--principal {
  background: var(--noir);
  color: var(--papier);
}

.btn--principal:hover,
.btn--principal:focus-visible {
  background: transparent;
  color: var(--noir);
}

/* ── CHARGEMENT ── */

#ecran-chargement {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.chargement-contenu {
  width: min(90vw, 500px);
}

.titre-chargement {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.15em;
}

.message-chargement {
  margin-top: 2rem;
  min-height: 1.6em;
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  color: var(--noir);
}

.curseur-chargement {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  animation: clignoter 0.8s step-end infinite;
  color: var(--gris);
}

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

/* ── RÉSULTATS ── */

#ecran-resultats {
  flex-direction: column;
  align-items: center;
}

.resultats-contenu {
  width: min(95vw, 820px);
  padding: 2rem 1rem 3rem;
}

.resultats-header {
  text-align: center;
  margin-bottom: 2rem;
}

.resultats-header .titre-principal {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.section-titre {
  font-size: clamp(0.7rem, 1.6vw, 0.8rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--gris);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Cartouche */

.cartouche {
  border: 1px solid var(--noir);
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
}

.cartouche-ligne {
  display: flex;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: clamp(0.7rem, 1.6vw, 0.82rem);
}

.cartouche-label {
  color: var(--gris);
  white-space: nowrap;
}

.cartouche-valeur {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Carte */

.carte-section {
  margin-bottom: 2rem;
}

.carte-cadre {
  position: relative;
  border: 1px solid var(--noir);
  padding: 2px;
}

.carte-actions {
  text-align: right;
  margin-top: 0.5rem;
}

.btn--petit {
  font-size: clamp(0.6rem, 1.4vw, 0.7rem);
  padding: 0.4rem 0.8rem;
  letter-spacing: 0.08em;
}

.map-container {
  width: 100%;
  aspect-ratio: 1;
  background: #eae7e0;
}

/* Croix de calage */

.croix-calage {
  position: absolute;
  font-size: 0.7rem;
  color: var(--gris);
  line-height: 1;
  z-index: 500;
  pointer-events: none;
  user-select: none;
}

.croix-calage--hg { top: -0.6rem; left: -0.4rem; }
.croix-calage--hd { top: -0.6rem; right: -0.4rem; }
.croix-calage--bg { bottom: -0.6rem; left: -0.4rem; }
.croix-calage--bd { bottom: -0.6rem; right: -0.4rem; }

/* Tuiles Leaflet en niveaux de gris */

.leaflet-tile-pane {
  filter: grayscale(1) brightness(0.88) contrast(1.2);
}

/* Overlay halftone sur la carte de zone uniquement (via pseudo-élément) */

.zone-carte-cadre::before {
  content: '';
  position: absolute;
  inset: 2px;
  z-index: 450;
  pointer-events: none;
  background:
    radial-gradient(circle, #1a1a1a 0.6px, transparent 0.6px);
  background-size: 4px 4px;
  opacity: 0.12;
}

/* Pions sur la carte */

.pion {
  transition: opacity 0.4s ease, transform 0.4s ease;
  cursor: pointer;
  filter: drop-shadow(0 0 2px rgba(245, 242, 236, 0.9));
}

.pion--cache {
  opacity: 0 !important;
  transform: scale(0.5) !important;
}

/* Popups Leaflet personnalisées */

.leaflet-popup-content-wrapper {
  background: var(--papier);
  color: var(--noir);
  font-family: var(--font);
  font-size: 0.75rem;
  border: 1px solid var(--noir);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.leaflet-popup-content {
  margin: 0.6rem 0.8rem;
  line-height: 1.5;
}

.leaflet-popup-tip {
  background: var(--papier);
  border: 1px solid var(--noir);
  border-top: none;
  border-left: none;
  box-shadow: none;
}

.leaflet-popup-close-button {
  color: var(--noir) !important;
  font-family: var(--font);
}

.popup-type {
  font-size: 0.65rem;
  color: var(--gris);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.popup-nom {
  font-weight: bold;
  margin: 0.2rem 0;
}

.popup-pts {
  font-size: 0.7rem;
}

.popup-saveur {
  font-style: italic;
  color: var(--gris);
  font-size: 0.7rem;
  margin-top: 0.3rem;
}

/* ── Inventaire ── */

.inventaire-section {
  margin-bottom: 2rem;
}

.inventaire-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}

/* Carte d'élément */

.carte-element {
  border: 1px solid var(--noir);
  padding: 1rem;
  background: var(--papier);
}

.carte-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gris);
  margin-bottom: 0.8rem;
}

.carte-illustration {
  text-align: center;
  margin-bottom: 0.6rem;
}

.carte-illustration svg {
  width: 100%;
  max-width: 160px;
  height: auto;
}

.carte-nom {
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.carte-compte {
  font-size: 0.8rem;
  color: var(--gris);
  margin-bottom: 0.5rem;
}

.carte-description {
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.carte-total {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  margin-bottom: 0.5rem;
}

.carte-saveur {
  font-style: italic;
  color: var(--gris);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Carte élément positif */
.carte-element--positif {
  border-style: dashed;
}

.carte-element--positif .carte-total {
  color: var(--gris);
}

/* ── Scoring ── */

.scoring-section {
  border: 1px solid var(--noir);
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.scoring-section .section-titre {
  margin-bottom: 1.2rem;
}

.score-total {
  margin-bottom: 1rem;
}

.score-label {
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  color: var(--gris);
}

.score-nombre {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  display: block;
  margin-top: 0.3rem;
  letter-spacing: 0.05em;
}

/* Jauge à seuils */

.jauge-seuils {
  margin-bottom: 1.5rem;
}

.jauge-seuils-fond {
  position: relative;
  height: 10px;
  border: 1px solid var(--noir);
  background: transparent;
}

.jauge-barre {
  height: 100%;
  background: var(--noir);
  transition: width 1.5s ease-out;
  position: relative;
  z-index: 1;
}

.jauge-seuil {
  position: absolute;
  top: -1px;
  width: 1px;
  height: calc(100% + 2px);
  background: var(--noir);
  opacity: 0.3;
  z-index: 2;
}

.jauge-labels {
  display: flex;
  margin-top: 0.3rem;
}

.jauge-label {
  font-size: 0.65rem;
  text-align: center;
  color: var(--gris);
  letter-spacing: 0.05em;
}

/* Verdict */

.verdict-conteneur {
  margin-bottom: 0.5rem;
}

.verdict-label {
  font-size: 0.8rem;
  color: var(--gris);
}

.verdict-categorie {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  display: block;
  margin: 0.3rem 0;
  letter-spacing: 0.1em;
}

.verdict-categorie--e {
  color: var(--rouge);
}

.verdict-texte {
  font-style: italic;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--gris);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Combos */

.combos-conteneur {
  text-align: left;
  border-top: 1px solid rgba(26, 26, 26, 0.15);
  padding-top: 1rem;
}

.combos-conteneur.cache {
  display: none;
}

.combos-titre {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--gris);
  margin-bottom: 0.6rem;
}

.combos-liste {
  list-style: none;
}

.combos-liste li {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.combo-nom {
  flex: 1;
}

.combo-detail {
  display: block;
  font-size: 0.72rem;
  color: var(--noir);
  margin-top: 0.15rem;
  opacity: 0.7;
}

.combo-texte {
  font-style: italic;
  color: var(--gris);
  font-size: 0.72rem;
  display: block;
  margin-top: 0.1rem;
}

.combo-bonus {
  font-weight: 700;
  white-space: nowrap;
  margin-left: 0.5rem;
}

/* ── Boutons ── */

.actions-conteneur {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--noir);
  background: transparent;
  color: var(--noir);
  font-family: var(--font);
  font-size: clamp(0.7rem, 1.6vw, 0.8rem);
  padding: 0.7rem 1.5rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

.btn:hover,
.btn:focus-visible {
  background: var(--noir);
  color: var(--papier);
  outline: none;
}

/* ── Erreur ── */

#ecran-erreur {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.erreur-contenu {
  width: min(90vw, 500px);
}

.titre-erreur {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.15em;
}

.message-erreur {
  margin: 2rem 0;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  line-height: 1.6;
}

/* Footer résultats */

.resultats-footer {
  text-align: center;
  font-size: clamp(0.6rem, 1.4vw, 0.72rem);
  color: var(--gris);
  line-height: 1.8;
  padding-top: 1rem;
  border-top: 1px solid rgba(26, 26, 26, 0.1);
}

.resultats-footer a {
  color: var(--gris);
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .zone-carte-cadre {
    width: 95vw;
  }

  .inventaire-grille {
    grid-template-columns: 1fr;
  }

  .resultats-contenu {
    padding: 1.5rem 0.8rem 2rem;
  }

  .cartouche {
    padding: 0.8rem;
  }

  .scoring-section {
    padding: 1rem;
  }

  .combos-liste li {
    flex-direction: column;
    gap: 0.2rem;
  }

  .combo-bonus {
    margin-left: 0;
  }

  .zone-info {
    flex-direction: column;
    text-align: center;
  }
}
