/* ───────────────── Palette (taken from the scene) ───────────────── */
:root {
  --night: #12151f;
  --pine: #17211c;
  --pine-2: #1f2d26;
  --snow: #f6f2ec;
  --cream: #f4ece0;
  --paper: #f6eee2;
  --ink: #3a2c25;
  --amber: #ffc67a;
  --amber-deep: #e9a25a;
  --coral: #ec8f72;
  --peach: #f5bc9f;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-text: "EB Garamond", Georgia, serif;
  --font-hand: "Caveat", "Bradley Hand", cursive;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--snow);
  font-family: var(--font-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

/* ───────────────── Scene ───────────────── */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: manipulation;
}
/* the scene is a picture, not a page: swiping with the mouse must never select
   numbers or drag pictures around */
#app, #app * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

#world {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
}

#pan {
  position: absolute;
  inset: 0;
  /* no will-change here: an extra GPU layer inside the zooming #world loses tiles of the
     picture (dark holes). app.js sets it only while a finger is swiping. */
}
/* once the map can be swiped, the browser must not take the swipe for itself */
#app.can-pan { touch-action: none; }

#stage {
  position: absolute;
  /* left / top / width / height are set by app.js (cover-crop of the image) */
}

#scene-img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

/* Night: darkens the sunset towards a blue night. Multiply keeps dark trees dark. */
#night {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0;
  background: linear-gradient(to bottom,
      #1a2350 0%,
      #222c5a 30%,
      #3a4064 52%,
      #2a2f4c 66%,
      #20263f 100%);
  transition: opacity 2s ease;
}

/* Warm light from the cabin – stays bright when it gets dark. */
#glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  animation: flicker 5s ease-in-out infinite;
}

#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#doors { position: absolute; inset: 0; pointer-events: none; }
#doors > * { pointer-events: auto; }

#snow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    linear-gradient(to bottom, rgba(10, 10, 18, .55) 0%, rgba(10, 10, 18, 0) 14%),
    linear-gradient(to top, rgba(10, 10, 18, .45) 0%, rgba(10, 10, 18, 0) 12%),
    radial-gradient(ellipse 85% 75% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(8, 8, 14, .45) 100%);
  transition: opacity .9s ease;
}

#flash {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  --fx: 50%;
  --fy: 50%;
  background: radial-gradient(circle at var(--fx) var(--fy),
      #fffaf0 0%, #ffe2b0 18%, #c98a55 42%, rgba(26, 18, 16, .96) 78%);
}

/* ───────────────── Doors (lights in the picture) ───────────────── */
.door {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
  transition-delay: var(--delay, 0s);
}
.doors-ready .door { opacity: 1; transform: none; }
.door:focus-visible { outline: none; }
.door:focus-visible .light { box-shadow: 0 0 0 2px rgba(255, 255, 255, .8), 0 0 22px 8px rgba(255, 198, 122, .6); }

.door .light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffaf0 0%, #ffd79a 45%, #f0a85d 100%);
  box-shadow: 0 0 10px 3px rgba(255, 200, 130, .75), 0 0 28px 10px rgba(255, 170, 90, .28);
  transition: transform .5s ease, box-shadow .5s ease, background .5s ease, width .5s, height .5s;
}

.door .num {
  position: absolute;
  top: 31px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  line-height: 1;
  letter-spacing: .02em;
  color: rgba(255, 246, 232, .92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .7);
  pointer-events: none;
  transition: color .5s ease, opacity .5s ease;
}

/* not yet */
.door.is-locked .light {
  width: 6px;
  height: 6px;
  background: rgba(225, 230, 245, .55);
  box-shadow: 0 0 6px 1px rgba(210, 220, 255, .25);
}
.door.is-locked .num { opacity: .5; }

/* can be opened */
.door.is-available .light { animation: pulse 2.8s ease-in-out infinite; }

