/* ============================================================
   Habillage « Noël » : actif quand <body class="theme-noel">
   (le jeu en cours a theme: "noel" dans config/jeux.js).
   Pensé d'abord pour le téléphone : le bouton « Je tente ma chance »
   doit être visible sur le premier écran, même sur un petit iPhone.
   ============================================================ */

:root {
  --nuit-1: #0a1322;
  --nuit-2: #12223a;
  --nuit-3: #1a2533;
  --or: #e2b04a;
  --or-clair: #f6d98b;
  --or-fonce: #a87a22;
  --sapin: #173d2f;
  --sapin-2: #0f2c22;
  --neige: #f4f8fb;
  --papier-noel: #fffaf0;
}

/* ---------- Hors thème (jeu sans habillage) ---------- */
.ciel, .sapins, .compte, .roue-bloc, .hero .bouton-or { display: none; }
.titre-noel { font-family: var(--f-titre); font-weight: 200; font-size: clamp(30px, 8vw, 44px); text-transform: uppercase; margin: 0 0 12px; }
#etat-jeu .hero { background: var(--papier); border-radius: 14px 14px 0 0; padding: 24px 20px 4px; }
#etat-jeu .lettre { border-radius: 0 0 14px 14px; }
.bon-cadeau { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; background: var(--bleu-vert); border-radius: 12px; padding: 14px; margin: 0 0 18px; }
.bon-label { margin: 0; font-family: var(--f-cond); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--rouge); }
.bon-marque img { display: block; border-radius: 8px; }
.bon-reflet { display: none; }

/* ============================================================
   THÈME NOËL
   ============================================================ */
.theme-noel {
  background: linear-gradient(180deg, var(--nuit-1) 0%, var(--nuit-2) 50%, var(--nuit-3) 100%) fixed;
  overflow-x: hidden;
}
html:has(.theme-noel) { overflow-x: hidden; }

/* ---------- Ciel fixe ---------- */
.theme-noel .ciel { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.theme-noel .bandeau, .theme-noel main, .theme-noel .pied { position: relative; z-index: 1; }
#neige { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }

.etoiles span {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #fff; opacity: .8;
  animation: scintille 3s ease-in-out infinite;
}
.etoiles span.grosse { width: 3px; height: 3px; box-shadow: 0 0 6px 1px rgba(255, 240, 200, .7); }
@keyframes scintille { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* Illustration de la scène (traîneau devant la lune, sapins enneigés),
   en haut de l'écran, fondue dans la nuit. Si l'image manque, seul le ciel étoilé reste. */
/* Image carrée : le traîneau occupe ~17-38 % de sa hauteur. Sur téléphone, elle fait
   520 px de haut : le traîneau passe entre l'en-tête et le titre, le titre se pose
   sur un dégradé sombre au-dessus des montagnes. */
.scene {
  position: absolute; top: 0; left: 0; right: 0;
  height: 520px;
  background:
    linear-gradient(180deg, rgba(10, 19, 34, 0) 34%, rgba(10, 19, 34, .72) 52%, var(--nuit-1) 82%),
    url("/img/scene-noel.jpg") 62% 0 / auto 100% no-repeat;
  animation: respire 26s ease-in-out infinite alternate;
  transform-origin: 66% 26%;
}
@keyframes respire { from { transform: scale(1); } to { transform: scale(1.06); } }
@media (min-width: 700px) {
  .scene { height: min(92vh, 900px); background-size: auto, cover; background-position: 0 0, center 20%; }
}

/* ---------- En-tête compact sur téléphone ---------- */
.theme-noel .bandeau {
  background: linear-gradient(180deg, rgba(5, 10, 20, .55), transparent);
  padding: 8px 14px;
  gap: 10px;
}
.theme-noel .bandeau-logo img { width: 44px; height: 44px; border-radius: 6px; }
.theme-noel .bandeau-titre { font-size: 22px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.theme-noel .bandeau-titre span { font-size: 13px; }

/* ---------- Héros : tout ce qui compte tient sur le premier écran ---------- */
.theme-noel main { max-width: 560px; padding: 0 14px 28px; }
.theme-noel #etat-jeu .hero {
  background: transparent;
  color: var(--neige);
  text-align: center;
  padding: 128px 0 0;   /* laisse voir le traîneau et la lune */
}
.theme-noel .bienvenue {
  color: var(--or-clair); text-align: center; margin: 0 0 4px;
  font-size: 15px; text-shadow: 0 1px 6px rgba(0,0,0,.8);
}
.theme-noel .titre-noel {
  font-family: var(--f-manuscrit);
  font-weight: 400;
  text-transform: none;
  font-size: clamp(34px, 10vw, 56px);
  line-height: 1.02;
  margin: 0 0 14px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.75), 0 0 28px rgba(246, 217, 139, .35);
}

/* ---------- Carte cadeau (le lot) ---------- */
.theme-noel .bon-cadeau {
  position: relative;
  overflow: hidden;
  grid-template-columns: 74px 1fr;
  gap: 0;
  padding: 0;
  margin: 0 auto 16px;
  max-width: 440px;
  text-align: left;
  color: #fff;
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.14), transparent 55%),
    linear-gradient(135deg, #7d1a1e 0%, #b3282d 48%, #8f1f23 100%);
  box-shadow: 0 14px 34px rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(246, 217, 139, .9), inset 0 0 0 5px rgba(143, 31, 35, 1), inset 0 0 0 6px rgba(246, 217, 139, .45);
}
/* Talon de la carte, séparé par un pointillé prédécoupé */
.theme-noel .bon-marque {
  align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.18);
  border-right: 2px dashed rgba(246, 217, 139, .7);
  position: relative;
}
.theme-noel .bon-marque::before, .theme-noel .bon-marque::after { /* encoches */
  content: ""; position: absolute; right: -9px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--nuit-2);
}
.theme-noel .bon-marque::before { top: -8px; }
.theme-noel .bon-marque::after { bottom: -8px; }
.theme-noel .bon-marque img { width: 48px; height: 48px; border-radius: 6px; box-shadow: 0 0 0 1.5px var(--or); }
.theme-noel .bon-texte { padding: 12px 14px 12px 14px; }
.theme-noel .bon-label {
  color: var(--or-clair);
  font-size: 14px;
  letter-spacing: .22em;
  margin: 0 0 2px;
}
.theme-noel .bon-cadeau .lot-nom { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 700; color: #fff; }
.theme-noel .bon-cadeau .lot-detail { margin: 4px 0 0; font-size: 13px; line-height: 1.3; color: #f6e2e2; }
.theme-noel .bon-texte { padding: 10px 12px; }
/* Reflet doré qui passe sur la carte */
.theme-noel .bon-reflet {
  display: block; position: absolute; top: 0; bottom: 0; left: -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 240, 200, .35), transparent);
  transform: skewX(-18deg);
  animation: reflet 4.5s ease-in-out infinite;
}
@keyframes reflet { 0%, 55% { left: -40%; } 100% { left: 130%; } }

