/* =====================================================================
   Calendrier de l'Avent : écran du jour (mobile d'abord, 375 à 430 px)
   Designer. Référence : docs/design.md
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  /* Fond & léopard */
  --rose-50: #fff4f6;
  --rose-100: #fde3e9;
  --rose-200: #f9ccd6;
  --rose-300: #f6bcc8;      /* fond principal */
  --rose-400: #f2a7b9;      /* fond léopard */
  --rose-500: #e48aa0;      /* tache léopard */
  --rose-600: #c8577a;      /* contour léopard */
  /* Texte */
  --framboise: #b0103f;     /* titre JOUR N */
  --framboise-700: #8a0c31;
  --framboise-300: #e8457a;
  --ink: #6e0f2e;           /* texte du message */
  /* Or */
  --gold-100: #fff0c2;
  --gold-200: #f7dc9a;
  --gold-400: #e0b04f;
  --gold-600: #b9853a;
  /* Or rose (carte) */
  --rosegold-100: #f8dbcf;
  --rosegold-300: #eab9a8;
  --rosegold-500: #d89a86;
  --cream: #fffaf6;
  --snow: #fff7f9;

  --font: 'Fredoka', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --card: min(86vw, 360px, 52vh);
  --radius-card: 28px;
  --dots-h: 64px;
  --gold-border: linear-gradient(135deg, var(--gold-200), var(--gold-600) 28%, var(--gold-100) 50%, var(--gold-400) 70%, var(--gold-600) 86%, var(--gold-200));

  /* Bonnet de Noël (posé sur le titre) */
  --hat: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'><defs><linearGradient id='h' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='%23ff4f86'/><stop offset='1' stop-color='%23c3124a'/></linearGradient><radialGradient id='f' cx='.4' cy='.35' r='.75'><stop offset='0' stop-color='%23ffffff'/><stop offset='1' stop-color='%23f1dcd8'/></radialGradient></defs><path d='M14 70C16 40 40 14 72 14c20 0 34 12 36 30-8-6-16-6-22 2-4 8-6 16-6 24z' fill='url(%23h)'/><path d='M40 30c10-10 24-12 34-10' stroke='%23ff8fb1' stroke-width='4' fill='none' stroke-linecap='round' opacity='.6'/><rect x='6' y='62' width='86' height='26' rx='13' fill='url(%23f)'/><circle cx='106' cy='50' r='12' fill='url(%23f)'/></svg>");
  /* Chapeau pointu d'anniversaire (body.day-14) */
  --party-hat: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 110'><path d='M50 12 88 94q-38 12-76 0z' fill='%23ff5d8f'/><path d='M50 12 62 40q-14 6-26 0z' fill='%23ffc6d5'/><path d='M30 56q20 8 40 0l8 18q-28 10-56 0z' fill='%23ffc6d5'/><path d='M12 94q38 12 76 0l2 6q-40 14-80 0z' fill='%23f7d88a'/><circle cx='50' cy='11' r='9' fill='%23f7d88a'/><circle cx='42' cy='5' r='4' fill='%23fff0c2'/><circle cx='59' cy='6' r='4' fill='%23e0b04f'/></svg>");
  /* Fleuron doré du message */
  --flourish: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 20'><path d='M4 10h40M76 10h40' stroke='%23e0b04f' stroke-width='1.5' stroke-linecap='round'/><path d='M60 1c1 6 3 8 9 9-6 1-8 3-9 9-1-6-3-8-9-9 6-1 8-3 9-9z' fill='%23e0b04f'/><circle cx='48' cy='10' r='2' fill='%23e0b04f'/><circle cx='72' cy='10' r='2' fill='%23e0b04f'/></svg>");
}
@supports (height: 1svh) {
  :root { --card: min(86vw, 360px, 52svh); }
}