/* today */
.door.is-today .light {
  width: 12px;
  height: 12px;
  animation: pulse-strong 2.2s ease-in-out infinite;
}
.door.is-today .num { color: #fff; font-weight: 600; }

/* already opened */
.door.is-opened .light {
  background: radial-gradient(circle, #fff3dc 0%, #ffc67a 55%, #e9a25a 100%);
  box-shadow: 0 0 8px 2px rgba(255, 198, 122, .7), 0 0 20px 6px rgba(255, 170, 90, .22);
}
.door.is-opened .num { color: var(--amber); }

.door.is-nudge { animation: nudge .45s ease; }

.door.is-flaring .light {
  transform: scale(3.2);
  box-shadow: 0 0 30px 14px rgba(255, 220, 160, .95), 0 0 80px 40px rgba(255, 170, 90, .5);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px 3px rgba(255, 200, 130, .7), 0 0 26px 8px rgba(255, 170, 90, .25); }
  50% { transform: scale(1.25); box-shadow: 0 0 14px 5px rgba(255, 210, 150, .9), 0 0 36px 14px rgba(255, 170, 90, .35); }
}
@keyframes pulse-strong {
  0%, 100% { transform: scale(1); box-shadow: 0 0 14px 5px rgba(255, 214, 150, .9), 0 0 40px 16px rgba(255, 170, 90, .35); }
  50% { transform: scale(1.35); box-shadow: 0 0 20px 8px rgba(255, 228, 180, 1), 0 0 60px 26px rgba(255, 170, 90, .45); }
}
@keyframes nudge {
  0%, 100% { translate: 0 0; }
  20% { translate: -4px 0; }
  40% { translate: 4px 0; }
  60% { translate: -3px 0; }
  80% { translate: 2px 0; }
}
@keyframes flicker {
  0%, 100% { filter: brightness(1); }
  30% { filter: brightness(.92); }
  55% { filter: brightness(1.06); }
  70% { filter: brightness(.96); }
}

/* ───────────────── Intro title ───────────────── */
#intro {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 9vh);
  z-index: 6;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease;
  text-shadow: 0 2px 18px rgba(20, 10, 20, .7);
}
#intro.is-visible { opacity: 1; }
.intro-kicker {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(255, 236, 220, .85);
}
.intro-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(44px, 12vw, 76px);
  line-height: 1;
  color: #fff6ec;
}
.intro-sub {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: rgba(255, 240, 228, .9);
}

/* ───────────────── Toast ───────────────── */
#toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 28px);
  z-index: 30;
  transform: translate(-50%, 12px);
  max-width: calc(100% - 40px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(22, 20, 26, .78);
  border: 1px solid rgba(255, 220, 180, .22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--cream);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}
#toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

#preview-badge {
  position: absolute;
  left: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 31;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(233, 162, 90, .9);
  color: #2a1a10;
  font: 600 11px/1.4 system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ───────────────── Overlay (opened door) ───────────────── */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  visibility: hidden;
  opacity: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% 20%, rgba(80, 48, 36, .55), rgba(16, 14, 20, .0) 70%),
    rgba(16, 14, 20, .82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none; /* never catches taps while fading out */
  transition: opacity .7s ease, visibility 0s linear .7s;
}
#overlay.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity .7s ease, visibility 0s;
}

#overlay-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#overlay-content {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 76px) 20px calc(var(--safe-bottom) + 64px);
}

#overlay-close {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 230, 205, .25);
  background: rgba(30, 24, 26, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: .9;
}
#overlay-close:hover { opacity: 1; background: rgba(60, 44, 40, .7); }

/* shared bits */
.kicker {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--peach);
  text-align: center;
}
.door-title {
  margin: 0 0 26px;
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(34px, 9vw, 52px);
  line-height: 1.05;
  color: #fff6ec;
  text-align: center;
}
.prose p {
  margin: 0 0 .9em;
  font-size: 19px;
  line-height: 1.55;
  color: rgba(246, 238, 228, .92);
}
.prose p:last-child { margin-bottom: 0; }

/* entrance helper – children with .rise animate in one after another */
.rise {
  opacity: 0;
  transform: translateY(18px);
  animation: rise .9s cubic-bezier(.2, .8, .2, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ───────────── Template: letter ───────────── */
.letter { width: min(100%, 540px); }

.letter-sheet {
  position: relative;
  padding: 44px 32px 40px;
  border-radius: 3px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse at 100% 100%, rgba(196, 160, 120, .22), rgba(196, 160, 120, 0) 55%),
    var(--paper);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .65), 0 2px 0 rgba(255, 255, 255, .4) inset;
  font-family: var(--font-hand);
  font-size: 25px;
  line-height: 1.32;
  transform-origin: 50% 0%;
  opacity: 0;
  animation: unfold 1.3s cubic-bezier(.2, .75, .25, 1) forwards;
  animation-delay: var(--d, .1s);
}
/* fold line */
.letter-sheet::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(to right, rgba(120, 90, 60, 0), rgba(120, 90, 60, .14), rgba(120, 90, 60, 0));
}
@keyframes unfold {
  0% { opacity: 0; transform: perspective(1400px) rotateX(-75deg) translateY(30px) scale(.94); }
  45% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.letter-sheet p { margin: 0 0 .65em; }
.letter-greeting { font-size: 30px; }
.letter-signoff { margin-top: 1.1em !important; text-align: right; margin-bottom: 0 !important; }
.letter-signature {
  text-align: right;
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
  color: #4a2f22;
}

.attachment {
  margin-top: 28px;
  padding: 24px 24px 22px;
  border-radius: 16px;
  background: linear-gradient(150deg, #34503a 0%, #22362a 60%, #1b2a21 100%);
  border: 1px solid rgba(255, 214, 160, .35);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .7);
  color: var(--cream);
  text-align: center;
}
.attachment .kicker { color: #cfe3c4; margin-bottom: 8px; }
.attachment h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: 30px;
  line-height: 1.1;
}
.attachment p {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 18px;
  line-height: 1.5;
  color: rgba(244, 236, 224, .9);
}
.code {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 230, 190, .55);
  background: rgba(0, 0, 0, .18);
  font: 500 17px/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .08em;
  cursor: pointer;
}
.code-hint {
  display: block;
  margin-top: 7px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: rgba(244, 236, 224, .65);
}
.attachment a.link {
  display: inline-block;
  margin-top: 14px;
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 18px;
}

