* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff4d2;
  background: #241b0d;
  font-family: Georgia, "Trebuchet MS", serif;
}
.view { width: 100%; height: 100vh; height: 100svh; display: grid; place-items: center; }
.view[hidden] { display: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.map-frame {
  position: relative;
  width: min(100vw, 100svh, 900px);
  aspect-ratio: 1;
  overflow: hidden;
  box-shadow: 0 0 35px #000b;
}
.map-art { display: block; width: 100%; height: 100%; object-fit: contain; }
#map-hotspots { position: absolute; inset: 0; }
.map-hotspot {
  position: absolute;
  width: 8%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.map-hotspot:hover, .map-hotspot:focus-visible {
  border-color: #fff4c8;
  background: #fff4c833;
  box-shadow: 0 0 16px #ffdb64;
  outline: none;
}
.scene-view {
  position: relative;
  overflow: hidden;
  background: #17120b;
}
.scene-frame {
  position: relative;
  width: min(100vw, 100svh);
  aspect-ratio: 1;
  overflow: hidden;
}
.scene-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter .6s ease;
}
.scene-frame.lights-off .scene-art { filter: brightness(.22) saturate(.6) contrast(1.1); }
#scene-hotspots { position: absolute; inset: 0; }
.scene-hotspot {
  position: absolute;
  width: 9%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
}
.scene-hotspot:hover, .scene-hotspot:focus-visible { background: #fff4c833; box-shadow: 0 0 16px #ffdb64; outline: none; }
.moon-tint {
  position: absolute;
  left: 34.6%;
  top: 9.6%;
  width: 7.5%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe14d 0 55%, #ffd22e99 75%, transparent 100%);
  box-shadow: 0 0 22px 12px #ffd83a88;
  mix-blend-mode: hard-light;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.scene-frame.moon-yellow .moon-tint { opacity: 1; }
.fire-glow {
  position: absolute;
  left: 14%;
  top: 59%;
  width: 34%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffb84dcc 0, #ff8a2a77 35%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.scene-frame.fire-bright .fire-glow { opacity: 1; animation: fire-flicker 1.4s ease-in-out infinite alternate; }
@keyframes fire-flicker { from { filter: brightness(.9); } to { filter: brightness(1.25); } }
#steam-layer { position: absolute; inset: 0; pointer-events: none; }
.steam-puff {
  position: absolute;
  width: 4.5%;
  aspect-ratio: 1;
  margin: -2.25% 0 0 -2.25%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9 0, #fff4 45%, transparent 70%);
  filter: blur(2px);
  opacity: 0;
}
.scene-frame.steaming .steam-puff { animation: steam-rise 2.6s ease-out infinite; }
@keyframes steam-rise {
  0% { transform: translate(0, 0) scale(.5); opacity: 0; }
  20% { opacity: .9; }
  100% { transform: translate(var(--drift), -9vh) scale(1.6); opacity: 0; }
}
.glass-empty {
  position: absolute;
  left: 70.9%;
  top: 53.6%;
  width: 2.8%;
  height: 3.2%;
  border-radius: 0 0 .4vw .4vw;
  background: linear-gradient(90deg, #4b3b2fee, #6a5645ee 50%, #4b3b2fee);
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}
.scene-frame.glass-drained .glass-empty { opacity: 1; }
.dress-tint {
  position: absolute;
  inset: 0;
  background: #ff5c9a;
  mix-blend-mode: color;
  clip-path: polygon(34.1% 35.4%, 44.5% 35.2%, 45.3% 43%, 47% 50%, 49% 58%, 49.2% 64.8%, 39.1% 65.8%, 28.6% 64.5%, 28.9% 56%, 32.6% 46.9%, 33.6% 41.7%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.scene-frame.dress-pink .dress-tint { opacity: .85; }
.scene-frame.lights-bright .scene-art { filter: brightness(1.3) saturate(1.25) contrast(1.05); }
.window-sun {
  position: absolute;
  left: 1%;
  top: 7%;
  width: 18.5%;
  height: 29%;
  clip-path: ellipse(50% 50% at 50% 50%);
  background:
    radial-gradient(circle at 62% 38%, #fff 0, #fff6b0 12%, #ffd84a 24%, transparent 55%),
    linear-gradient(#7ec8ff, #bfe6ff 70%, #ffe9a8);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}
.scene-frame.sun-out .window-sun { opacity: .9; }
#fairy-layer { position: absolute; inset: 0; pointer-events: none; }
.fairy {
  position: absolute;
  width: 2.2%;
  aspect-ratio: 1;
  margin: -1.1% 0 0 -1.1%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #ffe9ff 25%, #ff9be8 50%, transparent 72%);
  box-shadow: 0 0 10px 4px #ff9be8aa, 0 0 22px 8px #ffd6f6666;
  opacity: 0;
}
.fairy::before, .fairy::after {
  content: "";
  position: absolute;
  top: -35%;
  width: 90%;
  height: 120%;
  background: #ffffffaa;
  border-radius: 100% 0;
  animation: wing-flap .18s ease-in-out infinite alternate;
}
.fairy::before { left: -85%; transform-origin: right center; }
.fairy::after { right: -85%; transform: scaleX(-1); transform-origin: left center; animation-name: wing-flap-r; }
@keyframes wing-flap { from { transform: rotate(-20deg); } to { transform: rotate(25deg); } }
@keyframes wing-flap-r { from { transform: scaleX(-1) rotate(-20deg); } to { transform: scaleX(-1) rotate(25deg); } }
#gem-layer { position: absolute; inset: 0; pointer-events: none; }
.gem-glow {
  position: absolute;
  width: 3.4%;
  aspect-ratio: 1;
  margin: -1.7% 0 0 -1.7%;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity .6s ease;
}
.scene-frame.gems-glow .gem-glow { opacity: 1; animation: gem-pulse 1.2s ease-in-out infinite alternate; }
@keyframes gem-pulse { from { transform: scale(.8); filter: brightness(.9); } to { transform: scale(1.25); filter: brightness(1.5); } }
.bubble {
  position: absolute;
  width: 2.4%;
  aspect-ratio: 1;
  margin: -1.2% 0 0 -1.2%;
  border-radius: 50%;
  border: 2px solid #e8ffffff;
  box-shadow: 0 0 6px #aef6ffcc;
  background: radial-gradient(circle at 30% 30%, #fffc, #aef6ff55 60%, transparent 75%);
  opacity: 0;
}
#leaf-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.falling-leaf {
  position: absolute;
  top: -10%;
  width: clamp(14px, 3.5vw, 26px);
  aspect-ratio: 1;
  border-radius: 0 100% 0 100%;
  background: linear-gradient(135deg, #f2a93b, #b5541c);
  animation: leaf-fall linear forwards;
}
.falling-leaf.acorn {
  width: clamp(12px, 3vw, 22px);
  aspect-ratio: 1 / 1.15;
  border-radius: 50% 50% 55% 55%;
  background: radial-gradient(circle at 35% 30%, #d99a52, #8a4f1d 60%, #5a300f) !important;
  box-shadow: inset 0 .45em 0 -.05em #5a3a1a;
}
#pearl-layer { position: absolute; inset: 0; pointer-events: none; }
.pearl-flash {
  position: absolute;
  width: 4%;
  aspect-ratio: 1;
  margin: -2% 0 0 -2%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #fffbe8 25%, #fff6c8aa 50%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
}
.scene-frame.pearls-flash .pearl-flash { animation: pearl-twinkle .5s ease-in-out 8 alternate; animation-delay: calc(var(--i) * .08s); }
@keyframes pearl-twinkle { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1.5); } }
.gnome-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gnome-layer .bald { opacity: 0; mix-blend-mode: color; transition: opacity .7s ease; }
.gnome-layer .bald polygon { fill: currentColor; }
@keyframes hat-hue { 0% { color: #ff2a2a; } 17% { color: #ffd21f; } 33% { color: #2aff5a; } 50% { color: #20d8ff; } 67% { color: #b13cff; } 83% { color: #ff3fd0; } 100% { color: #ff2a2a; } }
.scene-frame.gnomes-bald .gnome-layer .bald { opacity: 1; animation: hat-hue 3s linear infinite; animation-delay: calc(var(--g) * -.5s); }
#crystal-layer { position: absolute; inset: 0; pointer-events: none; }
.crystal-flash {
  position: absolute;
  width: 5%;
  aspect-ratio: 1;
  margin: -2.5% 0 0 -2.5%;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0;
}
.scene-frame.crystals-flash .crystal-flash { animation: crystal-cycle 2.4s linear 2; animation-delay: calc(var(--i) * .12s); }
@keyframes crystal-cycle {
  0% { opacity: 0; background: radial-gradient(circle, #ff3b3b, #ff3b3b66 50%, transparent 72%); }
  12% { opacity: 1; background: radial-gradient(circle, #ff3b3b, #ff3b3b66 50%, transparent 72%); }
  25% { opacity: 1; background: radial-gradient(circle, #ffe23b, #ffe23b66 50%, transparent 72%); }
  50% { opacity: 1; background: radial-gradient(circle, #3bff7a, #3bff7a66 50%, transparent 72%); }
  75% { opacity: 1; background: radial-gradient(circle, #ff4be0, #ff4be066 50%, transparent 72%); }
  100% { opacity: 0; background: radial-gradient(circle, #3bd0ff, #3bd0ff66 50%, transparent 72%); }
}
.falling-leaf:nth-child(3n) { background: linear-gradient(135deg, #d9772b, #7c3512); }
.falling-leaf:nth-child(3n+1) { background: linear-gradient(135deg, #e8c04a, #a8641a); }
.flying-firefly {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbd0 0 30%, #ffe45c 60%, transparent 72%);
  box-shadow: 0 0 10px 6px #ffe45ccc, 0 0 26px 14px #ffc83a77;
}
@keyframes leaf-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  50% { transform: translate(var(--sway), 55vh) rotate(180deg); }
  100% { transform: translate(calc(var(--sway) * -1), 115vh) rotate(380deg); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) { .falling-leaf { animation-duration: 3s !important; } }
.home-button {
  position: absolute;
  z-index: 2;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  padding: .65rem 1rem;
  border: 1px solid #ffe8a6;
  border-radius: 999px;
  color: #fff4d2;
  background: #382514e8;
  text-decoration: none;
}
.map-tagline {
  position: absolute;
  z-index: 1;
  top: max(1rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: min(60vw, 34rem);
  text-align: center;
  font-style: italic;
  font-size: clamp(.85rem, 2.2vw, 1.25rem);
  color: #ffe8a6;
  text-shadow: 0 0 8px #ffc83a99, 0 2px 4px #000;
}
@media (max-width: 600px) { .map-tagline { top: 4.2rem; width: 90vw; } }
.home-button:hover, .home-button:focus-visible { background: #5a3b1de8; }
.back-button {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  padding: .65rem 1rem;
  border: 1px solid #ffe8a6;
  border-radius: 999px;
  color: #fff4d2;
  background: #382514e8;
  font: inherit;
  cursor: pointer;
}
.scene-card {
  position: absolute;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 1rem;
  padding: .65rem 1rem;
  border: 1px solid #eacb75;
  border-radius: .75rem;
  background: #251b12d9;
  text-align: center;
  box-shadow: 0 0 20px #0008;
  pointer-events: none;
}
.scene-card h1 { margin: 0; color: #ffe39a; font-size: clamp(1.1rem, 3vw, 1.6rem); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
