/* Spook Spook Park v5 POV : interface par-dessus la scène. Tokens de direction_v4_branding.md (contrastes calculés, aucun noir ni blanc pur). */
@font-face { font-family: "Fredoka"; font-weight: 400; font-display: swap; src: url("fonts/fredoka-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }

:root {
  --nuit-ciel: #2B2A5C; --nuit-profond: #1F1E45; --nuit-brume: #3B3570; --nuit-violet: #6E5BA8;
  --menthe: #D9EAE3; --encre: #14303A; --rose: #EC65BB; --rose-ciel: #E9A7D0; --lilas: #B9A3D6; --lueur: #FFE27A;
  --font: "Fredoka", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  --focus: 3px solid #FFE27A;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--nuit-profond); color: var(--menthe); font-family: var(--font); }
body { overflow: hidden; }
#demo { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: var(--nuit-ciel); }
a { color: var(--lueur); }
:focus-visible { outline: var(--focus); outline-offset: 3px; }

/* Sans JavaScript : page défilante, lisible, sans canvas */
html:not(.js) body { overflow: auto; }
html:not(.js) #demo { position: static; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--nuit-ciel); }
html:not(.js) #scene { display: none; }

.carte { background: var(--nuit-profond); border: 2px solid var(--nuit-violet); border-radius: 20px; padding: clamp(20px, 4vw, 36px); max-width: 640px; width: 100%; box-shadow: 0 18px 60px rgba(20,18,50,.55); }
#accueil { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; background: radial-gradient(120% 90% at 50% 20%, rgba(59,53,112,.82), rgba(31,30,69,.96)); z-index: 5; }
html:not(.js) #accueil { position: static; background: none; }
.sur-titre { margin: 0 0 6px; font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--rose-ciel); font-weight: 600; }
h1, h2 { font-family: var(--font); font-weight: 700; line-height: 1.1; margin: 0 0 12px; color: var(--menthe); }
h1 { font-size: clamp(2rem, 6vw, 3rem); }
.chapo { margin: 0 0 14px; font-size: 1.0625rem; line-height: 1.5; }
.lieux { margin: 0 0 18px; padding-left: 1.25rem; line-height: 1.45; font-size: 1rem; }
.lieux li { margin-bottom: 6px; }
.lieux strong { color: var(--lueur); font-weight: 600; }
.note { background: var(--nuit-brume); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; }
.touches { display: grid; gap: 8px; margin: 18px 0 0; font-size: .9375rem; line-height: 1.4; }
.touches dt { font-weight: 600; color: var(--rose-ciel); }
.touches dd { margin: 0; }
.liens { margin: 16px 0 0; font-size: .9375rem; }

.bouton { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; min-width: 48px; padding: 0 28px; border: 0; border-radius: 999px; font: 700 1.125rem var(--font); background: var(--rose); color: var(--encre); cursor: pointer; text-decoration: none; margin: 0 8px 8px 0; transition: transform .15s ease, box-shadow .15s ease; box-shadow: 0 0 0 0 rgba(236,101,187,.0); }
.bouton:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(236,101,187,.35); }
.bouton.sec { background: var(--lilas); }
html:not(.js) #btn-start { display: none; }
#btn-start { min-width: 250px; }
#btn-start:disabled { opacity: .7; cursor: progress; }
.liens a { display: inline-flex; align-items: center; min-height: 48px; }

/* Interface de jeu */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#hud[hidden], #pause[hidden], #fin[hidden] { display: none; }
#progression { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
#progression ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 6px 10px; background: rgba(31,30,69,.72); border-radius: 999px; backdrop-filter: blur(6px); }
#progression li { font-size: .8125rem; padding: 4px 10px; border-radius: 999px; color: var(--lilas); transition: background .4s, color .4s; }
#progression li.fait { color: var(--menthe); }
#progression li.actif { background: var(--rose); color: var(--encre); font-weight: 700; }
#titre-zone { position: absolute; left: 0; right: 0; top: 22%; text-align: center; opacity: 0; transform: translateY(8px); transition: opacity 1s ease, transform 1s ease; pointer-events: none; padding: 0 16px; }
#titre-zone.visible { opacity: 1; transform: none; }
.tz-num { display: block; font-size: .875rem; letter-spacing: .2em; text-transform: uppercase; color: var(--lueur); margin-bottom: 6px; text-shadow: 0 2px 12px var(--nuit-profond); }
.tz-nom { display: block; font-size: clamp(2rem, 7vw, 4rem); font-weight: 700; color: var(--menthe); text-shadow: 0 3px 24px var(--nuit-profond), 0 0 40px rgba(110,91,168,.7); }
.astuce { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); margin: 0; padding: 8px 16px; background: rgba(31,30,69,.78); border-radius: 999px; font-size: .9375rem; color: var(--menthe); opacity: 0; transition: opacity .4s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.astuce.visible { opacity: 1; }
.actions { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 10px; pointer-events: auto; }
.rond { width: 60px; height: 60px; min-width: 48px; min-height: 48px; border-radius: 50%; border: 2px solid var(--lilas); background: rgba(31,30,69,.82); color: var(--menthe); font: 600 1.25rem var(--font); cursor: pointer; display: grid; place-items: center; align-content: center; line-height: 1; padding: 0; }
.rond span { font-size: .625rem; letter-spacing: .04em; margin-top: 2px; }
.rond[aria-pressed="true"] { background: var(--nuit-brume); border-color: var(--rose); color: var(--rose-ciel); }
#btn-saluer { display: none; border-color: var(--lueur); }
#btn-saluer.dispo { display: grid; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255,226,122,.18); } }
#viseur { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--menthe); opacity: .55; }
#stick { display: none; position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; border: 2px solid var(--lilas); background: rgba(31,30,69,.5); pointer-events: auto; touch-action: none; }
#stick-pom { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: var(--rose-ciel); opacity: .85; }
.tactile #stick { display: block; }
.tactile #viseur { display: none; }
.tactile .astuce { bottom: 170px; }

#pause, #fin { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(31,30,69,.78); z-index: 8; }
#fondu { position: absolute; inset: 0; background: var(--nuit-profond); opacity: 1; transition: opacity 1.6s ease; pointer-events: none; z-index: 9; }
#fondu.off { opacity: 0; }

@media (max-width: 520px) {
  #progression li { padding: 4px 6px; font-size: .6875rem; }
  #progression ol { gap: 2px; padding: 4px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #titre-zone, #fondu, .bouton { transition-duration: .01s; }
  #btn-saluer.dispo { animation: none; }
}
[hidden] { display: none !important; }

/* v6 : touches, invite du wagon, sous-titres, lampe */
.h-touches { font-size: 1.125rem; margin: 18px 0 8px; color: var(--rose-ciel); }
.kbds { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px 14px; grid-template-columns: 1fr 1fr; font-size: .9375rem; line-height: 1.5; }
@media (max-width: 520px) { .kbds { grid-template-columns: 1fr; } }
.note-tactile { margin: 6px 0 0; font-size: .875rem; }
kbd { display: inline-block; min-width: 1.9em; padding: 1px 7px; margin-right: 4px; border: 1.5px solid var(--lilas); border-bottom-width: 3px; border-radius: 7px; background: var(--nuit-brume); color: var(--menthe); font: 600 .875em var(--font); text-align: center; }
.tactile .kbds, .tactile .h-touches { display: none; }
.invite { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.invite p { margin: 0 0 10px; padding: 12px 22px; background: rgba(31,30,69,.88); border: 2px solid var(--lueur); border-radius: 999px; font-size: 1.25rem; font-weight: 600; color: var(--menthe); box-shadow: 0 0 40px rgba(255,226,122,.25); animation: pulse 1.6s ease-in-out infinite; }
.invite .bouton { display: none; pointer-events: auto; background: var(--lueur); min-height: 56px; margin: 0; }
.tactile .invite p { display: none; }
.tactile .invite .bouton { display: inline-flex; }
.sous-titre { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); margin: 0; max-width: min(88vw, 760px); padding: 10px 20px; background: rgba(31,30,69,.86); border-radius: 14px; font-size: clamp(1rem, 2.6vw, 1.375rem); line-height: 1.35; text-align: center; color: var(--menthe); opacity: 0; transition: opacity .5s; pointer-events: none; }
.sous-titre.visible { opacity: 1; }
.passer { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); pointer-events: auto; min-height: 48px; font-size: 1rem; padding: 0 20px; margin: 0; }
#btn-lampe[aria-pressed="true"] { background: var(--lueur); border-color: var(--lueur); color: var(--encre); }
.tactile .actions { flex-wrap: wrap; justify-content: flex-end; max-width: 210px; }
@media (prefers-reduced-motion: reduce) { .invite p { animation: none; } .sous-titre { transition-duration: .01s; } }

