:root {
  --rose: #ff4f8f;
  --coral: #ff785a;
  --gold: #ffd166;
  --mint: #62e6c5;
  --ink: #ffffff;
  --shadow: rgba(16, 10, 28, 0.38);
  --deep-shadow: rgba(13, 8, 22, 0.62);
}

@property --spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1d1430;
  touch-action: manipulation;
}

button {
  font: inherit;
}

.slideshow,
.slide,
.photo-vignette,
#effectsCanvas {
  position: fixed;
  inset: 0;
}

.slideshow {
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 209, 102, 0.22), transparent 32%),
    linear-gradient(135deg, #241336, #40245b 48%, #1b283f);
}

.slide {
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1700ms ease, transform 5800ms ease;
  will-change: opacity, transform, background-image;
}

.slide.is-visible {
  opacity: 1;
  transform: scale(1);
}

.photo-vignette {
  background:
    radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 48%), transparent 0 23%, rgba(8, 6, 15, 0.18) 42%, rgba(8, 6, 15, 0.64) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.52));
}

#effectsCanvas {
  z-index: 2;
  pointer-events: none;
}

.stage {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(18px, 4vw, 54px);
  text-align: center;
}

.intro {
  position: fixed;
  top: clamp(22px, 7vh, 72px);
  left: 50%;
  width: min(92vw, 820px);
  transform: translateX(-50%);
  text-shadow: 0 4px 24px var(--deep-shadow);
  transition: opacity 900ms ease, transform 900ms ease;
}

body.is-open .intro {
  opacity: 0;
  transform: translate(-50%, -28px);
  pointer-events: none;
}

.kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: clamp(0.88rem, 1.4vw, 1.05rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5.7rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.gift-button {
  position: relative;
  grid-area: 1 / 1;
  display: grid;
  width: min(58vw, 265px);
  aspect-ratio: 1;
  place-items: center;
  margin-top: min(18vh, 130px);
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 24px 28px var(--shadow));
  transition: transform 720ms cubic-bezier(.2, .8, .2, 1), opacity 550ms ease;
  will-change: transform, opacity;
}

.gift-button:hover,
.gift-button:focus-visible {
  transform: translateY(-3px) rotate(-0.35deg) scale(1.01);
  outline: none;
}

.gift-button:active {
  transform: translateY(-2px) scale(0.98);
}

body.is-open .gift-button {
  animation: giftExit 2880ms ease 2620ms forwards;
  pointer-events: none;
}

.gift-shadow {
  position: absolute;
  bottom: 21%;
  width: 78%;
  height: 13%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  filter: blur(10px);
}

.gift {
  position: relative;
  width: 76%;
  height: 68%;
  animation: giftFloat 7600ms ease-in-out infinite;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.gift-box,
.gift-lid {
  position: absolute;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  border: 4px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(90deg, transparent 0 42%, rgba(255, 255, 255, 0.32) 42% 58%, transparent 58%),
    linear-gradient(135deg, #ff3f7b, #ff705f 55%, #ffc14d);
  backface-visibility: hidden;
}

.gift-box {
  bottom: 0;
  height: 68%;
  border-radius: 10px 10px 18px 18px;
  overflow: hidden;
}

.gift-lid {
  top: 6%;
  height: 29%;
  border-radius: 16px 16px 9px 9px;
  transform-origin: 14% 100%;
  z-index: 2;
}

.gift-ribbon {
  position: absolute;
  display: block;
  background: linear-gradient(180deg, #fff2a8, var(--gold));
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.55);
}

.gift-ribbon-lid,
.gift-ribbon-box {
  top: 0;
  left: 50%;
  width: 17%;
  height: 100%;
  transform: translateX(-50%);
}

.gift-bow {
  position: absolute;
  top: -55%;
  width: 43%;
  height: 68%;
  border: 11px solid var(--gold);
  border-radius: 50% 50% 42% 50%;
  background: rgba(255, 218, 109, 0.16);
}

.gift-bow-left {
  left: 13%;
  transform: rotate(-28deg);
}

.gift-bow-right {
  right: 13%;
  transform: scaleX(-1) rotate(-28deg);
}

.gift-glow {
  position: absolute;
  inset: -25%;
  opacity: 0.28;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), transparent 56%);
  animation: glowPulse 4200ms ease-in-out infinite;
}

