/* ============================================================== */
/* WOBBLE'S WORLD — PREMIUM RETRO-COSMIC DESIGN SYSTEM           */
/* Inspired by minimal, elegant, soft aesthetics & night palette  */
/* ============================================================== */

:root {
  /* Daytime Palette: Soft warm cream, lilac, blush & golden butter */
  --bg: #FFF9F3;
  --surface: #FFFDFB;
  --surface-2: #FFF2EB;
  --ink: #32264D;
  --muted: #81778E;
  --line: #F0E4E7;
  
  --lilac: #A98BFF;
  --lilac-deep: #7954D8;
  --pink: #FF9DBB;
  --peach: #FFC2AD;
  --butter: #FFE79D;
  --mint: #C9EEE4;
  --mint-dark: #65A98A;
  
  --shadow: 0 18px 50px rgba(104, 75, 126, 0.08);
  --shadow-sm: 0 10px 25px rgba(104, 75, 126, 0.06);
  --shadow-glow: 0 0 35px rgba(255, 231, 157, 0.5);
  
  --radius: 26px;
  --radius-sm: 16px;
}

/* ============================================================== */
/* NIGHT MODE: VELVET INDIGO, SOFT STARLIGHT & NEON PASTEL ACCENTS */
/* ============================================================== */
html.dark-theme, body.is-night {
  --bg: #211B35;
  --surface: #302743;
  --surface-2: #3A2C4B;
  --ink: #F8EEFB;
  --muted: #C0B2CB;
  --line: #4B3A5C;
  
  --lilac: #B89BFF;
  --lilac-deep: #9B78E6;
  --pink: #FF99BC;
  --peach: #FFC0AC;
  --butter: #FFE48E;
  --mint: #7BE5CB;
  --mint-dark: #8DE0BA;
  
  --shadow: 0 18px 50px rgba(9, 6, 17, 0.55);
  --shadow-sm: 0 10px 25px rgba(9, 6, 17, 0.4);
  --shadow-glow: 0 0 35px rgba(255, 228, 142, 0.45);
}

