/* Carte des niveaux : l'ascension vers le temple. */
.page-carte { padding: 0 16px 40px; }
.ascension { max-width: 560px; margin: 0 auto; }

.entete-carte {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: 12px 16px;
  background: linear-gradient(rgba(11, 36, 23, 0.95), rgba(11, 36, 23, 0.75) 80%, transparent);
}
.entete-carte h1 { margin: 0; font-size: 1.3rem; color: var(--or-clair); text-shadow: 0 2px 0 #000; }
.score-total { font-size: 1.05rem; }

.sentier { position: relative; padding-top: 8px; }
/* Végétation de la jungle de part et d'autre du sentier */
.page-carte { position: relative; overflow-x: hidden; min-height: calc(100vh - 54px); }
.page-carte::before, .page-carte::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(340px, 30vw);
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 420'%3E%3Cg fill='%233fa36a'%3E%3Cpath d='M0 40 C80 20 150 50 190 110 C120 90 60 90 0 120Z' opacity='.55'/%3E%3Cpath d='M0 210 C110 170 220 200 260 270 C160 245 80 250 0 300Z' opacity='.4'/%3E%3Cpath d='M0 330 C60 310 120 330 150 380 C90 365 40 370 0 400Z' opacity='.5'/%3E%3C/g%3E%3Cg fill='%232a7a4c'%3E%3Cpath d='M0 120 C70 110 120 140 140 180 C90 165 40 170 0 190Z' opacity='.7'/%3E%3Cpath d='M0 280 C40 270 90 285 110 320 C70 310 30 315 0 330Z' opacity='.7'/%3E%3C/g%3E%3Cpath d='M20 0 C40 80 10 160 30 240 S20 380 40 420' stroke='%23163f28' stroke-width='5' fill='none'/%3E%3C/svg%3E");
  background-size: 100% auto;
  background-repeat: repeat-y;
}
.page-carte::before { left: 0; }
.page-carte::after { right: 0; transform: scaleX(-1); }
.sentier-trace { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sentier-trace .bord { fill: none; stroke: #2b2419; stroke-width: 30; stroke-linecap: round; }
.sentier-trace .chemin { fill: none; stroke: #6e5c3e; stroke-width: 22; stroke-linecap: round; }
.sentier-trace .paves { fill: none; stroke: #a88f62; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 3 11; }
.sentier-trace .parcouru { fill: none; stroke: var(--or-clair); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1 9; opacity: 0.85; filter: drop-shadow(0 0 4px var(--or)); }

/* Le temple, au sommet */
.temple { position: relative; width: 220px; margin: 0 auto; text-align: center; z-index: 1; }
.temple svg { width: 100%; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
.temple-nom {
  margin: 6px 0 0;
  font-family: var(--police-titre);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--or-clair);
  text-shadow: 0 2px 0 #000;
}

/* Les étapes : un médaillon à chaque virage */
.niveaux { list-style: none; margin: 0; padding: 0; position: relative; z-index: 1; }
.etape { position: relative; height: 190px; }
.medaillon {
  position: absolute;
  left: var(--x);
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  width: 180px;
}
.medaillon-disque {
  position: relative;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid;
  transition: transform 0.15s, box-shadow 0.15s;
}
.medaillon-disque .picto { width: 40px; height: 40px; }
.medaillon-numero {
  position: absolute;
  bottom: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--texte);
  background: var(--pierre-noire);
  border: 2px solid var(--pierre);
}
.plaque {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px 5px;
  border-radius: 6px;
  background: rgba(30, 25, 17, 0.85);
  border: 1px solid var(--pierre-fonce);
  text-align: center;
}
.plaque-titre { font-family: var(--police-titre); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.03em; }
.plaque .etoiles .icone { width: 16px; height: 16px; }

/* Niveau réussi : médaillon doré */
.etape-reussi .medaillon-disque {
  color: var(--or-fonce);
  background: radial-gradient(circle at 35% 30%, #fff1c2, var(--or-clair) 30%, var(--or) 90%);
  border-color: var(--or-fonce);
  box-shadow: 0 6px 0 #4a3308, 0 10px 18px rgba(0, 0, 0, 0.5);
}
/* Niveau ouvert pas encore réussi : médaillon émeraude */
.etape-disponible .medaillon-disque {
  color: var(--emeraude-noir);
  background: radial-gradient(circle at 35% 30%, #b6ffd6, var(--emeraude) 40%, var(--emeraude-fonce));
  border-color: var(--or-clair);
  box-shadow: 0 6px 0 #0d5a32, 0 10px 18px rgba(0, 0, 0, 0.5);
}
/* Niveau verrouillé : pierre grise */
.etape-ferme .medaillon-disque {
  color: var(--pierre-noire);
  background: radial-gradient(circle at 35% 30%, #a99d84, #6f634d);
  border-color: var(--pierre-noire);
  box-shadow: 0 6px 0 #2b2419, 0 10px 18px rgba(0, 0, 0, 0.5);
}
.etape-ferme .plaque { opacity: 0.7; }

a.medaillon:hover .medaillon-disque, a.medaillon:focus-visible .medaillon-disque { transform: translateY(-4px) scale(1.06); }
a.medaillon:focus-visible { outline: none; }
a.medaillon:focus-visible .plaque { outline: 2px solid var(--or-clair); }

/* Niveau actuel : halo qui pulse */
.etape.actuel .medaillon-disque::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 3px solid var(--or-clair);
  animation: halo 1.8s ease-out infinite;
}
@keyframes halo {
  from { transform: scale(0.85); opacity: 0.9; }
  to { transform: scale(1.3); opacity: 0; }
}

/* Niveau que le formateur vient d'ouvrir : la pierre se change en médaillon */
.etape.deverrouille .medaillon-disque { animation: deverrouillage 1.1s ease-out; }
@keyframes deverrouillage {
  0% { transform: scale(1); filter: grayscale(1) brightness(0.7); }
  40% { transform: scale(1.25) rotate(-8deg); filter: grayscale(0.4) brightness(1.6); }
  100% { transform: scale(1); filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .etape.actuel .medaillon-disque::before, .etape.deverrouille .medaillon-disque { animation: none; }
}

/* Le départ, en bas */
.depart { position: relative; z-index: 1; display: flex; justify-content: center; padding: 10px 0 0; }
.depart span {
  padding: 6px 16px;
  border-radius: 6px;
  font-family: var(--police-titre);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--discret);
  background: rgba(30, 25, 17, 0.85);
  border: 1px solid var(--pierre-fonce);
}

@media (max-width: 420px) {
  .medaillon { width: 140px; }
  .medaillon-disque { width: 70px; height: 70px; }
  .medaillon-disque .picto { width: 32px; height: 32px; }
}

/* En-tête de zone : bouton retour à gauche */
.entete-carte .bouton { padding: 6px 14px; font-size: 0.85rem; }
.entete-carte h1 { flex: 1; }

/* Gardien : anneau rouge et or autour du médaillon */
.etape.gardien .medaillon-disque { outline: 4px solid #a8321f; outline-offset: 4px; }
.plaque-gardien {
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ff8a73;
}

/* Carte du monde : plaques plus larges, intitulé du module */
.monde .medaillon { width: 220px; }
.plaque-module { font-size: 0.75rem; color: var(--discret); line-height: 1.3; }
.plaque-score { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--or-clair); font-size: 0.85rem; }
.depart a { color: var(--discret); text-decoration: none; }
@media (max-width: 420px) {
  .monde .medaillon { width: 160px; }
}