/* ───────────── Template: gift ───────────── */
.gift { width: min(100%, 500px); text-align: center; }

.gift-photo {
  margin: 0 auto 26px;
  padding: 12px 12px 14px;
  width: min(100%, 420px);
  background: #fbf7f0;
  border-radius: 3px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
  transform: rotate(-1.2deg);
}
.gift-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: blur(22px) brightness(1.4);
  transform: scale(1.06);
  animation: develop 2.4s cubic-bezier(.3, .6, .2, 1) forwards;
  animation-delay: var(--d, .3s);
}
@keyframes develop { to { filter: none; transform: none; } }

.gift-note {
  margin: 22px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--amber);
}

/* ───────────── Template: activity (ticket) ───────────── */
.activity { width: min(100%, 480px); }   /* as wide as the ticket, otherwise it isn't centred on a computer */
.ticket {
  position: relative;
  width: min(100%, 480px);
  padding: 36px 30px 32px;
  border-radius: 20px;
  color: var(--cream);
  background: linear-gradient(160deg, var(--pine-2) 0%, var(--pine) 100%);
  border: 1px solid rgba(242, 190, 120, .5);
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .8);
  text-align: center;
  /* ticket notches */
  -webkit-mask: radial-gradient(circle 14px at 0 62%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 14px at 100% 62%, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 14px at 0 62%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 14px at 100% 62%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 14px;
  border: 1px solid rgba(242, 190, 120, .22);
  pointer-events: none;
}
.ticket .door-title { margin-bottom: 22px; }
/* look: "cinema" in content.js – dark red like a cinema curtain */
.ticket--cinema { background: linear-gradient(160deg, #561820 0%, #3a0f17 50%, #22090f 100%); }

.ticket-details {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin: 0 0 24px;
  padding-bottom: 22px;
  border-bottom: 1px dashed rgba(242, 190, 120, .35);
}
.ticket-details div { min-width: 0; }
.ticket-details dt {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--peach);
  margin-bottom: 4px;
}
.ticket-details dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
}
.ticket .prose p { font-size: 18.5px; }
.ticket-bring {
  margin: 22px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: rgba(244, 236, 224, .75);
}
.ticket-bring span { color: var(--amber); font-style: normal; letter-spacing: .2em; text-transform: uppercase; font-size: 12px; margin-right: 8px; }

/* ───────────── Template: memory (pictures with music) ───────────── */
.memory { width: min(100%, 540px); }

.memory-photos {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 62vh;
  margin: 0 auto 26px;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .8);
  background: #1a1716;
}
.memory-photos img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.memory-photos img.is-active {
  opacity: 1;
  animation: kenburns 14s ease-out forwards;
}
@keyframes kenburns {
  from { transform: scale(1.12) translate(1.5%, 1%); }
  to { transform: scale(1) translate(0, 0); }
}

.song {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 18px;
  color: rgba(246, 238, 228, .85);
}
.song em { color: var(--amber); font-style: italic; }
.song-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 160, .4);
  background: rgba(255, 214, 160, .08);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 6px; }
.bars i { width: 2px; height: 30%; background: var(--amber); border-radius: 1px; }
.is-playing .bars i { animation: bar 1s ease-in-out infinite; }
.is-playing .bars i:nth-child(2) { animation-delay: -.35s; }
.is-playing .bars i:nth-child(3) { animation-delay: -.7s; }
@keyframes bar { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* ───────────── Empty door (no content yet) ───────────── */
.empty { text-align: center; max-width: 420px; }

/* ───────────── Reduced motion ───────────── */
@media (prefers-reduced-motion: reduce) {
  .door .light, .door.is-today .light, .door.is-available .light { animation: none !important; }
  .memory-photos img.is-active { animation: none; }
  #glow { animation: none; }
}

@media (min-width: 900px) {
  .door .num { font-size: 16px; }
  .letter-sheet { padding: 52px 48px 46px; font-size: 27px; }
}

/* ───────────────── Prototype: postcard door ─────────────────
   All timings / blur come from js/settings.js (as CSS variables). */
.pdoor {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%);
  perspective: var(--persp, 260px);
  opacity: 0;
  transition: opacity .8s ease;
  transition-delay: var(--delay, 0s);
}
.doors-ready .pdoor { opacity: 1; }
.pdoor > span, .pdoor-panel > span { display: block; position: absolute; inset: 0; }

