/* ============================================
   SAILI'S BIRTHDAY QUEST — premium stylesheet
   Palette: Twilight Dark-Mode with Gold Accents
   ============================================ */

:root {
  --night: #14050f; /* Deep dark velvet wine */
  --twilight: #23081b; /* Rich dark plum */
  --twilight-light: #3d0c2e; /* Muted deep berry rose */
  --gold: #ffd166; /* Glowing warm gold for keys and accents */
  --gold-glow: rgba(255, 209, 102, 0.35);
  --rose: #ff758f; /* Bright baby pink/rose */
  --rose-glow: rgba(255, 117, 143, 0.4);
  --lavender: #ffccd5; /* Soft pastel pink for subtexts */
  --glow: #fff0f3; /* Glowing soft pink-white for main titles/texts */
  --card-bg: rgba(35, 8, 27, 0.6); /* Glassmorphic dark plum card */
  --card-border: rgba(255, 117, 143, 0.2); /* Soft rose border */
  
  --display-font: 'Fredoka', sans-serif;
  --body-font: 'Quicksand', sans-serif;
  --script-font: 'Caveat', cursive;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--night);
  color: var(--glow);
  font-family: var(--body-font);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ---------- Ambient starfield ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 10% 20%, var(--glow) 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 10%, var(--glow) 50%, transparent 50%),
    radial-gradient(2px 2px at 30% 65%, var(--gold) 50%, transparent 50%),
    radial-gradient(1px 1px at 60% 80%, var(--glow) 50%, transparent 50%),
    radial-gradient(1px 1px at 90% 45%, var(--lavender) 50%, transparent 50%),
    radial-gradient(2px 2px at 45% 30%, var(--glow) 50%, transparent 50%),
    radial-gradient(1px 1px at 15% 90%, var(--lavender) 50%, transparent 50%),
    radial-gradient(2.5px 2.5px at 75% 60%, var(--gold) 50%, transparent 50%);
  background-repeat: repeat;
  background-size: 100% 100%;
  opacity: 0.5;
  animation: twinkle 5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes twinkle {
  0% { opacity: 0.35; }
  100% { opacity: 0.75; }
}

/* Global Celebration Background Canvas */
#globalCelebrationCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.75;
}

.hidden {
  display: none !important;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--display-font);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: var(--night);
  box-shadow: 0 8px 20px var(--rose-glow);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 26px rgba(255, 111, 156, 0.5);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* ---------- STAGE 0: GATE SCREEN ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, var(--twilight-light), var(--night) 85%);
  padding: 24px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.gate.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 500px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 40px 30px;
  border-radius: 28px;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.gate-butterfly {
  font-size: 4rem;
  display: inline-block;
  animation: flutter 3s ease-in-out infinite;
}

@keyframes flutter {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

.gate-title {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 1.2;
  margin-top: 15px;
}

.gate-title span {
  color: var(--gold);
  font-family: var(--script-font);
  font-size: 1.4em;
  font-weight: 600;
  text-shadow: 0 0 15px var(--gold-glow);
}

.gate-sub {
  color: var(--lavender);
  font-size: 1rem;
  line-height: 1.6;
  margin: 15px 0 25px;
}

.gate-question-box {
  background: rgba(20, 5, 15, 0.55);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(255, 117, 143, 0.12);
}

.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 20px;
  color: var(--glow);
}

.gate-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  position: relative;
  min-height: 55px;
}

.btn-yes {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
  position: relative;
  z-index: 10;
}

.btn-no {
  background: rgba(255, 255, 255, 0.15);
  color: var(--glow);
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
  z-index: 10;
  transition: transform 0.2s ease;
}

.btn-no.runaway {
  position: fixed;
  transition: top 0.15s cubic-bezier(0.19, 1, 0.22, 1), left 0.15s cubic-bezier(0.19, 1, 0.22, 1), transform 0.15s ease;
}

/* ---------- MUSIC TOGGLE ---------- */
.music-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--twilight-light);
  border: 1px solid rgba(255, 209, 102, 0.3);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.music-toggle:hover {
  transform: scale(1.08);
  background: var(--twilight);
}

