:root {
  --red: #c41e3a;
  --red-deep: #8b1024;
  --red-dark: #5c0a18;
  --gold: #e8c547;
  --gold-bright: #ffe082;
  --gold-deep: #b8860b;
  --cream: #fff6e8;
  --ink: #2a0d12;
  --white: #fffdf8;
}

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

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

body {
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--cream);
  background: var(--red-dark);
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #2a0d12;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(42, 13, 18, 0.28) 0%, rgba(42, 13, 18, 0.45) 100%);
  pointer-events: none;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 32px;
  text-align: center;
}

.envelope-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.envelope {
  position: relative;
  width: 220px;
  height: 280px;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
  animation: bob 2.4s ease-in-out infinite;
}

.env-shadow {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 8px;
  height: 18px;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(10px);
  border-radius: 50%;
}

.env-body {
  position: absolute;
  inset: 48px 0 0;
  border-radius: 10px 10px 16px 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #e23a4c 0%, #b3182e 55%, #8e1022 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.env-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(255, 215, 120, 0.35) 10px,
      rgba(255, 215, 120, 0.35) 11px
    );
}

.env-gold-line {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f5d76a, transparent);
}

.env-seal {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  min-width: 72px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffe9a0, #c9a227 70%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 3;
}

.seal-inner {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--red-deep);
}

.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 118px;
  transform-origin: top center;
  z-index: 4;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.flap-inner {
  display: block;
  width: 100%;
  height: 100%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #ff5a6a 0%, #c41e3a 100%);
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.25));
}

.gift-card {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 28px;
  height: 168px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf6, #fff1c9);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 2;
  transform: translateY(18px);
  opacity: 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  transition: transform 0.7s 0.15s ease, opacity 0.5s 0.15s ease;
}

.gift-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  width: 18px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #e23a4c, #a31428);
  opacity: 0.85;
}

.gift-label,
.gift-amount,
.gift-sub {
  position: relative;
  z-index: 1;
}

.gift-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b1024;
  font-weight: 600;
}

.gift-amount {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #b3182e;
  line-height: 1;
}

.gift-amount span {
  font-size: 22px;
  margin-left: 2px;
}

.gift-sub {
  font-size: 12px;
  color: #7a4a1c;
}

.envelope.is-open {
  animation: none;
}

.envelope.is-open .env-flap {
  transform: rotateX(180deg);
}

.envelope.is-open .gift-card {
  transform: translateY(-72px);
  opacity: 1;
}

.envelope.is-open .env-seal {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hint {
  font-size: 13px;
  color: rgba(255, 246, 232, 0.75);
  animation: pulse 1.6s ease-in-out infinite;
}

.envelope.is-open + .hint,
.stage.is-revealed .hint {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

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

.result {
  margin-top: auto;
  width: min(100%, 360px);
  padding-top: 8px;
  animation: rise 0.55s ease both;
}

.result[hidden] {
  display: none;
}

.result-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-deep);
  background: var(--gold);
  font-weight: 700;
}

.result h2 {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
}

.result h2 span {
  color: var(--gold-bright);
}

.result-note {
  margin-top: 6px;
  font-size: 14px;
  color: rgba(255, 246, 232, 0.82);
}

.cta {
  display: block;
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 15px 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  color: var(--red-deep);
  text-decoration: none;
  background: linear-gradient(180deg, #ffe9a8, #e0b84a);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.cta:active {
  transform: scale(0.98);
}

.fineprint {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 246, 232, 0.55);
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

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

@media (min-height: 780px) {
  .envelope {
    width: 240px;
    height: 310px;
  }
}