/* behind the door: transparent – the canvas (js/scene-canvas.js) draws the letter paper,
   the blurred preview, the event tint and the soft inner shadow there, only for the open door */
.pdoor-back { background: none; }

/* The die-cut line of a cardboard door: only top, right and bottom (left = hinge).
   A light line with a thin dark line next to it, like a cut in the card. */
.pdoor-frame { pointer-events: none; }
.pdoor-frame::before,
.pdoor-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-style: solid;
  border-width: 1px 1px 1px 0;
}
.pdoor-frame::before { border-color: rgba(255, 248, 236, var(--cut-light, .4)); }
.pdoor-frame::after {
  inset: 1px 1px 1px 0;
  border-color: rgba(10, 8, 14, var(--cut-dark, .3));
}
/* the hinge: barely visible fold on the left */
.pdoor-frame {
  background: linear-gradient(to right, rgba(255, 248, 236, var(--fold, .12)) 0, rgba(255, 248, 236, 0) 2px) no-repeat;
}
.pdoor-hinge-right .pdoor-frame::before,
.pdoor-hinge-right .pdoor-frame::after { border-width: 1px 0 1px 1px; }
.pdoor-hinge-right .pdoor-frame::after { inset: 1px 0 1px 1px; }
.pdoor-hinge-right .pdoor-frame {
  background: linear-gradient(to left, rgba(255, 248, 236, var(--fold, .12)) 0, rgba(255, 248, 236, 0) 2px) no-repeat;
}

/* the flap itself */
.pdoor-panel {
  transform-origin: var(--hinge, left center);
  transform-style: preserve-3d;
  transition: transform var(--open-ms, 900ms) var(--open-ease, cubic-bezier(.25, .8, .35, 1));
}
.pdoor.is-open .pdoor-panel { transform: rotateY(var(--open-deg, -108deg)); }
.pdoor.no-anim .pdoor-panel { transition: none; }

.pdoor-front, .pdoor-inside {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.pdoor-front {
  background-image: url("../assets/scene/cabin.jpg");
  background-repeat: no-repeat;
}
/* a soft shadow on the flap while it swings out */
.pdoor-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, .35));
  opacity: 0;
  transition: opacity var(--open-ms, 900ms) ease;
}
.pdoor.is-open .pdoor-front::after { opacity: 1; }
/* darkens with the night like the picture underneath */
.pdoor-front::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #1d2652;
  mix-blend-mode: multiply;
  opacity: var(--night-op, 0);
}
.pdoor-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: rgba(255, 248, 238, .95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 8px rgba(0, 0, 0, .6);
}
.pdoor-inside {
  transform: rotateY(180deg);
  background: linear-gradient(to right, #ddd3c3, #eee6d8);
  box-shadow: inset 0 0 0 1px rgba(160, 150, 140, .6);
}
/* Not unlocked yet: no frame at all, and the number is so pale that you can only guess where the door is. */
.pdoor.is-locked .pdoor-num { opacity: .45; }
/* (these four lie on snow or bright light: a little stronger, so they look just as pale as the others) */
.pdoor.is-locked:is([aria-label="December 8"], [aria-label="December 14"], [aria-label="December 19"], [aria-label="December 24"]) .pdoor-num {
  opacity: .72;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 8px rgba(0, 0, 0, .8);
}
.pdoor.is-locked .pdoor-frame { opacity: 0 !important; }
/* (event doors always have their flap with the picture, its edges would show) */
.pdoor-event.is-locked .pdoor-front { background-image: none; }
.pdoor-event.is-locked .pdoor-front::before,
.pdoor-event.is-locked .pdoor-front::after { display: none; }
/* All 24 days are postcard doors: a closed door is only cut line + number (the canvas shows the
   picture underneath). Only the door in use gets its flap (picture + 3D) – otherwise the phone
   would have to zoom more than 20 of them. Event doors are left exactly as they were. */
/* (the flap used to cover the cut line almost completely – keep it just as faint, like doors 7 and 15) */
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-frame { opacity: .12; }
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-panel { transform-style: flat; transition: none; }
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-front { background-image: none; -webkit-backface-visibility: visible; backface-visibility: visible; }
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-front::before,
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-front::after,
.pdoor:not(.pdoor-event):not(.is-live):not(.is-open) .pdoor-inside { display: none; }
.pdoor.is-nudge { animation: nudge .45s ease; }

/* keep the phone smooth while the camera moves */
#app.is-zooming .door .light,
#app.is-zooming #glow { animation-play-state: paused; }

/* ───────────────── Second scene behind a prototype door ───────────────── */
#passage {
  position: fixed;
  inset: 0;
  z-index: 45;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: var(--preview-bg, #f6f0e6);
  color: #2b2420;
  transition-property: opacity, visibility;
  transition-timing-function: ease;
  transition-duration: 700ms;
}
#passage.is-open { visibility: visible; opacity: 1; pointer-events: auto; }
#passage:not(.is-open) { transition-property: opacity, visibility; transition-delay: 0s, 0s; }

#passage-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#passage-content {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 76px) 24px calc(var(--safe-bottom) + 64px);
}
#passage-close {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(43, 36, 32, .25);
  background: rgba(255, 255, 255, .5);
  color: #2b2420;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* ───────────────── Room: a separate page behind a door (iframe, js/app.js openRoomDoor) ───────────────── */