/* Base resets & typography */
html {
  scroll-padding-top: 86px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', 'Nunito', sans-serif;
  line-height: 1.6;
  transition: background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              color 0.4s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Silky smooth transition between Day & Night theme states */
body, 
.retro-window, 
.retro-taskbar, 
.navbar-clay-pill, 
.nav-link-pill, 
.dreamland-status-pill, 
.desktop-bg-pattern, 
.ambient-glow-layer,
.floating-note,
.button,
.nav-theme-toggle-pill,
.tray-theme-toggle-btn {
  transition: background-color 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.4s ease,
              box-shadow 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: 'Nunito', sans-serif;
  letter-spacing: -0.02em;
}

/* Static, zero-repaint ambient glow layer */
.ambient-glow-layer {
  background: 
    radial-gradient(circle at 18% 12%, rgba(255, 157, 187, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 82% 75%, rgba(169, 139, 255, 0.16) 0%, transparent 48%),
    radial-gradient(circle at 35% 55%, rgba(201, 238, 228, 0.15) 0%, transparent 42%);
  contain: strict;
  transform: translateZ(0);
}

html.dark-theme .ambient-glow-layer, body.is-night .ambient-glow-layer {
  background: 
    radial-gradient(circle at 18% 12%, rgba(255, 153, 188, 0.13) 0%, transparent 45%),
    radial-gradient(circle at 82% 75%, rgba(184, 155, 255, 0.15) 0%, transparent 48%),
    radial-gradient(circle at 35% 55%, rgba(123, 229, 203, 0.1) 0%, transparent 42%);
}

/* Subtle background stars & pattern */
.desktop-bg-pattern {
  background-image: 
    radial-gradient(var(--line) 1px, transparent 1px),
    radial-gradient(var(--pink) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: 0 0, 18px 18px;
  opacity: 0.35;
  transition: opacity 0.4s ease;
  contain: strict;
}

html.dark-theme .desktop-bg-pattern, body.is-night .desktop-bg-pattern {
  opacity: 0.18;
  background-image: 
    radial-gradient(var(--butter) 1px, transparent 1px),
    radial-gradient(var(--lilac) 1px, transparent 1px);
}

/* ============================================================== */
/* LUXURIOUS STAGGERED SCROLL REVEALS                             */
/* ============================================================== */
[data-reveal], .reveal-on-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

[data-reveal].revealed, .reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ============================================================== */
/* SMART AUTO-HIDING TOPBAR (CLAYMORPHIC GLOSSY PILL)            */
/* ============================================================== */
#main-navbar {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

#main-navbar.navbar-hidden {
  transform: translateY(-135%);
  opacity: 0;
  pointer-events: none;
}

.navbar-clay-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 246, 249, 0.9) 100%);
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 9999px;
  box-shadow: 
    0 16px 36px -6px rgba(255, 175, 195, 0.45),
    0 4px 12px rgba(169, 139, 255, 0.1),
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    inset 0 -2px 3px rgba(255, 195, 210, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html.dark-theme .navbar-clay-pill, body.is-night .navbar-clay-pill {
  background: linear-gradient(180deg, rgba(46, 36, 66, 0.94) 0%, rgba(32, 24, 48, 0.94) 100%);
  border: 2px solid rgba(184, 155, 255, 0.35);
  box-shadow: 
    0 16px 36px -6px rgba(9, 6, 17, 0.7),
    0 0 25px rgba(184, 155, 255, 0.18),
    inset 0 2px 2px rgba(255, 255, 255, 0.2),
    inset 0 -2px 2px rgba(0, 0, 0, 0.45);
}

/* 3D Glossy Jelly Dots */
.jelly-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.jelly-dot:hover { transform: scale(1.3); }

.jelly-dot-pink {
  background: radial-gradient(circle at 35% 35%, #FFA5C8 0%, #FF3D82 65%, #C91656 100%);
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 5px rgba(255, 61, 130, 0.45);
}
.jelly-dot-yellow {
  background: radial-gradient(circle at 35% 35%, #FFF099 0%, #FFBE1A 65%, #D68F00 100%);
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 5px rgba(255, 190, 26, 0.45);
}
.jelly-dot-teal {
  background: radial-gradient(circle at 35% 35%, #92FCEB 0%, #18D8B6 65%, #0B9E83 100%);
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 5px rgba(24, 216, 182, 0.45);
}

/* Vertical Pill Divider */
.pill-divider {
  width: 1.5px;
  height: 24px;
  background: rgba(225, 200, 215, 0.55);
}
html.dark-theme .pill-divider, body.is-night .pill-divider {
  background: rgba(184, 155, 255, 0.25);
}

/* Active Nav Pill (Glossy 3D Pink Bubble) */
.nav-link-pill {
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  padding: 6px 14px;
  border-radius: 9999px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #4A355A;
  border: 1.5px solid transparent;
}

html.dark-theme .nav-link-pill, body.is-night .nav-link-pill {
  color: #DDD0EC;
}

.nav-link-pill:hover {
  color: #7954D8;
  background: rgba(255, 235, 242, 0.5);
  transform: translateY(-1px);
}

.nav-link-pill.active {
  background: linear-gradient(180deg, #FFEBF2 0%, #FFD6E5 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 
    inset 0 2px 3px rgba(255, 255, 255, 0.9),
    inset 0 -2px 3px rgba(255, 160, 190, 0.35),
    0 3px 8px rgba(255, 175, 195, 0.35);
  color: #4A1D3B;
  font-weight: 800;
}

html.dark-theme .nav-link-pill.active, body.is-night .nav-link-pill.active {
  background: linear-gradient(180deg, #533B6B 0%, #432E58 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 -2px 2px rgba(0, 0, 0, 0.3),
    0 3px 8px rgba(0, 0, 0, 0.4);
  color: #FFF2FA;
}

/* Dreamland Status Pill */
.dreamland-status-pill {
  background: rgba(235, 252, 248, 0.75);
  border: 1.5px solid rgba(190, 242, 232, 0.9);
  border-radius: 9999px;
  padding: 5px 13px;
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    0 2px 6px rgba(100, 220, 190, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

html.dark-theme .dreamland-status-pill, body.is-night .dreamland-status-pill {
  background: rgba(30, 48, 54, 0.65);
  border-color: rgba(92, 225, 230, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dreamland-sphere {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  background: radial-gradient(circle at 35% 35%, #92FCEB 0%, #15D2B0 65%, #0B9E83 100%);
  box-shadow: 0 0 8px rgba(21, 210, 176, 0.7);
  display: inline-block;
}

/* 3D Star Button on Far Right */
.navbar-star-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF2F6 100%);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    inset 0 -2px 3px rgba(255, 185, 205, 0.38),
    0 4px 12px rgba(255, 175, 195, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  font-size: 19px;
}

html.dark-theme .navbar-star-btn, body.is-night .navbar-star-btn {
  background: linear-gradient(180deg, #483761 0%, #36284D 100%);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 
    inset 0 2px 2px rgba(255, 255, 255, 0.2),
    inset 0 -2px 2px rgba(0, 0, 0, 0.4),
    0 4px 14px rgba(0, 0, 0, 0.5);
}

.navbar-star-btn:hover {
  transform: scale(1.12) rotate(8deg);
  box-shadow: 
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    0 6px 18px rgba(255, 175, 195, 0.6);
}

.navbar-star-btn:active {
  transform: scale(0.95);
}

/* ============================================================== */
/* RETRO GLASS WINDOWS & PANELS                                   */
/* ============================================================== */
.retro-window, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.28s ease, background 0.4s ease, border-color 0.4s ease;
}

.retro-window:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 25px rgba(169, 139, 255, 0.15);
}

.retro-window-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: calc(var(--radius) - 2px);
  border-top-right-radius: calc(var(--radius) - 2px);
  padding: 0.65rem 1.1rem;
}

/* Candy Window Action Dots */
.candy-dot {
  width: 11px;
  height: 11px;
  border-radius: 9999px;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}
.candy-dot:hover { transform: scale(1.25); }
.candy-dot-red { background-color: #FF8BA7; }
.candy-dot-yellow { background-color: #FFD36D; }
.candy-dot-green { background-color: #82D8A7; }

/* Status dot with gentle pulse ring */
.status-dot, .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #82D8A7;
  display: inline-block;
  box-shadow: 0 0 0 4px #DDF4E7;
}

html.dark-theme .status-dot, body.is-night .status-dot {
  box-shadow: 0 0 0 4px rgba(130, 216, 167, 0.25);
}

/* ============================================================== */
/* COSMIC ORBITAL RINGS & FLOATING NOTES                          */
/* ============================================================== */
.orbit {
  position: absolute;
  border: 1px solid rgba(183, 153, 222, 0.32);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-26deg);
  z-index: -2;
  pointer-events: none;
}
.orbit-one { width: 440px; height: 230px; }
.orbit-two { width: 510px; height: 290px; transform: translate(-50%, -50%) rotate(54deg); border-color: rgba(244, 178, 189, 0.32); }

@media (max-width: 640px) {
  .orbit-one { width: 290px; height: 160px; }
  .orbit-two { width: 340px; height: 200px; }
}

.floating-note {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(104, 75, 126, 0.08);
  z-index: 4;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.note-top { top: 12%; right: -2%; transform: rotate(3deg); }
.note-bottom { bottom: 8%; left: -3%; transform: rotate(-3deg); }

/* Eyebrow badge */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--lilac-deep);
  box-shadow: 0 4px 15px rgba(173, 140, 180, 0.08);
  text-transform: uppercase;
}

/* Gradient typography */
.gradient-text {
  background: linear-gradient(100deg, #936FE8 0%, #E28DBB 52%, #E5AD56 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================== */
/* TICKER REMINDER MARQUEE                                        */
/* ============================================================== */
.ticker {
  overflow: hidden;
  background: #F0E8FF;
  border-block: 1px solid #E4D5FB;
  transform: rotate(-0.9deg) scale(1.02);
  margin: 18px -15px 0;
  position: relative;
  z-index: 10;
  contain: paint;
  will-change: transform;
}

html.dark-theme .ticker, body.is-night .ticker {
  background: #3B2F51;
  border-color: #4B3A5C;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 28px;
  white-space: nowrap;
  width: max-content;
  padding: 12px 0;
  animation: ticker-move 32s linear infinite;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 1.8px;
  color: #7D68AE;
  will-change: transform;
  transform: translateZ(0);
}

html.dark-theme .ticker-track, body.is-night .ticker-track {
  color: #CBB9E8;
}

.ticker-track b { color: #E28DBB; font-size: 16px; }

@keyframes ticker-move {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============================================================== */
/* CRISP HD WOBBLE RENDERING                                      */
/* ============================================================== */
.wobble-img-hd {
  mix-blend-mode: normal !important;
  image-rendering: auto;
  filter: drop-shadow(0 14px 28px rgba(169, 139, 255, 0.28));
  transition: filter 0.35s ease, transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

html.dark-theme .wobble-img-hd, body.is-night .wobble-img-hd {
  filter: drop-shadow(0 14px 30px rgba(184, 155, 255, 0.45)) drop-shadow(0 0 18px rgba(255, 228, 142, 0.35));
}

/* Floating animation */
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.animate-wobble-float {
  animation: floaty 5.5s ease-in-out infinite;
}

@keyframes squishBounce {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.18, 0.82); }
  45% { transform: scale(0.9, 1.14); }
  65% { transform: scale(1.06, 0.95); }
  85% { transform: scale(0.98, 1.02); }
  100% { transform: scale(1, 1); }
}

.animate-squish {
  animation: squishBounce 0.58s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================== */
/* BUTTONS & CONTROLS                                             */
/* ============================================================== */
.button, .btn-wobble-primary {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  color: #FFF;
  background: linear-gradient(120deg, #9878E9, #C78FE6 55%, #F4A2B9);
  box-shadow: 0 10px 24px rgba(177, 139, 229, 0.28);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.button:hover, .btn-wobble-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(177, 139, 229, 0.4);
}

.btn-wobble-secondary, .button-soft {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--lilac-deep);
  box-shadow: 0 6px 16px rgba(145, 113, 164, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.btn-wobble-secondary:hover, .button-soft:hover {
  transform: translateY(-3px);
  background: var(--surface-2);
}

/* ============================================================== */
/* REAL-TIME SCREEN COMPANION MASCOT                              */
/* ============================================================== */
#desktop-companion {
  position: fixed;
  z-index: 999;
  width: 140px;
  height: 140px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 12px 28px rgba(169, 139, 255, 0.4));
  user-select: none;
  will-change: transform;
}

@media (max-width: 640px) {
  #desktop-companion { width: 100px; height: 100px; }
}

#desktop-companion:active { cursor: grabbing; }

#companion-speech-bubble {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  max-width: 250px;
  white-space: normal;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(104, 75, 126, 0.16);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 30;
}

#companion-speech-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--surface) transparent transparent transparent;
}

#desktop-companion:hover #companion-speech-bubble,
#desktop-companion.speaking #companion-speech-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#companion-speech-bubble.bubble-bottom {
  bottom: auto;
  top: 115%;
}
#companion-speech-bubble.bubble-bottom::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent var(--surface) transparent;
}
#companion-speech-bubble.bubble-right {
  left: 105%;
  transform: translateY(-50%);
}
#companion-speech-bubble.bubble-right::after {
  top: 50%;
  left: auto;
  right: 100%;
  transform: translateY(-50%);
  border-color: transparent var(--surface) transparent transparent;
}
#companion-speech-bubble.bubble-left {
  left: auto;
  right: 105%;
  transform: translateY(-50%);
}
#companion-speech-bubble.bubble-left::after {
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  border-color: transparent transparent transparent var(--surface);
}

/* Retro Taskbar */
.retro-taskbar {
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(104, 75, 126, 0.05);
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* Inputs & Form styling */
input, textarea {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus {
  border-color: var(--lilac) !important;
  box-shadow: 0 0 0 3px rgba(169, 139, 255, 0.25) !important;
}

/* Custom scrollbar for modal dialog */
.custom-modal-scroll::-webkit-scrollbar {
  width: 5px;
}
.custom-modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.custom-modal-scroll::-webkit-scrollbar-thumb {
  background: var(--pink);
  border-radius: 9999px;
}

/* Playroom Canvases */
#drawing-canvas, #game-canvas, #garden-canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

#drawing-canvas {
  cursor: crosshair;
  background-color: #FFFFFF;
}

#game-canvas {
  cursor: pointer;
  background: linear-gradient(180deg, #1A122C 0%, #301F4A 60%, #4D2D68 100%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--pink);
  border-radius: 9999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--lilac);
}

/* Sparkle Canvas */
#sparkle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

/* Easter Egg Aura */
.easter-egg-aura {
  animation: rainbowSpin 3s linear infinite;
  box-shadow: 0 0 45px var(--butter), 0 0 80px var(--pink), 0 0 110px var(--mint);
}

@keyframes rainbowSpin {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* Accessible Visible Focus Rings */
:focus-visible {
  outline: 3px solid var(--lilac);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Reduced Motion for Accessibility and Performance */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal], .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ============================================================== */
/* HIDDEN COLLECTIBLE DREAM ORBS (CRITERION C)                    */
/* ============================================================== */
.dream-orb {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFFFFF 0%, #FF9DBB 45%, #A98BFF 100%);
  box-shadow: 0 0 16px rgba(255, 157, 187, 0.8), 0 0 28px rgba(169, 139, 255, 0.6);
  cursor: pointer;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  user-select: none;
  animation: dreamFloat 3.5s ease-in-out infinite;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.dream-orb:hover {
  transform: scale(1.35);
  box-shadow: 0 0 24px rgba(255, 231, 157, 0.95), 0 0 38px rgba(255, 157, 187, 0.9);
}

.dream-orb.collected {
  pointer-events: none;
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

@keyframes dreamFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.08); }
}

.crown-aura {
  animation: crownPulse 2.5s ease-in-out infinite;
}

@keyframes crownPulse {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(255, 231, 157, 0.8)) drop-shadow(0 0 30px rgba(169, 139, 255, 0.6)); }
  50% { filter: drop-shadow(0 0 25px rgba(255, 231, 157, 1)) drop-shadow(0 0 45px rgba(255, 157, 187, 0.8)); }
}

/* ============================================================== */
/* WINDOW CONTROLS & DYNAMIC INTERACTIONS                         */
/* ============================================================== */
.retro-window.window-collapsed .retro-window-body {
  display: none !important;
}

@keyframes windowBoing {
  0% { transform: scale(1); }
  28% { transform: scale(1.03, 0.96); }
  58% { transform: scale(0.98, 1.02); }
  100% { transform: scale(1); }
}

.window-boing {
  animation: windowBoing 0.38s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================== */
/* RETRO START MENU (EARLY-WEB DESKTOP OS 98)                    */
/* ============================================================== */
.retro-start-menu {
  position: fixed;
  bottom: 56px;
  left: 12px;
  z-index: 9999;
  width: 295px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(78, 52, 98, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
  display: flex;
  overflow: hidden;
  animation: startMenuOpen 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom left;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes startMenuOpen {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.start-menu-sidebar {
  width: 44px;
  background: linear-gradient(180deg, var(--lilac-deep) 0%, #D882B5 60%, #FF9DBB 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16px;
  user-select: none;
}

.start-menu-sidebar-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  color: #FFF;
  font-size: 13.5px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.start-menu-content {
  flex: 1;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.start-menu-item:hover {
  background: var(--surface-2);
  border-color: var(--line);
  transform: translateX(4px);
  color: var(--lilac-deep);
}

.start-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

/* ============================================================== */
/* RETRO TOY BOX & BUBBLE WRAP POPPER                             */
/* ============================================================== */
.bubble-wrap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 8px;
  max-width: 280px;
  margin: 0 auto;
}

.bubble-wrap-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(255, 175, 195, 0.7) 45%, rgba(201, 139, 255, 0.85) 100%);
  box-shadow: inset -2px -2px 5px rgba(169, 139, 255, 0.4), 0 4px 10px rgba(255, 157, 187, 0.35);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.85);
  user-select: none;
}

.bubble-wrap-cell:hover:not(.popped) {
  transform: scale(1.12);
}

.bubble-wrap-cell:active:not(.popped) {
  transform: scale(0.9);
}

.bubble-wrap-cell.popped {
  background: var(--surface-2);
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.12);
  border: 2px dashed var(--line);
  transform: scale(0.85);
  opacity: 0.55;
  cursor: default;
}

/* Cosmic Mood Oracle 8-Ball */
.cosmic-orb {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #684E82 0%, #261D3A 70%, #110B1C 100%);
  border: 3px solid rgba(255, 231, 157, 0.6);
  box-shadow: 0 10px 28px rgba(33, 27, 53, 0.35), inset 0 0 20px rgba(184, 155, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.cosmic-orb:hover {
  transform: scale(1.08) rotate(5deg);
}

.cosmic-orb.shaking {
  animation: orbShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes orbShake {
  10%, 90% { transform: translate3d(-3px, 0, 0) rotate(-4deg); }
  20%, 80% { transform: translate3d(5px, 0, 0) rotate(4deg); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0) rotate(-6deg); }
  40%, 60% { transform: translate3d(6px, 0, 0) rotate(6deg); }
}

/* ============================================================== */
/* RETRO ACHIEVEMENT TOAST NOTIFICATIONS                          */
/* ============================================================== */
.achievement-toast {
  position: fixed;
  bottom: 64px;
  right: 18px;
  z-index: 10000;
  background: var(--surface);
  border: 2px solid var(--butter);
  border-radius: 18px;
  padding: 10px 18px;
  box-shadow: 0 14px 34px rgba(78, 52, 98, 0.22), 0 0 25px rgba(255, 231, 157, 0.45);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.achievement-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================================== */
/* TWIG THE LIVING GOLDEN STAR ENTITY                             */
/* ============================================================== */
.twig-star-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  filter: drop-shadow(0 2px 8px rgba(255, 231, 157, 0.7));
  user-select: none;
}

.twig-star-badge:hover {
  transform: scale(1.22) rotate(12deg);
  filter: drop-shadow(0 4px 16px rgba(255, 211, 109, 0.95));
}

.twig-star-badge.spinning {
  animation: starSpin 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes starSpin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.45) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* ============================================================== */
/* COZY STARGAZING CONSTELLATION ENDING                           */
/* ============================================================== */
.constellation-wrapper {
  background: radial-gradient(circle at 50% 40%, rgba(50, 38, 77, 0.92) 0%, rgba(20, 15, 33, 0.98) 100%);
  border: 1px solid rgba(169, 139, 255, 0.35);
  border-radius: 24px;
  box-shadow: 0 16px 45px rgba(15, 11, 26, 0.5), inset 0 0 35px rgba(169, 139, 255, 0.15);
  position: relative;
  overflow: hidden;
}

#constellation-canvas {
  touch-action: none;
  cursor: pointer;
  display: block;
}

/* ============================================================== */
/* LUXURY THEME TRANSITION PORTAL (WOBBLE DAY & NIGHT)             */
/* Super smooth, elegantly premium full-screen celestial transition */
/* ============================================================== */
.theme-transition-portal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.38s ease,
              transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.theme-transition-portal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

.theme-transition-portal.portal-exit {
  opacity: 0;
  transform: scale(1.08);
  filter: blur(8px);
  pointer-events: none;
  transition: opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dynamic Ambient Backdrop */
.portal-backdrop {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  transition: background 0.4s ease;
  z-index: 1;
}

.theme-transition-portal.to-night .portal-backdrop {
  background: radial-gradient(ellipse at 50% 46%, rgba(38, 25, 68, 0.94) 0%, rgba(14, 10, 26, 0.98) 100%);
}

.theme-transition-portal.to-day .portal-backdrop {
  background: radial-gradient(ellipse at 50% 46%, rgba(255, 250, 240, 0.96) 0%, rgba(255, 226, 210, 0.98) 100%);
}

/* Celestial glow aura behind the stage */
.portal-celestial-canvas-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.portal-glow-halo {
  width: 420px;
  height: 420px;
  border-radius: 50%;
  position: absolute;
  filter: blur(55px);
  opacity: 0.65;
  transition: all 0.4s ease;
}

.theme-transition-portal.to-night .portal-glow-halo {
  background: radial-gradient(circle, rgba(184, 155, 255, 0.45) 0%, rgba(123, 229, 203, 0.25) 45%, transparent 70%);
  animation: celestialMoonPulse 4s ease-in-out infinite alternate;
}

.theme-transition-portal.to-day .portal-glow-halo {
  background: radial-gradient(circle, rgba(255, 228, 142, 0.6) 0%, rgba(255, 153, 188, 0.35) 45%, transparent 70%);
  animation: celestialSunPulse 4s ease-in-out infinite alternate;
}

@keyframes celestialMoonPulse {
  0% { transform: scale(0.92) rotate(0deg); opacity: 0.55; }
  100% { transform: scale(1.15) rotate(15deg); opacity: 0.85; }
}

@keyframes celestialSunPulse {
  0% { transform: scale(0.95) rotate(0deg); opacity: 0.65; }
  100% { transform: scale(1.22) rotate(-15deg); opacity: 0.95; }
}

/* Floating particles container */
.portal-particles-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* Central Dream Stage */
.portal-stage {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  width: 90%;
  padding: 2.25rem 2rem;
  border-radius: 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.4s ease;
}

.theme-transition-portal.to-night .portal-stage {
  background: rgba(48, 39, 67, 0.65);
  border: 1.5px solid rgba(184, 155, 255, 0.35);
  box-shadow: 0 24px 65px rgba(10, 6, 20, 0.65), inset 0 0 40px rgba(184, 155, 255, 0.12);
}

.theme-transition-portal.to-day .portal-stage {
  background: rgba(255, 253, 251, 0.72);
  border: 1.5px solid rgba(255, 222, 173, 0.7);
  box-shadow: 0 24px 60px rgba(120, 90, 80, 0.15), inset 0 0 35px rgba(255, 240, 200, 0.4);
}

/* Mascot Presentation Container */
.portal-mascot-container {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .portal-mascot-container {
    width: 250px;
    height: 250px;
  }
}

.portal-celestial-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  pointer-events: none;
  transition: all 0.4s ease;
}

.theme-transition-portal.to-night .portal-celestial-ring {
  border: 2px dashed rgba(184, 155, 255, 0.45);
  box-shadow: 0 0 30px rgba(184, 155, 255, 0.35);
  animation: celestialRingSpin 24s linear infinite;
}

.theme-transition-portal.to-day .portal-celestial-ring {
  border: 2px dashed rgba(255, 210, 110, 0.55);
  box-shadow: 0 0 35px rgba(255, 220, 120, 0.45);
  animation: celestialRingSpin 24s linear infinite reverse;
}

@keyframes celestialRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.portal-image-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.portal-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.22));
}

.theme-transition-portal.active .portal-mascot-img {
  animation: portalMascotEnter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             portalMascotBob 3.2s ease-in-out 0.55s infinite alternate;
}

@keyframes portalMascotEnter {
  0% {
    opacity: 0;
    transform: scale(0.68) translateY(28px);
    filter: blur(8px) drop-shadow(0 0 0 rgba(0,0,0,0));
  }
  70% {
    opacity: 1;
    transform: scale(1.05) translateY(-6px);
    filter: blur(0) drop-shadow(0 20px 32px rgba(0,0,0,0.25));
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0) drop-shadow(0 16px 28px rgba(0,0,0,0.22));
  }
}

