:root {
  --bg-a: #13051f;
  --bg-b: #43113d;
  --pink: #ff5ca8;
  --hot-pink: #ff2f7d;
  --gold: #ffd166;
  --cream: #fff7fb;
  --text: #fff8fb;
  --muted: rgba(255, 248, 251, 0.74);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 92, 168, 0.28), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(255, 209, 102, 0.18), transparent 28%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 52%, #1f0631);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid rgba(255, 209, 102, 0.95);
  outline-offset: 4px;
}

.app {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  isolation: isolate;
}

.aurora {
  position: fixed;
  inset: auto auto 8% 50%;
  z-index: -3;
  width: min(640px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 92, 168, 0.28), transparent 64%);
  filter: blur(18px);
  transform: translateX(-50%);
  animation: pulseAurora 5s ease-in-out infinite;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  bottom: -40px;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--size);
  animation: floatHeart var(--duration) linear infinite;
  animation-delay: var(--delay);
  text-shadow: 0 0 18px rgba(255, 92, 168, 0.9);
}

.screen {
  display: none;
  width: min(720px, 100%);
  animation: softIn 0.65s ease both;
}

.screen.active {
  display: block;
}

.hero {
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.05;
}

h1 {
  max-width: 760px;
  margin-inline: auto;
  font-size: clamp(2.65rem, 8vw, 5.8rem);
}

.title-heart {
  display: inline-block;
  color: var(--pink);
  font-size: 0.72em;
  text-shadow: 0 0 30px rgba(255, 92, 168, 0.7);
  animation: beat 1.05s ease-in-out infinite;
}

.subtitle {
  max-width: 520px;
  margin: 22px auto 32px;
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  line-height: 1.65;
}

.primary-button,
.secondary-button {
  position: relative;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  color: #2a0619;
  background: linear-gradient(135deg, var(--gold), #ff9fbf 48%, #ff5ca8);
  box-shadow: 0 18px 44px rgba(255, 47, 125, 0.32);
  font-weight: 800;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 24px 58px rgba(255, 47, 125, 0.44);
}

.primary-button span {
  display: inline-block;
  animation: beat 1.05s ease-in-out infinite;
}

.gift {
  width: min(620px, 100%);
}

.letter-card,
.surprise-card {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)),
    rgba(34, 7, 38, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.letter-card.opening {
  animation: openCard 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card-glow {
  position: absolute;
  inset: -40% auto auto 50%;
  width: 380px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 92, 168, 0.25);
  filter: blur(20px);
  transform: translateX(-50%);
}

.card-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.seal {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--cream);
  background: rgba(255, 92, 168, 0.38);
  box-shadow: 0 0 24px rgba(255, 92, 168, 0.58);
}

.typewriter {
  position: relative;
  min-height: 108px;
  margin: 34px 0 14px;
  color: var(--cream);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.35;
  white-space: pre-line;
}

.typewriter::after {
  content: "";
  display: inline-block;
  width: 3px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.15em;
  background: var(--gold);
  animation: caret 0.85s steps(1) infinite;
}

.typewriter.done::after {
  display: none;
}

.flower-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 260px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.flower-stage.visible {
  opacity: 1;
  transform: translateY(0);
}

.flower-glow {
  position: absolute;
  width: 210px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.38), rgba(255, 92, 168, 0.22), transparent 68%);
  filter: blur(10px);
  animation: flowerAura 2.4s ease-in-out infinite;
}

.flower {
  position: relative;
  width: 190px;
  height: 235px;
}