*, *::before, *::after { box-sizing: border-box; }
.hidden { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--rose-300);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--framboise);
  background:
    radial-gradient(120% 55% at 50% 0%, #fbd3dc 0%, rgba(251, 211, 220, 0) 60%),
    radial-gradient(90% 45% at 50% 100%, #fbd0d9 0%, rgba(251, 208, 217, 0) 70%),
    var(--rose-300);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--dots-h) + env(safe-area-inset-bottom));
}
body.day-24 {
  background:
    radial-gradient(120% 60% at 50% 0%, #e7a7c6 0%, rgba(231, 167, 198, 0) 65%),
    linear-gradient(#ebb3cb, var(--rose-300) 60%);
}
body.day-25 {
  background:
    radial-gradient(70% 40% at 50% 45%, rgba(255, 226, 160, .5), rgba(255, 226, 160, 0) 70%),
    radial-gradient(120% 55% at 50% 0%, #fbd3dc 0%, rgba(251, 211, 220, 0) 60%),
    var(--rose-300);
}

/* =====================================================================
   DÉCOR (#decor) : markup prêt à coller dans docs/design.md
   ===================================================================== */
#decor {
  position: fixed;
  top: 0; bottom: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 520px;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#decor svg { position: absolute; display: block; overflow: visible; }
#decor .decor-defs { width: 0; height: 0; position: absolute; }

.decor-leopard { width: 230px; height: 196px; }
.decor-leopard--tl {
  top: -14px; left: -36px;
  -webkit-mask-image: linear-gradient(140deg, #000 40%, transparent 82%);
          mask-image: linear-gradient(140deg, #000 40%, transparent 82%);
}
.decor-leopard--br {
  bottom: -30px; right: -60px; width: 190px;
  transform: rotate(180deg);
  -webkit-mask-image: linear-gradient(140deg, #000 30%, transparent 80%);
          mask-image: linear-gradient(140deg, #000 30%, transparent 80%);
}
.decor-ornament {
  top: -6px; right: 14px; width: clamp(78px, 22vw, 100px);
  transform-origin: 50% 0;
  animation: swing 5s ease-in-out infinite alternate;
}
.decor-tree   { right: -26px; bottom: 26px; width: clamp(130px, 38vw, 165px); }
.decor-gift   { left: -16px;  bottom: 20px; width: clamp(118px, 34vw, 150px); }
.decor-bauble--a { left: clamp(96px, 30vw, 128px); bottom: 18px; width: 56px; }
.decor-bauble--b { right: clamp(92px, 28vw, 120px); bottom: 34px; width: 42px; }
.decor-ground { left: 0; bottom: 0; width: 100%; height: 74px; }
.decor-ribbon { left: 40%; bottom: 12px; width: 120px; }
.decor-tree .decor-twinkle circle { animation: blink 2.4s ease-in-out infinite; }
.decor-tree .decor-twinkle circle:nth-child(3n)   { animation-delay: -.8s; }
.decor-tree .decor-twinkle circle:nth-child(3n+1) { animation-delay: -1.6s; }

.decor-flake {
  left: var(--x); top: var(--y);
  width: var(--s, 32px); height: var(--s, 32px);
  opacity: .85;
  animation: float 7s ease-in-out var(--d, 0s) infinite alternate;
}
.decor-sparkle {
  left: var(--x); top: var(--y);
  width: var(--s, 18px); height: var(--s, 18px);
  animation: twinkle 2.6s ease-in-out var(--d, 0s) infinite;
}
.decor-snowfall i {
  position: absolute; top: -12px; left: var(--x);
  width: var(--s, 4px); height: var(--s, 4px);
  border-radius: 50%;
  background: #fff;
  opacity: .8;
  animation: snowfall var(--t, 12s) linear var(--d, 0s) infinite;
  will-change: transform;
}

/* Décors des jours spéciaux (pilotés par Animations.decor(day)) */
.decor-birthday, .decor-night, .decor-lights { display: none; }
body.day-14 .decor-birthday { display: block; }
body.day-24 .decor-night { display: block; }
body.day-25 .decor-lights { display: block; }
.decor-bunting { top: 0; left: 0; width: 100%; height: auto; }
.decor-bunting path:not(:first-child) { transform-box: fill-box; transform-origin: 50% 0; animation: flutter 2.8s ease-in-out infinite alternate; }
.decor-bunting path:nth-child(even) { animation-delay: -1.4s; }
.decor-balloons { width: 78px; animation: float 4.5s ease-in-out infinite alternate; }
.decor-balloons--l { left: -14px; top: 30%; }
.decor-balloons--r { right: -14px; top: 38%; animation-delay: -2s; }
.decor-moon { top: 18px; left: 34%; width: 38px; animation: twinkle 5s ease-in-out infinite; }
.decor-lights { top: 0; left: 0; width: 100%; height: auto; }
.decor-lights .decor-bulb { animation: blink 1.6s ease-in-out infinite; }
.decor-lights g:nth-child(odd) .decor-bulb { animation-delay: -.8s; }

/* =====================================================================
   ÉCRANS
   ===================================================================== */
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100vh - var(--dots-h));
  min-height: calc(100dvh - var(--dots-h) - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 26px);
  padding: calc(env(safe-area-inset-top) + 28px) 20px 24px;
  text-align: center;
}
#screen-day {
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top) + clamp(48px, 12vh, 124px));
}

/* ---------- Titre JOUR N + bonnet ---------- */
#day-title, .big-title {
  margin: 0;
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.005em;
  color: var(--framboise);
  text-shadow:
    0 2px 0 rgba(255, 255, 255, .35),
    0 6px 0 rgba(138, 12, 49, .12),
    0 14px 28px rgba(176, 16, 63, .22);
}
#day-title {
  position: relative;
  width: fit-content;
  margin-inline: auto;
  font-size: clamp(56px, 19vw, 92px);
  white-space: nowrap;
  animation: title-in .8s cubic-bezier(.2, 1.4, .4, 1) both;
}
#day-title::before, .has-hat::before {
  content: '';
  position: absolute;
  left: -.16em; top: -.5em;
  width: .98em; height: .82em;
  background: var(--hat) no-repeat center / contain;
  transform: rotate(-16deg);
  filter: drop-shadow(0 4px 4px rgba(138, 12, 49, .25));
  pointer-events: none;
}
body.day-14 #day-title::before {
  background-image: var(--party-hat);
  left: -.1em; top: -.66em; width: .7em; height: .78em;
  transform: rotate(-18deg);
}

