:root {
  --white: #fffdf8;
  --cream: #fff8e8;
  --toast: #e8c547;
  --toast-deep: #f4c430;
  --pink: #ff7eb3;
  --pink-hot: #ff6b9d;
  --blue: #5ec8f0;
  --blue-sky: #7dd3f0;
  --gold: #ffd700;
  --ink: #3d2b1f;
}

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

html, body {
  height: 100%;
  background: #1a120c;
  color: var(--ink);
  font-family: "Fredoka", system-ui, sans-serif;
  overflow: hidden;
}

#app {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  background: var(--white);
  overflow: hidden;
  isolation: isolate;
}

canvas#confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}

.scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 2;
}

.scene.on {
  opacity: 1;
  visibility: visible;
}

.bubble-title,
.wiggle-title,
.cta-title,
.close-title,
.close-place,
.close-date,
.close-names {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.15;
}

.scene-1 {
  background:
    radial-gradient(circle at 50% 42%, #fff 0 28%, transparent 62%),
    linear-gradient(180deg, #fffdf8, #fff3c8 70%, #ffe9ee);
}

.secret-text {
  width: 86%;
  font-size: clamp(28px, 8.4vw, 46px);
  z-index: 3;
}

.secret-text .ch {
  display: inline-block;
  transform: scale(0) rotate(-18deg);
  opacity: 0;
}

.secret-text.pop .ch {
  animation: letterPop 0.48s cubic-bezier(0.2, 1.6, 0.32, 1) both;
}

.secret-text .emoji {
  font-size: 1.15em;
}

.pop-burst {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
}

.pop-burst.go {
  animation: popRing 0.7s ease-out both;
}

.scene-2 {
  background:
    linear-gradient(180deg, #bfefff 0%, #fff8e8 48%, #ffe9f2 100%);
}

.sky-drift {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.7) 0 8%, transparent 9%),
    radial-gradient(circle at 82% 22%, rgba(255,255,255,0.55) 0 7%, transparent 8%);
}

.baby-wrap {
  position: relative;
  width: 78%;
  max-width: 340px;
  transform: translateY(18px);
}

.cloud-svg {
  width: 100%;
  filter: drop-shadow(0 10px 12px rgba(94, 200, 240, 0.18));
}

.baby {
  position: absolute;
  left: 50%;
  bottom: 38%;
  width: 46%;
  transform: translate(-50%, 42%) scale(0.7);
  opacity: 0;
}

.baby.peek {
  animation: peek 0.9s cubic-bezier(0.18, 1.3, 0.3, 1) both;
}

.baby.wink .eye-l {
  opacity: 0;
}

.baby.wink .wink-line {
  opacity: 1;
}

.wink-line {
  opacity: 0;
}

.wiggle-title {
  position: absolute;
  bottom: 12%;
  width: 88%;
  font-size: clamp(26px, 7.6vw, 40px);
}

.wiggle-title .ch {
  display: inline-block;
}

.wiggle-title.go .ch {
  animation: wiggle 0.7s ease-in-out infinite;
}

.scene-3 {
  background:
    radial-gradient(circle at 50% 38%, #fff 0 18%, transparent 48%),
    linear-gradient(180deg, #fff6fb, #eaf9ff 55%, #fff3c8);
}

.gift-stage {
  width: 62%;
  max-width: 260px;
  perspective: 700px;
}

.gift {
  position: relative;
  transform: scale(0.2) rotate(-8deg);
  opacity: 0;
}

.gift.in {
  animation: giftIn 0.55s cubic-bezier(0.2, 1.5, 0.32, 1) both;
}

.gift-box {
  height: 150px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(
      90deg,
      #ffd6e8 0 28px,
      #c9f0ff 28px 56px
    );
  box-shadow: 0 18px 0 rgba(232, 197, 71, 0.28);
  position: relative;
  overflow: hidden;
}

.ribbon-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
}

.ribbon-v.pink {
  left: 38%;
  background: var(--pink);
}

.ribbon-v.blue {
  left: 50%;
  background: var(--blue);
}

.gift-lid {
  position: absolute;
  left: -8%;
  right: -8%;
  top: -28px;
  height: 46px;
  transform-origin: 12% 80%;
  z-index: 2;
}

.gift.open .gift-lid {
  animation: lidBoing 0.7s cubic-bezier(0.2, 1.5, 0.25, 1) both;
}

.lid-top {
  height: 100%;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--pink) 0 50%, var(--blue) 50% 100%);
  box-shadow: 0 6px 0 rgba(61, 43, 31, 0.12);
}

.bow {
  position: absolute;
  top: -22px;
  width: 42px;
  height: 28px;
  border-radius: 50%;
}

.bow-pink {
  left: 28%;
  background: var(--pink-hot);
  transform: rotate(-18deg);
}

.bow-blue {
  right: 28%;
  background: var(--blue);
  transform: rotate(18deg);
}

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

.balloon {
  position: absolute;
  bottom: -18%;
  width: 46px;
  height: 58px;
  border-radius: 50% 50% 48% 48%;
  opacity: 0;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 46px;
  background: rgba(61, 43, 31, 0.28);
  transform: translateX(-50%);
}

.balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 8px;
  background: inherit;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.balloon.up {
  animation: balloonUp 1.15s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}

.scene-4 {
  background:
    radial-gradient(circle at 50% 46%, #fff 0 16%, transparent 50%),
    linear-gradient(180deg, #ffe9f4, #fff8dc 50%, #e7f8ff);
}

.cta-title {
  width: 84%;
  font-size: clamp(30px, 8.8vw, 48px);
  transform: scale(0.4) rotate(-6deg);
  opacity: 0;
}

.cta-title.go {
  animation: spinPop 0.7s cubic-bezier(0.15, 1.6, 0.3, 1) both;
}

.cta-title .emoji {
  font-size: 1.1em;
}

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

.twinkle {
  position: absolute;
  font-size: 28px;
  animation: twinkle 0.7s ease-in-out infinite;
}

.scene-5 {
  background: linear-gradient(180deg, #cbebff 0%, #fff8e8 42%, #ffe7f2 100%);
}

.venue {
  position: absolute;
  inset: auto 6% 28% 6%;
}

.building {
  width: 100%;
  filter: drop-shadow(0 10px 0 rgba(232, 197, 71, 0.18));
}

.close-copy {
  position: absolute;
  top: 8%;
  width: 88%;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.close-title {
  font-size: clamp(30px, 8.4vw, 44px);
  opacity: 0;
  transform: translateY(16px);
}

.close-title .ch,
.close-names .ch {
  display: inline-block;
}

.close-place,
.close-date {
  font-size: clamp(15px, 4.2vw, 20px);
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
}

.close-names {
  margin-top: 8px;
  font-size: clamp(22px, 6.4vw, 32px);
  opacity: 0;
}

.close-title.show,
.close-place.show,
.close-date.show {
  animation: riseIn 0.45s ease-out both;
}

.close-names.show {
  animation: nameBounce 0.7s cubic-bezier(0.2, 1.7, 0.3, 1) both;
}

.progress {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 3.2%;
  height: 6px;
  border-radius: 99px;
  background: rgba(61, 43, 31, 0.08);
  overflow: hidden;
  z-index: 12;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--gold), var(--blue));
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 38%, #fff 0 20%, transparent 55%),
    linear-gradient(180deg, #fff8e8, #ffe4f0 60%, #e8f8ff);
}

.overlay.hide {
  animation: fadeOut 0.35s ease both;
  pointer-events: none;
}

.overlay-gift {
  margin-bottom: 6px;
}

.play-btn {
  width: 86px;
  height: 86px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold), var(--toast-deep));
  box-shadow: 0 10px 0 #d4a017, 0 16px 24px rgba(244, 196, 48, 0.35);
  cursor: pointer;
  display: grid;
  place-items: center;
  animation: pulse 1.4s ease-in-out infinite;
}

.play-tri {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 16px 0 16px 26px;
  border-color: transparent transparent transparent #fff;
  margin-left: 6px;
}

.mini-box {
  width: 54px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pink) 50%, var(--blue) 50%);
  position: relative;
}

.mini-box::before {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: -10px;
  height: 16px;
  border-radius: 6px;
  background: var(--gold);
}

.replay-btn {
  position: absolute;
  right: 4%;
  bottom: 6.4%;
  z-index: 14;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 6px 0 #d4a017;
  cursor: pointer;
}

.replay-btn span {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0 auto;
  border: 3px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-40deg);
}

.replay-btn span::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -6px;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent #fff transparent;
}

@keyframes letterPop {
  0% { transform: scale(0) rotate(-18deg); opacity: 0; }
  70% { transform: scale(1.18) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  65% { transform: scale(1.22); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes popRing {
  0% { transform: scale(0.4); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.5); }
  100% { transform: scale(18); opacity: 0; box-shadow: 0 0 0 80px rgba(255, 126, 179, 0); }
}

@keyframes peek {
  0% { transform: translate(-50%, 42%) scale(0.7); opacity: 0; }
  100% { transform: translate(-50%, 8%) scale(1); opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-4px); }
}

@keyframes giftIn {
  0% { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  70% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes lidBoing {
  0% { transform: rotate(0) translateY(0); }
  55% { transform: rotate(-48deg) translate(-18px, -86px); }
  75% { transform: rotate(-38deg) translate(-12px, -70px); }
  100% { transform: rotate(-42deg) translate(-16px, -78px); }
}

@keyframes balloonUp {
  0% { transform: translateY(40px) scale(0.4); opacity: 0; }
  100% { transform: translateY(-420px) scale(1); opacity: 1; }
}

@keyframes spinPop {
  0% { transform: scale(0.4) rotate(-18deg); opacity: 0; }
  70% { transform: scale(1.12) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.7) rotate(-10deg); opacity: 0.45; }
  50% { transform: scale(1.18) rotate(10deg); opacity: 1; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nameBounce {
  0% { transform: scale(0.4) translateY(20px); opacity: 0; }
  60% { transform: scale(1.16) translateY(-6px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; }
}

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

@media (max-height: 640px) {
  .gift-box { height: 118px; }
  .venue { bottom: 24%; }
}