/* ---------- HEROHEADER ---------- */
.hero-header {
  position: relative;
  text-align: center;
  padding: 60px 20px 40px;
  overflow: hidden;
}

.confetti-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--lavender);
  text-transform: lowercase;
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 10px;
}

.name-glow {
  font-family: var(--script-font);
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow), 0 0 40px var(--rose-glow);
  display: inline-block;
  animation: glow-pulse 3s ease-in-out infinite alternate;
  font-size: 1.25em;
}

@keyframes glow-pulse {
  0% { text-shadow: 0 0 15px var(--gold-glow), 0 0 30px var(--rose-glow); }
  100% { text-shadow: 0 0 30px var(--gold), 0 0 60px var(--rose); }
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--lavender);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- GENERAL SECTIONS ---------- */
.section {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 50px 20px;
  z-index: 10;
  text-align: center;
}

.section-title {
  font-family: var(--display-font);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin-bottom: 10px;
}

.section-sub {
  color: var(--lavender);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto 30px;
  line-height: 1.5;
}

.badge {
  background: rgba(255, 111, 156, 0.15);
  color: var(--rose);
  font-family: var(--display-font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 100px;
  display: inline-block;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 111, 156, 0.25);
}

/* ---------- QUEST MAP PATH ---------- */
.quest-map-container {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 40px 20px;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.map-path-line {
  position: absolute;
  top: 50px;
  left: 10%;
  right: 10%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  z-index: 1;
}

.map-path-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--gold), var(--rose));
  border-radius: 10px;
  transition: width 0.6s ease;
  box-shadow: 0 0 10px var(--rose);
}

.quest-nodes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quest-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.node-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--twilight);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
  transition: all 0.4s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.node-title {
  font-family: var(--display-font);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--lavender);
  margin-bottom: 4px;
  transition: color 0.4s ease;
}

.node-status {
  font-size: 0.75rem;
  color: rgba(185, 170, 255, 0.5);
  font-weight: 500;
}

/* Node States */
.quest-node.active .node-icon {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  border-color: var(--gold);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255, 209, 102, 0.4);
  color: var(--night);
}

.quest-node.active .node-title {
  color: var(--gold);
  font-weight: 600;
}

.quest-node.completed .node-icon {
  background: #10b981;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  color: white;
}

.quest-node.completed .node-title {
  color: #34d399;
}

.quest-node.locked {
  opacity: 0.55;
}

/* ---------- QUEST SECTIONS (COLLAPSE/ACTIVE) ---------- */
.quest-section {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.quest-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.quest-section.locked {
  display: none !important;
}

/* ---------- QUEST 1: SCRATCH GALLERY ---------- */
.scratch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
  margin-top: 20px;
}

.scratch-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  overflow: hidden;
  background: #18153c;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  border: 6px solid white; /* Polaroid look */
  transform: rotate(var(--rotate, 0deg));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.scratch-card:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  z-index: 5;
}

/* Tape sticker on Polaroids */
.scratch-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 25px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 10;
}

.scratch-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  border-radius: 0 !important;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  z-index: 3;
}

.scratch-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--script-font);
  font-size: 1.3rem;
  color: #333;
  background: white;
  padding: 10px 8px 12px;
  pointer-events: none;
  z-index: 2;
  border-top: 1px solid #eee;
  height: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scratch-progress {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(12, 11, 30, 0.7);
  color: var(--gold);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 100px;
  pointer-events: none;
  z-index: 4;
  font-weight: 600;
}

.hint-text {
  margin-top: 25px;
  color: var(--lavender);
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ---------- QUEST 2: BALLOON POP GAME ---------- */
.game-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  margin: 0 auto;
}

.game-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 18px;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--lavender);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--display-font);
  font-size: 2rem;
  color: var(--gold);
  font-weight: 600;
}

.game-arena {
  position: relative;
  height: 400px;
  background: radial-gradient(circle at center, var(--twilight-light) 0%, var(--night) 85%);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: rgba(20, 5, 15, 0.8);
  color: var(--glow);
}

