/* ========================================================
   THE MOBILE STORY EXPERIENCE — STYLESHEET
   5-Screen Story Deck (Gift -> Photo -> Carousel -> Cake Cut -> Letter)
   ======================================================== */

:root {
  --bg-dark: #070913;
  --bg-card: rgba(18, 24, 48, 0.75);
  --bg-glass-input: rgba(255, 255, 255, 0.05);

  --gold: #f3d997;
  --gold-glow: #e5b869;
  --gold-soft: #fcf6e8;
  --rose: #f4a29a;
  --purple: #a78bfa;

  --text-main: #f3f5fc;
  --text-sub: #b2bdd8;
  --text-muted: #727e9e;

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-hand: 'Caveat', cursive;

  --border-gold: rgba(243, 217, 151, 0.22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  position: relative;
}

/* ----------------------------------------------------
   CANVAS BACKGROUNDS (Inside mobile viewport)
   ---------------------------------------------------- */
.viewport-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.viewport-canvas-top {
  z-index: 50;
}

/* ----------------------------------------------------
   MOBILE VIEWPORT CONTAINER
   ---------------------------------------------------- */
.mobile-viewport {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: radial-gradient(circle at top, #141b36 0%, #080a14 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8), 0 0 40px rgba(243, 217, 151, 0.08);
}

@media (min-width: 480px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #030409;
  }

  .mobile-viewport {
    height: 92vh;
    max-height: 840px;
    border-radius: 36px;
    border: 1px solid var(--border-gold);
  }
}

/* ----------------------------------------------------
   STORY PROGRESS BAR (5 SEGMENTS)
   ---------------------------------------------------- */
.story-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 14px 16px 8px;
  background: linear-gradient(to bottom, rgba(7, 9, 19, 0.9) 0%, rgba(7, 9, 19, 0) 100%);
}

.progress-bar-container {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}

.progress-segment .fill {
  width: 0%;
  height: 100%;
  background: var(--gold);
  transition: width 0.3s ease;
}

.progress-segment.active .fill {
  width: 100%;
}

.progress-segment.passed .fill {
  width: 100%;
  background: rgba(243, 217, 151, 0.7);
}

.story-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-badge {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 600;
}

.music-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-gold);
  color: var(--gold-soft);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.music-toggle.playing {
  background: rgba(243, 217, 151, 0.2);
  border-color: var(--gold);
}

.music-toggle.playing .music-note {
  animation: bounce 1.2s infinite ease-in-out;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* ----------------------------------------------------
   TAP ZONES FOR SLIDE NAVIGATION
   ---------------------------------------------------- */
.tap-zone {
  position: absolute;
  top: 60px;
  bottom: 60px;
  width: 30%;
  z-index: 25;
  cursor: pointer;
}

.tap-left {
  left: 0;
}

.tap-right {
  right: 0;
}

/* ----------------------------------------------------
   STORY SLIDES GENERAL
   ---------------------------------------------------- */
.story-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 18px 58px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateX(40px);
  transition: all 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  z-index: 5;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.story-slide::-webkit-scrollbar {
  display: none;
}

.story-slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateX(0);
  pointer-events: auto;
}

.slide-content {
  width: 100%;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeInContent 0.5s ease;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pill-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--gold);
  background: rgba(243, 217, 151, 0.1);
  border: 1px solid var(--border-gold);
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  filter: drop-shadow(0 2px 8px rgba(243, 217, 151, 0.3));
}

/* ----------------------------------------------------
   ANIMATION KEYFRAMES & SHIMMER EFFECTS
   ---------------------------------------------------- */
@keyframes textShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes btnShine {
  0% {
    left: -100%;
  }

  30%,
  100% {
    left: 150%;
  }
}

@keyframes giftWiggle {

  0%,
  70%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  74% {
    transform: translateY(-7px) rotate(-6deg);
  }

  78% {
    transform: translateY(-9px) rotate(6deg);
  }

  82% {
    transform: translateY(-5px) rotate(-4deg);
  }

  86% {
    transform: translateY(-3px) rotate(4deg);
  }

  90% {
    transform: translateY(-1px) rotate(-1deg);
  }

  94% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes photoBreathing {

  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(243, 217, 151, 0.25);
  }

  50% {
    transform: translateY(-8px) scale(1.02) rotate(0.8deg);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 40px rgba(243, 217, 151, 0.45);
  }
}

