/* Les Mystères de l'Avent — feuille de style commune (joueuses et organisatrice) */

:root {
  --nuit-1: #0a1330;
  --nuit-2: #16244f;
  --nuit-3: #22356b;
  --or: #e8c470;
  --or-clair: #f7e3a8;
  --or-fonce: #b8913a;
  --bordeaux: #7d1f2e;
  --sapin: #1d4b39;
  --creme: #fbf4e4;
  --texte: #f6f1e4;
  --texte-doux: #c9cbe0;
  --carte: rgba(255, 255, 255, 0.07);
  --carte-bord: rgba(232, 196, 112, 0.35);
  --erreur: #ff8f8f;
  --succes: #9fe0b5;
  --rayon: 14px;
  --ombre: 0 10px 30px rgba(0, 0, 0, 0.35);
  --police-titre: "Cinzel Decorative", Georgia, serif;
  --police-texte: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% -10%, var(--nuit-3) 0%, var(--nuit-2) 35%, var(--nuit-1) 100%) fixed;
  background-color: var(--nuit-1);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

#neige {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* ------------------------------------------------------------ en-tête */

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.titre {
  font-family: var(--police-titre);
  font-weight: 700;
  color: var(--or);
  font-size: clamp(22px, 6.4vw, 30px);
  line-height: 1.15;
  margin: 8px 0 4px;
  text-align: center;
  text-shadow: 0 2px 18px rgba(232, 196, 112, 0.35);
}

.sous-titre {
  text-align: center;
  color: var(--texte-doux);
  margin: 0 0 18px;
  font-size: 15px;
}

.puce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  font-size: 15px;
  white-space: nowrap;
}

.bouton-icone {
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}

/* ------------------------------------------------------------ calendrier */

.calendrier {
  --cote: calc((min(100vw, 560px) - 32px - 30px) / 4);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: var(--cote);
  grid-auto-flow: dense;
  gap: 10px;
  perspective: 1200px;
}

.case {
  position: relative;
  min-width: 0;
  border: none;
  padding: 0;
  background: transparent;
  border-radius: 12px;
}

.case.grande { grid-column: span 2; grid-row: span 2; }
.case.large { grid-column: span 2; }

.case .interieur {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 40%, #fff6d6 0%, var(--or) 45%, var(--or-fonce) 100%);
  display: grid;
  place-items: center;
  color: var(--nuit-1);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
}

.case .interieur .etoiles { font-size: 16px; letter-spacing: 1px; }

.case .porte {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1);
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(232, 196, 112, 0.55);
  box-shadow: var(--ombre);
  backface-visibility: hidden;
  overflow: hidden;
}

.case .porte::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(232, 196, 112, 0.35);
  border-radius: 8px;
}

.case .porte::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--or);
  box-shadow: 0 0 6px rgba(232, 196, 112, 0.8);
}