.game-overlay.playing {
  display: none;
}

.game-result {
  font-family: var(--script-font);
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  max-width: 320px;
  padding: 0 10px;
  line-height: 1.4;
}

.game-balloon {
  position: absolute;
  width: 56px;
  height: 70px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  cursor: pointer;
  animation: rise linear forwards;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: inset -6px -6px 12px rgba(0, 0, 0, 0.15);
}

.game-balloon::after {
  content: '';
  position: absolute;
  bottom: -15px;
  width: 1.5px;
  height: 15px;
  background: rgba(245, 241, 255, 0.3);
  left: 50%;
}

@keyframes rise {
  from { transform: translateY(0); }
  to { transform: translateY(-480px); }
}

.pop-particle {
  position: absolute;
  font-family: var(--display-font);
  font-size: 1.15rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  background: rgba(20, 5, 15, 0.95);
  color: var(--gold) !important;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 209, 102, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  animation: pop-reveal-slow 3.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pop-reveal-slow {
  0% { opacity: 0; transform: scale(0.7) translateY(20px); }
  12% { opacity: 1; transform: scale(1) translateY(0); }
  85% { opacity: 1; transform: scale(1) translateY(-40px); }
  100% { opacity: 0; transform: scale(0.95) translateY(-70px); }
}

/* ---------- QUEST 3: TRIVIA RIDDLES ---------- */
.trivia-container {
  max-width: 500px;
  margin: 0 auto;
}

.trivia-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 30px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  transition: transform 0.3s ease;
}

.trivia-card.shake {
  animation: shakeCard 0.4s ease;
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.trivia-progress {
  font-size: 0.8rem;
  color: var(--rose);
  font-family: var(--display-font);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.trivia-question {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--glow);
}

.trivia-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trivia-opt {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 20px;
  border-radius: 14px;
  color: var(--glow);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
}

.trivia-opt:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--rose);
  transform: translateX(3px);
}

.trivia-opt.correct {
  background: #10b981;
  color: white;
  border-color: #34d399;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.trivia-opt.incorrect {
  background: #ef4444;
  color: white;
  border-color: #f87171;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* ---------- QUEST 4: INTERACTIVE CAKE ---------- */
.cake-wrap {
  display: flex;
  justify-content: center;
  margin: 30px 0 20px;
  perspective: 1000px;
}

.cake {
  position: relative;
  width: 250px;
  height: 250px;
  cursor: pointer;
  transform: rotateX(5deg);
  transition: transform 0.3s ease;
}

.cake:hover {
  transform: rotateX(5deg) scale(1.04);
}

.real-cake-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  background: rgba(35, 8, 27, 0.35);
  border: 1px solid rgba(255, 117, 143, 0.15);
}

.candle-wrapper {
  position: absolute;
  top: 15px; /* position it on top of the cake image */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.candle-wrapper.locked {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
  pointer-events: none;
}

.candle {
  position: relative;
  width: 8px;
  height: 50px;
  background: linear-gradient(180deg, var(--rose-soft, #ffb3c9), var(--rose));
  border-radius: 4px;
}

.candle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.3) 5px, rgba(255,255,255,0.3) 10px);
}

.flame {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 24px;
  background: radial-gradient(circle at 50% 70%, var(--gold), var(--rose) 80%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  cursor: pointer;
  animation: flicker 0.4s ease-in-out infinite alternate;
  box-shadow: 0 0 15px var(--gold), 0 0 35px var(--rose-glow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.flame.out {
  opacity: 0;
  transform: translateX(-50%) scaleY(0);
  box-shadow: none;
  pointer-events: none;
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1) rotate(-3deg); }
  100% { transform: translateX(-50%) scale(1.08) rotate(3deg); }
}

.cake-msg {
  margin-top: 18px;
  font-family: var(--script-font);
  font-size: 1.4rem;
  color: var(--gold);
}

/* ---------- SITE FOOTER ---------- */
.site-footer {
  text-align: center;
  padding: 40px 20px 50px;
  color: rgba(255, 204, 213, 0.35);
  font-size: 0.8rem;
}

/* ---------- COLLAGE & FINAL LETTER SCREEN ---------- */
.final-letter-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 5, 15, 0.88);
  backdrop-filter: blur(15px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease, visibility 1s ease;
  overflow: hidden;
}