@keyframes sealPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(243, 217, 151, 0.5);
  }

  50% {
    transform: scale(1.15);
    box-shadow: 0 0 25px rgba(243, 217, 151, 0.9);
  }
}

@keyframes letterUnfold {
  from {
    opacity: 0;
    transform: perspective(800px) rotateX(12deg) translateY(25px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: perspective(800px) rotateX(0deg) translateY(0) scale(1);
  }
}

.next-pill-btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f5dfa6 0%, #d8a84e 100%);
  color: #17140e;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  padding: 12px 28px;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(229, 184, 105, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 30;
}

.next-pill-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-20deg);
  animation: btnShine 3.5s infinite ease-in-out;
}

.next-pill-btn:active {
  transform: scale(0.94);
}

/* ----------------------------------------------------
   SLIDE 0: FRONT COVER - 3D GIFT BOX & ENTRANCE ANIMATIONS
   ---------------------------------------------------- */
@keyframes frontFadeSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes frontBoxPopIn {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(25px);
  }
  60% {
    transform: scale(1.06) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes frontFadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes waveAnimation {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(16deg); }
  20% { transform: rotate(-10deg); }
  30% { transform: rotate(16deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(12deg); }
  60%, 100% { transform: rotate(0deg); }
}

.animated-wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: waveAnimation 2.2s infinite ease-in-out;
  margin-left: 6px;
  filter: drop-shadow(0 2px 8px rgba(243, 217, 151, 0.4));
}

.gift-slide-content {
  justify-content: center;
}

.front-hi-greeting {
  font-family: var(--font-hand);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--gold-soft);
  text-shadow: 0 0 18px rgba(243, 217, 151, 0.45);
  margin-bottom: 6px;
  animation: frontFadeSlideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gift-headline {
  font-family: var(--font-serif);
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 22px;
  text-shadow: 0 4px 25px rgba(243, 217, 151, 0.25);
  animation: frontFadeSlideDown 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.25s backwards;
}

.gift-box-wrap {
  position: relative;
  width: 160px;
  height: 175px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 30px;
  transition: transform 0.3s ease;
  animation: frontBoxPopIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

.gift-slide-content .next-pill-btn {
  animation: frontFadeSlideUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.68s backwards;
}

.gift-box-wrap:hover {
  transform: scale(1.06);
}

.gift-glow-halo {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 217, 151, 0.4) 0%, transparent 70%);
  animation: haloPulse 2.5s infinite ease-in-out;
  pointer-events: none;
}

@keyframes haloPulse {

  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.65;
  }

  50% {
    transform: scale(1.18);
    opacity: 0.95;
  }
}

.gift-box {
  position: relative;
  width: 110px;
  height: 100px;
  animation: giftFloat 3s infinite ease-in-out, giftWiggle 3.8s infinite ease-in-out;
}