@keyframes portalMascotBob {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-10px) scale(1.02); }
}

/* Floating Elements (Zzz for night, Sparkles for day) */
.portal-floating-elements {
  position: absolute;
  inset: -20px;
  pointer-events: none;
  z-index: 12;
}

.floating-zzz-char {
  position: absolute;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  color: #FFE48E;
  text-shadow: 0 0 12px rgba(255, 228, 142, 0.8), 0 0 20px rgba(184, 155, 255, 0.6);
  opacity: 0;
  animation: floatUpZzz 1.4s ease-out forwards;
}

@keyframes floatUpZzz {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6) rotate(-10deg);
  }
  30% {
    opacity: 1;
    transform: translate(10px, -20px) scale(1.1) rotate(5deg);
  }
  100% {
    opacity: 0;
    transform: translate(25px, -65px) scale(1.4) rotate(15deg);
  }
}

.floating-sun-sparkle {
  position: absolute;
  font-size: 20px;
  opacity: 0;
  animation: floatSunSparkle 1.3s ease-out forwards;
}

@keyframes floatSunSparkle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4) rotate(0deg);
  }
  35% {
    opacity: 1;
    transform: translate(var(--tx, 15px), var(--ty, -25px)) scale(1.2) rotate(60deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--tx, 15px) * 1.8), calc(var(--ty, -25px) * 1.8)) scale(0.8) rotate(120deg);
  }
}