/* ---------- Carte à gratter ---------- */
#scratch-card {
  position: relative;
  width: var(--card);
  height: var(--card);
  flex: 0 0 auto;
  border-radius: var(--radius-card);
  border: 3px solid transparent;
  background:
    radial-gradient(circle at 30% 25%, #fff 0%, #ffeef2 55%, #fbd9e1 100%) padding-box,
    var(--gold-border) border-box;
  box-shadow:
    0 22px 44px -16px rgba(160, 40, 80, .45),
    0 4px 12px rgba(160, 60, 80, .16);
  overflow: hidden;
  isolation: isolate;
  animation: card-in .9s cubic-bezier(.2, 1.2, .4, 1) .1s both;
}
#scratch-card::after { /* reflet intérieur du liseré */
  content: '';
  position: absolute; inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), inset 0 0 22px rgba(255, 255, 255, .22);
  pointer-events: none;
}
#day-image {
  position: absolute; inset: 0;
  z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius-card) - 3px);
  user-select: none;
  -webkit-user-drag: none;
}
#scratch-canvas {
  position: absolute; inset: 0;
  z-index: 1;
  width: 100%; height: 100%;
  display: block;
  border-radius: calc(var(--radius-card) - 3px);
  /* repli avant peinture du canvas : or rose brossé en CSS */
  background:
    repeating-linear-gradient(-7deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, var(--rosegold-300), #f8d9cc 28%, #e2a995 50%, #f4cfc0 72%, var(--rosegold-500));
  touch-action: none;
  cursor: grab;
}
#scratch-canvas:active { cursor: grabbing; }

#scratch-hint {
  position: absolute; inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 6%;
  color: var(--framboise);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.hint-big {
  font-weight: 700;
  font-size: calc(var(--card) * .145);
  line-height: 1;
  letter-spacing: .01em;
}
.hint-small {
  font-weight: 600;
  font-size: calc(var(--card) * .105);
  line-height: 1.15;
}
.hint-hand {
  width: calc(var(--card) * .25);
  height: calc(var(--card) * .25);
  margin-top: calc(var(--card) * .045);
  animation: hand-swipe 2.2s ease-in-out infinite;
}
#scratch-card.scratching #scratch-hint { opacity: 0; transform: scale(.96); }

/* Révélation (posée par Animations.play, retirée par app.js au reset) */
#scratch-card.revealed { animation: card-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
#scratch-card.revealed #scratch-canvas {
  opacity: 0;
  transform: scale(1.06);
  transition: opacity .7s ease, transform .7s ease;
  pointer-events: none;
}
#scratch-card.revealed #scratch-hint { opacity: 0; }