#room {
  position: fixed;
  inset: 0;
  z-index: 46;
  visibility: hidden;
  pointer-events: none;
  background: #eef1f5;
}
#room.is-open { visibility: visible; pointer-events: auto; }
.room-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}
#room-close {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(43, 36, 32, .25);
  background: rgba(255, 255, 255, .6);
  color: #2b2420;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* ───────────────── Cloud curtain over the switch: two walls from left + right (js/clouds.js) ───────────────── */
#clouds {
  position: fixed;
  inset: 0;
  z-index: 60;              /* above everything, also above the room */
  display: none;
  overflow: hidden;
  pointer-events: none;
}
#clouds.is-on { display: block; pointer-events: auto; }   /* no taps while they hide the switch */
.cloud-bank {
  position: absolute;
  top: 0;                   /* size + vertical position are set by js/clouds.js per screen */
  pointer-events: none;
  will-change: transform;
}
.cloud-left  { left: 0;  transform: translateX(-110%); }
.cloud-right { right: 0; transform: translateX(110%); }

/* plain, clearly labelled placeholders – one per type */
.ph {
  --accent: #8a7a6a;
  width: min(100%, 420px);
  padding: 40px 28px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  text-align: center;
}
.ph--gift     { --accent: #b0574a; }
.ph--activity { --accent: #4f7258; }
.ph--letter   { --accent: #a9844f; }
.ph--memory   { --accent: #56609a; }
.ph-kicker {
  margin: 0 0 14px;
  font: 600 12px/1.4 system-ui, sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.ph-type {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 44px;
  line-height: 1.05;
}
.ph-de {
  margin: 6px 0 22px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: rgba(43, 36, 32, .65);
}
.ph-meta { margin: 0 0 6px; font-size: 18px; }
.ph-note { margin: 0; font-size: 15px; color: rgba(43, 36, 32, .55); }

/* ───────────────── EVENT: Daft Punk (door 7) ───────────────── */
.ev { position: absolute; inset: 0; pointer-events: none; }
.ev > * { position: absolute; }

/* Halloween grade: a cold purple-green tint that pushes the Christmas warmth back */
.ev-grade {
  inset: 0;
  background: linear-gradient(to bottom, #3b2a6b 0%, #2f3f4a 55%, #22313a 100%);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.ev-dp.is-disco .ev-grade { opacity: .55; }

/* an orange-ish moon that slowly shows up */
.ev-moon {
  width: 2.1%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 38%, #ffe2b3 0%, #f3a65a 55%, #c4642a 100%);
  box-shadow: 0 0 18px 6px rgba(255, 150, 70, .35);
  opacity: 0;
  transition: opacity 3s ease;
}
.ev-dp.is-disco .ev-moon { opacity: .9; }

/* thin fog drifting over the lake */
.ev-fog {
  left: -20%;
  width: 140%;
  height: 30%;
  opacity: 0;
  transition: opacity 2.5s ease;
  background:
    radial-gradient(ellipse 30% 45% at 20% 50%, rgba(200, 210, 230, .32), transparent 70%),
    radial-gradient(ellipse 35% 40% at 55% 60%, rgba(200, 210, 230, .26), transparent 70%),
    radial-gradient(ellipse 30% 45% at 85% 45%, rgba(200, 210, 230, .3), transparent 70%);
  animation: fog-drift 28s linear infinite alternate;
}
.ev-fog-1 { top: 55%; }
.ev-fog-2 { top: 72%; animation-duration: 36s; animation-direction: alternate-reverse; }
.ev-dp.is-disco .ev-fog { opacity: 1; }
@keyframes fog-drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }

/* disco: big coloured light cones wandering over the picture */
.ev-cones { inset: 0; overflow: hidden; opacity: 0; transition: opacity 1s ease; }
.ev-dp.is-disco .ev-cones { opacity: 1; }
.ev-cones i {
  position: absolute;
  top: -4%;
  width: 26%;
  height: 115%;
  margin-left: -13%;
  transform-origin: 50% 0;
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, var(--c) 0%, color-mix(in srgb, var(--c) 30%, transparent) 55%, transparent 100%);
  mix-blend-mode: screen;
  opacity: .42;
  animation: cone-sweep var(--d) ease-in-out infinite alternate;
}
@keyframes cone-sweep { from { transform: rotate(var(--a)); } to { transform: rotate(calc(var(--a) * -1)); } }

/* the UFO */
.ev-ufo {
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: transform;
}
.ev-dp.is-playing .ev-ufo,
.ev-dp.is-parked .ev-ufo { opacity: 1; }
.ev-ufo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: brightness(calc(1 - var(--night-op, 0) * .45));
}
.ufo-hatch {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse, #fff 0%, #fff1c4 35%, rgba(255, 210, 140, .6) 60%, rgba(255, 200, 120, 0) 75%);
  opacity: 0;
  transition: opacity .5s ease;
}
.ufo-shaft {
  position: absolute;
  height: 260%;
  clip-path: polygon(8% 100%, 92% 100%, 100% 0, 0 0);
  background: linear-gradient(to top, rgba(255, 244, 210, .75), rgba(255, 244, 210, 0));
  opacity: 0;
  transition: opacity .6s ease;
}
.ev-dp.is-hatch-open .ufo-hatch,
.ev-dp.is-hatch-open .ufo-shaft { opacity: 1; }

/* coloured beams under the UFO while it parties */
.ufo-beams { position: absolute; left: 50%; top: 82%; width: 0; height: 0; opacity: 0; transition: opacity .4s ease; }
.ev-dp.is-disco .ufo-beams { opacity: 1; }
.ufo-beams i {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.2em;
  height: 9em;
  margin-left: -1.1em;
  font-size: var(--ufo-em, 10px);
  transform-origin: 50% 0;
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, var(--c), transparent 90%);
  opacity: .6;
  animation: beam-swing var(--d) ease-in-out infinite alternate;
}
@keyframes beam-swing { from { transform: rotate(var(--r)); } to { transform: rotate(calc(var(--r) * -1.6)); } }

/* pumpkins left behind */
.ev-pumpkins { inset: 0; }
.ev-pumpkin {
  position: absolute;
  transform: translate(-50%, -100%) scale(0);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 4px rgba(255, 160, 60, .75));
}
.ev-pumpkin svg { display: block; width: 100%; height: auto; }
.ev-dp.has-pumpkins .ev-pumpkin {
  transform: translate(-50%, -100%) scale(1);
  transition: transform .6s cubic-bezier(.3, 1.6, .5, 1);
  transition-delay: calc(var(--i) * 120ms);
}
.ev-dp.is-parked .ev-pumpkin { transition: none; }

/* the two figures */
.ev-fig {
  transform: translate(-50%, 0);
  transform-origin: 50% 100%;
  display: none;
  will-change: transform;
}
.ev-dp.is-playing .ev-fig { display: block; }
.ev-fig-inner { position: absolute; inset: 0; transform-origin: 50% 100%; }
.ev-fig-inner img, .fig-arm img, .fig-fore img { position: absolute; display: block; }
.fig-body { inset: 0; width: 100%; height: 100%; }
.fig-face { opacity: 0; }
.fig-arm, .fig-fore { position: absolute; }
.fig-arm > img, .fig-fore > img { inset: 0; width: 100%; height: 100%; }

/* door 7: light behind the opening while it charges up */
/* event doors: the paper glows a little brighter while it charges up (drawn in js/scene-canvas.js) */
@keyframes charge { from { filter: brightness(1); } to { filter: brightness(1.22); } }

/* spooky: less Christmas warmth, darker edges */
#app.ev-spooky #glow { opacity: .3 !important; transition: opacity 1.5s ease; }
#app.ev-spooky #vignette { opacity: 1; }
#app #vignette { transition: opacity 1.5s ease; }

/* text + tap catcher */
#ev-text {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 7vh);
  z-index: 35;
  padding: 0 24px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s ease, transform .8s ease;
  text-shadow: 0 2px 16px rgba(10, 0, 30, .85);
}
#ev-text.is-visible { opacity: 1; transform: none; }
#ev-text .ev-kicker {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #ffb36b;
}
#ev-text .ev-line {
  margin: 0 auto;
  max-width: 20ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(28px, 7.4vw, 48px);
  line-height: 1.1;
  color: #fff6ec;
}
#ev-text .ev-hint {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: rgba(255, 240, 230, .7);
  animation: hint-blink 1.8s ease-in-out infinite;
}
@keyframes hint-blink { 50% { opacity: .35; } }
#ev-catch { position: absolute; inset: 0; z-index: 34; display: none; }
#ev-catch.is-active { display: block; cursor: pointer; }

