/* Parcours en quête (27/11/2026, retour de Mathis : « trop d'options, les randonneurs sont mal
   guidés »). Repères tirés des jeux : un seul bouton d'action à la fois (la touche « A » d'une
   manette, le gros bouton de Duolingo), un journal de quête par escale (jeux de rôle), un plateau
   où avance un pion (jeux de société, livres-jeux), le nom de l'escale en grand à l'arrivée
   (entrée dans une nouvelle région), « Objectif atteint » en bannière brève, les relances comme
   des choix de dialogue (romans visuels), le reste des questions rangé dans « Explorer »
   (l'inventaire). Boutons « en relief » qui s'enfoncent sous le doigt. Toutes les animations
   s'arrêtent avec « Réduire les animations » ou le réglage du téléphone (règles de app.css). */

/* ---------- accueil : Samara parle, comme dans un roman visuel ---------- */
.dialogue-accueil { display: flex; align-items: flex-end; gap: 10px; text-align: left; margin: 4px 0 14px; }
.dialogue-accueil .guide { flex: none; width: 76px; height: 76px; margin: 0; overflow: visible; box-shadow: 0 0 0 4px var(--fond), var(--ombre-forte); }
.dialogue-accueil .guide::before { inset: -7px; padding: 3px; }
.dialogue-accueil .guide::after { right: 0; bottom: 2px; width: 15px; height: 15px; }
.dialogue-accueil .guide-avatar { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; }
.bulle-accueil {
  position: relative; flex: 1; min-width: 0; background: var(--surface); border: 1.5px solid var(--bord);
  border-radius: 20px 20px 20px 6px; padding: 10px 14px 12px; box-shadow: var(--ombre);
  transform-origin: 0 100%; animation: bulle-parle .5s var(--ressort) .15s both;
}
.bulle-accueil .surtitre { margin: 0 0 2px; }
.bulle-accueil h1 { font-size: 1.28em; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.bulle-accueil .accueil-texte { margin: 4px 0 0; font-size: .9em; color: var(--encre-douce); max-width: none; min-height: 2.8em; text-wrap: pretty; }
@keyframes bulle-parle { from { opacity: 0; transform: scale(.6) translateY(8px); } }

/* ---------- carte du lieu : plateau et journal de quête ---------- */
.lieu-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lieu-tete .progression { flex: 0 0 auto; width: 84px; }
.lieu .lieu-resume { margin: 12px 0 2px; }
.quete { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px; padding: 10px 12px 8px; }
.quete-titre { margin: 0 0 6px !important; font-family: var(--titres); font-size: .74em !important; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--vif); }
.objectifs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.objectifs li { display: flex; align-items: center; gap: 10px; min-height: 30px; font-weight: 600; font-size: .9em; opacity: .78; transition: opacity .3s; }
.objectifs .case { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .55); color: #fff; transition: background-color .3s, border-color .3s; }
.objectifs li.prochain { opacity: 1; }
.objectifs li.prochain .case { border-color: var(--vif); color: var(--vif); animation: pulsation 2.4s var(--sortie) 3; } /* trois pulsations, pas en continu : batterie */
.objectifs li.fait { opacity: .9; }
.objectifs li.fait > span:nth-child(2) { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--vif) 70%, transparent); }
.objectifs li.fait .case { background: var(--vif); border-color: var(--vif); color: var(--sur-vif); animation: cocher .45s var(--rebond) both; }
@keyframes cocher { 0% { transform: scale(.4) rotate(-20deg); } 100% { transform: none; } }