/* ---------- Message du jour ---------- */
/* ---------- Indice du jour (toujours visible, avant le grattage) ---------- */
#day-clue {
  position: relative;
  width: var(--card);
  margin: 0 auto;
  padding: 10px 16px 12px;
  border: 1.5px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 251, .92), rgba(255, 241, 244, .92)) padding-box,
    var(--gold-border) border-box;
  box-shadow: 0 10px 24px -14px rgba(160, 40, 80, .45);
  text-align: center;
  animation: title-in .8s .15s cubic-bezier(.2, 1.4, .4, 1) both;
}
#day-clue.hidden { display: none; }
.clue-label {
  display: inline-block;
  margin-bottom: 2px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--framboise);
}
.clue-label::before, .clue-label::after { content: '✦'; margin: 0 .5em; color: var(--gold-400); letter-spacing: 0; }
#day-clue-text {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(15px, 4.2vw, 18px);
  line-height: 1.35;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

#day-message {
  position: relative;
  width: var(--card);
  margin: 0 auto;
  padding: 18px 22px 22px;
  border: 1.5px solid transparent;
  border-radius: 22px;
  background:
    linear-gradient(180deg, #fffdfb, #fff1f4) padding-box,
    var(--gold-border) border-box;
  box-shadow: 0 16px 36px -14px rgba(160, 40, 80, .45);
  color: var(--ink);
  font-weight: 500;
  font-size: clamp(17px, 4.6vw, 20px);
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: center;
  animation: msg-in .8s cubic-bezier(.2, 1.2, .4, 1) both;
}
#day-message::before {
  content: '';
  display: block;
  width: 96px; height: 16px;
  margin: 0 auto 10px;
  background: var(--flourish) no-repeat center / contain;
}
#day-message::after {
  content: '';
  position: absolute; inset: 5px;
  border: 1px solid rgba(224, 176, 79, .35);
  border-radius: 17px;
  pointer-events: none;
}

/* ---------- Écran « Rendez-vous le 1er décembre » / « Joyeux Noël » ---------- */
.big-title { font-size: clamp(50px, 15.5vw, 78px); }
.big-title span {
  display: block;
  margin-top: .22em;
  font-size: .5em;
  font-weight: 600;
  color: var(--framboise-300);
}
.big-title sup { font-size: .55em; }
.has-hat { position: relative; width: fit-content; margin-inline: auto; }
.screen-kicker {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--framboise-700);
  opacity: .85;
}
.screen-sub {
  margin: 0;
  max-width: 30ch;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}
.wait-gift {
  width: min(44vw, 180px);
  transform-origin: 50% 100%;
  animation: gift-wiggle 3s ease-in-out infinite;
}
.wait-gift svg, .end-arrow svg { display: block; width: 100%; height: auto; }
.end-arrow { width: 30px; color: var(--framboise); animation: bob 1.6s ease-in-out infinite; }
#screen-wait .big-title, #screen-end .big-title { animation: title-in .9s cubic-bezier(.2, 1.4, .4, 1) both; }

/* ---------- Pastilles des jours passés ---------- */
#day-dots {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(255, 244, 247, .94), rgba(255, 244, 247, .6) 70%, rgba(255, 244, 247, 0));
}
#day-dots::-webkit-scrollbar { display: none; }
#day-dots:empty { display: none; }
#day-dots .dot:first-child { margin-left: auto; }
#day-dots .dot:last-child { margin-right: auto; }
.dot {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font: 600 15px/1 var(--font);
  color: var(--framboise);
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--rosegold-100) 45%, var(--rosegold-300) 100%);
  box-shadow: inset 0 0 0 1.5px var(--gold-400), 0 3px 8px rgba(160, 40, 80, .18);
  cursor: pointer;
  scroll-snap-align: center;
  transition: transform .2s ease, background .2s ease;
}
.dot:active { transform: scale(.92); }
.dot:focus-visible { outline: 2px solid var(--framboise); outline-offset: 3px; }
.dot.today { box-shadow: inset 0 0 0 1.5px var(--gold-400), 0 0 0 3px var(--gold-200), 0 3px 8px rgba(160, 40, 80, .18); }
.dot.current {
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff5c8d 0%, var(--framboise) 70%);
  box-shadow: inset 0 0 0 1.5px var(--gold-200), 0 4px 12px rgba(176, 16, 63, .4);
  transform: scale(1.08);
}

