/* Harfang — jeu Topo (tranche « jeux/topo ») : composants propres au jeu, par-dessus les styles communs
   (commun/styles/). Fiche JEUX, charte : docs/charte.md. */

/* ---------- page du jeu ---------- */
/* les régions n'ont de sens qu'en terrain réel */
form:has(input[name="mode"][value="inconnu"]:checked) .groupe--regions { opacity: 0.45; }
.defile--fonce { margin-top: 56px; }      /* archives, sous les réglages */

/* ---------- partie : joueur en duel ---------- */
.enigme__joueur { display: inline-block; margin: 10px 0 0; padding: 4px 12px; background: var(--or); color: var(--noir); font-weight: 700; }

/* ---------- vue ---------- */
.vue { margin: 0 0 24px; }
.vue__cadre { position: relative; overflow: hidden; background: var(--noir); aspect-ratio: 1980 / 900; }
.vue__cadre img { width: 100%; height: 100%; object-fit: cover; }
.vue__legende { font-size: 0.85rem; color: var(--encre-douce); margin-top: 6px; }
.vue__cache { position: absolute; inset: 0; display: grid; place-items: center; background: var(--noir); color: var(--argent); }
.vue__cache p { margin: 0; font-family: var(--titre); font-size: 1.6rem; }
.vue--jumelles .vue__cadre img { transform: scale(3.73); }
.vue--jumelles .vue__cadre::before {   /* bord de l'oculaire */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 50% 100% at 50% 50%, transparent 80%, rgba(0, 0, 0, 0.9) 100%);
}
.vue--brouillard .vue__cadre img { filter: contrast(0.5) brightness(1.2) saturate(0.6) blur(1px); }
.vue--brouillard .vue__cadre::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(232, 236, 241, 0.35), rgba(232, 236, 241, 0.6));
}

