/* ─── Variables ─────────────────────────────────────────── */
:root {
  --text: #ffffff;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
}

/* ─── Body: static dark base ────────────────────────────── */
body {
  overflow: hidden;
  font-family: 'Baloo 2', cursive;
  color: var(--text);
  background: linear-gradient(160deg, #020818 0%, #0d1a3a 35%, #1e1050 65%, #4a1640 100%);
}

/* ════════════════════════════════════════════════════════════
   Z-INDEX MAP
   aurora-wrap   → 1
   stars-wrap    → 2
   shoots-wrap   → 3
   scene         → 4   (intro z:5, final z:4 inside)
   ════════════════════════════════════════════════════════════ */

/* ─── Aurora ─────────────────────────────────────────────── */
.aurora-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
}

.orb1 {
  width: 700px;
  height: 550px;
  background: radial-gradient(circle, rgba(180,55,135,0.45) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: floatOrb1 14s ease-in-out infinite alternate;
}

.orb2 {
  width: 600px;
  height: 500px;
  background: radial-gradient(circle, rgba(55,90,210,0.35) 0%, transparent 70%);
  bottom: -100px;
  right: -100px;
  animation: floatOrb2 18s ease-in-out infinite alternate;
}

.orb3 {
  width: 800px;
  height: 400px;
  background: radial-gradient(circle, rgba(110,50,190,0.30) 0%, transparent 70%);
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  animation: floatOrb3 22s ease-in-out infinite alternate;
}

@keyframes floatOrb1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(80px, -60px) scale(1.15); }
}
@keyframes floatOrb2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-70px, -80px) scale(1.1); }
}
@keyframes floatOrb3 {
  from { transform: translateX(-50%) scale(1); }
  to   { transform: translateX(-40%) scale(1.2); }
}

/* ─── Stars ──────────────────────────────────────────────── */
.stars-wrap {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.star-field {
  position: absolute;
  inset: -60px;
}

.field1 {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.90) 0 1px,   transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,0.65) 0 1px,   transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,0.80) 0 1px,   transparent 1px);
  background-size: 90px 90px, 130px 130px, 60px 60px;
  background-position: 0 0, 45px 65px, 20px 30px;
  animation: drift1 28s linear infinite, twinkle1 3.5s ease-in-out infinite;
}

.field2 {
  background-image:
    radial-gradient(circle, rgba(210,220,255,0.95) 0 1.5px, transparent 2.5px),
    radial-gradient(circle, rgba(255,215,235,0.80) 0 1px,   transparent 2px),
    radial-gradient(circle, rgba(255,255,255,0.70) 0 1.5px, transparent 2px);
  background-size: 160px 160px, 210px 210px, 280px 280px;
  background-position: 80px 40px, 120px 100px, 60px 160px;
  animation: drift2 42s linear infinite, twinkle2 5s ease-in-out infinite;
}

@keyframes drift1 {
  from { transform: translate(0, 0); }
  to   { transform: translate(8px, -60px); }
}
@keyframes drift2 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-12px, -40px); }
}
@keyframes twinkle1 {
  0%, 100% { opacity: 0.55; }
  40%       { opacity: 0.90; }
  70%       { opacity: 0.65; }
}
@keyframes twinkle2 {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.88; }
}

/* ─── Shooting stars ─────────────────────────────────────── */
.shoots-wrap {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.shoot {
  position: absolute;
  height: 1.5px;
  border-radius: 9999px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.95), transparent);
  opacity: 0;
}

.shoot:nth-child(1) { top: 12%; left: 20%; width: 150px; transform: rotate(25deg); animation: shoot 9s  1.5s ease-in-out infinite; }
.shoot:nth-child(2) { top: 28%; left: 55%; width: 110px; transform: rotate(20deg); animation: shoot 13s 5.5s ease-in-out infinite; }
.shoot:nth-child(3) { top:  8%; left: 68%; width: 190px; transform: rotate(28deg); animation: shoot 10s 9.5s ease-in-out infinite; }
.shoot:nth-child(4) { top: 38%; left:  4%; width: 130px; transform: rotate(18deg); animation: shoot 15s 3.0s ease-in-out infinite; }