.final-letter-screen.active {
  opacity: 1;
  visibility: visible;
}

.flying-photos-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Cloned photo items for collage */
.flying-photo-item {
  position: absolute;
  width: 180px;
  aspect-ratio: 4 / 5;
  border: 5px solid white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  background: white;
  transform-origin: center;
  transition: all 1.8s cubic-bezier(0.19, 1, 0.22, 1);
  opacity: 0;
}

.flying-photo-item img {
  width: 100%;
  height: calc(100% - 30px);
  object-fit: cover;
  display: block;
}

.flying-photo-item .collage-label {
  height: 30px;
  line-height: 26px;
  text-align: center;
  font-family: var(--script-font);
  font-size: 0.9rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

/* Polaroids tape look in collage */
.flying-photo-item::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--tape-rot, -3deg));
  width: 60px;
  height: 20px;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
}

/* Collage Final Scattered Positions */
.flying-photo-item.assembled {
  opacity: 1;
}

/* Positioning the 6 photos in a scrapbook collage layout at the center */
.flying-photo-item.assembled:nth-child(1) { left: calc(50% - 240px); top: calc(50% - 250px); transform: rotate(-8deg) scale(0.9); }
.flying-photo-item.assembled:nth-child(2) { left: calc(50% + 80px); top: calc(50% - 240px); transform: rotate(6deg) scale(0.85); }
.flying-photo-item.assembled:nth-child(3) { left: calc(50% - 280px); top: calc(50% - 20px); transform: rotate(10deg) scale(0.85); }
.flying-photo-item.assembled:nth-child(4) { left: calc(50% + 120px); top: calc(50% - 10px); transform: rotate(-5deg) scale(0.9); }
.flying-photo-item.assembled:nth-child(5) { left: calc(50% - 180px); top: calc(50% + 140px); transform: rotate(-3deg) scale(0.8); }
.flying-photo-item.assembled:nth-child(6) { left: calc(50% + 40px); top: calc(50% + 150px); transform: rotate(12deg) scale(0.85); }

/* The Letter Card overlay */
.letter-card {
  position: relative;
  z-index: 10;
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  background: linear-gradient(160deg, #fffcf5 0%, #fcf7e8 100%);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 209, 102, 0.25);
  border: 1px solid rgba(255, 209, 102, 0.4);
  padding: 35px 30px;
  text-align: center;
  color: #352f20;
  display: flex;
  flex-direction: column;
  transform: scale(0.4) rotate(-3deg);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.8s ease;
}

.letter-card.open {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

.letter-wings {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: inline-block;
  animation: flutter 2.5s ease-in-out infinite;
}

.letter-title {
  font-family: var(--display-font);
  font-size: 2rem;
  color: #c25983;
  margin-bottom: 20px;
  font-weight: 700;
}

.letter-scroll-body {
  text-align: left;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 25px;
  font-family: var(--script-font);
  font-size: 1.35rem;
  line-height: 1.6;
}

.letter-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.letter-scroll-body::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.03);
  border-radius: 10px;
}

.letter-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(194, 89, 131, 0.3);
  border-radius: 10px;
}

.letter-scroll-body p {
  margin-bottom: 15px;
}

.letter-scroll-body em {
  font-style: normal;
  color: #c25983;
  font-weight: bold;
}

.letter-sign {
  text-align: right;
  margin-top: 15px;
  color: #c25983;
}