/* ---------- Bouton principal ---------- */
.theme-noel .hero .bouton-or { display: block; }
.bouton-or {
  margin: 0 auto 16px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  font-size: 23px;
  padding: 14px 24px;
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  color: #3a2608;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(226, 176, 74, .45), inset 0 -3px 0 var(--or-fonce);
  animation: pulse 2.4s ease-in-out infinite;
}
.bouton-or:hover { background: var(--or-clair); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }

/* ---------- Compte à rebours (sous le bouton) ---------- */
.theme-noel .compte { display: block; margin: 0 auto 10px; }
.compte[hidden] { display: none !important; }
.compte-titre { margin: 0 0 6px; font-family: var(--f-cond); letter-spacing: .15em; text-transform: uppercase; color: var(--or-clair); font-size: 13px; }
.compte-cases { display: flex; justify-content: center; gap: 8px; }
.compte-cases div {
  min-width: 58px; padding: 6px 4px 5px; border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(246, 217, 139, .35);
  backdrop-filter: blur(4px);
}
.compte-cases span { display: block; font-family: var(--f-cond); font-weight: 600; font-size: 26px; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.compte-cases small { font-size: 11px; color: #c9d3de; text-transform: uppercase; letter-spacing: .08em; }

.theme-noel .hero .accroche { color: #dbe4ee; font-size: 16px; max-width: 460px; margin: 6px auto 0; }

/* ---------- Forêt de sapins pleine largeur ---------- */
.theme-noel .sapins { display: block; width: 100vw; height: 110px; margin: 18px 0 0 calc(50% - 50vw); }
.sapins-loin { fill: var(--sapin-2); opacity: .85; }
.sapins-pres { fill: var(--sapin); }
.neige-sol { fill: var(--neige); }

/* ---------- Lettre au Père Noël ---------- */
.theme-noel #etat-jeu .lettre {
  position: relative;
  margin-top: -6px;
  border-radius: 6px 6px 14px 14px;
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(179, 40, 45, .07) 31px 32px),
    var(--papier-noel);
  border-top: 8px solid transparent;
  border-image: repeating-linear-gradient(90deg, var(--rouge) 0 14px, #fff 14px 28px, #1f6b4a 28px 42px, #fff 42px 56px) 8;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  padding: 20px 16px;
}
.lettre-entete { text-align: center; margin-bottom: 14px; }
.lettre-entete .manuscrit { font-size: 30px; }
.lettre-entete .petit { margin-top: 2px; }
.bouton-rouge { justify-self: stretch; text-align: center; }
.theme-noel .bouton-rouge { box-shadow: 0 6px 18px rgba(179, 40, 45, .35); }
/* Champs plus confortables au doigt (et pas de zoom automatique sur iPhone) */
.theme-noel input[type="email"], .theme-noel input:not([type]) { font-size: 16px; padding: 13px 12px; }

/* ---------- Paquet cadeau qui s'ouvre après l'envoi ---------- */
.merci { text-align: center; }
.paquet { position: relative; width: 120px; height: 120px; margin: 6px auto 4px; }
.paquet-boite {
  position: absolute; bottom: 0; left: 14px; width: 92px; height: 70px;
  background: linear-gradient(90deg, var(--rouge) 0 40px, var(--or) 40px 52px, var(--rouge) 52px);
  border-radius: 4px;
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.18);
}
.paquet-couvercle {
  position: absolute; bottom: 66px; left: 8px; width: 104px; height: 24px;
  background: linear-gradient(90deg, #c5323a 0 46px, var(--or) 46px 58px, #c5323a 58px);
  border-radius: 4px; transform-origin: 10% 100%;
}
.paquet.ouvert .paquet-couvercle { animation: couvercle 1s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes couvercle { to { transform: translate(-10px, -38px) rotate(-28deg); } }
.eclats { position: absolute; left: 50%; bottom: 70px; width: 0; height: 0; }
.eclats span {
  position: absolute; width: 8px; height: 8px; margin: -4px; background: var(--or);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: eclat 1.3s ease-out forwards;
}
@keyframes eclat {
  from { transform: translate(0, 0) scale(.4); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(220deg); opacity: 0; }
}
.ticket { display: inline-flex; align-items: stretch; margin: 6px auto 14px; border: 2px dashed var(--or); border-radius: 10px; overflow: hidden; font-family: var(--f-cond); }
.ticket-label { background: var(--or); color: #3a2608; padding: 6px 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.ticket-num { padding: 6px 14px; font-size: 22px; font-weight: 600; color: var(--rouge); letter-spacing: .06em; }
.merci-mail { font-size: 14px; color: var(--texte-doux); }

/* ---------- Roue du caviste ---------- */
.theme-noel .roue-bloc { display: block; margin-top: 20px; text-align: center; }
.sur-titre.sombre { display: block; color: var(--rouge); margin: 0; font-family: var(--f-cond); letter-spacing: .3em; text-transform: uppercase; font-weight: 600; }
.titre-roue { font-family: var(--f-manuscrit); font-weight: 400; font-size: 34px; margin: 0 0 6px; color: var(--texte); }
.petit-centre { margin: 0 auto 16px; max-width: 420px; color: var(--texte-doux); font-size: 15px; }
.roue-zone { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto 14px; }
.roue { width: 100%; height: 100%; display: block; transition: transform 4.6s cubic-bezier(.12, .78, .12, 1); filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); }
.roue text { font-family: var(--f-cond); font-weight: 600; font-size: 11px; letter-spacing: .04em; fill: #fff; text-transform: uppercase; }
.roue-fleche {
  position: absolute; top: -10px; left: 50%; z-index: 2; width: 0; height: 0; transform: translateX(-50%);
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--or);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}
.roue-centre {
  position: absolute; top: 50%; left: 50%; z-index: 2; width: 76px; height: 76px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 4px solid var(--or);
  background: radial-gradient(circle at 35% 35%, #fff, var(--papier-noel));
  font-family: var(--f-cond); font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--rouge); cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.roue-centre:disabled { cursor: default; opacity: .85; }
.conseil { background: var(--bleu-vert-pale); border-radius: 12px; padding: 14px 16px; text-align: left; animation: apparait .5s ease-out; }
.conseil .manuscrit { font-size: 26px; }
.conseil p { margin: 0 0 8px; }
@keyframes apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.theme-noel #etat-attente { box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.theme-noel .pied { background: rgba(8, 14, 24, .94); }

/* ---------- Écrans plus grands ---------- */
@media (min-width: 700px) {
  .theme-noel .bandeau { padding: 14px 24px; }
  .theme-noel #etat-jeu .hero { padding-top: min(34vh, 320px); }
  .theme-noel .bandeau-logo img { width: 60px; height: 60px; }
  .theme-noel .sapins { height: 150px; }
  .theme-noel .hero .accroche { font-size: 18px; }
}

/* ---------- Accessibilité ---------- */
@media (prefers-reduced-motion: reduce) {
  .scene, .etoiles span, .bon-reflet, .bouton-or { animation: none !important; }
  .roue { transition-duration: .01s; }
}