/* Légende des touches : toujours présente, repliable, ouverte par défaut (fond opaque : contraste indépendant du décor) */
.legende { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: min(330px, 62vw); background: rgba(31,30,69,.94); border: 1.5px solid var(--nuit-violet); border-radius: 16px; color: var(--menthe); pointer-events: auto; font-size: .875rem; line-height: 1.45; }
.legende-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; background: none; border: 0; color: var(--lueur); font: 700 .9375rem var(--font); cursor: pointer; border-radius: 16px; }
.legende-btn .chev { transition: transform .2s; }
.legende.ferme .chev { transform: rotate(-90deg); }
#legende-corps { padding: 0 16px 12px; }
.legende.ferme #legende-corps { display: none; }
.legende ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.leg-tactile { display: none !important; }
.tactile .leg-clavier { display: none; }
.tactile .leg-tactile { display: grid !important; }
.tactile .legende, .legende.haut { bottom: auto; top: 66px; width: min(250px, 56vw); }
.tactile #stick { z-index: 4; }
@media (max-width: 600px) { .legende { bottom: auto; top: 66px; width: min(250px, 56vw); } }
@media (max-height: 520px) { .legende { width: min(260px, 40vw); } }
@media (max-height: 560px) { .legende { font-size: .75rem; width: min(400px, 64vw); } .legende-btn { min-height: 40px; } #legende-corps { padding: 0 12px 8px; } .leg-clavier { grid-template-columns: 1fr 1fr; gap: 2px 10px; } .legende kbd { min-width: 1.5em; padding: 0 4px; } }

/* v7 : tout au clavier. Les boutons de jeu ne sont affichés qu'au tactile ; la légende est fixe et toujours ouverte. */
.legende-btn { display: none; }
.legende-titre { margin: 0; padding: 10px 16px 4px; color: var(--lueur); font: 700 .9375rem var(--font); }
#legende-corps { display: block !important; }
.legende { pointer-events: none; }
html:not(.tactile) .actions, html:not(.tactile) .invite .bouton, html:not(.tactile) .passer, html:not(.tactile) #pause .bouton:not(#btn-sortir2), html:not(.tactile) #fin .bouton { display: none !important; }
.tactile .pause-touches { display: none; }
.pause-touches { margin: 0 0 12px; font-size: 1.0625rem; }
.vitesse { position: absolute; left: 50%; top: 82px; transform: translateX(-50%); margin: 0; padding: 8px 18px; background: rgba(31,30,69,.9); border: 2px solid var(--rose); border-radius: 999px; color: var(--menthe); font-size: .9375rem; pointer-events: none; white-space: nowrap; }
.vitesse b { color: var(--lueur); font-size: 1.125rem; }
.vitesse[hidden] { display: none !important; }
.leg-wagon { color: var(--rose-ciel); }
@media (max-height: 640px) { .legende-titre { padding: 6px 12px 2px; } }

/* v8 : fiche d'attraction, étoiles, mini-carte, photo */
.etoiles { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); margin: 0; padding: 8px 16px; background: rgba(31,30,69,.92); border: 2px solid var(--lueur); border-radius: 999px; color: var(--lueur); font-weight: 700; font-size: .9375rem; pointer-events: none; }
.carte-boite { position: absolute; top: 74px; right: max(14px, env(safe-area-inset-right)); padding: 6px; background: rgba(31,30,69,.92); border: 1.5px solid var(--nuit-violet); border-radius: 14px; pointer-events: none; }
.carte-boite canvas { display: block; width: 150px; height: 190px; border-radius: 8px; }
.carte-boite[hidden] { display: none; }
.fiche { position: absolute; right: max(14px, env(safe-area-inset-right)); top: 290px; width: min(340px, 44vw); padding: 14px 18px 12px; background: rgba(31,30,69,.95); border: 2px solid var(--rose); border-radius: 18px; color: var(--menthe); pointer-events: none; transition: opacity .6s ease, transform .6s ease; }
.fiche[hidden] { display: none; }
.fiche.cache { opacity: 0; transform: translateX(16px); }
.fiche-sur { margin: 0 0 2px; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--rose-ciel); font-weight: 600; }
.fiche h2 { margin: 0 0 6px; font-size: 1.375rem; color: var(--lueur); line-height: 1.15; }
.fiche-tags { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.fiche-tags span { background: var(--menthe); color: var(--encre); border-radius: 999px; padding: 1px 10px; font-size: .8125rem; font-weight: 600; }
#fiche-texte { margin: 0 0 8px; font-size: .9375rem; line-height: 1.45; }
.fiche-liste { margin: 0 0 8px; padding-left: 1.1rem; font-size: .875rem; line-height: 1.4; }
.fiche-aide { margin: 0; font-size: .8125rem; color: var(--lilas); }
.photo-info { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 20px; background: rgba(31,30,69,.92); border: 2px solid var(--lueur); border-radius: 999px; color: var(--menthe); pointer-events: none; }
.photo-info[hidden] { display: none; }
.flash { position: absolute; inset: 0; background: var(--menthe); opacity: 0; pointer-events: none; transition: opacity .35s ease-out; z-index: 7; }
.flash.on { opacity: .75; transition: none; }
.bravo { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); text-align: center; padding: 22px 34px; background: rgba(31,30,69,.95); border: 3px solid var(--lueur); border-radius: 24px; pointer-events: none; }
.bravo[hidden] { display: none; }
.bravo h2 { margin: 0 0 6px; font-size: 2.5rem; color: var(--lueur); }
.bravo p { margin: 0; font-size: 1.125rem; }
html.photo .sortir, html.photo .legende, html.photo .carte-boite, html.photo .etoiles, html.photo #progression, html.photo .fiche, html.photo .astuce, html.photo .invite, html.photo .vitesse, html.photo .sous-titre, html.photo .actions, html.photo #titre-zone { display: none !important; }
@media (max-width: 900px) { .fiche { top: auto; bottom: 14px; right: 14px; width: min(320px, 50vw); } }
@media (max-width: 600px) { .carte-boite, .fiche { display: none; } }
@media (max-height: 760px) { .fiche { top: 270px; } }
@media (max-height: 640px) { .carte-boite canvas { width: 110px; height: 140px; } .fiche { top: 224px; width: min(300px, 40vw); } .fiche-liste { display: none; } }
@media (prefers-reduced-motion: reduce) { .fiche, .flash { transition-duration: .01s; } }

