/* ===== Couleurs et polices (change-les ici pour tout le site) ===== */
:root {
  --nuit: #0f1b33;
  --nuit-2: #1a2b4d;
  --bordeaux: #8e1f35;
  --rouge: #c9314b;
  --or: #e9c46a;
  --or-clair: #f6e3a8;
  --creme: #fbf5ea;
  --rose: #e8a6b4;
  --sapin: #1f5a4a;
  --texte: #2b2233;
  --script: "Great Vibes", cursive;
  --titre: "Playfair Display", Georgia, serif;
  --corps: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--corps);
  color: var(--creme);
  background:
    radial-gradient(ellipse at 50% -10%, #2c4677 0%, transparent 60%),
    radial-gradient(ellipse at 90% 110%, #3a1530 0%, transparent 55%),
    var(--nuit);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: inherit; }
.cache { display: none !important; }
.invisible { visibility: hidden; }

canvas.neige {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
canvas.confettis {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 50;
}
main, section, header, nav, .retour { position: relative; z-index: 1; }

.titre-script {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  color: var(--or-clair);
  margin: 0;
  text-shadow: 0 0 18px rgba(233, 196, 106, .45);
}

/* ===================== ACCUEIL : INTRO ===================== */
.intro {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 16px;
}
.intro-pour { font-family: var(--titre); letter-spacing: .25em; text-transform: uppercase; font-size: .85rem; opacity: .8; margin: 0; animation: monte 1s both; }
.intro-prenom { font-family: var(--script); font-weight: 400; font-size: clamp(3rem, 13vw, 5.5rem); color: var(--or-clair); margin: 4px 0 36px; animation: monte 1s .3s both; text-shadow: 0 0 24px rgba(233,196,106,.5); }
.intro-aide { margin-top: 28px; opacity: .7; animation: respire 2.4s ease-in-out infinite; }

.enveloppe {
  --l: min(78vw, 320px);
  position: relative; width: var(--l); height: calc(var(--l) * .64);
  border: 0; padding: 0; background: none; cursor: pointer;
  animation: monte 1s .6s both, flotte 4s 1.6s ease-in-out infinite;
  perspective: 900px;
}
.enveloppe-fond, .enveloppe-poche, .enveloppe-rabat, .enveloppe-lettre { position: absolute; left: 0; width: 100%; }
.enveloppe-fond { inset: 0; background: #b52b43; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.enveloppe-lettre {
  left: 6%; width: 88%; top: 8%; height: 84%;
  background: var(--creme); border-radius: 4px;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 14%;
  transition: transform 1.1s cubic-bezier(.3,1.4,.5,1) .5s;
  z-index: 1;
}
.lettre-texte { opacity: 0; transition: opacity .6s .9s; font-family: var(--script); color: var(--bordeaux); font-size: clamp(1.4rem, 6vw, 2rem); }
.enveloppe-poche {
  inset: 0; z-index: 2; border-radius: 6px;
  background:
    linear-gradient(to top right, #c9314b 50%, transparent 50.5%) left / 50.5% 100% no-repeat,
    linear-gradient(to top left, #c9314b 50%, transparent 50.5%) right / 50.5% 100% no-repeat;
}
.enveloppe-rabat {
  top: 0; height: 58%; z-index: 3;
  background: #a8253c;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform .8s ease, z-index 0s .4s;
}
.sceau {
  position: absolute; left: 50%; top: 50%; z-index: 4;
  width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e3a8, #c9a24a 70%);
  color: var(--bordeaux); font-size: 26px; line-height: 54px;
  box-shadow: 0 3px 8px rgba(0,0,0,.35);
  transition: transform .5s, opacity .5s;
}
.enveloppe.ouverte { animation: none; }
.enveloppe.ouverte .sceau { transform: scale(0) rotate(180deg); opacity: 0; }
.enveloppe.ouverte .enveloppe-rabat { transform: rotateX(180deg); z-index: 0; }
.enveloppe.ouverte .lettre-texte { opacity: 1; }
.enveloppe.ouverte .enveloppe-lettre { transform: translateY(-62%); }

/* ===================== ACCUEIL : LE CADRE ===================== */
.cadre-zone { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; text-align: center; }
.cadre-zone.apparition { animation: zoomDoux 1.2s cubic-bezier(.2,.8,.2,1) both; }
.entete { margin-bottom: 26px; }
.surtitre { font-family: var(--titre); text-transform: uppercase; letter-spacing: .3em; font-size: .8rem; opacity: .75; margin: 0 0 6px; }
.sous-titre { margin: 8px 0 0; opacity: .8; }

.cadre { position: relative; }
.cadre-bord {
  padding: clamp(12px, 3vw, 22px);
  border-radius: 18px;
  background:
    linear-gradient(135deg, #f6e3a8, #b88a2e 25%, #f6e3a8 50%, #b88a2e 75%, #f6e3a8);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 0 0 3px rgba(255,255,255,.25);
}
.grille {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 1.8vw, 12px);
  padding: clamp(10px, 2.5vw, 18px);
  border-radius: 10px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.06), transparent 40%),
    var(--bordeaux);
  box-shadow: inset 0 0 30px rgba(0,0,0,.45);
}
@media (min-width: 620px) { .grille { grid-template-columns: repeat(6, 1fr); } }

.case {
  position: relative; aspect-ratio: 1; text-decoration: none;
  perspective: 700px;
  animation: monte .6s calc(var(--i) * 45ms + .3s) both;
}
.case.grande .porte { background: linear-gradient(145deg, #f6e3a8, #c9a24a) !important; }
.case.grande .porte-num { color: var(--bordeaux); text-shadow: none; }
.case.grande .porte-num::after { content: " ★"; }
.case-interieur {
  position: absolute; inset: 0; border-radius: 8px;
  background: radial-gradient(circle, #fff7e0, #f0d98f);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 12px rgba(0,0,0,.25);
}
.case-emoji { font-size: clamp(1.4rem, 5vw, 2.1rem); }
.porte {
  position: absolute; inset: 0; border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.12), transparent 55%),
    var(--sapin);
  border: 2px solid rgba(246,227,168,.55);
  display: flex; align-items: center; justify-content: center;
  transform-origin: left center;
  transition: transform .75s cubic-bezier(.4,.1,.3,1), box-shadow .3s;
  backface-visibility: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,.3);
}
.case:nth-child(3n+2) .porte { background: linear-gradient(145deg, rgba(255,255,255,.12), transparent 55%), #23365e; }
.case:nth-child(3n) .porte { background: linear-gradient(145deg, rgba(255,255,255,.14), transparent 55%), #a3283f; }
.porte-num { font-family: var(--titre); font-weight: 700; font-size: clamp(1.1rem, 4.6vw, 1.7rem); color: var(--or-clair); text-shadow: 0 1px 2px rgba(0,0,0,.4); }

.case:not(.dispo) .porte { filter: saturate(.55) brightness(.8); }
.case:not(.dispo) .porte::after { content: "🔒"; position: absolute; right: 4px; bottom: 2px; font-size: .7rem; opacity: .7; }
.case.dispo .porte { animation: brille 2.6s ease-in-out infinite; }
.case.dispo:hover .porte { transform: rotateY(-22deg); }
.case.deja-ouverte .porte { transform: rotateY(-70deg); animation: none; }
.case.deja-ouverte:hover .porte { transform: rotateY(-80deg); }
.case.ouvre .porte { transform: rotateY(-105deg); }
.case.secoue { animation: secoue .45s; }

.guirlande {
  position: absolute; left: 4%; right: 4%; top: -14px; height: 28px; pointer-events: none;
  background: radial-gradient(circle, #ffd76a 3px, transparent 4px) 0 50% / 28px 28px repeat-x;
  filter: drop-shadow(0 0 6px #ffd76a);
  animation: clignote 1.6s steps(2) infinite;
}
.pied { margin-top: 26px; font-family: var(--script); font-size: 1.7rem; color: var(--or-clair); }

.bulle {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px);
  background: var(--creme); color: var(--bordeaux); font-weight: 700;
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 0; transition: .35s; z-index: 60; max-width: calc(100% - 32px); text-align: center;
}
.bulle.visible { opacity: 1; transform: translate(-50%, 0); }

/* ===================== PAGE D'UN JOUR ===================== */
.retour {
  display: inline-block; margin: 16px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.1); text-decoration: none; font-weight: 600; font-size: .9rem;
  backdrop-filter: blur(6px);
}
.jour { max-width: 640px; margin: 0 auto; padding: 8px 16px 56px; }
.jour-entete { text-align: center; margin-bottom: 22px; }
.jour-badge {
  display: inline-flex; flex-direction: column; align-items: center;
  background: var(--creme); color: var(--bordeaux); border-radius: 14px;
  padding: 8px 18px 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: tombe .9s cubic-bezier(.3,1.5,.5,1) both;
}
.jour-num { font-family: var(--titre); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.jour-mois { text-transform: uppercase; letter-spacing: .2em; font-size: .7rem; font-weight: 700; }
.jour-emoji { font-size: 3.4rem; margin: 18px 0 4px; animation: monte .8s .3s both, flotte 4s 1.2s ease-in-out infinite; }
.jour-titre { font-family: var(--titre); font-size: clamp(1.7rem, 6vw, 2.4rem); margin: 0; color: var(--or-clair); animation: monte .8s .45s both; }

.carte {
  background: var(--creme); color: var(--texte); border-radius: 16px;
  padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.explication { margin: 0; font-size: 1.08rem; line-height: 1.6; }
.petit-titre { font-family: var(--titre); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .15em; margin: 0 0 10px; color: var(--rouge); }
.mot { background: #fffaf0 repeating-linear-gradient(transparent 0 31px, rgba(201,49,75,.15) 31px 32px); }
.mot-texte { font-family: var(--script); font-size: 1.9rem; line-height: 32px; margin: 0; color: #3b2a4a; white-space: pre-line; }
.mot-signature { text-align: right; font-family: var(--script); font-size: 1.6rem; color: var(--rouge); margin: 6px 0 0; }

.apparait { animation: monte .8s calc(var(--d) * .18s + .5s) both; }

.galerie { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin: 26px 0; }
.polaroid {
  margin: 0; background: #fff; padding: 10px 10px 8px; border-radius: 3px;
  width: min(100%, 270px); transform: rotate(var(--r));
  box-shadow: 0 14px 34px rgba(0,0,0,.45); transition: transform .3s;
}
.polaroid:hover { transform: rotate(0) scale(1.03); }
.polaroid img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.polaroid figcaption { font-family: var(--script); color: #333; font-size: 1.4rem; text-align: center; padding-top: 6px; }
.photo-vide { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: #eee; color: #999; font-size: .9rem; }
.zoom { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; animation: fondu .3s; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 6px; }

.surprise-zone { text-align: center; margin: 34px 0 10px; }
.surprise-zone .petit-titre { color: var(--or-clair); }
.aide { opacity: .75; animation: respire 2.4s ease-in-out infinite; }

/* Le paquet cadeau */
.paquet {
  position: relative; width: 150px; height: 150px; margin: 16px auto 4px; display: block;
  border: 0; background: none; cursor: pointer; padding: 0;
  animation: sautille 2.2s ease-in-out infinite;
}
.paquet-boite {
  position: absolute; left: 12px; right: 12px; bottom: 0; height: 96px; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 43%, var(--or) 43% 57%, transparent 57%),
    linear-gradient(160deg, #d33a55, #8e1f35);
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.paquet-couvercle {
  position: absolute; left: 4px; right: 4px; top: 30px; height: 30px; border-radius: 5px; z-index: 2;
  background:
    linear-gradient(90deg, transparent 43%, var(--or) 43% 57%, transparent 57%),
    linear-gradient(160deg, #e2486a, #a3283f);
  box-shadow: 0 4px 10px rgba(0,0,0,.3);
  transition: transform .8s cubic-bezier(.3,1.3,.5,1), opacity .8s;
}
.noeud { position: absolute; left: 50%; top: -24px; width: 0; height: 0; }
.noeud::before, .noeud::after {
  content: ""; position: absolute; width: 34px; height: 26px; top: 0;
  border: 7px solid var(--or); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.noeud::before { right: 0; transform: rotate(-20deg); }
.noeud::after { left: 0; transform: rotate(20deg); }
.paquet-lueur {
  position: absolute; left: 50%; top: 55%; width: 10px; height: 10px; border-radius: 50%;
  background: #fff6c8; box-shadow: 0 0 0 0 rgba(255,240,180,.9);
  opacity: 0; transform: translate(-50%, -50%);
}
.paquet.attend-code { animation: none; }
.paquet.ouvert { animation: none; }
.paquet.ouvert .paquet-couvercle { transform: translate(40px, -90px) rotate(35deg); opacity: 0; }
.paquet.ouvert .paquet-lueur { animation: eclat 1s ease-out forwards; }

.code-zone { max-width: 340px; margin: 10px auto; }
.code-zone label { display: block; margin-bottom: 8px; }
.code-ligne { display: flex; gap: 8px; }
.code-ligne input { flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--or); background: var(--creme); color: var(--texte); text-transform: uppercase; letter-spacing: .1em; }
.code-ligne button { font: inherit; font-weight: 700; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--or); color: var(--bordeaux); cursor: pointer; }
.code-erreur { color: var(--rose); min-height: 1.4em; }
.code-zone.secoue { animation: secoue .45s; }

/* Le ticket révélé */
.surprise { animation: deplie .9s cubic-bezier(.3,1.3,.5,1) both; }
.ticket {
  position: relative; margin: 10px auto 0; max-width: 460px;
  background: linear-gradient(135deg, #fff9e6, #f6e3a8);
  color: var(--texte); padding: 30px 24px 24px; border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 40px rgba(233,196,106,.35);
  border: 2px dashed rgba(142,31,53,.35);
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 26px; height: 26px; margin-top: -13px;
  border-radius: 50%; background: var(--nuit);
}
.ticket::before { left: -14px; }
.ticket::after { right: -14px; }
.ticket-tampon {
  position: absolute; top: -14px; right: 18px; transform: rotate(8deg);
  background: var(--rouge); color: #fff; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; font-size: .75rem; padding: 6px 12px; border-radius: 6px;
  animation: tampon .6s .5s both;
}
.ticket-titre { font-family: var(--titre); font-size: 1.6rem; margin: 0 0 10px; color: var(--bordeaux); }
.ticket-texte { margin: 0; line-height: 1.6; font-size: 1.05rem; }
.ticket-indice { margin: 14px 0 0; font-style: italic; color: var(--sapin); font-weight: 600; }

.navigation { display: flex; justify-content: space-between; margin-top: 40px; gap: 12px; }
.nav-lien { text-decoration: none; padding: 10px 16px; border-radius: 999px; background: rgba(255,255,255,.1); font-weight: 600; font-size: .9rem; }

/* Verrou */
.verrou { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; }
.cadenas { font-size: 4rem; animation: secoue 1s 1s, flotte 4s ease-in-out infinite; }
.compte { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.compte span { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; min-width: 70px; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.compte b { display: block; font-family: var(--titre); font-size: 1.8rem; letter-spacing: 0; color: var(--or-clair); }

/* ===================== ANIMATIONS ===================== */
@keyframes monte { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes flotte { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes respire { 0%,100% { opacity: .45; } 50% { opacity: .9; } }
@keyframes zoomDoux { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes brille { 0%,100% { box-shadow: 0 3px 8px rgba(0,0,0,.3); } 50% { box-shadow: 0 0 16px 2px rgba(246,227,168,.7); } }
@keyframes secoue { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
@keyframes clignote { to { opacity: .55; } }
@keyframes tombe { from { opacity: 0; transform: translateY(-60px) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes sautille { 0%,100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-6px) rotate(-3deg); } 75% { transform: translateY(-6px) rotate(3deg); } }
@keyframes eclat { 0% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,240,180,.9); } 100% { opacity: 0; box-shadow: 0 0 0 120px rgba(255,240,180,0); } }
@keyframes deplie { from { opacity: 0; transform: scale(.6) translateY(-30px); } to { opacity: 1; transform: none; } }
@keyframes tampon { from { opacity: 0; transform: rotate(8deg) scale(2.4); } to { opacity: 1; transform: rotate(8deg) scale(1); } }
@keyframes fondu { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===================== OUVERTURE DU CADEAU (avant la page) ===================== */
body.bloque { overflow: hidden; }
.ouverture {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
  transition: opacity .8s ease, transform .8s ease;
}
.ouverture.disparait { opacity: 0; transform: scale(1.15); pointer-events: none; }
.ouverture-jour {
  font-family: var(--script); font-size: clamp(2.4rem, 10vw, 3.6rem); color: var(--or-clair);
  margin: 0 0 40px; text-shadow: 0 0 20px rgba(233,196,106,.5);
  animation: monte 1s both;
}
.paquet.grand { transform: scale(1.6); margin: 30px auto 60px; animation: sautille 2.2s ease-in-out infinite, monte .9s .2s both; }
.paquet.grand.tremble { animation: tremble .9s ease-in both; }
.paquet.grand.ouvert { animation: gonfle .6s ease-out forwards; }
.paquet.grand.ouvert .paquet-couvercle { transform: translate(60px, -160px) rotate(50deg); opacity: 0; }
.paquet.grand.ouvert .paquet-boite { transition: opacity .5s .15s; opacity: 0; }
.eclair {
  position: fixed; inset: 0; z-index: 45; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fff9e0 0%, rgba(246,227,168,.85) 25%, rgba(246,227,168,0) 70%);
}
.eclair.flash { animation: flash 1.2s ease-out forwards; }

@keyframes tremble {
  0% { transform: scale(1.6) rotate(0); }
  15% { transform: scale(1.6) rotate(-6deg); }
  30% { transform: scale(1.65) rotate(6deg); }
  45% { transform: scale(1.7) rotate(-8deg); }
  60% { transform: scale(1.75) rotate(8deg); }
  75% { transform: scale(1.8) rotate(-10deg); }
  100% { transform: scale(1.9) rotate(0); }
}
@keyframes gonfle { to { transform: scale(2.6); opacity: 0; } }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* ===================== MINI-JEU ===================== */
.jeu {
  position: relative; max-width: 460px; margin: 10px auto 0; height: min(64vh, 480px);
  border-radius: 18px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #2c4677, #12203d 70%);
  border: 2px solid rgba(246,227,168,.5);
  box-shadow: 0 18px 50px rgba(0,0,0,.45), inset 0 0 40px rgba(0,0,0,.35);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.jeu-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.jeu-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; padding: 10px 14px;
  font-weight: 700; color: var(--or-clair); pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.35), transparent);
}
.jeu-hud b { font-family: var(--titre); font-size: 1.2rem; }
.jeu-ecran {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15,27,51,.78); backdrop-filter: blur(3px);
  animation: fondu .4s;
}
.jeu-titre { font-family: var(--script); font-weight: 400; font-size: 2.4rem; color: var(--or-clair); margin: 0 0 8px; }
.jeu-regles { margin: 0 0 18px; line-height: 1.5; opacity: .9; }
.jeu-bouton {
  font: inherit; font-weight: 700; font-size: 1.1rem; padding: 12px 34px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #f6e3a8, #c9a24a); color: var(--bordeaux); cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.35); animation: respire 2.4s ease-in-out infinite;
}

/* ===================== COMPTEUR DE JOURS ===================== */
.special { margin: 26px 0; }
.compteur {
  text-align: center; padding: 26px 18px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(142,31,53,.85), rgba(26,43,77,.9));
  border: 2px solid rgba(246,227,168,.45); box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.compteur-titre { font-family: var(--script); font-size: 2rem; color: var(--or-clair); margin: 0 0 8px; }
.compteur-grand b {
  display: block; font-family: var(--titre); font-size: clamp(3.6rem, 18vw, 5.5rem); line-height: 1.05;
  color: var(--or-clair); text-shadow: 0 0 24px rgba(233,196,106,.55);
}
.compteur-grand span { text-transform: uppercase; letter-spacing: .3em; font-size: .85rem; font-weight: 700; }
.compteur-detail { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0 14px; }
.compteur-detail span { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.compteur-detail b { display: block; font-family: var(--titre); font-size: 1.35rem; letter-spacing: 0; color: var(--creme); }
.compteur-pied { margin: 0; opacity: .85; }

/* ===================== LETTRE ANIMÉE ===================== */
.lettre-anim { display: flex; flex-direction: column; align-items: center; text-align: center; }
.lettre-anim .enveloppe { margin-top: 10px; }
.papier {
  width: 100%; max-width: 520px; text-align: left; color: #3b2a4a;
  background: #fffaf0 repeating-linear-gradient(transparent 0 35px, rgba(201,49,75,.13) 35px 36px);
  border-radius: 6px; padding: 26px 24px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.45);
  transform-origin: top; animation: deplieLettre 1s cubic-bezier(.3,1.2,.5,1) both;
}
.papier-texte { font-family: var(--script); font-size: 1.85rem; line-height: 36px; margin: 0; white-space: pre-line; min-height: 72px; }
.papier-signature { font-family: var(--script); font-size: 2rem; color: var(--rouge); text-align: right; margin: 10px 0 0; opacity: 0; }
.papier-signature.signe { animation: monte .8s both; opacity: 1; }
.plume { display: inline-block; width: 2px; height: 1.1em; background: var(--rouge); margin-left: 2px; vertical-align: -0.15em; animation: clignote .6s steps(2) infinite; }
@keyframes deplieLettre { from { opacity: 0; transform: perspective(800px) rotateX(-80deg); } to { opacity: 1; transform: none; } }

/* ===================== LIEN VERS LA PAGE DU COMPTEUR ===================== */
.special { text-align: center; }
.bouton-special {
  display: inline-block; margin: 6px auto 0; padding: 14px 28px; border-radius: 999px;
  background: linear-gradient(135deg, #f6e3a8, #c9a24a); color: var(--bordeaux);
  font-weight: 700; font-size: 1.1rem; text-decoration: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.4); animation: brilleBouton 2.6s ease-in-out infinite;
}
.cadre-zone .bouton-special { margin-top: 28px; }
@keyframes brilleBouton { 0%,100% { box-shadow: 0 10px 26px rgba(0,0,0,.4); } 50% { box-shadow: 0 0 26px 4px rgba(246,227,168,.6); } }
.page-compteur .jour-entete .titre-script { margin-top: 6px; }
.page-compteur .compteur { text-align: center; }

/* ===================== LETTRE FÉERIQUE (lettres dorées + poudre magique) ===================== */
.papier-magique {
  position: relative; width: 100%; max-width: 520px; text-align: left;
  padding: 30px 24px 24px; border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(246,227,168,.14), transparent 60%),
    linear-gradient(160deg, #1d2c52, #121c38 60%, #2a1534);
  border: 1px solid rgba(246,227,168,.55);
  box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 40px rgba(233,196,106,.25), inset 0 0 30px rgba(246,227,168,.08);
  animation: apparitionMagique 1.2s ease both;
}
.papier-magique::before {
  content: ""; position: absolute; inset: 8px; border-radius: 10px; pointer-events: none;
  border: 1px solid rgba(246,227,168,.25);
}
.poudre { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.magie-texte {
  position: relative; z-index: 1; margin: 0;
  font-family: var(--script); font-size: 1.9rem; line-height: 1.35;
}
.magie-mot { white-space: nowrap; }
.magie-lettre { opacity: 0; color: #f3d27a; filter: blur(5px); }
.magie-lettre.visible { animation: lettreDoree 1.1s ease-out forwards; }
.magie-signature {
  position: relative; z-index: 1; text-align: right; margin: 14px 0 0;
  font-family: var(--script); font-size: 2.2rem; color: #f3d27a; opacity: 0;
  text-shadow: 0 0 12px rgba(255,215,120,.8);
}
.magie-signature.signe { animation: lettreDoree 1.6s ease-out forwards; }

@keyframes lettreDoree {
  0%   { opacity: 0; color: #fffbe8; filter: blur(5px); text-shadow: 0 0 18px #fff3c4, 0 0 30px rgba(255,215,120,.9); }
  40%  { opacity: 1; color: #fff3c4; filter: blur(0); text-shadow: 0 0 14px rgba(255,230,160,.95); }
  100% { opacity: 1; color: #f0c860; filter: blur(0); text-shadow: 0 0 6px rgba(255,205,100,.55), 0 1px 0 rgba(120,80,10,.4); }
}
@keyframes apparitionMagique { from { opacity: 0; transform: scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- Erreur réseau / badge aperçu ---------- */
.erreur-reseau {
  position: fixed; inset: auto 16px 24px 16px; z-index: 50; margin: 0 auto; max-width: 360px;
  background: rgba(20, 12, 30, .92); color: #fff; border: 1px solid rgba(244, 210, 122, .5);
  border-radius: 14px; padding: 14px 16px; text-align: center; font-family: Nunito, sans-serif;
}
.erreur-reseau p { margin: 0 0 10px; }
.erreur-reseau button {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 8px 18px;
  background: #f4d27a; color: #3a1d2b; cursor: pointer;
}
.badge-apercu {
  position: fixed; top: 10px; right: 10px; z-index: 40; margin: 0; padding: 4px 10px;
  border-radius: 999px; background: #c9314b; color: #fff; font: 700 12px Nunito, sans-serif; opacity: .85;
}