/* ---------- carte + réponse ---------- */
.enigme__corps { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 28px; align-items: start; }
.enigme__corps--grande { grid-template-columns: 1fr; }
@media (max-width: 860px) { .enigme__corps { grid-template-columns: 1fr; } }
.plan__cadre { position: relative; background: #fff; border: 1px solid var(--trait); }
.plan__cadre img { width: 100%; height: auto; }

/* zoom au doigt dans le cadre (zoom_cadre.js) : un doigt fait défiler la page, sauf une fois zoomé */
.vue__cadre, .plan__cadre, .plan__calque { touch-action: pan-x pan-y; }
.cadre-zoome, .cadre-zoome .plan__calque { touch-action: none; }
.plan__cadre { overflow: hidden; }
.zoom-contenu { position: relative; transform-origin: 0 0; }
.vue__cadre .zoom-contenu { width: 100%; height: 100%; overflow: hidden; }
.plan__calque { position: absolute; inset: 0; width: 100%; height: 100%; }

.noeud { fill: transparent; stroke: none; }
.noeud--actif { cursor: pointer; }
.noeud--actif:hover { fill: rgba(199, 162, 61, 0.35); stroke: var(--or); stroke-width: 3; }
.noeud--choisi { fill: rgba(199, 162, 61, 0.55); stroke: var(--or-sombre); stroke-width: 4; }
.observateur { fill: var(--rouge-observateur); stroke: #000; stroke-width: 3; }
.rose-carte__trait { stroke: #000; stroke-width: 3; }
.rose-carte__lettre { font: 700 26px var(--texte); text-anchor: middle; fill: #000; paint-order: stroke; stroke: #fff; stroke-width: 6px; }
.solution__champ { stroke: var(--rouge); stroke-width: 3; stroke-dasharray: 14 10; }
.solution__fleche { stroke: var(--rouge); stroke-width: 8; }
.solution__pointe { fill: var(--rouge); }
/* pointage : cercle fin, ancre, direction et champ de vision du joueur */
.pointage__cercle { fill: none; stroke: var(--bleu-fonce); stroke-width: 2.5; pointer-events: none; }
.pointage__cran { stroke: var(--bleu-fonce); stroke-width: 2.5; pointer-events: none; }
.pointage__nord { font: 700 24px var(--texte); fill: var(--bleu-fonce); text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 6px; pointer-events: none; }
.pointage__centre { fill: var(--or); stroke: var(--bleu-fonce); stroke-width: 3; pointer-events: none; }
.pointage__fleche { stroke: var(--bleu-fonce); stroke-width: 6; stroke-linecap: round; pointer-events: none; }
.pointage__champ { stroke: var(--bleu-fonce); stroke-width: 3; stroke-dasharray: 12 9; opacity: 0.75; pointer-events: none; }
.pointage__ancre { fill: var(--or); stroke: var(--bleu-fonce); stroke-width: 3; cursor: grab; touch-action: none; }
.pointage__ancre:active { cursor: grabbing; }
.pointage__prise { fill: transparent; stroke: none; }
.pointage__ancre--libre { fill: #fff; }
.reponse-joueur { fill: none; stroke-width: 6; }
.reponse-joueur--1 { stroke: var(--or); }
.reponse-joueur--2 { stroke: var(--bleu); }
.reponse-joueur__nom { font: 700 28px var(--texte); fill: #000; paint-order: stroke; stroke: #fff; stroke-width: 6px; }

/* ---------- formulaire de réponse : position et rose des directions ---------- */
.reponse__position { display: flex; gap: 16px; }
.reponse__position label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--encre-douce); }
.rose { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); gap: 6px; }
.rose__bouton {
  font: 700 1.05rem var(--texte); cursor: pointer;
  background: var(--fond); color: var(--encre); border: 1.5px solid var(--trait);
}
.rose__bouton:hover { border-color: var(--argent-fonce); }
.rose__bouton--choisi { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.rose__centre { border-radius: 50%; margin: 22px; background: var(--or); }

/* ---------- partie sur téléphone : vue, carte et réponse sur un seul écran (T-033) ---------- */
@media (max-width: 680px) {
  .en-partie .entete, .en-partie .pied, .en-partie .tir { display: none; }

  .en-partie .partie__barre { top: 0 !important; }
  .en-partie .partie__barre .conteneur { width: auto; margin: 0; }
  .en-partie .partie__barre-ligne { flex-wrap: nowrap; align-items: center; gap: 14px; padding: 2px 10px; min-height: 38px; }
  .en-partie #resume-reglages { display: none; }
  .en-partie .partie__progression { font-size: 0.92rem; white-space: nowrap; }
  .en-partie .partie__score { font-size: 0.88rem; white-space: nowrap; }
  .en-partie .partie__score strong, .en-partie .partie__chrono { font-size: 1.15rem; }
  .en-partie #annuler { font-size: 0; padding: 2px 10px; }
  .en-partie #annuler::after { content: "✕"; font-size: 1rem; }

  .en-partie .enigme.conteneur { position: relative; width: auto; margin: 0; padding: 0 0 var(--hauteur-reponse, 90px); scroll-margin-top: 38px; }
  .en-partie .enigme__question, .en-partie .enigme__aide { display: none; }
  .en-partie .enigme__tete { height: 0; margin: 0; }
  .en-partie #enigme-numero {   /* le lieu, posé sur le bas de la vue */
    position: absolute; left: 0; right: 0; top: calc(100vw * 900 / 1980 - 19px); z-index: 2; margin: 0; padding: 2px 8px;
    font-size: 0.6rem; letter-spacing: 0.04em; color: #fff; background: rgba(0, 0, 0, 0.5);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  }
  .en-partie .enigme__joueur { position: absolute; left: 8px; top: 4px; z-index: 2; margin: 0; padding: 0 6px; color: #fff; background: rgba(0, 0, 0, 0.5); }
  .en-partie .vue { margin: 0; }
  .en-partie .vue__legende { display: none; }
  .en-partie .enigme__corps { display: block; }
  .en-partie .plan__outils { display: none; }
  .en-partie .plan__cadre { border: 0; }

  .en-partie .reponse {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 20; gap: 5px; padding: 5px 8px 6px;
    background: var(--fond); border-top: 2px solid var(--or); max-height: 46vh; overflow-y: auto;
  }
  .en-partie #groupe-position { display: none; }
  .en-partie #groupe-direction legend { display: none; }
  .en-partie #groupe-direction[disabled] { display: none; }
  .en-partie .rose { grid-template-columns: repeat(8, 1fr); grid-template-rows: 36px; gap: 3px; }
  .en-partie .rose__centre { display: none; }
  .en-partie .rose__bouton { font-size: 0.82rem; padding: 0; min-width: 0; }
  .en-partie .rose__bouton[data-dir="N"] { order: 1; }
  .en-partie .rose__bouton[data-dir="NE"] { order: 2; }
  .en-partie .rose__bouton[data-dir="E"] { order: 3; }
  .en-partie .rose__bouton[data-dir="SE"] { order: 4; }
  .en-partie .rose__bouton[data-dir="S"] { order: 5; }
  .en-partie .rose__bouton[data-dir="SO"] { order: 6; }
  .en-partie .rose__bouton[data-dir="O"] { order: 7; }
  .en-partie .rose__bouton[data-dir="NO"] { order: 8; }
  .en-partie #valider, .en-partie #suivante { min-height: 38px; padding: 4px; font-size: 0.98rem; }
  .en-partie .resultat { font-size: 0.85rem; }
  .en-partie .resultat p { margin: 0 0 3px; }
}