/* ---------- bandeau de quête sous l'en-tête (pendant la conversation, sur téléphone) ---------- */
.parcours { display: none; max-width: 1240px; margin: 6px auto 0; }
body[data-conversation="oui"] .parcours { display: block; }
.hud {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 6px 4px 10px; border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, .12); color: inherit; text-align: left; font-size: .8em; transition: background-color .2s;
}
.hud:hover { background: rgba(255, 255, 255, .2); }
.hud:active { transform: scale(.985); }
.hud .progression { flex: 0 0 auto; width: 64px; }
.hud .progression span { width: 11px; height: 11px; border-width: 2px; }
.hud .progression i { min-width: 8px; }
.hud-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hud-texte b { font-family: var(--titres); color: var(--vif); font-weight: 800; margin-right: 5px; }
.pastilles { display: flex; gap: 4px; flex: none; }
.pastille { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .8); transition: background-color .3s, color .3s; }
.pastille.fait { background: var(--vif); color: var(--sur-vif); animation: cocher .45s var(--rebond) both; }

/* ---------- commandes : bouton d'action et « Explorer » ---------- */
.commandes { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.action-principale {
  flex: 1; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 10px; text-align: left;
  border: 0; border-radius: 18px; color: var(--sur-vif); position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, #ffe54d 0%, var(--vif) 55%, #ffd000 100%);
  box-shadow: 0 5px 0 var(--vif-fonce), 0 10px 22px rgba(244, 167, 0, .35);
  transition: transform .12s var(--sortie), box-shadow .12s var(--sortie), filter .2s;
}
.action-principale[hidden] { display: none; }
.action-principale:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--vif-fonce), 0 4px 10px rgba(244, 167, 0, .3); }
.action-principale:disabled { filter: saturate(.4) brightness(.97); cursor: default; }
.action-principale > svg { flex: none; margin-left: auto; transition: transform .25s var(--sortie); }
.action-principale:hover:not(:disabled) > svg { transform: translateX(3px); }
.action-picto { flex: none; width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: rgba(42, 21, 48, .1); }
.action-textes { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.action-textes strong { font-family: var(--titres); font-weight: 800; font-size: 1.02em; letter-spacing: -.01em; overflow-wrap: anywhere; }
.action-textes small { font-size: .8em; font-weight: 600; opacity: .85; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* reflet qui balaie le bouton quand il change : l'œil va au prochain geste */
.action-principale::after {
  content: ""; position: absolute; z-index: -1; inset: 0; transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .75) 48%, transparent 66%);
}
.action-principale.neuf { animation: bouton-neuf .5s var(--ressort) both; }
.action-principale.neuf::after { animation: balayer 1.1s var(--sortie) .35s both; }
.action-principale.defi .action-picto svg { animation: scintiller 2.6s ease-in-out infinite; }
.action-principale.arriver .action-picto svg { animation: rebond-pion 1.4s var(--sortie) infinite; }
@keyframes bouton-neuf { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes balayer { to { transform: translateX(120%); } }
@keyframes rebond-pion { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

.bouton-explorer {
  flex: none; width: 64px; border-radius: 18px; border: 1.5px solid var(--bord-fort); background: var(--surface); color: var(--accent-texte);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7em; font-weight: 700; box-shadow: 0 4px 0 var(--bord), var(--ombre); transition: transform .12s var(--sortie), box-shadow .12s var(--sortie);
}
.bouton-explorer:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bord), var(--ombre); }
.bouton-explorer:hover { border-color: var(--accent-texte); }
/* tout est fait à cette escale : « Explorer » prend la largeur */
body[data-action="aucune"] .bouton-explorer { flex: 1; }

/* sur téléphone, pendant la frappe, le clavier prend la place : on garde la saisie seule */
@media (max-width: 599px) {
  .pied:has(textarea:focus) .commandes { display: none; }
}