@keyframes shoot {
  0%   { opacity: 0; transform: rotate(var(--r,25deg)) translateX(0); }
  4%   { opacity: 1; }
  18%  { opacity: 0; transform: rotate(var(--r,25deg)) translateX(320px); }
  100% { opacity: 0; transform: rotate(var(--r,25deg)) translateX(320px); }
}

/* ─── Scene wrapper ──────────────────────────────────────── */
.scene {
  position: fixed;
  inset: 0;
  z-index: 4;
}

/* ─── Intro ──────────────────────────────────────────────── */
.intro {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.floating-text {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(88vw, 980px);
  text-align: center;
  line-height: 1.45;
  font-family: 'Baloo 2', cursive;
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-shadow: 0 0 24px rgba(200,140,255,0.50), 0 2px 8px rgba(0,0,0,0.40);
  opacity: 0;
  transform: translate(-50%, 90px);
  transition: transform 1.1s ease, opacity 1.1s ease;
}

.floating-text.active {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.floating-text.exit {
  opacity: 0;
  transform: translate(-50%, -165px);
}

/* ─── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Final section ──────────────────────────────────────── */
.final-section {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2rem;
  padding: 3rem 5vw;
}

.wish-text {
  max-width: 620px;
  text-align: left;
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.75rem, 3.2vw, 3.2rem);
  line-height: 1.75;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 0 20px rgba(200,140,255,0.35), 0 2px 6px rgba(0,0,0,0.4);
}

.wish-text p { margin: 0 0 0.55rem 0; }

/* ─── Cake area ──────────────────────────────────────────── */
.cake-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.cake-title {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-family: 'Baloo 2', cursive;
  letter-spacing: 0.6px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 14px rgba(200,140,255,0.4);
  transition: transform 0.4s ease, text-shadow 0.4s ease;
}

.cake-title.done {
  transform: scale(1.02);
  text-shadow: 0 0 28px rgba(255,200,100,0.65), 0 0 14px rgba(255,255,255,0.4);
}

/* ─── Cake image ─────────────────────────────────────────── */
.cake-img {
  width: 320px;
  max-width: 90vw;
  cursor: pointer;
  filter: drop-shadow(0 8px 20px rgba(180,60,140,0.35)) drop-shadow(0 20px 40px rgba(0,0,0,0.45));
  transition: transform 0.2s ease, filter 0.5s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.cake-img:hover {
  transform: scale(1.04) translateY(-4px);
  filter: drop-shadow(0 12px 28px rgba(180,60,140,0.50)) drop-shadow(0 24px 48px rgba(0,0,0,0.50));
}

.cake-img:active { transform: scale(0.97); }

.cake-img.blown {
  filter: drop-shadow(0 8px 20px rgba(100,100,200,0.30)) drop-shadow(0 20px 40px rgba(0,0,0,0.40)) brightness(0.97) saturate(0.9);
}

/* ─── Wish line ──────────────────────────────────────────── */
.wish-come-true {
  font-size: clamp(1rem, 1.8vw, 1.5rem);
  font-family: 'Dancing Script', cursive;
  letter-spacing: 0.3px;
  text-align: center;
  text-shadow: 0 0 16px rgba(255,200,100,0.6);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.wish-come-true:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  body { overflow-y: auto; }

  .scene {
    position: relative;
    min-height: 100vh;
  }

  .final-section {
    position: relative;
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .wish-text {
    text-align: center;
    max-width: 90vw;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .cake-img { width: 280px; }
}

@media (max-width: 520px) {
  .floating-text { font-size: clamp(1.6rem, 6.5vw, 2.6rem); }
  .wish-text      { font-size: 1.55rem; }
  .cake-img       { width: 230px; }
}
