/* =========================================================
   NOËL-OS — Styles
   ========================================================= */
:root {
  --nuit: #071427;
  --carte: #0f2340;
  --bord: rgba(255, 255, 255, 0.12);
  --texte: #eef3fa;
  --texte-doux: #a9b8cc;
  --or: #f5c542;
  --or-fonce: #b8860b;
  --rouge: #d62839;
  --vert: #20bf6b;
  --bleu: #4aa3ff;
  --rayon: 14px;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --conte: Georgia, "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--texte);
  background: #030a18; /* (le dégradé de la nuit est sur .ciel : un fond « fixed » coûtait cher à Firefox) */
  overflow-x: hidden;
}
body.modale-ouverte { overflow: hidden; }
/* Une fenêtre ouverte recouvre le décor : on fige ses animations, sinon le navigateur
   recalcule le flou de la fenêtre à chaque image (et la lettre saccade). */
body.modale-ouverte :is(.ciel, .paysage-fond, .ecran-titre, .jeu) * { animation-play-state: paused !important; }
code, pre, .mono { font-family: var(--mono); }
code { background: rgba(255, 255, 255, 0.09); padding: 0.05em 0.35em; border-radius: 5px; font-size: 0.92em; }
h1, h2, h3, h4 { line-height: 1.2; }
.petit { font-size: 0.88em; color: var(--texte-doux); }
.centre { text-align: center; }
.droite { text-align: right; }
.r { color: #ff6b6b; } .g { color: #51e08a; } .b { color: #64b5ff; }
[hidden] { display: none !important; }

/* ---------- Le ciel ---------- */
.ciel {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, #030a18 0%, #0a1d3a 45%, #17325a 75%, #22446f 100%);
}
/* Le ciel est sous tout le reste : dans Firefox, chaque fois que quelque chose bouge par-dessus,
   il faut le redessiner à cet endroit. Il doit donc rester bon marché : des étoiles en petits
   points (app.js, cielEtoile) plutôt que 32 dégradés plein écran, des aurores sans flou ni
   mélange de calques, qui glissent sans tourner. */
.etoiles { position: absolute; inset: 0 0 35% 0; }
.etoiles i {
  position: absolute; width: var(--t); height: var(--t); margin: calc(var(--t) / -2) 0 0 calc(var(--t) / -2);
  background: radial-gradient(closest-side, var(--c, #fff), transparent);
}
/* chaque étoile scintille à son rythme (petites zones : ça ne coûte presque rien) */
.etoiles i.scintille { opacity: 0.6; animation: scintille-ciel 4s ease-in-out infinite alternate; }
@keyframes scintille-ciel { from { opacity: 0.25; } to { opacity: 1; } }
.aurore { position: absolute; left: -10%; right: -10%; top: -6vh; height: 46vh; opacity: 0.55; }
/* (le dégradé s'éteint doucement jusqu'au bord : il remplace l'ancien flou de 38 px) */
.aurore span { position: absolute; animation: aurore 18s ease-in-out infinite alternate; will-change: transform; }
.aurore span:nth-child(1) { left: 1%; top: 2%; width: 63%; height: 61%; background: radial-gradient(closest-side, rgba(61, 255, 168, 0.75), rgba(61, 255, 168, 0.38) 45%, rgba(61, 255, 168, 0)); }
.aurore span:nth-child(2) { left: 31%; top: -8%; width: 58%; height: 71%; background: radial-gradient(closest-side, rgba(122, 215, 255, 0.6), rgba(122, 215, 255, 0.3) 45%, rgba(122, 215, 255, 0)); animation-duration: 23s; animation-delay: -6s; }
.aurore span:nth-child(3) { left: 56%; top: 7%; width: 53%; height: 56%; background: radial-gradient(closest-side, rgba(185, 140, 255, 0.55), rgba(185, 140, 255, 0.28) 45%, rgba(185, 140, 255, 0)); animation-duration: 27s; animation-delay: -11s; }
@keyframes aurore { 0% { transform: translate(-6%, 3%); } 50% { transform: translate(4%, -4%); } 100% { transform: translate(8%, 2%); } }
body.noel-sauve .aurore { opacity: 0.85; }
.lune {
  position: absolute; top: 7vh; right: 8vw; width: 78px; height: 78px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fffdf0 0%, #fff4c8 55%, #e9d9a0 100%);
  box-shadow: 0 0 40px 12px rgba(255, 244, 200, 0.35), 0 0 120px 40px rgba(255, 244, 200, 0.12);
}
@media (max-width: 700px) { .lune { top: 1.2vh; right: 3vw; width: 40px; height: 40px; } .lune::after { display: none; } .traineau { font-size: 18px; } }
.lune::after { content: ""; position: absolute; width: 16px; height: 16px; left: 46px; top: 22px; border-radius: 50%; background: rgba(200, 180, 120, 0.35); box-shadow: -24px 22px 0 -3px rgba(200, 180, 120, 0.28); }
.traineau { position: absolute; top: 12vh; left: 0; font-size: 26px; white-space: nowrap; letter-spacing: -4px; filter: brightness(0) drop-shadow(0 0 1px rgba(255, 255, 255, 0.4)); opacity: 0; visibility: hidden; }
/* (caché entre deux passages : même invisible, son filtre était recalculé à chaque image dans Firefox) */
.traineau.vole { visibility: visible; animation: traineau 16s linear forwards; }
@keyframes traineau {
  0% { transform: translate(110vw, 0) rotate(-4deg); opacity: 0.9; }
  50% { transform: translate(40vw, -4vh) rotate(-2deg); opacity: 0.9; }
  100% { transform: translate(-30vw, 2vh) rotate(-5deg); opacity: 0.9; }
}
.paysage-fond { position: fixed; left: 0; right: 0; bottom: 0; height: 34vh; min-height: 200px; z-index: 0; pointer-events: none; }
.paysage-fond svg { width: 100%; height: 100%; display: block; }
/* Le calque des petites animations d'un grand dessin (app.js, calqueAnime), posé pile dessus */
.calque-anime { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#neige { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.entete, .scene, .pied { position: relative; z-index: 2; }

/* Animations des décors SVG */
.d-etoile { fill: #fff; animation: scintille 2.6s ease-in-out infinite alternate; }
.d-fenetre { animation: fenetre 5s ease-in-out infinite; filter: drop-shadow(0 0 5px #ffb84d); }
@keyframes fenetre { 0%, 100% { opacity: 1; } 47% { opacity: 1; } 50% { opacity: 0.55; } 53% { opacity: 1; } }
.d-fumee circle { fill: rgba(230, 236, 245, 0.35); animation: fumee 3.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes fumee { from { transform: translateY(0) scale(0.6); opacity: 0.8; } to { transform: translateY(-26px) scale(1.6); opacity: 0; } }
.d-aurore { animation: aurore-svg 12s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes aurore-svg { from { transform: translateX(-30px) scaleY(0.9); } to { transform: translateX(30px) scaleY(1.15); } }
.d-ampoule, .d-led, .d-balise { animation: scintille 1.4s ease-in-out infinite alternate; filter: drop-shadow(0 0 4px currentColor); }
.d-balise { animation-duration: 0.9s; }
.d-lampe { filter: drop-shadow(0 0 10px #ffe9a0); animation: lampe 4s ease-in-out infinite; }
@keyframes lampe { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } }
.d-onde { animation: onde 1.8s ease-out infinite; opacity: 0; }
@keyframes onde { 0% { opacity: 0; } 30% { opacity: 0.9; } 100% { opacity: 0; } }
.d-piste { stroke-dasharray: 12 8; animation: piste 2s linear infinite; }
@keyframes piste { to { stroke-dashoffset: -40; } }
.d-ecran { animation: fenetre 3s infinite; filter: drop-shadow(0 0 8px #3dff7a); }
.d-flocon-fenetre { animation: flocon-fenetre 3s linear infinite; }
@keyframes flocon-fenetre { from { transform: translateY(-20px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(30px); opacity: 0; } }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-size: 0.95em; cursor: pointer; color: var(--texte);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--bord); border-radius: 999px;
  padding: 0.55em 1.15em; margin: 0.25em;
  transition: transform 0.12s, background 0.2s, box-shadow 0.2s;
  /* (pas de backdrop-filter, ici ni ailleurs : dans Firefox, un seul flou d'arrière-plan oblige à
     redessiner toute la page à chaque image — l'écran titre tombait à 4 images/s) */
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-principal {
  background: linear-gradient(180deg, #e8394a, #a81828); border: 1px solid #f5c54288; font-weight: 600;
  box-shadow: 0 4px 14px rgba(214, 40, 57, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.btn-principal:hover:not(:disabled) { background: linear-gradient(180deg, #f2495a, #bb1f30); box-shadow: 0 6px 20px rgba(214, 40, 57, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-discret { background: rgba(10, 25, 50, 0.55); }
.btn-rond { padding: 0.55em 0.8em; }
.btn-etoile { background: linear-gradient(180deg, #ffd86b, #d69e0b); color: #2a1d00; border-color: #fff3c4; box-shadow: 0 4px 22px rgba(245, 197, 66, 0.55); text-shadow: none; }
.lien { font: inherit; background: none; border: 0; color: var(--texte-doux); text-decoration: underline; cursor: pointer; padding: 0; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.entete { text-align: center; padding: 1.6rem 1rem 0.4rem; }
.logo { font-family: var(--mono); letter-spacing: 0.15em; color: var(--texte-doux); font-size: 0.85rem; }
.version { opacity: 0.6; }
.titre-neige { margin: 0.35rem 0 0.1rem; font-family: var(--conte); font-size: clamp(2.3rem, 7vw, 4rem); letter-spacing: 0.01em; }
.titre-neige span {
  position: relative; display: inline-block; padding: 0.15em 0.1em 0;
  background: linear-gradient(180deg, #fff9e6 0%, #ffe08a 45%, #e0a422 70%, #fff1b8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a3d00) drop-shadow(0 0 18px rgba(255, 215, 120, 0.45));
}
.titre-neige span::before {
  content: ""; position: absolute; left: 0.05em; right: 0.05em; top: 0.16em; height: 0.2em;
  background:
    radial-gradient(ellipse 0.32em 0.16em at 50% 100%, #fff 98%, transparent 100%) 0 0 / 0.46em 100% repeat-x,
    radial-gradient(ellipse 0.22em 0.12em at 50% 100%, #f2f7ff 98%, transparent 100%) 0.23em 0.03em / 0.38em 100% repeat-x,
    linear-gradient(0deg, #fff 0 45%, transparent 45%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
  border-radius: 0.12em;
  opacity: 0.95;
}
.sous-titre { margin: 0 0 0.8rem; color: #d3deec; text-shadow: 0 1px 3px #000; }
.statut { display: inline-block; font-family: var(--mono); font-size: 0.82rem; padding: 0.25em 0.8em; border-radius: 999px; border: 1px solid var(--bord); background: rgba(0, 0, 0, 0.35); }
.statut.gele { color: #ff9a9a; } .statut.moyen { color: #ffc46b; } .statut.ok { color: #6ef0a0; }
.progression { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 0.8rem auto 0.4rem; max-width: 540px; font-size: 0.9rem; color: #d3deec; }
.barre { flex: 1; height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.25); }
.sucre-orge .remplissage {
  height: 100%; width: 0; border-radius: 999px; transition: width 0.9s ease;
  background: repeating-linear-gradient(-45deg, #e8394a 0 9px, #fff 9px 18px);
  background-size: 200% 100%; animation: sucre 3s linear infinite;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
@keyframes sucre { to { background-position: -51px 0; } }
.actions { margin-top: 0.3rem; }
.compte-rebours { margin: 0.6rem auto 0; display: inline-block; padding: 0.4em 1em; border-radius: 10px; background: rgba(8, 20, 40, 0.7); border: 1px solid rgba(245, 197, 66, 0.45); font-size: 0.92rem; }
body.hors-ligne .statut { color: #ff9a9a; }

/* ---------- Scène ---------- */
.scene {
  display: grid; grid-template-columns: minmax(280px, 430px) minmax(300px, 680px);
  justify-content: center; align-items: start; gap: 2rem; padding: 1rem 1.2rem 2rem;
}
@media (max-width: 900px) { .scene { grid-template-columns: 1fr; max-width: 600px; margin: 0 auto; } }
.bloc-sapin { position: sticky; top: 1rem; }
@media (max-width: 900px) { .bloc-sapin { position: static; } }
#sapin { width: 100%; height: auto; display: block; overflow: visible; }
.legende-sapin { text-align: center; font-size: 0.85rem; color: #d3deec; margin: 0.3rem 0 0; text-shadow: 0 1px 3px #000; }

/* Sapin */
.halo-sapin { animation: halo 5s ease-in-out infinite; }
@keyframes halo { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.sol-neige { fill: #eaf3ff; opacity: 0.95; }
.tronc { fill: #6b3f1d; }
.etage-sapin { fill: url(#degrade-sapin); stroke: #0b3a20; stroke-width: 1.5; stroke-linejoin: round; }
.neige-sapin { fill: none; stroke: #f4f9ff; stroke-width: 3.2; stroke-linecap: round; opacity: 0.85; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.fil-guirlande { fill: none; stroke: rgba(255, 230, 160, 0.35); stroke-width: 1.4; }
.lumiere { fill: var(--couleur); opacity: 0.25; transition: fill 0.5s, opacity 0.5s; }
.guirlande-sapin.allumee .lumiere { opacity: 1; filter: url(#lueur); animation: scintille 1.6s infinite alternate; }
@keyframes scintille { from { opacity: 1; } to { opacity: 0.35; } }
.paillette { font-size: 9px; fill: #fff; opacity: 0; animation: paillette 4s ease-in-out infinite; pointer-events: none; transform-box: fill-box; transform-origin: center; }
@keyframes paillette { 0%, 70%, 100% { opacity: 0; transform: scale(0.4); } 80% { opacity: 1; transform: scale(1.2); } }
.cadeau-sapin { opacity: 0; transform: translateY(8px); transition: opacity 0.8s, transform 0.8s; transform-box: fill-box; }
.cadeau-sapin.visible { opacity: 1; transform: none; }

.boule { cursor: pointer; transform-box: fill-box; transform-origin: center top; }
.boule .crochet { stroke: #c9b37a; stroke-width: 1.5; }
.boule .attache-boule { fill: #d9bf73; }
.boule .corps { fill: #2c3c52; stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; transition: fill 0.6s; }
.boule .halo { fill: none; stroke: transparent; stroke-width: 2.5; }
.boule .reflet { pointer-events: none; opacity: 0.35; }
.numero-boule { font-size: 11px; font-weight: 700; fill: #8fa2b8; pointer-events: none; font-family: "Segoe UI", system-ui, sans-serif; }
.boule.verrouillee, .boule.fermee { opacity: 0.55; }
.boule.disponible .corps { fill: #eef3fa; }
.boule.disponible .numero-boule { fill: #1d2b3c; }
.boule.disponible .halo { stroke: var(--or); animation: respire 1.8s ease-in-out infinite; }
.boule.disponible { animation: balance 3s ease-in-out infinite; }
@keyframes balance { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes respire { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.boule.resolue .corps { fill: var(--couleur); filter: url(#lueur); }
.boule.resolue .reflet { opacity: 1; }
.boule.resolue .numero-boule { fill: #fff; }
.boule:hover .corps, .boule:focus-visible .corps { stroke: #fff; stroke-width: 2; }
.boule:focus { outline: none; }
.boule.vient-de-s-allumer { animation: allumage 1.5s ease-out; }
@keyframes allumage { 0% { transform: scale(1); } 30% { transform: scale(1.7); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }

.etoile-sapin { cursor: pointer; }
.etoile-sapin .rayon { stroke: var(--or); stroke-width: 2; stroke-linecap: round; opacity: 0; }
.etoile-sapin .branches { fill: #4a5568; stroke: #8b96a6; stroke-width: 1.2; stroke-linejoin: round; transition: fill 0.8s; }
.etoile-sapin .numero-boule { fill: #cbd5e0; font-size: 10px; }
.etoile-sapin.disponible .branches { fill: #6f7c8e; stroke: var(--or); animation: respire 1.8s infinite; }
.etoile-sapin.resolue .branches { fill: var(--or); stroke: #fff3c4; filter: url(#lueur); }
.etoile-sapin.resolue .rayon { animation: rayons 3s ease-in-out infinite; }
@keyframes rayons { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.6; } }
.etoile-sapin.resolue .numero-boule { fill: #5a3d00; }
.etoile-sapin.resolue { animation: etoile-brille 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes etoile-brille { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(4deg); } }
.etoile-sapin:focus { outline: none; }
.etoile-sapin:focus-visible .branches { stroke: #fff; stroke-width: 2.5; }

/* ---------- Le calendrier : une planche de bois avec des portes ---------- */
.planche {
  position: relative; padding: 2.6rem 1.1rem 1.3rem; border-radius: 18px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #7a4a25, #4b2a13);
  border: 9px solid #3a2010;
  box-shadow: 0 0 0 2px #c9a35a inset, 0 0 0 3px #3a2010, 0 20px 50px rgba(0, 0, 0, 0.55);
}
.planche::before {
  content: ""; position: absolute; left: -12px; right: -12px; top: -16px; height: 26px;
  background:
    radial-gradient(circle at 12px 26px, #fff 13px, transparent 14px) 0 0 / 34px 26px repeat-x,
    radial-gradient(circle at 20px 26px, #f2f7ff 17px, transparent 18px) 9px 2px / 46px 26px repeat-x;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.3));
  border-radius: 12px 12px 0 0;
}
.guirlande-planche {
  position: absolute; left: 14px; right: 14px; top: 14px; height: 14px;
  background:
    radial-gradient(circle, #ff5a5f 4px, transparent 5px) 0 0 / 56px 14px repeat-x,
    radial-gradient(circle, #ffd23f 4px, transparent 5px) 14px 0 / 56px 14px repeat-x,
    radial-gradient(circle, #3ddc84 4px, transparent 5px) 28px 0 / 56px 14px repeat-x,
    radial-gradient(circle, #4aa3ff 4px, transparent 5px) 42px 0 / 56px 14px repeat-x;
  filter: drop-shadow(0 0 4px rgba(255, 230, 150, 0.8));
  animation: guirlande-planche 1.6s steps(2) infinite;
}
@keyframes guirlande-planche { 50% { filter: drop-shadow(0 0 7px rgba(255, 230, 150, 1)) brightness(1.3); opacity: 0.75; } }
.plaque {
  position: relative; margin: 0 auto 1rem; width: max-content; max-width: 100%;
  font-family: var(--conte); font-size: 1.45rem; color: #3a2508; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 0.25em 1.2em; border-radius: 10px;
  background: linear-gradient(180deg, #ffe7a3, #d9a93c 55%, #f5d27a);
  box-shadow: 0 3px 0 #8a6215, 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 #fff8dc;
}
.plaque::before, .plaque::after { content: "🎀"; position: absolute; top: 50%; transform: translateY(-50%); font-size: 1rem; }
.plaque::before { left: 0.3em; } .plaque::after { right: 0.3em; }
.grille-portes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.7rem; }
@media (max-width: 1100px) { .grille-portes { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 420px) { .grille-portes { grid-template-columns: repeat(3, 1fr); } }

.porte {
  --face: #a3182a; --face-2: #6d0f1b;
  position: relative; aspect-ratio: 3 / 3.6; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--texte); perspective: 600px;
  border-radius: 10px;
}
.teinte-vert { --face: #157a42; --face-2: #0b4726; }
.teinte-bleu { --face: #1f5aa0; --face-2: #11345e; }
.teinte-prune { --face: #7b2a73; --face-2: #4a1645; }
.porte-24 { --face: #c99410; --face-2: #7a5a00; }
.porte-interieur {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  background: radial-gradient(circle at 50% 60%, #ffe9a8 0%, #f0a83a 45%, #5a2d0c 100%);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6);
}
.porte-emoji { font-size: clamp(1.4rem, 3.2vw, 2.1rem); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
.porte-coche { font-size: 0.75rem; font-weight: 700; color: #3a2508; background: #fff3c4; border-radius: 999px; padding: 0 0.45em; }
.porte-battant { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform 0.9s cubic-bezier(0.3, 1.4, 0.5, 1); }
.face { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.avant {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(160deg, var(--face), var(--face-2));
  box-shadow: inset 0 0 0 2px rgba(245, 197, 66, 0.75), inset 0 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 0 6px rgba(245, 197, 66, 0.35), 0 4px 8px rgba(0, 0, 0, 0.45);
}
.face.arriere { transform: rotateY(180deg); background: linear-gradient(160deg, #6b3f1f, #3d2312); box-shadow: inset 0 0 0 2px #2a170b; }
.porte-numero {
  font-family: var(--conte); font-weight: 700; font-size: clamp(1.5rem, 3.6vw, 2.2rem); line-height: 1;
  background: linear-gradient(180deg, #fff6d0, #f5c542 55%, #b8860b); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45));
}
.poignee { position: absolute; right: 9%; top: 52%; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #b8860b); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.porte-etat { position: absolute; bottom: 7%; font-size: 0.72rem; opacity: 0.9; }
.givre { position: absolute; inset: 0; border-radius: 10px; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
.porte.verrouillee .givre, .porte.fermee .givre {
  opacity: 1;
  background:
    radial-gradient(ellipse at 10% 10%, rgba(255, 255, 255, 0.55), transparent 35%),
    radial-gradient(ellipse at 90% 85%, rgba(220, 240, 255, 0.5), transparent 40%),
    radial-gradient(ellipse at 80% 15%, rgba(220, 240, 255, 0.35), transparent 30%),
    linear-gradient(160deg, rgba(200, 230, 255, 0.25), rgba(200, 230, 255, 0.05));
  box-shadow: inset 0 0 12px rgba(220, 240, 255, 0.55);
}
.porte.verrouillee .face.avant, .porte.fermee .face.avant { filter: saturate(0.55) brightness(0.8); }
.porte.disponible { animation: appel 2.2s infinite; }
@keyframes appel { 0% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(245, 197, 66, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0); } }
.porte.disponible:hover .porte-battant, .porte.disponible:focus-visible .porte-battant { transform: rotateY(-28deg); }
.porte.disponible .porte-emoji::before { content: "✨"; }
.porte.resolue .porte-battant { transform: rotateY(-72deg); }
.porte.resolue:hover .porte-battant { transform: rotateY(-82deg); }
.porte:not(.resolue):hover { z-index: 1; }
.porte:focus { outline: none; }
.porte:focus-visible { outline: 3px solid var(--or); outline-offset: 3px; }

/* ---------- Pied de page ---------- */
.pied { text-align: center; color: #c3d0e0; font-size: 0.82rem; padding: 1rem 1rem 2rem; text-shadow: 0 1px 3px #000; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, calc(100% + 2rem)); /* bien caché, même vide */
  background: linear-gradient(180deg, #13304f, #0b1d36); border: 1px solid var(--or); color: var(--texte);
  padding: 0.75em 1.3em; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 50; transition: transform 0.35s ease; max-width: 92vw; text-align: center;
}
.toast.visible { transform: translate(-50%, 0); }

/* ---------- Fenêtres ---------- */
.modale {
  position: fixed; inset: 0; z-index: 20; background: rgba(3, 9, 18, 0.9);
  overflow-y: auto; padding: 2rem 0.8rem; display: flex; justify-content: center; align-items: flex-start;
}
.fenetre {
  position: relative; width: 100%; max-width: 880px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.035) 2px, transparent 3px) 0 0 / 60px 60px,
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.03) 1.5px, transparent 2.5px) 0 0 / 44px 44px,
    linear-gradient(180deg, #102847, #0c1f39);
  border: 1px solid rgba(245, 197, 66, 0.35); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 6px rgba(255, 255, 255, 0.03);
  overflow: hidden; overflow: clip; animation: entree 0.4s ease; /* clip : rogne pareil, sans bloquer les éléments « sticky » à l'intérieur */
}
@keyframes entree { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.fermer {
  position: absolute; top: 0.8rem; right: 0.8rem; z-index: 5; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45); background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 1.05rem; cursor: pointer;
}
.fermer:hover { background: rgba(0, 0, 0, 0.65); }

/* Bandeau illustré */
.bandeau-jour { position: relative; height: 250px; overflow: hidden; }
@media (max-width: 560px) { .bandeau-jour { height: 210px; } }
.bandeau-scene, .bandeau-scene .decor-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bandeau-heros {
  position: absolute; right: 6%; bottom: 30px; font-size: clamp(4rem, 12vw, 6.5rem); line-height: 1;
  filter: drop-shadow(0 0 18px rgba(255, 240, 190, 0.65)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
  animation: flotte 4s ease-in-out infinite;
}
@keyframes flotte { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
.bandeau-texte {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.5rem 1.6rem 1.1rem;
  background: linear-gradient(180deg, transparent, rgba(4, 12, 26, 0.55) 45%, rgba(4, 12, 26, 0.85));
}
.bandeau-sur { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: #ffe9a8; text-shadow: 0 1px 2px #000; }
.bandeau-jour h2 { margin: 0.1rem 0 0.3rem; font-family: var(--conte); font-size: clamp(1.6rem, 4.4vw, 2.4rem); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); max-width: 75%; }
.bandeau-concept { display: inline-block; background: rgba(245, 197, 66, 0.18); border: 1px solid rgba(245, 197, 66, 0.5); border-radius: 999px; padding: 0.15em 0.8em; font-size: 0.88rem; }
.particules { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particules span { position: absolute; top: -12%; animation: particule linear infinite; opacity: 0.85; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4)); }
.particules .p-chiffre { font-family: var(--mono); font-weight: 700; color: #7dff9b; text-shadow: 0 0 8px #3dff7a; }
@keyframes particule { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--derive), 300px) rotate(360deg); } }

.corps-jour { padding: 1.5rem 1.7rem 1.7rem; }
@media (max-width: 560px) { .corps-jour { padding: 1.1rem 1rem 1.3rem; } .bandeau-texte { padding: 2rem 1rem 0.9rem; } }
.histoire {
  position: relative; padding: 0.9rem 1.2rem 0.9rem 3.2rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.1), rgba(245, 197, 66, 0.03));
  border: 1px solid rgba(245, 197, 66, 0.25);
  font-family: var(--conte); font-style: italic; font-size: 1.05rem; color: #f1e8d2;
}
.histoire::before { content: "🎄"; position: absolute; left: 0.9rem; top: 0.8rem; font-size: 1.4rem; font-style: normal; }
.histoire p { margin: 0.3rem 0; }
/* Le petit cours du lutin : la notion expliquée avant l'énigme */
.cours {
  margin-top: 1.1rem; border-radius: 14px;
  background: linear-gradient(160deg, rgba(19, 48, 79, 0.9), rgba(15, 36, 64, 0.9));
  border: 1px solid rgba(74, 163, 255, 0.35); border-left: 5px solid #4aa3ff;
}
.cours > summary {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.6rem;
  padding: 0.75rem 2.4rem 0.75rem 1.1rem; position: relative;
  cursor: pointer; list-style: none; color: #9fd1ff; font-family: var(--conte); font-size: 1.12rem; font-weight: 700;
}
.cours > summary::-webkit-details-marker { display: none; }
.cours > summary small { font-family: inherit; font-size: 0.8rem; font-weight: 400; color: #8fb3d6; font-style: italic; }
.cours > summary::after { content: "▾"; position: absolute; right: 1rem; top: 0.7rem; transition: transform 0.2s; }
.cours:not([open]) > summary::after { transform: rotate(-90deg); }
.cours > summary:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; border-radius: 12px; }
.contenu-cours { padding: 0 1.2rem 0.9rem; line-height: 1.55; }
.contenu-cours p { margin: 0.5rem 0; }
.contenu-cours ul { margin: 0.4rem 0; padding-left: 1.3rem; }
.contenu-cours li { margin: 0.25rem 0; }
.contenu-cours .tableau { font-size: 0.88rem; }
.tableau.compact th, .tableau.compact td { padding: 0.3rem 0.45rem; }
.tableau .gauche, .tableau td.gauche { text-align: left; }
.contenu-cours .allume { color: var(--or); font-weight: 700; }
@media (max-width: 560px) {
  .cours > summary { padding-left: 0.85rem; }
  .contenu-cours { padding: 0 0.85rem 0.8rem; }
  .contenu-cours .tableau { font-size: 0.8rem; }
  .contenu-cours .tableau th, .contenu-cours .tableau td { padding: 0.3rem 0.35rem; }
  .contenu-cours .tableau.compact th, .contenu-cours .tableau.compact td { padding: 0.25rem 0.2rem; }
  .contenu-cours pre.code { font-size: 0.8rem; padding: 0.6rem 0.7rem; }
}
@media (max-width: 360px) { .contenu-cours pre.code { font-size: 0.76rem; padding: 0.55rem 0.6rem; } }
/* (sur un tout petit écran, une longue ligne de code — « WHERE vitesse > 60 AND nez_rouge = 'non' » — passe
   à la ligne au lieu d'obliger à faire glisser le bloc) */
@media (max-width: 380px) { pre.code { white-space: pre-wrap; } }
.enigme { margin-top: 1.1rem; }
.enigme > p:first-child { margin-top: 0; }
.widget { margin: 1rem 0; }

.note, blockquote.note {
  margin: 0.8rem 0; padding: 0.8rem 1.1rem;
  background: linear-gradient(180deg, #f6ecd2, #eadbb2); color: #3b2a12;
  border-radius: 6px 6px 14px 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 0 24px rgba(140, 100, 30, 0.2);
  position: relative;
}
.note::after { content: ""; position: absolute; top: -8px; left: 50%; width: 70px; height: 18px; transform: translateX(-50%) rotate(-2deg); background: rgba(255, 255, 255, 0.45); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.note code { background: rgba(80, 50, 10, 0.12); color: #3b2a12; }
.note .r { color: #b3202f; } .note .g { color: #137a3d; } .note .b { color: #1d5fa8; }
.note p { margin: 0.3rem 0; }
.note.petit, .note .petit { color: #5a4422; }
.note ol { margin: 0.3rem 0; padding-left: 1.3rem; }
.schema { margin: 0.8rem 0; padding: 0.7rem 1rem; background: rgba(0, 0, 0, 0.28); border-radius: 10px; text-align: center; font-size: 1.05em; }
.alerte { background: rgba(214, 40, 57, 0.16); border: 1px solid rgba(214, 40, 57, 0.45); border-radius: 10px; padding: 0.6rem 0.9rem; }
pre.code { background: #081425; border: 1px solid var(--bord); border-radius: 12px; padding: 0.9rem 1.1rem; overflow-x: auto; font-size: 0.92rem; line-height: 1.6; color: #d5e6ff; }
pre.code .commentaire { color: #7f95ad; font-style: italic; }
pre.code .mot { color: #ff9f6b; font-weight: 700; }
.tableau { border-collapse: collapse; margin: 0.6rem auto; font-size: 0.92rem; }
.tableau th, .tableau td { border: 1px solid var(--bord); padding: 0.4rem 0.7rem; text-align: center; }
.tableau th { background: rgba(255, 255, 255, 0.07); font-weight: 600; }
.defilement { overflow-x: auto; }
.legende-regex td:first-child { width: 5.5rem; }
.legende-regex td:last-child { text-align: left; }

/* Réponse */
.formulaire-reponse { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin: 1.2rem 0 0.4rem; }
.champ-reponse, .champ-nombre, .champ-libre, .champ-mdp {
  font: inherit; color: var(--texte); background: #081629; border: 2px solid rgba(245, 197, 66, 0.35); border-radius: 12px; padding: 0.6em 0.9em; min-width: 0;
}
.champ-reponse { flex: 1 1 260px; max-width: 420px; font-size: 1.05rem; }
.champ-reponse:focus, .champ-nombre:focus, .champ-libre:focus, .champ-mdp:focus { border-color: var(--or); outline: none; box-shadow: 0 0 14px rgba(245, 197, 66, 0.35); }
.champ-libre { width: 100%; margin: 0.4rem 0; }
.champ-libre.invalide { border-color: #ff6b6b; }
.message { display: none; margin: 0.8rem auto 0; max-width: 640px; padding: 0.7rem 1rem; border-radius: 12px; text-align: center; }
.message.visible { display: block; }
.message.erreur { background: rgba(214, 40, 57, 0.16); border: 1px solid rgba(214, 40, 57, 0.45); }
.message.info { background: rgba(74, 163, 255, 0.13); border: 1px solid rgba(74, 163, 255, 0.4); }
.message.secousse { animation: secousse 0.45s; }
@keyframes secousse { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.indices { margin-top: 1rem; text-align: center; }
.liste-indices { text-align: left; max-width: 640px; margin: 0.4rem auto; padding: 0.6rem 1rem 0.6rem 2.2rem; background: rgba(74, 163, 255, 0.09); border-radius: 12px; border: 1px dashed rgba(74, 163, 255, 0.45); }
.liste-indices:empty { display: none; }
.liste-indices li { margin: 0.3rem 0; }

/* Réussite et leçon */
.resultat:empty { display: none; }
.resultat { margin-top: 1.4rem; }
.bandeau-succes { text-align: center; padding: 0.9rem 1rem; border-radius: 14px; background: linear-gradient(135deg, rgba(32, 191, 107, 0.28), rgba(245, 197, 66, 0.22)); border: 1px solid rgba(32, 191, 107, 0.6); font-size: 1.08rem; }
.bandeau-succes .petit { display: block; margin-top: 0.2rem; color: #ffe9a8; }
.fragment-gagne { margin: 1rem auto; text-align: center; }
.fragment-gagne small { color: var(--texte-doux); display: block; margin-top: 0.4rem; }
.ticket {
  display: inline-flex; align-items: center; gap: 1rem; padding: 0.6rem 1.4rem; border-radius: 12px; color: #3a2508;
  background: linear-gradient(135deg, #fff3c4, #f5c542 50%, #ffe08a);
  box-shadow: 0 6px 20px rgba(245, 197, 66, 0.35), inset 0 0 0 2px #fff8dc, inset 0 0 0 4px rgba(184, 134, 11, 0.6);
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 10px, #000 11px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 10px, #000 11px) right / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 50%, transparent 10px, #000 11px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 10px, #000 11px) right / 51% 100% no-repeat;
  animation: ticket 0.8s ease-out;
}
@keyframes ticket { from { transform: scale(0.4) rotate(-12deg); opacity: 0; } 70% { transform: scale(1.08) rotate(2deg); } to { transform: none; opacity: 1; } }
.ticket-titre { font-weight: 700; font-size: 0.9rem; }
.ticket-lettre { font-family: var(--mono); font-size: 2.2rem; font-weight: 800; line-height: 1; color: #8a1020; }
.ticket-position code { background: rgba(80, 50, 10, 0.15); color: #3a2508; }
.lecon {
  position: relative; margin-top: 1rem; padding: 1.1rem 1.3rem 1.1rem 1.6rem; border-radius: 16px;
  background: linear-gradient(160deg, #13304f, #0f2440); border: 1px solid rgba(74, 163, 255, 0.35); overflow: hidden;
}
.lecon::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: repeating-linear-gradient(-45deg, #e8394a 0 8px, #fff 8px 16px); }
.lecon h3 { margin: 0 0 0.6rem; color: #9fd1ff; font-family: var(--conte); font-size: 1.3rem; }
.lecon h4 { margin: 1.1rem 0 0.4rem; color: var(--or); }
.lecon ul { padding-left: 1.3rem; }
.lecon li { margin: 0.25rem 0; }
.lecon .grand { font-size: 1.35rem; text-align: center; font-family: var(--conte); }
.terrain { margin-top: 0.4rem; padding: 0.8rem; border-radius: 12px; background: rgba(0, 0, 0, 0.24); }
.recap { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.35rem 0.8rem; font-size: 0.9rem; margin: 0.6rem 0; }
.recap div { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 0.3rem 0.6rem; }
.navigation-jours { display: flex; justify-content: space-between; align-items: center; margin-top: 1.4rem; padding-top: 0.8rem; border-top: 1px solid var(--bord); }

/* Lettre du Père Noël (intro) : un vieux parchemin écrit à la plume, à la lueur d'une bougie */
.lettre-pole-nord {
  --plume-ecriture: "Segoe Print", "Bradley Hand", "Noteworthy", cursive;
  --calligraphie: "Segoe Script", "Snell Roundhand", "Apple Chancery", "Lucida Handwriting", "Brush Script MT", cursive;
  position: relative; padding: 1.6rem 1.8rem 1.5rem; border-radius: 4px;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 70, 20, 0.22) 100%),
    linear-gradient(180deg, #f9f0d9, #ecd9ad);
  color: #3b2a12; font-family: var(--plume-ecriture); font-size: 1.04rem; line-height: 1.7;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 0 50px rgba(140, 90, 30, 0.32);
  /* (penchée comme une vraie lettre posée ; sur un téléphone elle se tient droite, voir plus bas : très haute,
     la moindre inclinaison décalait son haut d'une dizaine de pixels contre un bord de l'écran) */
  --penche: -0.6deg;
  transform: rotate(var(--penche));
}
/* Le givre qui gagne les coins (plus fort quand Kryos apparaît) et la lueur de la bougie,
   sous le texte (z-index négatif dans le contexte créé par le transform). */
.lettre-pole-nord::before, .lettre-pole-nord::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit; }
.lettre-pole-nord::before {
  background:
    radial-gradient(circle at 0 0, rgba(214, 238, 255, 0.95), rgba(214, 238, 255, 0) 90px),
    radial-gradient(circle at 100% 0, rgba(214, 238, 255, 0.85), rgba(214, 238, 255, 0) 70px),
    radial-gradient(circle at 0 100%, rgba(214, 238, 255, 0.8), rgba(214, 238, 255, 0) 80px),
    radial-gradient(circle at 100% 100%, rgba(214, 238, 255, 0.95), rgba(214, 238, 255, 0) 100px);
  opacity: 0.45; transition: opacity 1.2s;
}
.lettre-pole-nord.givree::before { opacity: 1; }
.lettre-pole-nord::after { background: radial-gradient(ellipse 55% 35% at 88% 6%, rgba(255, 168, 60, 0.3), transparent 70%); animation: bougie 2.6s ease-in-out infinite; }
@keyframes bougie { 0%, 100% { opacity: 0.75; } 25% { opacity: 1; } 45% { opacity: 0.55; } 60% { opacity: 0.95; } 80% { opacity: 0.7; } }
.lettre-pole-nord p { margin: 0.55rem 0; }
.lettre-pole-nord .entete-lettre { text-align: right; color: #7a5a2a; margin-top: 0; font-size: 0.92em; line-height: 1.4; }
.lettre-pole-nord .salutation { font-family: var(--calligraphie); font-size: 1.45em; margin-top: 0.9rem; }
.lettre-pole-nord .appel { font-weight: 700; color: #6b1420; }
.lettre-pole-nord .mot-givre { color: #1f6fae; letter-spacing: 0.04em; text-shadow: 0 0 6px rgba(120, 200, 255, 0.85), 0 0 1px #fff; }
.lettre-pole-nord .regles { margin: 0.8rem 0; }
.lettre-pole-nord .regles div { background: rgba(120, 80, 20, 0.08); border: 1px dashed rgba(120, 80, 20, 0.3); line-height: 1.5; }
.lettre-pole-nord .ps { font-size: 0.92em; color: #5a3e1c; margin-bottom: 0; }
.bas-lettre { position: relative; display: flex; justify-content: flex-end; align-items: center; min-height: 86px; margin-top: 0.4rem; }
.signature { text-align: right; color: #4a2c0e; }
.nom-signature { display: block; white-space: nowrap; font-family: var(--calligraphie); font-size: 2.1rem; line-height: 1.2; padding: 0 0.3rem; }
.paraphe { display: block; width: 200px; height: 38px; margin: -6px 0 0 auto; overflow: visible; }
.paraphe path { fill: none; stroke: #6b4520; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.bas-lettre .sceau { left: 0.3rem; top: 50%; bottom: auto; margin-top: -31px; }

/* L'animation d'écriture */
.scene-lettre { position: relative; perspective: 900px; }
.lettre-pole-nord.en-ecriture .encre { opacity: 0; }
/* (0,8 s : à 1,6 s, une cinquantaine de lettres changeaient de couleur en même temps ; Firefox passait
   de 37 à 46 images/s en moyenne pendant l'écriture avec 0,8 s, autant que sans l'effet, 2026-11-16) */
.lettre-pole-nord.en-ecriture .encre.ecrit { opacity: 1; animation: encre-fraiche 0.8s ease-out; }
/* L'encre magique : chaque lettre naît en or brillant sous la plume, puis sèche en brun.
   Seules la couleur et l'opacité changent : un flou ou un halo par lettre faisait saccader l'animation. */
@keyframes encre-fraiche { from { opacity: 0; color: #ffe07a; } 14% { opacity: 1; color: #f0b628; } 45% { color: #c08a1e; } }

/* La lumière dorée qui suit la pointe de la plume, sous l'encre */
.halo-plume {
  position: absolute; left: 0; top: 0; z-index: -1; width: 110px; height: 110px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 228, 150, 0.75) 0, rgba(255, 205, 95, 0.32) 34%, rgba(255, 190, 80, 0) 70%);
  transition: transform 0s linear, opacity 0.5s; will-change: transform;
}
.halo-plume.eteint, .lettre-pole-nord.gelee .halo-plume { opacity: 0; }
/* La poussière d'or (des points lumineux et de petites étoiles), animée en JavaScript */
.poussiere-or {
  position: absolute; left: 0; top: 0; z-index: 5; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fffbe0 0, #f5c542 40%, rgba(245, 197, 66, 0) 70%); box-shadow: 0 0 6px rgba(255, 210, 90, 0.9); will-change: transform, opacity;
}
.poussiere-or.etoile-or {
  width: auto; height: auto; margin: -8px 0 0 -5px; background: none; box-shadow: none;
  font: 12px/1 "Segoe UI Symbol", "Apple Symbols", sans-serif; color: #ffe27a; text-shadow: 0 0 5px rgba(255, 200, 70, 0.95);
}
.lettre-pole-nord.en-ecriture .regles > div { opacity: 0; transition: opacity 0.4s; }
.lettre-pole-nord.en-ecriture .regles > div.commence { opacity: 1; }
.lettre-pole-nord.en-ecriture .nom-signature { clip-path: inset(0 100% 0 0); }
.lettre-pole-nord.en-ecriture .paraphe path { stroke-dashoffset: 1; }
.lettre-pole-nord.en-ecriture .signature.ecrite .nom-signature { clip-path: inset(0 0 0 0); transition: clip-path 1.4s ease-in-out; }
.lettre-pole-nord.en-ecriture .signature.ecrite .paraphe path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.8s ease-out 1.2s; }
.lettre-pole-nord.en-ecriture .sceau { opacity: 0; transform: scale(2.4) rotate(-40deg); }
.lettre-pole-nord.en-ecriture .sceau.appose { opacity: 1; transform: rotate(-12deg); transition: transform 0.35s cubic-bezier(0.5, 1.9, 0.6, 1), opacity 0.15s; }
.plume { position: absolute; left: 0; top: 0; z-index: 4; width: 40px; height: 40px; pointer-events: none; transition: transform 0.06s linear, opacity 0.3s; filter: drop-shadow(2px 4px 3px rgba(60, 35, 10, 0.35)); }
.plume svg { width: 100%; height: 100%; animation: plume-danse 0.45s ease-in-out infinite alternate; transform-origin: 6% 96%; }
.plume.levee { opacity: 0; }
@keyframes plume-danse { from { transform: rotate(-4deg); } to { transform: rotate(5deg) translateY(-1px); } }
/* La lettre sort de l'enveloppe et se déplie vers le joueur */
.lettre-pole-nord.sortie { animation: lettre-sortie 1.1s cubic-bezier(0.2, 0.8, 0.25, 1) 2.75s both; transform-origin: 50% 0; }
@keyframes lettre-sortie {
  from { opacity: 0; transform: translateY(60px) scale(0.4) rotateX(62deg) rotate(var(--penche)); }
  35% { opacity: 1; }
  to { opacity: 1; transform: translateY(0) scale(1) rotateX(0deg) rotate(var(--penche)); }
}
.lettre-pole-nord.tampon { animation: tampon 0.4s ease-out; }
@keyframes tampon { 0%, 100% { transform: rotate(var(--penche)); } 30% { transform: rotate(var(--penche)) scale(0.992) translateY(2px); } }
.lettre-pole-nord.frisson { animation: frisson 0.6s; }
@keyframes frisson { 0%, 100% { transform: rotate(var(--penche)); } 15% { transform: rotate(calc(var(--penche) - 0.5deg)) translate(-4px, 1px); } 35% { transform: rotate(calc(var(--penche) + 0.6deg)) translate(4px, -1px); } 55% { transform: rotate(calc(var(--penche) - 0.4deg)) translate(-3px, 0); } 75% { transform: rotate(calc(var(--penche) + 0.3deg)) translate(2px, 1px); } }

/* L'enveloppe arrive de très loin, à travers la tempête : un point doré qui tournoie et grossit
   en volant vers le joueur, puis elle perd son sceau et s'ouvre. */
.enveloppe {
  position: absolute; z-index: 5; left: 50%; top: 40px; width: min(300px, 80%); aspect-ratio: 5 / 3; transform: translateX(-50%);
  animation: env-vol 2s ease-in-out both, env-depart 0.55s ease-in 2.65s forwards;
}
@keyframes env-vol {
  0% { opacity: 0; transform: translateX(-50%) translate(70px, 10px) scale(0.04) rotate(-280deg); }
  12% { opacity: 1; }
  40% { transform: translateX(-50%) translate(-110px, 70px) scale(0.2) rotate(-160deg); }
  68% { transform: translateX(-50%) translate(85px, 34px) scale(0.52) rotate(-55deg); }
  88% { transform: translateX(-50%) translate(-6px, -4px) scale(1.1) rotate(5deg); }
  100% { opacity: 1; transform: translateX(-50%) translate(0, 0) scale(1) rotate(0deg); }
}
/* Sa lueur dorée et les petites étoiles qui l'escortent (elles s'éteignent à l'arrivée) */
.env-lueur {
  position: absolute; inset: -55% -35%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 226, 140, 0.75), rgba(255, 200, 80, 0.28) 45%, rgba(255, 190, 70, 0) 100%);
  animation: env-lueur 2.6s ease-out both;
}
@keyframes env-lueur { from { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 0.9; } to { opacity: 0; } }
.env-etoile {
  position: absolute; z-index: 4; font-style: normal; font-size: 22px; line-height: 1; color: #ffe27a; pointer-events: none;
  text-shadow: 0 0 6px rgba(255, 200, 70, 0.95); animation: env-etoile 0.55s ease-in-out infinite alternate, env-lueur 2.6s ease-out both;
}
.env-etoile.a { left: -12%; top: -14%; }
.env-etoile.b { right: -10%; top: 6%; animation-delay: -0.2s, 0s; font-size: 16px; }
.env-etoile.c { left: -6%; bottom: -12%; animation-delay: -0.35s, 0s; font-size: 14px; }
.env-etoile.d { right: -14%; bottom: -8%; animation-delay: -0.1s, 0s; }
@keyframes env-etoile { from { transform: scale(0.55) rotate(0deg); } to { transform: scale(1.15) rotate(40deg); } }
/* « Pour Marie » : l'enveloppe est adressée au joueur */
.env-adresse {
  position: absolute; z-index: 2; left: 8%; right: 8%; bottom: 9%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: "Segoe Script", "Snell Roundhand", "Apple Chancery", "Lucida Handwriting", cursive; font-size: 1.15rem; color: #5a3a14;
}
.env-dos, .env-face, .env-rabat { position: absolute; border-radius: 6px; }
.env-dos { inset: 0; background: linear-gradient(160deg, #e3cb95, #c9a96d); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.55); }
.env-face { inset: 0; background: linear-gradient(200deg, #f2e2b8, #dcc38d); clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%); }
.env-rabat { left: 0; right: 0; top: 0; height: 58%; background: linear-gradient(180deg, #ead39f, #d4b67c); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; animation: rabat 0.5s ease-in-out 2.3s forwards; }
.env-sceau {
  position: absolute; z-index: 3; left: 50%; top: 58%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: var(--conte); font-weight: 700; font-size: 0.95rem; color: #ffd9d9;
  background: radial-gradient(circle at 35% 35%, #e0414f, #8a1020 70%); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 0 0 4px rgba(0, 0, 0, 0.15);
  animation: sceau-saute 0.35s ease-in 2.05s forwards;
}
@keyframes env-depart { to { opacity: 0; transform: translateX(-50%) translateY(110px) scale(0.92); } }
@keyframes rabat { to { transform: rotateX(180deg); } }
@keyframes sceau-saute { 40% { transform: scale(1.15) rotate(-8deg); } to { opacity: 0; transform: translateY(-30px) scale(1.4) rotate(30deg); } }

/* Pendant l'écriture : pas de bouton (on ne passe pas la lettre), juste « Le Père Noël t'écrit… » */
.pied-intro .ecriture-en-cours, .pied-intro .revoir-lettre { display: none; }
.pied-intro.en-cours { position: sticky; bottom: 0.8rem; z-index: 6; }
.pied-intro.en-cours > :not(.ecriture-en-cours) { display: none; }
.pied-intro.en-cours .ecriture-en-cours {
  display: inline-block; margin: 0; padding: 0.4em 1em; border-radius: 999px;
  font-family: var(--conte); font-style: italic; color: #ffe9a8; background: rgba(10, 26, 51, 0.6);
  animation: ecriture-pulse 1.6s ease-in-out infinite;
}
@keyframes ecriture-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.pied-intro.termine .revoir-lettre { display: inline; margin-top: 0.8rem; }
.pied-intro.termine .btn-principal { animation: apparition-mission 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes apparition-mission { from { opacity: 0; transform: translateY(14px) scale(0.85); } to { opacity: 1; transform: none; } }

/* La téléportation vers le chalet, quand le joueur accepte la mission :
   la lettre s'illumine, deux anneaux d'or partent du bouton, des traînées d'étoiles filent vers
   les bords, un éclair blanc envahit l'écran… puis se dissipe sur le chalet.
   Uniquement transform et opacity, pour rester fluide. */
.lettre-pole-nord.magie { animation: lettre-magie 1.75s ease-in both; }
.scene-lettre .lettre-pole-nord.magie::after { /* plus fort que .gelee::after */
  z-index: 8; animation: lueur-magie 1.75s ease-in both;
  background: radial-gradient(ellipse 70% 60% at 50% 80%, rgba(255, 236, 170, 0.95), rgba(255, 205, 90, 0.5) 45%, rgba(255, 190, 70, 0) 80%);
}
@keyframes lettre-magie {
  0% { transform: rotate(var(--penche)); }
  20%, 40%, 60%, 80% { transform: rotate(var(--penche)) translate(-1.5px, 1px); }
  30%, 50%, 70%, 90% { transform: rotate(var(--penche)) translate(1.5px, -1px); }
  100% { transform: rotate(var(--penche)) scale(0.97); }
}
@keyframes lueur-magie { from { opacity: 0; } 70% { opacity: 1; } to { opacity: 1; } }
.teleportation { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: auto; }
.tp-voile { position: absolute; inset: 0; background: radial-gradient(circle, rgba(60, 40, 0, 0.35), rgba(3, 8, 16, 0.8)); animation: tp-voile 1.2s ease-out both; }
@keyframes tp-voile { from { opacity: 0; } to { opacity: 1; } }
.tp-centre { position: absolute; width: 0; height: 0; }
.tp-traits i {
  position: absolute; left: 0; top: -1px; width: 34vmax; height: 2px; border-radius: 2px; transform-origin: 0 50%; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 246, 207, 0), #fff6cf 60%, rgba(255, 255, 255, 0));
  animation: tp-trait 0.7s cubic-bezier(0.55, 0, 0.9, 0.5) 2 both;
}
@keyframes tp-trait {
  from { opacity: 0; transform: rotate(var(--angle)) translateX(3vmax) scaleX(0.15); }
  25% { opacity: 1; }
  to { opacity: 0; transform: rotate(var(--angle)) translateX(85vmax) scaleX(1.6); }
}
.tp-anneau {
  position: absolute; left: -9vmax; top: -9vmax; width: 18vmax; height: 18vmax; border-radius: 50%;
  border: 3px solid rgba(255, 223, 128, 0.95); box-shadow: 0 0 18px rgba(255, 210, 90, 0.8), inset 0 0 18px rgba(255, 210, 90, 0.6);
  opacity: 0; animation: tp-anneau 1.1s cubic-bezier(0.2, 0.7, 0.4, 1) 0.15s both;
}
.tp-anneau.deux { animation-delay: 0.6s; }
@keyframes tp-anneau { from { opacity: 1; transform: scale(0.05); } 60% { opacity: 0.8; } to { opacity: 0; transform: scale(6); } }
.tp-eclair {
  position: absolute; left: -12vmax; top: -12vmax; width: 24vmax; height: 24vmax; border-radius: 50%;
  background: radial-gradient(closest-side, #fff 0, #fffbe8 55%, rgba(255, 240, 190, 0.85) 75%, rgba(255, 230, 160, 0) 100%);
  opacity: 0; animation: tp-eclair 1.15s cubic-bezier(0.7, 0, 0.9, 0.6) 0.6s both;
}
@keyframes tp-eclair { from { opacity: 0.4; transform: scale(0); } 30% { opacity: 1; } to { opacity: 1; transform: scale(16); } }
/* L'arrivée : tout se dissipe, l'éclair blanc s'efface en dernier et révèle le chalet */
.teleportation.arrivee { pointer-events: none; }
.teleportation.arrivee .tp-traits, .teleportation.arrivee .tp-anneau { opacity: 0; transition: opacity 0.25s; }
.teleportation.arrivee .tp-voile { animation: tp-voile-fin 0.3s ease-out both; }
@keyframes tp-voile-fin { from { opacity: 1; } to { opacity: 0; } }
.teleportation.arrivee .tp-eclair { animation: tp-dissipe 1.4s ease-out both; }
@keyframes tp-dissipe { from { opacity: 1; transform: scale(16); } to { opacity: 0; transform: scale(17); } }
.sceau {
  position: absolute; left: 1.4rem; bottom: 1rem; width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: var(--conte); font-weight: 700; font-size: 1.2rem; color: #ffd9d9;
  background: radial-gradient(circle at 35% 35%, #e0414f, #8a1020 70%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 0 0 4px rgba(0, 0, 0, 0.15), inset 0 0 0 7px rgba(255, 255, 255, 0.12);
  transform: rotate(-12deg);
}
.salut { margin: 0 0 0.6rem; font-size: 1.05rem; color: #fff3c4; text-shadow: 0 1px 3px #000; }
.salut .lien { margin-left: 0.6rem; font-size: 0.82rem; }
.signature-lutin { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; margin: 1.4rem auto 0.2rem; max-width: 420px; text-align: center; }
.signature-lutin label { font-family: var(--conte); font-size: 1.15rem; color: #ffe9a8; }
.champ-nom {
  width: 100%; font: inherit; font-family: var(--conte); font-size: 1.35rem; font-style: italic; text-align: center;
  color: #3b2a12; background: linear-gradient(180deg, #f8efd8, #ecdcb4); border: 0; border-bottom: 3px solid #8a1020; border-radius: 8px 8px 2px 2px;
  padding: 0.45em 0.8em; box-shadow: inset 0 0 18px rgba(140, 100, 30, 0.25);
}
.champ-nom:focus { outline: none; box-shadow: inset 0 0 18px rgba(140, 100, 30, 0.25), 0 0 0 3px rgba(245, 197, 66, 0.6); }
.signature-lutin small { color: var(--texte-doux); }
.onglets { display: flex; gap: 0.3rem; margin-bottom: 0.4rem; background: rgba(0, 0, 0, 0.3); padding: 0.25rem; border-radius: 999px; }
.onglet { font: inherit; font-size: 0.92rem; cursor: pointer; border: 0; border-radius: 999px; padding: 0.45em 1em; background: none; color: var(--texte-doux); }
.onglet.actif { background: linear-gradient(180deg, #ffe08a, #e0a422); color: #3a2508; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.ligne-mdp { position: relative; width: 100%; }
.ligne-mdp .champ-nom { padding-right: 2.8em; font-style: normal; }
.voir-mdp { position: absolute; right: 0.5em; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1.1rem; }
.erreur-nom { margin: 0; color: #ff9a9a; min-height: 1.2em; }
.regles { display: grid; gap: 0.5rem; margin: 1rem 0; }
.regles div { border-radius: 10px; padding: 0.5rem 0.8rem; }
.regles > div > span:first-child:not(.encre) { margin-right: 0.4rem; }
.pied-intro { padding: 1.2rem 1rem 0.2rem; }

/* =========================================================
   La lettre magique : neige, encre dorée… et l'attaque de Kryos
   ========================================================= */
:root { --texture-givre: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22200%22%20height%3D%22200%22%20viewBox%3D%220%200%20200%20200%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cg%20stroke-width%3D%221.4%22%20opacity%3D%22.9%22%3E%3Cpath%20d%3D%22M40%2022v36M24.4%2031l31.2%2018M24.4%2049l31.2-18M40%2028l-4-4M40%2028l4-4M40%2052l-4%204M40%2052l4%204M29.6%2034l-5.5%201.5M50.4%2046l5.5-1.5M29.6%2046l-5.5-1.5M50.4%2034l5.5%201.5%22%2F%3E%3Cpath%20d%3D%22M150%20108v24M139.6%20114l20.8%2012M139.6%20126l20.8-12%22%2F%3E%3Cpath%20d%3D%22M96%20168v14M89.9%20171.5l12.2%207M89.9%20178.5l12.2-7%22%2F%3E%3C%2Fg%3E%3Cg%20stroke-width%3D%221%22%20opacity%3D%22.75%22%3E%3Cpath%20d%3D%22M0%20128q42-14%2072-58M18%20122l-4-11M18%20122l11%201M36%20113l-4-11M36%20113l11%200M52%20101l-3-10M52%20101l10-1M64%2086l-2-9M64%2086l9-2%22%2F%3E%3Cpath%20d%3D%22M200%2036q-44%206-76%2052M184%2039l1-10M184%2039l-8%206M168%2044l1-10M168%2044l-8%207M152%2053l0-10M152%2053l-8%207M138%2066l-1-9M138%2066l-8%206%22%2F%3E%3Cpath%20d%3D%22M112%200q14%2030-4%2064M116%2016l8-4M116%2016l-8-3M118%2032l8-3M118%2032l-8-4M115%2048l8-2M115%2048l-8-5%22%2F%3E%3Cpath%20d%3D%22M200%20170q-30%204-58%2030M186%20172l0-8M186%20172l-6%205M172%20176l0-8M172%20176l-6%206M158%20184l-1-8M158%20184l-6%206%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23fff%22%20stroke%3D%22none%22%20opacity%3D%22.8%22%3E%3Ccircle%20cx%3D%2280%22%20cy%3D%22120%22%20r%3D%221.4%22%2F%3E%3Ccircle%20cx%3D%2220%22%20cy%3D%22180%22%20r%3D%221%22%2F%3E%3Ccircle%20cx%3D%22170%22%20cy%3D%2278%22%20r%3D%221.2%22%2F%3E%3Ccircle%20cx%3D%2260%22%20cy%3D%2210%22%20r%3D%221%22%2F%3E%3Ccircle%20cx%3D%22128%22%20cy%3D%22150%22%20r%3D%221.6%22%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.pied-intro .legende-gel { display: none; }
.pied-intro.termine .legende-gel {
  display: block; margin: 0 auto 1rem; max-width: 34rem; font-family: var(--conte); font-style: italic; font-size: 1.02rem;
  color: #cdeeff; text-shadow: 0 0 10px rgba(120, 200, 255, 0.7);
}
.pied-intro.termine button.legende-gel { display: inline-block; color: var(--or); text-shadow: 0 0 10px rgba(245, 197, 66, 0.6); }

/* La neige qui tombe sur la lettre (et la tempête quand Kryos attaque) */
.neige-lettre { position: absolute; inset: 0 -12px; z-index: 6; pointer-events: none; overflow: hidden; }
.neige-lettre .douce, .neige-lettre .tempete { position: absolute; inset: 0; }
/* (entre deux rafales, la tempête est cachée pour de bon : ses 70 flocons invisibles tombaient quand même,
   et Firefox redessinait toute la lettre pour rien) */
.neige-lettre .tempete { opacity: 0; visibility: hidden; transition: opacity 0.6s, visibility 0s 0.6s; }
.scene-lettre.blizzard .neige-lettre .tempete { opacity: 1; visibility: visible; transition: opacity 1.2s; }
.neige-lettre i {
  position: absolute; top: -20px; display: block; border-radius: 50%; background: #fff; opacity: 0.85;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.95), 0 0 2px 0.5px rgba(70, 120, 175, 0.55); font-style: normal; line-height: 1; text-align: center;
  animation: flocon-lettre linear infinite; will-change: transform;
}
.neige-lettre i.glyphe { background: none; box-shadow: none; color: #fff; text-shadow: 0 0 2px rgba(50, 105, 165, 0.9), 0 0 7px #9fd3ff; }
.neige-lettre .tempete i { opacity: 0.7; animation-name: flocon-tempete; }
@keyframes flocon-lettre { to { transform: translate(var(--dx), var(--h)) rotate(300deg); } }
@keyframes flocon-tempete { to { transform: translate(var(--dx), var(--h)); } }

/* Les étincelles dorées de la plume magique */
.etincelle {
  position: absolute; z-index: 5; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fffbe0 0, #f5c542 40%, rgba(245, 197, 66, 0) 70%); box-shadow: 0 0 6px rgba(255, 210, 90, 0.9);
  animation: etincelle 0.9s ease-out forwards;
}
@keyframes etincelle { from { opacity: 1; transform: translate(0, 0) scale(1.3); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); } }

/* La bougie : elle vacille au nom de Kryos, s'affole, puis s'éteint quand le givre arrive */
.lettre-pole-nord.bougie-faible::after { animation: bougie-faible 0.3s steps(2) infinite; }
@keyframes bougie-faible { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.55; } }
.lettre-pole-nord.tension::after { animation-duration: 0.45s; }
.lettre-pole-nord.assaut::after, .lettre-pole-nord.gelee::after { animation: none; opacity: 0; transition: opacity 0.8s; }

/* La plume tremble sur les derniers mots, puis gèle et tombe */
.plume.tremble svg { animation-duration: 0.11s; }
.plume.gelee {
  opacity: 0; transition-property: transform, opacity, filter; transition-timing-function: cubic-bezier(0.55, 0, 0.9, 0.55);
  filter: hue-rotate(185deg) saturate(0.5) brightness(1.35) drop-shadow(0 0 6px rgba(170, 220, 255, 0.95));
}
.plume.gelee svg { animation: none; transform: rotate(-40deg); transition: transform 1.2s; }
/* Une tache d'encre, là où la plume s'est arrêtée */
.lettre-pole-nord .interrompu::after {
  content: ""; display: inline-block; width: 0.5em; height: 0.42em; margin-left: 0.18em; border-radius: 55% 40% 60% 45%;
  background: #1d3f63; opacity: 0; transition: opacity 0.4s;
}
.lettre-pole-nord.gelee .interrompu::after { opacity: 0.75; }

/* La lettre tremble sous le choc : une secousse brève quand Kryos attaque, une autre quand la glace
   se fend. (Elle tremblait sans arrêt pendant toute l'attaque, ~10 s : déplacer la lettre entière
   oblige Firefox à la redessiner à chaque image, il tombait à 10-17 images/s ; mesuré le 2026-11-16,
   même sans rotation.) */
.lettre-pole-nord.assaut { animation: tremble-gel 0.14s linear 3; }
.lettre-pole-nord.assaut.fissure { animation: secousse-gel 0.14s linear 3; }
@keyframes tremble-gel { 0%, 100% { transform: rotate(var(--penche)); } 25% { transform: rotate(calc(var(--penche) - 0.2deg)) translate(-1.5px, 1px); } 50% { transform: rotate(calc(var(--penche) + 0.2deg)) translate(1.5px, -1px); } 75% { transform: rotate(calc(var(--penche) - 0.1deg)) translate(-1px, 0); } }
@keyframes secousse-gel { 0%, 100% { transform: rotate(var(--penche)); } 25% { transform: rotate(calc(var(--penche) - 0.2deg)) translate(-1.5px, 1px); } 50% { transform: rotate(calc(var(--penche) + 0.2deg)) translate(1.5px, -1px); } 75% { transform: rotate(calc(var(--penche) - 0.1deg)) translate(-1px, 0); } }

/* Le givre envahit la lettre depuis les bords, jusqu'au centre */
@property --fonte { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.couche-givre {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; opacity: 0;
  background: var(--texture-givre) 0 0 / 190px 190px, radial-gradient(ellipse at 50% 42%, rgba(232, 246, 255, 0.22) 20%, rgba(214, 238, 255, 0.9) 100%);
}
/* (Le givre apparaît en fondu, plus épais sur les bords. Il envahissait la lettre par un masque
   animé : Firefox redessinait toute la lettre à chaque image, 15-20 images/s ; mesuré le 2026-11-16.) */
.lettre-pole-nord.gelee .couche-givre {
  opacity: 1; transition: opacity 2.2s cubic-bezier(0.45, 0, 0.75, 1);
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.55) 30%, #000 85%);
  mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.55) 30%, #000 85%);
}
/* Une fois figée, la glace s'éclaircit assez pour qu'on puisse relire la lettre à travers */
.lettre-pole-nord.fige .couche-givre {
  -webkit-mask-image: none; mask-image: none; opacity: 0.72;
  transition: opacity 1.6s;
}
/* L'encre gèle : elle devient bleue, la lettre se couvre d'un voile glacé. D'un seul coup, une fois le
   givre en place (un dégradé de couleur sur tout le texte coûtait trop cher à Firefox). */
.lettre-pole-nord.gelee { color: #234f78; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 0 70px rgba(110, 185, 240, 0.6); transition: color 0s 1.4s, box-shadow 0s 1.4s; }
.lettre-pole-nord.gelee .entete-lettre, .lettre-pole-nord.gelee .ps { color: #3a6890; }
.lettre-pole-nord.gelee .appel { color: #1b4a75; }
.lettre-pole-nord.gelee p, .lettre-pole-nord.gelee .regles > div { text-shadow: 0 0 3px rgba(205, 237, 255, 0.95); }
.lettre-pole-nord.gelee .regles div { background: rgba(120, 180, 230, 0.12); border-color: rgba(60, 120, 180, 0.35); }

/* Les fissures dans la glace */
/* Elles partent du bas de la lettre, là où Kryos a frappé (hauteur fixe : même allure sur téléphone et sur grand écran) */
.fissures { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: min(100%, 480px); z-index: 3; pointer-events: none; overflow: visible; clip-path: inset(0 0 0 100%); }
.fissures path { fill: none; stroke: rgba(255, 255, 255, 0.95); stroke-width: 2; stroke-linejoin: bevel; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 1.5px rgba(20, 80, 140, 0.9)); }
.lettre-pole-nord.fissure .fissures { clip-path: inset(0 0 0 0); transition: clip-path 0.55s cubic-bezier(0.2, 0.8, 0.3, 1); }

/* La dalle de glace où Kryos grave sa menace, à la place de la fin de la lettre */
.fin-gelee {
  position: relative; z-index: 3; margin: 0.8rem -0.5rem 0; padding: 1.6rem 1rem 1.2rem; text-align: center; border-radius: 0 0 10px 10px; opacity: 0;
  background: var(--texture-givre) 0 0 / 150px 150px, linear-gradient(165deg, rgba(240, 250, 255, 0.97), rgba(176, 218, 246, 0.95) 60%, rgba(140, 195, 235, 0.95));
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.95), inset 0 -8px 20px rgba(50, 120, 185, 0.35);
  clip-path: polygon(0 10%, 5% 0, 12% 7%, 20% 1%, 28% 8%, 37% 0, 45% 6%, 54% 0, 62% 7%, 71% 1%, 79% 8%, 88% 0, 95% 6%, 100% 2%, 100% 100%, 0 100%);
}
.fin-gelee.visible { animation: dalle-gel 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards; }
@keyframes dalle-gel { from { opacity: 0; transform: translateY(14px) scale(0.9); } to { opacity: 1; transform: none; } } /* (sans flou animé : trop cher pour Firefox) */
.lettre-pole-nord.fige .fin-gelee { opacity: 1; }
.gravure {
  margin: 0; font-family: var(--conte); font-weight: 700; font-size: 1.22rem; line-height: 1.65; letter-spacing: 0.13em; text-transform: uppercase;
  color: rgba(14, 56, 96, 0.9); text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.9), -1px -1px 0 rgba(8, 36, 66, 0.35), 0 0 12px rgba(80, 160, 235, 0.55);
}
.signe-gravure { display: inline-block; margin-top: 0.35rem; font-size: 1.35em; letter-spacing: 0.06em; color: rgba(120, 12, 40, 0.88); }
.fin-gelee .encre { opacity: 0; }
.fin-gelee .encre.ecrit, .fin-gelee.gravee .encre { opacity: 1; }
.lettre-pole-nord.en-ecriture .fin-gelee .encre.ecrit { animation: graver 0.5s ease-out; }
@keyframes graver { from { opacity: 0; color: #fff; } 40% { opacity: 1; } } /* (sans halo animé : trop cher pour Firefox) */
@media (max-width: 480px) { .gravure { font-size: 1rem; letter-spacing: 0.08em; } }

/* Jour 24 : la fin de la lettre dégèle, puis le Père Noël écrit sa dernière lettre */
.fin-de-lettre { margin: 1.4rem 0 1rem; }
.fin-de-lettre h4 { text-align: center; font-family: var(--conte); font-size: 1.15rem; }
.fin-de-lettre .scene-lettre { margin: 0.7rem 0.2rem 1.6rem; }
.lecon .lettre-pole-nord p { margin: 0.55rem 0; }
.lettre-degel .deja { color: #8c7b5c; font-style: italic; }
.lettre-degel .couche-givre {
  opacity: 1; z-index: 3; box-shadow: inset 0 0 30px #fff;
  background: var(--texture-givre) 0 0 / 170px 170px, linear-gradient(170deg, rgba(240, 249, 255, 0.97), rgba(190, 226, 250, 0.97));
}
.lettre-degel.degel .couche-givre {
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--fonte), #000 calc(var(--fonte) + 28%));
  mask-image: linear-gradient(to bottom, transparent var(--fonte), #000 calc(var(--fonte) + 28%));
  animation: fonte 3.4s ease-in forwards;
}
@keyframes fonte { from { --fonte: -28%; } 85% { opacity: 1; } to { --fonte: 100%; opacity: 0; } }
.lettre-degel.degele .couche-givre { display: none; }
.lettre-finale.en-attente { visibility: hidden; }
.admirer-final { margin: 0.4rem 0 0; }

/* =========================================================
   Les Kères : un esprit de glace ailé garde chaque pièce
   ========================================================= */
.givrin-carte {
  display: flex; align-items: center; gap: 0.9rem; margin: 0 0 1.1rem; padding: 0.75rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(120, 190, 255, 0.16), rgba(40, 70, 130, 0.3)); border: 1px solid rgba(160, 215, 255, 0.35);
  box-shadow: inset 0 0 24px rgba(160, 215, 255, 0.12);
}
.givrin-carte.boss { background: linear-gradient(135deg, rgba(130, 40, 170, 0.28), rgba(15, 15, 50, 0.55)); border-color: rgba(210, 130, 255, 0.45); }
.givrin-avatar { position: relative; flex: none; width: 74px; height: 74px; }
.givrin-carte.boss .givrin-avatar { width: 92px; height: 92px; }
.givrin-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 8px rgba(150, 215, 255, 0.75)); animation: givrin-flotte 2.6s ease-in-out infinite; }
.boss .givrin-svg { filter: drop-shadow(0 0 10px rgba(255, 64, 96, 0.55)) drop-shadow(0 0 4px rgba(170, 220, 255, 0.6)); }
@keyframes givrin-flotte { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.givrin-texte { min-width: 0; }
.givrin-titre { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #9fd1ff; }
.boss .givrin-titre { color: #e3b5ff; }
.givrin-nom { display: block; font-family: var(--conte); font-size: 1.35rem; line-height: 1.2; color: #e8f6ff; text-shadow: 0 0 10px rgba(140, 205, 255, 0.8); }
.givrin-bulle {
  position: relative; margin: 0.4rem 0 0 0.4rem; padding: 0.45rem 0.8rem; border-radius: 12px;
  background: rgba(240, 248, 255, 0.94); color: #13304f; font-family: var(--conte); font-style: italic; font-size: 0.97rem; line-height: 1.35;
}
.givrin-bulle::before { content: ""; position: absolute; left: -8px; top: 12px; border: 8px solid transparent; border-left: 0; border-right-color: rgba(240, 248, 255, 0.94); }
/* Une mauvaise réponse : la Kère se tord de rire */
.givrin-carte.ricane .givrin-svg { animation: givrin-ricane 0.75s ease-in-out; }
@keyframes givrin-ricane { 0%, 100% { transform: none; } 20% { transform: translateY(-9px) rotate(-9deg) scale(1.1); } 40% { transform: rotate(7deg); } 60% { transform: translateY(-6px) rotate(-6deg) scale(1.05); } 80% { transform: rotate(4deg); } }
/* Chassé : il ne reste qu'une flaque */
.flaque {
  position: absolute; left: 10%; right: 10%; bottom: 6%; height: 20%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse at 40% 35%, rgba(255, 255, 255, 0.85), rgba(150, 210, 255, 0.6) 40%, rgba(90, 160, 220, 0.3) 72%, transparent 74%);
}
.givrin-carte.chasse { filter: saturate(0.7); }
.givrin-carte.chasse .givrin-bulle { opacity: 0.75; }
.givrin-carte.chasse .givrin-svg, .givrin-chasse .givrin-svg { opacity: 0; animation: none; }
.givrin-carte.chasse .flaque, .givrin-chasse .flaque { opacity: 1; }
.givrin-chasse {
  display: flex; align-items: center; gap: 0.9rem; margin: 0.8rem 0; padding: 0.7rem 1rem; border-radius: 14px;
  background: rgba(160, 215, 255, 0.1); border: 1px dashed rgba(160, 215, 255, 0.45);
}
.givrin-chasse b { font-size: 1.08rem; color: #e8f6ff; }
.givrin-chasse p { margin: 0.25rem 0 0; font-family: var(--conte); font-style: italic; color: #bfe6ff; }
/* En direct : il tremble, flashe… et vole en éclats */
/* (démarre après le défilement jusqu'au résultat) */
.givrin-chasse.en-direct .givrin-svg { opacity: 1; animation: givrin-eclate 0.95s ease-in 0.55s forwards; }
.givrin-chasse.en-direct .flaque { opacity: 0; animation: flaque 0.6s ease-out 1.7s forwards; }
@keyframes givrin-eclate {
  0% { transform: none; }
  10%, 30%, 50% { transform: translateX(-4px) rotate(-7deg); }
  20%, 40% { transform: translateX(4px) rotate(7deg); }
  70% { transform: scale(1.2); opacity: 1; filter: brightness(2.4) drop-shadow(0 0 18px #fff); }
  100% { transform: scale(0.25); opacity: 0; filter: brightness(3); }
}
@keyframes flaque { from { opacity: 0; transform: scaleX(0.3); } to { opacity: 1; transform: none; } }
.eclat {
  position: absolute; left: 50%; top: 45%; width: 13px; height: 13px; margin: -6.5px; opacity: 0; pointer-events: none;
  background: linear-gradient(135deg, #fff, #9fd3ff); clip-path: polygon(50% 0, 100% 70%, 20% 100%);
}
.boss .eclat { background: linear-gradient(135deg, #cfe9ff, #5a4a9a); }
.en-direct .eclat { animation: eclat 0.85s cubic-bezier(0.2, 0.7, 0.4, 1) 1.4s forwards; }
@keyframes eclat { from { opacity: 1; transform: translate(0, 0) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); } }
@media (max-width: 480px) {
  .givrin-carte, .givrin-chasse { gap: 0.6rem; padding: 0.6rem 0.7rem; }
  .givrin-avatar, .givrin-carte.boss .givrin-avatar { width: 56px; height: 56px; }
  .givrin-nom { font-size: 1.15rem; }
  .givrin-bulle { font-size: 0.9rem; }
}
/* Dans le chalet : la Kère hante la pièce ouverte tant qu'elle n'est pas réparée */
.piece-givrin { display: none; position: absolute; z-index: 1; right: 6%; bottom: 26%; width: 28%; max-width: 48px; pointer-events: none; }
.piece-chalet.disponible .piece-givrin { display: block; animation: hante 2.8s ease-in-out infinite; }
.piece-givrin .givrin-svg { animation: none; filter: drop-shadow(0 0 5px rgba(150, 215, 255, 0.95)); }
.piece-24 .piece-givrin { width: 34%; max-width: 58px; }
@keyframes hante { 0%, 100% { transform: translateY(0) rotate(-6deg); opacity: 0.95; } 50% { transform: translateY(-5px) rotate(6deg); opacity: 0.7; } }

/* Confettis, paillettes & célébration */
.confettis { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confettis span { position: absolute; top: -30px; animation: chute linear forwards; }
@keyframes chute { to { transform: translate(var(--dx), 110vh) rotate(540deg); opacity: 0.8; } }
.paillette-curseur { position: fixed; z-index: 60; pointer-events: none; font-size: 12px; transform: translate(-50%, -50%); animation: paillette-curseur 0.9s ease-out forwards; text-shadow: 0 0 6px currentColor; }
@keyframes paillette-curseur { to { transform: translate(-50%, 30px) scale(0.3) rotate(120deg); opacity: 0; } }
.celebration { position: fixed; inset: 0; z-index: 45; background: radial-gradient(circle, rgba(90, 60, 0, 0.92), rgba(3, 8, 16, 0.96)); display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; animation: entree 0.6s; }
.celebration h2 { font-family: var(--conte); font-size: clamp(2rem, 7vw, 3.8rem); color: var(--or); margin: 0.2rem 0; text-shadow: 0 0 30px rgba(245, 197, 66, 0.7); }
.grande-etoile { font-size: 9rem; line-height: 1; color: var(--or); text-shadow: 0 0 40px #f5c542, 0 0 90px #f5c542; animation: etoile-brille 2s infinite; }

/* ---------- Widgets ---------- */
/* Jour 1 : ampoules */
.guirlande {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 1.2rem 0.5rem 0.4rem;
  background: linear-gradient(transparent 22px, rgba(255, 255, 255, 0.3) 22px, rgba(255, 255, 255, 0.3) 24px, transparent 24px);
}
.ampoule { font: inherit; background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; color: var(--texte); padding: 0 0.15rem; }
.ampoule .culot { width: 14px; height: 10px; background: #8a7a4f; border-radius: 3px 3px 0 0; }
.ampoule .verre { width: 34px; height: 44px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; background: #3a4656; border: 2px solid rgba(255, 255, 255, 0.2); transition: background 0.25s, box-shadow 0.25s; }
.ampoule.allumee .verre { background: radial-gradient(circle at 40% 35%, #fff9d6, #ffd23f 45%, #ff9f1a); box-shadow: 0 0 18px 6px rgba(255, 210, 63, 0.6); }
.ampoule .valeur { margin-top: 0.3rem; font-family: var(--mono); font-weight: 700; font-size: 0.95rem; }
.affichage-binaire { text-align: center; margin: 0.6rem 0; font-size: 1.05rem; }
.affichage-binaire code { font-size: 1.15em; letter-spacing: 0.1em; color: var(--or); }
/* Petit rappel dans une énigme (les valeurs des ampoules, l'alphabet numéroté…) */
.rappel { margin: 0.8rem 0; padding: 0.55rem 0.9rem; border-radius: 10px; background: rgba(255, 214, 110, 0.1); border: 1px dashed rgba(255, 214, 110, 0.55); font-size: 0.95em; }
.rappel code { color: var(--or); white-space: nowrap; }
/* (sur un petit téléphone, « 128 · 64 · 32 · 16 · 8 · 4 · 2 · 1 » ne tient pas sur une ligne : il passe à la ligne) */
@media (max-width: 370px) { .rappel code { white-space: normal; } }
/* Le tableau ASCII affiché au mur du Bureau du Courrier (jour 2) */
.table-ascii {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(7.6rem, 1fr)); gap: 0.3rem; margin: 0.6rem auto 0.9rem; max-width: 640px;
  padding: 0.7rem; border-radius: 10px; background: #f4f0e6; color: #222; border: 2px solid #a58b5a; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.table-ascii span { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.15rem 0.45rem; border-radius: 6px; background: rgba(165, 139, 90, 0.16); }
.table-ascii b { font-size: 1.05rem; color: #7a1f1f; }
.table-ascii code { font-family: var(--mono); font-size: 0.9rem; color: #1e3a5f; background: none; padding: 0; }
.table-ascii.rangs { grid-template-columns: repeat(auto-fill, minmax(3.7rem, 1fr)); max-width: 560px; }

/* Jour 3 : César */
.reglage { margin: 0.6rem 0; }
.reglage label { display: block; margin-bottom: 0.3rem; }
.curseur { width: 100%; accent-color: var(--or); }
.valeur-curseur { font-size: 1.3em; color: var(--or); font-family: var(--mono); }
.alphabet { overflow-x: auto; margin: 0.6rem 0; font-family: var(--mono); font-size: 0.82rem; }
.ligne-alpha { display: flex; white-space: nowrap; }
.ligne-alpha span { display: inline-block; min-width: 1.45em; text-align: center; padding: 0.15em 0; }
.ligne-alpha .etiquette-alpha { min-width: 8.5em; text-align: left; color: var(--texte-doux); font-family: "Segoe UI", system-ui, sans-serif; }
.ligne-alpha.clair span:not(.etiquette-alpha) { color: var(--or); font-weight: 700; }
.ligne-alpha.clair.argent span:not(.etiquette-alpha) { color: #c9d6e3; }
/* Jour 3 : deux roues, deux couleurs (une lettre sur deux) */
.parchemin.deux-cles .or { color: #7a4f00; background: rgba(233, 196, 106, 0.45); border-radius: 2px; }
.parchemin.deux-cles .argent { color: #33404e; background: rgba(160, 178, 196, 0.4); border-radius: 2px; }
.reglage.or label { color: #f5c542; }
.reglage.argent label { color: #d5dde6; }
.reglage.or .curseur { accent-color: #e9c46a; }
.reglage.argent .curseur { accent-color: #b8c4d0; }
.parchemin {
  white-space: pre-wrap;
  word-break: break-word;
  background: linear-gradient(160deg, #f6ecd2, #e5d3a6);
  color: #3b2a12;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  font-size: 1.02rem;
  line-height: 1.7;
  box-shadow: inset 0 0 30px rgba(120, 80, 20, 0.25);
  letter-spacing: 0.04em;
}
/* Jour 3 : la vraie roue (une clé) : la lettre reste chiffrée, on touche une lettre pour la repérer dans la roue */
.parchemin-roue .lc { cursor: pointer; border-radius: 3px; }
.parchemin-roue .lc:hover { background: rgba(214, 160, 40, 0.3); }
.parchemin-roue .lc.choisie { background: #f5c542; color: #2a1a05; }
.parchemin-roue .mot-souligne { text-decoration: underline 2px #c0392b; text-underline-offset: 0.3em; font-weight: 700; }
.reglage.reglage-roue { display: block; }
.alphabet-roue { display: flex; flex-wrap: wrap; gap: 0.2rem 0.12rem; margin: 0.6rem 0; font-family: var(--mono); font-size: 0.85rem; }
.alphabet-roue .col-roue, .alphabet-roue .col-etiquettes { display: flex; flex-direction: column; }
.alphabet-roue .col-roue { min-width: 1.5em; text-align: center; border-radius: 4px; cursor: pointer; }
.alphabet-roue .col-roue span { padding: 0.12em 0; }
.alphabet-roue .col-roue .bas { color: var(--or); font-weight: 700; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.alphabet-roue .col-roue:hover { background: rgba(255, 255, 255, 0.08); }
.alphabet-roue .col-roue.choisie { background: rgba(245, 197, 66, 0.3); outline: 2px solid var(--or); outline-offset: -2px; }
.alphabet-roue .col-etiquettes { margin-right: 0.4rem; color: var(--texte-doux); font-family: "Segoe UI", system-ui, sans-serif; font-size: 0.8rem; }
.alphabet-roue .col-etiquettes span { padding: 0.12em 0; line-height: 1.55; }
.lecture-roue { min-height: 1.6em; margin: 0.2rem 0 0.5rem; font-size: 0.95rem; }

/* Jour 4 : couleurs */
.nuancier { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 0.6rem 0; }
.pastille { display: flex; flex-direction: column; align-items: center; font-size: 0.8rem; gap: 0.15rem; }
.pastille .rond { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); }
.atelier-peinture { display: flex; align-items: center; justify-content: center; gap: 1.4rem; flex-wrap: wrap; margin-top: 0.8rem; }
.boule-apercu {
  --teinte: #4a5568;
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 32%), var(--teinte);
  box-shadow: inset -10px -14px 24px rgba(0, 0, 0, 0.35), 0 0 30px color-mix(in srgb, var(--teinte) 60%, transparent);
  transition: background-color 0.3s;
  margin-top: 14px;
}
.boule-apercu .attache { position: absolute; top: -14px; left: 50%; width: 22px; height: 16px; transform: translateX(-50%); background: linear-gradient(#e9d8a6, #b89b55); border-radius: 4px 4px 2px 2px; }
.detail-rvb { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.95rem; max-width: 300px; }

/* Jour 5 : portes logiques */
.memo-portes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.4rem; font-size: 0.86rem; margin-bottom: 1rem; }
.memo-portes div { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 0.35rem 0.6rem; }
.interrupteurs { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
.interrupteur { font: inherit; color: var(--texte); cursor: pointer; background: #0a1a2f; border: 2px solid var(--bord); border-radius: 14px; padding: 0.5rem 0.9rem; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; min-width: 70px; }
.interrupteur .levier { width: 34px; height: 54px; border-radius: 10px; background: #2b3a4d; position: relative; }
.interrupteur .levier::after { content: ""; position: absolute; left: 4px; right: 4px; height: 22px; bottom: 4px; border-radius: 7px; background: #9aa8b8; transition: bottom 0.2s, background 0.2s; }
.interrupteur.on { border-color: #51e08a; }
.interrupteur.on .levier::after { bottom: 28px; background: #51e08a; box-shadow: 0 0 12px #51e08a; }
.interrupteur b { font-size: 1.2rem; }
.interrupteur .etat { font-family: var(--mono); color: var(--texte-doux); }
.circuit { display: grid; gap: 0.5rem; max-width: 520px; margin: 0 auto; }
.porte-logique { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 2.4rem; align-items: center; gap: 0.6rem; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--bord); border-radius: 12px; padding: 0.5rem 0.8rem; }
.porte-logique code { background: none; white-space: pre-wrap; }
@media (max-width: 480px) { .porte-logique { grid-template-columns: 3.2rem minmax(0, 1fr) 2rem; gap: 0.4rem; padding: 0.5rem 0.6rem; } }
.lampe { width: 22px; height: 22px; border-radius: 50%; background: #2b3645; border: 2px solid rgba(255, 255, 255, 0.2); justify-self: end; transition: background 0.2s, box-shadow 0.2s; }
.lampe.on { background: #ffd23f; box-shadow: 0 0 14px 4px rgba(255, 210, 63, 0.6); }
.porte-logique.sortie { border-color: rgba(245, 197, 66, 0.5); }
.etoile-circuit { font-size: 2rem; line-height: 1; color: #3d4757; justify-self: end; transition: color 0.3s, text-shadow 0.3s; }
.etoile-circuit.on { color: var(--or); text-shadow: 0 0 18px var(--or); }

/* Jour 6 : tri */
.compteur { text-align: center; margin: 0.4rem 0 0.8rem; }
.rangee-tri { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.2rem; margin: 0.6rem 0; }
.colis { display: flex; flex-direction: column; align-items: center; background: linear-gradient(160deg, #a52a3a, #6d1622); border: 2px solid #f5c542; border-radius: 10px; padding: 0.4rem 0.5rem; min-width: 60px; }
.colis .emoji { font-size: 1.7rem; }
.colis .poids { font-family: var(--mono); font-weight: 700; font-size: 0.9rem; }
.colis.bouge { animation: bouge 0.35s; }
@keyframes bouge { 50% { transform: translateY(-8px); } }
.echange { font: inherit; cursor: pointer; background: rgba(255, 255, 255, 0.08); color: var(--or); border: 1px solid var(--bord); border-radius: 50%; width: 2rem; height: 2rem; font-weight: 700; }
.echange:hover:not(:disabled) { background: rgba(245, 197, 66, 0.25); }
.echange:disabled { opacity: 0.3; cursor: default; }
/* Jour 6 : entre deux paquets, le résultat de la pesée, la balance et l'échange, empilés */
.ecart-tri { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.signe-tri { font-family: var(--mono); font-weight: 800; font-size: 1.2rem; line-height: 1.2; min-width: 1.4em; text-align: center; color: var(--texte-doux); }
.signe-tri.bon { color: #5ad18a; }
.signe-tri.mauvais { color: #ff6b6b; }
.balance .echange { width: 1.9rem; height: 1.9rem; font-size: 0.95rem; padding: 0; }

/* Jour 7 : dichotomie */
.rue { margin: 0.6rem 0 1rem; }
.rue-barre { position: relative; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.rue-zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #f5c542, #ffdf80); border-radius: 999px; transition: left 0.4s, width 0.4s; }
.rue-legende { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--texte-doux); margin-top: 0.25rem; gap: 0.5rem; }
.ligne-form { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.champ-nombre { width: 10rem; font-size: 1.05rem; }
.journal { columns: 2; max-width: 520px; margin: 0.8rem auto; font-family: var(--mono); font-size: 0.9rem; }
@media (max-width: 480px) { .journal { columns: 1; } }

/* Jour 8 : graphe */
.cadre-carte { background: radial-gradient(ellipse at center, #1a3d63, #0c2038); border-radius: 14px; border: 1px solid var(--bord); padding: 0.4rem; }
.carte { width: 100%; height: auto; display: block; }
.arete line { stroke: rgba(255, 255, 255, 0.35); stroke-width: 4; stroke-linecap: round; transition: stroke 0.3s; }
.arete.choisie line { stroke: var(--or); stroke-width: 6; }
.pastille-poids { fill: #0b1a2e; stroke: rgba(255, 255, 255, 0.5); stroke-width: 1.5; }
.arete.choisie .pastille-poids { stroke: var(--or); }
.arete .poids { fill: #fff; font-weight: 700; font-size: 14px; font-family: "Segoe UI", system-ui, sans-serif; }
.noeud { cursor: pointer; }
.noeud circle { fill: #183a5e; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2.5; transition: fill 0.2s, stroke 0.2s; }
.noeud .emoji { font-size: 22px; pointer-events: none; }
.noeud .nom { fill: #e7f0fb; font-size: 13px; font-weight: 600; pointer-events: none; paint-order: stroke; stroke: #0b1a2e; stroke-width: 4px; font-family: "Segoe UI", system-ui, sans-serif; }
.noeud.accessible circle { stroke: #51e08a; stroke-dasharray: 5 4; animation: tourne 6s linear infinite; }
@keyframes tourne { to { stroke-dashoffset: -90; } }
.noeud.dans-chemin circle { fill: #7a5a00; stroke: var(--or); }
.noeud.actuel circle { fill: #d6a10f; }
.noeud:focus { outline: none; }
.noeud:focus-visible circle { stroke: #fff; stroke-width: 4; }
.trajet { text-align: center; margin: 0.7rem 0 0.3rem; }
.trajet small { color: var(--texte-doux); }

/* Jour 9 : Koch */
.toile-koch { width: min(100%, 420px); height: auto; aspect-ratio: 1; background: radial-gradient(circle, #1c4670, #0a1c33); border-radius: 50%; }

/* Jour 10 / 13 : brouillons */
.case-suivi { width: 6rem; font: inherit; text-align: center; background: #0a1a2f; color: var(--texte); border: 1px solid var(--bord); border-radius: 6px; padding: 0.2rem; }
.case-suivi.petite { width: 2.6rem; }
.suivi th { font-size: 0.82rem; }

/* Jour 11 */
.operations { columns: 2; max-width: 520px; padding-left: 1.6rem; }
.operations li { margin: 0.15rem 0; break-inside: avoid; }

/* Jour 16 : pixels et compression (RLE) */
.atelier-pixels { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 640px) { .atelier-pixels { grid-template-columns: 1fr; } }
.codes-rle { font-size: 0.85rem; padding-left: 1.6rem; margin: 0; }
.codes-rle li { margin: 0.15rem 0; }
.codes-rle code { word-break: break-all; }
.grille-pixels { display: grid; gap: 2px; background: #2b3a4d; padding: 2px; border-radius: 6px; touch-action: none; user-select: none; max-width: 520px; margin: 0 auto; }
.pixel { aspect-ratio: 1; background: #f4f7fb; cursor: crosshair; border-radius: 1px; }
.pixel:hover { outline: 2px solid var(--or); outline-offset: -2px; }
.pixel.rouge { background: #d62839; }
.pixel.vert { background: #1f8a4c; }
.zone-grille .centre { margin-top: 0.4rem; }
/* … version en couleurs (l'affiche de Kryos) : palette, lignes justes cochées, ligne survolée */
.grille-affiche { max-width: 340px; gap: 1px; padding: 1px; }
.palette-pixels { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 0.9rem; }
.couleur-palette { display: inline-flex; align-items: center; gap: 0.35rem; font: inherit; font-size: 0.9rem; padding: 0.3rem 0.65rem; border-radius: 999px; border: 2px solid var(--bord); background: rgba(255, 255, 255, 0.06); color: var(--texte); cursor: pointer; }
.couleur-palette[aria-pressed="true"] { border-color: var(--or); background: rgba(232, 185, 35, 0.2); }
.couleur-palette .pastille { width: 1.1rem; height: 1.1rem; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.55); }
.codes-couleurs li { border-radius: 4px; padding: 0 0.25rem; }
.codes-couleurs li.survol { background: rgba(232, 185, 35, 0.22); }
.codes-couleurs .coche { visibility: hidden; margin-left: 0.4rem; color: #3ddc84; font-weight: 700; }
.codes-couleurs li.juste .coche { visibility: visible; }
.codes-couleurs li.juste code { color: #7dffae; }
.zone-grille .bilan-tests { text-align: center; margin: 0.5rem 0 0; }
.ligne-courante { max-width: 340px; margin: 0 auto 0.4rem; min-height: 1.6em; font-size: 0.85rem; text-align: center; }
.ligne-courante code { word-break: break-all; }
.ligne-courante .coche { color: #3ddc84; font-weight: 700; }

/* Jour 13 : code-barres */
.code-barres { width: min(100%, 360px); height: auto; margin: 0.4rem auto; display: block; border-radius: 6px; }
.tache-neige { filter: blur(1px); }
.calcul-ean th, .calcul-ean td { padding: 0.3rem 0.35rem; min-width: 2.4rem; }
.calcul-ean td.inconnu { background: rgba(74, 163, 255, 0.25); font-weight: 700; }
.calcul-ean td.cle { background: rgba(245, 197, 66, 0.25); }
.etiquette-colis { text-align: center; font-family: var(--mono); font-size: 1.35rem; letter-spacing: 0.05em; background: #f4f0e6; color: #222; padding: 0.8rem; border-radius: 8px; border: 2px dashed #a58b5a; margin: 0.6rem auto; max-width: 480px; }
.etiquette-colis.binaire { max-width: 620px; font-size: 1.05rem; letter-spacing: 0.02em; line-height: 1.7; word-spacing: 0.15em; }
/* Jour 13 : trois étiquettes côte à côte ; jour 17 : deux tables côte à côte */
.etiquettes-ean { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; margin: 0.6rem 0; }
.etiquette-ean { flex: 1 1 200px; max-width: 260px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 10px; padding: 0.5rem; text-align: center; }
.etiquette-ean .code-barres { width: 100%; height: auto; }
.etiquette-ean-titre { margin-bottom: 0.3rem; }
.calcul-ean .ligne-chiffres td { font-family: var(--mono); font-weight: 700; }
.deux-tables { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: flex-start; }
.deux-tables > div { flex: 1 1 260px; min-width: 0; }

/* Jour 14 : paquets */
.paquets { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 0.4rem 0 1rem; }
.paquet { font: inherit; color: var(--texte); cursor: pointer; display: flex; flex-direction: column; align-items: center; background: linear-gradient(160deg, #6b4a1f, #43300f); border: 2px solid #c9a35a; border-radius: 10px; padding: 0.4rem 0.7rem; min-width: 84px; transition: transform 0.15s, opacity 0.2s; }
.paquet:hover:not(:disabled) { transform: translateY(-3px); }
.paquet:disabled { opacity: 0.3; cursor: default; }
.entete-paquet { font-size: 0.72rem; color: #f3dfb4; }
.entete-paquet code { background: rgba(0, 0, 0, 0.3); }
.donnees { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; white-space: pre; }
/* Les paquets scellés : le numéro binaire en grand, un colis à la place des données */
.paquet.scelle { gap: 0.15rem; }
.seq-paquet { font-family: var(--mono); font-size: 1.3rem; font-weight: 700; letter-spacing: 0.08em; background: rgba(0, 0, 0, 0.3); padding: 0 0.3rem; border-radius: 4px; }
.sceau-paquet { font-size: 1.3rem; line-height: 1.2; }
.reassemblage { text-align: center; padding: 0.7rem; background: rgba(0, 0, 0, 0.25); border-radius: 10px; font-size: 1.1rem; min-height: 3rem; }

/* Jour 12 : le code Morse (bande de papier, tableau, manipulateur ; le voyant change de couleur, sans animation) */
.recepteur-morse { border: 2px solid var(--bord); border-radius: 12px; padding: 0.7rem 0.8rem; background: rgba(255, 255, 255, 0.04); margin: 0.5rem 0 0.9rem; }
.voyant-morse { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; background: #3a4a3e; border: 2px solid #1d2a20; vertical-align: -0.08em; }
.voyant-morse.allume { background: #ffe066; border-color: #fff3b0; box-shadow: 0 0 10px #ffd23f; }
.bande-morse { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.4rem; background: #fff8e6; color: #3a2508; border-radius: 6px; padding: 0.7rem 0.8rem 0.4rem; margin: 0.5rem 0 0.7rem; box-shadow: inset 0 0 14px rgba(120, 80, 20, 0.2); }
.groupe-morse { display: flex; flex-direction: column; align-items: center; min-width: 2.6rem; border-radius: 6px; padding: 0.1rem 0.35rem; border: 1px dashed #c9a86a; background: rgba(120, 80, 20, 0.06); color: inherit; font: inherit; cursor: pointer; }
.groupe-morse:hover { background: rgba(245, 197, 66, 0.25); }
.groupe-morse:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
.groupe-morse b { font-family: var(--mono); font-size: 1.45rem; letter-spacing: 0.12em; line-height: 1.3; white-space: nowrap; }
.groupe-morse small { font-size: 0.72rem; color: #8a6a3a; }
.groupe-morse.joue { background: rgba(245, 197, 66, 0.45); }
.table-morse { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); gap: 0.3rem; margin: 0.4rem 0 0.9rem; }
.case-morse { display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0.5rem; border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
.case-morse b { color: var(--or); min-width: 1em; }
.case-morse span { font-family: var(--mono); letter-spacing: 0.08em; white-space: nowrap; }
.manip-morse { border: 2px solid var(--bord); border-radius: 12px; padding: 0.7rem 0.8rem; background: rgba(255, 255, 255, 0.04); }
.ligne-manip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1rem; margin: 0.5rem 0; }
.touche-morse { flex: 0 0 auto; width: 5.5rem; height: 5.5rem; border-radius: 50%; border: 4px solid #6b4a2b; background: radial-gradient(circle at 40% 35%, #f0c879, #b9823a); color: #3a2010; font: inherit; font-weight: 700; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: 0 5px 0 #5a3418; transition: transform 0.05s, box-shadow 0.05s; }
.touche-morse.enfoncee { transform: translateY(4px); box-shadow: 0 1px 0 #5a3418; }
.touche-morse:focus-visible { outline: 3px solid var(--or); outline-offset: 3px; }
.cote-manip { flex: 1 1 12rem; min-width: 0; }
.encours-morse { font-size: 1.3rem; letter-spacing: 0.12em; color: var(--or); }
.boutons-manip { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tape-morse { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 3rem; align-items: center; padding: 0.4rem; border-radius: 8px; background: rgba(0, 0, 0, 0.2); }
.lettre-tapee { display: flex; flex-direction: column; align-items: center; min-width: 2.2rem; padding: 0.1rem 0.3rem; border-radius: 6px; background: rgba(255, 255, 255, 0.07); }
.lettre-tapee b { font-family: var(--mono); font-size: 1.3rem; }
.lettre-tapee small { font-family: var(--mono); font-size: 0.7rem; color: var(--texte-doux); white-space: nowrap; }
.lettre-tapee.inconnue b { color: #ff9a9a; }
@media (prefers-reduced-motion: reduce) { .touche-morse { transition: none; } }

/* Codes HTTP (version simple : jour 15 sur la branche dev) */
.legende-http { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.3rem 1rem; font-size: 0.88rem; margin-bottom: 1rem; }
.legende-http code { color: var(--or); font-weight: 700; }
.situations { padding-left: 1.6rem; }
.situations li { margin: 0.55rem 0; }
.situations li span { margin-right: 0.5rem; }
.situations select { font: inherit; font-size: 0.95rem; background: #0a1a2f; color: var(--texte); border: 2px solid var(--bord); border-radius: 8px; padding: 0.2rem 0.4rem; }

/* Jour 15 : regex (version simple) */
.motif { text-align: center; font-size: 1.35rem; margin: 0.6rem 0; }
.motif code { padding: 0.3em 0.7em; color: var(--or); }
.etiquettes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0.6rem 0; }
.etiquettes span { font-family: var(--mono); background: #f4f0e6; color: #222; padding: 0.3rem 0.7rem; border-radius: 6px 14px 14px 6px; border-left: 6px solid #d62839; font-size: 0.98rem; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 560px) { .deux-colonnes { grid-template-columns: 1fr; } }
.resultats-regex { list-style: none; padding: 0; margin: 0.4rem 0; font-size: 0.92rem; }
.resultats-regex li { padding: 0.12rem 0; }
.resultats-regex li.ok code { background: rgba(32, 191, 107, 0.2); }

/* Jour 18 : débogage */
.code-cliquable { background: #081425; border: 1px solid var(--bord); border-radius: 12px; padding: 0.5rem 0; }
.ligne-code { display: flex; width: 100%; gap: 1rem; align-items: center; font: inherit; text-align: left; background: none; border: 0; color: #d5e6ff; cursor: pointer; padding: 0.35rem 1rem; }
.ligne-code:hover { background: rgba(245, 197, 66, 0.12); }
.ligne-code .numero { font-family: var(--mono); color: #6f86a0; min-width: 1.4rem; text-align: right; }
.ligne-code code { background: none; white-space: pre; font-size: 0.95rem; }
.ligne-code.saine { background: rgba(32, 191, 107, 0.1); }
.ligne-code.bug { background: rgba(214, 40, 57, 0.3); box-shadow: inset 4px 0 0 #ff6b6b; }
/* Jour 18 : les lignes qu'on déplace (▲ ▼), et le tableau de ce que fait le robot */
.code-deplacable .ligne-code { cursor: default; }
.code-deplacable .ligne-code:hover { background: none; }
.code-deplacable .ligne-code.deplacable { background: rgba(245, 197, 66, 0.08); }
.boutons-ligne { margin-left: auto; display: flex; gap: 0.3rem; flex-shrink: 0; }
/* (sur téléphone, la ligne la plus longue et ses boutons ▲ ▼ doivent tenir dans l'écran) */
@media (max-width: 480px) {
  .code-deplacable .ligne-code { gap: 0.5rem; padding: 0.3rem 0.5rem; }
  .code-deplacable .ligne-code code { font-size: 0.8rem; }
  .code-deplacable .boutons-ligne { flex-direction: column; gap: 0.2rem; }
  .code-deplacable .btn-ligne { width: 1.8rem; height: 1.45rem; }
}
/* On fait glisser une ligne à sa place : à la souris par toute la ligne, au doigt par sa poignée ☰
   (sur un écran tactile, la poignée remplace ▲ ▼, gardés pour les lecteurs d'écran) */
.poignee-ligne { display: none; }
.code-deplacable .ligne-code[data-o] { transition: transform 0.15s ease; }
.code-deplacable .ligne-code.en-main {
  position: relative; z-index: 2; transition: none; cursor: grabbing;
  background: rgba(245, 197, 66, 0.22); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(245, 197, 66, 0.7);
}
@media (pointer: fine) { .code-deplacable .ligne-code.deplacable { cursor: grab; user-select: none; -webkit-user-select: none; } }
@media (pointer: coarse) {
  .code-deplacable .boutons-ligne { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .poignee-ligne {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: auto; width: 2.2rem; height: 1.9rem;
    border-radius: 8px; border: 1px solid rgba(245, 197, 66, 0.55); background: rgba(245, 197, 66, 0.12); color: var(--or); font-size: 1rem;
    touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  }
}
@media (pointer: coarse) and (max-width: 360px) { .poignee-ligne { width: 1.8rem; } }
@media (prefers-reduced-motion: reduce) { .code-deplacable .ligne-code[data-o] { transition: none; } }
/* (et sur un très petit téléphone, en anglais : « total = total + weights[i] » est plus long) */
@media (max-width: 360px) {
  .code-deplacable .ligne-code { gap: 0.35rem; padding: 0.3rem 0.35rem; }
  .code-deplacable .ligne-code .numero { min-width: 1rem; }
  .code-deplacable .ligne-code code { font-size: 0.74rem; }
}
.btn-ligne { font: inherit; font-size: 0.8rem; width: 2rem; height: 1.8rem; border-radius: 6px; border: 1px solid var(--bord); background: rgba(255, 255, 255, 0.08); color: var(--or); cursor: pointer; }
.btn-ligne:hover:not(:disabled) { background: rgba(245, 197, 66, 0.25); }
.btn-ligne:disabled { opacity: 0.3; cursor: default; }
.trace-debogage { margin-top: 0.6rem; }
.table-trace th { text-align: left; white-space: nowrap; }
.table-trace td { text-align: left; }
.sortie-robot { font-size: 1.05rem; margin: 0.5rem 0 0; }

/* Jour 19 : mots de passe */
.champ-mdp { width: 100%; font-family: var(--mono); font-size: 1.15rem; }
.jauge { height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); margin: 0.7rem 0; overflow: hidden; }
.jauge-remplissage { height: 100%; width: 0; background: linear-gradient(90deg, #d62839, #ff9f43); border-radius: 999px; transition: width 0.3s; }
.jauge-remplissage.fort { background: linear-gradient(90deg, #20bf6b, #7bed9f); }
.resultat-mdp { text-align: center; margin: 0.4rem 0; }
.criteres { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.2rem 1rem; font-size: 0.9rem; color: var(--texte-doux); }
.criteres li.ok { color: var(--texte); }

/* Jour 21 : phishing */
.boite-mail { display: grid; gap: 0.8rem; }
.courriel { background: #f3f6fa; color: #1c2533; border-radius: 12px; padding: 0.8rem 1rem; border: 2px solid transparent; transition: border-color 0.2s; }
.courriel code { background: rgba(0, 0, 0, 0.06); color: #1c2533; }
.entete-mail { font-size: 0.88rem; border-bottom: 1px solid #d5dce6; padding-bottom: 0.4rem; margin-bottom: 0.4rem; }
.courriel p { margin: 0.4rem 0; }
.lien-mail code { color: #0b57d0; text-decoration: underline; word-break: break-all; font-size: 1rem; background: none; }
.courriel .btn { color: #1c2533; background: #e2e8f0; border-color: #cbd5e0; }
.courriel.piege { border-color: #d62839; opacity: 0.85; }
.courriel.authentique { border-color: #20bf6b; box-shadow: 0 0 0 4px rgba(32, 191, 107, 0.25); }
.verdict { margin-top: 0.5rem; padding: 0.5rem 0.7rem; background: #ffe3e6; border-radius: 8px; font-size: 0.92rem; }
.courriel.authentique .verdict { background: #dff6e9; }
/* Jour 21 : les morceaux du nom du site, qu'on accuse un par un */
.morceau-lien { font: inherit; color: inherit; text-decoration: underline; background: rgba(11, 87, 208, 0.08); border: 1px dashed rgba(11, 87, 208, 0.45); border-radius: 4px; padding: 0.05rem 0.2rem; margin: 0.1rem 0; cursor: pointer; }
.morceau-lien:hover { background: rgba(11, 87, 208, 0.18); }
.morceau-lien:focus-visible { outline: 3px solid var(--or); outline-offset: 1px; }
.morceau-lien.accuse { background: #d62839; border-color: #d62839; color: #fff; }
.morceau-lien.innocent { background: rgba(32, 191, 107, 0.15); border-color: #20bf6b; color: #145a2c; text-decoration: none; }

/* Jour 22 : terminal */
.terminal { background: #050b06; border: 1px solid #1e5a2a; border-radius: 12px; padding: 0.8rem 1rem; font-family: var(--mono); font-size: 0.9rem; color: #7dff9b; box-shadow: inset 0 0 30px rgba(40, 255, 100, 0.08), 0 0 20px rgba(40, 255, 100, 0.08); cursor: text; }
.term-sortie { max-height: 340px; min-height: 160px; overflow-y: auto; scrollbar-color: #1e5a2a #050b06; }
.term-l { white-space: pre-wrap; word-break: break-word; }
.term-cmd { color: #d9ffe2; }
.term-erreur { color: #ff8a8a; }
.term-info { color: #59b56f; }
.term-ls { display: flex; flex-wrap: wrap; gap: 0.2rem 1.6rem; }
.term-ls .dossier { color: #64b5ff; font-weight: 700; }
.term-ls .fichier { color: #d9ffe2; }
.term-ligne { display: flex; align-items: center; }
.term-invite { color: #f5c542; white-space: pre; }
.term-champ { flex: 1; min-width: 0; font: inherit; background: none; border: 0; color: #d9ffe2; outline: none; caret-color: #7dff9b; padding: 0.15rem 0; }

/* Jour 24 : finale */
.inventaire { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.5rem; margin: 0.6rem 0 1rem; }
.carte-fragment { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; background: rgba(245, 197, 66, 0.1); border: 1px solid rgba(245, 197, 66, 0.4); border-radius: 10px; padding: 0.4rem; }
.carte-fragment small { color: var(--texte-doux); font-size: 0.72rem; }
.carte-fragment code { background: none; font-size: 0.9rem; letter-spacing: 0.05em; }
.carte-fragment b { font-size: 1.4rem; font-family: var(--mono); color: var(--or); }
.carte-fragment.vide { opacity: 0.45; border-style: dashed; background: none; }
/* =========================================================
   Les mini-jeux « à tester » (widgets-dur.js)
   ========================================================= */
/* Terminal : Kryos, les lutins, l'écran gelé, le dégel final */
.terminal { position: relative; }
.term-ok { color: #ffe08a; }
.term-kryos { color: #9fd8ff; font-weight: 700; }
.term-kryos-rm { color: #ff9a9a; font-size: 0.85em; }
.term-lutins { color: #ffd36b; }
.term-voile {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; border-radius: inherit;
  background: var(--texture-givre) 0 0 / 160px 160px, rgba(190, 230, 255, 0.85); color: #0b2a44; font-weight: 800; font-size: 1.15rem; text-align: center;
  opacity: 0; visibility: hidden; transition: opacity 0.35s, visibility 0s 0.35s; pointer-events: none;
}
.terminal.gele .term-voile { opacity: 1; visibility: visible; transition: opacity 0.25s; }
.terminal.duel { border-color: #2a4f7a; box-shadow: inset 0 0 30px rgba(80, 160, 255, 0.1); }
.terminal.duel .term-sortie { max-height: 430px; }
.terminal.degele { border-color: #c9a227; box-shadow: inset 0 0 30px rgba(255, 210, 90, 0.16); }
.terminal.fige .term-ligne { opacity: 0.4; }

/* Jour 2 : l'étiquette et l'imprimante en mode test */
.etiquette-octets, .ticket-imprime { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin: 0.5rem 0; }
.octet-etiquette, .octet-imprime { display: flex; flex-direction: column; align-items: center; padding: 0.2rem 0.4rem; border-radius: 8px; border: 2px solid #a58b5a; background: #f4f0e6; color: #1e3a5f; font-family: var(--mono); }
.octet-etiquette small { font-size: 0.65rem; color: #7a6a4a; }
.octet-etiquette code, .octet-imprime code { background: none; padding: 0; font-size: 0.85rem; color: inherit; }
.octet-imprime { background: rgba(255, 255, 255, 0.06); border-color: var(--bord); color: var(--texte); }
.octet-imprime b { font-size: 1.05rem; color: var(--or); }
.imprimante { margin-top: 0.8rem; padding: 0.7rem; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--bord); }
.imprimante > .petit { margin-top: 0; }

/* Jour 5 : le schéma de l'alarme et le tableau de tests */
.cadre-circuit { margin: 0.5rem 0; }
.schema-circuit { display: block; width: 100%; max-width: 640px; margin: 0 auto; font-family: var(--mono); }
.legende-circuit { display: none; flex-wrap: wrap; justify-content: center; gap: 0.2rem 0.9rem; margin: 0 0 0.6rem; }
@media (max-width: 560px) { .legende-circuit { display: flex; } .schema-circuit .legende-capteur { display: none; } .schema-circuit text { font-size: 17px; } }
.schema-circuit .fil { fill: none; stroke: #3a4656; stroke-width: 4; stroke-linejoin: round; transition: stroke 0.2s; }
.schema-circuit .fil.on { stroke: #ffd23f; }
.schema-circuit text { fill: #e8eef6; text-anchor: middle; font-size: 15px; font-weight: 700; }
.schema-circuit .emoji { font-size: 18px; }
.schema-circuit .lettre { font-size: 16px; }
.schema-circuit .lettre-petite, .schema-circuit .num-porte { font-size: 11px; }
.schema-circuit .num-porte, .schema-circuit .legende-capteur { fill: var(--texte-doux); font-weight: 400; }
.schema-circuit .legende-capteur { font-size: 10px; }
.schema-circuit .capteur, .schema-circuit .porte-schema { cursor: pointer; outline: none; }
.schema-circuit .capteur rect, .schema-circuit .cloche-alarme rect { fill: #1b2532; stroke: rgba(255, 255, 255, 0.25); stroke-width: 2; }
.schema-circuit .capteur.on rect { fill: #4a3f10; stroke: #ffd23f; }
.schema-circuit .porte-schema rect { fill: #24364d; stroke: #64b5ff; stroke-width: 2; }
.schema-circuit .porte-schema.non rect { stroke: #ff9f43; }
.schema-circuit .capteur:focus-visible rect, .schema-circuit .porte-schema:focus-visible rect { stroke: #fff; stroke-width: 3; }
.schema-circuit .cloche-alarme.on rect { fill: #5a1520; stroke: #ff5a6e; }
.tests-circuit { margin-top: 0.6rem; }
.bilan-tests { text-align: center; font-weight: 700; color: #ffb3bd; margin: 0.4rem 0; }
.bilan-tests.tous { color: #7dffa0; }
.table-tests tr.ok td, .table-neurone tr.ok td { background: rgba(63, 191, 106, 0.1); }
.table-tests tr.rate td, .table-neurone tr.rate td { background: rgba(255, 90, 110, 0.15); }

/* Jour 9 : la banquise et l'éditeur de programme */
.atelier-robot { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 760px) { .atelier-robot { grid-template-columns: 1fr; } }
.grille-robot { display: block; width: 100%; max-width: 430px; margin: 0 auto; }
.case-glace { fill: #cfe9fb; }
.case-glace.b { fill: #b9dcf3; }
.emoji-grille { font-size: 30px; text-anchor: middle; }
.cadeau { transition: opacity 0.25s; }
.cadeau.pris { opacity: 0; }
.robot-lutin { transition: transform 0.28s ease-in-out; }
.robot-lutin .corps { fill: rgba(255, 255, 255, 0.7); stroke: #2a6fb0; stroke-width: 2; }
.robot-lutin .emoji-grille { font-size: 24px; }
.robot-lutin .fleche { fill: #d62839; transition: transform 0.2s; }
.robot-lutin.secoue .corps { stroke: #d62839; stroke-width: 3; }
.boom { font-size: 34px; opacity: 0; pointer-events: none; }
.boom.visible { opacity: 1; }
.editeur-robot { width: 100%; font-size: 0.95rem; line-height: 1.5; background: #0a1a2f; color: #d9ffe2; border: 1px solid var(--bord); border-radius: 10px; padding: 0.6rem 0.7rem; resize: vertical; tab-size: 2; }
.palette-robot { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.4rem 0; }
.palette-robot .btn { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.boutons-robot { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.4rem 0; }
.compteur-lignes { font-family: var(--mono); color: #7dffa0; }
.compteur-lignes.trop { color: #ff8a8a; }
.etat-robot { min-height: 1.4em; }
.etat-robot.erreur { color: #ff9a9a; }
.etat-robot.ok { color: #7dffa0; font-weight: 700; }

/* Jour 11 : la cuisine, l'assiette (pile) et le passe-plat (file) */
.cuisine-crepes { display: flex; flex-direction: column; gap: 0.6rem; }
.zone-crepes { background: rgba(0, 0, 0, 0.2); border: 1px solid var(--bord); border-radius: 12px; padding: 0.5rem 0.7rem; }
.zone-crepes > .petit { margin: 0 0 0.35rem; }
.deux-rangements { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 520px) { .deux-rangements { grid-template-columns: 1fr; } }
.file-crepes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; min-height: 2rem; }
.assiette-crepes { display: flex; justify-content: center; }
.pile-crepes { display: flex; flex-direction: column-reverse; align-items: center; min-width: 8rem; min-height: 2rem; padding-bottom: 0.35rem; border-bottom: 5px solid #e9e4d8; border-radius: 0 0 50% 50% / 0 0 40% 40%; }
.crepe { display: inline-flex; align-items: center; justify-content: center; width: 3.2rem; height: 1.6rem; border-radius: 50%; background: #e8b562; color: #4a2a0a; font-weight: 800; font-family: var(--mono); box-shadow: inset 0 -3px 0 #c98a3a; }
.pile-crepes .crepe + .crepe { margin-bottom: -0.2rem; }
.crepe.prochaine, .crepe.dessus, .crepe.premier { outline: 2px solid var(--or); outline-offset: 2px; }
.boutons-crepes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.mot-servi { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.lettre-servie { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2.4rem; border-radius: 8px; border: 2px dashed var(--bord); font-family: var(--mono); font-weight: 800; font-size: 1.2rem; color: var(--texte-doux); }
.lettre-servie.bonne { border: 2px solid #3fbf6a; color: #7dffa0; background: rgba(63, 191, 106, 0.12); }
.lettre-servie.fausse { border: 2px solid #ff5a6e; color: #ffb3bd; background: rgba(255, 90, 110, 0.14); }

/* Jour 15 : la trieuse d'étiquettes */
.deux-colonnes-tri { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 0.6rem 0; }
@media (max-width: 560px) { .deux-colonnes-tri { grid-template-columns: 1fr; } }
.liste-tri { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.liste-tri li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.6rem; border-radius: 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); }
.liste-tri li.juste { border-color: rgba(63, 191, 106, 0.6); background: rgba(63, 191, 106, 0.1); }
.liste-tri li.faux { border-color: rgba(255, 90, 110, 0.7); background: rgba(255, 90, 110, 0.12); }
.liste-tri .verdict { font-size: 0.82rem; color: var(--texte-doux); white-space: nowrap; }
.erreur-motif { color: #ff9a9a; }

/* Jour 17 : la console SQL */
.console-sql .term-sortie { max-height: 430px; }
.sql-ligne { display: flex; align-items: flex-start; gap: 0.4rem; margin-top: 0.3rem; }
.sql-ligne .term-invite { padding-top: 0.25rem; }
.sql-champ { resize: vertical; min-height: 2.4rem; line-height: 1.4; }
.sql-executer { padding: 0.3rem 0.8rem; }
.table-sql { margin: 0.3rem 0; color: #d9ffe2; font-size: 0.85rem; }
.table-sql th { color: #f5c542; }

/* Jour 19 : le profil Kèrebook et l'attaque par force brute */
.kerebook { max-width: 560px; margin: 0.5rem auto; border-radius: 14px; overflow: hidden; background: #f0f2f5; color: #1c1e21; font-family: system-ui, "Segoe UI", sans-serif; }
.kb-couverture { height: 70px; padding: 0.4rem 0.7rem; background: linear-gradient(120deg, #1d3c6e, #6ec3f4); }
.kb-logo { color: #fff; font-weight: 800; font-size: 1.1rem; }
.kb-identite { display: flex; gap: 0.7rem; align-items: center; padding: 0 0.8rem 0.6rem; margin-top: -24px; }
.kb-avatar { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex: none; border-radius: 50%; background: #fff; border: 3px solid #fff; font-size: 2rem; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.kb-identite b { display: block; margin-top: 18px; font-size: 1.05rem; }
.kb-identite small, .kb-post header small, .kb-post footer, .kb-fil > .petit { color: #65676b; }
.kb-fil { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.4rem 0.6rem 0.8rem; }
.kb-fil > .petit { margin: 0; }
.kb-post { background: #fff; border-radius: 10px; padding: 0.6rem 0.7rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.kb-post header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.3rem; }
.kb-post header b { display: block; font-size: 0.9rem; }
.kb-post header small { font-size: 0.75rem; }
.kb-mini { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: #e4e6eb; font-size: 1.1rem; }
.kb-post p { margin: 0.2rem 0; }
.kb-image { margin: 0.3rem 0; padding: 0.4rem; border-radius: 8px; background: #e7f3ff; font-size: 2.6rem; text-align: center; }
.kb-post footer { margin-top: 0.4rem; padding-top: 0.3rem; border-top: 1px solid #e4e6eb; }
.kb-commentaire { margin-top: 0.3rem; padding: 0.3rem 0.6rem; border-radius: 12px; background: #f0f2f5; font-size: 0.88rem; }
.kb-attaque { max-width: 560px; margin: 0.8rem auto; text-align: center; }
.kb-force { margin-top: 0.5rem; }
.kb-compteur { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 8px; background: #050b06; color: #7dff9b; font-size: 1.3rem; letter-spacing: 0.12em; }
.kb-abandon { color: #ffb3bd; font-weight: 700; }

/* Jour 20 : les lettres, la machine à empreintes, le registre */
.lettres-matin { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.lettre-enfant { display: flex; flex-direction: column; justify-content: space-between; gap: 0.4rem; padding: 0.6rem 0.7rem; border-radius: 10px; background: #f8f1e0; color: #3b2a14; font-family: Georgia, serif; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); }
.lettre-enfant p { margin: 0; font-style: italic; }
.lettre-enfant .btn { align-self: flex-start; font-family: system-ui, sans-serif; font-style: normal; color: var(--texte); }
.machine-empreintes { margin: 0.6rem 0; padding: 0.7rem; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--bord); }
.machine-empreintes > .petit { margin-top: 0; }
.machine-texte { min-height: 4.5rem; resize: vertical; }
.machine-sortie p { margin: 0.3rem 0; }
.empreinte-courte { background: none; color: var(--or); font-size: 1.1rem; font-weight: 700; }
.empreinte-reste { background: none; color: var(--texte-doux); font-size: 0.75rem; word-break: break-all; }
.machine-sortie .ok { color: #7dffa0; font-weight: 700; }
.machine-sortie .non { color: #ffb3bd; font-weight: 700; }
.catalogue { columns: 2; margin: 0.3rem 0; padding-left: 1.1rem; }
.registre code { color: var(--or); }

/* Jour 23 : les réglages du neurone */
.reglages-neurone { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.4rem 1rem; margin: 0.4rem 0 0.8rem; }
.reglage { display: flex; align-items: center; gap: 0.4rem; }
.libelle-reglage { flex: 1; font-size: 0.9rem; }
.reglage .btn { width: 2rem; height: 2rem; padding: 0; font-weight: 800; }
.valeur-reglage { min-width: 2.2rem; text-align: center; font-family: var(--mono); font-weight: 800; font-size: 1.1rem; color: var(--or); }
.critere { opacity: 0.18; margin: 0 1px; }
.critere.oui { opacity: 1; }
.nouveaux-jouets { margin-top: 0.8rem; }
.cartes-nouveaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
.carte-nouveau { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.5rem; border-radius: 10px; border: 1px solid var(--bord); background: rgba(255, 255, 255, 0.04); text-align: center; }
.carte-nouveau.aime { border-color: #ff7a9a; background: rgba(255, 122, 154, 0.12); }
.carte-nouveau b { font-size: 0.85rem; }
.emoji-nouveau { font-size: 1.8rem; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Le chalet du Père Noël
   ========================================================= */
.scene { grid-template-columns: minmax(320px, 920px) minmax(220px, 330px); }
@media (max-width: 1100px) { .scene { grid-template-columns: 1fr; max-width: 920px; margin: 0 auto; } .bloc-sapin { position: static; } }
/* (pas de filter: drop-shadow sur tout le chalet : dès qu'une case bougeait, Firefox refaisait
   le flou de l'ombre sur toute la façade, à chaque image ; l'ombre est sur .facade, en box-shadow) */
.chalet { position: relative; width: 100%; }
.toit { position: relative; z-index: 2; margin: 0 -4% -1.2% -4%; }
.toit-svg { width: 100%; height: auto; display: block; overflow: visible; }
.facade {
  position: relative; padding: 0.6rem 1.1rem 0;
  background:
    linear-gradient(90deg, #2a170b 0 12px, transparent 12px calc(100% - 12px), #2a170b calc(100% - 12px)),
    repeating-linear-gradient(180deg, #7a4a25 0 20px, #6b3f1f 20px 24px, #5a3418 24px 26px);
  border-radius: 0 0 8px 8px; box-shadow: 0 24px 40px rgba(0, 0, 0, 0.55);
}
.facade::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(ellipse at 20% 0, rgba(0, 0, 0, 0.18), transparent 60%), repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 26px);
}
.niveau { position: relative; padding: 1.5rem 0.2rem 0.9rem; border-bottom: 12px solid #3a2010; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2); }
.niveau:last-child { border-bottom: 0; box-shadow: none; }
.nom-niveau {
  position: absolute; top: 0.3rem; left: 50%; transform: translateX(-50%); z-index: 1;
  font-family: var(--conte); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; color: #3a2508;
  padding: 0.05em 0.9em; border-radius: 6px; background: linear-gradient(180deg, #ffe7a3, #d9a93c); box-shadow: 0 2px 0 #8a6215;
}
.guirlande-niveau {
  position: absolute; left: 6px; right: 6px; top: 6px; height: 12px; opacity: 0.3;
  background:
    radial-gradient(circle, #ff5a5f 4px, transparent 5px) 0 0 / 52px 12px repeat-x,
    radial-gradient(circle, #ffd23f 4px, transparent 5px) 13px 0 / 52px 12px repeat-x,
    radial-gradient(circle, #3ddc84 4px, transparent 5px) 26px 0 / 52px 12px repeat-x,
    radial-gradient(circle, #4aa3ff 4px, transparent 5px) 39px 0 / 52px 12px repeat-x;
  transition: opacity 0.8s;
}
.niveau.complet .guirlande-niveau { opacity: 1; filter: drop-shadow(0 0 5px rgba(255, 230, 150, 0.9)); animation: guirlande-planche 1.6s steps(2) infinite; }
.niveau.complet { background: radial-gradient(ellipse at 50% 60%, rgba(255, 210, 120, 0.18), transparent 70%); }
.pieces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.7rem; }
@media (max-width: 700px) { .pieces { grid-template-columns: repeat(3, 1fr); gap: 0.55rem; } .facade { padding: 0.5rem 0.6rem 0; } }

.piece-chalet {
  position: relative; aspect-ratio: 4 / 3.2; padding: 0; margin: 0; cursor: pointer; overflow: hidden;
  border: 5px solid #2a170b; border-radius: 6px; background: #050a14; color: #fff; font: inherit;
  box-shadow: inset 0 0 0 2px #8a5a30, 0 4px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s, box-shadow 0.3s, border-color 0.3s;
}
.piece-scene, .piece-scene .decor-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Les 24 petits dessins de la façade restent immobiles : à cette taille, on ne voit pas leurs
   ampoules ni leurs flocons bouger, et Firefox redessinait les 24 dessins à chaque image
   (1 177 animations : la façade tombait à 2 images/s). La pièce s'anime une fois ouverte. */
.piece-scene * { animation: none !important; }
.piece-lueur { position: absolute; inset: 0; pointer-events: none; }
.piece-numero {
  position: absolute; top: 4px; left: 4px; z-index: 1; min-width: 1.6em; height: 1.6em; padding: 0 0.3em; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-family: var(--conte); font-weight: 700; font-size: 0.8rem;
  color: #3a2508; background: radial-gradient(circle at 35% 30%, #fff3c4, #e0a422); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.piece-etiquette {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0.9rem 0.3rem 0.25rem;
  font-size: 0.66rem; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8)); text-shadow: 0 1px 2px #000;
}
.piece-chalet.verrouillee, .piece-chalet.fermee { cursor: default; }
.piece-chalet.verrouillee .piece-numero, .piece-chalet.fermee .piece-numero { filter: grayscale(0.7) brightness(0.8); }
/* Le halo autour d'une case ouverte reste fixe (une ombre portée animée se redessine à chaque
   image, sur chacune des cases) ; c'est la lueur intérieure qui respire. */
.piece-chalet.disponible { border-color: #e0a422; z-index: 1; box-shadow: inset 0 0 0 2px #ffe7a3, 0 0 16px 4px rgba(245, 197, 66, 0.45); }
.piece-chalet.disponible .piece-lueur { box-shadow: inset 0 0 26px rgba(255, 214, 120, 0.65); animation: respire 2.2s ease-in-out infinite; }
.piece-chalet.resolue .piece-lueur { box-shadow: inset 0 0 18px rgba(255, 200, 110, 0.35); }
.piece-chalet.resolue .piece-etiquette { color: #fff3c4; }
.piece-chalet:not(.verrouillee):not(.fermee):hover, .piece-chalet:focus-visible { transform: scale(1.07); z-index: 3; }
.piece-chalet:focus { outline: none; }
.piece-chalet:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
.piece-24 { border-color: #c99410; }

.niveau.sous-sol {
  background:
    repeating-linear-gradient(0deg, transparent 0 26px, rgba(0, 0, 0, 0.25) 26px 28px),
    repeating-linear-gradient(90deg, #5b5f66 0 56px, #4a4e55 56px 58px);
  margin: 0 -1.1rem; padding-left: 1.3rem; padding-right: 1.3rem; padding-bottom: 1.2rem; border-radius: 0 0 10px 10px;
}
.niveau.sous-sol .nom-niveau { background: linear-gradient(180deg, #d5dce3, #9aa8b8); box-shadow: 0 2px 0 #5b6470; }
.sol-exterieur {
  position: relative; z-index: 2; height: 30px; margin: -4px -6% 0;
  background:
    radial-gradient(circle at 20px 0, #fff 20px, transparent 21px) 0 0 / 48px 30px repeat-x,
    linear-gradient(180deg, #fff 0 60%, #dfeaf7 60%);
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35);
}
@media (max-width: 700px) { .niveau.sous-sol { margin: 0 -0.6rem; padding-left: 0.8rem; padding-right: 0.8rem; } }

/* Les pièces animées */
.d-flamme { animation: flamme 0.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes flamme { from { transform: scaleY(0.88) skewX(-2deg); } to { transform: scaleY(1.08) skewX(2deg); } }
.d-lueur { animation: lueur-feu 1.4s ease-in-out infinite; }
@keyframes lueur-feu { 0%, 100% { opacity: 0.14; } 50% { opacity: 0.3; } }
.d-pendule { animation: pendule 1.6s ease-in-out infinite alternate; }
@keyframes pendule { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.d-flocon-geant { animation: tourne-lent 24s linear infinite; }
@keyframes tourne-lent { to { transform: rotate(360deg); } }
.d-volant { animation: tourne-lent 30s linear infinite; }
.d-convoyeur { animation: convoyeur 4s linear infinite; }
@keyframes convoyeur { from { transform: translateX(-40px); } to { transform: translateX(40px); } }
.d-curseur { animation: scintille 0.6s steps(2) infinite; }
.d-etoile-sapin { filter: drop-shadow(0 0 8px #f5c542); animation: respire 2.4s ease-in-out infinite; }
.d-spot { animation: lampe 3s ease-in-out infinite; }
.d-etoile-circuit { filter: drop-shadow(0 0 6px #f5c542); }

/* Entrer dans le chalet par une case du calendrier (js : entrerDansLeChalet) :
   1. approche : le chalet s'assombrit autour de la case, qui grandit jusqu'au milieu de l'écran et
      devient une porte de calendrier de l'Avent à deux battants, avec son numéro ;
   2. ouverte : les battants s'ouvrent vers l'intérieur, la lumière de la pièce passe ;
   3. passage : on franchit la porte, la lumière dorée remplit l'écran (la pièce s'affiche dessous) ;
   4. arrivée : la lumière se dissipe sur la pièce.
   Seuls transform et opacity bougent ; le dessin de la pièce, copié de la case, est figé. */
.entree-chalet { position: fixed; inset: 0; z-index: 30; overflow: hidden; pointer-events: auto; }
.ec-voile {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(3, 8, 16, 0.5) 0, rgba(3, 8, 16, 0.93) 42vmax);
}
.ec-cadre {
  position: absolute; container-type: size; transform-origin: 0 0; perspective: 1500px; will-change: transform;
  border-radius: 8px; background: #050a14; box-shadow: 0 0 0 0.9cqh #2a170b, 0 0 0 1.6cqh #c9a35a, 0 3cqh 7cqh rgba(0, 0, 0, 0.6);
  transition: transform 0.64s cubic-bezier(0.6, 0, 0.25, 1);
}
.entree-chalet.approche .ec-voile { opacity: 1; }
.entree-chalet.approche .ec-cadre { transform: none !important; }
.ec-piece { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.ec-piece svg { width: 100%; height: 100%; display: block; }
.ec-piece * { animation: none !important; }
.ec-lumiere {
  position: absolute; inset: 0; opacity: 0; border-radius: inherit; transition: opacity 0.6s ease 0.1s;
  background: radial-gradient(ellipse 55% 60% at 50% 55%, rgba(255, 244, 200, 0.9), rgba(255, 210, 110, 0.4) 55%, rgba(255, 190, 80, 0.05) 85%);
}
.entree-chalet.ouverte .ec-lumiere { opacity: 1; }
.ec-battant {
  position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; opacity: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.22)), var(--porte, #9b1b30);
  box-shadow: inset 0 0 0 0.8cqh rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease 0.12s, transform 0.62s cubic-bezier(0.55, 0, 0.3, 1);
}
.ec-battant.g { left: 0; transform-origin: 0 50%; border-radius: 6px 0 0 6px; }
.ec-battant.d { right: 0; transform-origin: 100% 50%; border-radius: 0 6px 6px 0; box-shadow: inset 0 0 0 0.8cqh rgba(0, 0, 0, 0.35), inset 0.5cqh 0 0 rgba(0, 0, 0, 0.3); }
.ec-moulure { position: absolute; inset: 11% 13%; border: 0.7cqh solid rgba(232, 196, 110, 0.65); border-radius: 1.2cqh; box-shadow: inset 0 0 2cqh rgba(0, 0, 0, 0.25); }
/* Le numéro, sur un médaillon d'or coupé en deux par la fente de la porte */
.ec-numero {
  position: absolute; top: 50%; width: 30cqh; height: 30cqh; margin-top: -15cqh; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font: 700 16cqh/1 var(--conte); color: #3a2508;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #e0a422 70%, #b07a12); box-shadow: 0 0.5cqh 1.6cqh rgba(0, 0, 0, 0.5), inset 0 0 0 0.7cqh rgba(255, 255, 255, 0.35);
}
.ec-battant.g .ec-numero { left: 100%; transform: translateX(-50%); }
.ec-battant.d .ec-numero { left: 0; transform: translateX(-50%); }
.ec-couronne {
  position: absolute; left: 50%; top: 5%; width: 15cqh; height: 15cqh; margin-left: -7.5cqh; border-radius: 50%; opacity: 0;
  border: 2.6cqh solid #1f7a4d; box-shadow: 0 0 0 0.4cqh #14532f, inset 0 0 0 0.4cqh #14532f; transition: opacity 0.3s ease 0.12s;
}
.entree-chalet.approche .ec-battant, .entree-chalet.approche .ec-couronne { opacity: 1; }
.entree-chalet.ouverte .ec-couronne { opacity: 0; transition-delay: 0s; transition-duration: 0.15s; }
/* Les battants s'ouvrent vers l'intérieur de la pièce (presque de profil, pour ne jamais montrer leur dos) */
.entree-chalet.ouverte .ec-battant.g { transform: rotateY(86deg); }
.entree-chalet.ouverte .ec-battant.d { transform: rotateY(-86deg); }
/* On passe la porte : elle grandit autour de nous, la lumière dorée envahit tout */
.entree-chalet.passage .ec-cadre { transform: translate(-70%, -70%) scale(2.4) !important; transition: transform 0.5s cubic-bezier(0.6, 0, 0.9, 0.5); }
.ec-flash {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.38s ease-in;
  background: radial-gradient(circle at 50% 50%, #fffbe8 0, #ffeab0 40%, #ffd98a 100%);
}
.entree-chalet.passage .ec-flash { opacity: 1; }
.entree-chalet.arrivee { pointer-events: none; }
.entree-chalet.arrivee .ec-voile, .entree-chalet.arrivee .ec-cadre { opacity: 0; transition: opacity 0.15s; }
.entree-chalet.arrivee .ec-flash { opacity: 0; transition: opacity 0.6s ease-out; }
/* La case d'où l'on entre (sa copie a pris sa place), la case fermée qu'on secoue, la case réparée
   qui s'illumine au retour, et la case du jour qui brille à l'arrivée au chalet */
.piece-chalet.on-y-entre { visibility: hidden; }
.piece-chalet.secouee { animation: case-secouee 0.45s ease; }
@keyframes case-secouee { 0%, 100% { transform: none; } 20% { transform: translateX(-4px) rotate(-1.5deg); } 40% { transform: translateX(4px) rotate(1.5deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.piece-chalet.vient-d-etre-reparee { z-index: 3; animation: case-reparee 1.4s ease-out; }
@keyframes case-reparee {
  0% { transform: none; }
  30% { transform: scale(1.14); box-shadow: inset 0 0 0 2px #ffe7a3, 0 0 0 4px #ffe7a3, 0 0 44px 16px rgba(255, 214, 120, 0.9); }
  100% { transform: none; }
}
.piece-chalet.a-ouvrir { z-index: 3; animation: case-a-ouvrir 0.85s ease-in-out 3; }
@keyframes case-a-ouvrir { 50% { transform: scale(1.12); box-shadow: inset 0 0 0 2px #ffe7a3, 0 0 34px 12px rgba(245, 197, 66, 0.85); } }
@media (prefers-reduced-motion: reduce) { .piece-chalet.secouee, .piece-chalet.vient-d-etre-reparee, .piece-chalet.a-ouvrir { animation: none; } }
.modale.piece-ouverte { padding: 0; background: #050d1a; backdrop-filter: none; }
.modale.piece-ouverte .fenetre { max-width: none; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; animation: entree-piece 0.5s ease; }
@keyframes entree-piece { from { opacity: 0; } to { opacity: 1; } }
.modale.piece-ouverte .bandeau-jour { height: min(48vh, 440px); }
.modale.piece-ouverte .bandeau-texte { padding-left: max(1.6rem, calc((100% - 900px) / 2)); padding-right: max(1.6rem, calc((100% - 900px) / 2)); }
.modale.piece-ouverte .bandeau-heros { display: none; }
.modale.piece-ouverte .corps-jour { max-width: 900px; margin: 0 auto; }
.modale.piece-ouverte .fermer {
  position: fixed; top: 0.8rem; left: 0.8rem; right: auto; width: auto; height: auto; padding: 0.45em 1.1em;
  border-radius: 999px; font-size: 0.95rem; background: rgba(10, 20, 40, 0.88); border-color: rgba(245, 197, 66, 0.6);
}
.portes-voisines { flex-wrap: wrap; gap: 0.5rem; }
.porte-voisine { background: linear-gradient(180deg, #7a4a25, #4b2a13); border: 1px solid #c9a35a; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .portes-voisines { justify-content: center; } .porte-voisine { max-width: 100%; } }

/* =========================================================
   Le sapin du jardin (décoratif)
   ========================================================= */
#sapin { pointer-events: none; }
.palier { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.06)); }
.perles { filter: drop-shadow(0 0 2px rgba(255, 220, 120, 0.8)); }
.lumiere-sapin { fill: var(--couleur); opacity: 0.22; }
.lumiere-sapin.allumee { opacity: 1; filter: url(#lueur); animation: scintille 1.4s ease-in-out infinite alternate; }
.boule-sapin .sphere { transition: filter 0.6s; }
.boule-sapin:not(.allumee) { opacity: 0.85; }
.boule-sapin:not(.allumee) .reflet-boule { opacity: 0.25; }
.boule-sapin.allumee .sphere { filter: url(#lueur); }
.boule-sapin { transform-box: fill-box; transform-origin: 50% 0; }
.boule-sapin.allumee { animation: balance-boule 4s ease-in-out infinite; }
@keyframes balance-boule { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.boule-sapin.vient-de-s-allumer { animation: allumage 1.5s ease-out; }
.etoile-sapin2 .rayon { stroke: #f5c542; stroke-width: 2; stroke-linecap: round; opacity: 0; }
.etoile-sapin2 .branches { fill: #59636f; stroke: #8b96a6; stroke-width: 1.5; stroke-linejoin: round; transition: fill 0.8s; }
.etoile-sapin2.allumee .branches { fill: url(#or-etoile); stroke: #fff3c4; filter: url(#lueur); }
.etoile-sapin2.allumee .rayon { animation: rayons 3s ease-in-out infinite; }
.etoile-sapin2.allumee { animation: etoile-brille 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* =========================================================
   Écran titre, barre du joueur, mise en page responsive
   ========================================================= */
html, body { overflow-x: hidden; overflow-x: clip; }

/* Écran titre */
.ecran-titre { position: relative; z-index: 2; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 1.2rem 1rem 2rem; text-align: center; }
.titre-contenu { width: 100%; max-width: 780px; display: flex; flex-direction: column; align-items: center; }
.ecran-titre .logo { margin: 0; }
.ecran-titre .titre-neige { margin: 0.2rem 0 0.3rem; font-size: clamp(1.9rem, 9vw, 5.2rem); white-space: nowrap; }
.illustration-titre { position: relative; z-index: 0; container-type: size; width: min(600px, 100%); max-height: 52vh; aspect-ratio: 600 / 420; margin: 0.6rem auto 0.8rem; }
.chalet-titre { position: relative; width: 100%; height: 100%; display: block; overflow: visible; }
.boutons-titre { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.6rem; }
.btn-geant { font-size: 1.15rem; padding: 0.8em 1.8em; }
/* L'anneau doré qui part du bouton : il grandit et s'efface (transform et opacity seulement ;
   l'ancienne ombre portée animée était redessinée à chaque image) */
.ecran-titre .btn-geant { position: relative; }
.ecran-titre .btn-geant::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.55); opacity: 0; animation: appel-bouton 2.4s ease-out infinite;
}
@keyframes appel-bouton { 0% { opacity: 0.9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.08, 1.32); } }
.rebours-titre { margin: 0.9rem 0 0; font-size: 0.92rem; color: #d3deec; padding: 0.35em 1em; border-radius: 999px; background: rgba(8, 20, 40, 0.65); border: 1px solid rgba(245, 197, 66, 0.35); }
@media (max-height: 600px) and (orientation: landscape) { .illustration-titre { max-height: 38vh; } .ecran-titre .titre-neige { font-size: clamp(2rem, 7vw, 3rem); } }

/* Barre du joueur */
.jeu { position: relative; z-index: 2; }
.hud {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 1.1rem; background: rgba(6, 14, 28, 0.93);
  border-bottom: 1px solid rgba(245, 197, 66, 0.28); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.hud-titre { font-family: var(--conte); font-size: 1.15rem; white-space: nowrap; color: #ffe7a3; }
.hud-progression { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
.hud-progression .barre { height: 12px; }
.hud-actions { display: flex; align-items: center; gap: 0.35rem; }
.btn-hud { font: inherit; font-size: 0.92rem; cursor: pointer; color: var(--texte); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--bord); border-radius: 999px; padding: 0.3em 0.75em; white-space: nowrap; }
.btn-hud:hover { background: rgba(255, 255, 255, 0.16); }
.hud .salut { margin: 0 0 0 0.4rem; font-size: 0.92rem; white-space: nowrap; display: flex; align-items: center; gap: 0.5rem; }
.nom-joueur b { display: inline-block; max-width: 11em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; color: #fff3c4; }
.hud .salut .lien { font-size: 0.8rem; margin: 0; }
.infos-jeu { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; margin: 0.7rem auto 0; padding: 0 0.6rem; }
.infos-jeu p { margin: 0; }
.infos-jeu .compte-rebours { padding: 0.25em 0.9em; font-size: 0.85rem; border-radius: 999px; }
@media (max-width: 760px) {
  .hud { flex-wrap: wrap; gap: 0.45rem 0.6rem; padding: 0.5rem 0.7rem; }
  .hud-titre { order: 1; font-size: 1rem; }
  .hud-actions { order: 2; margin-left: auto; }
  .hud-progression { order: 3; flex-basis: 100%; max-width: none; }
  .btn-hud .sur { display: none; }
  .nom-joueur b { max-width: 6.5em; }
}
@media (max-width: 380px) { .hud-titre { font-size: 0.92rem; } }

/* Le chalet en entier dans l'écran, sur ordinateur, et le sapin aussi grand que la place le permet à côté */
.scene { grid-template-columns: minmax(0, 1fr); align-items: start; padding-top: 0.6rem; }
.chalet { width: 94%; margin: 0 auto; }
.toit { margin: 0 -3% -1.2% -3%; }
.sol-exterieur { margin: -4px -3% 0; }
@media (min-width: 1101px) {
  .scene { display: flex; justify-content: center; align-items: flex-start; gap: clamp(1rem, 3vw, 3.5rem); }
  .bloc-chalet { flex: 0 1 clamp(640px, calc((100vh - 230px) * 1.32), 920px); min-width: 0; }
  .bloc-sapin { flex: 0 1 clamp(330px, calc((100vh - 215px) * 0.68), 600px); min-width: 300px; top: 4.5rem; }
}
@media (max-width: 1100px) {
  .bloc-sapin { position: static; width: min(100%, 500px); margin: 1rem auto 0; }
}
@media (max-width: 700px) { .scene { padding: 0.4rem 0.5rem 1.5rem; } .chalet { width: 96%; } }

/* On peut cliquer sur le sapin pour l'admirer en grand */
#sapin { pointer-events: auto; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.btn-admirer { display: block; margin: 0.6rem auto 0; font-size: 0.9rem; padding: 0.45em 1.1em; border-color: rgba(245, 197, 66, 0.55); }
.btn-admirer:hover { border-color: var(--or); }
.place-sapin { width: 100%; }

/* =========================================================
   Le sapin en grand (après chaque pièce réparée, ou à la demande)
   ========================================================= */
body.vitrine-ouverte { overflow: hidden; }
.vitrine-sapin {
  position: fixed; inset: 0; z-index: 46; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: radial-gradient(ellipse 60% 70% at 50% 48%, rgba(24, 66, 52, 0.82), rgba(3, 9, 18, 0.96) 75%);
  cursor: zoom-out; animation: vitrine-fond 0.5s ease both;
}
.vitrine-sapin::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.4s ease;
  background: radial-gradient(ellipse 55% 60% at 50% 40%, rgba(255, 200, 80, 0.35), rgba(255, 200, 80, 0) 70%);
}
.vitrine-sapin.etoile::before { opacity: 1; }
.vitrine-sapin.sortie { animation: vitrine-fond 0.38s ease reverse both; }
@keyframes vitrine-fond { from { opacity: 0; } to { opacity: 1; } }
.vitrine-cadre { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; max-height: 100%; }
.vitrine-scene { animation: vitrine-entree 0.75s cubic-bezier(0.2, 0.9, 0.25, 1.12) both; }
.vitrine-sapin.sortie .vitrine-scene { animation: vitrine-sortie 0.38s ease both; }
@keyframes vitrine-entree { from { opacity: 0; transform: translateY(8vh) scale(0.55); } to { opacity: 1; transform: none; } }
@keyframes vitrine-sortie { to { opacity: 0; transform: scale(0.85); } }
.vitrine-sapin #sapin { width: auto; height: min(calc(100vh - 12.5rem), 137vw); height: min(calc(100svh - 12.5rem), 137vw); aspect-ratio: 400 / 586; cursor: zoom-out; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)); }
.vitrine-legende { position: relative; z-index: 1; text-align: center; color: #eef3fa; text-shadow: 0 1px 4px #000, 0 0 12px rgba(0, 0, 0, 0.8); max-width: 34rem; }
.vitrine-compte { margin: 0; font-size: 1.05rem; }
.vitrine-compte b { font-size: 1.7em; color: var(--or); font-variant-numeric: tabular-nums; }
.vitrine-message { margin: 0.3rem 0 0.8rem; min-height: 2.8em; font-family: var(--conte); font-size: 1.25rem; line-height: 1.3; color: #ffe7a3; opacity: 0; }
.vitrine-message.visible { animation: vitrine-message 0.6s ease both; }
@keyframes vitrine-message { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.vitrine-message .petit { display: block; margin-top: 0.3rem; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 0.9rem; color: #d3deec; }
.vitrine-sapin #sapin.zoom-boule { animation: zoom-boule 2.8s cubic-bezier(0.45, 0, 0.3, 1) both; }
@keyframes zoom-boule { 0% { transform: scale(1); } 28% { transform: scale(1.5); } 72% { transform: scale(1.5); } 100% { transform: scale(1); } }
/* Écran large ou téléphone couché : le texte passe à côté du sapin */
@media (min-aspect-ratio: 5/4) {
  .vitrine-cadre { flex-direction: row; gap: clamp(1rem, 4vw, 3rem); }
  .vitrine-sapin #sapin { height: calc(100vh - 2.5rem); height: calc(100svh - 2.5rem); }
  .vitrine-legende { text-align: left; width: min(22rem, 38vw); }
  .vitrine-message { min-height: 5.5em; }
}
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .vitrine-compte { font-size: 0.95rem; } .vitrine-message { font-size: 1.05rem; }
}

/* L'animation d'allumage : ce qui « attend » est éteint, puis s'allume */
.boule-sapin.en-attente { animation: none; opacity: 0.85; }
.boule-sapin.en-attente .sphere { fill: url(#boule-eteinte); filter: none; }
.boule-sapin.en-attente .reflet-boule { opacity: 0.25; }
.lumiere-sapin.en-attente { opacity: 0.22; filter: none; animation: none; }
.cadeau-sapin.en-attente { opacity: 0; transition: none; }
.cadeau-sapin.tombe { animation: cadeau-tombe 0.9s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
@keyframes cadeau-tombe { 0% { opacity: 0; transform: translateY(-140px) rotate(-8deg); } 55% { opacity: 1; transform: translateY(5px) rotate(2deg); } 75% { transform: translateY(-7px); } 100% { opacity: 1; transform: none; } }
.etoile-sapin2 { transform-box: fill-box; transform-origin: center; }
.etoile-sapin2.en-attente { animation: none; }
.etoile-sapin2.en-attente .branches { fill: #59636f; stroke: #8b96a6; filter: none; }
.etoile-sapin2.en-attente .rayon { animation: none; opacity: 0; }
.etoile-sapin2.vient-de-s-allumer { animation: etoile-pop 1.3s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes etoile-pop { 0% { transform: scale(0.5) rotate(-40deg); } 50% { transform: scale(1.6) rotate(12deg); } 100% { transform: none; } }
.eclat { pointer-events: none; }
.eclat .onde { fill: none; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: onde 0.9s ease-out forwards; }
@keyframes onde { from { opacity: 1; transform: scale(0.3); } to { opacity: 0; transform: scale(2.4); } }
.eclat .etincelle { animation: etincelle 1.1s cubic-bezier(0.15, 0.7, 0.3, 1) forwards; }
@keyframes etincelle { from { opacity: 1; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); } }
@media (prefers-reduced-motion: reduce) { .vitrine-sapin, .vitrine-scene, .vitrine-message.visible { animation: none; opacity: 1; } }

/* Accueil en deux étapes : la lettre, puis le compte */
.etape-compte .titre-carnet { margin: 0.4rem 0 0.2rem; font-family: var(--conte); font-size: 1.5rem; color: #ffe7a3; }
.etape-compte .signature-lutin { margin-top: 0.6rem; }
.etape-compte > p { margin-top: 1rem; }
@media (max-width: 480px) { .onglet { padding: 0.4em 0.7em; font-size: 0.85rem; } .lettre-pole-nord { padding: 1.2rem 1rem 1.2rem; font-size: 0.95rem; } .nom-signature { font-size: 1.7rem; } .paraphe { width: 160px; } .bas-lettre .sceau { width: 52px; height: 52px; margin-top: -26px; font-size: 1rem; } }
@media (max-width: 400px) { .bas-lettre { padding-left: 56px; } .nom-signature { font-size: 1.35rem; padding: 0; } .paraphe { width: 130px; } .bas-lettre .sceau { left: 0; width: 48px; height: 48px; margin-top: -24px; font-size: 0.9rem; } }

/* Étiquettes des pièces : le nom tient sur 2 lignes, et disparaît si la case est trop petite */
.piece-chalet { container-type: inline-size; }
.piece-etiquette { white-space: normal; display: flex; align-items: flex-end; justify-content: center; gap: 0.25em; padding: 1rem 0.25rem 0.25rem; font-size: 0.64rem; line-height: 1.15; }
.piece-nom { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; }
@container (max-width: 78px) { .piece-nom { display: none; } .piece-icone { font-size: 0.9rem; } }
.btn-deconnexion .icone { display: none; }
@media (max-width: 760px) {
  .btn-deconnexion .texte { display: none; }
  .btn-deconnexion .icone { display: inline; font-size: 1.05rem; text-decoration: none; }
  .btn-deconnexion { text-decoration: none; }
  .modale.piece-ouverte .fermer { top: 0.5rem; left: 0.5rem; font-size: 0.85rem; padding: 0.35em 0.85em; }
}
/* Carte du jour 8 : lisible même sur un petit téléphone (on la fait glisser) */
.seulement-mobile { display: none; }
@media (max-width: 560px) {
  .cadre-carte { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cadre-carte .carte { min-width: 540px; }
  .seulement-mobile { display: block; }
}

/* Petits écrans et téléphones à l'horizontale */
@media (max-height: 520px) and (orientation: landscape) {
  .ecran-titre { padding-top: 0.4rem; padding-bottom: 0.8rem; }
  .ecran-titre .logo { display: none; }
  .ecran-titre .titre-neige { font-size: clamp(1.8rem, 6vw, 2.6rem); margin-bottom: 0.1rem; }
  .illustration-titre { max-height: 34vh; margin: 0 auto 0.3rem; }
  .btn-geant { font-size: 1rem; padding: 0.6em 1.4em; }
}
@media (max-width: 560px) {
  .infos-jeu .statut { font-size: 0.72rem; }
  .inventaire { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.35rem; }
  .carte-fragment { padding: 0.3rem 0.2rem; }
  .carte-fragment code { font-size: 0.78rem; }
  .carte-fragment b { font-size: 1.15rem; }
}

/* Bouton de langue */
.btn-langue-titre { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 3; font-size: 0.85rem; }

/* Le bouton du son (🔊) ouvre le panneau des trois curseurs. Celui en haut à gauche sert sur
   l'écran titre et dans les fenêtres (qui cachent la barre du jeu). */
.panneau-son {
  position: fixed; z-index: 60; padding: 0.8rem 1rem 0.9rem; border-radius: 16px;
  background: linear-gradient(180deg, #14325a, #0b1d36); border: 1px solid rgba(245, 197, 66, 0.55);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); color: var(--texte); font-size: 0.92rem; animation: panneau-son 0.18s ease-out;
}
@keyframes panneau-son { from { opacity: 0; transform: translateY(-6px); } }
.titre-panneau-son { margin: 0 0 0.5rem; font-family: var(--conte); color: #ffe7a3; font-size: 1.02rem; }
.curseur-son { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.1rem 0.6rem; margin: 0.45rem 0; }
.curseur-son span { grid-column: 1; }
.curseur-son output { grid-column: 2; font-size: 0.8rem; color: var(--texte-doux); min-width: 3.2em; text-align: right; }
.curseur-son input { grid-column: 1 / -1; width: 100%; accent-color: var(--or); cursor: pointer; height: 1.4rem; margin: 0; }
.aide-voix { margin: 0.2rem 0 0.4rem; font-size: 0.78rem; color: var(--texte-doux); line-height: 1.35; }
.btn-silence { width: 100%; margin-top: 0.4rem; font-size: 0.88rem; padding: 0.4em 0.8em; }
.btn-son-flottant {
  position: fixed; top: 0.8rem; left: 0.8rem; z-index: 21; display: none; width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45); background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 1.05rem; cursor: pointer;
}
.btn-son-flottant:hover { background: rgba(0, 0, 0, 0.65); }
body.sur-ecran-titre .btn-son-flottant, body.modale-ouverte .btn-son-flottant { display: block; }
body.vitrine-ouverte .btn-son-flottant { display: none; }
/* Dans une pièce, le bouton « 🏡 Chalet » occupe déjà le coin en haut à gauche */
/* (décalé de la largeur d'une barre de défilement, pour ne pas la recouvrir) */
.modale.piece-ouverte ~ .btn-son-flottant { left: auto; right: calc(0.8rem + 12px); background: rgba(10, 20, 40, 0.7); border-color: rgba(245, 197, 66, 0.6); }
@media (max-width: 760px) { .modale.piece-ouverte ~ .btn-son-flottant { top: 0.5rem; right: calc(0.5rem + 12px); width: 2.1rem; height: 2.1rem; font-size: 0.95rem; } }
.btn-langue .langue-court { display: none; }
@media (max-width: 760px) {
  .hud .btn-langue { font-size: 0.8rem; padding: 0.3em 0.55em; }
  .hud .btn-langue .langue-long { display: none; }
  .hud .btn-langue .langue-court { display: inline; }
  /* Si la barre ne tient pas sur une ligne, les boutons passent à la ligne au lieu de sortir de l'écran */
  .hud-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 0.35rem; min-width: 0; }
}
/* Tablette, petit portable : la barre reste sur une ligne en raccourcissant les libellés comme sur téléphone
   (sinon le bouton de déconnexion sortait de l'écran) */
@media (min-width: 761px) and (max-width: 1000px) {
  .hud { gap: 0.7rem; }
  .hud .btn-langue .langue-long { display: none; }
  .hud .btn-langue .langue-court { display: inline; }
  .btn-hud .sur { display: none; }
  .nom-joueur b { max-width: 7em; }
  .btn-deconnexion { text-decoration: none; }
  .btn-deconnexion .texte { display: none; }
  .btn-deconnexion .icone { display: inline; font-size: 1.05rem; text-decoration: none; }
}
@media (max-width: 400px) {
  .hud-actions { gap: 0.25rem; }
  .btn-hud { padding: 0.3em 0.55em; }
  .nom-joueur b { max-width: 5em; }
}

/* =========================================================
   Écran titre : le chalet illuminé… et derrière lui, dans le brouillard, une ombre immense
   qu'on devine à peine. Elle met longtemps à se dessiner, des bancs de brume passent devant,
   et de temps en temps deux lueurs rouges s'allument là où seraient ses yeux.
   Seuls transform et opacity bougent (l'image et chaque banc de brume ont leur calque).
   ========================================================= */
.titre-contenu { position: relative; z-index: 1; }
.titre-contenu > :not(.illustration-titre) { position: relative; z-index: 1; }
/* Le chalet gelé (il sert à la scène « chalet » de la lettre) */
.chalet-titre .d-cristal { animation: scintille 1.6s ease-in-out infinite alternate; }
.chalet-titre .d-yeux-kere { transform-box: fill-box; transform-origin: center; animation: yeux-kere 5.5s infinite; }
@keyframes yeux-kere { 0%, 88%, 100% { transform: scaleY(1); opacity: 1; } 60% { opacity: 0.75; } 91% { transform: scaleY(0.1); } 94% { transform: scaleY(1); } }
.chalet-titre .etoile-titre { animation: etoile-froide 3s ease-in-out infinite alternate; }
@keyframes etoile-froide { from { opacity: 0.6; } to { opacity: 1; } }
.chalet-titre .lueur-etoile { opacity: 0; }
/* Le chalet de l'écran titre, avant l'attaque : l'étoile du toit brille */
.chalet-titre.chaud .etoile-titre { animation: none; }
.chalet-titre.chaud .lueur-etoile { animation: lueur-etoile-titre 2.8s ease-in-out infinite alternate; }
@keyframes lueur-etoile-titre { from { opacity: 0.65; } to { opacity: 1; } }

/* (ses yeux, à 34 % de la hauteur de l'image, encadrent l'étoile du toit) */
.ombre-titre {
  position: absolute; left: 50%; top: -46%; height: 158%; aspect-ratio: 780 / 500; z-index: -1; pointer-events: none;
  transform: translateX(-50%); opacity: 0; animation: ombre-apparait 20s cubic-bezier(0.55, 0, 0.7, 1) 2.5s forwards;
}
@keyframes ombre-apparait { to { opacity: 1; } }
/* Un halo de brume derrière elle, pour que sa silhouette sombre se détache à peine du ciel */
.ombre-voile { position: absolute; inset: 6% 12% 18%; border-radius: 50%; background: radial-gradient(closest-side, rgba(130, 170, 220, 0.12), rgba(130, 170, 220, 0.04) 60%, rgba(130, 170, 220, 0)); }
/* (opacité 0,44 jusqu'au 2026-11-28 : « Kryos est trop visible derrière le chalet, encore plus discret ») */
.ombre-image {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0.2; transform-origin: 50% 34%;
  animation: ombre-souffle 26s ease-in-out infinite alternate; will-change: transform;
}
@keyframes ombre-souffle { from { transform: translateY(2.5%) scale(0.985); } to { transform: translateY(-1.5%) scale(1.02); } }
.ombre-yeux i {
  position: absolute; top: 34%; width: 4%; aspect-ratio: 2.6 / 1; margin: -0.77% 0 0 -2%; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, #ffd0d6 0, #ff4d6a 22%, rgba(255, 40, 75, 0.55) 45%, rgba(255, 40, 75, 0) 100%);
  animation: ombre-regard 15s ease-in-out 6s infinite;
}
.ombre-yeux i:first-child { left: 45.7%; }
.ombre-yeux i:last-child { left: 54.7%; top: 34.3%; }
@keyframes ombre-regard { 0%, 70%, 100% { opacity: 0; } 77% { opacity: 0.6; } 83% { opacity: 0.48; } 85.5% { opacity: 0; } 87.5% { opacity: 0.52; } 94% { opacity: 0; } }
/* Les bancs de brume, devant l'ombre mais derrière le chalet */
.ombre-brume { position: absolute; left: -30%; width: 160%; pointer-events: none; will-change: transform; }
.ombre-brume.b1 {
  top: 16%; height: 36%; animation: brume-glisse 38s ease-in-out infinite alternate;
  background: radial-gradient(ellipse 18% 46% at 28% 50%, rgba(195, 218, 242, 0.24), transparent 70%), radial-gradient(ellipse 16% 40% at 52% 58%, rgba(195, 218, 242, 0.2), transparent 70%), radial-gradient(ellipse 22% 50% at 80% 44%, rgba(195, 218, 242, 0.18), transparent 70%);
}
.ombre-brume.b2 {
  top: 40%; height: 44%; animation: brume-glisse 52s ease-in-out -26s infinite alternate-reverse;
  background: radial-gradient(ellipse 26% 50% at 22% 50%, rgba(170, 200, 235, 0.2), transparent 70%), radial-gradient(ellipse 24% 46% at 58% 46%, rgba(170, 200, 235, 0.22), transparent 70%), radial-gradient(ellipse 20% 40% at 88% 56%, rgba(170, 200, 235, 0.16), transparent 70%);
}
.ombre-brume.b3 {
  top: -2%; height: 32%; animation: brume-glisse 64s ease-in-out -10s infinite alternate;
  background: radial-gradient(ellipse 20% 50% at 40% 52%, rgba(185, 210, 240, 0.16), transparent 70%), radial-gradient(ellipse 24% 44% at 70% 48%, rgba(185, 210, 240, 0.13), transparent 70%);
}
@keyframes brume-glisse { from { transform: translateX(-11%); } to { transform: translateX(11%); } }
@media (prefers-reduced-motion: reduce) {
  .ombre-titre { animation: none; opacity: 1; }
  .ombre-image, .ombre-brume, .ombre-yeux i { animation: none; }
}

/* =========================================================
   Le décor qui raconte la lettre : pendant que le Père Noël écrit, l'histoire se joue
   DERRIÈRE la lettre, sur tout l'écran ; le parchemin, un peu transparent, la laisse
   deviner à travers lui. Seuls transform et opacity bougent ; les grandes zones animées
   ont leur calque.
   ========================================================= */
.modale.cinema-actif { display: block; padding: 0; background: #02060f; backdrop-filter: none; -webkit-backdrop-filter: none; overflow-x: hidden; } /* (la lettre penchée dépasse d'1 px : sur téléphone, elle glissait de côté) */
.modale.cinema-actif .fenetre {
  position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 1.4rem 0 2rem;
  background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; animation: none;
}
.modale.cinema-actif .corps-jour { padding: 1.2rem 0.6rem 1.6rem; }
.modale.cinema-actif .bandeau-jour { display: none; }
.modale.cinema-actif .fermer { position: fixed; top: 0.8rem; right: calc(0.8rem + 12px); z-index: 6; }
.cinema { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #02060f; }
.cin-scene { position: absolute; inset: 0; display: none; opacity: 0; transition: opacity 1.4s ease; contain: strict; container-type: size; overflow: hidden; }
.cin-scene.active, .cin-scene.sortie { display: block; }
.cin-scene.active { opacity: 1; }
.cin-calque, .cin-calque > .cin-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Les bords de l'écran s'assombrissent un peu : la lettre ressort au milieu */
.cin-bord { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(ellipse 80% 75% at 50% 50%, rgba(2, 6, 15, 0) 55%, rgba(2, 6, 15, 0.55) 100%); }
/* Le parchemin laisse passer l'histoire (sans flou d'arrière-plan : trop coûteux par-dessus une vidéo) */
.modale.cinema-actif .lettre-pole-nord {
  background:
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 70, 20, 0.2) 100%),
    linear-gradient(180deg, rgba(249, 240, 217, 0.8), rgba(236, 217, 173, 0.8));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 0 50px rgba(140, 90, 30, 0.28);
}
@media (max-width: 700px) {
  .modale.cinema-actif .fenetre { padding-top: 3.4rem; } /* (la place du bouton ✕) */
  .modale.cinema-actif .corps-jour { padding: 0.8rem 0.6rem 1.5rem; }
}
/* Écran en hauteur (téléphone, tablette debout) : l'écran se partage, l'histoire se joue EN HAUT et la
   lettre s'écrit EN BAS, chacune dans sa partie. Le décor garde à peu près les proportions des vidéos
   (16/9) sans dépasser 42 % de la hauteur ; la lettre défile toute seule dans le reste. */
@media (max-aspect-ratio: 999/1000) { /* (un écran carré pile garde la mise en page côte à côte) */
  .modale.cinema-actif { --haut-cinema: var(--haut-cinema-aligne, min(42svh, 62vw)); top: var(--haut-cinema); } /* (arrondie au pixel de l'écran par app.js) */
  .modale.cinema-actif .cinema { bottom: auto; height: var(--haut-cinema); }
  /* le bas du décor se fond dans la nuit, du côté de la lettre */
  .modale.cinema-actif .cin-bord { background: linear-gradient(180deg, rgba(2, 6, 15, 0) 80%, #02060f 100%), radial-gradient(ellipse 85% 80% at 50% 50%, rgba(2, 6, 15, 0) 60%, rgba(2, 6, 15, 0.45) 100%); }
  .modale.cinema-actif .fenetre { padding-top: 0.4rem; } /* (le bouton ✕ est sur le décor) */
  .modale.cinema-actif .fermer { top: 0.6rem; }
  .modale.cinema-actif .lettre-pole-nord { background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 70, 20, 0.2) 100%), linear-gradient(180deg, #f9f0d9, #ecd9ad); }
}
/* Écran plus large que haut (ordinateur, tablette ou téléphone à l'horizontale) : l'histoire se joue
   À GAUCHE et la lettre s'écrit À DROITE, côte à côte. */
@media (min-width: 560px) and (min-aspect-ratio: 1/1) {
  .modale.cinema-actif { --col-lettre: clamp(430px, 43vw, 640px); --marge-lettre: clamp(14px, 2.2vw, 40px); }
  .modale.cinema-actif .cinema { right: calc(var(--col-lettre) + 2 * var(--marge-lettre)); }
  /* le bord droit du décor se fond dans la nuit, du côté de la lettre */
  .modale.cinema-actif .cin-bord { background: linear-gradient(90deg, rgba(2, 6, 15, 0) 82%, #02060f 100%), radial-gradient(ellipse 85% 80% at 50% 50%, rgba(2, 6, 15, 0) 60%, rgba(2, 6, 15, 0.5) 100%); }
  .modale.cinema-actif .fenetre { max-width: var(--col-lettre); margin: 0 var(--marge-lettre) 0 auto; }
  /* plus rien derrière le parchemin : il redevient opaque */
  .modale.cinema-actif .lettre-pole-nord { background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 70, 20, 0.2) 100%), linear-gradient(180deg, #f9f0d9, #ecd9ad); }
  .modale.cinema-actif .fermer { right: calc(var(--marge-lettre) + 12px); }
}
/* (téléphone à l'horizontale : la lettre prend la moitié de l'écran, avec un peu moins de marges) */
@media (min-width: 560px) and (max-width: 899px) and (min-aspect-ratio: 1/1) {
  .modale.cinema-actif { --col-lettre: clamp(280px, 48vw, 430px); --marge-lettre: 10px; }
  .modale.cinema-actif .fenetre { padding-top: 2.9rem; }
  .modale.cinema-actif .lettre-pole-nord { padding: 1.1rem 1rem 1.1rem; font-size: 0.95rem; }
}

/* Les illustrations du titre (Kryos, le chalet gelé) réutilisées dans une boîte à leurs proportions */
.cin-boite { position: absolute; left: 50%; top: 58%; width: min(84cqw, 112cqh); aspect-ratio: 600 / 420; transform: translate(-50%, -50%); container-type: size; }
.cin-boite .chalet-titre { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Les vidéos et les images (public/media) couvrent toute la scène, centrées : sur ordinateur comme
   sur téléphone, c'est le milieu de l'image (où se tient l'action) qui reste visible. */
.cin-video, .cin-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cin-video-evt { opacity: 0; transition: opacity 0.6s ease; }
.cin-video-evt.visible { opacity: 1; }
/* Quand l'action d'une vidéo n'est pas au milieu de l'image : le chalet où plongent les Kères est à
   gauche, le sapin dont l'étoile s'éteint à droite, le projecteur des lutins à gauche */
.cin-video.cadre-chalet-keres { object-position: 30% 50%; }
.cin-video.cadre-chalet-etoile { object-position: 75% 50%; }
.cin-video.cadre-atelier { object-position: 38% 50%; }
.cin-video.cadre-kryos-trone { object-position: 45% 50%; }      /* Kryos à gauche, l'étoile du sapin à droite */
.cin-video.cadre-prophetie-livre { object-position: 25% 50%; }  /* les images qui bougent sont sur la page de gauche */
.cin-tremble { position: absolute; inset: 0; }
/* Une lente approche, comme une caméra qui avance */
.cin-fond-image { transform: scale(1.1); transition: transform 16s cubic-bezier(0.2, 0.6, 0.3, 1); will-change: transform; }
.cin-scene.active .cin-fond-image { transform: none; }
.cin-scene.immediat .cin-fond-image { transition: none; }
.cin-kere-img { display: block; width: 100%; height: auto; pointer-events: none; }

/* Animations communes */
.cin-aurore { animation: cin-aurore 8s ease-in-out infinite alternate; will-change: opacity, transform; }
@keyframes cin-aurore { from { opacity: 0.55; transform: translateX(-2%); } to { opacity: 1; transform: translateX(2%); } }

/* 1. Le cachot */
.cin-halo-bougie { animation: bougie 2.6s ease-in-out infinite; will-change: opacity; }
.cin-cachot .cin-flamme { transform-box: fill-box; transform-origin: 50% 100%; animation: cin-flamme 0.45s ease-in-out infinite alternate; }
@keyframes cin-flamme { from { transform: scale(1, 1) rotate(-3deg); } to { transform: scale(0.88, 1.12) rotate(3deg); } }
.cin-cachot .cin-rafale { animation: cin-rafale 0.9s linear infinite; }
@keyframes cin-rafale { from { transform: translate(60px, -10px); } to { transform: translate(-80px, 12px); } }
.cin-cachot .cin-bras { transform-box: fill-box; transform-origin: 8% 10%; animation: cin-ecrit 0.7s ease-in-out infinite alternate; }
@keyframes cin-ecrit { from { transform: rotate(-2.5deg); } to { transform: rotate(2deg) translateX(3px); } }
.cin-lettre-vole { opacity: 0; }
.cin-cachot.evt-envol .cin-lettre-vole { animation: cin-envol 3.4s ease-in-out both; }
@keyframes cin-envol {
  0% { transform: translate(540px, 440px) scale(0.3); opacity: 0; }
  15% { transform: translate(560px, 400px) scale(0.9); opacity: 1; }
  65% { transform: translate(745px, 165px) scale(0.75); opacity: 1; }
  100% { transform: translate(930px, 40px) scale(0.2); opacity: 0; }
}

/* 2. Le glacier */
.cin-fissure { opacity: 0; transition: opacity 0.35s ease calc(var(--k) * 0.2s); }
.cin-glacier.evt-fendu .cin-fissure { opacity: 1; }
.cin-glacier.evt-fendu .cin-glacier-calque { animation: cin-secousse 0.5s ease-in-out 3; }
@keyframes cin-secousse { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-6px, 2px); } 50% { transform: translate(5px, -2px); } 75% { transform: translate(-3px, 1px); } }
.cin-kryos-dort { opacity: 0.5; transition: opacity 1.4s ease, transform 1.4s ease; }
.cin-yeux-ouverts { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scaleY(0.1); transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s; }
.cin-glacier.evt-revenu .cin-kryos-dort { opacity: 1; transform: translateY(-26px); }
.cin-glacier.evt-revenu .cin-yeux-ouverts { opacity: 1; transform: none; }
.cin-glacier.evt-revenu .cin-yeux-fermes { opacity: 0; }
.cin-eclat { opacity: 0; }
.cin-glacier.evt-revenu .cin-eclat { animation: cin-eclat 1.5s cubic-bezier(0.15, 0.7, 0.3, 1) forwards; }
@keyframes cin-eclat {
  0% { opacity: 1; transform: translate(500px, 380px) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(500px + var(--dx)), calc(380px + var(--dy))) rotate(var(--r)); }
}
.cin-flash { position: absolute; inset: 0; background: #eaf8ff; opacity: 0; will-change: opacity; }
.cin-glacier.evt-revenu .cin-flash { animation: cin-flash 0.9s ease-out; }
/* La vidéo : Kryos derrière un voile de glace, qui tremble, se fend, puis vole en éclats */
.cin-voile-glace {
  position: absolute; inset: 0; opacity: 1; transition: opacity 0.5s ease 0.12s;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, rgba(170, 220, 255, 0.14), rgba(190, 232, 255, 0.48));
}
.cin-voile-glace::after { content: ""; position: absolute; inset: 0; opacity: 0.28; background: var(--texture-givre) 0 0 / 300px 300px; }
.cin-glacier.evt-fendu .cin-tremble { animation: cin-secousse 0.5s ease-in-out 3; }
.cin-glacier.evt-revenu .cin-voile-glace { opacity: 0; }
/* (pendant le flashback « il y a mille ans », pas encore de voile : il vient avec le glacier, « Cette nuit ») */
.cin-glacier:not(.evt-nuit) .cin-voile-glace { opacity: 0; }
/* Les fissures étaient dans la glace : elles partent avec elle */
.cin-glacier:not(.secours) .cin-fissures { transition: opacity 0.5s ease 0.12s; }
.cin-glacier.evt-revenu:not(.secours) .cin-fissures { opacity: 0; }
/* (Pas de zoom sur la vidéo quand Kryos se libère : agrandir une vidéo en cours de lecture faisait
   tomber l'animation de 26 à 17 images/s pendant une seconde, sur une puce graphique de portable.) */
.cin-glacier.secours .cin-tremble { display: none; }
@keyframes cin-flash { 0% { opacity: 0; } 12% { opacity: 0.9; } 100% { opacity: 0; } }

/* 3. Les Kères */
.cin-souffle { position: absolute; left: 50%; top: 47%; width: 70cqw; height: 50cqh; transform: translateX(-50%); background: radial-gradient(ellipse 50% 40% at 50% 20%, rgba(190, 230, 255, 0.35), transparent 70%); animation: cin-souffle 3.2s ease-in-out infinite alternate; will-change: opacity, transform; }
@keyframes cin-souffle { from { opacity: 0.35; transform: translateX(-50%) scale(0.9); } to { opacity: 0.9; transform: translateX(-50%) scale(1.15); } }
/* (au rythme de la lettre : l'essaim s'envole lentement, pas en boucle frénétique) */
.cin-kere-essaim { position: absolute; left: 50%; top: 58%; width: var(--t); opacity: 0; animation: cin-essaim 7s ease-out var(--d) infinite; }
@keyframes cin-essaim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.1); }
  12% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15); }
}
.cin-noelos, .cin-cage { position: absolute; bottom: 5%; width: min(24cqw, 200px); opacity: 0; transform: translateY(16px); transition: opacity 0.8s ease, transform 0.8s ease; }
.cin-noelos { left: 4%; }
.cin-cage { right: 12%; }
.cin-keres.evt-noelos .cin-noelos, .cin-keres.evt-lutins .cin-cage { opacity: 1; transform: none; }
.cin-noelos-gel { opacity: 0; transition: opacity 0.6s ease 1s; }
.cin-keres.evt-noelos .cin-noelos-gel { opacity: 1; }
.cin-barreaux { transform: translateY(-170px); transition: transform 0.55s cubic-bezier(0.5, 1.6, 0.6, 1) 0.6s; }
.cin-keres.evt-lutins .cin-barreaux { transform: none; }

/* 4. Le chalet */
.cin-etoile-or { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity 1.3s ease, transform 1.3s ease; transform-origin: 50% 6%; }
.cin-chalet.evt-etoile .cin-etoile-or { opacity: 0; transform: scale(1.4); }
/* Chaque Kère plonge une seule fois dans sa pièce, l'une après l'autre, pendant la phrase qui le raconte */
.cin-kere-plonge { position: absolute; left: 0; top: 0; width: 7cqw; opacity: 0; animation: cin-plonge 4s ease-in var(--d) both; }
@keyframes cin-plonge {
  0% { opacity: 0; transform: translate(-30cqw, -40cqh) scale(1.6); }
  12% { opacity: 1; }
  55% { opacity: 1; transform: translate(var(--x), var(--y)) scale(0.7); }
  62%, 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.2); }
}

/* 5. L'hiver sans fin */
.cin-neige-fenetre { animation: cin-neige-fenetre 2.4s ease-in-out infinite alternate; }
@keyframes cin-neige-fenetre { from { transform: translateY(-4px); } to { transform: translate(-3px, 6px); } }
.cin-chaussette { transform-box: fill-box; transform-origin: 50% 0; animation: cin-balance 3s ease-in-out infinite alternate; }
@keyframes cin-balance { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.cin-glace-24 { opacity: 0; transition: opacity 2s ease 1.6s; }
.cin-hiver.active .cin-glace-24 { opacity: 0.75; }
.cin-givre-coins { opacity: 0; transition: opacity 3s ease 0.5s; }
.cin-hiver.active .cin-givre-coins { opacity: 1; }

/* 6. La prophétie */
.cin-rayons-or { transform-origin: 50% 47.1%; animation: cin-tourne 40s linear infinite; will-change: transform; }
@keyframes cin-tourne { to { transform: rotate(360deg); } }
.cin-aura { opacity: 0.55; animation: cin-pulse 3s ease-in-out infinite alternate; will-change: opacity; }
@keyframes cin-pulse { to { opacity: 0.85; } }
.cin-prophetie .cin-brume-boule { transform-origin: 500px 330px; animation: cin-tourne 16s linear infinite; }
.cin-heros { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.8); transition: opacity 1.6s ease, transform 1.6s ease; }
.cin-prophetie.evt-visage .cin-heros { opacity: 0.9; transform: none; }
.cin-prenom {
  position: absolute; left: 50%; top: 82%; margin: 0; max-width: 86%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0.05em 0.9em 0.15em; border-radius: 6px; background: linear-gradient(180deg, #fbf1d6, #e8d3a2); border: 2px solid #c9a35a;
  font-family: "Segoe Script", "Snell Roundhand", "Apple Chancery", "Lucida Handwriting", cursive; font-size: clamp(1.2rem, 7cqh, 2.8rem); line-height: 1.3;
  color: #6b1420; box-shadow: 0 0 26px rgba(255, 210, 110, 0.8), 0 6px 14px rgba(0, 0, 0, 0.5); opacity: 0; transform: translate(-50%, -50%) scaleX(0.2);
  transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.cin-prophetie.evt-toi .cin-prenom { opacity: 1; transform: translate(-50%, -50%); }
/* « Tu es notre seul espoir » : la vidéo des lutins prisonniers remplace la boule, la plaque s'en va */
.cin-prophetie.evt-espoir:not(.secours) .cin-prenom { opacity: 0; transition-duration: 0.6s; }
.cin-etoile-espoir { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.4); transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.3, 1.6, 0.5, 1); }
.cin-prophetie.evt-espoir .cin-etoile-espoir { opacity: 1; transform: none; }
.cin-prophetie.evt-espoir .cin-aura { animation-duration: 1.2s; }

/* 7. La mission : le calendrier des 24 pièces */
.cin-porte .cin-lueur { opacity: 0; transition: opacity 1s ease; }
.cin-mission.evt-lumiere .cin-porte-1 .cin-lueur { opacity: 1; }
.cin-mission.evt-etoile .cin-porte .cin-lueur { opacity: 0.55; }
.cin-kere-fuit { opacity: 0; }
.cin-mission.evt-kere .cin-kere-fuit { animation: cin-kere-fuit 2.2s ease-in forwards; }
@keyframes cin-kere-fuit {
  0% { opacity: 0; transform: translate(533px, 373px) scale(0.4); }
  15% { opacity: 1; transform: translate(533px, 340px) scale(1.2); }
  100% { opacity: 0; transform: translate(240px, 60px) scale(0.3) rotate(-200deg); }
}
.cin-boule { opacity: 0.3; transition: opacity 0.8s ease; }
.cin-mission.evt-lumiere .cin-boule-1, .cin-mission.evt-etoile .cin-boule { opacity: 1; }
.cin-guirlande circle { opacity: 0.25; }
.cin-mission.evt-guirlandes .cin-guirlande circle { animation: cin-clignote 1.1s ease-in-out infinite alternate; }
@keyframes cin-clignote { from { opacity: 0.35; } to { opacity: 1; } }
.cin-fragment { opacity: 0; }
.cin-mission.evt-fragment .cin-fragment { animation: cin-fragment 2.4s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }
@keyframes cin-fragment {
  0% { opacity: 0; transform: translate(533px, 373px) scale(0.3) rotate(0deg); }
  100% { opacity: 1; transform: translate(660px, 150px) scale(1.2) rotate(360deg); }
}
.cin-etoile-sapin { opacity: 0; transition: opacity 1s ease; }
.cin-etoile-eteinte { transition: opacity 1s ease; }
.cin-mission.evt-etoile .cin-etoile-sapin { opacity: 1; }
.cin-mission.evt-etoile .cin-etoile-eteinte { opacity: 0; }

/* 8. Le secret des lutins */
.cin-faisceau { animation: cin-projecteur 0.16s steps(2, jump-none) infinite alternate; will-change: opacity; }
@keyframes cin-projecteur { from { opacity: 0.82; } to { opacity: 1; } }
.cin-bobine { transform-box: fill-box; transform-origin: center; animation: cin-tourne 1.8s linear infinite; }
.cin-bobine.b2 { animation-duration: 2.3s; }
.cin-crayon { transform: translate(450px, 396px) rotate(-14deg); animation: cin-crayon 0.9s ease-in-out infinite alternate; }
@keyframes cin-crayon { to { transform: translate(478px, 392px) rotate(-10deg); } }
.cin-halo-ampoule { animation: cin-pulse 1.6s ease-in-out infinite alternate; opacity: 0.6; }

/* 9. La menace : Kryos sort du noir (ses yeux, les plus lumineux, apparaissent les premiers) */
.cin-menace { background: #000; }
.cin-kryos-surgit { opacity: 0; transform: scale(1.18); will-change: opacity, transform; }
.cin-menace.active .cin-kryos-surgit { animation: cin-kryos-surgit 4.2s cubic-bezier(0.5, 0, 0.6, 1) 0.4s forwards; }
@keyframes cin-kryos-surgit { 0% { opacity: 0; transform: scale(1.18); } 35% { opacity: 0.32; } 100% { opacity: 1; transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .cin-menace.active .cin-kryos-surgit { opacity: 1; transform: none; } }
.cin-givre-montant {
  position: absolute; inset: 0; opacity: 0; will-change: opacity;
  background: var(--texture-givre) 0 0 / 200px 200px, radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(200, 235, 255, 0.55) 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, transparent 40%, #000 95%); mask-image: radial-gradient(ellipse at 50% 50%, transparent 40%, #000 95%);
}
.cin-menace.active .cin-givre-montant { animation: cin-givre-monte 7s ease-in forwards; }
@keyframes cin-givre-monte { to { opacity: 0.6; } }

/* 10. Le gel : Kryos règne */
.cin-givre-montant.plein { opacity: 0.75; animation: none; }
.cin-eclair { position: absolute; inset: 0; background: #f2fbff; opacity: 0; will-change: opacity; }
.cin-gel.active .cin-eclair { animation: cin-flash 1.2s ease-out; }
.cin-gel.immediat .cin-eclair { animation: none; }

/* =========================================================
   La visite du chalet, de l'intérieur : un couloir par étage, six portes numérotées
   par couloir (un calendrier de l'Avent qu'on parcourt), l'escalier entre les étages.
   Les tailles suivent la hauteur du couloir (unités cqh) : tout tient à la même échelle
   sur ordinateur comme sur téléphone, où l'on avance dans le couloir en le faisant glisser.
   ========================================================= */
.visite { position: relative; width: min(100% - 1.2rem, 1500px); margin: 0.55rem auto 0; }
.visite-barre { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.btn-escalier {
  font: inherit; font-size: 0.86rem; cursor: pointer; color: #ffe7a3; white-space: nowrap;
  background: linear-gradient(180deg, #6b3f1f, #4a2a12); border: 1px solid #c9a35a; border-radius: 999px; padding: 0.32em 0.9em;
}
.btn-escalier:hover { filter: brightness(1.15); }
.plan-etages { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: center; }
.pastille-etage {
  position: relative; font: inherit; font-size: 0.8rem; cursor: pointer; color: var(--texte); display: inline-flex; align-items: baseline; gap: 0.35em;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--bord); border-radius: 999px; padding: 0.28em 0.75em;
}
.pastille-etage .pastille-compte { font-size: 0.74rem; color: var(--texte-doux); }
.pastille-court { display: none; }
.pastille-etage { white-space: nowrap; flex: none; }
.couloir-defil.glisse { cursor: grabbing; }
@media (pointer: fine) { .couloir-defil { cursor: grab; } }
.pastille-etage.actif { background: linear-gradient(180deg, #f5c542, #c9952a); color: #2a1a05; border-color: #fff0b0; font-weight: 700; }
.pastille-etage.actif .pastille-compte { color: #4a3008; }
.pastille-etage.complet::after { content: "✓"; margin-left: 0.15em; color: #3ddc84; font-weight: 700; }
.pastille-etage.a-jouer::before { content: ""; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a5f; box-shadow: 0 0 6px #ff5a5f; }

.visite-cadre {
  position: relative; height: clamp(360px, calc(100vh - 215px), 640px); overflow: hidden; border-radius: 18px;
  border: 1px solid rgba(245, 197, 66, 0.35); background: #05080f;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 3px rgba(0, 0, 0, 0.3);
}
.visite-tour { height: 400%; transition: transform 0.8s cubic-bezier(0.6, 0, 0.25, 1); will-change: transform; }
.couloir { position: relative; height: 25%; overflow: hidden; container-type: size; --givre: 1; }
/* Les étages qu'on ne voit pas ne s'animent pas (le navigateur n'a rien à recalculer pour eux) */
.couloir:not(.actif) * { animation-play-state: paused !important; }
.couloir-defil { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.couloir-defil::-webkit-scrollbar { display: none; }
.couloir-piste {
  --plafond: #2a170b; --poutres: none; --mur: #5a3820; --motif: none; --lambris: none; --plinthe: #2a170b; --sol-haut: #6b4223; --sol-bas: #2e1a0c; --tapis: none;
  position: relative; display: flex; align-items: stretch; justify-content: center; height: 100%; min-width: 100%; width: max-content;
  background:
    var(--poutres),
    linear-gradient(180deg, var(--plafond) 0 9cqh, rgba(0, 0, 0, 0.45) 9cqh 10cqh, transparent 10cqh),
    linear-gradient(180deg, transparent 0 78cqh, var(--plinthe) 78cqh 80.5cqh, transparent 80.5cqh),
    var(--tapis),
    repeating-linear-gradient(180deg, transparent 0 3.6cqh, rgba(0, 0, 0, 0.22) 3.6cqh 4cqh) 0 80.5cqh / 100% 20cqh no-repeat,
    linear-gradient(180deg, transparent 0 80.5cqh, var(--sol-haut) 80.5cqh, var(--sol-bas) 100cqh),
    var(--lambris),
    var(--motif),
    var(--mur);
}
/* Le couloir de l'étage où l'on est a son propre calque : quand la caméra s'approche d'une porte,
   le navigateur l'agrandit sans le redessiner (le premier zoom coûtait 150 ms de calcul). */
.couloir.actif .couloir-piste { will-change: transform; }
.couloir-piste.camera-entre { transform: scale(2.6); transition: transform 0.85s cubic-bezier(0.6, 0, 0.3, 1); }

/* Les quatre décors */
.couloir-grenier .couloir-piste {
  --mur: #4a2c18; --poutres: repeating-linear-gradient(90deg, #22130a 0 4cqh, #3a2010 4cqh 22cqh) 0 0 / 100% 9cqh no-repeat;
  --motif: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 0.35cqh, transparent 0.35cqh 8cqh);
  --sol-haut: #5e3a1e; --sol-bas: #24140a;
}
.couloir-etage .couloir-piste {
  --mur: #7a1d2c; --motif: repeating-linear-gradient(90deg, rgba(255, 220, 170, 0.09) 0 2.4cqh, transparent 2.4cqh 6cqh);
  --lambris: linear-gradient(180deg, #c9a35a 0 0.6cqh, #4a2a12 0.6cqh) 0 56cqh / 100% 22cqh no-repeat; --plinthe: #2e1a0c;
  --sol-haut: #6b4223; --sol-bas: #2a170b; --tapis: linear-gradient(180deg, #c9a35a 0 0.5cqh, #8c1d2c 0.5cqh 9.5cqh, #c9a35a 9.5cqh) 0 86cqh / 100% 10cqh no-repeat;
}
.couloir-rdc .couloir-piste {
  --mur: #6b3f1f; --motif: repeating-linear-gradient(180deg, transparent 0 4.4cqh, rgba(0, 0, 0, 0.32) 4.4cqh 5.2cqh, rgba(255, 220, 170, 0.06) 5.2cqh 5.8cqh);
  --sol-haut: #8a8378; --sol-bas: #3e3a34; --plinthe: #3a2a20;
}
.couloir-soussol .couloir-piste {
  --mur: #3e434c; --plafond: #1d2027; --plinthe: #1d2027; --sol-haut: #4a4f58; --sol-bas: #1b1e24;
  --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.35' stroke-width='3'%3E%3Cpath d='M0 1.5H120M0 31.5H120M40 0V30M100 0V30M10 30V60M70 30V60'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.04'%3E%3Crect x='4' y='5' width='32' height='22' rx='4'/%3E%3Crect x='76' y='35' width='20' height='22' rx='4'/%3E%3C/g%3E%3C/svg%3E") 0 10cqh / 21cqh 10.5cqh;
}
/* Kryos a gelé les murs : le givre recule à mesure que les pièces de l'étage sont réparées */
.couloir-givre {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: calc(0.25 + 0.75 * var(--givre)); transition: opacity 1.5s ease;
  background: var(--texture-givre) 0 0 / 26cqh 26cqh, radial-gradient(circle at 0 0, rgba(214, 238, 255, 0.55), transparent 40cqh), radial-gradient(circle at 100% 0, rgba(214, 238, 255, 0.45), transparent 36cqh);
  -webkit-mask-image: radial-gradient(circle at 0 0, #000, transparent 38cqh), radial-gradient(circle at 100% 0, #000, transparent 34cqh), radial-gradient(circle at 0 100%, #000, transparent 22cqh), radial-gradient(circle at 100% 100%, #000, transparent 22cqh);
  mask-image: radial-gradient(circle at 0 0, #000, transparent 38cqh), radial-gradient(circle at 100% 0, #000, transparent 34cqh), radial-gradient(circle at 0 100%, #000, transparent 22cqh), radial-gradient(circle at 100% 100%, #000, transparent 22cqh);
}
/* La guirlande du plafond : éteinte et givrée, elle s'allume quand tout l'étage est réparé */
.couloir-guirlande {
  position: absolute; left: 0; right: 0; top: 9.4cqh; height: 3cqh; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #7f9fbf 0 0.8cqh, transparent 1cqh) 0 0 / 5cqh 3cqh repeat-x;
}
.couloir.complet .couloir-guirlande {
  background:
    radial-gradient(circle at 50% 50%, #ff5a5f 0 0.9cqh, transparent 1.3cqh) 0 0 / 20cqh 3cqh repeat-x,
    radial-gradient(circle at 50% 50%, #ffd23f 0 0.9cqh, transparent 1.3cqh) 5cqh 0 / 20cqh 3cqh repeat-x,
    radial-gradient(circle at 50% 50%, #3ddc84 0 0.9cqh, transparent 1.3cqh) 10cqh 0 / 20cqh 3cqh repeat-x,
    radial-gradient(circle at 50% 50%, #4aa3ff 0 0.9cqh, transparent 1.3cqh) 15cqh 0 / 20cqh 3cqh repeat-x;
  animation: guirlande-couloir 1.2s ease-in-out infinite alternate;
}
@keyframes guirlande-couloir { from { opacity: 0.6; } to { opacity: 1; } }

/* Une baie : une porte et, contre le mur, un objet du décor */
.baie { position: relative; flex: 0 0 auto; width: 32cqh; height: 100%; scroll-snap-align: center; }
.deco { position: absolute; z-index: 1; pointer-events: none; right: -5.5cqh; width: 11cqh; }
.deco .deco-svg { display: block; width: 100%; height: auto; overflow: visible; }
.deco-portrait, .deco-fenetre, .deco-lucarne { top: 38cqh; width: 10cqh; right: -5cqh; }
.deco-applique { top: 40cqh; width: 6cqh; right: -3cqh; }
.deco-lanterne, .deco-tuyaux { top: 9cqh; }
.deco-lanterne { top: 12cqh; width: 7cqh; right: -3.5cqh; }
.deco-malle, .deco-cheminee, .deco-horloge, .deco-portemanteau, .deco-serveur, .deco-tonneau { bottom: 19cqh; }
.deco-cheminee { width: 15cqh; right: -7.5cqh; }
.deco-horloge { width: 7cqh; right: -3.5cqh; }
.deco-portemanteau, .deco-serveur { width: 9cqh; right: -4.5cqh; }
.deco-tonneau { width: 8cqh; right: -4cqh; }
.baie:last-of-type .deco { display: none; }
.deco-flamme { transform-box: fill-box; transform-origin: 50% 100%; animation: cin-flamme 0.5s ease-in-out infinite alternate; }
.deco-halo { animation: bougie 2.6s ease-in-out infinite; }
.deco-feu { transform-box: fill-box; transform-origin: 50% 100%; animation: cin-flamme 0.7s ease-in-out infinite alternate; }
.deco-balancier { transform-box: view-box; transform-origin: 25px 60px; animation: balancier 1s ease-in-out infinite alternate; }
@keyframes balancier { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.deco-led { animation: d-clignote-led 1.3s steps(2, jump-none) infinite; }
@keyframes d-clignote-led { from { opacity: 1; } to { opacity: 0.25; } }

/* Les bouts du couloir : l'escalier, ou un mur */
.couloir-bout { position: relative; flex: 0 0 auto; width: 22cqh; height: 100%; border: 0; padding: 0; margin: 0; background: none; color: inherit; font: inherit; }
button.couloir-bout { cursor: pointer; }
.escalier-dessin { position: absolute; left: 0; right: 0; bottom: 19.5cqh; height: 62cqh; }
.escalier-dessin svg { width: 100%; height: 100%; display: block; }
.escalier.descend .escalier-dessin { transform: scaleX(-1); }
.panneau-escalier {
  position: absolute; left: 50%; top: 16cqh; transform: translateX(-50%); white-space: nowrap; z-index: 2;
  padding: 0.6cqh 1.4cqh; border-radius: 1cqh; background: linear-gradient(180deg, #6b3f1f, #4a2a12); border: 0.3cqh solid #c9a35a;
  color: #ffe7a3; font: 600 clamp(0.62rem, 2.5cqh, 0.88rem)/1.2 var(--conte); box-shadow: 0 0.6cqh 1.4cqh rgba(0, 0, 0, 0.45);
}
button.couloir-bout:hover .panneau-escalier, button.couloir-bout:focus-visible .panneau-escalier { background: linear-gradient(180deg, #8a5a30, #5a3418); }
button.couloir-bout:focus-visible { outline: 3px solid var(--or); outline-offset: -6px; border-radius: 12px; }

/* Les portes */
.porte {
  position: absolute; left: 50%; bottom: 19.6cqh; width: 20cqh; height: 44cqh; margin-left: -10cqh; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; cursor: pointer; perspective: 70cqh; -webkit-tap-highlight-color: transparent; z-index: 2;
}
.porte:focus-visible { outline: none; }
.porte:focus-visible .porte-cadre { box-shadow: 0 0 0 0.8cqh #5a3418, 0 0 0 1.2cqh #2a170b, 0 0 0 1.8cqh var(--or); }
.porte-cadre {
  position: absolute; inset: 0; border-radius: 10cqh 10cqh 0.4cqh 0.4cqh; background: #120a05;
  box-shadow: 0 0 0 0.8cqh #5a3418, 0 0 0 1.2cqh #2a170b, 0 1.6cqh 3cqh rgba(0, 0, 0, 0.55);
}
.porte-interieur, .porte-battant, .porte-givre { position: absolute; inset: 0.9cqh 0.9cqh 0; border-radius: 9cqh 9cqh 0 0; }
.porte-interieur { overflow: hidden; background: radial-gradient(ellipse at 50% 70%, #3a2a12, #05080f 75%); }
.porte-interieur .decor-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* La pièce entrevue par la porte entrouverte reste immobile : ses guirlandes animées, dessinées en
   six exemplaires dans le couloir, faisaient tomber l'animation à 35 images par seconde (60 sans). */
.porte-interieur * { animation: none !important; }
.porte-battant {
  overflow: hidden; transform-origin: 0 50%; transition: transform 1s cubic-bezier(0.5, 0, 0.25, 1);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent 26%, rgba(255, 255, 255, 0.07) 62%, rgba(0, 0, 0, 0.22)), var(--couleur);
  box-shadow: inset 0 0 0 0.45cqh rgba(0, 0, 0, 0.3);
}
.porte-battant::before, .porte-battant::after { content: ""; position: absolute; left: 15%; right: 15%; border: 0.5cqh solid rgba(0, 0, 0, 0.24); box-shadow: inset 0 0 0 0.25cqh rgba(255, 255, 255, 0.08); }
.porte-battant::before { top: 12%; height: 30%; border-radius: 6cqh 6cqh 0.8cqh 0.8cqh; }
.porte-battant::after { top: 56%; height: 34%; border-radius: 0.8cqh; }
.porte-numero {
  position: absolute; z-index: 1; left: 50%; top: 27%; width: 13cqh; height: 13cqh; margin-left: -6.5cqh; display: grid; place-items: center;
  font: 700 6.4cqh/1 Georgia, "Times New Roman", serif; color: #ffe7a3; text-shadow: 0 0.3cqh 0 rgba(0, 0, 0, 0.5);
  background: radial-gradient(circle, transparent 54%, #1f7a4d 55% 66%, #145a36 67% 70%, transparent 71%);
}
.porte-numero::after { content: ""; position: absolute; left: 50%; bottom: 0.4cqh; width: 3.4cqh; height: 2.4cqh; margin-left: -1.7cqh; background: #d62839; clip-path: polygon(0 0, 100% 0, 75% 50%, 100% 100%, 50% 70%, 0 100%, 25% 50%); }
.porte-poignee { position: absolute; z-index: 1; right: 11%; top: 56%; width: 2.4cqh; height: 2.4cqh; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #c9a35a 60%, #7a5a14); box-shadow: 0 0.3cqh 0.5cqh rgba(0, 0, 0, 0.5); }
.porte-chaines, .porte-cadenas { position: absolute; z-index: 2; display: none; }
.porte-chaines { inset: 30% 4% 22%; }
.porte-chaines svg { width: 100%; height: 100%; display: block; }
.porte-cadenas { left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: 4.6cqh; line-height: 1; }
.porte-givre { pointer-events: none; opacity: 0; transition: opacity 1s ease; background: var(--texture-givre) 0 0 / 13cqh 13cqh, radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(214, 238, 255, 0.75) 100%); }
.porte-aura { position: absolute; left: -45%; right: -45%; top: -18%; bottom: -6%; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 55%, rgba(255, 214, 110, 0.5), transparent 62%); will-change: opacity; }
.porte-lumiere {
  position: absolute; left: -35%; right: -35%; top: 100%; height: 15cqh; z-index: -1; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(255, 205, 120, 0.55), rgba(255, 205, 120, 0)); clip-path: polygon(32% 0, 68% 0, 100% 100%, 0 100%);
}
.porte-kere { position: absolute; z-index: 3; right: -5cqh; top: -2cqh; width: 8.5cqh; opacity: 0; pointer-events: none; transition: opacity 0.6s; }
.porte-kere .givrin-svg { width: 100%; height: auto; display: block; overflow: visible; }
.porte-panneau {
  position: absolute; left: 50%; bottom: calc(100% + 5.5cqh); width: 25cqh; margin-left: -12.5cqh; z-index: 2;
  padding: 0.6cqh 1cqh; border-radius: 1cqh; background: linear-gradient(180deg, #6b3f1f, #4a2a12); border: 0.3cqh solid #c9a35a;
  color: #ffe7a3; font: 600 clamp(0.6rem, 2.35cqh, 0.86rem)/1.2 var(--conte); text-align: center; box-shadow: 0 0.6cqh 1.4cqh rgba(0, 0, 0, 0.45);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.porte-prochaine {
  position: absolute; left: 50%; top: calc(100% + 2.4cqh); z-index: 3; white-space: nowrap; display: none; transform: translateX(-50%);
  padding: 0.5cqh 1.4cqh; border-radius: 999px; background: linear-gradient(180deg, #ffe08a, #f5c542); color: #3a2508;
  font: 700 clamp(0.6rem, 2.3cqh, 0.82rem)/1.2 inherit; box-shadow: 0 0 2cqh rgba(255, 214, 110, 0.75);
}
/* Les états */
.porte.verrouillee .porte-battant, .porte.fermee .porte-battant { filter: saturate(0.45) brightness(0.62); }
.porte.verrouillee .porte-chaines, .porte.verrouillee .porte-cadenas, .porte.fermee .porte-cadenas { display: block; }
.porte.verrouillee .porte-givre { opacity: 0.85; }
.porte.verrouillee .porte-panneau, .porte.fermee .porte-panneau { color: #c9b48a; filter: brightness(0.8); }
.porte.disponible .porte-givre { opacity: 0.6; }
.porte.disponible .porte-aura { opacity: 1; animation: aura-porte 2.2s ease-in-out infinite alternate; }
@keyframes aura-porte { from { opacity: 0.45; } to { opacity: 1; } }
.porte.disponible .porte-kere { opacity: 1; animation: kere-porte 2.8s ease-in-out infinite alternate; }
@keyframes kere-porte { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-2.4cqh) rotate(6deg); } }
.porte.disponible:hover .porte-battant { transform: rotateY(-14deg); }
.porte.resolue .porte-battant { transform: rotateY(-44deg); }
.porte.resolue .porte-lumiere { opacity: 1; }
.porte.resolue:hover .porte-battant { transform: rotateY(-58deg); }
.porte.prochaine .porte-prochaine { display: block; animation: rebond-prochaine 1.2s ease-in-out infinite alternate; }
@keyframes rebond-prochaine { from { transform: translate(-50%, 0); } to { transform: translate(-50%, -1cqh); } }
.porte.ouvre .porte-battant { transform: rotateY(-108deg); transition-duration: 0.8s; }
.porte.ouvre .porte-kere { opacity: 0; }
.porte.secouee { animation: porte-secouee 0.5s ease-in-out; }
@keyframes porte-secouee { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-1.2cqh) rotate(-1deg); } 40% { transform: translateX(1cqh) rotate(1deg); } 60% { transform: translateX(-0.7cqh); } 80% { transform: translateX(0.5cqh); } }
/* Le Grand Salon (jour 24) : une double porte plus haute, sous l'emprise de Kryos */
.baie-24 .porte { width: 24cqh; margin-left: -12cqh; height: 50cqh; }
.baie-24 .porte-numero { color: #bfe6ff; }
.baie-24 .porte-kere { width: 10cqh; right: -6cqh; }

/* Les flèches pour avancer dans le couloir (quand il dépasse de l'écran) */
.pas-couloir {
  position: absolute; top: 50%; z-index: 4; width: 2.6rem; height: 4.2rem; margin-top: -2.1rem; border-radius: 14px; cursor: pointer;
  background: rgba(5, 10, 20, 0.55); color: #ffe7a3; font-size: 2.1rem; line-height: 1; border: 1px solid rgba(245, 197, 66, 0.5);
}
.pas-couloir:hover { background: rgba(5, 10, 20, 0.8); }
.pas-couloir.gauche { left: 0.45rem; }
.pas-couloir.droite { right: 0.45rem; }

/* La lumière de la pièce qui envahit l'écran quand la porte s'ouvre */
.voile-entree {
  position: fixed; inset: 0; z-index: 25; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--x) var(--y), #fffbea 0, #ffe7a8 14%, rgba(255, 210, 130, 0.92) 34%, rgba(255, 200, 110, 0) 62%);
  transform-origin: var(--x) var(--y); animation: voile-entree 0.82s ease-in forwards; will-change: opacity, transform;
}
@keyframes voile-entree { 0% { opacity: 0; transform: scale(0.35); } 45% { opacity: 0.6; } 100% { opacity: 1; transform: scale(3.2); } }
.voile-entree.dissipe { animation: voile-sort 0.6s ease-out forwards; }
@keyframes voile-sort { from { opacity: 1; transform: scale(3.2); } to { opacity: 0; transform: scale(3.6); } }

/* L'arrivée par téléportation : la caméra recule dans le couloir */
.visite.arrivee .visite-cadre { animation: arrivee-visite 1.6s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes arrivee-visite { from { transform: scale(1.18); opacity: 0.2; } to { transform: none; opacity: 1; } }

/* Le pied de la visite : la vue d'ensemble (le calendrier vu de dehors, et le sapin du jardin) */
.visite-pied { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 0.2rem; }
.visite-pied .btn { font-size: 0.88rem; padding: 0.4em 1em; }
.retour-interieur { display: flex; justify-content: center; margin: 0.4rem 0 0.2rem; }

@media (max-width: 760px) {
  .visite { width: calc(100% - 0.8rem); }
  .btn-escalier { display: none; } /* sur téléphone : les pastilles et l'escalier au bout du couloir suffisent */
  .plan-etages { gap: 0.25rem; flex-wrap: nowrap; }
  .pastille-etage { font-size: 0.7rem; padding: 0.24em 0.5em; }
  .visite-cadre > .visite-barre { padding: 0.25rem 0.3rem; }
  .pastille-etage .pastille-nom { display: none; }
  .pastille-etage .pastille-court { display: inline; }
  .visite-cadre { height: clamp(330px, calc(100vh - 300px), 600px); height: clamp(330px, calc(100svh - 300px), 600px); border-radius: 14px; }
}

/* =========================================================
   Dans une pièce : 1. le projecteur des lutins projette le petit cours,
   2. la Kère surgit dans un éclat de glace et lance son défi.
   ========================================================= */
/* Pendant la projection, la pièce est plongée dans la pénombre */
.bandeau-jour::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: rgba(2, 5, 12, 0.72); opacity: 0; transition: opacity 0.9s ease; }
.jour.en-projection .bandeau-jour::after { opacity: 1; }
.bandeau-texte { z-index: 2; }

.projection { position: relative; padding-top: 0.2rem; }
.projection[hidden], .defi[hidden] { display: none; }
.projecteur { position: relative; z-index: 2; width: 118px; margin: -0.3rem auto 0; }
.projecteur svg { display: block; width: 100%; height: auto; overflow: visible; }
.projecteur .bobine { transform-box: fill-box; transform-origin: center; animation: cin-tourne 1.6s linear infinite; }
.projecteur .bobine.b2 { animation-duration: 2.1s; }
.projecteur .lentille { filter: drop-shadow(0 0 6px #fff6d0); }
/* Le faisceau de lumière, de la lentille jusqu'à l'écran */
.faisceau-projection {
  position: relative; z-index: 1; height: 54px; margin: -4px auto -2px; width: 100%; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 246, 208, 0.62), rgba(255, 246, 208, 0.1));
  clip-path: polygon(47.5% 0, 52.5% 0, 100% 100%, 0 100%);
}
.ecran-projection {
  position: relative; padding: 1rem 1.3rem 1.2rem; border-radius: 6px; transform-origin: 50% 0;
  background: radial-gradient(ellipse 80% 40% at 50% 0, rgba(255, 246, 208, 0.16), transparent 70%), linear-gradient(180deg, #14294a, #0d1f3a);
  border: 1px solid rgba(255, 246, 208, 0.4); box-shadow: 0 0 46px rgba(255, 236, 170, 0.18), inset 0 0 60px rgba(0, 0, 0, 0.35);
}
/* Le film qui scintille, juste au démarrage */
.ecran-projection::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: rgba(255, 246, 208, 0.05); opacity: 0; }
.projection.allume .projecteur { animation: projecteur-allume 0.5s ease-out both; }
.projection.allume .faisceau-projection { animation: faisceau-allume 1.2s steps(1, end) both, faisceau-vibre 0.16s steps(2, jump-none) 1.2s 10 alternate; }
.projection.allume .ecran-projection { animation: ecran-deroule 0.8s cubic-bezier(0.3, 1.25, 0.5, 1) 0.35s both; }
.projection.allume .ecran-projection::after { animation: film-scintille 0.12s steps(2, jump-none) 1s 16 alternate; }
@keyframes projecteur-allume { from { opacity: 0; transform: translateY(-10px); } }
@keyframes faisceau-allume { 0% { opacity: 0; } 20% { opacity: 1; } 28% { opacity: 0.2; } 36%, 100% { opacity: 1; } }
@keyframes faisceau-vibre { from { opacity: 0.85; } to { opacity: 1; } }
@keyframes ecran-deroule { from { transform: scaleY(0.04); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes film-scintille { from { opacity: 0; } to { opacity: 1; } }
.projection.repli .ecran-projection { animation: ecran-enroule 0.42s ease-in forwards; }
.projection.repli .faisceau-projection, .projection.repli .projecteur { transition: opacity 0.35s; opacity: 0; }
@keyframes ecran-enroule { to { transform: scaleY(0.03); opacity: 0; } }
.passer-cours { float: right; margin: 0 0 0.4rem 0.6rem; font-size: 0.85rem; }
.titre-projection { margin: 0.1rem 0 0.2rem; font-family: var(--conte); color: #ffe7a3; font-size: 1.25rem; }
.titre-projection:focus, .titre-defi:focus { outline: none; }
.sous-titre-projection { margin: 0 0 0.6rem; font-size: 0.9rem; color: #bfd3ea; font-style: italic; }
.ecran-projection .contenu-cours { padding: 0; }
.suite-projection { margin: 1.1rem 0 0.2rem; }

/* Le défi : la Kère surgit dans un éclat de glace */
.titre-defi { margin: 0 0 0.5rem; font-family: var(--conte); color: #bfe6ff; font-size: 1.15rem; }
.revoir-cours { display: inline-block; margin: 0.2rem 0 0.4rem; font-size: 0.86rem; padding: 0.35em 0.9em; }
.eclats-entree { position: absolute; inset: 0; pointer-events: none; }
.defi.surgit .givrin-carte { animation: kere-surgit 0.75s cubic-bezier(0.3, 1.45, 0.5, 1) both; }
.defi.surgit .givrin-avatar { animation: kere-tourbillon 0.75s ease-out both; }
.defi.surgit .eclats-entree .eclat { animation: eclat 0.8s cubic-bezier(0.2, 0.7, 0.4, 1) 0.15s forwards; }
.defi.surgit .givrin-bulle { animation: bulle-apparait 0.5s ease-out 0.55s both; }
.defi.surgit .titre-defi, .defi.surgit .histoire, .defi.surgit .enigme { animation: defi-apparait 0.6s ease-out both; }
.defi.surgit .titre-defi { animation-delay: 0.35s; }
.defi.surgit .histoire { animation-delay: 0.5s; }
.defi.surgit .enigme { animation-delay: 0.65s; }
@keyframes kere-surgit { from { opacity: 0; transform: scale(0.6) translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes kere-tourbillon { from { transform: rotate(-200deg) scale(0.2); } to { transform: none; } }
@keyframes bulle-apparait { from { opacity: 0; transform: translateX(-10px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes defi-apparait { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .ecran-projection { padding: 0.85rem 0.85rem 1rem; }
  .passer-cours { float: none; display: block; margin: 0 0 0.3rem auto; }
  .projecteur { width: 96px; }
}

/* =========================================================
   Dans le chalet, en plein écran : plus de ciel ni de paysage du dehors, seulement l'intérieur.
   La barre de l'escalier flotte en haut du couloir, le guide et les découvertes en bas.
   ========================================================= */
body.dans-le-chalet { background: #070403; }
body.dans-le-chalet .ciel, body.dans-le-chalet .paysage-fond, body.dans-le-chalet #neige { display: none; }
body.dans-le-chalet .hud { background: rgba(12, 7, 4, 0.94); border-bottom-color: rgba(201, 163, 90, 0.4); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.dans-le-chalet .infos-jeu { margin: 0; padding: 0.3rem 0.6rem; background: #0d0806; border-bottom: 1px solid rgba(201, 163, 90, 0.2); }
body.dans-le-chalet .visite { width: 100%; margin: 0; }
body.dans-le-chalet .visite-cadre {
  height: calc(100vh - var(--haut-dessus, 100px)); height: calc(100dvh - var(--haut-dessus, 100px)); min-height: 340px;
  border: 0; border-radius: 0; box-shadow: none;
}
body.dans-le-chalet .pied { background: #070403; }
.btn-dehors { display: none; }
.visite-bas .btn-dehors { display: inline-flex; }

/* La barre de l'escalier, par-dessus le plafond du couloir */
.visite-cadre > .visite-barre {
  position: absolute; z-index: 6; top: 0.5rem; left: 50%; transform: translateX(-50%); margin: 0; max-width: calc(100% - 1rem);
  padding: 0.3rem 0.45rem; border-radius: 999px; background: rgba(12, 7, 4, 0.78); border: 1px solid rgba(201, 163, 90, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); flex-wrap: nowrap;
}
/* En bas, sur le parquet : le guide, les découvertes, la sortie */
.visite-bas {
  position: absolute; z-index: 6; bottom: 0.6rem; left: 50%; transform: translateX(-50%); display: flex; gap: 0.45rem; align-items: center;
  max-width: calc(100% - 1rem); flex-wrap: nowrap;
}
.visite-bas > * { white-space: nowrap; }
.btn-guide, .compteur-decouvertes, .visite-bas .btn-dehors {
  font: inherit; font-size: 0.84rem; color: #ffe7a3; background: rgba(12, 7, 4, 0.8); border: 1px solid rgba(201, 163, 90, 0.55);
  border-radius: 999px; padding: 0.35em 0.9em; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.btn-guide { cursor: pointer; background: linear-gradient(180deg, #f5c542, #c9952a); color: #2a1a05; font-weight: 700; border-color: #fff0b0; }
.btn-guide:hover { filter: brightness(1.08); }
.compteur-decouvertes { cursor: default; }
.compteur-decouvertes.complet { background: linear-gradient(180deg, #3ddc84, #1f8a4d); color: #fff; }
@media (max-width: 760px) {
  .visite-bas .btn-dehors .texte-long { display: none; }
  .btn-guide, .compteur-decouvertes, .visite-bas .btn-dehors { font-size: 0.74rem; padding: 0.32em 0.7em; }
}

/* La porte vers laquelle on est guidé */
.porte.guidee .porte-cadre { animation: porte-guidee 0.8s ease-in-out 4; }
@keyframes porte-guidee { 0%, 100% { box-shadow: 0 0 0 0.8cqh #5a3418, 0 0 0 1.2cqh #2a170b, 0 0 0 1.2cqh rgba(255, 214, 110, 0); } 50% { box-shadow: 0 0 0 0.8cqh #5a3418, 0 0 0 1.2cqh #2a170b, 0 0 0 3.4cqh rgba(255, 214, 110, 0.65); } }

/* Les objets à découvrir : ils scintillent tant qu'on ne les a pas examinés */
.deco.decouverte { pointer-events: auto; cursor: zoom-in; padding: 0; border: 0; background: none; color: inherit; font: inherit; z-index: 3; -webkit-tap-highlight-color: transparent; }
.deco.decouverte .deco-dessin { display: block; transition: transform 0.2s ease; }
.deco.decouverte:hover .deco-dessin, .deco.decouverte:focus-visible .deco-dessin { transform: scale(1.08) rotate(-2deg); }
.deco.decouverte:focus-visible { outline: 2px solid var(--or); outline-offset: 4px; border-radius: 8px; }
.scintillement {
  position: absolute; top: -1.6cqh; right: -0.6cqh; font-size: 3cqh; line-height: 1; color: #fff3c4; pointer-events: none;
  text-shadow: 0 0 1.2cqh #ffd27a; animation: scintillement 2.4s ease-in-out infinite;
}
@keyframes scintillement { 0%, 60%, 100% { opacity: 0; transform: scale(0.4) rotate(0); } 75% { opacity: 1; transform: scale(1.2) rotate(45deg); } 90% { opacity: 0.6; transform: scale(0.8) rotate(90deg); } }
.deco.decouverte.vue .scintillement { display: none; }
.carte-decouverte {
  position: absolute; z-index: 8; left: 50%; top: 50%; width: min(420px, calc(100% - 2rem)); transform: translate(-50%, -50%);
  padding: 1.1rem 1.3rem 1.2rem; border-radius: 6px; text-align: center; color: #3b2a12;
  background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 70, 20, 0.22) 100%), linear-gradient(180deg, #f9f0d9, #ecd9ad);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 0 40px rgba(140, 90, 30, 0.3); animation: decouverte-apparait 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.carte-decouverte.sort { animation: decouverte-sort 0.25s ease-in forwards; }
@keyframes decouverte-apparait { from { opacity: 0; transform: translate(-50%, -46%) scale(0.85) rotate(-3deg); } }
@keyframes decouverte-sort { to { opacity: 0; transform: translate(-50%, -54%) scale(0.92); } }
.decouverte-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 0.3rem; }
.decouverte-sur { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8a5a10; }
.carte-decouverte h3 { margin: 0.25rem 0 0.4rem; font-family: var(--conte); font-size: 1.25rem; color: #4a2c0e; }
.carte-decouverte p { margin: 0.3rem 0 0.8rem; line-height: 1.5; }
.decouverte-bravo { font-weight: 700; color: #1f6a3d; }

/* Une pièce réparée : la Kère s'enfuit, la porte s'illumine et s'entrouvre */
.porte.celebree .porte-battant { animation: porte-s-ouvre 1.4s cubic-bezier(0.5, 0, 0.25, 1) 0.45s both; }
@keyframes porte-s-ouvre { from { transform: rotateY(0); } to { transform: rotateY(-44deg); } }
.porte.celebree .porte-aura { opacity: 1; animation: aura-victoire 1.8s ease-out; background: radial-gradient(ellipse at 50% 55%, rgba(255, 228, 140, 0.9), transparent 65%); }
@keyframes aura-victoire { 0% { opacity: 0; transform: scale(0.6); } 30% { opacity: 1; transform: scale(1.25); } 100% { opacity: 0.5; transform: scale(1); } }
.porte.celebree .porte-lumiere { opacity: 1; transition: opacity 1s 0.8s; }
.kere-fuite { position: absolute; z-index: 5; right: -5cqh; top: -2cqh; width: 9cqh; pointer-events: none; animation: kere-fuite 1.6s cubic-bezier(0.4, 0, 0.8, 0.6) forwards; }
.kere-fuite .givrin-svg { width: 100%; height: auto; display: block; }
@keyframes kere-fuite {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  25% { transform: translate(-2cqh, -3cqh) rotate(-12deg) scale(1.15); opacity: 1; }
  100% { transform: translate(40cqh, -60cqh) rotate(40deg) scale(0.3); opacity: 0; }
}
.gerbe-porte { position: absolute; left: 50%; top: 45%; width: 0; height: 0; pointer-events: none; z-index: 4; }
.gerbe-porte i { position: absolute; width: 1.2cqh; height: 1.2cqh; margin: -0.6cqh; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 1.4cqh #ffd27a; opacity: 0; animation: gerbe-porte 1.1s cubic-bezier(0.2, 0.7, 0.4, 1) forwards; }
@keyframes gerbe-porte { 0% { opacity: 1; transform: translate(0, 0) scale(1.2); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); } }

/* Un étage libéré : le givre fond, la guirlande s'allume d'un bout à l'autre, une vague d'or passe */
.couloir.liberation .couloir-givre { animation: givre-fond 2.6s ease-in forwards; }
@keyframes givre-fond { from { opacity: 1; } to { opacity: 0.25; } }
.couloir.liberation .couloir-guirlande { animation: guirlande-allume 2.2s steps(14, end) 0.6s both; }
@keyframes guirlande-allume { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.vague-doree {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; will-change: transform;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 226, 140, 0.0) 38%, rgba(255, 226, 140, 0.45) 50%, rgba(255, 226, 140, 0) 62%, transparent 70%);
  transform: translateX(-100%); animation: vague-doree 2.4s ease-in-out 0.3s forwards;
}
@keyframes vague-doree { to { transform: translateX(100%); } }
.banniere-liberation {
  position: absolute; z-index: 7; left: 50%; top: 30%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  padding: 0.8rem 1.6rem; border-radius: 14px; background: rgba(12, 7, 4, 0.82); border: 2px solid #f5c542; text-align: center;
  box-shadow: 0 0 40px rgba(255, 210, 110, 0.5); animation: banniere 4.2s ease both; white-space: nowrap; max-width: 92%;
}
.banniere-titre { font-family: var(--conte); font-size: clamp(1.2rem, 4.5cqh, 2rem); color: #ffe7a3; font-weight: 700; }
.banniere-sous-titre { font-size: 0.92rem; color: #f0e2c0; }
@keyframes banniere { 0% { opacity: 0; transform: translate(-50%, -40%) scale(0.8); } 12%, 85% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -56%) scale(0.96); } }

/* =========================================================
   Le compteur de tentatives du défi (pas de chrono : on prend son temps)
   ========================================================= */
.tentatives-defi {
  position: sticky; top: 0.6rem; z-index: 6; display: flex; align-items: center; gap: 0.45rem; width: fit-content; margin: 0 auto 0.9rem;
  padding: 0.35rem 1rem 0.35rem 0.75rem; border-radius: 999px; background: rgba(8, 18, 36, 0.92); border: 1px solid rgba(255, 214, 110, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); font-variant-numeric: tabular-nums; color: #f3e6c4;
}
.tentatives-icone { font-size: 1.05rem; }
.tentatives-nombre { font-family: var(--mono); font-size: 1.2rem; color: #ffe7a3; min-width: 1.4em; text-align: center; display: inline-block; }
.tentatives-defi.compte .tentatives-nombre { animation: tentative-compte 0.45s ease-out; }
@keyframes tentative-compte { 40% { transform: scale(1.45); color: #ffb3bd; } }
.tentatives-defi.vaincu { opacity: 0.6; }
/* Petit écran : un compteur discret, en petit texte. Collé en haut quand on fait défiler (classe « colle »),
   il se décale pour tomber pile entre « 🏡 Chalet » (à gauche) et le bouton du son (à droite). */
@media (max-width: 480px) {
  .tentatives-defi { gap: 0.3rem; padding: 0.2rem 0.7rem 0.2rem 0.55rem; font-size: 0.78rem; top: 0.55rem; transition: translate 0.25s ease; }
  .tentatives-icone { font-size: 0.85rem; }
  .tentatives-nombre { font-size: 0.95rem; }
  .tentatives-defi.colle { translate: 1.3rem 0; }
}
@media (max-width: 480px) and (prefers-reduced-motion: reduce) { .tentatives-defi { transition: none; } }
.liste-indices + .btn.propose, .btn.propose { animation: indice-propose 0.8s ease-in-out 5; border-color: var(--or); }
@keyframes indice-propose { 50% { transform: scale(1.06); box-shadow: 0 0 18px rgba(255, 214, 110, 0.7); } }
.tentatives-victoire { display: inline-block; margin-right: 0.4rem; padding: 0.1em 0.6em; border-radius: 999px; background: rgba(255, 255, 255, 0.15); font-weight: 700; }

/* =========================================================
   La Kère se présente : grande, ailes qui battent, bouche qui parle
   ========================================================= */
.defi .givrin-carte { padding: 0.9rem 1.2rem; gap: 1.1rem; }
.defi .givrin-avatar { width: 128px; height: 128px; }
.defi .givrin-carte.boss .givrin-avatar { width: 150px; height: 150px; }
.defi .givrin-bulle { font-size: 1.08rem; min-height: 2.6em; }
.givrin-svg .aile { transform-box: fill-box; }
.givrin-svg .aile-g { transform-origin: 100% 70%; }
.givrin-svg .aile-d { transform-origin: 0 70%; }
.givrin-svg .yeux { transform-box: fill-box; transform-origin: center; }
.givrin-svg .bouche { transform-box: fill-box; transform-origin: 50% 20%; }
.givrin-carte .givrin-svg .aile, .givrin-chasse .givrin-svg .aile { animation: aile-kere 0.32s ease-in-out infinite alternate; }
.givrin-carte .givrin-svg .aile-d { animation-delay: 0.04s; }
@keyframes aile-kere { to { transform: rotate(-16deg) scaleY(0.8); } }
.givrin-svg .aile-d { --sens: 1; }
.givrin-carte .givrin-svg .aile-d { animation-name: aile-kere-d; }
@keyframes aile-kere-d { to { transform: rotate(16deg) scaleY(0.8); } }
.givrin-carte .givrin-svg .yeux { animation: cligne-kere 4.5s infinite; }
@keyframes cligne-kere { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
.givrin-carte.parle .givrin-svg .bouche { animation: parle-kere 0.16s ease-in-out infinite alternate; }
@keyframes parle-kere { to { transform: scaleY(1.7); } }
/* Dans le couloir et sur la façade : la Kère flotte, mais ses ailes restent immobiles (six dessins
   animés à la fois ralentiraient tout le couloir) */
.porte-kere .givrin-svg, .piece-givrin .givrin-svg { animation: none; }
@media (max-width: 480px) { .defi .givrin-avatar, .defi .givrin-carte.boss .givrin-avatar { width: 88px; height: 88px; } .defi .givrin-bulle { font-size: 0.98rem; } }
/* Les illustrations (public/media) : trois calques carrés superposés, la lueur est dans l'image
   (pas de filter, qui ferait redessiner la Kère à chaque battement d'ailes). Les ailes pivotent
   autour de leur attache, sur le dos de la Kère. */
.givrin-svg.givrin-img { position: relative; aspect-ratio: 1; filter: none; }
.givrin-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.givrin-img .aile-g { transform-origin: 33.4% 42.8%; }
.givrin-img .aile-d { transform-origin: 66.6% 42.8%; }
.givrin-carte .givrin-img .aile, .givrin-chasse .givrin-img .aile { animation-duration: 0.36s; }
/* Quand elle parle, tout son corps se tasse et s'étire un peu */
.givrin-img .corps { transform-origin: 50% 85%; }
.givrin-carte.parle .givrin-img .corps { animation: parle-image 0.16s ease-in-out infinite alternate; }
@keyframes parle-image { to { transform: scale(1.035, 0.965); } }

/* =========================================================
   Le cours en diapositives, sur la toile du projecteur
   ========================================================= */
.enrouleur { position: absolute; left: -10px; right: -10px; top: -12px; height: 14px; border-radius: 7px; background: linear-gradient(180deg, #7d8794, #3a404d 60%, #23272f); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5); }
.ecran-projection { margin-top: 10px; }
.diapos { position: relative; min-height: 11rem; }
.diapo[hidden] { display: none; }
.diapos.change .diapo:not([hidden]) { animation: diapo-arrive 0.45s ease-out; }
@keyframes diapo-arrive { 0% { opacity: 0; transform: translateX(14px); } 30% { opacity: 0.4; } 45% { opacity: 0.15; } 100% { opacity: 1; transform: none; } }
.diapo-pied { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 1rem; padding-top: 0.7rem; border-top: 1px dashed rgba(255, 246, 208, 0.25); }
.diapo-nav { font-size: 0.9rem; padding: 0.4em 1em; }
.diapo-nav:disabled { opacity: 0.35; cursor: default; }
.diapo-nav[hidden] { visibility: hidden; display: inline-block; }
.diapo-milieu { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.diapo-points { display: flex; gap: 0.35rem; }
.diapo-points i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 246, 208, 0.25); cursor: pointer; }
.diapo-points i.actif { background: #ffe7a3; box-shadow: 0 0 8px rgba(255, 231, 163, 0.8); }
.diapo-numero { font-size: 0.78rem; color: #bfd3ea; }
.suite-projection[hidden] { display: none; }
/* La poussière qui danse dans le faisceau du projecteur */
.faisceau-projection i { position: absolute; bottom: 0; width: 3px; height: 3px; border-radius: 50%; background: #fff6d0; opacity: 0; animation: poussiere-faisceau 6s linear infinite; }
@keyframes poussiere-faisceau { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 0.8; } 100% { opacity: 0; transform: translate(12px, -48px); } }
@media (max-width: 560px) { .diapo-nav { font-size: 0.8rem; padding: 0.35em 0.7em; } .diapos { min-height: 9rem; } }
/* (tout petit écran : les points et « Diapo 1 / 6 » passent au-dessus des deux boutons, sinon « Suivante ▶ » sortait de l'écran) */
@media (max-width: 360px) { .diapo-pied { flex-wrap: wrap; row-gap: 0.45rem; } .diapo-milieu { order: -1; flex-basis: 100%; } }

/* =========================================================
   La scène de chaque énigme (public/js/scenes.js) : un grand fond IMMOBILE, et de petits calques
   animés par-dessus (transform et opacity seulement) : Firefox ne redessine que ces calques.
   La scène couvre sa boîte (comme un fond « cover »), centrée, aux proportions 900 × 250.
   ========================================================= */
.scene-enigme { position: absolute; inset: 0; overflow: hidden; container-type: size; }
.scene-cadre { position: absolute; left: 50%; top: 50%; width: max(100cqw, 360cqh); aspect-ratio: 900 / 250; transform: translate(-50%, -50%); }
.scene-fond { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-fond * { animation: none !important; }
.sp { position: absolute; pointer-events: none; }
.sp > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sp.clip, .sp.clip > svg { overflow: hidden; }
/* La Kère : ses trois images (corps, ailes) comme sur sa carte, et ce qu'elle tient */
.kere-acteur .ka-vol, .kere-acteur .ka-pose { position: absolute; inset: 0; }
.kere-acteur img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.kere-acteur .aile-g { transform-origin: 33.4% 42.8%; animation: aile-kere 0.36s ease-in-out infinite alternate; }
.kere-acteur .aile-d { transform-origin: 66.6% 42.8%; animation: aile-kere-d 0.36s ease-in-out 0.04s infinite alternate; }
.ka-pose.retourne { transform: scaleX(-1); }
.ka-objet { position: absolute; overflow: visible; }
.kere-acteur .ka-vol { animation: ka-flotte 3.2s ease-in-out infinite; }
@keyframes ka-flotte { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6%) rotate(3deg); } }
/* Une mauvaise réponse : elle se tord de rire */
.scene-enigme.ricane .kere-acteur .ka-pose { animation: ka-rire 0.17s ease-in-out 8 alternate; }
@keyframes ka-rire { from { transform: translateY(0) rotate(-7deg); } to { transform: translateY(-6%) rotate(7deg) scale(1.07); } }
/* Chassée : elle file par le plafond ; il ne reste qu'une flaque et sa couronne */
.flaque-scene { opacity: 0; }
.scene-enigme.chassee .flaque-scene { opacity: 1; transition: opacity 0.6s 0.9s; }
.scene-enigme.chassee .kere-acteur { opacity: 0; transform: translate(60%, -160%) scale(0.35) rotate(50deg); transition: transform 1.2s cubic-bezier(0.5, -0.4, 0.7, 1), opacity 0.8s 0.5s; }
/* (Dans une case de la façade, la scène reste immobile : règle .piece-scene * plus haut.) */

/* Jour 1 : la guirlande-serrure clignote, la griffe grave, le bonhomme de neige fond */
.s1-amp, .s1-amp-volee { animation: s1-clignote 1.7s steps(1) infinite; }
@keyframes s1-clignote { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.s1-amp-volee { animation-duration: 0.5s; }
.s1-griffe { animation: s1-grave 3.4s ease-in-out infinite; }
@keyframes s1-grave { 0% { opacity: 0; transform: translate(0, 0) scale(0.6); } 12% { opacity: 1; transform: translate(80%, 20%) scale(1); } 50% { opacity: 1; transform: translate(620%, 140%) scale(1.1); } 60%, 100% { opacity: 0; transform: translate(640%, 150%) scale(0.5); } }
.s1-bonhomme { transform-origin: 50% 100%; animation: s1-fond 3.6s ease-in-out infinite alternate; }
@keyframes s1-fond { to { transform: scale(1.05, 0.9); } }
.s1-sueur path { animation: s1-goutte 1.6s ease-in infinite; }
.s1-sueur path + path { animation-delay: 0.7s; }
@keyframes s1-goutte { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }
.s1-case { animation: s1-case 2.4s ease-in-out infinite; }
@keyframes s1-case { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* Jour 2 : le ruban de 0 et de 1 défile, la Kère plonge tamponner « GELÉ », une lettre vole */
.s2-defile { animation: s2-defile 0.9s linear infinite; }
@keyframes s2-defile { from { transform: translateY(-14px); } to { transform: translateY(0); } }
.s2-kere { animation: s2-tamponne 2.6s ease-in-out infinite; }
@keyframes s2-tamponne { 0%, 22% { transform: translate(0, 0); } 32% { transform: translate(-22%, 78%); } 38% { transform: translate(-22%, 72%); } 54%, 100% { transform: translate(0, 0); } }
.s2-tampon-marque { animation: s2-marque 2.6s ease-in-out infinite; }
@keyframes s2-marque { 0%, 31% { opacity: 0; transform: scale(1.3); } 33% { opacity: 1; transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
.s2-enveloppe { animation: s2-vol 11s linear infinite; }
@keyframes s2-vol { 0% { transform: translate(0, 0) rotate(-8deg); } 25% { transform: translate(800%, 40%) rotate(6deg); } 50% { transform: translate(1600%, -10%) rotate(-6deg); } 75% { transform: translate(2400%, 50%) rotate(8deg); } 100% { transform: translate(3200%, 0) rotate(-8deg); } }

/* Jour 3 : la roue tourne, la lettre se brouille sous la plume */
.s3-roue-or { animation: s3-tourne 16s linear infinite; }
@keyframes s3-tourne { to { transform: rotate(360deg); } }
.s3-clair { animation: s3-clair 6s ease-in-out infinite; }
.s3-chiffre { animation: s3-clair 6s ease-in-out -3s infinite; }
@keyframes s3-clair { 0%, 38% { opacity: 1; } 50%, 88% { opacity: 0; } 100% { opacity: 1; } }
.s3-flamme { transform-origin: 50% 100%; animation: s3-flamme 0.4s ease-in-out infinite alternate; }
@keyframes s3-flamme { to { transform: scale(0.85, 1.12) rotate(4deg); } }
.s3-kere .ka-objet { transform-origin: 80% 10%; animation: s3-plume 0.22s ease-in-out infinite alternate; }
@keyframes s3-plume { from { transform: rotate(-8deg); } to { transform: rotate(6deg) translateX(-4%); } }

/* Jour 4 : les boules aux couleurs inversées défilent, la peinture goutte, le voyant clignote */
.s4-defile { animation: s4-defile 7s linear infinite; }
@keyframes s4-defile { 0% { transform: translateX(-40px); opacity: 0; } 12% { opacity: 1; } 86% { opacity: 1; } 100% { transform: translateX(30px); opacity: 0; } }
.s4-goutte { animation: s4-goutte 1.4s ease-in infinite; }
@keyframes s4-goutte { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(85%); } }
.s4-voyant { animation: s1-clignote 0.9s steps(1) infinite; }
.s4-kere .ka-objet { transform-origin: 20% 70%; animation: s4-pinceau 1.1s ease-in-out infinite; }
@keyframes s4-pinceau { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-35deg); } 80% { transform: rotate(20deg); } }

/* Jour 5 : le courant court dans les fils, l'étoile hoquette, la Kère ronge un fil et s'électrocute */
.s5-courant { animation: s5-monte 1.3s linear infinite; }
.s5-courant.c2 { animation-delay: 0.6s; }
@keyframes s5-monte { 0% { opacity: 0; transform: translateY(470%); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(0); } }
.s5-etoile { animation: s5-etoile 3.5s steps(1) infinite; opacity: 0; }
@keyframes s5-etoile { 0%, 79%, 100% { opacity: 0; } 82% { opacity: 0.8; } 85% { opacity: 0; } 87% { opacity: 0.5; } 90% { opacity: 0; } }
.s5-zap { opacity: 0; animation: s5-zap 3.5s steps(1) infinite; }
@keyframes s5-zap { 0%, 79%, 100% { opacity: 0; } 80% { opacity: 1; } 84% { opacity: 0.3; } 86% { opacity: 1; } 91% { opacity: 0; } }
.s5-kere .ka-pose { animation: s5-secousse 3.5s linear infinite; }
@keyframes s5-secousse { 0%, 79%, 92%, 100% { transform: none; } 80% { transform: translate(-4%, 2%) rotate(-6deg) scale(1.08); } 83% { transform: translate(4%, -2%) rotate(6deg) scale(1.08); } 86% { transform: translate(-3%, 1%) rotate(-4deg) scale(1.08); } 89% { transform: translate(3%, 0) rotate(4deg); } }

/* Jour 6 : les paquets coincés tressautent, l'aiguille tremble sur « vide », la Kère sirote le carburant */
.s6-paquet { animation: s6-coince 0.5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.s6-paquet.impair { animation-delay: -0.25s; }
@keyframes s6-coince { from { transform: rotate(-2deg); } to { transform: translateY(-4%) rotate(2deg); } }
.s6-aiguille { animation: s6-aiguille 0.3s ease-in-out infinite alternate; }
@keyframes s6-aiguille { from { transform: rotate(-7deg); } to { transform: rotate(5deg); } }
.s6-bulles circle { animation: s1-goutte 1.4s ease-out infinite reverse; }
.s6-kere .ka-pose { transform-origin: 50% 80%; animation: s6-sirote 1.1s ease-in-out infinite; }
@keyframes s6-sirote { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06, 0.94); } }

/* Jour 7 : le traîneau tourne en rond au-dessus de l'avenue, la radio crie, la Kère souffle du givre */
.s7-traineau { animation: s7-ronde 7s ease-in-out infinite; }
@keyframes s7-ronde { 0% { transform: translate(0, 0); } 24% { transform: translate(380%, -40%); } 25% { transform: translate(380%, -40%) scaleX(-1); } 49% { transform: translate(0, 20%) scaleX(-1); } 50% { transform: translate(0, 20%); } 74% { transform: translate(300%, 60%); } 75% { transform: translate(300%, 60%) scaleX(-1); } 99% { transform: translate(0, 0) scaleX(-1); } 100% { transform: translate(0, 0); } }
.s7-ondes { transform-origin: 0 50%; animation: s7-ondes 1.2s ease-out infinite; }
@keyframes s7-ondes { 0% { opacity: 0; transform: scale(0.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.3); } }
.s7-haut { animation: s7-alterne 3s steps(1) infinite; }
.s7-bas { animation: s7-alterne 3s steps(1) -1.5s infinite; }
@keyframes s7-alterne { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.s7-givre { transform-origin: 90% 20%; animation: s7-souffle 3s ease-out infinite; }
@keyframes s7-souffle { 0%, 40% { opacity: 0; transform: scale(0.3); } 55% { opacity: 1; } 100% { opacity: 0; transform: scale(1.2) translate(-10%, 10%); } }

/* Jour 8 : un petit traîneau suit le faux raccourci de la Kère ; son épingle tremble */
.s8-traineau { animation: s8-faux 6s ease-in-out infinite; }
@keyframes s8-faux { 0% { opacity: 0; transform: translate(0, 0); } 6% { opacity: 1; } 30% { transform: translate(275%, 403%); } 60% { transform: translate(944%, 625%); } 88% { opacity: 1; transform: translate(1380%, 85%); } 100% { opacity: 0; transform: translate(1380%, 85%); } }
.s8-epingle { transform-origin: 50% 100%; animation: s8-epingle 0.8s ease-in-out infinite alternate; }
@keyframes s8-epingle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.s8-kere .ka-objet { transform-origin: 50% 90%; animation: s8-epingle 0.6s ease-in-out infinite alternate; }

/* Jour 9 : le cadre sans fin s'enfonce, la Kère tourne en rond (dans sa propre boucle) */
/* Jour 9 : le robot grimpe l'escalier de cadeaux (case = 34 × 24), puis rejoint le traîneau, et recommence */
.s9-robot { animation: s9-robot 10s steps(1, end) infinite; }
@keyframes s9-robot {
  0% { transform: translate(0, 0); } 6% { transform: translate(34px, 0); } 12% { transform: translate(34px, -24px); }
  18% { transform: translate(68px, -24px); } 24% { transform: translate(68px, -48px); } 30% { transform: translate(102px, -48px); }
  36% { transform: translate(102px, -72px); } 42% { transform: translate(136px, -72px); } 48% { transform: translate(136px, -96px); }
  54% { transform: translate(170px, -96px); } 60% { transform: translate(204px, -96px); } 66% { transform: translate(204px, -72px); }
  72%, 100% { transform: translate(204px, -48px); }
}
.s9-kere .ka-pose { animation: s9-brandit 2.4s ease-in-out infinite alternate; }
@keyframes s9-brandit { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.s9-flocon { animation: s9-flocon 6s linear infinite; }
.s9-flocon.f2 { animation-delay: -3s; }
@keyframes s9-flocon { 0% { opacity: 0; transform: translateY(0) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(1200%) rotate(180deg); } }

/* Jour 10 : le programme défile sur l'écran du robot, le four fume, les miettes tombent */
.s10-defile { animation: s10-defile 7s linear infinite; }
@keyframes s10-defile { from { transform: translateY(0); } to { transform: translateY(-49px); } }
.s10-antenne { animation: s1-clignote 1s steps(1) infinite; }
.s10-vapeur { animation: s10-vapeur 3s ease-out infinite; }
@keyframes s10-vapeur { 0% { opacity: 0; transform: translateY(20%) scale(0.7); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40%) scale(1.2); } }
.s10-miettes circle { animation: s1-goutte 1.3s ease-in infinite; }
.s10-miettes circle:nth-child(2) { animation-delay: 0.4s; }
.s10-miettes circle:nth-child(3) { animation-delay: 0.8s; }
.s10-kere .ka-objet { transform-origin: 50% 50%; animation: s10-croque 0.9s ease-in-out infinite; }
@keyframes s10-croque { 0%, 70%, 100% { transform: none; } 80% { transform: translate(-12%, -16%) rotate(-12deg); } 90% { transform: translate(-6%, -8%); } }

/* Jour 11 : les crêpes avancent sur le tapis (la file), les bougies dansent, la Kère croque */
.s11-defile { animation: s11-defile 4s linear infinite; }
@keyframes s11-defile { 0% { transform: translateX(-30px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(50px); opacity: 0; } }
.s11-flamme { transform-origin: 50% 100%; animation: s3-flamme 0.4s ease-in-out infinite alternate; }
.s11-flamme.f2 { animation-delay: -0.2s; }
.s11-kere .ka-objet { transform-origin: 30% 50%; animation: s10-croque 1.2s ease-in-out infinite; }

/* Jour 16 : l'affiche de Kryos se peint pixel par pixel, le flash crépite, la Kère attend la séance */
.s16-pixels .px { opacity: 0; animation: s16-px 6s steps(1) infinite; }
@keyframes s16-px { 0% { opacity: 0; } 2% { opacity: 1; } 75% { opacity: 1; } 76%, 100% { opacity: 0; } }
.s16-flash { opacity: 0; animation: s16-flash 4s ease-out infinite; }
@keyframes s16-flash { 0%, 88% { opacity: 0; transform: scale(0.6); } 90% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.4); } }
.s16-mais { opacity: 0; animation: s16-saute 1.8s ease-out infinite; }
.s16-mais.m2 { animation-delay: 0.9s; }
@keyframes s16-saute { 0% { opacity: 1; transform: none; } 45% { opacity: 1; transform: translate(-60%, -170%) rotate(-90deg); } 100% { opacity: 0; transform: translate(-120%, 40%) rotate(-200deg); } }
.s16-kere .ka-objet { transform-origin: 50% 90%; animation: s16-secoue 0.9s ease-in-out infinite alternate; }
@keyframes s16-secoue { from { transform: rotate(-5deg); } to { transform: rotate(5deg) translateY(-3%); } }
@keyframes s16-gomme { from { transform: translateX(-8%) rotate(-6deg); } to { transform: translateX(8%) rotate(6deg); } }

/* Jour 13 : le laser du scanner balaie les étiquettes, la caisse refuse, la Kère gribouille un code */
.s13-laser { transform-origin: 0 50%; animation: s13-laser 2.4s ease-in-out infinite; }
@keyframes s13-laser { 0%, 100% { opacity: 0; transform: translateY(0) scaleX(0.2); } 15% { opacity: 1; } 50% { opacity: 1; transform: translateY(500%) scaleX(1); } 70% { opacity: 0; } }
.s13-ecran { animation: s1-clignote 0.8s steps(1) infinite; }
.s13-gribouille { transform-origin: 0 50%; animation: s13-gribouille 2s steps(6) infinite; }
@keyframes s13-gribouille { 0% { transform: scaleX(0); } 70%, 100% { transform: scaleX(1); } }
.s13-kere .ka-objet { transform-origin: 50% 90%; animation: s16-gomme 0.2s ease-in-out infinite alternate; }

/* Jour 14 : les paquets tombent en tournoyant, la neige tourbillonne, la Kère jongle */
.s14-chute { animation: s14-chute 3.2s ease-in infinite; }
.s14-chute.c2 { animation-delay: -0.8s; }
.s14-chute.c3 { animation-delay: -1.6s; }
.s14-chute.c4 { animation-delay: -2.4s; }
@keyframes s14-chute { 0% { opacity: 0; transform: translateY(-60%) rotate(0); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(330%) rotate(200deg); } }
.s14-neige { animation: s14-neige 2.5s linear infinite; }
@keyframes s14-neige { from { transform: translate(0, -10%); } to { transform: translate(-6%, 40%); } }
.s14-kere .ka-objet { animation: s14-jongle 0.9s ease-in-out infinite; }
@keyframes s14-jongle { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-30%, -90%) rotate(180deg); } }

/* Jour 12 : l'antenne émet ses ondes, le voyant du poste clignote, la Kère brandit le micro gelé */
.s12-ondes .onde { opacity: 0; animation: s12-onde 1.8s ease-out infinite; }
.s12-ondes .o2 { animation-delay: 0.3s; }
.s12-ondes .o3 { animation-delay: 0.6s; }
@keyframes s12-onde { 0% { opacity: 0; } 20% { opacity: 1; } 70%, 100% { opacity: 0; } }
.s12-voyant { animation: s1-clignote 0.8s steps(1) infinite; }
.s12-kere .ka-objet { transform-origin: 50% 85%; animation: s12-brandit 1s ease-in-out infinite alternate; }
@keyframes s12-brandit { from { transform: rotate(-8deg); } to { transform: rotate(8deg) translateY(-6%); } }

/* Jour 15 : les cadeaux défilent sous le robot, le voyant hésite entre vert et rouge, les confettis volent */
.s15-defile { animation: s15-defile 3s linear infinite; }
@keyframes s15-defile { from { transform: translateX(0); } to { transform: translateX(60px); } }
.s15-vert { animation: s7-alterne 1.5s steps(1) infinite; }
.s15-rouge { animation: s7-alterne 1.5s steps(1) -0.75s infinite; }
.s15-confettis rect { animation: s15-confetti 1.4s ease-out infinite; }
.s15-confettis rect:nth-child(2) { animation-delay: 0.3s; }
.s15-confettis rect:nth-child(3) { animation-delay: 0.6s; }
.s15-confettis rect:nth-child(4) { animation-delay: 0.9s; }
.s15-confettis rect:nth-child(5) { animation-delay: 1.1s; }
@keyframes s15-confetti { 0% { opacity: 0; transform: translateY(14px) rotate(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px) rotate(300deg); } }
.s15-kere .ka-objet { animation: s15-glisse 1.5s ease-in infinite; }
@keyframes s15-glisse { 0%, 30% { transform: none; opacity: 1; } 70% { transform: translate(10%, 60%) rotate(30deg); opacity: 1; } 71%, 100% { opacity: 0; transform: translate(10%, 60%); } }

/* Jour 17 : les fiches s'envolent du fichier, le curseur clignote */
.s17-fiche { animation: s17-vole 3s ease-out infinite; }
.s17-fiche.f2 { animation-delay: 1s; }
.s17-fiche.f3 { animation-delay: 2s; }
@keyframes s17-vole { 0% { opacity: 0; transform: translate(0, 40%) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-120%, -260%) rotate(-140deg); } }
.s17-curseur { animation: s1-clignote 1s steps(1) infinite; }

/* Jour 18 : la loupe inspecte, le papillon de nuit voltige, le canard couine, l'écran est passé au peigne fin */
.s18-loupe { animation: s18-loupe 5s ease-in-out infinite; }
@keyframes s18-loupe { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(180%, 140%); } 66% { transform: translate(60%, 160%); } }
.s18-papillon { animation: s18-papillon 4s ease-in-out infinite; }
@keyframes s18-papillon { 0%, 100% { transform: translate(0, 0) scaleX(1); } 25% { transform: translate(-200%, 80%) scaleX(0.6); } 50% { transform: translate(-80%, 160%) scaleX(1); } 75% { transform: translate(60%, 60%) scaleX(0.6); } }
.s18-canard { transform-origin: 50% 100%; animation: s18-couic 2.6s ease-in-out infinite; }
@keyframes s18-couic { 0%, 80%, 100% { transform: none; } 85% { transform: scale(1.12, 0.88); } 90% { transform: scale(0.94, 1.08) translateY(-6%); } }
.s18-ligne { animation: s18-scan 4s steps(8) infinite; }
@keyframes s18-scan { from { transform: translateY(-300%); } to { transform: translateY(820%); } }

/* Jour 19 : les essais de mots de passe défilent sur l'ordinateur de glace, la Kère tape à toute vitesse */
.s19-defile { animation: s19-defile 2.2s linear infinite; }
@keyframes s19-defile { from { transform: translateY(0); } to { transform: translateY(-77px); } }
.s19-voyant { animation: s1-clignote 0.6s steps(1) infinite; }
.s19-kere .ka-pose { animation: s19-tape 0.12s linear infinite alternate; }
@keyframes s19-tape { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(3%) rotate(2deg); } }

/* Jour 20 : la bougie danse, la cire coule, la Kère appose son faux sceau */
.s20-flamme { transform-origin: 50% 100%; animation: s3-flamme 0.4s ease-in-out infinite alternate; }
.s20-cire { animation: s1-goutte 2.4s ease-in infinite; }
.s20-kere { animation: s20-tamponne 2.8s ease-in-out infinite; }
@keyframes s20-tamponne { 0%, 25% { transform: translate(0, 0); } 35% { transform: translate(-6%, 62%); } 42% { transform: translate(-6%, 58%); } 58%, 100% { transform: translate(0, 0); } }
.s20-marque { animation: s2-marque 2.8s ease-in-out infinite; }

/* Jour 21 : l'appât se balance au bout de la ligne, la notification clignote */
.s21-appat { transform-origin: 50% 0; animation: s21-balance 2.2s ease-in-out infinite alternate; }
@keyframes s21-balance { from { transform: rotate(-12deg); } to { transform: rotate(10deg) translateY(4%); } }
.s21-notif { animation: s21-notif 1.6s ease-in-out infinite; }
@keyframes s21-notif { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.s21-kere .ka-objet { transform-origin: 0 80%; animation: s21-canne 2.2s ease-in-out infinite alternate; }
@keyframes s21-canne { from { transform: rotate(-4deg); } to { transform: rotate(6deg); } }

/* Jour 22 : le curseur clignote, des dossiers cachés apparaissent et disparaissent, la Kère se faufile */
.s22-curseur { animation: s1-clignote 1s steps(1) infinite; }
.s22-fantome { animation: s22-fantome 4s ease-in-out infinite; }
.s22-fantome.f2 { animation-delay: -2s; }
@keyframes s22-fantome { 0%, 100% { opacity: 0; transform: translateY(10%); } 40%, 60% { opacity: 1; transform: none; } }
.s22-kere { animation: s22-faufile 6s ease-in-out infinite; }
@keyframes s22-faufile { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-30%) translateY(10%); } }

/* Jour 23 : les jouets défilent devant le robot, son avis hésite, la craie scintille, la Kère échange les étiquettes */
.s23-defile { animation: s23-defile 5s linear infinite; }
@keyframes s23-defile { from { transform: translateX(-20px); } to { transform: translateX(40px); } }
.s23-avis { animation: s7-alterne 2.5s steps(1) infinite; }
.s23-avis2 { animation: s7-alterne 2.5s steps(1) -1.25s infinite; }
.s23-craie { animation: s1-case 1.4s ease-in-out infinite; }
.s23-kere .ka-objet { animation: s23-echange 2.5s ease-in-out infinite; }
@keyframes s23-echange { 0%, 40%, 100% { transform: none; } 50% { transform: translate(40%, -20%) rotate(20deg); } 60% { transform: translate(40%, -20%) rotate(-10deg); } }

/* Jour 24 : l'étoile tente de se rallumer, le givre court sur les branches, Kryos domine le sapin */
.s24-etoile { opacity: 0; animation: s24-etoile 5s steps(1) infinite; }
@keyframes s24-etoile { 0%, 84%, 100% { opacity: 0; } 86% { opacity: 0.7; } 88% { opacity: 0.1; } 90% { opacity: 0.5; } 92% { opacity: 0; } }
.s24-givre path { animation: s1-case 2.6s ease-in-out infinite; }
.s24-givre path:nth-child(2n) { animation-delay: -1.3s; }
.s24-givre path:nth-child(3n) { animation-delay: -0.7s; }
.kere-acteur.s24-kryos .ka-vol { animation: s24-kryos 6s ease-in-out infinite; }
@keyframes s24-kryos { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4%) scale(1.04); } }

@media (prefers-reduced-motion: reduce) {
  .scene-enigme .sp, .scene-enigme .sp *, .kere-acteur .ka-vol, .kere-acteur .ka-pose, .kere-acteur img { animation: none !important; }
}

/* =========================================================
   Mode économe (app.js, surveillerFluidite) : le navigateur dessine sans l'aide de la carte
   graphique et tombait à quelques images par seconde. On fige les animations d'ambiance
   éparpillées sur l'écran, qui l'obligeaient à tout redessiner ; restent la neige, le traîneau,
   les ampoules du toit, l'ombre et la brume du titre, la case du jour et tout le jeu lui-même.
   ========================================================= */
html.econome .aurore span,
html.econome .paysage-fond *,
html.econome .etoiles i.scintille:nth-child(n+21),
html.econome .piece-chalet:not(.prochaine) .piece-givrin,
html.econome #sapin .paillette,
html.econome .bandeau-scene .decor-svg * { animation: none; } /* (les scènes des énigmes, elles, sont faites pour rester légères) */
html.econome .piece-chalet:not(.prochaine) .piece-lueur { animation: none; opacity: 0.6; }
html.econome #sapin .halo-sapin { animation: none; opacity: 0.8; }
/* (la neige douce tombait sur toute la lettre : toute la lettre était redessinée à chaque image ;
   la tempête de Kryos, courte, reste) */
html.econome .neige-lettre .douce { display: none; }
html.econome .lettre-pole-nord::after { animation: none; } /* (la lueur de la bougie couvre toute la lettre) */

/* =========================================================
   Chaque taille d'écran. Sur un téléphone : des boutons, des titres et des champs à sa mesure (pas de
   bouton géant sur un petit écran). Sur un écran tactile : les petits boutons se touchent facilement,
   grâce à une zone invisible autour (ils ne grossissent pas à l'œil). Sur un très grand écran : tout
   grandit un peu, au lieu de flotter, minuscule, au milieu.
   ========================================================= */
/* Les titres qui passent sur deux lignes se coupent en deux moitiés égales (et pas « qui es- / tu ? ») */
.titre-carnet, .bandeau-jour h2, .titre-defi, .titre-projection, .vitrine-message { text-wrap: balance; }
@media (max-width: 480px) {
  .btn-geant { font-size: 1rem; padding: 0.7em 1.35em; }
  .ecran-titre .btn-geant { white-space: nowrap; }
  .etape-compte .titre-carnet { font-size: 1.25rem; }
  .champ-nom { font-size: 1.12rem; padding: 0.42em 0.7em; }
  .jour.intro .bandeau-jour { height: 150px; }
  .jour.intro .bandeau-jour h2 { font-size: 1.5rem; max-width: none; }
}
/* Téléphone : la lettre se tient droite (très haute, penchée de 0,6°, son haut touchait un bord de l'écran) */
/* (et sans aucune transformation au repos : une lettre transformée, très haute, est dessinée en morceaux par
   le navigateur, et des raccords d'un pixel apparaissaient en fines lignes ; isolation garde le givre et la
   lueur de la bougie, en z-index négatif, au-dessus du parchemin) */
@media (max-width: 700px) { .lettre-pole-nord { --penche: 0deg; transform: none; isolation: isolate; } }
@media (min-width: 560px) and (max-width: 899px) and (min-aspect-ratio: 1/1) { .modale.cinema-actif .lettre-pole-nord { --penche: 0deg; transform: none; isolation: isolate; } }
/* Le nom de la pièce : sur un petit écran, il prend toute la largeur (« L'Observatoire », un seul long mot,
   dépassait de ses 75 % à 280 px) */
.bandeau-jour h2 { overflow-wrap: break-word; }
@media (max-width: 480px) { .modale.piece-ouverte .bandeau-jour h2 { max-width: none; } }
@media (max-width: 380px) {
  /* « 🎄 Première visite » et « 🔑 J'ai déjà un compte » ne tiennent plus côte à côte : l'un sous l'autre */
  .onglets { flex-direction: column; align-items: stretch; width: 100%; border-radius: 18px; }
  .onglet { white-space: nowrap; }
  .modale:not(.piece-ouverte):not(.cinema-actif) { padding: 1rem 0.5rem; }
}
/* La Kère et sa bulle. Dans les défis, la Kère fait 128 px (Kryos 150) : sur un téléphone, côte à côte,
   il ne restait à la bulle que 70 px, un mot par ligne et des mots qui débordaient. En dessous de 420 px,
   la Kère passe AU-DESSUS de sa bulle (qui prend toute la largeur) ; jusqu'à 560 px, elle rapetisse. */
.givrin-bulle { overflow-wrap: break-word; }
@media (max-width: 560px) {
  .defi .givrin-carte { padding: 0.7rem 0.9rem; gap: 0.8rem; }
  .defi .givrin-avatar { width: 96px; height: 96px; }
  .defi .givrin-carte.boss .givrin-avatar { width: 110px; height: 110px; }
  .defi .givrin-bulle { font-size: 1rem; }
}
@media (max-width: 420px) {
  .defi .givrin-carte, .defi .givrin-chasse { flex-direction: column; align-items: stretch; gap: 0.3rem; text-align: center; }
  .defi .givrin-avatar, .defi .givrin-carte.boss .givrin-avatar { align-self: center; width: 88px; height: 88px; }
  .defi .givrin-carte.boss .givrin-avatar { width: 100px; height: 100px; }
  .defi .givrin-bulle { margin: 0.6rem 0 0; text-align: left; }
  .defi .givrin-bulle::before { left: 50%; top: -8px; margin-left: -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: rgba(240, 248, 255, 0.94); }
}
/* Écran tactile : une zone invisible agrandit les petits boutons sous le doigt */
@media (pointer: coarse) {
  .voir-mdp::after, .btn-deconnexion::after, .passer-cours::after, .revoir-lettre::after, .btn-langue::after, .morceau-lien::after { content: ""; position: absolute; inset: -9px -6px; }
  .morceau-lien::after { inset: -8px -1px; } /* (les morceaux d'un lien se touchent presque : on n'agrandit qu'en hauteur) */
  .btn-deconnexion, .passer-cours, .revoir-lettre, .hud .btn-langue, .morceau-lien { position: relative; } /* (celui de l'écran titre est déjà placé en absolu) */
}
/* Dans une pièce, sur un petit écran : en faisant défiler, un voile sombre passe derrière « 🏡 Chalet »,
   le compteur et le son, pour que le texte ne se faufile plus entre eux (classe « defilee », app.js) */
@media (max-width: 760px) {
  .modale.piece-ouverte.defilee::before {
    content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3.2rem; z-index: 4; pointer-events: none;
    background: linear-gradient(180deg, rgba(5, 13, 26, 0.97) 55%, rgba(5, 13, 26, 0));
  }
}
/* Très grand écran (27 pouces et plus, sans zoom) : tout grandit d'un huitième, puis d'un quart */
@media (min-width: 1800px) and (min-height: 1100px) {
  html { font-size: 18px; }
  body { font-size: 19px; }
  .scene { grid-template-columns: minmax(320px, 1035px) minmax(220px, 372px); }
  .fenetre { max-width: 990px; }
  .titre-contenu { max-width: 880px; }
  .illustration-titre { width: min(675px, 100%); }
  .signature-lutin { max-width: 472px; }
  .modale.piece-ouverte .bandeau-jour { height: min(48vh, 495px); }
  .modale.piece-ouverte .corps-jour { max-width: 1012px; }
  .modale.piece-ouverte .bandeau-texte { padding-left: max(1.6rem, calc((100% - 1012px) / 2)); padding-right: max(1.6rem, calc((100% - 1012px) / 2)); }
  .modale.cinema-actif { --col-lettre: clamp(430px, 43vw, 720px); }
}
@media (min-width: 2300px) and (min-height: 1300px) {
  html { font-size: 20px; }
  body { font-size: 21px; }
  .scene { grid-template-columns: minmax(320px, 1150px) minmax(220px, 412px); }
  .fenetre { max-width: 1100px; }
  .titre-contenu { max-width: 975px; }
  .illustration-titre { width: min(750px, 100%); }
  .signature-lutin { max-width: 525px; }
  .modale.piece-ouverte .bandeau-jour { height: min(48vh, 550px); }
  .modale.piece-ouverte .corps-jour { max-width: 1125px; }
  .modale.piece-ouverte .bandeau-texte { padding-left: max(1.6rem, calc((100% - 1125px) / 2)); padding-right: max(1.6rem, calc((100% - 1125px) / 2)); }
  .modale.cinema-actif { --col-lettre: clamp(430px, 43vw, 800px); }
}