/* ---------- une réponse : Écouter près du nom, une ligne d'outils discrète ---------- */
.nom-outils { margin-left: auto; display: flex; align-items: center; }
.nom-outils .ecouter {
  min-height: 34px; padding: 3px 12px 3px 9px; border-radius: 999px; border: 1.5px solid var(--bord); background: var(--surface);
  color: var(--accent-texte); font-family: var(--texte); font-size: .95em; font-weight: 700; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .2s var(--ressort), background-color .2s, color .2s, border-color .2s;
}
.nom-outils .ecouter:hover { border-color: var(--accent-texte); }
.nom-outils .ecouter:active { transform: scale(.93); }
.pied-reponse { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: -2px; animation: monter .3s var(--sortie) both; }
.lien-reponse {
  min-height: 36px; padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--accent-texte);
  font-size: .8em; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-texte) 40%, transparent);
}
.lien-reponse:first-child { padding-left: 2px; }
.lien-reponse:hover { background: var(--doux); }
.pouces { margin-left: auto; display: inline-flex; gap: 2px; }
.pouces button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--encre-douce); display: grid; place-items: center; opacity: .75; transition: transform .2s var(--ressort), background-color .2s, opacity .2s; }
.pouces button:hover:not(:disabled) { background: var(--doux); opacity: 1; }
.pouces button:disabled { cursor: default; opacity: .35; }
.pouces [data-pouce="bas"] svg { transform: scaleY(-1); }
.pouces [data-pouce][aria-pressed="true"] { background: var(--vif); color: var(--sur-vif); opacity: 1; animation: bondir .45s var(--rebond); }

/* relances : des choix de dialogue, numérotés, un seul jeu à l'écran */
.relances { display: grid; gap: 6px; margin-top: 4px; counter-reset: choix; }
.relances-titre { margin: 0; font-size: .8em; font-weight: 700; color: var(--encre-douce); animation: monter .3s var(--sortie) both; }
.relances button {
  counter-increment: choix; justify-self: start; max-width: 100%; min-height: 44px; display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 7px; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--accent-texte) 30%, transparent);
  background: var(--surface); color: var(--encre); font-size: .88em; font-weight: 600; text-align: left;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent-texte) 18%, transparent);
  transition: transform .12s var(--sortie), box-shadow .12s var(--sortie), border-color .2s, background-color .2s;
  animation: choix-arrive .4s var(--ressort) both;
}
.relances button::before {
  content: counter(choix); flex: none; width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  background: var(--doux); color: var(--accent-texte); font-family: var(--titres); font-weight: 800; font-size: .85em; opacity: 1;
}
.relances button:nth-of-type(2) { animation-delay: .08s; }
.relances button:nth-of-type(3) { animation-delay: .16s; }
.relances button:hover { border-color: var(--accent-texte); background: var(--doux); }
.relances button:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent-texte) 18%, transparent); }
@keyframes choix-arrive { from { opacity: 0; transform: translateX(-12px); } }

/* ---------- trajet : le pion avance sur le plateau ---------- */
.trajet {
  align-self: stretch; position: relative; overflow: hidden; border-radius: 22px; padding: 12px 16px 14px;
  background: linear-gradient(160deg, var(--doux) 0%, var(--surface) 70%); border: 1.5px dashed color-mix(in srgb, var(--accent-texte) 45%, transparent);
  animation: monter .35s var(--sortie) both;
}
.trajet-titre { margin: 0; display: flex; align-items: center; gap: 6px; font-family: var(--titres); font-size: .72em; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-texte); }
.plateau-trajet { display: block; width: 100%; max-width: 380px; height: auto; margin: 6px 0 4px; overflow: visible; }
.pt-chemin { fill: none; stroke: var(--accent-texte); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 8; opacity: .55; }
.pt-case circle { fill: var(--surface); stroke: var(--accent-texte); stroke-width: 3; }
.pt-case.depart circle { fill: var(--accent); stroke: var(--accent); }
.pt-case.arrivee circle { stroke: var(--vif-fonce); stroke-dasharray: 4 3; }
.pt-case text { font-family: var(--titres); font-weight: 800; font-size: 13px; fill: var(--accent-texte); }
.pt-case.depart text { fill: var(--sur-accent); }
.pt-pion circle { fill: var(--vif); stroke: var(--sur-vif); stroke-width: 2.5; }
.pt-pion .pt-pion-coeur { fill: var(--sur-vif); stroke: none; }
.trajet-nom { display: block; font-family: var(--titres); font-size: 1em; }
.trajet p { margin: 2px 0 0; font-size: .9em; }
.trajet .trajet-aide { margin-top: 6px; font-size: .82em; color: var(--encre-douce); }

