/* ============================================================
   Jeu de Noël APCIL — Styles
   public/css/jeu.css
     1. Base et couleurs
     2. Ciel, neige, pages seules (connexion…)
     3. Le jeu : accueil, chemin, bâtiments, plaques
     4. Fenêtres (question, résultats, gagnant)
     5. Administration
   ============================================================ */

/* ---------- 1. Base ---------- */
:root {
  --nuit: #0d1b3a;
  --nuit-2: #183062;
  --nuit-3: #29508f;
  --neige: #f6f9fd;
  --glace: #dfe9f5;
  --or: #ffd166;
  --or-fonce: #e0a526;
  --rouge: #c0392b;
  --rouge-clair: #e25b4b;
  --sapin: #1f6f50;
  --texte: #1d2a3a;
  --texte-doux: #5a6878;
  --ok: #1d7a4c;
  --ok-fond: #e3f4ea;
  --erreur: #a8322a;
  --erreur-fond: #fbe7e4;
  --info-fond: #e7eef9;
  --rayon: 16px;
  --titre: "Georgia", "Times New Roman", serif;
  --corps: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 70px; }
body { margin: 0; font-family: var(--corps); color: var(--texte); line-height: 1.5; }
img, svg { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.en-ligne { display: inline; margin: 0; }
[hidden] { display: none !important; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1px solid #c9d3e0;
  background: #fff; color: var(--texte); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.bouton:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 27, 58, .15); }
.bouton--primaire { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.bouton--primaire:hover { background: var(--rouge-clair); }
.bouton--clair { background: var(--glace); border-color: var(--glace); }
.bouton--large { width: 100%; }
.bouton--petit { min-height: 34px; padding: 5px 14px; font-size: .9rem; }
.bouton--danger { color: var(--erreur); border-color: #e6b8b2; }
.lien-bouton { background: none; border: 0; padding: 4px; color: inherit; text-decoration: underline; cursor: pointer; font-size: .92rem; }

.message { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-size: .96rem; }
.message--ok { background: var(--ok-fond); color: var(--ok); }
.message--erreur { background: var(--erreur-fond); color: var(--erreur); }
.message--info { background: var(--info-fond); color: #24426f; }
.mention { font-size: .86rem; color: var(--texte-doux); margin: 6px 0 14px; }
.chapo { color: var(--texte-doux); margin: 0 0 18px; }

.champ { margin-bottom: 14px; }
.champ label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .94rem; }
.champ input, .champ select, .champ textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #c3cddb; border-radius: 12px; background: #fff;
}
.champ textarea { min-height: 90px; }
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: 3px solid rgba(41, 80, 143, .25); border-color: var(--nuit-3); }

.bandeau-test {
  position: relative; z-index: 30; margin: 0; padding: 9px 16px; text-align: center;
  background: repeating-linear-gradient(45deg, #ffe7a3, #ffe7a3 14px, #ffd977 14px, #ffd977 28px);
  color: #5a3d00; font-size: .92rem;
}

/* ---------- 2. Ciel, neige, pages seules ---------- */
.page-seule, .page-jeu { background: var(--nuit); color: var(--neige); min-height: 100vh; }
.ciel {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, #081330 0%, var(--nuit) 35%, var(--nuit-2) 75%, #2c4f86 100%);
}
.etoiles {
  position: absolute; inset: 0; opacity: .8;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 47% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 78% 27%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 6% 42%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 85% 46%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 52%, #fff 50%, transparent 51%);
  animation: scintille 6s ease-in-out infinite alternate;
}
@keyframes scintille { from { opacity: .55; } to { opacity: .95; } }
.lune {
  position: absolute; top: 70px; right: 9%; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #f4e7b8 60%, #e8d79a);
  box-shadow: 0 0 40px 12px rgba(255, 240, 190, .25);
}
canvas.neige { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

.seule { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; }
.carte {
  width: 100%; max-width: 430px; background: rgba(255, 255, 255, .97); color: var(--texte);
  border-radius: 24px; padding: 28px 26px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.carte__marque { text-align: center; margin-bottom: 18px; }
.carte__surtitre { margin: 8px 0 0; text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; color: var(--rouge); font-weight: 700; }
.carte__titre { font-family: var(--titre); font-size: 1.7rem; margin: 2px 0 4px; color: var(--nuit); line-height: 1.15; }
.carte__sous-titre { margin: 0; color: var(--texte-doux); }
.carte__liens { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; font-size: .94rem; }
.carte__liens .bouton { font-weight: 600; }
.seule__pied { text-align: center; margin-top: 22px; color: #c6d3ea; font-size: .84rem; }
.seule__pied img { height: auto; filter: brightness(0) invert(1); opacity: .85; }
.seule__pied p { margin: 6px 0 0; }

/* ---------- 3. Le livre pop-up ----------
   --obscurite (0 = plein jour, 1 = nuit) est posée sur <html> par PHP
   puis tenue à jour par livre.js selon l'heure de Paris. */
.page-livre { background: #dfe8f2; color: var(--texte); }
.page-livre .ciel { background: linear-gradient(180deg, #9fbddc 0%, #cfdeee 45%, #edf3f9 100%); }
.ciel__nuit {
  position: absolute; inset: 0; opacity: var(--obscurite, 1); transition: opacity 3s ease;
  background: linear-gradient(180deg, #040b22 0%, #0d1b3a 40%, #1d3768 100%);
}
.est-nuit { color: var(--neige); }

/* Le coin du compte, discret en haut à droite */
.coin {
  position: fixed; top: 10px; right: 10px; z-index: 30; display: flex; align-items: center; gap: 4px;
  padding: 4px 6px 4px 14px; border-radius: 999px; font-size: .86rem;
  background: rgba(255, 255, 255, .72); color: var(--texte); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(13, 27, 58, .12);
}
.est-nuit .coin { background: rgba(8, 19, 48, .6); color: #fff; }
.coin__nom { font-weight: 700; margin-right: 4px; }
.coin__lien { padding: 5px 10px; border-radius: 999px; border: 0; background: none; color: inherit; text-decoration: none; cursor: pointer; font-size: .86rem; }
.coin__lien:hover { background: rgba(127, 140, 160, .18); }
.page-livre .bandeau-test { position: sticky; top: 0; }

/* La couverture */
.livre { position: relative; z-index: 2; }
.couverture {
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 70px 22px 40px; max-width: 640px; margin: 0 auto;
}
.couverture__logo { height: auto; margin-bottom: 18px; transition: filter 2s; }
.est-nuit .couverture__logo { filter: brightness(0) invert(1); opacity: .9; }
.couverture__surtitre { margin: 0; text-transform: uppercase; letter-spacing: .2em; font-size: .8rem; font-weight: 700; color: var(--rouge); }
.est-nuit .couverture__surtitre { color: var(--or); }
.couverture__titre {
  font-family: var(--titre); font-size: clamp(2.7rem, 12vw, 4.8rem); line-height: .98; margin: 10px 0 18px; color: #14284b;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .6);
}
.est-nuit .couverture__titre { color: #fff; text-shadow: 0 4px 28px rgba(0, 0, 0, .45); }
.couverture__texte { max-width: 520px; margin: 0 auto 22px; color: #34465e; }
.est-nuit .couverture__texte { color: #d3def0; }
.couverture__jour {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 20px; border-radius: var(--rayon); margin-bottom: 14px;
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9);
}
.couverture__jour strong { font-size: 1.06rem; }
.couverture__jour span { font-size: .94rem; opacity: .8; }
.est-nuit .couverture__jour { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); }
.couverture__descendre {
  margin-top: 10px; padding: 8px 14px; border: 0; background: none; color: var(--rouge); font-weight: 700; cursor: pointer; font-size: 1rem;
}
.est-nuit .couverture__descendre { color: var(--or); }
.couverture__descendre::after {
  content: ""; display: block; width: 12px; height: 12px; margin: 8px auto 0; border-right: 2px solid; border-bottom: 2px solid;
  transform: rotate(45deg); animation: rebond 1.6s infinite;
}
@keyframes rebond { 50% { transform: translateY(6px) rotate(45deg); } }

/* La rue : une page par jour, les tranches de rue se fondent l'une dans l'autre */
.rue { position: relative; max-width: 760px; margin: 0 auto; }
.page { position: relative; aspect-ratio: 2 / 3; perspective: 1300px; }
.page ~ .page { margin-top: -16%; }   /* la tranche suivante recouvre le bas de la précédente et s'y fond */
.sans-rue .page { aspect-ratio: 1 / .9; }
.sans-rue .page ~ .page { margin-top: 0; }
.page__rue {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 11%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 11%);
}
.page:last-of-type .page__rue { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 11%, #000 90%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 11%, #000 90%, transparent 100%); }
.page__rue img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page__rue--miroir img { transform: scaleX(-1); }
.rue__nuit { opacity: var(--obscurite, 0); transition: opacity 3s ease; }
.page__figurines { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }

/* La scène : le bâtiment pop-up, son médaillon, son cadenas */
.scene { position: absolute; z-index: 2; width: 66%; bottom: 34%; }
.page--gauche .scene { left: 2%; }
.page--droite .scene { right: 2%; }
.sans-rue .scene { width: 68%; bottom: 25%; }

.batiment {
  position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.batiment:focus-visible { outline: 3px solid var(--or); outline-offset: 6px; border-radius: 20px; }
.batiment__pli {
  position: relative; display: block; transform-origin: 50% 94%; transform: rotateX(86deg);
  transition: transform 1.2s cubic-bezier(.2, 1.5, .42, 1), filter 1s ease;
}
.page.est-vue .batiment__pli { transform: rotateX(0deg); }
.batiment__image {
  display: block; width: 100%; height: auto;
  filter: brightness(calc(1 - var(--obscurite, 0) * .1)) drop-shadow(0 16px 12px rgba(10, 20, 40, .3));
}
/* À la nuit tombée, le bâtiment déplié rayonne doucement */
.batiment__pli::before {
  content: ""; position: absolute; inset: -4% -6% 0; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 96, .55), rgba(255, 196, 96, 0));
  opacity: 0; transition: opacity 1.5s ease;
}
.page.est-vue:not(.page--ferme) .batiment__pli::before { opacity: calc(var(--obscurite, 0) * .9); }
.batiment__ombre {
  position: absolute; left: 6%; right: 6%; bottom: 0; height: 16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(10, 20, 40, .38), rgba(10, 20, 40, 0));
  opacity: .25; transform: translateY(30%); transition: opacity 1s ease;
}
.page.est-vue .batiment__ombre { opacity: .85; }

/* Les jours à venir : la page reste pliée */
.page--ferme .batiment__pli,
.page--ferme.est-vue .batiment__pli { transform: rotateX(74deg); filter: saturate(.45) brightness(.72); }
.page--ferme .batiment__ombre { opacity: .3; }
.page.est-secouee .batiment__pli { animation: secoue .55s ease; }
@keyframes secoue { 0%, 100% { transform: rotateX(74deg); } 30% { transform: rotateX(60deg); } 65% { transform: rotateX(79deg); } }

.batiment__attente {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 4 / 3;
  border-radius: 14px; background: #fffdf7; border: 2px dashed #cdbf9f; color: #6b5a3a; padding: 10px;
}
.batiment__attente-num { font-family: var(--titre); font-size: 2.6rem; font-weight: 700; color: var(--rouge); line-height: 1; }
.batiment__attente-nom { font-family: var(--titre); font-size: 1.1rem; font-weight: 700; }
.batiment__attente-note { font-size: .8rem; opacity: .75; }

.medaillon {
  position: absolute; top: -2%; z-index: 3; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%;
  font-family: var(--titre); font-size: 1.4rem; font-weight: 700; color: #6e1b10;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffd166 45%, #d99b1f 100%);
  border: 3px solid #fff8e3; box-shadow: 0 6px 16px rgba(10, 20, 40, .35);
  transform: scale(0); transition: transform .5s cubic-bezier(.3, 1.8, .5, 1) .75s;
}
.page--gauche .medaillon { left: 4%; }
.page--droite .medaillon { right: 4%; }
.page.est-vue .medaillon, .page--ferme .medaillon { transform: scale(1); }
.page--ferme .medaillon { top: 38%; background: radial-gradient(circle at 35% 30%, #ffffff, #d5dde8 55%, #9eabbf 100%); color: #3b4a63; transition: none; }

.cadenas {
  position: absolute; z-index: 3; left: 50%; top: 54%; transform: translate(-50%, -50%); width: 50px; height: 50px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(13, 27, 58, .78); color: #eef3fa;
  border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 6px 16px rgba(10, 20, 40, .3); pointer-events: none;
}
.cadenas svg { width: 24px; height: 24px; }

.appel {
  position: absolute; z-index: 3; left: 50%; bottom: -4%; padding: 10px 20px; border-radius: 999px; white-space: nowrap;
  background: var(--or); color: #3b2a00; font-weight: 800; box-shadow: 0 8px 20px rgba(10, 20, 40, .35); pointer-events: none;
  transform: translateX(-50%) scale(0); transition: transform .45s cubic-bezier(.3, 1.8, .5, 1) 1.1s;
}
.page.est-vue .appel { transform: translateX(-50%) scale(1); }
.page.est-arrivee .appel { animation: appel 1.6s ease-in-out 1.6s infinite; }
@keyframes appel { 50% { transform: translateX(-50%) scale(1.08); } }

/* L'étiquette sous le bâtiment : la date et le nom */
.etiquette {
  position: absolute; z-index: 3; top: 67.5%; width: min(60%, 340px); padding: 8px 14px 9px; border-radius: 12px;
  background: rgba(255, 253, 247, .94); color: var(--texte); box-shadow: 0 8px 22px rgba(10, 20, 40, .22);
  display: flex; flex-direction: column; gap: 1px; border-top: 3px solid var(--rouge);
}
.page--gauche .etiquette { left: 6%; }
.page--droite .etiquette { right: 6%; }
.sans-rue .etiquette { top: 77%; }
.page--ferme .etiquette { background: rgba(236, 240, 246, .9); border-top-color: #8592a8; }
.page--jour .etiquette { border-top-color: var(--or-fonce); }
.page--ouvert .etiquette { border-top-color: var(--sapin); }
.etiquette__date { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--texte-doux); }
.etiquette__nom { font-family: var(--titre); font-size: 1.12rem; font-weight: 700; color: #14284b; line-height: 1.2; }
.etiquette__info { font-size: .84rem; color: var(--texte-doux); }

/* Les figurines (illustrations fig-*.webp), placées par livre.js :
   --x0 / --x1 départ et arrivée, --bas hauteur, --largeur taille */
.figurine {
  position: absolute; left: var(--x0); bottom: var(--bas); width: var(--largeur); height: auto;
  filter: brightness(calc(1 - var(--obscurite, 0) * .25)) drop-shadow(0 4px 3px rgba(10, 20, 40, .25));
}
.figurine--passe { animation: passe var(--duree, 20s) linear var(--retard, 0s) infinite; animation-play-state: paused; }
.figurine--pieton { animation: passe var(--duree, 20s) linear var(--retard, 0s) infinite, dandine .55s ease-in-out infinite alternate; animation-play-state: paused; }
.figurine--inverse { animation-direction: reverse, alternate; }
.figurine--gauche { scale: -1 1; }
.figurine--fixe { transform-origin: 50% 100%; animation: balance 3s ease-in-out infinite alternate; animation-play-state: paused; }
.page.est-animee .figurine { animation-play-state: running; }
@keyframes passe {
  0%   { left: var(--x0); opacity: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 1; }
  100% { left: var(--x1); opacity: 0; }
}
@keyframes dandine { from { translate: 0 0; rotate: -2deg; } to { translate: 0 -5%; rotate: 2deg; } }
@keyframes balance { from { rotate: -2deg; } to { rotate: 2deg; } }

.fin { position: relative; z-index: 2; text-align: center; padding: 40px 20px 90px; }
.fin p { max-width: 420px; margin: 0 auto; }
.fin__titre { font-family: var(--titre); font-size: 1.5rem; font-weight: 700; margin-bottom: 6px !important; }

@media (max-width: 600px) {
  .scene { width: 74%; }
  .sans-rue .scene { width: 76%; }
  .medaillon { width: 42px; height: 42px; font-size: 1.15rem; }
  .etiquette { width: 66%; }
  .etiquette__nom { font-size: 1.02rem; }
  .appel { padding: 8px 16px; font-size: .92rem; }
}

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #fff; color: var(--texte);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35); transition: opacity .25s ease, transform .25s ease; text-align: center;
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 4. Fenêtres ---------- */
.fenetre {
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: hidden auto; padding: 26px 24px 22px; border: 0;
  border-radius: 22px; background: #fff; color: var(--texte); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.fenetre::backdrop { background: rgba(5, 12, 30, .72); backdrop-filter: blur(3px); }
.fenetre[open] { animation: apparait .28s ease; }
@keyframes apparait { from { transform: translateY(18px) scale(.97); } }
.fenetre__fermer-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.fenetre__fermer { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #eef2f7; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--texte); }
.fenetre__surtitre { margin: 0 44px 8px 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--rouge); font-weight: 700; }
.fenetre__question { font-family: var(--titre); font-size: 1.35rem; line-height: 1.3; margin: 0 0 18px; color: var(--nuit); }
.fenetre__explication { background: #f4f7fb; border-left: 4px solid var(--nuit-3); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .95rem; }
.fenetre__bilan { margin: 14px 0 0; }

.qcm { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.qcm__choix {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 2px solid #dbe3ee; background: #fff; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.qcm--lecture .qcm__choix { cursor: default; }
.qcm__choix input { position: absolute; opacity: 0; pointer-events: none; }
.qcm__lettre { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #eef2f7; font-weight: 800; color: var(--nuit); }
.qcm__texte { flex: 1; }
.qcm__note { flex: none; font-size: .78rem; font-weight: 700; }
label.qcm__choix:hover { border-color: #a9bad3; }
label.qcm__choix:has(input:checked) { border-color: var(--rouge); background: #fff5f3; }
label.qcm__choix:has(input:checked) .qcm__lettre { background: var(--rouge); color: #fff; }
label.qcm__choix:has(input:focus-visible) { outline: 3px solid rgba(41, 80, 143, .35); }
.qcm__choix--mien { border-color: var(--nuit-3); background: var(--info-fond); }
.qcm__choix--bonne { border-color: var(--ok); background: var(--ok-fond); }
.qcm__choix--bonne .qcm__lettre { background: var(--ok); color: #fff; }
.qcm__choix--bonne .qcm__note { color: var(--ok); }
.qcm__choix--fausse { border-color: #e3a49c; background: var(--erreur-fond); }
.qcm__choix--fausse .qcm__note { color: var(--erreur); }
.qcm + .mention { margin-top: 12px; }
.fenetre .qcm + .message, .fenetre .qcm + .fenetre__explication { margin-top: 16px; }

.fenetre--annonce { text-align: center; padding-top: 30px; }
.fenetre--annonce .cadeau { width: 110px; height: 110px; animation: cadeau 1.2s ease-in-out infinite alternate; }
@keyframes cadeau { to { transform: translateY(-6px) rotate(-4deg); } }
.annonce__titre { font-family: var(--titre); color: var(--nuit); font-size: 1.55rem; margin: 10px 0 8px; }
.annonce__texte { font-size: 1.1rem; margin: 0 0 14px; }
.fenetre--annonce .bouton { margin-top: 8px; }

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

/* ---------- 5. Administration ---------- */
.admin { background: #f3f6fa; color: var(--texte); }
.admin-barre { background: var(--nuit); color: #fff; }
.admin-barre__interieur { max-width: 1200px; margin: 0 auto; padding: 10px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.admin-marque { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.admin-nav a { padding: 7px 12px; border-radius: 999px; text-decoration: none; color: #cfdaee; font-size: .93rem; }
.admin-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-nav a[aria-current="page"] { background: #fff; color: var(--nuit); font-weight: 600; }
.admin-compte { display: flex; align-items: center; gap: 10px; }
.admin-compte .bouton { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #fff; }
.admin-contenu { max-width: 1200px; margin: 0 auto; padding: 24px 18px 60px; }
.admin-titre { font-family: var(--titre); color: var(--nuit); margin: 0 0 18px; }
.admin h2 { color: var(--nuit); font-size: 1.15rem; margin: 30px 0 12px; }
.bloc { background: #fff; border-radius: var(--rayon); padding: 18px 20px; box-shadow: 0 2px 10px rgba(13, 27, 58, .06); margin-bottom: 18px; }
.bloc > :first-child { margin-top: 0; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.chiffre { background: #fff; border-radius: var(--rayon); padding: 16px 18px; box-shadow: 0 2px 10px rgba(13, 27, 58, .06); }
.chiffre strong { display: block; font-size: 1.8rem; color: var(--nuit); font-family: var(--titre); }
.chiffre span { color: var(--texte-doux); font-size: .9rem; }
.tableau-defile { overflow-x: auto; background: #fff; border-radius: var(--rayon); box-shadow: 0 2px 10px rgba(13, 27, 58, .06); }
table.tableau { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tableau th, .tableau td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e8edf4; vertical-align: top; }
.tableau th { background: #f7f9fc; font-weight: 700; color: var(--texte-doux); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau .actions { white-space: nowrap; }
.tableau .actions form { display: inline; }
.ligne--jour td { background: #fff8e6; }
.etat { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.etat--a_venir { background: #eef1f6; color: #5d6878; }
.etat--ouverte { background: #fff1c9; color: #7a5300; }
.etat--close { background: var(--ok-fond); color: var(--ok); }
.etat--non { background: var(--erreur-fond); color: var(--erreur); }
.discret { color: var(--texte-doux); font-size: .86rem; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.formulaire-ligne { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.formulaire-ligne .champ { margin: 0; flex: 1; min-width: 160px; }
.case { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.case input { width: 20px; height: 20px; margin-top: 2px; }
.lien-copie { display: flex; gap: 8px; margin-top: 8px; }
.lien-copie input { flex: 1; min-height: 40px; padding: 6px 10px; border: 1px solid #c3cddb; border-radius: 10px; font-size: .85rem; }
.vignette { width: 64px; height: 64px; object-fit: contain; background: #e9eef6; border-radius: 10px; }
.vignette svg { width: 64px; height: 64px; }
details.detail summary { cursor: pointer; color: var(--nuit-3); font-weight: 600; }
.choix-admin { display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.choix-admin input[type=radio] { width: 22px; height: 22px; }

/* ---------- 6. Rue illustrée : raccords et places relevées ----------
   --echelle (sur .rue) et --decalage (sur chaque page) viennent de
   planDeLaRue() (gabarits/decor.php) : chaque tranche est un peu agrandie
   et décalée pour que les routes se raccordent d'une page à l'autre. */
.page__rue { overflow: hidden; }
.page__rue img { transform: translateX(calc(var(--decalage, 0) * 100%)) scale(var(--echelle, 1)); }
.page__rue--miroir img { transform: translateX(calc(var(--decalage, 0) * 100%)) scale(calc(-1 * var(--echelle, 1)), var(--echelle, 1)); }
.scene--placee { right: auto !important; }
.etiquette--placee { right: auto !important; width: min(46%, 300px); }
.page--intermede .intermede {
  position: absolute; z-index: 3; left: 50%; top: 18%; transform: translateX(-50%); margin: 0; white-space: nowrap;
  padding: 8px 16px; border-radius: 999px; background: rgba(255, 253, 247, .9); color: #14284b;
  font-family: var(--titre); font-style: italic; box-shadow: 0 6px 18px rgba(10, 20, 40, .2);
}
@media (max-width: 600px) {
  .etiquette--placee { width: 52%; }
}

/* ---------- 7. Les languettes (tirettes du livre animé) ----------
   --tirage (sur la page) : 0 = bâtiment caché hors de la page, seule la
   languette dépasse du bord ; 1 = bâtiment en place. Réglé par livre.js
   pendant qu'on tire. --course (sur la scène) : la distance à parcourir,
   en largeurs de bâtiment. */
.page { overflow: hidden; }
.page--gauche .tirette { --sens: -1; }
.page--droite .tirette { --sens: 1; }
.tirette {
  position: relative;
  transform: translateX(calc((1 - var(--tirage, 0)) * var(--sens, -1) * var(--course, 1) * 100%));
  will-change: transform;
}
/* Le bâtiment se déplie pendant qu'il glisse */
.page .batiment__pli,
.page.est-vue .batiment__pli,
.page--ferme .batiment__pli {
  transform: rotateX(calc((1 - var(--tirage, 0)) * 62deg)) rotate(calc((1 - var(--tirage, 0)) * var(--sens, -1) * -4deg));
  transition: none; filter: none;
}
/* Sticker découpé : liseré blanc tout autour, ombre portée */
.batiment__image {
  filter: brightness(calc(1 - var(--obscurite, 0) * .1))
          drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
          drop-shadow(0 12px 10px rgba(10, 20, 40, .35));
}
.batiment__ombre { opacity: calc(var(--tirage, 0) * .85); }
.page.est-vue:not(.page--ferme) .batiment__pli::before,
.page.est-tiree .batiment__pli::before { opacity: calc(var(--obscurite, 0) * .9); }
.medaillon, .cadenas { display: none; }

.appel { transform: translateX(-50%) scale(0); transition: transform .45s cubic-bezier(.3, 1.8, .5, 1) .2s; }
.page.est-tiree .appel { transform: translateX(-50%) scale(1); }
.page.est-tiree.est-arrivee .appel { animation: appel 1.6s ease-in-out 1s infinite; }

/* La languette : un onglet de carton rouge qui dépasse du bord de la page */
.languette {
  position: absolute; top: 22%; z-index: 4; width: 52px; height: 78px; padding: 0; border: 0; cursor: grab;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(180deg, #d64535, #a92a1e); color: #fff;
  box-shadow: 0 6px 16px rgba(10, 20, 40, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
  touch-action: pan-y; -webkit-tap-highlight-color: transparent; user-select: none;
}
.languette:active, .page.est-tiree-en-cours .languette { cursor: grabbing; }
.page--gauche .languette { left: 100%; border-radius: 0 16px 16px 0; }
.page--droite .languette { right: 100%; border-radius: 16px 0 0 16px; }
.page--droite .languette__signe { transform: scaleX(-1); }
.languette__num { font-family: var(--titre); font-size: 1.55rem; font-weight: 700; line-height: 1; color: #ffe7a1; }
.languette__signe { width: 18px; height: 18px; opacity: .9; }
.languette:focus-visible { outline: 3px solid var(--or); outline-offset: 3px; }
.page--ferme .languette { background: linear-gradient(180deg, #6f7d96, #4f5b72); cursor: not-allowed; }
.page--ferme .languette__num { color: #e8eef8; }
.page--ouvert .languette { background: linear-gradient(180deg, #2f8a5f, #1f6f50); }
/* Une fois tirée, la languette se fait discrète */
.page.est-tiree .languette { width: 40px; height: 56px; opacity: .92; }
.page.est-tiree .languette__signe { display: none; }

/* La languette du jour frétille et dit « Tirez ! » */
.languette__bulle {
  position: absolute; top: 50%; padding: 6px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: var(--or); color: #3b2a00; font-family: var(--corps); font-weight: 800; font-size: .9rem;
  box-shadow: 0 6px 14px rgba(10, 20, 40, .3); transform: translateY(-50%) scale(0); transition: transform .3s cubic-bezier(.3, 1.8, .5, 1);
}
.page--gauche .languette__bulle { left: calc(100% + 10px); }
.page--droite .languette__bulle { right: calc(100% + 10px); }
.page--jour:not(.est-tiree) .languette { animation: frissonne 2.4s ease-in-out infinite; }
.page--jour.est-arrivee:not(.est-tiree) .languette__bulle { transform: translateY(-50%) scale(1); }
.page.est-tiree-en-cours .languette { animation: none; }
.page--gauche { --dir: 1; }
.page--droite { --dir: -1; }
@keyframes frissonne { 0%, 70%, 100% { translate: 0 0; } 78% { translate: calc(var(--dir, 1) * 8px) 0; } 86% { translate: calc(var(--dir, 1) * -2px) 0; } 92% { translate: calc(var(--dir, 1) * 4px) 0; } }
.page.est-secouee .languette { animation: secoue-languette .5s ease; }
@keyframes secoue-languette { 20%, 60% { translate: 6px 0; } 40%, 80% { translate: -4px 0; } }

/* L'étiquette n'apparaît qu'une fois le bâtiment en place */
.etiquette { opacity: var(--tirage, 0); }

/* ---------- 8. Stickers et pastilles (version validée sur l'exemple) ----------
   Le liseré blanc est désormais dans l'image (modeles/image.php,
   decouperSticker) ; ici, seulement une ombre douce. La languette devient
   une pastille ronde blanche au numéro rouge, collée au bord du sticker. */
.batiment__image {
  filter: brightness(calc(1 - var(--obscurite, 0) * .1)) drop-shadow(0 10px 12px rgba(10, 20, 40, .32));
}
.languette,
.page.est-tiree .languette {
  top: 50%; width: 66px; height: 66px; border-radius: 50%; translate: 0 -50%;
  background: #fff; color: var(--rouge); border: 0;
  box-shadow: 0 6px 14px rgba(10, 20, 40, .3), inset 0 0 0 4px #fff, inset 0 0 0 5px #e4e7ec;
  opacity: 1;
}
.page--gauche .languette { left: calc(100% - 22px); border-radius: 50%; }
.page--droite .languette { right: calc(100% - 22px); border-radius: 50%; }
.languette__num { font-family: var(--corps); font-weight: 900; font-size: 2.1rem; color: var(--rouge); line-height: 1; }
.languette__signe { display: none; }
.page--ferme .languette { background: #fff; cursor: not-allowed; }
.page--ferme .languette__num { color: #8e98a8; }
.page--ferme .languette::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: #4f5b72 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='white' stroke-width='2.6'/%3E%3Crect x='6' y='11' width='12' height='9' rx='2' fill='white'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.page--ouvert .languette { background: #fff; }
.page.est-tiree .languette__num { font-size: 1.9rem; }
@keyframes frissonne { 0%, 70%, 100% { translate: 0 -50%; } 78% { translate: calc(var(--dir, 1) * 8px) -50%; } 86% { translate: calc(var(--dir, 1) * -2px) -50%; } 92% { translate: calc(var(--dir, 1) * 4px) -50%; } }
@keyframes secoue-languette { 0%, 100% { translate: 0 -50%; } 20%, 60% { translate: 6px -50%; } 40%, 80% { translate: -4px -50%; } }
/* Le sticker glisse simplement, sans se déplier ni changer de taille. */
.page .batiment__pli,
.page.est-vue .batiment__pli,
.page--ferme .batiment__pli,
.page--ferme.est-vue .batiment__pli { transform: none; }
.page.est-tiree .languette__num { font-size: 2.1rem; }

/* ---------- 9. Le livre : une page par jour, qu'on tourne ----------
   Les pages sont empilées ; la page courante est au-dessus. Tourner une
   page la fait pivoter autour de sa reliure (bord gauche) et révèle la
   suivante. Chaque page a sa propre illustration : aucun raccord. */
.livre {
  position: relative; z-index: 2; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 58px 10px 14px;
}
.livre__pages {
  position: relative; margin: 0; max-width: none;
  width: min(94vw, calc((100svh - 150px) * 2 / 3), 600px); aspect-ratio: 2 / 3;
  perspective: 2400px;
  border-radius: 6px 16px 16px 6px;
  box-shadow: 4px 4px 0 #efe9dc, 8px 8px 0 #e2d9c6, 12px 12px 0 #d5cab3, 0 26px 50px rgba(5, 12, 30, .45);
}
.livre__pages .page,
.livre__pages .page ~ .page {
  position: absolute; inset: 0; margin: 0; aspect-ratio: auto; overflow: hidden;
  border-radius: 6px 16px 16px 6px; background: #f3efe6;
  transform-origin: 0 50%; transform: rotateY(0deg);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 1s cubic-bezier(.45, .05, .25, 1);
}
.livre__pages .page.est-tournee { transform: rotateY(-176deg); }
.livre__pages .page.est-cachee { visibility: hidden; }
.livre__pages .page.est-rapide { transition-duration: .38s; }
/* La reliure : une ombre douce le long du bord gauche */
.livre__pages .page::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 34px; z-index: 6; pointer-events: none;
  background: linear-gradient(to right, rgba(40, 25, 10, .35), rgba(40, 25, 10, .08) 45%, rgba(40, 25, 10, 0));
}
/* Plus de fondu entre tranches : chaque page est entière */
.livre__pages .page__rue,
.livre__pages .page:last-of-type .page__rue { -webkit-mask-image: none; mask-image: none; }

/* La couverture et la dernière page */
.page--couverture .couverture, .page--fin .fin {
  position: absolute; inset: 0; z-index: 3; min-height: 0; max-width: none; margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 22px 26px; overflow: auto; color: #fff;
  background: linear-gradient(180deg, rgba(8, 19, 48, .72), rgba(8, 19, 48, .45) 45%, rgba(8, 19, 48, .78));
}
/* Centré tant que ça tient ; sinon le haut reste visible et la page défile
   (justify-content: center couperait le logo). */
.page--couverture .couverture > :first-child, .page--fin .fin > :first-child { margin-top: auto; }
.page--couverture .couverture > :last-child, .page--fin .fin > :last-child { margin-bottom: auto; }
.page--couverture .couverture, .page--fin .fin { justify-content: flex-start; }
.page--couverture .couverture__logo { filter: brightness(0) invert(1); opacity: .95; margin-bottom: 8px; width: 104px; flex: none; }
@media (max-height: 820px) {
  .page--couverture .couverture__logo { width: 84px; margin-bottom: 4px; }
  .page--couverture .couverture__titre { font-size: clamp(1.9rem, 7vh, 3.2rem); margin: 4px 0 8px; }
  .page--couverture .couverture__texte { font-size: .88rem; margin-bottom: 10px; }
}
.page--couverture .couverture__surtitre { color: var(--or); }
.page--couverture .couverture__titre { color: #fff; font-size: clamp(2.1rem, 9vw, 3.6rem); text-shadow: 0 4px 24px rgba(0, 0, 0, .5); margin: 6px 0 12px; }
.page--couverture .couverture__texte { color: #e3ebf7; font-size: .94rem; margin-bottom: 14px; }
.page--couverture .couverture__jour { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; padding: 10px 14px; }
.page--couverture .couverture__ouvrir { margin-top: 12px; }
.page--couverture .message { font-size: .86rem; }
.page--fin .fin__titre { font-family: var(--titre); font-size: 1.8rem; font-weight: 700; margin: 0 0 8px; }

/* La navigation sous le livre */
.livre__nav { display: flex; align-items: center; gap: 14px; }
.livre__fleche {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.9rem; line-height: 1;
  background: #fff; color: var(--rouge); box-shadow: 0 6px 16px rgba(10, 20, 40, .25);
}
.livre__fleche:disabled { opacity: .35; cursor: default; }
.livre__repere {
  min-width: 190px; text-align: center; font-weight: 700; padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .78); color: #14284b;
}
.est-nuit .livre__repere { background: rgba(255, 255, 255, .14); color: #fff; }
.livre__pages.sans-transition .page { transition: none !important; }
.livre__pages { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.livre__pages img { -webkit-user-drag: none; }
/* Sur une page de livre, le sticker est la vedette : grand, centré, posé
   sur l'illustration ; l'étiquette devient la légende en bas de page. */
.livre__pages .scene,
.livre__pages .scene--placee {
  left: 10% !important; right: auto !important; width: 80% !important; bottom: 34% !important;
  --course: 1.14 !important;
}
.livre__pages .page--jour .scene,
.livre__pages .page--jour .scene--placee { bottom: 38% !important; }
.livre__pages .etiquette,
.livre__pages .etiquette--placee {
  left: 7% !important; right: 7% !important; top: auto !important; bottom: 4.5%; width: auto;
  align-items: center; text-align: center; padding: 10px 14px 12px;
}
.livre__pages .appel { bottom: -12%; }
.livre__pages .languette__bulle { white-space: nowrap; }

/* ---------- 10. Pages en papier découpé (diorama) ----------
   Couches, de l'arrière vers l'avant : le fond (ciel, collines, sapins),
   le bâtiment qui monte (sticker + pastille), la neige du premier plan,
   l'étiquette et le cadre. --tirage (0 → 1) fait monter le bâtiment ;
   --descente (px, calculée par livre.js) : de combien il est enfoncé
   dans la neige au départ, seule la pastille dépassant. */
.page--papier { background: #0e1a3a; --ligne-neige: .835; }
.papier__fond, .papier__neige {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
}
.papier__fond { z-index: 0; }
.papier__neige { z-index: 4; }
.monte {
  position: absolute; z-index: 2; left: 11%; width: 78%; bottom: 10%;
  transform: translateY(calc((1 - var(--tirage, 0)) * var(--descente, 0px)));
  will-change: transform;
}
.monte__sticker { position: relative; }
.monte .batiment { display: block; width: 100%; }
.monte .batiment__image { width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(5, 10, 30, .45)); }
/* La pastille fait partie du sticker ; le site y écrit le numéro. */
.page--papier .languette.pastille {
  position: absolute; z-index: 3; height: auto !important; aspect-ratio: 1; padding: 0; border: 0;
  border-radius: 50% !important; right: auto !important; background: transparent !important; box-shadow: none !important;
  transform: translateY(-50%); translate: 0 0; opacity: 1; cursor: grab; touch-action: none; animation: none;
}
.page--papier .pastille svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pastille__anneau { fill: #fff; stroke: #e2e5ea; stroke-width: 3; }
.pastille__num { font-family: Cambria, "Times New Roman", serif; font-variant-numeric: lining-nums; font-weight: 700; font-size: 60px; fill: #b8261b; }
.page--ferme .pastille__num { fill: #8f99aa; }
.pastille__cadenas circle { fill: #4f5b72; }
.page--papier.est-tiree-en-cours .pastille { cursor: grabbing; }
/* Elle frétille en dépassant de la neige, le jour venu */
.page--papier.page--jour:not(.est-tiree) .languette.pastille { animation: frisson 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes frisson {
  0%, 66%, 100% { rotate: 0deg; translate: 0 0; }
  72% { rotate: -9deg; translate: 0 -4%; }
  80% { rotate: 8deg; translate: 0 -6%; }
  88% { rotate: -5deg; translate: 0 -3%; }
  94% { rotate: 3deg; translate: 0 0; }
}
.page--papier.est-secouee .languette.pastille { animation: tremble .5s ease; }
@keyframes tremble { 25%, 75% { rotate: -6deg; } 50% { rotate: 6deg; } }
.pastille__bulle {
  position: absolute; z-index: 6; transform: translateY(-50%) scale(0); transform-origin: 0 50%; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; background: var(--or); color: #3b2a00; font-weight: 800; font-size: .88rem;
  box-shadow: 0 6px 14px rgba(5, 10, 30, .35); transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); pointer-events: none;
}
.page--papier.page--jour.est-arrivee:not(.est-tiree) .pastille__bulle { transform: translateY(-50%) scale(1); }
.page--papier .appel { bottom: 14%; }
/* Étiquette : posée sur la neige du premier plan */
.page--papier .etiquette, .livre__pages .page--papier .etiquette {
  z-index: 5; bottom: 3.5%; left: 9% !important; right: 9% !important;
  background: rgba(255, 253, 247, .95); border-top: 0; border-radius: 10px;
  box-shadow: 0 4px 0 rgba(180, 160, 120, .35), 0 8px 18px rgba(5, 10, 30, .25);
}
/* Le cadre de la page : bande de papier rouge et filet doré */
.page--papier::after, .page--couverture::after, .page--fin::after {
  content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none; border-radius: inherit;
  border: 11px solid #a3241b;
  box-shadow: inset 0 0 0 2px #e6bd62, inset 0 0 0 5px #a3241b, inset 0 0 0 7px rgba(230, 189, 98, .55), inset 0 10px 18px rgba(0, 0, 0, .25);
}
.page--papier .intermede { z-index: 5; top: 40%; }
.page--papier .figurine { display: none; }
.monte { left: 4%; width: 92%; bottom: 13%; }
.page--papier .etiquette, .livre__pages .page--papier .etiquette { bottom: 2.5%; padding: 7px 12px 8px; left: 14% !important; right: 14% !important; }
.pastille__bulle { transform: translate(-50%, -100%) scale(0); transform-origin: 50% 100%; }
.page--papier.page--jour.est-arrivee:not(.est-tiree) .pastille__bulle { transform: translate(-50%, -100%) scale(1); }
/* Les jours passés frétillent aussi : on tire pour revoir le bâtiment. */
.page--papier.page--ouvert.est-arrivee:not(.est-tiree) .languette.pastille { animation: frisson 2.2s ease-in-out infinite; transform-origin: 50% 100%; }

/* ---------- 11. La page qui se plie (livre.js) ----------
   Plus de rotation 3D : la page courante est à plat ; pendant un tour de
   page, elle est découpée le long du pli (clip-path) et le dos du papier
   est dessiné sur le calque .pli, qui déborde à gauche du livre. */
.livre__pages .page, .livre__pages .page ~ .page, .livre__pages .page.est-tournee {
  transform: none !important; transition: none !important;
}
.livre__pages .pli {
  position: absolute; top: 0; left: -100%; z-index: 60; pointer-events: none;
}

/* ---------- 12. Le ciel animé (pages en papier) ----------
   Ne bouge que sur la page affichée (.est-animee, posée par livre.js). */
.ciel-anime { position: absolute; inset: 0 0 40% 0; z-index: 1; pointer-events: none; overflow: hidden; }
.ciel-anime img { position: absolute; height: auto; animation-play-state: paused; }
.page.est-animee .ciel-anime img, .page.est-animee .ciel-anime .etoile-filante { animation-play-state: running; }
.etoile-scintille { animation: scintille-papier 2.6s ease-in-out infinite alternate; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
@keyframes scintille-papier { from { opacity: .35; scale: .8; rotate: -8deg; } to { opacity: 1; scale: 1.08; rotate: 6deg; } }
/* Le Père Noël traverse le ciel, puis revient plus tard */
.traineau {
  width: 52%; top: 52%; left: -60%;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .35));
  animation: traineau-vol 24s linear infinite, traineau-houle 1.4s ease-in-out infinite alternate;
}
@keyframes traineau-vol {
  0% { left: -60%; top: 58%; }
  38% { left: 108%; top: 18%; }
  100% { left: 108%; top: 18%; }
}
@keyframes traineau-houle { from { translate: 0 0; rotate: -4deg; } to { translate: 0 -6%; rotate: 1deg; } }
/* L'étoile filante : une étoile dorée et sa traînée */
.etoile-filante {
  position: absolute; top: 10%; left: 70%; width: 34%; height: 4%; opacity: 0;
  rotate: 152deg; transform-origin: 0 50%;
  animation: filer 11s ease-in infinite; animation-play-state: paused;
}
.etoile-filante::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 3px; translate: 0 -50%; border-radius: 3px;
  background: linear-gradient(to right, rgba(255, 220, 130, .95), rgba(255, 220, 130, 0));
}
.etoile-filante img { position: absolute; left: -6%; top: 50%; width: 12%; translate: 0 -50%; animation: none; }
@keyframes filer {
  0% { opacity: 0; translate: 0 0; }
  3% { opacity: 1; }
  12% { opacity: 0; translate: -60% 80%; }
  100% { opacity: 0; translate: -60% 80%; }
}

/* ---------- 13. La carte de la question (pages en papier) ----------
   Quand le bâtiment est sorti, une carte de papier se déplie depuis la
   neige (comme une page de livre pop-up) ; le bâtiment recule au-dessus
   (--recul et --recul-echelle, calculés par livre.js). Rangée, elle laisse
   une pancarte plantée dans la neige pour la rouvrir. */
.livre__pages .page { container-type: size; }
.page--papier .appel { display: none; }
.monte {
  transform-origin: 50% 100%;
  transition: translate .7s cubic-bezier(.3, 1.25, .5, 1), scale .7s cubic-bezier(.3, 1.25, .5, 1);
}
.page.est-question .monte { translate: 0 calc(-1 * var(--recul, 40cqh)); scale: var(--recul-echelle, .62); }
.page.est-question .pastille__bulle { display: none; }
.page--papier .etiquette { transition: opacity .3s; }
.page.est-question .etiquette { opacity: 0; }

.carte-question {
  position: absolute; z-index: 6; left: 4.5%; right: 4.5%; bottom: 3%;
  max-height: 60cqh; display: flex; flex-direction: column;
  transform-origin: 50% 100%; transform: perspective(900px) rotateX(88deg);
  opacity: 0; visibility: hidden;
  transition: transform .55s cubic-bezier(.35, 1.45, .55, 1), opacity .25s, visibility 0s .55s;
}
.page.est-question .carte-question {
  transform: perspective(900px) rotateX(0deg); opacity: 1; visibility: visible;
  transition: transform .6s cubic-bezier(.35, 1.45, .55, 1) .12s, opacity .2s .12s, visibility 0s;
}
.carte-question:focus { outline: none; }
/* Le papier : crème, liseré blanc épais comme les stickers */
.carte__papier {
  position: relative; overflow: auto; overscroll-behavior: contain;
  padding: 14px 16px 16px; border-radius: 14px;
  background: #fffaf0; border: 6px solid #fff;
  box-shadow: 0 3px 0 #e2d6bd, 0 12px 26px rgba(5, 10, 30, .45);
  font-size: .9rem; color: #1d2433;
}
.carte__ranger {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: #f1e9d8; color: #6b5a3a; font-size: 1.35rem; line-height: 1; cursor: pointer;
}
.carte-question .fenetre__surtitre { margin: 0 38px 6px 0; font-size: .72rem; }
.carte-question .fenetre__question { font-size: 1.08rem; margin: 0 0 10px; }
.carte-question .qcm { gap: 6px; }
.carte-question .qcm__choix { padding: 7px 10px; gap: 10px; font-size: .9rem; border-radius: 10px; }
.carte-question .qcm__lettre { width: 28px; height: 28px; font-size: .85rem; }
.carte-question .mention { margin: 8px 0; font-size: .78rem; }
.carte-question .message { margin: 10px 0 0; padding: 9px 12px; font-size: .86rem; }
.carte-question .fenetre__explication { margin: 10px 0 0; font-size: .86rem; padding: 8px 12px; }
.carte-question .fenetre__bilan { margin: 10px 0 0; font-size: .88rem; }
.carte-question .bouton--large { padding: 10px 16px; }

/* La pancarte en bois, plantée dans la neige */
.pancarte {
  position: absolute; z-index: 5; right: 6%; bottom: 15%; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 100%; transform: scale(0) rotate(-20deg);
  transition: transform .45s cubic-bezier(.3, 1.8, .5, 1);
}
.pancarte::after {   /* le piquet */
  content: ""; position: absolute; left: 50%; top: 92%; width: 8px; height: 26px; translate: -50% 0;
  background: linear-gradient(to right, #6d4320, #8a5a2b 45%, #5a3518); border-radius: 0 0 3px 3px; z-index: -1;
}
.pancarte__planche {
  display: block; padding: 7px 14px; border-radius: 6px; rotate: -4deg;
  background: linear-gradient(180deg, #a8743f, #8a5a2b); color: #fff8e6; font-weight: 800; font-size: .86rem; white-space: nowrap;
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(5, 10, 30, .4); text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
.page.est-tiree:not(.est-question) .pancarte { transform: scale(1) rotate(0deg); transition-delay: .35s; }
.page.est-tiree:not(.est-question) .pancarte .pancarte__planche { animation: pancarte 2.4s ease-in-out 1.2s infinite; }
@keyframes pancarte { 0%, 70%, 100% { rotate: -4deg; } 78% { rotate: 3deg; } 86% { rotate: -6deg; } 93% { rotate: -2deg; } }
.page:not(.est-tiree) .pancarte, .page.est-question .pancarte { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .carte-question, .page.est-question .carte-question, .monte, .pancarte { transition: none; }
}

/* ---------- Règlement du jeu (30/11) ---------- */
.page-seule--large .carte { max-width: 720px; }
.reglement { font-size: .95rem; line-height: 1.55; }
.reglement h2 { font-family: var(--titre); font-size: 1.08rem; color: var(--nuit); margin: 20px 0 6px; }
.reglement h2:first-child { margin-top: 0; }
.reglement p { margin: 0 0 10px; }
.reglement ul { margin: 0 0 10px; padding-left: 20px; }
.reglement li { margin-bottom: 4px; }
.reglement__accord { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(13, 27, 58, .12); }
.reglement__accepte { margin-top: 18px; text-align: center; }
.seule__pied a { color: inherit; }
.texte-reglement { font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }

/* ---------- Jeu du week-end « Fusion de Noël » (30/11) ---------- */
.fusion { --gap: 10px; text-align: center; }
.fusion__entete { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; text-align: left; }
.fusion__regle { margin: 0; color: var(--texte-doux); font-size: .94rem; max-width: 360px; }
.fusion__scores { display: flex; gap: 8px; flex: none; }
.fusion__score { background: var(--nuit); color: #fff; border-radius: 12px; padding: 6px 14px; min-width: 86px; text-align: center; }
.fusion__score span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--or); }
.fusion__score strong { font-size: 1.3rem; }

.fusion__plateau {
  position: relative; width: 100%; max-width: 440px; aspect-ratio: 1; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); padding: var(--gap);
  background: linear-gradient(160deg, var(--nuit-2), var(--nuit)); border-radius: 18px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .35); touch-action: none; user-select: none; outline: none;
}
.fusion__plateau:focus-visible { box-shadow: 0 0 0 3px var(--or); }
.fusion__case { background: rgba(255, 255, 255, .09); border-radius: 12px; }
.fusion__tuiles { position: absolute; inset: 0; }
.fusion__tuile {
  --case: calc((100% - 5 * var(--gap)) / 4);
  position: absolute; width: var(--case); height: var(--case);
  left: calc(var(--gap) + var(--x) * (var(--case) + var(--gap)));
  top: calc(var(--gap) + var(--y) * (var(--case) + var(--gap)));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; transition: left .12s ease-in-out, top .12s ease-in-out;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.fusion__emoji { font-size: clamp(1.6rem, 9vw, 2.6rem); line-height: 1; }
.fusion__tuile small { font-size: .7rem; font-weight: 700; opacity: .7; margin-top: 2px; }
.fusion--apparait { animation: fusion-apparait .18s ease-out; }
.fusion--fusionne { animation: fusion-fusionne .2s ease-out; z-index: 2; }
@keyframes fusion-apparait { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes fusion-fusionne { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Une couleur par niveau, de la glace au rouge du Père Noël */
.niveau-1 { background: #eef4fb; color: #3a5a86; }
.niveau-2 { background: #fff4cf; color: #8a6400; }
.niveau-3 { background: #ffe39a; color: #7a5400; }
.niveau-4 { background: #ffd0d6; color: #a3283a; }
.niveau-5 { background: #f6a6a0; color: #7d1c18; }
.niveau-6 { background: #d9ecf8; color: #24426f; }
.niveau-7 { background: #9fd6b4; color: #124a33; }
.niveau-8 { background: #e25b4b; color: #fff; }
.niveau-9 { background: #b9824e; color: #fff; }
.niveau-10 { background: #29508f; color: #fff; }
.niveau-11, .niveau-max { background: linear-gradient(145deg, #e0352a, #a81f17); color: #fff; box-shadow: 0 0 18px rgba(255, 209, 102, .8); }

.fusion__fin {
  position: absolute; inset: 0; z-index: 5; border-radius: 18px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 20px; background: rgba(13, 27, 58, .82); color: #fff;
}
.fusion__fin[hidden] { display: none; }
.fusion__fin p { margin: 0; }
.fusion__fin-titre { font-family: var(--titre); font-size: 1.4rem; }

.fusion__actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: center; margin: 14px 0 10px; }
.fusion__chaine { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 0; margin: 0 0 18px; }
.fusion__maillon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; box-shadow: none; }
.fusion__maillon + .fusion__maillon::before { content: "›"; position: relative; left: -8px; margin-right: -6px; color: var(--texte-doux); font-size: .8rem; }

.fusion__titre-classement { font-family: var(--titre); font-size: 1.15rem; color: var(--nuit); margin: 6px 0 0; }
.fusion__pour-le-plaisir { margin: 2px 0 10px; }
.fusion__classement { list-style: none; padding: 0; margin: 0 auto; max-width: 420px; text-align: left; }
.fusion__classement li { display: grid; grid-template-columns: 34px 1fr auto 70px; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px; }
.fusion__classement li:nth-child(odd) { background: var(--glace); }
.fusion__classement li strong { text-align: right; }
.fusion__classement li.est-moi { background: #fff4cf; font-weight: 600; }
.fusion__classement li.fusion__moi-loin { margin-top: 8px; border-top: 2px dashed var(--glace); }
.fusion__classement li.fusion__vide { display: block; text-align: center; color: var(--texte-doux); background: none; }
.fusion__rang { font-weight: 700; color: var(--texte-doux); }
@media (max-width: 520px) {
  .fusion { --gap: 7px; }
  .fusion__entete { flex-direction: column; align-items: stretch; text-align: center; }
  .fusion__regle { max-width: none; }
  .fusion__scores { justify-content: center; }
}

/* La page « Week-end » du livre : le bouton vers le jeu */
.intermede__jeu { position: absolute; z-index: 6; left: 50%; top: 52%; transform: translateX(-50%); text-align: center; width: 80%; }
.intermede__jeu p { display: inline-block; margin: 0 0 10px; padding: 5px 14px; border-radius: 999px; background: rgba(255, 253, 247, .9); color: #14284b; font-weight: 600; font-size: .92rem; box-shadow: 0 6px 18px rgba(10, 20, 40, .2); }
.intermede__jeu .bouton { display: table; margin: 0 auto; }
.fusion__titre-classement--suite { margin-top: 22px; }
.fusion__hiscores { margin: 14px auto 0; text-align: center; }
.fusion__hiscores > summary { list-style: none; cursor: pointer; display: inline-block; }
.fusion__hiscores > summary::-webkit-details-marker { display: none; }
.fusion__hiscores[open] > summary { margin-bottom: 12px; }