.tap-hint {
  position: absolute;
  bottom: 2%;
  padding: 9px 14px;
  border-radius: 999px;
  color: #2d183d;
  font-size: clamp(0.83rem, 2.4vw, 1rem);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.voucher-card {
  position: relative;
  grid-area: 1 / 1;
  width: min(86vw, 560px);
  max-height: 78dvh;
  padding: clamp(16px, 3vw, 26px);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(34vh) scale(0.72) rotate(-5deg);
  transform-origin: 50% 100%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 229, 0.95)),
    linear-gradient(90deg, var(--rose), var(--gold));
  box-shadow: 0 30px 80px rgba(10, 6, 22, 0.52);
  color: #312039;
  pointer-events: none;
}

body.is-open .voucher-card {
  animation: cardReveal 2350ms cubic-bezier(.2, .9, .18, 1.05) 2230ms forwards;
  pointer-events: auto;
}

.card-spark {
  position: absolute;
  inset: -16px;
  z-index: -1;
  border-radius: 14px;
  background:
    conic-gradient(from var(--spin, 0deg), var(--rose), var(--gold), var(--mint), #7aa7ff, var(--rose));
  opacity: 0.72;
  filter: blur(16px);
  animation: rotateSpark 5800ms linear infinite;
}

.card-eyebrow {
  margin: 0 0 12px;
  color: #8b2d60;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.voucher-frame {
  overflow: hidden;
  border: 10px solid #fff;
  border-radius: 6px;
  background: #ffeec7;
  box-shadow: inset 0 0 0 1px rgba(58, 31, 58, 0.12), 0 14px 28px rgba(50, 31, 60, 0.22);
}

.voucher-frame img {
  display: block;
  width: 100%;
  max-height: min(58dvh, 680px);
  object-fit: contain;
  background: #fff5dc;
}

body.is-open .gift-lid {
  animation: lidFly 2050ms cubic-bezier(.18, .76, .24, 1) forwards;
}

body.is-open .gift-box {
  animation: boxPop 2050ms ease forwards;
}

audio[controls] {
  position: fixed;
  right: 16px;
  bottom: 6vh;
  left: 16px;
  z-index: 6;
  width: min(420px, calc(100vw - 32px));
  margin: 0 auto;
}

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

@keyframes glowPulse {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.18;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.38;
  }
}

@keyframes lidFly {
  0% {
    transform: translateX(-50%) rotate(0);
  }
  100% {
    transform: translate(-72%, -96%) rotate(-32deg);
  }
}

@keyframes boxPop {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  45% {
    transform: translateX(-50%) scale(1.025, 0.985);
  }
}

@keyframes giftExit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(110px) scale(0.66);
  }
}

@keyframes cardReveal {
  0% {
    opacity: 0;
    transform: translateY(34vh) scale(0.72) rotate(-5deg);
  }
  56% {
    opacity: 1;
    transform: translateY(-4vh) scale(1.04) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes rotateSpark {
  to {
    --spin: 360deg;
  }
}

@media (max-width: 640px) {
  .intro {
    top: 24px;
  }

  .gift-button {
    width: min(74vw, 260px);
    margin-top: 18vh;
  }

  .voucher-card {
    width: min(92vw, 520px);
    padding: 13px;
  }

  .voucher-frame {
    border-width: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 500ms !important;
    scroll-behavior: auto !important;
    transition-duration: 500ms !important;
  }
}

.signature {
  position: fixed;
  right: clamp(18px, 4vw, 48px);
  bottom: clamp(18px, 4vw, 42px);
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1rem, 2.7vw, 1.5rem);
  font-weight: 800;
  text-shadow: 0 3px 18px var(--deep-shadow);
}