@keyframes giftFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.gift-lid {
  position: absolute;
  top: -8px;
  left: -5px;
  width: 120px;
  height: 26px;
  background: linear-gradient(135deg, #e5b869 0%, #aa7721 100%);
  border-radius: 6px;
  border: 1px solid var(--gold);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  z-index: 3;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gift-box-wrap.opened .gift-lid {
  transform: translateY(-40px) rotate(-15deg);
}

.ribbon-bow {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 16px;
}

.ribbon-bow span {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid #fff3d1;
  border-radius: 50% 50% 0 50%;
  box-shadow: 0 0 8px rgba(255, 243, 209, 0.6);
}

.ribbon-bow span:first-child {
  left: 2px;
  transform: rotate(-30deg);
}

.ribbon-bow span:last-child {
  right: 2px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(30deg);
}

.gift-body {
  position: absolute;
  top: 14px;
  left: 0;
  width: 110px;
  height: 85px;
  background: linear-gradient(135deg, #1c234a 0%, #0d122b 100%);
  border: 1px solid var(--border-gold);
  border-radius: 6px 6px 12px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.ribbon-vertical {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 100%;
  background: linear-gradient(to right, #f3d997, #d8a84e);
}

.ribbon-horizontal {
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(to bottom, #f3d997, #d8a84e);
}

.gift-sparkles {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 1rem;
  animation: spinSlow 4s linear infinite;
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.gift-tap-hint {
  font-size: 0.76rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-top: 6px;
}

/* ----------------------------------------------------
   SLIDE 1: MAIN BIRTHDAY GREETING & PHOTO 1
   ---------------------------------------------------- */
.photo-frame {
  position: relative;
  width: 200px;
  height: 255px;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 2px solid var(--gold);
  animation: photoBreathing 4.5s ease-in-out infinite;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(243, 217, 151, 0.25);
  transition: transform 0.4s ease;
}

.photo-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(10, 13, 26, 0.5) 100%);
  z-index: 2;
  pointer-events: none;
}

.user-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: transform 0.5s ease;
}

.photo-frame:hover .user-photo {
  transform: scale(1.06);
}

.photo-sparkle-tag {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(13, 17, 34, 0.9);
  border: 1px solid var(--gold);
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-soft);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.slide-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 10px;
}

.name-highlight {
  background: linear-gradient(90deg, #fff3d6, #f3d997, #f4a29a, #a78bfa, #f3d997);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: textShimmer 4s ease infinite;
}

.slide-subtitle {
  font-size: 0.88rem;
  color: var(--text-sub);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 22px;
}

/* ----------------------------------------------------
   SLIDE 2: 3D PHOTO STACK (4:3 RATIO WITH PEEKING CARDS)
   ---------------------------------------------------- */
.stack-slide-content {
  justify-content: center;
}

.carousel-heading {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.carousel-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 3D Stack Container (Centered with Left & Right Peeks) */
.photo-stack-container {
  position: relative;
  width: 195px;
  height: 330px;
  margin: 8px auto 12px;
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
}

.stack-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-gold);
  border-radius: 20px;
  padding: 8px 8px 10px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  transition: transform 0.48s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.48s ease, filter 0.48s ease;
  transform-style: preserve-3d;
  box-sizing: border-box;
}

/* 2:3 Aspect Ratio Wrapper */
.stack-img-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #0d122b;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stack-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.stack-caption {
  text-align: center;
  padding-top: 6px;
}

.stack-caption h4 {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--gold-soft);
  margin: 0;
}

/* 3 Card Stack Positions: Center Front, Right Peek, Left Peek */
.stack-card.card-front {
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  z-index: 10;
  opacity: 1;
  filter: brightness(1);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(243, 217, 151, 0.25);
}

.stack-card.card-right {
  transform: translate3d(68px, 6px, -35px) scale(0.86) rotate(5deg);
  z-index: 4;
  opacity: 0.65;
  filter: brightness(0.8);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.stack-card.card-left {
  transform: translate3d(-68px, 6px, -35px) scale(0.86) rotate(-5deg);
  z-index: 4;
  opacity: 0.65;
  filter: brightness(0.8);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

/* Card cycling exit animation */
.stack-card.swiping-out {
  transform: translate3d(80px, -30px, 50px) rotate(15deg) scale(0.9);
  opacity: 0;
}

/* Stack Indicator Dots */
.stack-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.stack-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.stack-dots .dot.active {
  background: var(--gold);
  width: 18px;
  border-radius: 6px;
}

/* ----------------------------------------------------
   SLIDE 3: CANDLE BLOW + CAKE CUTTING
   ---------------------------------------------------- */
.cake-slide-content {
  justify-content: center;
}

.slide-title-sub {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--gold-soft);
  margin-bottom: 6px;
  transition: opacity 0.3s ease;
}

.wish-instruction {
  font-size: 0.84rem;
  color: var(--text-sub);
  max-width: 300px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Cake Stage */
.interactive-cake-stage {
  position: relative;
  width: 250px;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin: 4px auto 14px;
  cursor: pointer;
  user-select: none;
}

/* Virtual Knife Animation */
.virtual-knife {
  position: absolute;
  top: -10px;
  right: 24px;
  font-size: 2.6rem;
  z-index: 25;
  animation: knifeReady 1.2s infinite ease-in-out;
  filter: drop-shadow(0 0 12px rgba(243, 217, 151, 0.8));
  pointer-events: none;
}

.virtual-knife.cutting {
  animation: knifeCutSlice 0.9s forwards ease-in-out;
}

@keyframes knifeReady {
  0%, 100% {
    transform: translateY(0) rotate(-20deg) scale(1);
  }
  50% {
    transform: translateY(-10px) rotate(-10deg) scale(1.08);
  }
}

@keyframes knifeCutSlice {
  0% {
    transform: translate(0, 0) rotate(-20deg) scale(1);
    opacity: 1;
  }
  35% {
    transform: translate(-30px, 45px) rotate(35deg) scale(1.15);
    opacity: 1;
  }
  70% {
    transform: translate(-45px, 95px) rotate(70deg) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(-55px, 135px) rotate(90deg) scale(0.9);
    opacity: 0;
  }
}

/* Birthday Cake Structure */
.birthday-cake {
  position: relative;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.4s ease;
}

.cake-body-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Candle Structure */
.cake-candle {
  position: relative;
  width: 12px;
  height: 36px;
  background: repeating-linear-gradient(45deg, #ffffff, #ffffff 4px, #f3d997 4px, #f3d997 7px, #ff758f 7px, #ff758f 10px);
  border-radius: 4px;
  margin-bottom: -3px;
  z-index: 12;
  box-shadow: 0 0 10px rgba(243, 217, 151, 0.5);
}

.candle-halo {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 217, 151, 0.55) 0%, transparent 70%);
  animation: haloPulse 2s infinite ease-in-out;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.wick {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #2b2218;
}

.flame {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 24px;
  background: radial-gradient(ellipse at bottom, #fff 15%, #ffd466 50%, #ff7b2b 85%, transparent 100%);
  border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%;
  box-shadow: 0 0 18px #ffb338, 0 0 32px rgba(255, 166, 48, 0.85);
  animation: flicker 1.8s infinite alternate ease-in-out;
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 15;
}

.flame.extinguished {
  opacity: 0;
  transform: translateX(-50%) scale(0.1);
  pointer-events: none;
}

@keyframes flicker {
  0% {
    transform: translateX(-50%) rotate(-1deg) scale(1);
  }
  50% {
    transform: translateX(-50%) rotate(2deg) scale(1.06);
  }
  100% {
    transform: translateX(-50%) rotate(-1.5deg) scale(0.96);
  }
}

.smoke {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.smoke.hidden {
  display: none;
}

.smoke span {
  width: 4px;
  height: 4px;
  background: rgba(220, 220, 220, 0.7);
  border-radius: 50%;
  margin-bottom: 3px;
  animation: smokePuff 1.5s ease-out forwards;
}

@keyframes smokePuff {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-25px) scale(3);
    opacity: 0;
    filter: blur(2px);
  }
}

/* ==============================================
   CAKE TIERS (DELICIOUS 3D MULTI-TIER LOOK)
   ============================================== */
.cake-tier {
  position: relative;
  box-sizing: border-box;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Top Tier */
.cake-tier-top {
  width: 110px;
  height: 44px;
  background: linear-gradient(180deg, #fffcf9 0%, #ffe8eb 35%, #ffb6c1 100%);
  border-radius: 14px 14px 8px 8px;
  box-shadow: inset 0 -4px 10px rgba(217, 4, 41, 0.22), inset 0 2px 4px rgba(255, 255, 255, 0.9), 0 6px 16px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border-top: 2px solid #fff;
}

.cake-toppings {
  position: absolute;
  top: -13px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  padding: 0 10px;
  font-size: 0.95rem;
  z-index: 6;
  pointer-events: none;
}

.topping-item {
  animation: toppingBounce 2.5s infinite ease-in-out;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.topping-item.t-berry {
  transform-origin: bottom center;
}

.topping-item.t-sparkle {
  font-size: 0.75rem;
  color: var(--gold);
  animation-delay: 0.4s;
}

@keyframes toppingBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

/* Frosting Glaze Drips */
.frosting-glaze {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 14px;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  pointer-events: none;
}

.glaze-drip {
  width: 12px;
  background: #ffffff;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-glaze .gd1 { height: 11px; }
.top-glaze .gd2 { height: 8px; }
.top-glaze .gd3 { height: 13px; }
.top-glaze .gd4 { height: 9px; }
.top-glaze .gd5 { height: 12px; }

/* Bottom Tier */
.cake-tier-base {
  width: 155px;
  height: 48px;
  background: linear-gradient(180deg, #ffeef2 0%, #ff9ebb 40%, #ff5d8f 100%);
  border-radius: 12px 12px 16px 16px;
  box-shadow: inset 0 -6px 12px rgba(164, 19, 60, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  margin-top: -3px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.7);
}

.base-glaze .bgd1 { height: 12px; width: 14px; }
.base-glaze .bgd2 { height: 9px; width: 13px; }
.base-glaze .bgd3 { height: 15px; width: 16px; }
.base-glaze .bgd4 { height: 10px; width: 14px; }
.base-glaze .bgd5 { height: 14px; width: 15px; }
.base-glaze .bgd6 { height: 11px; width: 13px; }

.cake-decorations {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  margin-top: 8px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

/* Knife Cut Line */
.cut-line {
  position: absolute;
  top: 0;
  right: 32px;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, #fff, #f3d997, rgba(18, 22, 45, 0.9));
  box-shadow: 0 0 8px rgba(243, 217, 151, 0.8);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s ease;
  z-index: 10;
}

.cut-line.visible {
  transform: scaleY(1);
}

/* ==============================================
   REVEALED INTERIOR LAYERS (WHEN CAKE IS SLICED)
   ============================================== */
.tier-cut-interior {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  overflow: hidden;
  background: #3c1e1e;
  border-left: 2px solid #fff;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  z-index: 8;
  opacity: 0;
}

.birthday-cake.cake-sliced .tier-cut-interior {
  width: 28px;
  opacity: 1;
}

.cut-sponge {
  background: #f7d499;
  flex: 2;
  border-bottom: 1.5px solid #e0b06b;
}

.cut-cream {
  background: #ffffff;
  flex: 1;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Top cutout */
.top-cut-interior {
  border-radius: 0 12px 6px 0;
}

/* Base cutout */
.base-cut-interior {
  border-radius: 0 10px 14px 0;
}

/* ==============================================
   THE SLICED CAKE PIECE (SERVED BESIDE THE CAKE)
   ============================================== */
.cake-slice-piece {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 18;
  opacity: 0;
  transform: translate(0, 0) scale(0.6);
  pointer-events: none;
  transition: transform 0.85s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.birthday-cake.cake-sliced .cake-slice-piece {
  opacity: 1;
  transform: translate(44px, -2px) rotate(6deg) scale(1);
  pointer-events: auto;
}

.slice-berry {
  font-size: 1.15rem;
  margin-bottom: -5px;
  z-index: 4;
  animation: sliceBerryHop 2s infinite ease-in-out;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

@keyframes sliceBerryHop {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.slice-sponge-body {
  width: 46px;
  height: 60px;
  border-radius: 6px 12px 6px 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1.5px solid #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6), inset 0 0 6px rgba(0, 0, 0, 0.15);
}

.slice-layer.sl-sponge {
  background: #f7d499;
  flex: 3;
}

.slice-layer.sl-jam {
  background: #d90429;
  flex: 1;
}

.slice-layer.sl-cream {
  background: #ffffff;
  flex: 1.5;
}

.slice-plate {
  width: 58px;
  height: 9px;
  background: linear-gradient(90deg, #aa7c2b 0%, #f3d997 40%, #fff4db 60%, #8e6216 100%);
  border-radius: 50%;
  margin-top: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.slice-badge {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  color: #f3d997;
  background: rgba(18, 22, 45, 0.92);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 2px 6px;
  margin-top: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
}

/* ==============================================
   GOLDEN PEDESTAL STAND & PLATE
   ============================================== */
.cake-stand-pedestal {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -6px;
  z-index: 2;
}

.stand-plate-top {
  width: 190px;
  height: 14px;
  background: linear-gradient(90deg, #aa7c2b 0%, #f3d997 30%, #fff7e4 50%, #f3d997 70%, #aa7c2b 100%);
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.stand-plate-rim {
  width: 172px;
  height: 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  margin-top: -10px;
}

.stand-pillar {
  width: 42px;
  height: 8px;
  background: linear-gradient(90deg, #7c581a 0%, #f3d997 50%, #7c581a 100%);
  margin-top: 4px;
  border-radius: 2px;
}

.stand-foot {
  width: 82px;
  height: 8px;
  background: linear-gradient(90deg, #aa7c2b 0%, #f3d997 50%, #aa7c2b 100%);
  border-radius: 50%;
  margin-top: -2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* Ceremony Button */
.ceremony-btn {
  background: rgba(243, 217, 151, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 20px;
  cursor: pointer;
  z-index: 30;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ceremony-btn:hover {
  background: var(--gold);
  color: #121524;
}

.ceremony-btn.cake-ready {
  background: linear-gradient(135deg, #f5dfa6 0%, #d8a84e 100%);
  color: #121524;
  box-shadow: 0 8px 22px rgba(229, 184, 105, 0.45);
  animation: cakeBtnGlow 2s infinite alternate ease-in-out;
}

@keyframes cakeBtnGlow {
  0% { transform: scale(1); box-shadow: 0 8px 20px rgba(229, 184, 105, 0.4); }
  100% { transform: scale(1.03); box-shadow: 0 10px 28px rgba(229, 184, 105, 0.65); }
}

/* ==============================================
   CELEBRATION BOX (CENTER-ALIGNED + FUNNY LINE)
   ============================================== */
@keyframes celebrationPop {
  0% {
    opacity: 0;
    transform: scale(0.6) translateY(24px);
  }
  60% {
    transform: scale(1.06) translateY(-4px);
  }
  85% {
    transform: scale(0.98) translateY(2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes celebrationGlowPulse {
  0%, 100% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(243, 217, 151, 0.35);
  }
  50% {
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.75), 0 0 38px rgba(243, 217, 151, 0.7);
  }
}

.wish-revealed-box {
  background: linear-gradient(135deg, rgba(26, 34, 72, 0.94) 0%, rgba(13, 17, 40, 0.98) 100%);
  border: 1.5px solid var(--gold);
  border-radius: 20px;
  padding: 16px 20px 18px;
  margin-bottom: 14px;
  animation: celebrationPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, celebrationGlowPulse 2.8s infinite ease-in-out;
  backdrop-filter: blur(12px);
  text-align: center; /* CENTER ALIGNED */
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
  width: 100%;
}

.wish-revealed-box.hidden {
  display: none !important;
}

.star-badge-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
  display: inline-block;
  animation: bounceBadge 2s infinite ease-in-out;
}

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

.wish-revealed-box h3,
.wish-revealed-box .celebration-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center; /* CENTER ALIGNED */
  background: linear-gradient(90deg, #fff3d6, #f3d997, #f4a29a, #a78bfa, #f3d997);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 3s ease infinite;
  margin: 0 0 6px 0;
  width: 100%;
}

.wish-revealed-box p,
.wish-revealed-box .celebration-wish {
  font-size: 0.84rem;
  color: #e2e8f7;
  line-height: 1.55;
  font-style: italic;
  text-align: center; /* CENTER ALIGNED */
  margin: 0 0 10px 0;
  max-width: 320px;
}

/* Funny Sugar Warning Note */
.funny-sugar-note {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
  border: 1px dashed rgba(255, 209, 102, 0.45);
  border-radius: 12px;
  padding: 8px 14px;
  text-align: center; /* CENTER ALIGNED */
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: sugarPulse 2.8s infinite ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.4;
}

@keyframes sugarPulse {
  0%, 100% {
    transform: scale(1);
    border-color: rgba(255, 209, 102, 0.45);
  }
  50% {
    transform: scale(1.02);
    border-color: rgba(255, 209, 102, 0.8);
    box-shadow: 0 4px 16px rgba(255, 209, 102, 0.2);
  }
}

/* ----------------------------------------------------
   SLIDE 4: THE HEARTFELT LETTER
   ---------------------------------------------------- */
.letter-slide-content {
  justify-content: center;
}

.letter-card {
  background: linear-gradient(160deg, rgba(22, 28, 59, 0.94) 0%, rgba(11, 15, 34, 0.98) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 22px;
  padding: 24px 20px;
  width: 100%;
  text-align: left;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(243, 217, 151, 0.04);
  position: relative;
  margin-bottom: 14px;
  animation: letterUnfold 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.letter-stamp {
  position: absolute;
  top: -14px;
  left: 20px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, #b88628 100%);
  color: #121626;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(243, 217, 151, 0.6);
  animation: sealPulse 2.8s infinite ease-in-out;
}

.letter-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--gold-soft);
  margin-bottom: 12px;
  font-style: italic;
}

.letter-text p {
  font-size: 0.83rem;
  color: #dbe2f5;
  line-height: 1.6;
  margin-bottom: 9px;
}

.letter-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88rem !important;
  color: var(--gold) !important;
  margin-top: 10px;
  margin-bottom: 3px;
  padding-left: 10px;
  border-left: 2px solid var(--gold);
}

.ai-disclaimer {
  font-size: 0.72rem;
  color: rgba(220, 226, 245, 0.45);
  font-style: italic;
  display: block;
  margin-bottom: 8px;
  padding-left: 10px;
}

.letter-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sign-off {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.author-name {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--gold-soft);
}

.replay-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-gold);
  color: var(--gold-soft);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 10px 24px;
  border-radius: 20px;
  cursor: pointer;
  z-index: 30;
  transition: all 0.3s ease;
}

.replay-btn:hover {
  background: rgba(243, 217, 151, 0.2);
}

/* ----------------------------------------------------
   BOTTOM STORY FOOTER
   ---------------------------------------------------- */
.story-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(to top, rgba(7, 9, 19, 0.9) 0%, rgba(7, 9, 19, 0) 100%);
}

.nav-arrow {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-gold);
  color: var(--gold-soft);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow:active {
  transform: scale(0.92);
}

.slide-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.slide-indicator span {
  color: var(--gold);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----------------------------------------------------
   DESKTOP POLISH (Phone frame look on big screens)
   ---------------------------------------------------- */
@media (min-width: 768px) {
  .mobile-viewport {
    max-width: 400px;
    height: 88vh;
    max-height: 820px;
    border-radius: 42px;
    border: 2px solid var(--border-gold);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 60px rgba(243, 217, 151, 0.12), inset 0 0 40px rgba(243, 217, 151, 0.03);
  }

  .gift-headline {
    font-size: 2.2rem;
  }

  .slide-title {
    font-size: 1.75rem;
  }

  .photo-frame {
    width: 170px;
    height: 210px;
  }

  .carousel-container {
    max-width: 290px;
  }

  .letter-card {
    padding: 22px 18px;
  }
}

/* ----------------------------------------------------
   GIFT EXPIRED OVERLAY SCREEN (Controlled via switch.js)
   ---------------------------------------------------- */
.gift-expired-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  background: radial-gradient(circle at center, #141938 0%, #080a18 100%);
  border-radius: inherit;
}

.gift-expired-screen.hidden {
  display: none !important;
}

.expired-card {
  background: linear-gradient(145deg, rgba(23, 29, 61, 0.96) 0%, rgba(10, 13, 30, 0.98) 100%);
  border: 1px solid rgba(243, 217, 151, 0.3);
  border-radius: 26px;
  padding: 36px 24px 30px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(243, 217, 151, 0.1);
  max-width: 320px;
  width: 100%;
  animation: expiredFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes expiredFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.expired-icon {
  font-size: 3.6rem;
  margin-bottom: 14px;
  animation: expiredBob 3s ease-in-out infinite;
}

@keyframes expiredBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.expired-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.expired-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: #f3d997;
  margin-bottom: 12px;
}

.expired-desc {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: #e2e8f7;
  line-height: 1.5;
  margin-bottom: 8px;
}

.expired-sub {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 22px;
}

.expired-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 7px 18px;
  border-radius: 14px;
}