/* Portal Typography Card */
.portal-text-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.portal-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.theme-transition-portal.to-night .portal-pill-badge {
  background: rgba(184, 155, 255, 0.22);
  color: #FFE48E;
  border: 1px solid rgba(184, 155, 255, 0.4);
}

.theme-transition-portal.to-day .portal-pill-badge {
  background: rgba(255, 215, 120, 0.3);
  color: #7954D8;
  border: 1px solid rgba(255, 195, 80, 0.5);
}

.portal-badge-sparkle {
  font-size: 9px;
  animation: starSpin 3s linear infinite;
}

.portal-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0;
  transition: color 0.3s ease;
}

@media (min-width: 640px) {
  .portal-title {
    font-size: 1.85rem;
  }
}

.theme-transition-portal.to-night .portal-title {
  color: #F8EEFB;
  text-shadow: 0 2px 14px rgba(184, 155, 255, 0.4);
}

.theme-transition-portal.to-day .portal-title {
  color: #32264D;
  text-shadow: 0 2px 12px rgba(255, 210, 120, 0.35);
}

.portal-subtitle {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.88;
  line-height: 1.4;
  font-weight: 600;
  transition: color 0.3s ease;
}

.theme-transition-portal.to-night .portal-subtitle {
  color: #C0B2CB;
}

