:root {
  --sky: #B9BEDD;
  --cream: #FFFBF4;
  --ink: #3A2418;
  --red: #C8323A;
  --red-dark: #9E2730;
  --gold: #C9963A;
  --sage: #7FA095;
  --muted: #6A5A63;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Playfair Display', Georgia, serif;
  --font-num: 'Abril Fatface', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- page publique ---------- */
body.public { min-height: 100svh; background: #F6F3F8; }
.scene { width: 100%; background: var(--sky); display: flex; justify-content: center; position: relative; isolation: isolate; overflow: hidden; }
.house { position: relative; }
.house::before { content: ''; position: absolute; left: 50%; width: 100vw; transform: translateX(-50%); bottom: 0; height: 5.6%; background: #F6F3F8; z-index: -1; }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.stage { display: flex; flex-direction: column; align-items: center; padding: 0 0 28px; }
.house {
  width: min(100%, 760px, calc((100svh - 96px) / 1.3875));
  min-width: min(100%, 340px);
}
.facade { display: block; width: 100%; height: auto; user-select: none; -webkit-tap-highlight-color: transparent; }

.info { width: min(100% - 32px, 720px); text-align: center; margin-top: 4px; position: relative; z-index: 6; }
.status { font-size: 1rem; margin: 0 0 6px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin: 0; font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot-avail { background: #CADDEF; box-shadow: 0 0 0 2px #FFD978, 0 0 8px #FFD978; }
.dot-open { background: #FDE3A0; }
.dot-lock { background: #A9B4C9; opacity: .7; }

.error { margin: 16px; padding: 16px 20px; background: var(--cream); border-radius: 14px; text-align: center; position: relative; z-index: 6; }

.demo-bar {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 8px 12px; background: #3A2418; color: #FFF3DD; font-size: .85rem;
}
.demo-bar select, .demo-bar button { font: inherit; padding: 3px 8px; border-radius: 6px; border: 0; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); z-index: 50;
  background: #3A2418; color: #FFF6E6; padding: 12px 18px; border-radius: 14px; max-width: min(92vw, 460px);
  font-size: .95rem; text-align: center; opacity: 0; pointer-events: none; transition: .3s ease;
  box-shadow: 0 10px 30px rgba(30, 15, 40, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font: 700 1rem var(--font-ui);
  background: var(--red); color: #fff; border: 0; border-radius: 999px; padding: 12px 24px; cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 0 var(--red-dark); transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-dark); }
.btn small { font-weight: 400; font-size: .75rem; opacity: .9; }
.btn-ghost { background: transparent; color: var(--red-dark); box-shadow: inset 0 0 0 2px var(--red); }

/* ---------- fenêtres de la façade ---------- */
.facade .num { font-family: var(--font-num); }
.facade .inside-num { font-family: var(--font-num); font-size: 15px; }
.facade .banner-title { font-family: var(--font-title); font-weight: 800; font-size: 40px; fill: #fff; stroke: #A62B33; stroke-width: 1.6px; paint-order: stroke; letter-spacing: 1px; }

.win { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: center; transition: transform .25s ease; }
.win .leaf { transform-box: fill-box; transition: transform .9s cubic-bezier(.55, .05, .3, 1); }
.win .leaf-l { transform-origin: left center; }
.win .leaf-r { transform-origin: right center; }
.win.opening .leaf, .win.is-opened .leaf { transform: scaleX(.12); }
.win .num { transition: opacity .35s ease, transform .35s ease; transform-box: fill-box; transform-origin: center; }
.win.opening .num, .win.is-opened .num { opacity: 0; transform: scale(1.6); }
.win .inside-star { transform-box: fill-box; transform-origin: center; }
.win.opening .inside-star { animation: pop .8s .3s ease both; }
.win .leaves { transition: filter .3s; }
.win.is-locked .leaves, .win.is-waiting .leaves { filter: saturate(.55); }
.win.is-locked .num, .win.is-waiting .num { opacity: .78; }
.win .glow, .win .sparkle, .win .glow-line { opacity: 0; pointer-events: none; }
.win .frost { opacity: 0; transition: opacity .4s; pointer-events: none; }
.win.is-locked .frost, .win.is-waiting .frost { opacity: .38; }
.win.is-available .glow-line { opacity: 1; }
.win.is-available .glow { animation: glow 2.2s ease-in-out infinite; }
.win.is-available .sparkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.8s ease-in-out infinite; }
.win .lock { opacity: 0; transition: opacity .2s; pointer-events: none; }
.win.is-locked:focus-visible .lock, .win.is-waiting:focus-visible .lock { opacity: 1; }
.win:focus-visible .hit { stroke: #fff; stroke-width: 3; stroke-dasharray: 7 5; }
.win.shake { animation: shake .45s ease; }
@media (hover: hover) {
  .win.is-available:hover { transform: scale(1.05); }
  .win.is-opened:hover { transform: scale(1.03); }
  .win.is-locked:hover .lock, .win.is-waiting:hover .lock { opacity: 1; }
  .win.is-locked, .win.is-waiting { cursor: not-allowed; }
}
@keyframes glow { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.5) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes shake { 20% { transform: translateX(-4px) rotate(-1deg); } 40% { transform: translateX(4px) rotate(1deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.facade .bulb { animation: bulb 2.6s ease-in-out infinite; }
.facade .bulb-halo { animation: bulb 2.6s ease-in-out infinite; }
@keyframes bulb { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.facade .twinkle { animation: bulb 3s ease-in-out infinite; }
.facade .smoke circle { transform-box: fill-box; transform-origin: center; animation: smoke 4.8s ease-out infinite; opacity: 0; }
@keyframes smoke { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 20% { opacity: .55; } 100% { opacity: 0; transform: translate(18px, -70px) scale(1.8); } }
.facade .lamp-halo { animation: bulb 4s ease-in-out infinite; }

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

/* ---------- fenêtre de surprise ---------- */
.surprise-layer {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(46, 32, 64, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s ease;
}
.surprise-layer.in { opacity: 1; }
.surprise-layer.out { opacity: 0; }
.s-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.surprise {
  position: relative; z-index: 1; width: min(100%, 560px); max-height: calc(100svh - 32px); overflow: auto;
  background: var(--cream); border-radius: 20px; padding: 26px 26px 28px;
  box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--gold), 0 24px 60px rgba(25, 10, 40, .45);
  transform: translateY(24px) scale(.9); transition: transform .45s cubic-bezier(.2, 1.3, .4, 1);
  text-align: center;
}
.surprise-layer.in .surprise { transform: none; }
.surprise::before {
  content: ''; position: absolute; inset: 10px; border: 1.5px dashed rgba(201, 150, 58, .6); border-radius: 14px; pointer-events: none;
}
.s-close {
  position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: #F2E7D8; color: var(--ink); font-size: 26px; line-height: 1; z-index: 2;
}
.s-close:hover { background: #EADCC8; }
.s-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; }
.s-day {
  font-family: var(--font-num); font-size: 30px; color: #fff; background: var(--red); width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--red);
}
.s-date { font-size: .85rem; color: var(--muted); }
.s-title { font-family: var(--font-title); font-weight: 800; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.15; margin: 6px 0 12px; color: var(--red-dark); }
.s-body { font-size: 1.05rem; line-height: 1.6; }
.s-text p { margin: 0 0 .8em; }
.s-text a { color: var(--red-dark); word-break: break-word; }
.s-figure { margin: 4px 0 14px; }
.s-figure img { max-width: 100%; max-height: 52svh; border-radius: 12px; display: block; margin: 0 auto; box-shadow: 0 6px 18px rgba(58, 36, 24, .18); }
.s-video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin: 4px 0 14px; }
.s-video iframe, .s-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.s-actions { margin: 14px 0 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.s-gift { position: relative; background: #FCEDEA; border-radius: 14px; padding: 26px 18px 14px; overflow: hidden; }
.s-ribbon::before, .s-ribbon::after { content: ''; position: absolute; background: var(--red); opacity: .9; }
.s-ribbon::before { left: 0; right: 0; top: 10px; height: 8px; }
.s-ribbon::after { top: 0; bottom: 0; left: 18px; width: 8px; }
.kind-gift .s-title::before { content: 'Cadeau'; display: block; font: 700 .75rem var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.kind-animation .s-title { font-size: clamp(1.8rem, 7vw, 2.6rem); }

@media (max-width: 480px) {
  .surprise { padding: 22px 18px 22px; }
}