/* =====================================================================
   EFFETS DE RÉVÉLATION (créés par animations.js)
   ===================================================================== */
.fx-layer {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
  transition: opacity .45s ease;
}
.fx-layer.fx-out { opacity: 0; }
.fx-layer > * { pointer-events: none; }
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-shine {
  position: absolute; inset: 0;
  z-index: 4;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .8) 47%, rgba(255, 236, 190, .55) 53%, transparent 70%);
  transform: translateX(-120%);
  animation: fx-shine .9s ease-out .1s forwards;
}

.fx-veil { position: absolute; inset: 0; opacity: 0; animation: fx-fade-in .7s ease forwards; }
.fx-veil--birthday { background: radial-gradient(circle at 50% 40%, rgba(150, 12, 70, .5), rgba(60, 5, 40, .78)); }
.fx-veil--night { background: linear-gradient(180deg, rgba(28, 20, 66, .88) 0%, rgba(74, 32, 92, .72) 45%, rgba(176, 16, 63, .28) 100%); }
.fx-veil--gold { background: radial-gradient(circle at 50% 45%, rgba(255, 236, 190, .45), rgba(176, 16, 63, .55) 60%, rgba(90, 10, 40, .72)); }

/* Textes lettre par lettre */
.fx-banner {
  position: absolute;
  left: 4vw; right: 4vw;
  top: 14vh;
  text-align: center;
  font: 700 clamp(38px, 11.5vw, 58px)/1.04 var(--font);
  letter-spacing: .01em;
}
.fx-word { display: inline-block; white-space: nowrap; }
.fx-ch {
  display: inline-block;
  animation:
    fx-letter .7s cubic-bezier(.2, 1.6, .4, 1) calc(var(--i) * 55ms) both,
    fx-wave 1.6s ease-in-out calc(var(--i) * 90ms + 1.4s) infinite;
}
.fx-banner--birthday {
  color: #fff;
  text-shadow: 0 3px 0 var(--framboise), 0 6px 0 var(--gold-400), 0 12px 26px rgba(0, 0, 0, .35);
}
.fx-banner--night {
  color: #fff6ea;
  text-shadow: 0 0 18px rgba(255, 214, 140, .85), 0 3px 0 rgba(120, 40, 90, .6);
}
.fx-banner--gold { filter: drop-shadow(0 3px 0 #9e0d39) drop-shadow(0 10px 18px rgba(0, 0, 0, .3)); }
.fx-banner--gold .fx-ch {
  color: transparent;
  background: linear-gradient(100deg, #b9853a, #fff3c4 40%, #e0b04f 60%, #fff7d6 80%, #b9853a);
  background-size: 220% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  animation:
    fx-letter .7s cubic-bezier(.2, 1.6, .4, 1) calc(var(--i) * 55ms) both,
    fx-shimmer 2.2s linear infinite;
}

/* Gâteau d'anniversaire */
.fx-cake { position: absolute; animation: fx-rise .9s cubic-bezier(.2, 1.3, .4, 1) both; }
.fx-cake svg, .fx-gift svg, .fx-sleigh svg, .fx-lights svg, .fx-balloon svg { display: block; width: 100%; height: auto; overflow: visible; }
.fx-flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scale(0);
  transition: transform .4s cubic-bezier(.3, 1.8, .5, 1);
}
.fx-cake.lit .fx-flame { transform: scale(1); transition-delay: var(--d, 0ms); }
.fx-flicker {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: fx-flicker .16s ease-in-out infinite alternate;
}

/* Ballons qui s'envolent */
.fx-balloon {
  position: absolute;
  bottom: -160px;
  animation: fx-balloon-up 5s cubic-bezier(.35, .1, .6, 1) both;
  will-change: transform;
}
.fx-balloon-sway { animation: fx-sway 1.8s ease-in-out infinite alternate; transform-origin: 50% 0; }

/* Guirlande lumineuse (24) */
.fx-lights { position: absolute; top: 4px; left: 0; width: 100%; }
.fx-b .fx-bulb { fill: #6f5260; transition: fill .2s ease; }
.fx-b .fx-halo { fill: var(--c); opacity: 0; transition: opacity .3s ease; }
.fx-b.on .fx-bulb { fill: var(--c); }
.fx-b.on .fx-halo { opacity: .4; animation: fx-glow 1.1s ease-in-out .3s infinite alternate; }
.fx-b.on:nth-child(odd) .fx-halo { animation-delay: .85s; }

/* Traîneau (24) : position pilotée en JS */
.fx-sleigh {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 6px rgba(255, 220, 150, .8));
  will-change: transform;
}

/* Cadeau qui s'ouvre (25) */
.fx-gift { position: absolute; animation: fx-drop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.fx-gift svg { transform-origin: 50% 100%; transition: transform .45s ease, opacity .45s ease; }
.fx-gift.shake svg { animation: fx-shake .1s ease-in-out 8 alternate; }
.fx-gift .fx-lid {
  transform-box: fill-box;
  transform-origin: 0 100%;
  transition: transform .8s cubic-bezier(.2, 1.1, .3, 1), opacity .5s ease .5s;
}
.fx-gift.open .fx-lid { transform: translate(-30%, -150%) rotate(-32deg); opacity: 0; }
.fx-gift.away svg { transform: scale(.5) translateY(30%); opacity: 0; }
.fx-rays {
  position: absolute;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.2);
  transition: opacity .6s ease, transform .7s cubic-bezier(.2, 1.2, .4, 1);
}
.fx-rays.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fx-rays i {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 230, 160, .6) 0deg 7deg, rgba(255, 230, 160, 0) 7deg 20deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 15%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 15%, transparent 100%);
  animation: fx-spin 9s linear infinite;
}