/* ---------- arrivée : le nom de l'escale en grand ---------- */
.chapitre { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; cursor: pointer; background: radial-gradient(circle at 50% 45%, rgba(74, 26, 72, .88), rgba(20, 8, 24, .95)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: chapitre-fond 2.3s ease both; }
.chapitre[hidden] { display: none; }
.chapitre-carte { text-align: center; color: #fff; display: grid; justify-items: center; gap: 4px; animation: chapitre-entree 2.3s var(--sortie) both; }
.chapitre-tampon {
  width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--vif); color: var(--vif); display: grid; place-content: center; text-align: center;
  font-family: var(--titres); font-weight: 800; line-height: 1; transform: rotate(-10deg); margin-bottom: 10px;
  animation: tamponner .55s var(--rebond) .25s both;
}
.chapitre-tampon span { font-size: .62em; letter-spacing: .14em; text-transform: uppercase; }
.chapitre-tampon b { font-size: 2.2em; }
.chapitre-sur { margin: 0; font-family: var(--titres); font-size: .78em; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--vif); }
.chapitre-nom { margin: 0; max-width: 16em; font-family: var(--titres); font-size: clamp(1.6em, 8vw, 2.4em); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; text-shadow: 0 4px 20px rgba(0, 0, 0, .35); }
.chapitre-trait { display: block; width: 160px; height: 4px; margin-top: 10px; border-radius: 4px; background: var(--degrade); transform-origin: center; animation: trait .6s var(--sortie) .45s both; }
.chapitre small { margin-top: 14px; font-size: .74em; opacity: .7; }
@keyframes chapitre-fond { 0% { opacity: 0; } 12%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes chapitre-entree { 0% { opacity: 0; transform: translateY(16px) scale(.96); } 15%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes trait { from { transform: scaleX(0); } }

/* ---------- « Objectif atteint » ---------- */
.toast {
  position: fixed; z-index: 46; left: 50%; top: calc(env(safe-area-inset-top) + 10px); translate: -50% 0; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; pointer-events: none;
  background: var(--encre); color: var(--fond); font-family: var(--titres); font-weight: 700; font-size: .84em; box-shadow: var(--ombre-forte);
  opacity: 0; transform: translateY(-14px) scale(.96); transition: opacity .25s var(--sortie), transform .35s var(--ressort);
}
.toast.visible { opacity: 1; transform: none; }
.toast-rond { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--vif); color: var(--sur-vif); }
.toast.visible .toast-rond { animation: cocher .5s var(--rebond) .1s both; }

/* ---------- Explorer : l'inventaire des questions ---------- */
.panneau-explorer .raccourcis-grands { margin-top: 2px; }
.panneau-explorer .carte-question { animation: monter .35s var(--sortie) both; }
.panneau-explorer .carte-question:nth-child(n+5) { animation-delay: .18s; }

/* ---------- ordinateur : la carte du lieu reste à gauche, le bandeau est inutile ---------- */
@media (min-width: 960px) and (min-height: 560px) {
  body[data-conversation="oui"] .parcours { display: none; }
  .dialogue-accueil { margin-top: 6px; }
  .trajet, .relances button, .nom-outils .ecouter { background: var(--fond); }
}
/* très petits téléphones */
@media (max-width: 359px) {
  .dialogue-accueil .guide, .dialogue-accueil .guide-avatar { width: 60px; height: 60px; }
  .bulle-accueil h1 { font-size: 1.12em; }
  .bouton-explorer { width: 52px; }
  .hud .progression { display: none; }
}
/* téléphone couché */
@media (orientation: landscape) and (max-height: 520px) {
  .accueil { display: block; }
  .dialogue-accueil { margin-bottom: 8px; }
  .action-principale { min-height: 48px; }
}
/* contraste renforcé et sombre : bouton d'action et pastilles restent lisibles */
:root[data-contraste] .action-principale { background: var(--vif); box-shadow: 0 4px 0 var(--encre); }
:root[data-contraste] .quete, :root[data-contraste] .hud { border: 1.5px solid currentColor; }
:root[data-sombre] .toast { background: var(--surface); color: var(--encre); border: 1.5px solid var(--bord); }

/* ---------- téléphone : le bouton d'action toujours sous le pouce ---------- */
/* La zone du bas est fixée en bas de l'écran, dès l'accueil ; la page lui laisse sa hauteur
   (--hauteur-pied, mesurée par app.js). */
@media not ((min-width: 960px) and (min-height: 560px)) {
  .pied { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; max-width: 680px; margin: 0 auto; padding-left: var(--gouttiere); padding-right: var(--gouttiere); }
  body { padding-bottom: var(--hauteur-pied, 170px); }
  .vers-le-bas { top: -40px; }
}
@media (max-width: 599px) {
  .lieu-photo img { aspect-ratio: 3 / 1; }
  .lieu-tete .progression { display: none; } /* le plateau est dans le bandeau de quête */
  .accueil { padding-top: 12px; }
}

/* l'en-tête reste visible en haut de l'écran : le bandeau de quête aussi */
.entete { position: sticky; top: 0; }

/* Dans la colonne qui défile (ordinateur), aucune carte ne doit être écrasée pour tenir :
   sans cela, le tampon d'escale et la carte de trajet se réduisaient à une ligne coupée. */
.fil > * { flex-shrink: 0; }

/* ---------- corrections de la relecture ergonomie et accessibilité (27/11) ---------- */
:root { --bord-fort: color-mix(in srgb, var(--accent-texte) 45%, var(--surface)); --vif-texte: var(--vif); }
:root[data-daltonien] { --vif-texte: #ffd24a; --accent-clair: #004a9c; }
/* anneau de focus visible partout (l'orange faisait 1,9:1 sur fond clair) ; jaune sur fonds foncés */
:focus-visible { outline: 3px solid var(--accent-texte); outline-offset: 2px; }
.entete :focus-visible, .lieu :focus-visible, .chapitre :focus-visible { outline-color: var(--vif); }
/* textes jaunes sur prune ou bleu : jeton lisible aussi en mode daltonien */
.marque b, .pepites, .lieu-etape, .quete-titre, .hud-texte b, .chapitre-sur { color: var(--vif-texte); }
/* champ et bordures visibles au soleil ; texte d'aide du champ assez contrasté */
.saisie { border-color: var(--bord-fort); }
.saisie textarea::placeholder { opacity: 1; }
/* encoche à droite en paysage (téléphones) */
@media not ((min-width: 960px) and (min-height: 560px)) {
  .entete, .pied { padding-right: max(var(--gouttiere), env(safe-area-inset-right)); }
}
/* en-tête : passe sur deux lignes plutôt que de sortir de l'écran (320 px, grand texte) */
.entete-ligne { flex-wrap: wrap; row-gap: 4px; }
.marque { min-width: 0; }
/* l'élément qui reçoit le focus ne passe jamais sous l'en-tête ou la zone du bas */
html { scroll-padding-top: 120px; scroll-padding-bottom: var(--hauteur-pied, 170px); }
/* écran bas (téléphone couché, zoom fort) : rien de fixe, tout défile */
@media (max-height: 540px) {
  .entete { position: relative; }
  .pied { position: relative !important; max-width: none; }
  body { padding-bottom: 0 !important; }
  html { scroll-padding: 0; }
}
/* « Objectif atteint » au-dessus de la zone du bas, loin des drapeaux et du menu */
.toast { top: auto; bottom: calc(var(--hauteur-pied, 170px) + 10px); }
@media (min-width: 960px) and (min-height: 560px) { .toast { bottom: 150px; } }
.avis-erreur { margin: 8px 0 0; font-size: .85em; font-weight: 700; color: #b3261e; }
:root[data-sombre] .avis-erreur { color: #ffb4ab; }
.bouton-reessayer { margin-left: 6px; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 0; background: var(--accent); color: var(--sur-accent); font-weight: 700; }