.case.c0 .porte { background: linear-gradient(145deg, #93283a, var(--bordeaux)); }
.case.c1 .porte { background: linear-gradient(145deg, #276149, var(--sapin)); }
.case.c2 .porte { background: linear-gradient(145deg, #2e4688, var(--nuit-3)); }
.case.c3 .porte { background: linear-gradient(145deg, #3a2a63, #261a47); }

.case .numero {
  position: relative;
  font-family: var(--police-titre);
  font-weight: 700;
  color: var(--or);
  font-size: clamp(22px, 7vw, 32px);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.case.grande .numero { font-size: clamp(40px, 13vw, 60px); }

.case .cadenas {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  opacity: 0.7;
}

.case.verrouillee .porte { filter: saturate(0.55) brightness(0.8); }

.case.disponible .porte {
  animation: lueur 2.2s ease-in-out infinite;
  border-color: var(--or-clair);
}

@keyframes lueur {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 196, 112, 0), var(--ombre); }
  50% { box-shadow: 0 0 22px rgba(247, 227, 168, 0.85), var(--ombre); }
}

.case.ouverte .porte { transform: rotateY(-38deg); }
.case.terminee .porte { transform: rotateY(-112deg); }
.case.anim-ouverture .porte { transform: rotateY(-112deg); }

.case.secoue { animation: secoue 0.45s ease; }

@keyframes secoue {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.bandeau {
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  border-radius: var(--rayon);
  padding: 12px 16px;
  margin: 0 0 16px;
  text-align: center;
  color: var(--texte);
}

.bandeau strong { color: var(--or); }

/* ------------------------------------------------------------ écran de choix du prénom */

.choix-joueuse {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.choix-joueuse button {
  padding: 16px;
  border-radius: var(--rayon);
  border: 1px solid var(--carte-bord);
  background: var(--carte);
  font-size: 20px;
  font-weight: 700;
}

/* ------------------------------------------------------------ fenêtre d'une case */

.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(5, 9, 25, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.voile.visible { opacity: 1; }

.fenetre {
  width: 100%;
  max-width: 560px;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1b2b5e 0%, #121d43 100%);
  border: 1px solid var(--carte-bord);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 20px 16px 32px;
  transform: translateY(40px);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.voile.visible .fenetre { transform: translateY(0); }

@media (min-width: 600px) {
  .voile { align-items: center; }
  .fenetre { border-radius: 22px; border-bottom: 1px solid var(--carte-bord); max-height: 90vh; }
}

.fenetre-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fenetre-entete .jour {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--or);
  margin: 0;
}

.fenetre-entete h2 {
  font-family: var(--police-titre);
  font-size: 24px;
  margin: 2px 0 0;
  line-height: 1.2;
}

.bloc {
  background: var(--carte);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--rayon);
  padding: 16px;
  margin: 12px 0;
}

.consigne { color: var(--texte-doux); margin: 0 0 12px; font-size: 15px; }

.texte-jeu { font-size: 18px; white-space: pre-line; margin: 0; }

.grand-texte {
  font-size: clamp(44px, 16vw, 72px);
  text-align: center;
  margin: 8px 0;
  line-height: 1.2;
}

.code-texte {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(24px, 8vw, 34px);
  letter-spacing: 0.18em;
  text-align: center;
  color: var(--or-clair);
  word-break: break-word;
  margin: 8px 0;
}

.miroir {
  transform: scaleX(-1);
  font-family: var(--police-titre);
  font-size: 22px;
  text-align: center;
  color: var(--or-clair);
  margin: 12px 0;
}

.rangee { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.centre { justify-content: center; text-align: center; }

.tuile {
  min-width: 44px;
  height: 52px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1.5px solid var(--carte-bord);
  background: rgba(232, 196, 112, 0.12);
  font-size: 24px;
  font-weight: 800;
  color: var(--or-clair);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tuile.choisie { background: var(--or); color: var(--nuit-1); transform: translateY(-4px); }

.champ {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(232, 196, 112, 0.45);
  background: rgba(0, 0, 0, 0.25);
  font-size: 18px;
  outline: none;
}

.champ:focus { border-color: var(--or-clair); box-shadow: 0 0 0 3px rgba(232, 196, 112, 0.2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  color: var(--nuit-1);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 14px rgba(232, 196, 112, 0.3);
}

.btn:disabled { opacity: 0.5; }

.btn.secondaire {
  background: transparent;
  color: var(--or);
  border: 1.5px solid var(--carte-bord);
  box-shadow: none;
}

.btn.plein { width: 100%; }

.ligne-reponse { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }

.message { margin: 8px 0 0; font-size: 15px; min-height: 22px; }
.message.erreur { color: var(--erreur); }
.message.succes { color: var(--succes); }

.indice {
  border-left: 3px solid var(--or);
  padding: 4px 0 4px 12px;
  margin: 8px 0;
  color: var(--texte);
}

.revelation {
  text-align: center;
  padding: 20px 16px;
  border-radius: var(--rayon);
  background: radial-gradient(circle at 50% 0%, rgba(247, 227, 168, 0.28), rgba(232, 196, 112, 0.06));
  border: 1.5px solid var(--or);
  animation: apparition 0.7s ease;
}

.revelation .etiquette {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--or);
}

.revelation .piece {
  font-family: var(--police-titre);
  font-size: clamp(24px, 7.5vw, 32px);
  margin: 6px 0;
  color: var(--or-clair);
}

@keyframes apparition {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.trophee { text-align: center; }
.trophee .grosses-etoiles { font-size: 40px; letter-spacing: 4px; color: var(--or); }

/* ------------------------------------------------------------ jeux particuliers */

.morse-code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 28px;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--or-clair);
  word-break: break-word;
}

.acrostiche-ligne { margin: 10px 0; }
.acrostiche-ligne .definition { font-size: 15px; color: var(--texte-doux); margin-bottom: 6px; }

.cases-lettres { display: flex; gap: 4px; flex-wrap: wrap; }

.cases-lettres input {
  width: 34px;
  height: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  padding: 0;
}

.cases-lettres input.premiere { border-color: var(--or); background: rgba(232, 196, 112, 0.18); color: var(--or-clair); }

.panneaux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.panneau {
  background: linear-gradient(180deg, #8a5a2b, #6b4220);
  border-radius: 10px;
  padding: 12px;
  border: 2px solid #3f2610;
  box-shadow: var(--ombre);
}

.panneau .nom { font-weight: 800; color: var(--or-clair); font-size: 15px; }
.panneau .dit { font-size: 15px; margin-top: 4px; }

.galerie { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.galerie img { border-radius: 10px; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; cursor: zoom-in; }

.photo-ordre { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: none; }
.photo-ordre.choisie { border-color: var(--or); }
.photo-ordre img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.photo-ordre .lettre {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: var(--or);
  color: var(--nuit-1);
  font-weight: 900;
  font-size: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.cadenas-roues { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.roue { display: grid; gap: 4px; justify-items: center; }
.roue button { width: 52px; height: 34px; border-radius: 8px; border: 1px solid var(--carte-bord); background: var(--carte); }
.roue .chiffre {
  width: 52px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 900;
  border-radius: 10px;
  background: #0c142e;
  border: 2px solid var(--or-fonce);
  color: var(--or-clair);
  font-family: ui-monospace, Menlo, monospace;
}

.grille-mots { display: grid; gap: 4px; margin: 0 auto; max-width: 360px; }
.grille-mots button {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  font-weight: 800;
  font-size: clamp(16px, 5vw, 22px);
  padding: 0;
}
.grille-mots button.barree { background: rgba(232, 196, 112, 0.35); color: var(--nuit-1); }

.liste-mots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.liste-mots button { border-radius: 999px; padding: 4px 12px; border: 1px solid var(--carte-bord); background: transparent; font-size: 14px; }
.liste-mots button.trouve { text-decoration: line-through; opacity: 0.55; }

.puzzle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; max-width: 360px; margin: 0 auto; }
.puzzle button { aspect-ratio: 1 / 1; border: 2px solid transparent; border-radius: 4px; padding: 0; background-repeat: no-repeat; background-size: 300% 300%; }
.puzzle button.choisie { border-color: var(--or); }

.clavier-t9 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 12px auto 0; }
.clavier-t9 > div {
  border-radius: 12px;
  background: linear-gradient(180deg, #2c3c74, #1c2a58);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 4px;
  text-align: center;
}
.clavier-t9 .chiffre { font-size: 24px; font-weight: 800; }
.clavier-t9 .lettres { font-size: 12px; letter-spacing: 0.15em; color: var(--texte-doux); min-height: 16px; }

.quiz-question { margin: 14px 0; }
.quiz-question .q { font-weight: 700; margin-bottom: 8px; }
.quiz-choix { display: grid; gap: 6px; }
.quiz-choix button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--carte-bord);
  background: var(--carte);
}
.quiz-choix button.choisie { background: var(--or); color: var(--nuit-1); font-weight: 800; }

.zoom {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  padding: 16px;
}
.zoom img { max-height: 92vh; border-radius: 8px; }

/* ------------------------------------------------------------ effets */

#effets {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #fdf3d6;
  color: var(--nuit-1);
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: var(--ombre);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 50;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.chargement { text-align: center; color: var(--texte-doux); padding: 40px 0; }

.masque { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .case .porte, .voile, .fenetre { transition: none; }
  .case.disponible .porte { animation: none; }
}

/* ------------------------------------------------------------ version 2 : points, flocons, nouveaux jeux */

.centre-texte { text-align: center; }
button.puce { cursor: pointer; }

.case .interieur { grid-template-rows: auto auto; align-content: center; gap: 2px; }
.flocon-case {
  font-family: var(--police-titre);
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1;
  color: var(--nuit-1);
}
.case.grande .flocon-case { font-size: clamp(34px, 10vw, 48px); }
.points-case { font-size: 11px; font-weight: 900; letter-spacing: 0.02em; }

.zone-jeu { overflow-wrap: anywhere; }

/* Mot gelé */
.legende-mot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; font-size: 13px; color: var(--texte-doux); margin: 6px 0 10px; }
.pastille { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; }
.pastille.bonne, .mot-case.bonne, .touche.bonne { background: var(--or); color: var(--nuit-1); border-color: var(--or); }
.pastille.ailleurs, .mot-case.ailleurs, .touche.ailleurs { background: #5aa9e6; color: var(--nuit-1); border-color: #5aa9e6; }
.pastille.absente, .mot-case.absente, .touche.absente { background: #3a4266; color: #9aa0bf; border-color: #3a4266; }
.mot-grille { display: grid; gap: 5px; margin: 0 auto; max-width: calc(var(--n) * 44px); }
.mot-ligne { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 5px; }
.mot-case {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font-weight: 900;
  font-size: clamp(18px, 5.5vw, 24px);
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
}
.mot-case.tapee { border-color: var(--or-clair); }
.clavier { display: grid; gap: 6px; margin-top: 12px; }
.clavier-rang { display: flex; gap: 4px; justify-content: center; }
.touche {
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  height: 46px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
  font-size: 15px;
  padding: 0;
}
.touche.large { flex: 1.6 1 0; max-width: 72px; font-size: 13px; }

/* Memory */
.chrono { text-align: center; font-weight: 900; font-size: 20px; color: var(--or-clair); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.memory { display: grid; gap: 8px; }
.carte-memory {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--carte-bord);
  background: linear-gradient(145deg, #93283a, var(--bordeaux));
  font-size: clamp(24px, 8vw, 34px);
  padding: 0;
  display: grid;
  place-items: center;
  transition: transform 0.25s ease, background 0.25s ease;
}
.carte-memory .face { display: none; }
.carte-memory .dos { color: var(--or); opacity: 0.7; font-size: 0.7em; }
.carte-memory.retournee { background: var(--creme); transform: scale(1.03); }
.carte-memory.retournee .face { display: block; }
.carte-memory.retournee .dos { display: none; }
.carte-memory.trouvee { background: rgba(159, 224, 181, 0.85); transform: none; }
.carte-memory.carte-photo { overflow: hidden; }
.carte-memory.carte-photo.retournee .face.photo { display: block; width: 100%; height: 100%; }
.carte-memory .face.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.carte-memory.carte-photo.trouvee { box-shadow: 0 0 0 3px var(--succes); }
.carte-memory.carte-photo.trouvee img { opacity: 0.6; }

/* Cryptogramme */
.crypto { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; margin-top: 6px; }
.crypto-mot { display: flex; gap: 3px; }
.crypto-case { display: grid; justify-items: center; gap: 2px; border-radius: 6px; padding: 2px 1px; }
.crypto-case.meme { background: rgba(232, 196, 112, 0.18); }
.crypto-case .sym { font-size: 17px; line-height: 1.2; min-height: 21px; }
.crypto-case input {
  width: 26px;
  height: 30px;
  padding: 0;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  text-transform: uppercase;
  border: none;
  border-bottom: 2px solid var(--or);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px 4px 0 0;
}
.crypto-case input.fixe { color: var(--or); border-bottom-color: var(--or-fonce); }
.crypto-case.ponctuation { align-content: end; padding: 2px 0; }
.crypto-case.ponctuation .ponct { height: 30px; display: flex; align-items: flex-end; font-weight: 900; font-size: 18px; color: var(--or-clair); }

.alphabet-morse { font-family: ui-monospace, Menlo, monospace; font-size: 14px; word-spacing: 4px; line-height: 1.9; margin: 10px 0 0; }

/* Quiz chrono */
.compteur-quiz { text-align: center; font-weight: 800; color: var(--or); margin: 0 0 6px; }
.barre-temps { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin-bottom: 14px; }
.barre-temps .remplissage { height: 100%; width: 100%; background: linear-gradient(90deg, var(--erreur), var(--or)); transition: width 0.1s linear; }
.correction { display: grid; gap: 8px; }
.ligne-correction { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; font-size: 15px; }
.ligne-correction .marque { font-weight: 900; font-size: 18px; }
.ligne-correction.ok .marque { color: var(--succes); }
.ligne-correction.ko .marque { color: var(--erreur); }
.ligne-correction .bonne { color: var(--or-clair); font-weight: 700; }

/* Escape game */
.etape-faite, .etape-courante { border-left: 3px solid var(--or-fonce); padding: 4px 0 4px 12px; margin: 12px 0; }
.etape-faite { opacity: 0.85; border-left-color: var(--succes); }
.titre-etape { font-weight: 900; color: var(--or-clair); margin-bottom: 4px; }
.etape-courante .texte-jeu { white-space: pre-line; font-size: 20px; text-align: center; }

/* Listes (rébus, devinettes…) */
.liste-jeu { display: grid; gap: 12px; }
.element { border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.03); }
.element.ok { border-color: rgba(159, 224, 181, 0.45); }
.element-tete { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.numero-element { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--or); color: var(--nuit-1); font-weight: 900; font-size: 14px; }
.grand-element { font-size: clamp(24px, 7vw, 32px); line-height: 1.25; }
.texte-element { font-size: 16px; }
.rebus-illustre { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rebus-img { width: clamp(52px, 16vw, 72px); height: auto; }
.rebus-lettre { font-size: clamp(30px, 9vw, 40px); font-weight: 900; line-height: 1; color: var(--or-clair); }
.rebus-illustre .plus { font-size: 22px; font-weight: 900; opacity: 0.75; }
.image-element { border-radius: 8px; margin-bottom: 8px; max-height: 220px; object-fit: contain; }
.element .message { margin: 6px 0 0; }

/* Résultat d'une case */
.resultat { text-align: center; }
.points-gagnes { font-family: var(--police-titre); font-size: 44px; color: var(--or); line-height: 1.1; }
.flocon-gagne { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 12px; font-weight: 800; }
.lettre-flocon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #dbe9ff 60%, #a9c4f2 100%);
  color: var(--nuit-1);
  font-family: var(--police-titre);
  font-size: 22px;
  box-shadow: 0 0 18px rgba(219, 233, 255, 0.7);
}

/* Panneau du score */
.grand-score { font-family: var(--police-titre); font-size: 52px; color: var(--or); line-height: 1.1; }
.jauge { position: relative; height: 14px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); margin: 18px 4px 0; }
.jauge-remplie { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--or-fonce), var(--or-clair)); }
.jauge-palier { position: absolute; top: -4px; width: 3px; height: 22px; margin-left: -1px; background: var(--texte-doux); border-radius: 2px; }
.jauge-palier.atteint { background: var(--succes); }
.jauge-nom { position: absolute; top: 26px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 800; color: var(--texte-doux); }
.jauge-palier:last-child .jauge-nom { transform: translateX(-85%); }
.etiquette-bloc { margin: 0 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--or); }
.classement { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: rang; }
.classement li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); counter-increment: rang; }
.classement li::before { content: counter(rang) "."; color: var(--or); font-weight: 900; margin-right: 8px; }
.classement li span { flex: 1; }
.classement li.moi { outline: 1px solid var(--carte-bord); }
.flocons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.flocon { display: grid; justify-items: center; gap: 2px; opacity: 0.45; }
.flocon.gagne { opacity: 1; }
.flocon .lettre-flocon { width: 36px; height: 36px; font-size: 18px; }
.flocon:not(.gagne) .lettre-flocon { background: rgba(255, 255, 255, 0.1); color: var(--texte-doux); box-shadow: none; font-family: var(--police-texte); }
.jour-flocon { font-size: 11px; color: var(--texte-doux); }
.regles { margin: 0; padding-left: 20px; font-size: 15px; color: var(--texte-doux); }
.legende-paliers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.legende-paliers .palier { font-size: 14px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); color: var(--texte-doux); }
.legende-paliers .palier.atteint { background: rgba(159, 224, 181, 0.18); color: var(--succes); }
.case .etincelle { font-size: 20px; }

a.btn { text-decoration: none; }
.definition-mot { text-align: center; font-size: 1.05rem; margin: 6px 0 10px; }
.definition-mot strong { color: var(--or-clair); }
.mot-grille.long, .mot-grille.long .mot-ligne { gap: 3px; }
.mot-grille.long .mot-case { font-size: clamp(13px, 4vw, 20px); border-radius: 6px; border-width: 1.5px; }

/* ------------------------------------------------------------ jeux 8 à 14 */

/* Enquête */
.indices-enquete { margin: 6px 0 0; padding-left: 1.4em; display: grid; gap: 6px; }
.indices-enquete li { line-height: 1.45; cursor: pointer; }
.indices-enquete li.barre { text-decoration: line-through; opacity: 0.45; }
.bloc-enquete { margin-top: 12px; }
.defile { overflow-x: auto; }
.grille-enquete { border-collapse: collapse; margin: 0 auto; }
.grille-enquete th { font-weight: 700; font-size: 13px; color: var(--texte-doux); }
.grille-enquete tbody th { text-align: right; padding: 0 8px 0 0; white-space: nowrap; color: var(--texte); }
.grille-enquete thead th { vertical-align: bottom; padding: 0 0 6px; height: 96px; }
.grille-enquete thead th span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; }
.grille-enquete td { padding: 0; }
.marque { width: 38px; height: 38px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.05); color: var(--texte); font-size: 18px; font-weight: 900; padding: 0; }
.marque.m1 { color: var(--erreur); }
.marque.m2 { color: var(--nuit-1); background: var(--succes); }

/* Simon */
.simon { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.simon-6 { grid-template-columns: repeat(3, 1fr); }
.cloche-simon { aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); font-size: 34px; filter: saturate(0.55) brightness(0.75); transition: transform 0.1s, filter 0.1s, box-shadow 0.1s; }
.cloche-simon.allumee { filter: none; transform: scale(1.08); box-shadow: 0 0 26px rgba(255, 255, 255, 0.75); }
.cloche-simon.k0 { background: #d8434b; }
.cloche-simon.k1 { background: #3aa76d; }
.cloche-simon.k2 { background: #3b7be2; }
.cloche-simon.k3 { background: #e8b931; }
.cloche-simon.k4 { background: #a35ad8; }
.cloche-simon.k5 { background: #ee8a35; }

/* Sudoku */
.sudoku { display: grid; max-width: 380px; margin: 0 auto; border: 3px solid var(--or); border-radius: 6px; overflow: hidden; }
.sudoku-case { aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.04); color: #9fd0ff; font-size: clamp(16px, 5vw, 22px); font-weight: 800; font-variant-numeric: tabular-nums; }
.s6 .sudoku-case { font-size: clamp(20px, 6.5vw, 28px); }
.sudoku-case.donnee { color: var(--texte); background: rgba(255, 255, 255, 0.12); }
.sudoku-case.bord-d { border-right: 3px solid var(--or); }
.sudoku-case.bord-b { border-bottom: 3px solid var(--or); }
.sudoku-case.meme { background: rgba(232, 196, 112, 0.25); }
.sudoku-case.choisie { background: var(--or); color: var(--nuit-1); }
.sudoku-case.conflit { color: var(--erreur); background: rgba(255, 143, 143, 0.18); }
.pave-sudoku { display: grid; gap: 6px; max-width: 380px; margin: 12px auto; }
.pave-sudoku .touche { height: 48px; font-size: 20px; max-width: none; }

/* Taquin */
.taquin-modele { display: block; width: 140px; height: 140px; object-fit: cover; border-radius: 10px; margin: 0 auto 12px; border: 2px solid var(--carte-bord); }
.taquin { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; background: rgba(0, 0, 0, 0.35); border-radius: 8px; overflow: hidden; }
.morceau { position: absolute; width: calc(100% / var(--n)); height: calc(100% / var(--n)); padding: 0; border: 1px solid rgba(0, 0, 0, 0.45); border-radius: 4px; background-repeat: no-repeat; background-size: calc(var(--n) * 100%) calc(var(--n) * 100%); transition: left 0.12s ease, top 0.12s ease; }
.morceau .num { position: absolute; top: 3px; left: 5px; font-size: 12px; font-weight: 900; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.taquin-complet { position: absolute; inset: 0; background-size: cover; animation: apparait 0.8s ease forwards; opacity: 0; }
@keyframes apparait { to { opacity: 1; } }

/* Coffre à code couleur */
.mm-lignes { display: grid; gap: 6px; max-width: 360px; margin: 0 auto; }
.mm-ligne { display: grid; grid-template-columns: 22px 1fr 56px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.mm-ligne.courante { background: rgba(232, 196, 112, 0.12); border: 1px solid var(--carte-bord); }
.mm-num { font-size: 12px; color: var(--texte-doux); text-align: right; }
.mm-pions { display: flex; gap: 6px; }
.mm-pion { width: 30px; height: 30px; border-radius: 50%; display: inline-block; border: 2px solid rgba(255, 255, 255, 0.3); padding: 0; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2); }
.mm-pion.vide { background: rgba(255, 255, 255, 0.06); border-style: dashed; box-shadow: none; }
.mm-pion.pR { background: #d8434b; } .mm-pion.pV { background: #3aa76d; } .mm-pion.pB { background: #3b7be2; } .mm-pion.pJ { background: #f0c73a; }
.mm-pion.pO { background: #ee8a35; } .mm-pion.pP { background: #a35ad8; } .mm-pion.pW { background: #f4f4f4; } .mm-pion.pM { background: #8a5a35; }
.mm-retour { display: flex; flex-wrap: wrap; gap: 4px; width: 56px; }
.mm-bien, .mm-mal { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.mm-bien { background: var(--or); }
.mm-mal { border: 2px solid var(--texte); }
.mm-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; }
.mm-palette .mm-pion { width: 42px; height: 42px; }
.legende-mot .leg { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.fenetre:focus { outline: none; }

/* ------------------------------------------------------------ image derrière les portes */

.case.avec-fond .interieur {
  background-color: var(--nuit-2);
  background-repeat: no-repeat;
  grid-template-rows: none;
  grid-auto-flow: column;
  place-content: end;
  gap: 3px;
  padding: 4px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.25);
}
.case.avec-fond .flocon-case,
.case.avec-fond .points-case {
  background: rgba(255, 246, 214, 0.9);
  color: var(--nuit-1);
  border-radius: 6px;
  padding: 1px 5px;
  line-height: 1.3;
}
.case.avec-fond .flocon-case { font-size: 15px; }
.case.grande.avec-fond .flocon-case { font-size: 20px; }
.case.avec-fond .points-case { font-size: 10px; }
.image-entiere { display: block; width: 100%; height: auto; border-radius: 12px; }

/* ------------------------------------------------------------ cadeau surprise */

.cadeau-zone { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 6px 0 4px; }
.cadeau-boite { font-size: 96px; line-height: 1; animation: cadeau-attend 1.6s ease-in-out infinite; }
.cadeau-boite.ouvre { animation: cadeau-ouvre 0.7s ease-in forwards; }
.cadeau-titre { margin: 4px 0 0; }
.etiquette-cadeau { margin: 0; font-weight: 900; color: var(--or); letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px; }
.cadeau-message { margin: 0; font-size: clamp(1.25rem, 1.1rem + 1vw, 1.5rem); line-height: 1.35; font-weight: 700; white-space: pre-line; text-wrap: balance; }
.cadeau-image { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; }
@keyframes cadeau-attend {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-8deg) scale(1.05); }
  40% { transform: rotate(7deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.02); }
}
@keyframes cadeau-ouvre {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35) rotate(10deg); opacity: 1; }
  100% { transform: scale(0.2) rotate(-20deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cadeau-boite, .cadeau-boite.ouvre { animation: none; }
}

/* ------------------------------------------------------------ jeux 15 à 24 */

/* Mots croisés */
.croises { display: grid; gap: 2px; max-width: 380px; margin: 0 auto; }
.cc { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 4px; background: #f6f1e4; color: var(--nuit-1); font-weight: 900; font-size: clamp(15px, 4.6vw, 21px); line-height: 1; text-transform: uppercase; }
.cc.vide { background: transparent; border-color: transparent; }
.cc .num { position: absolute; top: 1px; left: 2px; font-size: 9px; font-weight: 800; color: #5a5f80; }
.cc.mot { background: #ffe9a8; }
.cc.courante { background: var(--or); box-shadow: inset 0 0 0 2px var(--or-fonce); }
.cc.ok { background: #c9efd6; color: #14532d; }
.cc.faux { background: #ffc9c9; }
.definition-croises { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(232, 196, 112, 0.14); border: 1px solid var(--carte-bord); font-size: 15px; line-height: 1.4; min-height: 44px; }
.defs-croises { display: grid; gap: 12px; margin-top: 16px; }
.etiquette-defs { margin: 0 0 4px; font-weight: 900; color: var(--or); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.def-croises { display: block; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--texte); font: inherit; font-size: 15px; line-height: 1.4; }
.def-croises .lg { color: var(--texte-doux); }
.def-croises.choisie { background: rgba(232, 196, 112, 0.16); }
.def-croises.trouve { color: var(--succes); }
.def-croises.trouve::before { content: "✓ "; }

/* Trouve l'intrus */
.intrus { --n: 3; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; max-width: 400px; margin: 0 auto; }
.intrus-case { aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; background: rgba(255, 255, 255, 0.06); font-size: calc((min(100vw, 440px) - 100px) / var(--n) * 0.55); line-height: 1; display: grid; place-items: center; min-width: 0; overflow: hidden; }
.intrus-case.retourne span { display: inline-block; transform: scaleX(-1); }
.intrus-case.rate { background: rgba(255, 143, 143, 0.35); animation: tremble 0.3s; }
.intrus.fini { opacity: 0.45; pointer-events: none; }
@keyframes tremble { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* Le compte est bon */
.cible-compte { margin: 4px auto 12px; width: max-content; min-width: 120px; padding: 6px 18px; border-radius: 12px; background: linear-gradient(180deg, #1d2f6b, #0b1233); border: 2px solid var(--or); color: var(--or-clair); text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 40px; font-weight: 900; letter-spacing: 0.08em; }
.plaques { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.plaque { min-width: 58px; height: 52px; padding: 0 10px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.2); background: #f6f1e4; color: var(--nuit-1); font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.plaque.calculee { background: #ffe9a8; }
.plaque.choisie { background: var(--or); border-color: var(--or-fonce); transform: translateY(-2px); }
.ops-compte { display: flex; gap: 8px; justify-content: center; margin: 12px 0 6px; }
.ops-compte .touche.op { max-width: 64px; height: 50px; font-size: 26px; }
.ops-compte .touche.choisie { background: var(--or); color: var(--nuit-1); }
.lignes-compte { min-height: 24px; text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 15px; color: var(--texte-doux); line-height: 1.6; }

/* Bougies magiques */
.bougies { display: grid; gap: 6px; max-width: 340px; margin: 8px auto 0; }
.bougie { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.bougie .cire { position: absolute; left: 34%; right: 34%; bottom: 12%; height: 46%; border-radius: 4px 4px 3px 3px; background: linear-gradient(90deg, #d9d2c3, #fff7e6 45%, #cfc6b3); }
.bougie .cire::before { content: ""; position: absolute; left: 50%; top: -12%; width: 2px; height: 14%; margin-left: -1px; background: #3a2c22; }
.bougie .flamme { position: absolute; left: 50%; bottom: 60%; width: 26%; height: 28%; margin-left: -13%; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fffbe0 0%, #ffd34d 45%, #ff8a1f 80%, transparent 82%); opacity: 0; transform: scale(0.4); transition: opacity 0.15s, transform 0.15s; }
.bougie.allumee { background: radial-gradient(circle at 50% 40%, rgba(255, 200, 90, 0.38), rgba(0, 0, 0, 0.15) 70%); border-color: rgba(255, 211, 77, 0.5); }
.bougie.allumee .flamme { opacity: 1; transform: scale(1); animation: vacille 1.4s ease-in-out infinite; }
@keyframes vacille { 50% { transform: scale(0.92, 1.06) rotate(-2deg); } }

/* Attrape les étoiles */
.ciel-etoiles { display: block; margin: 0 auto; border-radius: 14px; border: 1px solid var(--carte-bord); touch-action: none; user-select: none; -webkit-user-select: none; }

/* Mission d'équipe */
.bloc-equipe { margin: 12px 0; padding: 12px; border-radius: 12px; background: rgba(232, 196, 112, 0.1); border: 1px dashed var(--carte-bord); }
.paires-equipe { display: flex; flex-wrap: wrap; gap: 8px; }
.paire-equipe { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); font-size: 17px; }
.paire-equipe strong { color: var(--or-clair); }

/* Grande finale */
.vrac-finale { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.flocon-vrac { width: 40px; height: 44px; padding: 0; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.25); background: radial-gradient(circle at 50% 30%, #ffffff, #cfe0ff); color: var(--nuit-1); font-weight: 900; font-size: 20px; }
.flocon-vrac:disabled { opacity: 0.25; }
.manquants { margin-top: 10px; }
.btn.petit { padding: 8px 12px; font-size: 14px; }
.grille-finale { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; }
.mot-finale { display: flex; gap: 3px; }
.trou { width: 30px; height: 38px; padding: 0; border: 0; border-bottom: 3px solid var(--or); border-radius: 6px 6px 0 0; background: rgba(255, 255, 255, 0.08); color: var(--texte); font-weight: 900; font-size: 19px; }
.trou.plein { background: rgba(232, 196, 112, 0.22); }
.trou.choisi { background: rgba(232, 196, 112, 0.45); }
.autre-saisie { margin-top: 14px; color: var(--texte-doux); font-size: 14px; }
.autre-saisie summary { cursor: pointer; }

/* ------------------------------------------------------------ jeu de cartes et récompense en photo */
.table-cartes { display: flex; gap: 16px; justify-content: center; margin: 14px 0; perspective: 600px; }
.carte-jeu { position: relative; width: 96px; height: 136px; border-radius: 10px; background: #fffdf7; color: #1b1b2f; box-shadow: var(--ombre); display: flex; align-items: center; justify-content: center; font-weight: 900; }
.carte-jeu.rouge { color: #c0392b; }
.carte-jeu .coin { position: absolute; top: 6px; left: 8px; font-size: 17px; line-height: 1; }
.carte-jeu .coin.bas { top: auto; left: auto; bottom: 6px; right: 8px; transform: rotate(180deg); }
.carte-jeu .centre-carte { font-size: 46px; line-height: 1; }
.carte-jeu.dos { background: repeating-linear-gradient(45deg, var(--bordeaux) 0 8px, #5c1622 8px 16px); border: 4px solid #fffdf7; }
.carte-jeu.nouvelle { animation: retourne-carte 0.35s ease-out; }
@keyframes retourne-carte { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }
.tenue { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tenue li { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--carte); font-size: 15px; transition: opacity 0.4s; }
.tenue li.tombee { opacity: 0.35; text-decoration: line-through; }
.tenue li.gagnee { background: rgba(217, 182, 106, 0.3); box-shadow: inset 0 0 0 1px rgba(217, 182, 106, 0.8); font-weight: 700; }
.tenue-emoji { font-size: 20px; }
.photo-recompense { display: block; width: 100%; max-width: 420px; margin: 12px auto 0; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .carte-jeu.nouvelle { animation: none; } }
.carte-tiree:empty { display: none; }
.carte-tiree { margin: 14px auto 0; max-width: 420px; padding: 16px 18px; border-radius: var(--rayon); background: #fffdf7; color: var(--nuit-1); text-align: center; box-shadow: var(--ombre); }
.carte-tiree .etiquette { color: var(--bordeaux); }
.carte-tiree .texte-jeu { color: var(--nuit-1); margin: 6px 0 0; }
.carte-tiree.nouvelle { animation: retourne-carte 0.35s ease-out; }
@media (prefers-reduced-motion: reduce) { .carte-tiree.nouvelle { animation: none; } }
.deux-images { display: grid; gap: 10px; max-width: 520px; margin: 0 auto; }
.cadre-diff { position: relative; border-radius: 10px; overflow: hidden; line-height: 0; }
.cadre-diff.zoome { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.cadre-diff.glisse { cursor: grabbing; }
.toile-diff { position: relative; width: 100%; touch-action: manipulation; cursor: crosshair; }
.cadre-diff.zoome .toile-diff { touch-action: pan-x pan-y; }
.toile-diff img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.zoom-diff { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 10px; }
.btn-zoom { min-width: 48px; padding: 6px 14px; font-size: 1.3rem; line-height: 1; }
.zoom-niveau { min-width: 6.5em; text-align: center; font-weight: 700; }
/* Sur un écran en largeur (ordinateur, téléphone couché) : les deux photos côte à côte, fenêtre élargie. */
@media (min-width: 600px) and (orientation: landscape) {
  .fenetre:has(.deux-images) { max-width: min(1200px, 96vw); }
  .deux-images { grid-template-columns: 1fr 1fr; max-width: none; }
}
.rond-diff { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #39e07a; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); pointer-events: none; }
.rond-diff.manque { border-color: var(--erreur); border-style: dashed; }
.croix-diff { position: absolute; transform: translate(-50%, -50%); color: var(--erreur); font-weight: 900; font-size: 18px; white-space: nowrap; line-height: 1; pointer-events: none; text-shadow: 0 0 4px #000; }

/* ============================================================ thèmes */
/* Éléments propres au thème « botanique », cachés dans le thème de nuit. */
.ornement, .case .deco, .guirlande-bas { display: none; }
.symbole-score::before { content: "✦"; }

/* ------------------------------------------------------------ thème « botanique » : papier crème, portes vert sapin, ornements dorés */
:root[data-theme^="botanique"] {
  --nuit-1: #142f20;
  --nuit-2: #1c3d2a;
  --nuit-3: #27513a;
  --or: #d9b66a;
  --or-clair: #f1dca4;
  --or-fonce: #a8863e;
  --bordeaux: #8a1d20;
  --sapin: #1f4a32;
  --papier: #f3ead8;
  --encre: #1d3b28;
  --encre-douce: #4a5e4f;
  --porte: #1f4a32;
  --sauge: #bdd3ab;
  --police-titre: "Playfair Display", Georgia, "Times New Roman", serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-porte: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme^="botanique"] body { background: var(--grain), var(--papier); background-color: var(--papier); }
[data-theme^="botanique"] .page { color: var(--encre); }
/* Les flocons tombent devant les portes (mais derrière les fenêtres des jeux). */
[data-theme^="botanique"] #neige { z-index: 2; }

/* En-tête : cloche, score, prénom, sans pastilles */
[data-theme^="botanique"] .entete .puce {
  background: none;
  border: none;
  color: var(--encre);
  font-family: var(--police-titre);
  font-size: 19px;
  padding: 6px 4px;
  font-variant-numeric: lining-nums;
}
[data-theme^="botanique"] .symbole-score::before { content: "★"; }
[data-theme^="botanique"] #btn-son {
  background: url("../img/deco/cloche.svg") center / 30px no-repeat;
  border: none;
  font-size: 0;
  color: transparent;
}
[data-theme^="botanique"] #btn-son.muet { background-image: url("../img/deco/cloche-muette.svg"); }

/* Rameau de pin entre deux filets, au-dessus du titre */
[data-theme^="botanique"] .ornement {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto -2px;
}
[data-theme^="botanique"] .ornement::before,
[data-theme^="botanique"] .ornement::after { content: ""; flex: 1; border-top: 1px solid rgba(29, 59, 40, 0.38); }
[data-theme^="botanique"] .ornement span { width: 170px; aspect-ratio: 200 / 64; background: url("../img/deco/ornement-titre.svg") center / contain no-repeat; }

[data-theme^="botanique"] .titre {
  font-family: var(--police-titre);
  font-weight: 600;
  color: var(--encre);
  font-size: clamp(2.4rem, 1.4rem + 6vw, 3.9rem);
  line-height: 1.02;
  letter-spacing: -0.012em;
  text-shadow: none;
  margin: 2px 0 10px;
  text-wrap: balance;
}
[data-theme^="botanique"] .sous-titre {
  font-family: var(--police-titre);
  font-style: italic;
  color: var(--encre);
  font-size: clamp(1.05rem, 0.95rem + 0.9vw, 1.35rem);
  margin-bottom: 22px;
}

/* Bandeau sans cadre, entre deux filets */
[data-theme^="botanique"] .bandeau:not(.masque) {
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 22px;
  color: var(--encre);
  font-family: var(--police-titre);
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.35;
  gap: 10px;
}
[data-theme^="botanique"] .bandeau::before,
[data-theme^="botanique"] .bandeau::after { content: ""; flex: 1 1 0; min-width: 0; border-top: 1px solid rgba(29, 59, 40, 0.38); }
[data-theme^="botanique"] .bandeau .texte-bandeau { flex: 0 1 auto; text-wrap: balance; }
[data-theme^="botanique"] .bandeau strong { color: var(--encre); font-weight: 600; }

/* Portes : cuir vert sapin, cadre gravé aux coins échancrés, bouton de laiton en demi-lune */
[data-theme^="botanique"] .calendrier { --cote: calc((min(100vw, 560px) - 32px - 36px) / 4); gap: 12px; }
[data-theme^="botanique"] .case { container-type: size; }
[data-theme^="botanique"] .case,
[data-theme^="botanique"] .case .interieur { border-radius: 7px; }
[data-theme^="botanique"] .case .interieur { background: #e8dcc2; color: var(--encre); box-shadow: inset 0 0 18px rgba(60, 50, 30, 0.35); }
[data-theme^="botanique"] .case .porte {
  border: none;
  border-radius: 7px;
  background: var(--grain-porte), radial-gradient(ellipse at 40% 35%, #285a3d 0%, var(--porte) 60%, #193d29 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 12px rgba(0, 0, 0, 0.18),
    0 2px 0 #11281b, 0 7px 12px rgba(45, 50, 30, 0.26);
}
/* Cadre gravé : quatre filets et quatre échancrures (arcs de cercle) aux coins */
[data-theme^="botanique"] .case .porte::before {
  --f: rgba(205, 232, 205, 0.24);
  --e: 7px;
  inset: 6%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.38));
  background:
    radial-gradient(circle at 0 0, transparent calc(var(--e) - 0.6px), var(--f) calc(var(--e) - 0.6px), var(--f) calc(var(--e) + 0.6px), transparent calc(var(--e) + 0.6px)) left top / calc(var(--e) + 1px) calc(var(--e) + 1px) no-repeat,
    radial-gradient(circle at 100% 0, transparent calc(var(--e) - 0.6px), var(--f) calc(var(--e) - 0.6px), var(--f) calc(var(--e) + 0.6px), transparent calc(var(--e) + 0.6px)) right top / calc(var(--e) + 1px) calc(var(--e) + 1px) no-repeat,
    radial-gradient(circle at 0 100%, transparent calc(var(--e) - 0.6px), var(--f) calc(var(--e) - 0.6px), var(--f) calc(var(--e) + 0.6px), transparent calc(var(--e) + 0.6px)) left bottom / calc(var(--e) + 1px) calc(var(--e) + 1px) no-repeat,
    radial-gradient(circle at 100% 100%, transparent calc(var(--e) - 0.6px), var(--f) calc(var(--e) - 0.6px), var(--f) calc(var(--e) + 0.6px), transparent calc(var(--e) + 0.6px)) right bottom / calc(var(--e) + 1px) calc(var(--e) + 1px) no-repeat,
    linear-gradient(var(--f), var(--f)) center top / calc(100% - 2 * var(--e)) 1.2px no-repeat,
    linear-gradient(var(--f), var(--f)) center bottom / calc(100% - 2 * var(--e)) 1.2px no-repeat,
    linear-gradient(var(--f), var(--f)) left center / 1.2px calc(100% - 2 * var(--e)) no-repeat,
    linear-gradient(var(--f), var(--f)) right center / 1.2px calc(100% - 2 * var(--e)) no-repeat;
}
/* Œillet : un fin anneau doré, sobre */
[data-theme^="botanique"] .case .porte::after {
  right: 7%;
  top: 50%;
  width: 6.5cqmin;
  height: 6.5cqmin;
  min-width: 6px;
  min-height: 6px;
  margin-top: 0;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1.3px #d9b66a, 0 1px 0 rgba(0, 0, 0, 0.3);
}
[data-theme^="botanique"] .case .numero {
  font-family: "Libre Caslon Text", "Playfair Display", Georgia, serif;
  font-weight: 400;
  color: #f2ead6;
  font-size: clamp(1.6rem, 0.8rem + 4.4vw, 2.4rem);
  font-size: 28cqmin;
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  font-variant-numeric: lining-nums;
}
[data-theme^="botanique"] .case .cadenas { display: none; }
[data-theme^="botanique"] .case.verrouillee .porte { filter: none; }
[data-theme^="botanique"] .case.disponible .porte { animation: none; }
/* Case commencée : la porte reste fermée (pas de perspective qui déforme les chiffres), son cadre devient doré. */
[data-theme^="botanique"] .case.ouverte .porte { transform: none; }
[data-theme^="botanique"] .case.ouverte .porte::before { --f: rgba(226, 190, 110, 0.85); filter: drop-shadow(0 0 2px rgba(226, 190, 110, 0.45)); }

/* La case du jour : vert sauge, qui respire doucement */
[data-theme^="botanique"] .case.aujourdhui .porte {
  background: var(--grain-porte), radial-gradient(ellipse at 40% 35%, #d3e3c5 0%, var(--sauge) 60%, #a9c494 100%);
  box-shadow: inset 0 0 0 1px rgba(60, 90, 50, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 0 #8fae7a, 0 7px 12px rgba(45, 50, 30, 0.22);
  animation: respire 2.8s ease-in-out infinite;
}
[data-theme^="botanique"] .case.aujourdhui .porte::before { --f: rgba(29, 59, 40, 0.32); filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5)); }
[data-theme^="botanique"] .case.aujourdhui .numero { color: var(--encre); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); }
@keyframes respire {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(60, 90, 50, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 0 #8fae7a, 0 7px 12px rgba(45, 50, 30, 0.22); }
  50% { box-shadow: inset 0 0 0 1px rgba(60, 90, 50, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 0 #8fae7a, 0 8px 22px rgba(120, 160, 90, 0.55); }
}

/* La grande case 24 : rouge, chiffres dorés */
[data-theme^="botanique"] .case.grande .porte {
  background: var(--grain-porte), radial-gradient(ellipse at 40% 35%, #a1272a 0%, #861c1f 60%, #6a1416 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 16px rgba(0, 0, 0, 0.22),
    0 2px 0 #4e0f11, 0 9px 16px rgba(60, 30, 20, 0.3);
}
[data-theme^="botanique"] .case.grande .porte::before { --e: 11px; inset: 5%; --f: rgba(240, 210, 150, 0.3); }
[data-theme^="botanique"] .case.grande .porte::after { right: 4.5%; width: 4.5cqmin; height: 4.5cqmin; }
[data-theme^="botanique"] .case.aujourdhui .porte::after { background: rgba(255, 255, 255, 0.25); box-shadow: inset 0 0 0 1.3px #8a6a2c, 0 1px 0 rgba(255, 255, 255, 0.5); }
[data-theme^="botanique"] .case.grande .numero {
  font-size: clamp(3.2rem, 1.4rem + 11vw, 5.4rem);
  font-size: 34cqmin;
  background: linear-gradient(180deg, #f7df9c 0%, #d8b25e 55%, #b38b3c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35));
}
[data-theme^="botanique"] .case.grande.aujourdhui .numero { color: transparent; }

/* Motifs dorés dans un coin de certaines portes, par-dessus le cadre */
[data-theme^="botanique"] .case .deco {
  display: block;
  position: absolute;
  width: 40%;
  aspect-ratio: 1;
  background: center / contain no-repeat;
  opacity: 0.95;
  pointer-events: none;
}
[data-theme^="botanique"] .case .deco.pin { background-image: url("../img/deco/coin-pin.svg"); }
[data-theme^="botanique"] .case .deco.houx { background-image: url("../img/deco/coin-houx.svg"); }
[data-theme^="botanique"] .case .deco.baies { background-image: url("../img/deco/coin-baies.svg"); }
[data-theme^="botanique"] .case .deco.grand-pin { background-image: url("../img/deco/coin-24.svg"); width: 46%; }
[data-theme^="botanique"] .case .deco.bg { left: 2%; bottom: 2%; }
[data-theme^="botanique"] .case .deco.bd { right: 7%; bottom: 0; width: 36%; transform: scaleX(-1); }
[data-theme^="botanique"] .case .deco.hd { right: 9%; top: 2%; }
[data-theme^="botanique"] .case.aujourdhui .deco { filter: brightness(0.45) saturate(0.6); }

/* Choix du prénom et chargement, sur le papier */
[data-theme^="botanique"] .chargement { color: var(--encre-douce); font-family: var(--police-titre); font-style: italic; }
[data-theme^="botanique"] .choix-joueuse button {
  border: none;
  background: var(--grain-porte), var(--porte);
  color: #f4ecd8;
  font-family: var(--police-titre);
  font-weight: 500;
  box-shadow: 0 3px 0 #11281b, 0 8px 14px rgba(45, 50, 30, 0.25);
}

/* Fenêtres des jeux : vert sapin profond au lieu du bleu nuit */
[data-theme^="botanique"] .voile { background: rgba(30, 38, 26, 0.55); }
[data-theme^="botanique"] .fenetre { background: var(--grain-porte), linear-gradient(180deg, #24492f 0%, #163322 100%); }

/* ------------------------------------------------------------ variante « botanique-chat » : chat et souris au trait, aquarelles */
/* Le chat qui court après la souris, au-dessus du titre */
[data-theme="botanique-chat"] .ornement { max-width: 480px; margin-bottom: 2px; }
[data-theme="botanique-chat"] .ornement span {
  width: clamp(130px, 34vw, 172px);
  aspect-ratio: 1832 / 1440;
  background-image: url("../img/deco/chat/chat-souris.svg");
}

/* Brins dorés à la craie : le pied de la tige part d'un coin de la porte et le brin pousse vers le centre.
   --bx/--by : pied de la tige dans le dessin ; --a : direction du brin (0 = vers le haut) ; --t : direction voulue. */
[data-theme="botanique-chat"] .case .deco {
  width: auto;
  right: auto;
  bottom: auto;
  aspect-ratio: 0.5;
  opacity: 0.92;
  left: var(--cx);
  top: var(--cy);
  transform-origin: var(--bx) var(--by);
  transform: translate(calc(var(--bx) * -1), calc(var(--by) * -1)) rotate(calc(var(--t) - var(--a)));
}
[data-theme="botanique-chat"] .case .deco.bg { --cx: 7%; --cy: 93%; --t: 45deg; left: var(--cx); top: var(--cy); right: auto; bottom: auto; width: auto; transform: translate(calc(var(--bx) * -1), calc(var(--by) * -1)) rotate(calc(var(--t) - var(--a))); }
[data-theme="botanique-chat"] .case .deco.bd { --cx: 93%; --cy: 93%; --t: -45deg; left: var(--cx); top: var(--cy); right: auto; bottom: auto; width: auto; transform: translate(calc(var(--bx) * -1), calc(var(--by) * -1)) rotate(calc(var(--t) - var(--a))); }
[data-theme="botanique-chat"] .case .deco.hd { --cx: 93%; --cy: 7%; --t: -135deg; left: var(--cx); top: var(--cy); right: auto; bottom: auto; width: auto; transform: translate(calc(var(--bx) * -1), calc(var(--by) * -1)) rotate(calc(var(--t) - var(--a))); }
[data-theme="botanique-chat"] .case .deco.brin-baies { background-image: url("../img/deco/chat/brin-baies.svg"); aspect-ratio: 346 / 693; height: 37.5%; --bx: 89.0%; --by: 0.9%; --a: -160deg; }
[data-theme="botanique-chat"] .case .deco.brin-baies-2 { background-image: url("../img/deco/chat/brin-baies-2.svg"); aspect-ratio: 424 / 625; height: 34.0%; --bx: 87.5%; --by: 98.9%; --a: -22deg; }
[data-theme="botanique-chat"] .case .deco.houx-1 { background-image: url("../img/deco/chat/houx-1.svg"); aspect-ratio: 554 / 912; height: 37.4%; --bx: 84.8%; --by: 99.2%; --a: -24deg; }
[data-theme="botanique-chat"] .case .deco.houx-2 { background-image: url("../img/deco/chat/houx-2.svg"); aspect-ratio: 632 / 912; height: 38.5%; --bx: 59.7%; --by: 99.2%; --a: -1deg; }
[data-theme="botanique-chat"] .case .deco.rameau { background-image: url("../img/deco/chat/rameau.svg"); aspect-ratio: 371 / 900; height: 38.1%; --bx: 52.8%; --by: 99.9%; --a: 0deg; }
[data-theme="botanique-chat"] .case .deco.rameau-2 { background-image: url("../img/deco/chat/rameau-2.svg"); aspect-ratio: 378 / 900; height: 38.0%; --bx: 37.6%; --by: 99.9%; --a: 3deg; }
[data-theme="botanique-chat"] .case .deco.brindille { background-image: url("../img/deco/chat/brindille.svg"); aspect-ratio: 303 / 456; height: 39.0%; --bx: 73.9%; --by: 1.3%; --a: -161deg; }
[data-theme="botanique-chat"] .case .deco.branche-baies { background-image: url("../img/deco/chat/branche-baies.svg"); aspect-ratio: 533 / 912; height: 36.5%; --bx: 66.8%; --by: 99.2%; --a: -12deg; }
[data-theme="botanique-chat"] .case .deco.brin-g { background-image: url("../img/deco/chat/brin-g.svg"); aspect-ratio: 345 / 748; height: 36.5%; --bx: 97.1%; --by: 99.9%; --a: -25deg; }
[data-theme="botanique-chat"] .case .deco.sapin { background-image: url("../img/deco/chat/sapin.svg"); aspect-ratio: 630 / 820; height: 35.5%; --bx: 69.7%; --by: 99.1%; --a: -18deg; }
/* La souris dorée trottine au pied d'une porte */
[data-theme="botanique-chat"] .case .deco.souris { background-image: url("../img/deco/chat/souris-or.svg"); height: 29%; aspect-ratio: 700 / 596; left: 9%; top: auto; bottom: 8%; transform: none; }

/* Case 24 : couronne à l'aquarelle autour du chiffre */
[data-theme="botanique-chat"] .case .deco.couronne {
  background-image: url("../img/deco/chat/couronne-feuilles.webp");
  height: 80%;
  aspect-ratio: 800 / 792;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}
[data-theme="botanique-chat"] .case.grande .numero { position: relative; font-size: 22cqmin; }
[data-theme="botanique-chat"] .case.aujourdhui .deco.couronne { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2)); }

/* Guirlande à l'aquarelle sous les portes */
[data-theme="botanique-chat"] .guirlande-bas {
  display: block;
  width: min(92%, 520px);
  aspect-ratio: 1400 / 212;
  margin: 26px auto 6px;
  background: url("../img/deco/chat/guirlande-poinsettia.webp") center / contain no-repeat;
}

/* ============================================================ thème « coffre » : nuit d'hiver moderne, lumières chaudes */

:root[data-theme="coffre"] {
  --nuit-1: #070b1a;
  --nuit-2: #0d1430;
  --nuit-3: #1a2350;
  --or: #f2c879;
  --or-clair: #ffe7b5;
  --or-fonce: #c9923f;
  --bordeaux: #6e1426;
  --sapin: #163d33;
  --texte: #f7f1e6;
  --texte-doux: #b9bdd6;
  --carte: rgba(255, 255, 255, 0.06);
  --carte-bord: rgba(255, 231, 181, 0.18);
  --rayon: 18px;
  --ombre: 0 18px 40px rgba(0, 0, 0, 0.45);
  --police-titre: "Fraunces", Georgia, serif;
  --police-texte: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --chaud: rgba(255, 176, 92, 0.55);
}
[data-theme="coffre"] body {
  background:
    radial-gradient(circle at 10% 22%, rgba(255, 190, 110, 0.14), transparent 90px),
    radial-gradient(circle at 92% 10%, rgba(255, 214, 150, 0.12), transparent 130px),
    radial-gradient(circle at 85% 70%, rgba(255, 160, 90, 0.08), transparent 160px),
    radial-gradient(circle at 6% 85%, rgba(255, 200, 140, 0.08), transparent 140px),
    radial-gradient(ellipse 120% 50% at 50% 115%, rgba(255, 150, 70, 0.10), transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% -10%, #1c2656 0%, #0d1430 45%, #070b1a 100%) fixed;
  background-color: #070b1a;
}
[data-theme="coffre"] .page { max-width: 600px; padding-top: 12px; }
[data-theme="coffre"] .titre {
  font-family: var(--police-titre);
  font-weight: 300;
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: clamp(38px, 11vw, 54px);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--or-clair);
  text-shadow: 0 0 28px rgba(255, 190, 110, 0.45);
  margin: 18px 0 6px;
}
[data-theme="coffre"] .sous-titre { font-size: 14px; letter-spacing: 0.02em; color: var(--texte-doux); margin-bottom: 22px; }
[data-theme="coffre"] .puce, [data-theme="coffre"] .bouton-icone {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 600;
}
[data-theme="coffre"] .bandeau { border-radius: 16px; background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 231, 181, 0.16); font-size: 15px; }

/* La grille : des fenêtres givrées, éclairées de l'intérieur quand c'est le jour. */
[data-theme="coffre"] .calendrier { --cote: calc((min(100vw, 600px) - 32px - 36px) / 4); gap: 12px; perspective: 1400px; }
[data-theme="coffre"] .case, [data-theme="coffre"] .case .interieur, [data-theme="coffre"] .case .porte { border-radius: 18px; }
[data-theme="coffre"] .case .porte {
  background:
    var(--grain),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.10), transparent 55%),
    linear-gradient(160deg, rgba(40, 52, 110, 0.75), rgba(14, 20, 48, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 10px 26px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="coffre"] .case.c0 .porte, [data-theme="coffre"] .case.c1 .porte,
[data-theme="coffre"] .case.c2 .porte, [data-theme="coffre"] .case.c3 .porte { background-color: transparent; }
[data-theme="coffre"] .case .porte::before { inset: 6px; border: 1px solid rgba(242, 200, 121, 0.28); border-radius: 12px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%); }
[data-theme="coffre"] .case .porte::after { display: none; }
[data-theme="coffre"] .case .numero {
  font-family: var(--police-titre);
  font-weight: 300;
  font-variation-settings: "opsz" 144;
  font-size: clamp(28px, 8.5vw, 40px);
  color: rgba(247, 241, 230, 0.92);
  letter-spacing: -0.03em;
  text-shadow: none;
}
[data-theme="coffre"] .case.grande { grid-column: span 2; grid-row: span 2; }
[data-theme="coffre"] .case.grande .numero { font-size: clamp(64px, 20vw, 104px); font-style: italic; }
[data-theme="coffre"] .case.grande .porte::after {
  display: block; content: "Le grand jour"; background: none; box-shadow: none; width: auto; height: auto; margin: 0;
  top: auto; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255, 231, 181, 0.75); border: none;
  font: 600 10px/1 var(--police-texte); letter-spacing: 0.28em; text-transform: uppercase;
}
[data-theme="coffre"] .case.large .numero { font-size: clamp(36px, 11vw, 52px); }
[data-theme="coffre"] .case .cadenas { display: none; }
[data-theme="coffre"] .case.verrouillee .porte { filter: none; opacity: 0.55; }
[data-theme="coffre"] .case.verrouillee .porte .numero { color: rgba(201, 207, 235, 0.65); }
[data-theme="coffre"] .case.verrouillee .porte::after {
  display: block; content: "❄"; background: none; box-shadow: none; width: auto; height: auto;
  top: auto; bottom: 8px; right: 10px; margin: 0; font-size: 11px; color: rgba(201, 207, 235, 0.5);
}

/* Disponible : la fenêtre s'allume, chaude comme une maison la nuit de Noël. */
[data-theme="coffre"] .case.disponible .porte {
  background:
    var(--grain),
    radial-gradient(circle at 50% 120%, rgba(255, 170, 80, 0.38), rgba(255, 140, 60, 0.08) 55%, transparent 75%),
    linear-gradient(160deg, #2a3366, #151b40);
  border: 1px solid rgba(255, 214, 150, 0.45);
  animation: coffre-respire 3.2s ease-in-out infinite;
}
[data-theme="coffre"] .case.disponible .numero { color: var(--or-clair); text-shadow: 0 0 18px rgba(255, 200, 120, 0.7); }
@keyframes coffre-respire {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 170, 80, 0), 0 10px 26px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 0 18px rgba(255, 170, 80, 0.3), 0 10px 26px rgba(0, 0, 0, 0.35); }
}
[data-theme="coffre"] .case.aujourdhui::before {
  content: "Aujourd’hui";
  position: absolute; z-index: 3; top: -9px; left: 50%; transform: translateX(-50%);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(90deg, #ffd38a, #f2a65a); color: #2a1408;
  font: 700 10px/1.6 var(--police-texte); letter-spacing: 0.04em; text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(255, 170, 80, 0.5);
}

/* Derrière la porte : velours et lettre dorée. */
[data-theme="coffre"] .case .interieur {
  background: radial-gradient(circle at 50% 35%, #7a1e33 0%, #3b0c1b 70%, #24060f 100%);
  color: var(--or-clair);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.55);
}
[data-theme="coffre"] .case .flocon-case { font-family: var(--police-titre); font-weight: 600; color: var(--or-clair); text-shadow: 0 0 14px rgba(255, 200, 120, 0.8); }
[data-theme="coffre"] .case .points-case { color: rgba(255, 231, 181, 0.8); }
[data-theme="coffre"] .case.ouverte .porte { transform: rotateY(-34deg); }

/* Fenêtres et boutons du jeu. */
[data-theme="coffre"] .fenetre { border-radius: 24px; background: linear-gradient(180deg, #151d44, #0b1130); border: 1px solid rgba(255, 231, 181, 0.16); }
[data-theme="coffre"] .btn { border-radius: 999px; font-weight: 700; }
[data-theme="coffre"] .btn.plein, [data-theme="coffre"] .btn:not(.secondaire) { background: linear-gradient(90deg, #ffd38a, #f2a65a); color: #2a1408; border-color: transparent; }

/* ============================================================ ouverture « waouh » (tous thèmes) */

.wahoo { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: grid; place-items: center; }
.wahoo-voile { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(20, 12, 30, 0.55), rgba(3, 5, 14, 0.94)); opacity: 0; transition: opacity 0.45s ease; }
.wahoo.actif .wahoo-voile { opacity: 1; }
.wahoo-rayons {
  position: absolute; width: 160vmax; height: 160vmax; left: 50%; top: 45%; margin: -80vmax 0 0 -80vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 140, 0.16) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 55%); mask: radial-gradient(circle, #000 0, transparent 55%);
  opacity: 0; transform: scale(0.4) rotate(0deg);
}
.wahoo.eclat .wahoo-rayons { opacity: 1; transform: scale(1) rotate(40deg); transition: opacity 0.4s ease, transform 2.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.wahoo-coffret { position: fixed; z-index: 2; perspective: 900px; transform-origin: center; }
.wahoo-coffret .battant {
  position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden;
  background: inherit; border: 1px solid rgba(255, 214, 150, 0.55);
  transition: transform 0.9s cubic-bezier(0.5, 0, 0.15, 1);
  backface-visibility: hidden;
}
.wahoo-coffret .battant.g { left: 0; border-radius: 22px 0 0 22px; transform-origin: left center; border-right: none; }
.wahoo-coffret .battant.d { right: 0; border-radius: 0 22px 22px 0; transform-origin: right center; border-left: none; }
.wahoo-coffret .battant::after { content: ""; position: absolute; top: 0; bottom: 0; width: 6px; background: linear-gradient(180deg, #ffe7b5, #c9923f); }
.wahoo-coffret .battant.g::after { right: 0; }
.wahoo-coffret .battant.d::after { left: 0; }
.wahoo-coffret .noeud {
  position: absolute; z-index: 2; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff4d6, #f2c879 45%, #a9722a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 30px rgba(255, 200, 120, 0.6);
  display: grid; place-items: center; color: #3a1c06; font: 600 clamp(30px, 9vw, 46px)/1 "Fraunces", Georgia, serif;
  transition: transform 0.5s cubic-bezier(0.5, 0, 0.2, 1), opacity 0.4s ease;
}
.wahoo-coffret .lumiere {
  position: absolute; inset: 8%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, #fff 0%, #ffe3a6 30%, rgba(255, 170, 80, 0.6) 55%, transparent 72%);
  opacity: 0; transform: scale(0.3);
}
.wahoo.ouvre .battant.g { transform: rotateY(-118deg); }
.wahoo.ouvre .battant.d { transform: rotateY(118deg); }
.wahoo.ouvre .noeud { transform: translate(-50%, -50%) scale(0); opacity: 0; }
.wahoo.ouvre .lumiere { opacity: 1; transform: scale(2.6); transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease; }
.wahoo.tremble .wahoo-coffret { animation: wahoo-tremble 0.5s ease-in-out; }
@keyframes wahoo-tremble {
  0%, 100% { rotate: 0deg; } 20% { rotate: -4deg; } 40% { rotate: 4deg; } 60% { rotate: -3deg; } 80% { rotate: 2deg; }
}
.wahoo-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(255, 246, 220, 0.95), rgba(255, 200, 120, 0.35) 35%, transparent 70%); opacity: 0; }
.wahoo.eclat .wahoo-flash { animation: wahoo-flash 1s ease-out forwards; }
@keyframes wahoo-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.wahoo-texte { position: absolute; z-index: 3; top: 45%; left: 0; right: 0; text-align: center; transform: translateY(-50%); opacity: 0; color: #fff4dc; }
.wahoo-texte small { display: block; font: 600 13px/1 "Manrope", system-ui, sans-serif; letter-spacing: 0.32em; text-transform: uppercase; color: #ffd38a; margin-bottom: 10px; }
.wahoo-texte b { display: block; font: 300 italic clamp(96px, 34vw, 160px)/0.9 "Fraunces", Georgia, serif; letter-spacing: -0.04em; text-shadow: 0 0 40px rgba(255, 190, 110, 0.85), 0 0 90px rgba(255, 150, 70, 0.5); }
.wahoo-texte span { display: block; margin-top: 14px; font: 500 16px/1.3 "Manrope", system-ui, sans-serif; color: #e9dcc6; }
.wahoo.revele .wahoo-texte { animation: wahoo-texte 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes wahoo-texte { 0% { opacity: 0; transform: translateY(-50%) scale(0.6); filter: blur(8px); } 100% { opacity: 1; transform: translateY(-50%) scale(1); filter: blur(0); } }
.wahoo.fin { transition: opacity 0.5s ease; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .wahoo * { transition: none !important; animation: none !important; } }
.wahoo.revele .lumiere { opacity: 0.3; transition: opacity 0.9s ease, transform 0.9s ease; }
.wahoo.revele .wahoo-flash { opacity: 0; }
.wahoo-coffret .battant::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; background: linear-gradient(90deg, #c9923f, #ffe7b5, #c9923f); }

/* Texture et mélange (inspiration de Gilles) : grain de papier sur les portes, le 24 en velours bordeaux. */
:root[data-theme="coffre"] {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
[data-theme="coffre"] body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.6; background: var(--grain);
}
[data-theme="coffre"] .case.grande .porte {
  background:
    var(--grain),
    radial-gradient(circle at 50% 40%, rgba(255, 190, 120, 0.22), transparent 60%),
    linear-gradient(160deg, #7a1e33, #3b0c1b);
  border: 1px solid rgba(255, 214, 150, 0.5);
}
[data-theme="coffre"] .case.grande .porte::before { inset: 9px; border-color: rgba(242, 200, 121, 0.45); border-radius: 14px; }
[data-theme="coffre"] .case.grande .numero { color: var(--or-clair); text-shadow: 0 0 24px rgba(255, 190, 110, 0.5); }
[data-theme="coffre"] .case.verrouillee.grande .porte { opacity: 0.85; }
[data-theme="coffre"] .case.verrouillee.grande .porte::after { content: "Le grand jour"; font-size: 10px; bottom: 18px; right: 0; color: rgba(255, 231, 181, 0.7); }
[data-theme="coffre"] .case .interieur { background-image: var(--grain), radial-gradient(circle at 50% 35%, #7a1e33 0%, #3b0c1b 70%, #24060f 100%); }
/* Plus de « soleil » plein écran à l'ouverture. */
.wahoo-rayons { display: none; }
.wahoo.ouvre .lumiere { transform: scale(1.6); }
.wahoo-flash { background: radial-gradient(circle at 50% 45%, rgba(255, 246, 220, 0.75), rgba(255, 200, 120, 0.15) 25%, transparent 45%); }
.wahoo-coffret .lumiere { inset: 30%; background: radial-gradient(circle, rgba(255, 245, 220, 0.9) 0%, rgba(255, 210, 140, 0.35) 40%, transparent 70%); }
.wahoo.ouvre .lumiere { opacity: 0.8; transform: scale(1.3); }
.wahoo.revele .lumiere { opacity: 0; }
.wahoo.eclat .wahoo-flash { animation-duration: 0.6s; }
/* Case encore fermée : on ne voit pas l'intérieur à travers la porte givrée. */
[data-theme="coffre"] .case.verrouillee .interieur { visibility: hidden; }

/* Téléphone d'abord : en-tête compact pour que les 24 cases tiennent sur un écran (iPhone 14 Pro Max). */
[data-theme="coffre"] .page { padding: max(10px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)); }
[data-theme="coffre"] .entete { margin-bottom: 0; }
[data-theme="coffre"] .titre { font-size: clamp(30px, 9vw, 42px); margin: 6px 0 2px; }
[data-theme="coffre"] .sous-titre { font-size: 13px; margin-bottom: 10px; }
[data-theme="coffre"] .bandeau { padding: 8px 14px; margin: 0 0 14px; font-size: 14px; }
[data-theme="coffre"] .calendrier { gap: 10px; }
[data-theme="coffre"] .case .numero { font-size: clamp(26px, 7.6vw, 36px); }
[data-theme="coffre"] .case .porte::before { inset: 5px; border-radius: 11px; }
[data-theme="coffre"] .case.aujourdhui::before { top: -8px; font-size: 9px; padding: 1px 8px; }

/* Explication « ajouter à l'écran d'accueil » (première visite). */
.raccourci { position: fixed; inset: 0; z-index: 70; display: grid; place-items: end center; background: rgba(3, 5, 14, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: raccourci-fondu 0.3s ease; }
.raccourci .feuille {
  width: min(100%, 480px); margin: 0 10px max(10px, env(safe-area-inset-bottom)); padding: 22px 20px 18px; border-radius: 26px;
  background: linear-gradient(180deg, #19214c, #0d1333); border: 1px solid rgba(255, 231, 181, 0.22); color: #f3ead9;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); animation: raccourci-monte 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.raccourci h2 { margin: 0 0 6px; font: 400 italic 26px/1.1 var(--police-titre, Georgia), serif; color: #ffe7b5; }
.raccourci p { margin: 0 0 12px; font-size: 15px; line-height: 1.4; color: #d9d0c0; }
.raccourci ol { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: e; }
.raccourci li { counter-increment: e; display: flex; gap: 12px; align-items: center; padding: 8px 0; font-size: 15px; line-height: 1.35; }
.raccourci li::before { content: counter(e); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(90deg, #ffd38a, #f2a65a); color: #2a1408; font-weight: 800; font-size: 13px; }
.raccourci .pictos { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: rgba(255, 255, 255, 0.1); vertical-align: middle; margin: 0 2px; }
.raccourci .pictos svg { width: 16px; height: 16px; stroke: #9fc4ff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.raccourci .actions { display: flex; gap: 10px; }
.raccourci .actions .btn { flex: 1; }
@keyframes raccourci-fondu { from { opacity: 0; } }
@keyframes raccourci-monte { from { transform: translateY(40px); opacity: 0; } }

/* En-tête du Coffre : nom doré en deux temps, petites étoiles qui scintillent, mot personnel. */
[data-theme="coffre"] .titre { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 4px 0 6px; text-shadow: none; }
[data-theme="coffre"] .titre .mot {
  font-size: clamp(38px, 11.5vw, 54px); line-height: 0.95; padding: 0 0.08em 0.08em;
  background: linear-gradient(100deg, #c9923f 0%, #ffe7b5 30%, #fff6e2 42%, #f2c879 55%, #b07a2e 80%, #ffe7b5 100%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 190, 110, 0.35));
  animation: coffre-reflet 7s ease-in-out infinite;
}
@keyframes coffre-reflet { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }
[data-theme="coffre"] .titre .suite {
  display: flex; align-items: center; gap: 10px; width: min(78%, 300px);
  font: 700 11px/1 var(--police-texte); font-style: normal; letter-spacing: 0.42em; text-transform: uppercase; color: rgba(255, 220, 160, 0.85);
}
[data-theme="coffre"] .titre .suite::before, [data-theme="coffre"] .titre .suite::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(242, 200, 121, 0.7)); }
[data-theme="coffre"] .titre .suite::after { background: linear-gradient(90deg, rgba(242, 200, 121, 0.7), transparent); }
[data-theme="coffre"] .titre .suite span { margin-right: -0.42em; }
[data-theme="coffre"] .titre::before, [data-theme="coffre"] .titre::after {
  content: "✦"; position: absolute; color: #ffe7b5; font-size: 12px; text-shadow: 0 0 10px rgba(255, 210, 140, 0.9);
  animation: coffre-scintille 2.6s ease-in-out infinite;
}
[data-theme="coffre"] .titre::before { left: 9%; top: 4px; }
[data-theme="coffre"] .titre::after { right: 10%; top: 26px; font-size: 9px; animation-delay: 1.3s; }
@keyframes coffre-scintille { 0%, 100% { opacity: 0.2; transform: scale(0.6) rotate(0deg); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }
[data-theme="coffre"] .sous-titre { font-size: 13px; color: rgba(233, 220, 198, 0.75); margin-bottom: 12px; }
[data-theme="coffre"] .sous-titre .salut { color: #ffe7b5; font-weight: 700; }
[data-theme="coffre"] #btn-joueuse { font-size: 14px; }
@media (prefers-reduced-motion: reduce) { [data-theme="coffre"] .titre .mot, [data-theme="coffre"] .titre::before, [data-theme="coffre"] .titre::after { animation: none; } }