/* parked UFO: lid open, soft light from the hatch, a shadow on the snow */
.ev-dp.is-lid-open .ufo-lid { transform: rotate(-58deg); }
.ev-dp.is-lid-open .ufo-hatch { opacity: .75; }
.ev-dp.is-hatch-open .ufo-hatch { opacity: 1; }
.ufo-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 78%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(10, 12, 25, .55) 0%, rgba(10, 12, 25, 0) 70%);
  opacity: 0;
  transition: opacity .4s ease;
}
.ev-dp.is-landed .ufo-shadow { opacity: 1; }
.ev-dp.is-flying .ufo-shadow { opacity: 0; }

/* the small crew inside the UFO (behind the saucer, so their legs are hidden) */
.ufo-crew { position: absolute; inset: 0; }
.crew {
  position: absolute;
  display: block;
  transform: translate(-50%, 0);
  transform-origin: 50% 100%;
  opacity: 0;
  transition: opacity .35s ease;
  filter: brightness(calc(1 - var(--night-op, 0) * .35));
}
.ev-dp.has-crew .crew { opacity: 1; }

/* tap area of the parked UFO (a bit bigger than the UFO itself) */
.ufo-hit { position: absolute; inset: -140% -25% -40% -25%; pointer-events: none; }
.ev-dp.is-parked .ufo-hit { pointer-events: auto; cursor: pointer; }