/* =====================================================================
   KEYFRAMES
   ===================================================================== */
@keyframes title-in { from { opacity: 0; transform: translateY(-18px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes card-pop { 0% { transform: scale(1); } 35% { transform: scale(.965); } 100% { transform: scale(1); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes hand-swipe {
  0%, 100% { transform: translateX(-10%) rotate(-6deg); }
  50% { transform: translateX(12%) rotate(5deg); }
}
@keyframes swing { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes float { from { transform: translateY(-4px) rotate(-6deg); } to { transform: translateY(6px) rotate(6deg); } }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.72); } 50% { opacity: 1; transform: scale(1); } }
@keyframes blink { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@keyframes snowfall { to { transform: translate3d(var(--dx, 24px), 105vh, 0); } }
@keyframes flutter { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes gift-wiggle {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-5deg); } 80% { transform: rotate(5deg); }
  85% { transform: rotate(-3deg); } 90% { transform: rotate(2deg); }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

@keyframes fx-fade-in { to { opacity: 1; } }
@keyframes fx-shine { to { transform: translateX(120%); } }
@keyframes fx-letter {
  0% { opacity: 0; transform: translateY(40px) scale(.3) rotate(-12deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes fx-wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes fx-shimmer { from { background-position: 100% 0; } to { background-position: -120% 0; } }
@keyframes fx-rise { 0% { opacity: 0; transform: translateY(70vh) scale(.8); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes fx-flicker { from { transform: scale(1, 1) skewX(-3deg); } to { transform: scale(.92, 1.08) skewX(3deg); } }
@keyframes fx-balloon-up { from { transform: translateY(0); } to { transform: translateY(-165vh); } }
@keyframes fx-sway { from { transform: rotate(-7deg) translateX(-6px); } to { transform: rotate(7deg) translateX(6px); } }
@keyframes fx-glow { from { opacity: .25; } to { opacity: .6; } }
@keyframes fx-drop { 0% { opacity: 0; transform: translateY(-60vh) scale(.7); } 70% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes fx-shake { from { transform: rotate(-5deg) scale(1.02); } to { transform: rotate(5deg) scale(1.02); } }
@keyframes fx-spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Mouvement réduit : décor figé, révélation en simple fondu
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .2s !important;
    transition-delay: 0s !important;
  }
  .decor-snowfall { display: none; }
  #scratch-card.revealed #scratch-canvas { transform: none; }
  .fx-shine { display: none; }
}

/* Grand écran (PC) : on garde la composition mobile au centre */
@media (min-width: 700px) {
  :root { --card: min(360px, 52vh); }
}