/* v9 : légende réduite, billetterie en superposition, aides d'arrêt */
.invite-sub { display: block; margin-top: 6px; font-size: .875rem; font-weight: 400; color: var(--lilas); }
.billets { position: absolute; inset: 0; z-index: 10; background: rgba(31,30,69,.97); display: flex; flex-direction: column; }
.billets[hidden] { display: none; }
.billets-barre { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--nuit-brume); color: var(--menthe); font-weight: 600; flex-wrap: wrap; }
.billets iframe { flex: 1; width: 100%; border: 0; background: var(--nuit-ciel); }
.pause-liste { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: .9375rem; }
html.photo .billets { display: none; }

/* v10 : bouton de sortie des lieux (visible partout, cible 48 px), indépendant d'Échap */
.sortir { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 52px; margin: 0; padding: 0 24px; pointer-events: auto; font-size: 1rem; z-index: 6; }
.sortir[hidden], #btn-sortir2[hidden] { display: none !important; }
#btn-sortir2 { display: inline-flex; }

/* v10 : téléphone. Pile verticale en portrait (progression, étoiles + passer, légende), fiche masquée, sortie au-dessus des commandes */
.tactile .vitesse { display: none; }
@media (max-width: 600px) {
  .etoiles { top: 58px; }
  .passer { top: 58px; }
  .tactile .legende, .legende { top: 112px; width: min(230px, 58vw); }
  .tactile .sortir { bottom: 168px; }
  .tactile.dedans .astuce, .dedans .astuce { bottom: 232px; }
}
@media (max-width: 1000px) and (max-height: 560px) {
  .tactile .fiche { display: none; }
  .dedans .sous-titre, .dedans .astuce { bottom: 88px; }
  .tactile .sortir { bottom: 14px; }
}

.billets-barre { align-items: center; }
.billets-barre .fermer { min-height: 48px; margin: 0; padding: 0 20px; font-size: 1rem; display: inline-flex !important; }
.tactile .billets-aide { display: none; }
@media (max-width: 600px) { .tactile.dedans .sous-titre, .dedans .sous-titre { bottom: 232px; } }