/* ---------- RESPONSIVE DETAILS ---------- */
@media (max-width: 768px) {
  .section { padding: 40px 16px; }
  .quest-map-container { padding: 30px 15px; }
  .map-path-line { left: 12%; right: 12%; }
  .node-icon { width: 46px; height: 46px; font-size: 1.3rem; }
  .node-title { font-size: 0.8rem; }
  .node-status { font-size: 0.65rem; }
  
  .scratch-grid { gap: 20px; }
  
  /* Stacked nodes responsive */
  .quest-nodes { gap: 5px; }
  
  /* Responsive Collage - Scale down and shift positions slightly */
  .flying-photo-item {
    width: 110px;
    border: 3px solid white;
  }
  .flying-photo-item .collage-label {
    font-size: 0.7rem;
    height: 20px;
    line-height: 18px;
  }
  .flying-photo-item.assembled:nth-child(1) { left: calc(50% - 150px); top: calc(50% - 220px); }
  .flying-photo-item.assembled:nth-child(2) { left: calc(50% + 40px); top: calc(50% - 210px); }
  .flying-photo-item.assembled:nth-child(3) { left: calc(50% - 170px); top: calc(50% - 80px); }
  .flying-photo-item.assembled:nth-child(4) { left: calc(50% + 60px); top: calc(50% - 70px); }
  .flying-photo-item.assembled:nth-child(5) { left: calc(50% - 120px); top: calc(50% + 60px); }
  .flying-photo-item.assembled:nth-child(6) { left: calc(50% + 10px); top: calc(50% + 70px); }
  
  .letter-card {
    padding: 24px 20px;
    max-height: 70vh;
  }
  .letter-title { font-size: 1.6rem; margin-bottom: 15px; }
  .letter-scroll-body { font-size: 1.15rem; line-height: 1.5; }
}

@media (max-width: 480px) {
  .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
  .node-title { display: none; } /* Hide labels on tiny screens to save space */
  .node-icon { margin-bottom: 4px; }
  .map-path-line { top: 23px; }
  .scratch-grid { grid-template-columns: 1fr 1fr; }
  
  .game-arena { height: 320px; }
  .cake { transform: scale(0.8); }
}

/* ---------- FIREWORKS CANVASES ---------- */
#gateFireworksCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

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

/* ---------- STROBE LIGHTS & STROBING SCREEN ---------- */
.final-letter-screen.active {
  animation: finalstrobe 8s ease-in-out infinite;
}

@keyframes finalstrobe {
  0%, 100% {
    background: radial-gradient(circle at center, rgba(35, 8, 27, 0.95), rgba(20, 5, 15, 0.98));
    box-shadow: inset 0 0 50px rgba(255, 117, 143, 0.15);
  }
  25% {
    background: radial-gradient(circle at center, rgba(61, 12, 46, 0.95), rgba(20, 5, 15, 0.98));
    box-shadow: inset 0 0 80px rgba(255, 209, 102, 0.2);
  }
  50% {
    background: radial-gradient(circle at center, rgba(20, 40, 55, 0.95), rgba(20, 5, 15, 0.98));
    box-shadow: inset 0 0 60px rgba(255, 117, 143, 0.18);
  }
  75% {
    background: radial-gradient(circle at center, rgba(50, 15, 30, 0.95), rgba(20, 5, 15, 0.98));
    box-shadow: inset 0 0 100px rgba(255, 77, 109, 0.25);
  }
}

.strobe-light {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

.strobe-1 {
  top: -60px;
  left: -60px;
  background: var(--gold);
  animation: flash-color-1 5s ease-in-out infinite alternate;
}

.strobe-2 {
  top: -60px;
  right: -60px;
  background: var(--rose);
  animation: flash-color-2 5s ease-in-out infinite alternate-reverse;
}

@keyframes flash-color-1 {
  0% { transform: scale(1) rotate(0deg); opacity: 0.25; background: var(--gold); }
  50% { transform: scale(1.4) rotate(180deg); opacity: 0.5; background: var(--rose); }
  100% { transform: scale(0.9) rotate(360deg); opacity: 0.2; background: var(--lavender); }
}

@keyframes flash-color-2 {
  0% { transform: scale(1.3) rotate(0deg); opacity: 0.4; background: var(--rose); }
  50% { transform: scale(0.8) rotate(-180deg); opacity: 0.18; background: var(--lavender); }
  100% { transform: scale(1.5) rotate(-360deg); opacity: 0.55; background: var(--gold); }
}

