/* EasyCatalog Quest — charte easy-catalog.fr */
:root{
  --bg:#f2f6fb; --card:#fff; --navy:#1f3a5f; --navy-dark:#152a46; --blue:#2f6fed; --blue-deep:#2560d8;
  --blue-soft:#e8f0fe; --teal:#0f9d8f; --teal-soft:#e2f6f3; --mint:#54e6a0; --ink:#16202c; --ink-2:#31506e;
  --muted:#5f6e80; --line:#dbe4ef; --green:#1f8a4c; --green-soft:#e7f6ee; --amber:#c9820a; --amber-soft:#fdf3e0;
  --r:10px; --retro:"Courier New",ui-monospace,Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
button,input{font:inherit}
#app{max-width:1000px;margin:0 auto;padding:0 12px 24px}
.barre{display:flex;align-items:center;justify-content:space-between;padding:10px 0}
.marque{display:flex;align-items:center;gap:8px;font-weight:600;color:var(--navy)}
.marque b{color:var(--teal)}
.barre-actions{display:flex;gap:6px;align-items:center}
.badge-beta{font-family:var(--retro);font-weight:700;background:var(--navy);color:var(--mint);border-radius:6px;padding:2px 8px;letter-spacing:.1em}
a.btn-icone{text-decoration:none;font-size:14px}
.btn-icone{border:1px solid var(--line);background:var(--card);color:var(--navy);border-radius:8px;padding:6px 10px;cursor:pointer}
.btn-icone[aria-pressed="true"]{background:var(--teal-soft);border-color:var(--teal);color:var(--teal)}

#scene{position:relative}
#cadre-jeu{position:relative;width:100%;aspect-ratio:16/9;background:#07111f;border:1px solid #1f3a5f;border-radius:var(--r);overflow:hidden;box-shadow:0 6px 24px rgba(31,58,95,.08)}
#canvas{display:block;width:100%;height:100%;touch-action:manipulation;cursor:pointer}

#hud{position:absolute;left:8px;right:8px;top:8px;display:flex;gap:6px;flex-wrap:wrap;pointer-events:none}
.hud-bloc{background:rgba(12,24,42,.72);border:1px solid rgba(111,147,191,.45);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);box-shadow:0 0 12px rgba(84,230,160,.08);border-radius:8px;padding:2px 8px;display:flex;flex-direction:column;line-height:1.15;min-width:58px}
.hud-bloc small{font-size:10px;color:#9fb4cc;text-transform:uppercase;letter-spacing:.04em}
.hud-bloc b{font-family:var(--retro);color:#fff;font-size:15px;text-shadow:0 0 6px rgba(84,230,160,.35)}
.hud-joueur{flex-direction:row;align-items:center;gap:6px}
.hud-joueur span{font-weight:600;color:#fff;font-size:13px}
.hud-score b{color:var(--mint)}
.hud-combo{background:var(--navy);color:var(--mint);font-family:var(--retro);font-weight:700;justify-content:center;animation:clignote .5s steps(2) infinite}
#couche-mascottes{position:absolute;left:0;top:0;width:2px;height:2px;pointer-events:none;overflow:hidden;opacity:.01;z-index:0}
.mascotte-source{position:absolute;left:0;top:0;width:1px;height:1px}
#hud{display:none !important}
.mascotte-monde{position:absolute;width:auto;filter:drop-shadow(0 6px 10px rgba(0,0,0,.45)) drop-shadow(0 0 14px rgba(84,230,160,.25));transition:opacity .25s}
.mascotte-monde.pop.anime{animation:pop .5s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{from{transform:scale(.2) translateY(40px)}to{transform:none}}
#hud{z-index:2}
#btn-turbo{z-index:3;position:absolute;right:12px;bottom:12px;font:700 13px "Press Start 2P",monospace;padding:12px 14px;border:3px solid #16202c;border-radius:10px;background:#f0b340;color:#16202c;box-shadow:0 4px 0 #16202c;touch-action:none;user-select:none;-webkit-user-select:none}
#btn-turbo.actif{background:#fff;transform:translateY(3px);box-shadow:0 1px 0 #16202c}
#aide-saut{z-index:2;position:absolute;left:50%;bottom:10px;transform:translateX(-50%);background:var(--mint);color:var(--navy-dark);font-weight:700;box-shadow:0 0 16px rgba(84,230,160,.6);padding:4px 12px;border-radius:8px;font-size:14px;pointer-events:none;animation:clignote .6s steps(2) infinite}
kbd{font-family:var(--retro);background:var(--blue-soft);color:var(--navy);border:1px solid var(--line);border-radius:4px;padding:0 4px;font-size:.85em}

/* Mini-ordinateur */
.ordi{position:absolute;left:50%;top:13%;transform:translateX(-50%);width:min(620px,86%);background:linear-gradient(180deg,rgba(21,42,70,.96),rgba(10,22,40,.96));border-radius:14px;padding:0 14px 14px;box-shadow:0 0 0 1px rgba(84,230,160,.25),0 0 30px rgba(84,230,160,.18),0 14px 40px rgba(0,0,0,.5);border:2px solid #2d4f7a;z-index:3;animation:ouvrir .18s ease-out}
.ordi-barre{display:flex;align-items:center;gap:5px;padding:8px 0}
.pastille{width:9px;height:9px;border-radius:50%;background:#31506e}
.ordi-titre{margin-left:8px;color:#9fb4cc;font-size:12px;font-family:var(--retro);text-transform:uppercase;letter-spacing:.06em}
.q-enonce{color:#fff;font-size:18px;font-weight:600;margin:4px 0 12px;min-height:2.6em}
.q-choix{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.q-choix button{text-align:left;background:#fff;border:2px solid var(--line);border-radius:8px;padding:9px 10px;color:var(--ink);cursor:pointer;font-size:15px;line-height:1.25;display:flex;gap:8px;align-items:flex-start}
.q-choix button:hover,.q-choix button:focus-visible{border-color:var(--blue);outline:none;background:var(--blue-soft)}
.q-choix button .lettre{font-family:var(--retro);font-weight:700;color:var(--blue);min-width:1.2em}
.q-choix button.juste{background:var(--green);border-color:var(--green);color:#fff}
.q-choix button.juste .lettre,.q-choix button.faux .lettre{color:#fff}
.q-choix button.faux{background:var(--amber);border-color:var(--amber);color:#fff;animation:secoue .3s}
.q-choix button:disabled{cursor:default}
.chrono{margin-top:12px}
.chrono-libelle{display:flex;justify-content:space-between;color:#9fb4cc;font-size:12px;font-family:var(--retro)}
.chrono-libelle b{color:var(--mint)}
.chrono-piste{height:12px;background:#0d1d31;border-radius:6px;overflow:hidden;margin-top:3px;border:1px solid #31506e}
.chrono-barre{height:100%;width:100%;background:linear-gradient(90deg,var(--teal),var(--mint))}
.ordi.urgent .chrono-barre{background:var(--amber)}
.ordi.urgent .chrono-libelle b{color:var(--amber);animation:clignote .4s steps(2) infinite}

/* Écrans */
.ecran{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:14px;background:rgba(242,246,251,.9);overflow:auto;z-index:5}
.ecran-transparent{background:rgba(242,246,251,.55)}
.carte{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:20px 22px;max-width:520px;width:100%;box-shadow:0 6px 24px rgba(31,58,95,.1);margin:auto}
.carte-large{max-width:900px}
.carte-titre{text-align:center}
.sur-titre{margin:0;color:var(--teal);font-weight:700;font-size:13px;text-transform:uppercase;letter-spacing:.08em}
.titre-retro{font-family:var(--retro);color:var(--navy);font-size:42px;line-height:1;margin:8px 0 10px;letter-spacing:.02em;text-shadow:3px 3px 0 var(--blue-soft)}
.titre-retro span{color:var(--blue);font-size:54px;text-shadow:3px 3px 0 var(--teal-soft),6px 6px 0 var(--mint)}
.titre-ecran{margin:4px 0 8px;color:var(--navy);font-size:22px}
.sous-titre{margin:14px 0 6px;color:var(--ink-2);font-size:14px;text-transform:uppercase;letter-spacing:.05em}
.sous-titre small{text-transform:none;color:var(--muted);letter-spacing:0}
.accroche{color:var(--ink-2)}
.intro-ecran{color:var(--muted);margin:0 0 6px}
.note,.mention{color:var(--muted);font-size:12px}
.actions{display:flex;flex-direction:column;gap:8px;margin-top:14px}
.actions-ligne{flex-direction:row;justify-content:space-between;flex-wrap:wrap}
.btn{border-radius:8px;padding:11px 16px;border:2px solid transparent;cursor:pointer;font-weight:600;text-decoration:none;text-align:center;display:inline-block}
.btn small{font-weight:400}
.btn-principal{background:var(--blue);color:#fff}
.btn-principal:hover{background:var(--blue-deep)}
.btn-secondaire{background:var(--card);border-color:var(--blue);color:var(--blue)}
.btn-secondaire:hover{background:var(--blue-soft)}
.btn-secret{background:#8a6dcf;border-color:#5c47a0;color:#fff}
.btn-secret:hover{background:#5c47a0}
.btn-teal{background:var(--teal);color:#fff}
.btn-lien{background:none;color:var(--ink-2);text-decoration:underline}
.btn-petit{padding:6px 10px;font-size:14px}

.creation-grille{display:grid;grid-template-columns:1.1fr .8fr 1.1fr;gap:16px;align-items:start}
.liste-avatars{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.liste-avatars button{background:var(--bg);border:2px solid var(--line);border-radius:8px;padding:2px;cursor:pointer}
.liste-avatars button[aria-checked="true"]{border-color:var(--blue);background:var(--blue-soft)}
.liste-avatars canvas{width:100%;height:auto;display:block}
.photo-actions{display:flex;gap:6px;flex-wrap:wrap}
#zone-webcam{margin-top:8px}
#zone-webcam video{width:100%;border-radius:8px;background:#000}
.apercu-colonne{display:flex;justify-content:center}
#apercu-heros{width:100%;max-width:220px;height:auto;background:linear-gradient(var(--blue-soft),#fff);border-radius:var(--r);border:1px solid var(--line)}
.champ{display:block;font-size:13px;font-weight:600;color:var(--ink-2);margin-bottom:8px}
.champ small{font-weight:400;color:var(--muted)}
.champ input{display:block;width:100%;margin-top:2px;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:#fff}
.champ input:focus{outline:2px solid var(--blue);border-color:var(--blue)}
.champ input.invalide{border-color:var(--amber);background:var(--amber-soft)}
.champ-duo{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.case{display:flex;gap:6px;align-items:flex-start;font-size:13px;color:var(--ink-2);margin:4px 0}
.erreur{color:var(--amber);font-weight:600;font-size:14px}
.info-retour{background:var(--teal-soft);color:var(--teal);border-radius:8px;padding:6px 10px;font-size:14px;font-weight:600}

.bulle-guide{display:flex;align-items:flex-end;gap:8px;max-width:760px}
.bulle-guide img{flex:none;width:150px;height:auto}
.source-cachee{position:fixed !important;left:0;top:0;width:1px !important;height:1px !important;opacity:.01;pointer-events:none}
.place-guide{flex:none;width:150px;height:150px}
#guide-curseur{position:fixed;left:0;top:0;width:150px;height:150px;image-rendering:pixelated;pointer-events:none;z-index:40;filter:drop-shadow(4px 4px 0 rgba(22,32,44,.35));will-change:transform}
.bulle{background:var(--card);border:2px solid var(--teal);border-radius:14px;padding:16px 18px;position:relative;box-shadow:0 6px 24px rgba(31,58,95,.12)}
.bulle:before{content:"";position:absolute;left:-12px;bottom:28px;border:10px solid transparent;border-right-color:var(--teal);border-left:0}
.regles{padding-left:18px;margin:8px 0;color:var(--ink-2);font-size:14px}

.score-geant{font-family:var(--retro);font-size:40px;color:var(--teal);margin:6px 0;font-weight:700}
.game-over{font-family:var(--retro);font-size:44px;font-weight:700;color:var(--navy);text-align:center;margin:0;letter-spacing:.08em;animation:clignote 1s steps(2) 3}
.game-over.victoire{color:var(--teal)}
.fin-cause{text-align:center;color:var(--ink-2);margin:4px 0 12px}
.fin-grille{display:grid;grid-template-columns:1.2fr 1fr;gap:18px}
.fin-resume{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.fin-resume div{background:var(--bg);border-radius:8px;padding:8px;text-align:center}
.fin-resume small{display:block;font-size:11px;color:var(--muted);text-transform:uppercase}
.fin-resume b{font-family:var(--retro);font-size:18px;color:var(--navy)}
.bilan{list-style:none;padding:0;margin:0}
.bilan li{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding:4px 0;font-size:14px}
.etiquette{font-size:12px;font-weight:700;border-radius:20px;padding:1px 8px}
.etiquette.ok{background:var(--green-soft);color:var(--green)}
.etiquette.moyen{background:var(--blue-soft);color:var(--blue-deep)}
.etiquette.faible{background:var(--amber-soft);color:var(--amber)}
.reco{display:flex;gap:10px;align-items:center;background:var(--teal-soft);border-radius:var(--r);padding:10px;margin-top:12px}
.reco img{width:80px;height:auto;flex:none}
.reco p{margin:0 0 6px}
.reco .actions{margin-top:4px;flex-direction:row;flex-wrap:wrap}
.classement{padding:0;margin:0;list-style:none;counter-reset:rang}
.classement li{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:8px;counter-increment:rang;font-size:14px}
.classement li:before{content:counter(rang);font-family:var(--retro);font-weight:700;color:var(--muted);width:1.6em;text-align:right}
.classement li.moi{background:var(--blue-soft);outline:2px solid var(--blue)}
.classement canvas{width:28px;height:28px;flex:none}
.classement .cl-pseudo{flex:1;font-weight:600;color:var(--navy)}
.classement .cl-grade{color:var(--muted);font-size:12px}
.classement .cl-score{font-family:var(--retro);font-weight:700;color:var(--teal)}
.classement .vide{color:var(--muted)}

.pied{text-align:center;color:var(--muted);font-size:12px;margin-top:12px}
.pied a{color:var(--blue)}
.badge-local{background:var(--amber-soft);color:var(--amber);border-radius:20px;padding:1px 8px;font-weight:600;margin-left:6px}
.btn-reset{margin-left:6px;border:1px solid var(--amber);background:#fff;color:var(--amber);border-radius:20px;padding:0 8px;font-size:11px;font-weight:600;cursor:pointer}
.btn-reset.confirmer{background:var(--amber);color:#fff}
.retro-clignote{animation:clignote .7s steps(2) infinite}

@keyframes clignote{50%{opacity:.25}}
@keyframes secoue{25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
@keyframes ouvrir{from{transform:translateX(-50%) scale(.6);opacity:0}}

/* Mobile : l'écran de question passe sous la zone de jeu */
@media (max-width:760px){
  .ordi{position:relative;left:auto;top:auto;transform:none;width:100%;margin-top:8px;animation:none}
  .q-choix{grid-template-columns:1fr}
  .q-enonce{font-size:16px}
  .creation-grille{grid-template-columns:1fr}
  .apercu-colonne{order:-1}
  #apercu-heros{max-width:150px}
  .fin-grille{grid-template-columns:1fr}
  .ecran{position:fixed;z-index:20}
  .titre-retro{font-size:32px}.titre-retro span{font-size:42px}
  .place-guide{width:90px;height:90px}
  #guide-curseur{width:96px;height:96px}
  .game-over{font-size:32px}
  .hud-bloc{min-width:0;padding:1px 5px}.hud-bloc b{font-size:12px}.hud-bloc small{font-size:8px}
  .hud-joueur span{display:none}
}

/* ===================== Habillage rétro pixel (v3) ===================== */
@font-face{font-family:"Press Start 2P";src:url("../assets/fonts/PressStart2P.woff2") format("woff2");font-display:swap}
:root{--pixel:"Press Start 2P","Courier New",monospace;--ombre-pixel:4px 4px 0 #16202c}
#canvas{image-rendering:pixelated;image-rendering:crisp-edges}
#cadre-jeu{background:#4a82ee;border:4px solid #16202c;border-radius:0;box-shadow:var(--ombre-pixel)}
.marque span{font-family:var(--pixel);font-size:12px}
.btn-icone{font-family:var(--pixel);font-size:10px;border:3px solid #16202c;border-radius:0;box-shadow:3px 3px 0 #16202c}
a.btn-icone{font-size:10px}
.badge-beta{border-radius:0;box-shadow:3px 3px 0 #16202c}
/* écrans */
.ecran{background:rgba(74,130,238,.55)}
.ecran-transparent{background:rgba(74,130,238,.25)}
.carte{border:4px solid #16202c;border-radius:0;box-shadow:6px 6px 0 #16202c}
.sur-titre{font-family:var(--pixel);font-size:10px;letter-spacing:.05em}
.titre-retro{font-family:var(--pixel);font-size:30px;line-height:1.25;color:#fff;letter-spacing:0;
  text-shadow:3px 0 0 #16202c,-3px 0 0 #16202c,0 3px 0 #16202c,0 -3px 0 #16202c,5px 5px 0 #16202c}
.titre-retro span{font-size:46px;background:linear-gradient(180deg,#ffd25e 0%,#f0b340 45%,#c9820a 55%,#8a5a08 100%);-webkit-background-clip:text;background-clip:text;color:transparent;
  text-shadow:none;filter:drop-shadow(3px 0 0 #16202c) drop-shadow(-3px 0 0 #16202c) drop-shadow(0 3px 0 #16202c) drop-shadow(0 -3px 0 #16202c) drop-shadow(4px 4px 0 #16202c)}
.titre-ecran{font-family:var(--pixel);font-size:16px;line-height:1.5}
.sous-titre{font-family:var(--pixel);font-size:10px}
.btn{font-family:var(--pixel);font-size:12px;line-height:1.5;border:3px solid #16202c;border-radius:0;box-shadow:4px 4px 0 #16202c;transition:transform .05s}
.btn:active{transform:translate(3px,3px);box-shadow:1px 1px 0 #16202c}
.btn small{font-family:inherit;font-size:9px}
.btn-lien{border:0;box-shadow:none;font-size:10px}
.btn-principal{background:#2f6fed}.btn-principal:hover{background:#2560d8}
.btn-teal{background:#0f9d8f;color:#fff}
.btn-petit{font-size:10px;padding:8px 10px}
.liste-avatars button{border:3px solid #16202c;border-radius:0}
.liste-avatars button[aria-checked="true"]{background:#ffd25e;border-color:#16202c;box-shadow:3px 3px 0 #16202c}
.liste-avatars canvas{image-rendering:pixelated}
#apercu-heros{border:3px solid #16202c;border-radius:0;background:linear-gradient(#4a82ee,#a8c7ff 70%,#54e6a0 70%,#54e6a0 74%,#c9820a 74%);image-rendering:pixelated}
.champ input{border:3px solid #16202c;border-radius:0}
.bulle{border:4px solid #16202c;border-radius:0;box-shadow:6px 6px 0 #16202c}
.bulle:before{border-right-color:#16202c}
/* dialogue de question : boîte de texte rétro */
.ordi{background:#fff;border:4px solid #16202c;border-radius:0;box-shadow:6px 6px 0 #16202c,inset 0 0 0 3px #2f6fed;padding:0 16px 14px;animation:none}
.ordi-barre{border-bottom:3px dotted #c9d3df}
.pastille{border-radius:0;background:#2f6fed}.pastille+.pastille{background:#0f9d8f}.pastille+.pastille+.pastille{background:#f0b340}
.ordi-titre{font-family:var(--pixel);font-size:9px;color:#2f6fed;letter-spacing:0}
.q-enonce{color:#16202c;font-size:18px}
.q-choix button{border:3px solid #16202c;border-radius:0;box-shadow:3px 3px 0 #16202c;background:#f2f6fb}
.q-choix button:hover,.q-choix button:focus-visible{background:#ffd25e;border-color:#16202c}
.q-choix button .lettre{font-family:var(--pixel);font-size:12px;color:#2f6fed;padding-top:2px}
.q-choix button.juste{background:#1f8a4c}.q-choix button.faux{background:#c9820a}
.chrono-libelle{font-family:var(--pixel);font-size:9px;color:#31506e}
.chrono-libelle b{color:#0f9d8f;font-weight:400}
.chrono-piste{height:16px;border:3px solid #16202c;border-radius:0;background:#e6edf5}
.chrono-barre{background:repeating-linear-gradient(90deg,#54e6a0 0 12px,#0f9d8f 12px 14px);transition:none}   /* mise à jour à chaque image : une transition relancée 60 fois par seconde figeait la barre */
.ordi.urgent .chrono-barre{background:repeating-linear-gradient(90deg,#f0b340 0 12px,#c9820a 12px 14px)}
.ordi.urgent .chrono-libelle b{color:#c9820a}
/* fin de partie */
.game-over{font-family:var(--pixel);font-size:38px;letter-spacing:0;color:#fff;text-shadow:3px 0 0 #16202c,-3px 0 0 #16202c,0 3px 0 #16202c,0 -3px 0 #16202c,5px 5px 0 #16202c}
.game-over.victoire{background:linear-gradient(180deg,#ffd25e 0%,#f0b340 45%,#c9820a 55%,#8a5a08 100%);-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none;
  filter:drop-shadow(3px 0 0 #16202c) drop-shadow(-3px 0 0 #16202c) drop-shadow(0 3px 0 #16202c) drop-shadow(0 -3px 0 #16202c) drop-shadow(4px 4px 0 #16202c)}
.fin-resume div{border:3px solid #16202c;border-radius:0;background:#e8f0fe}
.fin-resume small{font-family:var(--pixel);font-size:8px}
.fin-resume b{font-family:var(--pixel);font-size:13px}
.score-geant{font-family:var(--pixel);font-size:28px;color:#f0b340;text-shadow:3px 3px 0 #16202c}
.etiquette{border-radius:0;font-family:var(--pixel);font-size:8px;padding:3px 6px}
.reco{border:3px solid #16202c;border-radius:0}
.classement li{border-radius:0}
.classement li:before,.classement .cl-score{font-family:var(--pixel);font-size:11px}
.classement li.moi{outline:3px solid #16202c;background:#ffd25e}
.classement canvas{image-rendering:pixelated}
.badge-local{border-radius:0}
.btn-reset{border-radius:0;font-family:var(--pixel);font-size:8px;padding:3px 6px}
@media (max-width:760px){.titre-retro{font-size:20px}.titre-retro span{font-size:32px}.game-over{font-size:24px}.btn{font-size:10px}}

.chrono{display:flex;align-items:center;gap:10px}
.chrono-corps{flex:1}
#q-horloge{width:54px;height:54px;image-rendering:pixelated;flex:none}

@media (min-width:761px){.ordi{top:3%}}

/* écran des règles */
.regles-carte{max-width:960px}
.regles-grille{display:grid;grid-template-columns:1fr 1fr;gap:18px;text-align:left}
.touches,.pieges,.perdre,.deroule{list-style:none;padding:0;margin:0;font-size:14px;color:#31506e}
.touches li{display:flex;align-items:center;gap:10px;margin:6px 0}
.touches-k{min-width:210px}
.touches kbd,.regles-carte kbd{font-family:var(--pixel);font-size:9px;background:#fff;border:3px solid #16202c;border-bottom-width:5px;border-radius:0;padding:3px 6px;display:inline-block;margin:1px}
.deroule li,.pieges li{display:flex;align-items:center;gap:10px;margin:6px 0}
.perdre li{margin:4px 0;padding-left:14px;position:relative}
.perdre li:before{content:"";position:absolute;left:0;top:7px;width:6px;height:6px;background:#c9820a}
.vignette{width:108px;height:90px;flex:none;image-rendering:pixelated;border:3px solid #16202c;background:#a8c7ff}
@media (max-width:760px){.regles-grille{grid-template-columns:1fr}.touches-k{min-width:0}.vignette{width:72px;height:60px}}



/* règles : tiennent dans la fenêtre de jeu, en 3 onglets */
.ecran-regles{align-items:center;padding:10px}
.ecran-regles .carte{max-height:100%;overflow:auto;padding:12px 16px}
.regles-tete{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.regles-tete .titre-ecran{margin:0}
.onglets{display:flex;gap:4px}
.onglet{font-family:var(--pixel);font-size:9px;border:3px solid #16202c;background:#e8f0fe;padding:6px 8px;cursor:pointer}
.onglet.actif{background:#ffd25e;box-shadow:3px 3px 0 #16202c}
.regles-page{margin-top:8px}
.regles-page .intro-ecran{margin:4px 0 8px;font-size:14px}
.regles-page .vignette{width:72px;height:60px}
.pieges-grille{display:grid;grid-template-columns:1fr 1fr;gap:4px 14px}
.pieges-grille li{margin:2px 0;font-size:13px}
.deroule li,.touches li{margin:4px 0;font-size:14px}
.perdre li{font-size:15px;margin:8px 0}
.regles-nav{display:flex;gap:6px;align-items:center}
.ecran-regles .actions{margin-top:8px}
@media (max-width:760px){.ecran-regles{position:fixed;inset:0;z-index:30;background:rgba(74,130,238,.85)}.pieges-grille{grid-template-columns:1fr}}

.zone-code{border:3px solid #16202c;background:#fff3d6;padding:8px 10px;margin:4px 0 8px;box-shadow:3px 3px 0 #16202c}
.zone-code p{margin:0 0 6px;font-size:13px;color:#16202c}
.code-ligne{display:flex;gap:6px;align-items:flex-end}.code-ligne .champ{flex:1;margin:0}
.code-ligne input{letter-spacing:.3em;font-family:var(--pixel);font-size:14px}
#code-test{background:#e8f0fe;padding:4px 6px;margin-top:6px}

/* J8 : retour d'un joueur, actions toujours visibles, animations réduites */
.seul-retour{display:none}
.mode-retour .seul-retour{display:block}
.mode-retour .hors-retour{display:none!important}
.mode-retour .creation-grille{grid-template-columns:minmax(0,420px);justify-content:center}
.actions-collantes{position:sticky;bottom:-20px;background:var(--card);padding:10px 0 6px;margin-bottom:-6px;border-top:3px solid #16202c;z-index:2}
.reco{margin:0 0 12px}
.reco .a-renforcer{font-size:14px;margin:4px 0 0}
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

.reco a.lien-formation{color:var(--teal);font-weight:700;text-decoration:underline}

.btn-langue{font-family:var(--retro);font-size:12px;min-width:44px;margin-right:6px}

/* ===================== Téléphone : orientation (28/09) ===================== */
.conseil-rotation{display:none;margin:8px 0 0;text-align:center;font-family:var(--pixel);font-size:9px;line-height:1.6;color:#16202c;background:#f0b340;border:3px solid #16202c;padding:6px 8px}
/* Portrait : invitation à tourner le téléphone pendant la partie */
@media (orientation:portrait) and (max-width:600px) and (pointer:coarse){
  #scene:has(#hud:not([hidden])) .conseil-rotation{display:block}
}
/* Paysage sur téléphone (écran bas) : le jeu occupe tout l'écran, boutons discrets, panneaux ajustés à la hauteur */
@media (orientation:landscape) and (max-height:520px){
  body{background:#16202c}
  #app{max-width:none;padding:0}
  .barre{position:fixed;right:6px;bottom:6px;z-index:25;padding:0;pointer-events:none}
  #btn-son span{display:none}
  .barre .marque{display:none}
  .barre-actions{pointer-events:auto;gap:4px}
  .barre-actions .btn-icone{padding:3px 7px;font-size:10px;opacity:.9}
  .barre-actions .badge-beta,#lien-avis{display:none}
  .pied{display:none}
  #cadre-jeu{width:min(100vw,calc(100vh * 16 / 9));width:min(100vw,calc(100svh * 16 / 9));margin:0 auto;border-width:0;box-shadow:none}
  .ordi{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(780px,94vw);max-height:calc(100vh - 16px);max-height:calc(100svh - 16px);overflow:auto;margin:0;z-index:22;animation:none}
  .q-choix{grid-template-columns:1fr 1fr;gap:6px}
  .q-choix button{padding:6px 10px;min-height:0}
  .q-enonce{font-size:15px;margin:6px 0}
  .chrono{margin-top:6px}
  .ecran{position:fixed;z-index:20;align-items:flex-start;padding:8px}
  .ecran .carte{margin:auto}
}

/* Téléphone en portrait : en-tête compact sur une ligne (le bouton Son restait hors écran) */
@media (max-width:600px) and (orientation:portrait){
  .barre{gap:6px;padding:8px 0}
  .marque{gap:5px;min-width:0}
  .marque img{width:22px;height:22px}
  .marque span{font-size:12px;line-height:1.15}
  .barre-actions{gap:4px;flex-wrap:nowrap}
  .barre-actions .btn-icone,.barre-actions .badge-beta{font-size:9px;padding:4px 6px;white-space:nowrap}
  .barre-actions .badge-beta{letter-spacing:.05em}
  #btn-son span{display:none}
}

/* ===================== Téléphone v3 (28/09) : question toujours visible, sans défilement ===================== */
/* Portrait : la question s'ouvre en panneau fixé en bas de l'écran, le jeu reste visible au-dessus */
@media (max-width:600px) and (orientation:portrait){
  #scene:has(#ecran-question:not([hidden])) .conseil-rotation{display:none}
  #ecran-question{position:fixed;left:6px;right:6px;top:auto;bottom:calc(6px + env(safe-area-inset-bottom));width:auto;margin:0;transform:none;
    max-height:calc(100dvh - 16px);overflow:auto;-webkit-overflow-scrolling:touch;z-index:40;padding:0 10px 10px;animation:none;box-shadow:0 -6px 24px rgba(0,0,0,.35)}
  #ecran-question .ordi-barre{padding:6px 0}
  #ecran-question .ordi-titre{font-size:9px}
  #ecran-question .q-enonce{font-size:15px;line-height:1.3;margin:4px 0 8px;min-height:0}
  #ecran-question .q-choix{grid-template-columns:1fr;gap:6px}
  #ecran-question .q-choix button{font-size:14px;padding:9px 10px;min-height:44px;align-items:center}
  #ecran-question .chrono{margin-top:8px}
  #ecran-question #q-horloge{width:34px;height:34px}
  .pied{margin-bottom:8px}
  body:has(#ecran-question:not([hidden])) .pied{display:none}
}
/* Paysage : panneau ancré en bas, réponses en 2 colonnes, chrono compact, marges d'encoche */
@media (orientation:landscape) and (max-height:520px){
  #ecran-question{top:auto;bottom:calc(4px + env(safe-area-inset-bottom));left:calc(8px + env(safe-area-inset-left));right:calc(8px + env(safe-area-inset-right));
    width:auto;transform:none;max-height:calc(100svh - 8px);padding:0 10px 8px;z-index:40}
  #ecran-question .ordi-barre{padding:4px 0}
  #ecran-question .ordi-titre{font-size:9px}
  #ecran-question .q-enonce{font-size:14px;line-height:1.25;margin:2px 0 6px;min-height:0}
  #ecran-question .q-choix button{font-size:13px;padding:6px 8px;min-height:40px;align-items:center}
  #ecran-question .chrono{margin-top:6px}
  #ecran-question #q-horloge{display:none}
  #ecran-question .chrono-piste{height:10px;border-width:2px}
}

/* ===================== Téléphone paysage v4 (28/09) : question À CÔTÉ du jeu, écrans compacts ===================== */
@media (orientation:landscape) and (max-height:520px){
  /* le jeu et la question se partagent l'écran : le jeu rétrécit à gauche, la question s'ouvre à droite */
  #scene{display:flex;align-items:center;justify-content:center;gap:8px;height:100vh;height:100svh;box-sizing:border-box;
    padding:4px calc(6px + env(safe-area-inset-right)) 4px calc(6px + env(safe-area-inset-left))}
  #cadre-jeu{flex:none;margin:0;width:min(100%, calc((100vh - 8px) * 16 / 9));width:min(100%, calc((100svh - 8px) * 16 / 9));transition:width .25s ease-out}
  #scene:has(#ecran-question:not([hidden])) #cadre-jeu{width:min(48%, calc((100svh - 8px) * 16 / 9))}
  .conseil-rotation{display:none!important}
  #ecran-question{position:relative;inset:auto;top:auto;bottom:auto;left:auto;right:auto;transform:none;flex:1 1 0;min-width:0;width:auto;
    max-height:calc(100vh - 8px);max-height:calc(100svh - 8px);overflow:auto;margin:0;padding:0 10px 8px;box-shadow:none;animation:none}
  #ecran-question .q-choix{grid-template-columns:1fr;gap:5px}
  #ecran-question .q-choix button{min-height:38px;padding:5px 8px;font-size:13px}
  #ecran-question .q-enonce{font-size:14px}
  /* boutons langue / son : en haut à droite, hors du chemin des boutons d'action */
  .barre{top:calc(4px + env(safe-area-inset-top));bottom:auto;right:calc(4px + env(safe-area-inset-right))}
  /* écrans (accueil, règles, intro de monde…) : tiennent dans la hauteur, actions toujours visibles */
  .ecran{padding:6px 58px 6px calc(6px + env(safe-area-inset-left));align-items:center}
  .ecran .carte{max-height:calc(100svh - 12px);overflow:auto;padding:10px 14px;width:min(760px,100%)}
  .ecran .carte p{margin:4px 0}
  .carte-titre .titre-retro{font-size:18px;line-height:1.35;margin:2px 0;padding:4px 0}.carte-titre .titre-retro span{font-size:28px}
  .regles-grille,.pieges-grille{grid-template-columns:1fr 1fr!important}
  #ecran-question .chrono-libelle{font-size:8px}
  .carte-titre .accroche{font-size:12.5px;line-height:1.35}
  .carte-titre .actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:6px}
  .btn{font-size:9.5px;padding:7px 10px;box-shadow:3px 3px 0 #16202c}
  .titre-ecran{font-size:12px;margin:2px 0 4px}
  .sur-titre{font-size:8px;margin:0}
  .regles-page .intro-ecran,.deroule li,.touches li{font-size:12.5px}
  .regles-page .vignette{width:54px;height:45px}
  .ecran .actions-ligne{position:sticky;bottom:-10px;background:var(--card);margin:6px -14px -10px;padding:6px 14px 8px;border-top:3px solid #16202c;z-index:2}
  /* intro de monde : guide réduit, bulle scrollable avec bouton « C'est parti » toujours visible */
  .bulle-guide{max-width:none;width:100%;align-items:center}
  .place-guide{width:64px;height:64px}
  #guide-curseur{width:70px;height:70px}
  .bulle{max-height:calc(100svh - 12px);overflow:auto;padding:8px 12px;flex:1;min-width:0}
  .bulle p,.bulle li{font-size:12.5px;line-height:1.35}
  .bulle .regles{margin:4px 0;padding-left:18px}
  .bulle .actions-ligne{margin:6px -12px -8px;padding:6px 12px 8px}
}

/* Téléphone : bouton son lisible (ON vert / OFF orange) */
@media (max-width:600px) and (orientation:portrait), (orientation:landscape) and (max-height:520px){
  #btn-son{font-size:14px!important;padding:4px 8px!important;min-width:58px;opacity:1!important;display:inline-flex;align-items:center;justify-content:center}
  #btn-son[aria-pressed="true"]{background:#54e6a0;color:#16202c}
  #btn-son[aria-pressed="false"]{background:#f0b340;color:#16202c}
  #btn-son::after{font-family:var(--pixel);font-size:9px;margin-left:5px}
  #btn-son[aria-pressed="true"]::after{content:"ON"}
  #btn-son[aria-pressed="false"]::after{content:"OFF"}
  #btn-langue{opacity:1!important}
}

/* ===================== Téléphone paysage v5 (28/09) : question entière sans défilement, chrono en haut ===================== */
@media (orientation:landscape) and (max-height:520px){
  #scene:has(#ecran-question:not([hidden])) #cadre-jeu{width:min(40%, calc((100svh - 8px) * 16 / 9))}
  #ecran-question{display:flex;flex-direction:column;padding:0 8px 6px}
  #ecran-question[hidden]{display:none}
  #ecran-question .ordi-barre{order:0;padding:3px 0 2px}
  #ecran-question .chrono{order:1;margin:0 0 4px;display:flex;align-items:center;gap:6px}
  #ecran-question #q-horloge{display:block;width:26px;height:26px;flex:none}
  #ecran-question .chrono-corps{flex:1;min-width:0}
  #ecran-question .chrono-libelle{font-size:8px}
  #ecran-question .chrono-piste{height:9px;border-width:2px;margin-top:2px}
  #ecran-question .q-enonce{order:2;font-size:13px;line-height:1.25;margin:0 0 5px}
  #ecran-question .q-choix{order:3;grid-template-columns:1fr 1fr;gap:5px}
  #ecran-question .q-choix button{min-height:34px;padding:4px 6px;font-size:12px;line-height:1.2;box-shadow:2px 2px 0 #16202c;border-width:2px}
  #ecran-question .q-choix button .lettre{font-size:10px;min-width:1em}
}
/* téléphone : tap n'importe où = saut, sans zoom ni sélection */
@media (orientation:landscape) and (max-height:520px), (orientation:portrait) and (max-width:600px){ html,body,#scene{touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none} }

/* ===================== Téléphone v6 (28/09) ===================== */
/* iOS agrandit le texte en paysage : on bloque l'ajustement automatique */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
/* paysage : la question ne se tasse jamais, le panneau défile en dernier recours */
@media (orientation:landscape) and (max-height:520px){
  #ecran-question > *{flex:none}
  #ecran-question .q-choix{align-items:start}
  #ecran-question .q-choix button{height:auto}
}
/* portrait : en-tête sur une ligne, nom du jeu lisible, « Donner mon avis » raccourci */
@media (max-width:600px) and (orientation:portrait){
  .barre .badge-beta{display:none}
  .marque span{font-size:11px;white-space:nowrap}
  #lien-avis{font-size:0!important;padding:4px 6px!important}
  #lien-avis::after{content:"Avis";font-size:9px}
  html[lang="en"] #lien-avis::after{content:"Feedback"}
  .barre-actions{flex:none}
  .marque{flex:1 1 auto;overflow:hidden}
  .marque img{display:none}
}
/* paysage v7 : panneau à la hauteur de son contenu (Safari l'étirait), réponses de même hauteur, pas de trous blancs */
@media (orientation:landscape) and (max-height:520px){
  #ecran-question{align-self:center;height:auto!important;min-height:0;justify-content:flex-start}
  #ecran-question .q-choix{align-content:start;align-items:stretch;grid-auto-rows:auto;height:auto!important}
  #ecran-question .q-choix button{height:100%;min-height:40px;align-items:center}
  body:has(#ecran-question:not([hidden])) .barre{display:none}
}
/* paysage v8 : Safari étire la grille des réponses → réponses en flex (lignes à la hauteur du contenu) */
@media (orientation:landscape) and (max-height:520px){
  #ecran-question .q-choix{display:flex!important;flex-wrap:wrap;align-items:stretch;align-content:flex-start;gap:5px}
  #ecran-question .q-choix button{flex:1 1 calc(50% - 3px);max-width:calc(50% - 3px);height:auto!important;min-height:40px}
}
/* très petits écrans en paysage (iPhone SE + barre Safari) */
@media (orientation:landscape) and (max-height:280px){
  #ecran-question .q-enonce{font-size:12.5px;margin-bottom:4px}
  #ecran-question .q-choix button{min-height:34px;font-size:11.5px;padding:3px 6px}
  #ecran-question .ordi-titre{font-size:8px}
}

/* ===================== Classement en générique (28/09) ===================== */
.classement li:before{content:attr(data-rang)}
.generique{position:relative;max-height:min(52vh,340px);overflow:hidden}
.generique.manuel{overflow:auto}
.generique.actif{cursor:pointer;-webkit-mask-image:linear-gradient(180deg,transparent 0,#000 18px,#000 calc(100% - 18px),transparent 100%);mask-image:linear-gradient(180deg,transparent 0,#000 18px,#000 calc(100% - 18px),transparent 100%)}
.generique.actif .classement{animation:generique 30s linear infinite}
.generique.actif.pause .classement{animation-play-state:paused}
@keyframes generique{from{transform:translateY(0)}to{transform:translateY(-50%)}}
@media (orientation:landscape) and (max-height:520px){.generique{max-height:calc(100svh - 150px)}}

/* J27 : confirmation de l'e-mail */
#ecran-confirmer .carte{max-width:460px}
#ecran-confirmer .code-ligne{margin:10px 0}
#ecran-confirmer .champ-code{font-family:var(--pixel);font-size:18px;letter-spacing:.35em;width:100%;padding:10px;border:3px solid #16202c;text-align:center}

/* v3 : carte des mondes (le décor de la carte est dessiné dans le canvas, derrière ce panneau) */
.ecran-mondes{align-items:flex-end;background:transparent}
.ecran-mondes .plan-panneau{max-width:900px;margin:0 auto 4px;padding:8px 12px}
.ecran-mondes .sur-titre{display:none}
.ecran-mondes .titre-ecran{display:inline;margin:0;font-size:13px}
.ecran-mondes .plan-panneau p{margin:4px 0}
.ecran-mondes #plan-texte{display:inline;margin:0 0 0 8px;font-size:12px}
.ecran-mondes .plan-choix{display:flex;flex-direction:row;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:6px}
.ecran-mondes .plan-choix .btn{flex:1 1 180px;width:auto;font-size:11px;padding:6px 10px;margin:0}
@media (max-height:520px){.ecran-mondes .plan-panneau{padding:5px 8px}.ecran-mondes .titre-ecran{font-size:12px;margin:0}#plan-texte{display:none}.ecran-mondes .plan-choix{margin-top:4px;gap:6px}.ecran-mondes .plan-choix .btn{padding:5px 6px;font-size:10px}}
@media (orientation:portrait) and (max-width:600px){.ecran-mondes{align-items:flex-start;padding-top:calc(56.25vw + 64px)}}

.maj-version{margin:6px 0 0;font-size:12px;font-weight:700;color:var(--teal,#0f9d8f)}
.choix-theme{margin:10px 0 4px;padding:8px 10px;border:2px dashed #c9d3df;border-radius:8px}
.choix-theme-titre{margin:0 0 6px;font-size:13px}
.choix-theme-liste{display:flex;flex-wrap:wrap;gap:6px}
.choix-theme-liste button{font:600 12px/1.2 inherit;padding:6px 10px;border:2px solid #16202c;border-radius:6px;background:#fff;color:#16202c;cursor:pointer}
.choix-theme-liste button[aria-pressed="true"]{background:#54e6a0;box-shadow:0 2px 0 #16202c}
.choix-theme-liste button small{display:block;font-weight:400;font-size:10px;opacity:.7}
@media (max-height:520px){.choix-theme{margin:4px 0;padding:4px 6px}.choix-theme-titre{font-size:11px;margin-bottom:3px}.choix-theme-liste button{padding:3px 6px;font-size:11px}}
.q-taux{margin:8px 0 0;font-size:13px;font-weight:700;color:#0f9d8f;text-align:center}
.comparaison{margin:4px 0 8px;font-size:14px}.comparaison b{font-size:16px}
.bilan li .scores{margin-left:auto;margin-right:8px;font-size:12px;color:#5f6e80;white-space:nowrap}.bilan li .scores b{color:#16202c}
.bilan li .scores .mieux{color:#1f8a4c}.bilan li .scores .moins{color:#c9820a}

.carte-stats{max-width:720px}
.stats-sous{margin:0 0 10px;color:var(--muted);font-size:13px}
.stats-tuiles{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:6px}
.stats-tuiles div{flex:1 1 140px;background:var(--bg);border:2px solid #16202c;padding:8px 10px}
.stats-tuiles b{display:block;font-size:22px;color:var(--navy)}.stats-tuiles span{font-size:12px;color:var(--muted)}
.stats-barres{list-style:none;padding:0;margin:4px 0 10px}
.stats-barres li{display:grid;grid-template-columns:minmax(120px,38%) 1fr 92px;gap:8px;align-items:center;padding:3px 0;font-size:13px}
.stats-barres .piste{position:relative;height:18px;background:var(--line)}
.stats-barres .barre{position:absolute;left:0;top:0;bottom:0;background:var(--blue);color:#fff;font-weight:700;font-size:11px;display:flex;align-items:center;justify-content:flex-end;padding-right:5px;box-sizing:border-box}
.stats-barres.theme .barre{background:var(--teal)}
.stats-barres .moy{position:absolute;top:-3px;bottom:-3px;border-left:2px dashed var(--amber)}
.stats-barres .toi{position:absolute;top:50%;width:12px;height:12px;margin:-6px 0 0 -6px;background:#f0b340;border:2px solid #16202c;border-radius:50%}
.stats-barres .nb{font-size:11px;color:var(--muted);text-align:right}
.stats-aide{font-size:12px;color:var(--muted);margin:0}
.stats-aide i{display:inline-block;width:10px;height:10px;background:#f0b340;border:2px solid #16202c;border-radius:50%;vertical-align:-2px}
.stats-aide u{display:inline-block;width:0;height:12px;border-left:2px dashed var(--amber);vertical-align:-2px;text-decoration:none}
.stats-note{font-size:11px;color:var(--muted)}
@media (max-width:600px){.stats-barres li{grid-template-columns:1fr 70px}.stats-barres li .piste{grid-column:1/3;grid-row:2}}
.stats-tuiles b.txt{font-size:15px;line-height:1.25}