/* big figure: switch to the picture with the original arms + helmet in front */
.fig-carry { inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .3s ease; }
.ev-fig-inner > img:not(.fig-carry), .ev-fig-inner > .fig-arm { transition: opacity .3s ease; }
.ev-fig-inner.is-carry > .fig-carry { opacity: 1; }
.ev-fig-inner.is-carry > img:not(.fig-carry), .ev-fig-inner.is-carry > .fig-arm { opacity: 0 !important; transition: opacity .1s linear .3s; }

/* ───────────────── Lanterns ───────────────── */
.lantern-layer, .scene-trees { position: absolute; pointer-events: none; }
.lantern-layer { inset: 0; }
.scene-trees { display: block; filter: none; }
.lantern { position: absolute; }
.lantern .l-art { position: absolute; inset: 0; display: block; }
.lantern.is-flip .l-art { transform: scaleX(-1); }
.lantern img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  /* painted iron darkens with the night like the picture */
  filter: brightness(calc(1 - var(--night-op, 0) * .45));
}
.lantern .l-lit { opacity: 0; transition: opacity .6s ease; }
.lantern .l-halo {
  opacity: 0;
  transition: opacity .8s ease;
  filter: none;
}
.lantern.is-lit .l-lit { opacity: 1; }
.lantern.is-lit .l-halo { opacity: calc(.35 + var(--night-op, 0) * .5); }

/* warm light around the glass – grows with the night */
.lantern .l-glow {
  position: absolute;
  width: 260%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 150, .9) 0%, rgba(255, 180, 100, .42) 18%, rgba(255, 150, 70, .14) 42%, rgba(255, 140, 60, 0) 68%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity .8s ease;
  z-index: 1;
}
.lantern-post .l-glow { width: 420%; }
.lantern.is-lit .l-glow { opacity: calc(.5 + var(--night-op, 0) * .55); animation: lantern-breathe 4.5s ease-in-out infinite; }
@keyframes lantern-breathe { 50% { scale: 1.06; } }
/* lighting up: a short flicker */
.lantern.is-igniting .l-lit,
.lantern.is-igniting .l-glow { animation: lantern-ignite .9s steps(1, end) backwards; }
@keyframes lantern-ignite {
  0% { opacity: 0; } 12% { opacity: 1; } 22% { opacity: .15; } 34% { opacity: .9; } 44% { opacity: .35; } 60%, 100% { opacity: 1; }
}

/* in the lake: mirrored, soft, darker */
.lantern-refl { top: 62.2%; bottom: 0; height: auto; overflow: hidden; }
.lantern.is-refl { transform: scaleY(-1); opacity: .38; }
.lantern.is-refl .l-glow { opacity: 0; }
.lantern.is-refl.is-lit .l-glow { opacity: .5; animation: none; }

/* ───────────────── Clouds ───────────────── */
.clouds { overflow: hidden; }
/* colour-graded like the pines in the photo (baked into the PNGs by tools/make_clouds.py),
   a bit darker at night */