.stem {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 10px;
  height: 142px;
  border-radius: 999px;
  background: linear-gradient(#6ee7b7, #15803d);
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom;
}

.flower-stage.visible .stem {
  animation: growStem 0.7s ease forwards;
}

.leaf {
  position: absolute;
  bottom: 66px;
  width: 60px;
  height: 30px;
  border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #86efac, #16a34a);
  opacity: 0;
  transform: scale(0);
}

.leaf-left {
  left: 36px;
  transform-origin: right center;
  rotate: -20deg;
}

.leaf-right {
  right: 36px;
  transform-origin: left center;
  rotate: 200deg;
}

.flower-stage.visible .leaf {
  animation: popLeaf 0.5s ease 0.6s forwards;
}

.petal,
.flower-center {
  position: absolute;
  left: 50%;
  top: 64px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.petal {
  width: 70px;
  height: 96px;
  border-radius: 55px 55px 18px 18px;
  background: linear-gradient(145deg, #ff8cc6, #ff2f7d 64%, #c0266f);
  transform-origin: 50% 88%;
  box-shadow: inset 0 10px 18px rgba(255, 255, 255, 0.24);
}

.flower-stage.visible .petal {
  animation: openPetal 0.75s cubic-bezier(0.2, 0.9, 0.2, 1.2) forwards;
}

.petal-1 { --angle: 0deg; animation-delay: 0.95s !important; }
.petal-2 { --angle: 60deg; animation-delay: 1.05s !important; }
.petal-3 { --angle: 120deg; animation-delay: 1.15s !important; }
.petal-4 { --angle: 180deg; animation-delay: 1.25s !important; }
.petal-5 { --angle: 240deg; animation-delay: 1.35s !important; }
.petal-6 { --angle: 300deg; animation-delay: 1.45s !important; }

.flower-center {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6a8, var(--gold) 46%, #d97706);
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.7);
}

.flower-stage.visible .flower-center {
  animation: centerPop 0.5s ease 1.8s forwards;
}

.final-message {
  display: none;
  text-align: center;
}

.final-message.visible {
  display: block;
  animation: softIn 0.7s ease both;
}

.final-message h2,
.surprise-card h2 {
  font-size: clamp(2rem, 7vw, 3.65rem);
}

.final-message p,
.deploy-message,
.surprise-intro,
.counter-intro {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.final-message strong {
  color: var(--gold);
}

.secondary-button {
  min-height: 48px;
  margin-top: 12px;
  padding-inline: 22px;
}

.surprise {
  width: min(980px, 100%);
  text-align: center;
}

.surprise-card {
  min-height: auto;
}

.surprise-intro {
  max-width: 680px;
  margin: 18px auto 28px;
}

.memory-gallery {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(320px, 1.35fr);
  gap: 18px;
  align-items: stretch;
  margin: 34px 0 30px;
}

.photo-card {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

.photo-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.photo-card:hover img {
  transform: scale(1.035);
}

.photo-card-portrait img {
  object-position: center 38%;
}

.photo-card-landscape img {
  object-position: center;
}

.photo-card figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 40px 18px 16px;
  color: var(--cream);
  background: linear-gradient(transparent, rgba(19, 5, 31, 0.9));
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.counter-intro {
  margin: 0 0 -12px;
}

.fake-counter {
  display: grid;
  gap: 6px;
  width: min(300px, 100%);
  margin: 30px auto;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.fake-counter span {
  color: var(--gold);
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
}

.fake-counter small {
  color: var(--muted);
  font-weight: 700;
}

.deploy-message strong {
  color: var(--gold);
}

@keyframes floatHeart {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12%,
  82% {
    opacity: 1;
  }
  to {
    transform: translate3d(var(--drift), -112vh, 0) rotate(38deg);
    opacity: 0;
  }
}

@keyframes softIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes openCard {
  0% { transform: rotateX(8deg) scale(0.92); opacity: 0; }
  100% { transform: rotateX(0) scale(1); opacity: 1; }
}

@keyframes beat {
  50% { transform: scale(1.22); }
}

@keyframes caret {
  50% { opacity: 0; }
}

@keyframes pulseAurora {
  50% {
    transform: translateX(-50%) scale(1.08);
    opacity: 0.68;
  }
}

@keyframes growStem {
  to { transform: translateX(-50%) scaleY(1); }
}

@keyframes popLeaf {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes openPetal {
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-44px) scale(1);
  }
}

@keyframes centerPop {
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes flowerAura {
  50% {
    transform: scale(1.08);
    opacity: 0.72;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 20px;
  }

  .letter-card,
  .surprise-card {
    border-radius: 26px;
  }

  .flower-stage {
    height: 236px;
  }

  .flower {
    scale: 0.86;
  }

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

  .photo-card img {
    min-height: 0;
  }

  .photo-card-portrait img {
    aspect-ratio: 4 / 5;
  }

  .photo-card-landscape img {
    aspect-ratio: 3 / 2;
  }
}

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