:root {
  --bg: #14081f;
  --surface: rgba(255, 255, 255, 0.14);
  --surface-strong: rgba(255, 255, 255, 0.22);
  --highlight: #f7c6d0;
  --accent: #f7e3b3;
  --soft: #c7a5f7;
  --text: #f6f0ff;
  --muted: #d6c9e5;
  --shadow: 0 30px 90px rgba(19, 5, 40, 0.4);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, rgba(255, 215, 235, 0.18), transparent 25%),
              radial-gradient(circle at bottom left, rgba(195, 165, 247, 0.15), transparent 20%),
              linear-gradient(180deg, #14081f 0%, #0b0312 100%);
  overflow-x: hidden;
}

body {
  position: relative;
  overflow-x: hidden;
}

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  backdrop-filter: blur(12px);
  background: rgba(10, 7, 18, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.loader-card {
  padding: 2rem 2.2rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  text-align: center;
  width: min(380px, 90vw);
}

.loader-ring {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 202, 234, 0.9);
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scene {
  position: relative;
  min-height: 100vh;
  padding: 4rem 1.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.scene.active {
  display: flex;
}

.content-panel {
  position: relative;
  z-index: 3;
  width: min(1100px, 100%);
  backdrop-filter: blur(24px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 36px;
  box-shadow: var(--shadow);
  padding: 3rem;
}

.glass-panel {
  overflow: hidden;
}

.scene-title {
  font-size: clamp(1.6rem, 2vw, 2.4rem);
  margin-bottom: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 237, 247, 0.96);
}

.intro-badge {
  display: inline-flex;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0 0 1rem;
  font-family: 'Great Vibes', cursive;
  font-size: clamp(3rem, 6vw, 5.6rem);
  line-height: 0.9;
  color: #ffe2f2;
  text-shadow: 0 0 30px rgba(255, 208, 233, 0.32);
}

p {
  margin: 0 0 1.8rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 36rem;
}

.primary-button,
.secondary-button {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 1rem 1.8rem;
  font-weight: 600;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.primary-button {
  background: linear-gradient(135deg, rgba(255, 185, 224, 0.96), rgba(255, 235, 171, 0.95));
  color: #2f0f2e;
  box-shadow: 0 24px 50px rgba(255, 187, 199, 0.18);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button.disabled,
.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gift-stage,
.celebration-stage,
.ring-stage {
  display: grid;
  place-items: center;
  min-height: 420px;
}

.gift-box {
  position: relative;
  width: 240px;
  height: 240px;
  transform-style: preserve-3d;
  cursor: pointer;
}

.gift-box .wrap,
.gift-box .lid,
.gift-box .bow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.gift-box .wrap {
  width: 220px;
  height: 220px;
  background: linear-gradient(180deg, #f6c0d2, #d69fea);
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.gift-box .lid {
  width: 240px;
  height: 60px;
  background: linear-gradient(180deg, #fff0f6, #f2bada);
  border-radius: 18px 18px 4px 4px;
  transform: translate(-50%, -120%);
  transform-origin: center bottom;
  box-shadow: 0 18px 30px rgba(19, 5, 40, 0.18);
}

.gift-box.open .lid {
  transform: translate(-50%, -220%) rotateX(-80deg);
}

.gift-box .bow {
  width: 120px;
  height: 40px;
  top: 35%;
  background: radial-gradient(circle at 50% 40%, #ffe6f1, #e091c1);
  border-radius: 999px;
  box-shadow: inset 0 10px 20px rgba(255, 255, 255, 0.25);
}

.gift-box .bow::before,
.gift-box .bow::after {
  content: '';
  position: absolute;
  width: 64px;
  height: 32px;
  background: linear-gradient(135deg, #fff5f9, #e491bf);
  border-radius: 50% 20% 50% 90%;
  top: 0;
}

.gift-box .bow::before {
  left: -18px;
  transform: rotate(-45deg);
}

.gift-box .bow::after {
  right: -18px;
  transform: rotate(45deg);
}

.sparkle-layer,
.heart-layer,
.ring-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.sparkle,
.heart,
.confetti-piece {
  position: absolute;
  opacity: 0;
}

.celebration-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  position: relative;
}

.balloon-group {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balloon {
  position: absolute;
  width: 66px;
  height: 88px;
  background: radial-gradient(circle at 45% 30%, #ffe8f6, #f08ab8);
  border-radius: 50% 50% 48% 48%;
  box-shadow: inset -8px -6px 20px rgba(255, 255, 255, 0.45);
  transform: rotate(-8deg);
}

.balloon::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 78px;
  left: 50%;
  bottom: -78px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
}

@keyframes floatUp {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-24px) scale(1.02); }
  100% { transform: translateY(0px) scale(1); }
}

.balloon {
  animation: floatUp 6s ease-in-out infinite;
}

.cake-card {
  position: relative;
  width: min(360px, 90vw);
  min-height: 320px;
  margin: 0 auto;
}

.cake-base,
.cake-layer,
.cake-top {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 28px;
}

.cake-base {
  width: 320px;
  height: 120px;
  bottom: 0;
  background: linear-gradient(180deg, #fdd3eb, #f1a1cf);
  box-shadow: 0 20px 40px rgba(192, 102, 169, 0.26);
}

.cake-layer {
  width: 260px;
  height: 110px;
  bottom: 80px;
  background: linear-gradient(180deg, #ffe4f7, #f7b8dc);
}

.cake-top {
  width: 220px;
  height: 80px;
  bottom: 160px;
  background: linear-gradient(180deg, #fff2f8, #f3b2d8);
}

.candles {
  position: absolute;
  width: 100%;
  bottom: 210px;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.candle {
  width: 14px;
  height: 56px;
  background: linear-gradient(180deg, #fce6f2, #d07da8);
  border-radius: 12px;
  position: relative;
}

.candle .flame {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 14px;
  height: 24px;
  border-radius: 50% 50% 40% 40%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 40%, #fff3cc, #f7bb7c 55%, rgba(255, 166, 193, 0.8));
  filter: drop-shadow(0 0 12px rgba(255, 203, 166, 0.75));
  opacity: 0;
}

.candle.lit .flame {
  opacity: 1;
  animation: candleGlow 1.6s ease-in-out infinite;
}

@keyframes candleGlow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.92; }
  50% { transform: translateX(-50%) scale(1.05); opacity: 1; }
}

.typewriter {
  min-height: 10rem;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.photo-card {
  min-height: 200px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 240, 250, 0.32), rgba(250, 223, 242, 0.15));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 60px rgba(11, 3, 19, 0.2);
  transition: transform 0.3s ease, filter 0.3s ease;
}

.photo-card:hover {
  transform: translateY(-5px) scale(1.01);
  filter: drop-shadow(0 18px 40px rgba(255, 203, 234, 0.18));
}

.ring-stage {
  display: grid;
  place-items: center;
  min-height: 420px;
}

.ring-box {
  position: relative;
  width: 260px;
  height: 200px;
  border-radius: 28px;
  background: linear-gradient(180deg, #f7d9e4, #e686b6);
  box-shadow: 0 25px 60px rgba(123, 30, 86, 0.18);
  overflow: hidden;
}

.ring-box .ring-lid {
  position: absolute;
  width: 260px;
  height: 140px;
  background: linear-gradient(180deg, #ffe9f3, #e782b6);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  transform-origin: top center;
  transform: translateY(-120%);
  transition: transform 0.8s ease;
}

.ring-box.open .ring-lid {
  transform: translateY(-240%) rotateX(-75deg);
}

.ring-inner {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  width: 150px;
  height: 110px;
  transform: translateX(-50%);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 20%, #fff7fa, #d880af);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.ring-inner::before {
  content: '';
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f9f2ff, #f7c5ed);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.4), 0 0 20px rgba(255, 187, 224, 0.6);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ring-inner::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 60px;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f4beda, #ce75a1);
  border-radius: 18px;
  box-shadow: 0 0 10px rgba(206, 117, 161, 0.5);
}

.final-card {
  text-align: center;
  padding: 4rem 3rem;
}

.audio-control {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 2rem 0;
}

.audio-control span {
  opacity: 0.82;
  font-size: 0.95rem;
}

.button-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

@media (max-width: 840px) {
  .content-panel {
    padding: 2rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .photo-card {
    min-height: 170px;
  }
}

@media (max-width: 560px) {
  .scene {
    padding: 2rem 1rem;
  }

  h1 {
    font-size: 3.8rem;
  }

  .gift-box {
    width: 200px;
    height: 200px;
  }

  .cake-base {
    width: 260px;
  }

  .cake-layer {
    width: 220px;
  }

  .cake-top {
    width: 180px;
  }
}

@keyframes sparklePulse {
  0% { opacity: 0; transform: scale(0.25); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3); }
}

@keyframes heartFloat {
  0% { transform: translateY(0) scale(0.9); opacity: 0.8; }
  50% { transform: translateY(-72px) scale(1); opacity: 1; }
  100% { transform: translateY(-180px) scale(0.9); opacity: 0; }
}

.love-message {
  text-align: center;
  margin: 2rem 0;
}

.love-message p {
  margin: 1rem 0;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted);
}

.love-hearts,
.love-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.love-heart {
  position: absolute;
  animation: loveHeartFloat 4s ease-in-out infinite;
  opacity: 0.8;
}

.love-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, rgba(255,255,255,1), rgba(255, 214, 250, 0.2));
  border-radius: 50%;
  animation: loveSparkleTwinkle 3s ease-in-out infinite;
}

@keyframes loveHeartFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.1); }
}

@keyframes loveSparkleTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1); }
}