.cloud {
  position: absolute;
  height: auto;
  display: block;
  opacity: 1;            /* solid: the orange sky must not shine through */
  filter: brightness(calc(1 - var(--night-op, 0) * .35)) blur(.3px);
  animation: cloud-drift var(--drift, 50s) ease-in-out infinite alternate;
  user-select: none;
  -webkit-user-select: none;
}
.cloud.is-flip { scale: -1 1; }
.cloud[hidden] { display: none; }
@keyframes cloud-drift { from { translate: -1.2% 0; } to { translate: 1.8% -.6%; } }
/* door 15: these drift off to the left and fade away */
.cloud.is-leaving { animation: cloud-leave 4s cubic-bezier(.4, 0, .7, 1) forwards; }
@keyframes cloud-leave { to { translate: -60% -25%; opacity: 0; } }

/* ───────────────── Easter egg: the big lantern on the right breaks ───────────────── */
.l-hit {
  position: absolute;
  width: 46%;
  aspect-ratio: .6;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.lantern .l-broken { opacity: 0; }
.lantern.is-broken .l-broken { opacity: 1; }
.lantern.is-broken .l-dark, .lantern.is-broken .l-lit, .lantern.is-broken .l-halo { opacity: 0; }
.lantern.is-broken .l-hit { cursor: default; }
/* the moment it breaks: a hard jolt, the light flickers out */
.lantern.is-shattering .l-art { animation: lantern-jolt .5s cubic-bezier(.3, .7, .4, 1); transform-origin: 70% 100%; }
.lantern.is-flip.is-shattering .l-art { animation-name: lantern-jolt-flip; }
@keyframes lantern-jolt {
  0% { rotate: 0deg; } 15% { rotate: -1.6deg; } 35% { rotate: 1.1deg; } 60% { rotate: -.5deg; } 100% { rotate: 0deg; }
}
@keyframes lantern-jolt-flip {
  0% { transform: scaleX(-1) rotate(0deg); } 15% { transform: scaleX(-1) rotate(-1.6deg); } 35% { transform: scaleX(-1) rotate(1.1deg); } 100% { transform: scaleX(-1) rotate(0deg); }
}
.lantern.is-shattering .l-glow { animation: lantern-die .5s steps(1, end) forwards; }
@keyframes lantern-die { 0% { opacity: 1; } 20% { opacity: .2; } 35% { opacity: .9; } 55% { opacity: .1; } 70% { opacity: .5; } 100% { opacity: 0; } }
/* tapped before door 15: just a tiny wobble */
.lantern.is-tapped .l-art { animation: lantern-jolt .45s ease; transform-origin: 70% 100%; }

/* ───────────────── EVENT: frozen lantern (door 15) ───────────────── */

#fz {
  position: absolute;
  inset: 0;
  z-index: 35;           /* same as #ev-text, which comes later → the text stays on top */
  display: none;
  touch-action: none;
  cursor: grab;
}
#fz.is-active { display: block; }
.fz-dim {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(10, 18, 34, .55), rgba(6, 10, 20, .86));
  opacity: 0;
  transition: opacity 1s ease;
}
#fz.is-dim .fz-dim { opacity: 1; }
.fz-lantern {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 2%;
  will-change: transform;
}
.fz-swing { position: absolute; inset: 0; transform-origin: 50% 1%; }
.fz-lantern img, .fz-lantern canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fz-lantern .fz-lit { opacity: 0; }
.fz-lantern.is-lit .fz-lit { animation: lantern-ignite 1s steps(1, end) both; }
.fz-lantern .fz-glow {
  position: absolute;
  left: 50%;
  top: 68%;
  width: 380%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 220, 160, .85) 0%, rgba(255, 180, 100, .35) 20%, rgba(255, 150, 70, .1) 45%, rgba(255, 140, 60, 0) 68%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.fz-lantern.is-lit .fz-glow { opacity: 1; }
.fz-lantern canvas { inset: -12% -16%; width: 132%; height: 124%; }
.fz-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 9vh);
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(19px, 5vw, 26px);
  color: #f3f8ff;
  text-shadow: 0 2px 14px rgba(0, 10, 30, .9);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .7s ease, transform .7s ease;
  pointer-events: none;
}
.fz-hint.is-visible { opacity: 1; transform: none; }
.fz-hint .fz-arrows { display: block; margin-top: 6px; font-style: normal; letter-spacing: .4em; opacity: .75; animation: fz-swipe 1.6s ease-in-out infinite; }
@keyframes fz-swipe { 0%, 100% { translate: -14px 0; } 50% { translate: 14px 0; } }

/* ───────────────── The picture is drawn on a canvas (js/scene-canvas.js) ─────────────────
   The scene's HTML elements stay (layout, CSS animations, taps) but are not painted by the
   page – the canvas draws them with the camera. Zooming a canvas never leaves empty tiles. */
#scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.is-mirrored { visibility: hidden !important; }
.is-mirrored .l-hit { visibility: visible; }