.theme-transition-portal.to-day .portal-subtitle {
  color: #685779;
}

/* ============================================================== */
/* ENHANCED THEME TOGGLE BUTTONS (NAVBAR & TRAY)                  */
/* ============================================================== */
.nav-theme-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.75rem 0.32rem 0.4rem;
  border-radius: 9999px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-theme-toggle-pill:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: var(--lilac);
  box-shadow: 0 4px 14px rgba(169, 139, 255, 0.25);
}

.nav-theme-toggle-pill:active {
  transform: translateY(1px) scale(0.96);
}

.tray-theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tray-theme-toggle-btn:hover {
  transform: scale(1.05);
  border-color: var(--lilac);
  box-shadow: 0 2px 10px rgba(169, 139, 255, 0.2);
}

/* Hero Mascot Morphing Animation on Theme Switch */
.hero-wobble-morph {
  animation: heroMascotThemeMorph 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes heroMascotThemeMorph {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  35% {
    transform: scale(0.85) rotate(-3deg);
    filter: brightness(1.25) drop-shadow(0 0 35px rgba(255, 230, 150, 0.9));
  }
  70% {
    transform: scale(1.08) rotate(2deg);
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .theme-transition-portal,
  .theme-transition-portal.portal-exit,
  .portal-mascot-img,
  .hero-wobble-morph {
    animation: none !important;
    transition: opacity 0.2s ease !important;
    transform: none !important;
  }
}

/* ============================================================== */
/* SCROLL-DRIVEN STORYBOOK STYLING                                */
/* ============================================================== */
.story-scroll-track {
  position: relative;
}

.story-pip {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.story-pip:hover {
  border-color: var(--lilac);
  transform: scale(1.1);
  color: var(--ink);
}

.story-pip.active {
  background: var(--lilac-deep);
  color: #FFFFFF;
  border-color: var(--lilac-deep);
  transform: scale(1.18);
  box-shadow: 0 0 12px rgba(121, 84, 216, 0.5);
}

html.dark-theme .story-pip.active,
body.is-night .story-pip.active {
  background: var(--lilac);
  color: #211B35;
  border-color: var(--lilac);
  box-shadow: 0 0 14px rgba(184, 155, 255, 0.6);
}

/* ============================================================== */
/* 3D INTERACTIVE STORYBOOK PAGE-TURN FLIP ANIMATION (TIER 2)      */
/* ============================================================== */
.story-page-viewport {
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

.story-page-sheet {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.page-flip-forward {
  animation: pageTurnForward 0.58s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.page-flip-backward {
  animation: pageTurnBackward 0.58s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pageTurnForward {
  0% {
    transform: rotateY(0deg) scale(1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  }
  45% {
    transform: rotateY(-35deg) scale(0.96) translateZ(15px);
    box-shadow: -15px 15px 35px rgba(100, 70, 120, 0.22);
    filter: brightness(0.94);
  }
  100% {
    transform: rotateY(0deg) scale(1) translateZ(0);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    filter: brightness(1);
  }
}

@keyframes pageTurnBackward {
  0% {
    transform: rotateY(0deg) scale(1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  }
  45% {
    transform: rotateY(35deg) scale(0.96) translateZ(15px);
    box-shadow: 15px 15px 35px rgba(100, 70, 120, 0.22);
    filter: brightness(0.94);
  }
  100% {
    transform: rotateY(0deg) scale(1) translateZ(0);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    filter: brightness(1);
  }
}

/* ============================================================== */
/* FLASHLIGHT / NIGHTLIGHT CURSOR: DARK DREAM LAYERS (TIER 2)     */
/* ============================================================== */
#dream-flashlight-canvas-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

#dream-flashlight-canvas-wrap.active {
  opacity: 1;
}

/* ============================================================== */
/* DREAM DELIVERY MAP ANIMATION: SVG PATH SYNCED (TIER 2)         */
/* ============================================================== */
#delivery-flight-courier {
  will-change: transform, left, top;
}

/* ============================================================== */
/* 3D WEBGL & THREE.JS CHARACTER STUDIO (TIER 3)                  */
/* ============================================================== */
#wobble-3d-canvas {
  touch-action: none;
  cursor: grab;
  user-select: none;
}

#wobble-3d-canvas:active {
  cursor: grabbing;
}

/* ============================================================== */
/* INTERACTIVE CHAT & VISITOR MEMORY (TIER 3)                     */
/* ============================================================== */
#wobble-chat-modal .custom-modal-scroll::-webkit-scrollbar,
#visitor-memory-modal .custom-modal-scroll::-webkit-scrollbar {
  width: 5px;
}

#wobble-chat-modal .custom-modal-scroll::-webkit-scrollbar-thumb,
#visitor-memory-modal .custom-modal-scroll::-webkit-scrollbar-thumb {
  background: var(--lilac-light);
  border-radius: 9999px;
}

#companion-chat-pill {
  animation: pulse-soft 3s infinite ease-in-out;
}

@keyframes pulse-soft {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* ============================================================== */
/* PLAYROOM PROJECT LAUNCHER CARDS & POPUP WINDOW                */
/* ============================================================== */
.project-launcher-card {
  outline: none;
  border-radius: var(--radius);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, border-color 0.25s ease;
  user-select: none;
}

.project-launcher-card:hover {
  transform: translateY(-5px);
  border-color: var(--butter);
  box-shadow: 0 12px 30px -5px rgba(255, 175, 195, 0.35), 0 0 20px rgba(169, 139, 255, 0.2);
}

html.dark-theme .project-launcher-card:hover, body.is-night .project-launcher-card:hover {
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(184, 155, 255, 0.25);
}

.project-launcher-card:active {
  transform: translateY(-2px) scale(0.99);
}

.project-launcher-card:focus-visible {
  outline: 3px solid var(--butter);
  outline-offset: 3px;
}

/* Playroom Popup Modal & Window Animation */
#playroom-project-modal {
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}

#playroom-modal-window {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  will-change: transform;
}

#playroom-modal-window .custom-modal-scroll::-webkit-scrollbar {
  width: 6px;
}

#playroom-modal-window .custom-modal-scroll::-webkit-scrollbar-thumb {
  background: var(--lilac-light);
  border-radius: 9999px;
}

@media (prefers-reduced-motion: reduce) {
  .project-launcher-card,
  #playroom-project-modal,
  #playroom-modal-window,
  .polaroid-card-inner {
    transition: none !important;
    transform: none !important;
  }
}

/* ============================================================== */
/* WOBBLE RETRO POLAROID PHOTO BOOTH                             */
/* ============================================================== */
.polaroid-perspective-wrapper {
  perspective: 1100px;
}

.polaroid-card-inner {
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.polaroid-card-inner.flipped {
  transform: rotateY(180deg);
}

.polaroid-front, .polaroid-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.polaroid-back {
  transform: rotateY(180deg);
}

.polaroid-front:hover {
  box-shadow: 0 16px 36px -8px rgba(169, 139, 255, 0.35), 0 0 15px rgba(255, 231, 157, 0.3);
}

/* Flash overlay transition */
#polaroid-flash-overlay.flash-active {
  opacity: 1 !important;
  transition: opacity 0.05s ease-in;
}

/* Confetti Particles */
.booth-confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  font-size: 1.25rem;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 1.2s ease-out;
}

