:root {
  --rose: #ff4f9a;
  --rose-dark: #d91b72;
  --rose-soft: #ffb8d6;
  --rose-pale: #fff0f7;
  --blush: #ffd6e8;
  --ink: #482034;
  --paper: #fff7fb;
  --shadow: 0 18px 50px rgba(217, 27, 114, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 79, 154, 0.32), transparent 17rem),
    radial-gradient(circle at 82% 12%, rgba(255, 184, 214, 0.62), transparent 16rem),
    radial-gradient(circle at 50% 90%, rgba(255, 214, 232, 0.78), transparent 18rem),
    linear-gradient(145deg, #ffe2f0 0%, #fff0f7 46%, #ffc7df 100%);
  overflow: hidden;
}

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

.love-bg::before {
  content: "♡";
  position: absolute;
  left: 50%;
  top: 14%;
  color: rgba(255, 255, 255, 0.28);
  font-size: clamp(8rem, 38vw, 15rem);
  line-height: 1;
  text-shadow:
    0 0 18px rgba(255, 79, 154, 0.42),
    0 0 42px rgba(255, 79, 154, 0.28),
    0 0 84px rgba(255, 47, 141, 0.2);
  transform: translateX(-50%) rotate(-8deg);
  animation: neonPulse 3.4s ease-in-out infinite;
}

.love-bg span {
  position: absolute;
  bottom: -70px;
  display: block;
  color: rgba(255, 255, 255, 0.34);
  font-size: 34px;
  text-shadow:
    0 0 8px rgba(255, 79, 154, 0.75),
    0 0 20px rgba(255, 47, 141, 0.38);
  animation: floatLove 9s linear infinite;
}

.love-bg span::before {
  content: "♡";
}

.love-bg span:nth-child(1) {
  left: 8%;
  font-size: 24px;
  animation-delay: 0s;
  animation-duration: 8s;
}

.love-bg span:nth-child(2) {
  left: 18%;
  font-size: 42px;
  animation-delay: 2.3s;
  animation-duration: 11s;
}

.love-bg span:nth-child(3) {
  left: 31%;
  font-size: 28px;
  animation-delay: 4.2s;
  animation-duration: 9.5s;
}

.love-bg span:nth-child(4) {
  left: 43%;
  font-size: 50px;
  animation-delay: 1.1s;
  animation-duration: 12s;
}

.love-bg span:nth-child(5) {
  left: 55%;
  font-size: 26px;
  animation-delay: 5.4s;
  animation-duration: 8.6s;
}

.love-bg span:nth-child(6) {
  left: 67%;
  font-size: 38px;
  animation-delay: 0.8s;
  animation-duration: 10.5s;
}

.love-bg span:nth-child(7) {
  left: 78%;
  font-size: 30px;
  animation-delay: 3.6s;
  animation-duration: 9.2s;
}

.love-bg span:nth-child(8) {
  left: 88%;
  font-size: 46px;
  animation-delay: 6.2s;
  animation-duration: 12.8s;
}

.love-bg span:nth-child(9) {
  left: 24%;
  font-size: 20px;
  animation-delay: 7.1s;
  animation-duration: 10.8s;
}

.love-bg span:nth-child(10) {
  left: 72%;
  font-size: 22px;
  animation-delay: 8s;
  animation-duration: 8.8s;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app,
.screen {
  min-height: 100vh;
  min-height: 100svh;
}

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
  transition: opacity 500ms ease, transform 500ms ease;
  z-index: 1;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.loading-card {
  width: min(82vw, 360px);
  text-align: center;
}

.loading-card p {
  margin: 0 0 18px;
  font-size: clamp(1.1rem, 5vw, 1.45rem);
  font-weight: 700;
}

.loading-track {
  height: 16px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(217, 27, 114, 0.16), var(--shadow);
}

.loading-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff2f8d, #ff7bb7, #ffc1dc);
  transition: width 90ms linear;
}

.letter-screen {
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.envelope-stage {
  display: grid;
  justify-items: center;
  gap: 24px;
  width: min(86vw, 380px);
  transform: translateY(-18px);
  transition: opacity 360ms ease, transform 360ms ease;
  z-index: 2;
}

.envelope-stage.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-30px) scale(0.96);
}

.letter-intro {
  max-width: 320px;
  margin: 0;
  text-align: center;
  color: #6e2447;
  font-size: clamp(1.08rem, 4.8vw, 1.35rem);
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 2px 16px rgba(255, 255, 255, 0.7);
}

.soft-lights {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 52% 24%, rgba(255, 47, 141, 0.28), transparent 18rem),
    radial-gradient(circle at 42% 74%, rgba(255, 184, 214, 0.58), transparent 15rem);
  z-index: -1;
}

.envelope {
  position: relative;
  z-index: 2;
  width: min(74vw, 300px);
  height: min(48vw, 194px);
  background: transparent;
  filter: drop-shadow(0 22px 30px rgba(126, 46, 83, 0.24));
  transition: transform 420ms ease, opacity 360ms ease;
}

.envelope:active {
  transform: translateY(3px) scale(0.98);
}

.envelope-back,
.envelope-front,
.envelope-flap,
.paper-preview {
  position: absolute;
  inset: 0;
}

.envelope-back {
  border-radius: 12px;
  background: #ffc5dd;
}

.paper-preview {
  inset: 12% 12% auto;
  height: 58%;
  border-radius: 8px 8px 3px 3px;
  background: var(--paper);
  transform: translateY(18%);
  transition: transform 700ms ease;
}

.envelope-front {
  border-radius: 0 0 12px 12px;
  clip-path: polygon(0 28%, 50% 72%, 100% 28%, 100% 100%, 0 100%);
  background: linear-gradient(145deg, #ff9dcc, #ff4f9a);
}

.envelope-flap {
  transform-origin: 50% 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  border-radius: 12px;
  background: #ff7fbb;
  transition: transform 720ms cubic-bezier(0.18, 0.9, 0.25, 1.2);
}

.heart {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 2.1rem;
  background: var(--rose-dark);
  box-shadow: 0 10px 24px rgba(217, 27, 114, 0.34);
  transform: translate(-50%, -34%);
  animation: heartbeat 1.25s ease-in-out infinite;
}

.envelope.is-open {
  transform: translateY(18px) scale(0.92);
  opacity: 0;
}

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

.envelope.is-open .paper-preview {
  transform: translateY(-50%);
}

.letter-paper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(88vw, 430px);
  max-height: min(82vh, 720px);
  padding: 52px 30px 62px;
  border: 2px solid rgba(255, 143, 196, 0.44);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20px 20px, rgba(255, 79, 154, 0.18) 0 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 20px) 20px, rgba(255, 79, 154, 0.18) 0 4px, transparent 5px),
    radial-gradient(circle at 20px calc(100% - 20px), rgba(255, 79, 154, 0.18) 0 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 20px) calc(100% - 20px), rgba(255, 79, 154, 0.18) 0 4px, transparent 5px),
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 79, 154, 0.22) 32px);
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.34),
    var(--shadow);
  opacity: 0;
  overflow: auto;
  scrollbar-width: none;
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, calc(-50% + 42px)) scale(0.96);
  transition: opacity 650ms ease, transform 650ms ease;
}

.letter-paper::before,
.letter-paper::after {
  position: absolute;
  color: rgba(217, 27, 114, 0.22);
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 79, 154, 0.18);
  pointer-events: none;
  z-index: 0;
}

.letter-paper::before {
  content: "✿";
  left: 14px;
  top: 14px;
  box-shadow:
    24px 2px 0 -2px rgba(217, 27, 114, 0.18),
    2px 24px 0 -2px rgba(217, 27, 114, 0.18);
}

.letter-paper::after {
  content: "❀";
  right: 14px;
  bottom: 14px;
  box-shadow:
    -24px -2px 0 -2px rgba(217, 27, 114, 0.16),
    -2px -24px 0 -2px rgba(217, 27, 114, 0.16);
}

.letter-paper::-webkit-scrollbar {
  display: none;
}

.letter-paper.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.letter-paper p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1rem;
  line-height: 2;
}

.next-button,
.yes-button,
.no-button {
  min-width: 112px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 14px 28px rgba(217, 27, 114, 0.28);
}

.next-button {
  display: block;
  margin: 22px auto 0;
  background: var(--rose-dark);
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
  transform: translateY(12px);
  transition: opacity 400ms ease, transform 400ms ease;
}

.next-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  animation: floatButton 1.7s ease-in-out infinite;
}

.question-wrap,
.playlist-wrap,
.yay-content {
  width: min(90vw, 430px);
  text-align: center;
}

.question-wrap h1 {
  margin: 0 auto 28px;
  font-size: clamp(1.45rem, 7vw, 2.3rem);
  line-height: 1.2;
}

.choice-actions {
  position: relative;
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.yes-button {
  background: linear-gradient(135deg, #d91b72, #ff4f9a, #ff8fc4);
  z-index: 2;
}

.no-button {
  position: relative;
  background: #b96b91;
  transition: transform 260ms ease;
}

.no-button.is-dodging {
  position: absolute;
  z-index: 1;
}

.playlist-wrap {
  display: grid;
  justify-items: center;
  gap: 26px;
}

.spotify-player-card {
  width: min(88vw, 390px);
  overflow: hidden;
  border-radius: 8px;
  background: #121212;
  box-shadow: 0 22px 46px rgba(105, 28, 64, 0.3);
  animation: popIn 650ms ease both;
}

.spotify-embed {
  overflow: hidden;
  border-radius: 8px;
  background: #121212;
  transition: box-shadow 240ms ease, transform 240ms ease;
}

.spotify-embed.is-highlighted {
  box-shadow:
    0 0 0 3px rgba(255, 143, 196, 0.55),
    0 0 26px rgba(255, 79, 154, 0.45);
  transform: scale(1.02);
}

.spotify-embed iframe {
  display: block;
  border: 0;
}

.playlist-next {
  min-width: 162px;
  min-height: 54px;
  padding: 13px 28px;
  border-radius: 999px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  background: linear-gradient(135deg, #d91b72, #ff4f9a);
  box-shadow: 0 16px 30px rgba(217, 27, 114, 0.32);
  animation: floatButton 1.7s ease-in-out infinite;
}

.yay-content {
  position: relative;
  animation: popIn 650ms ease both;
  z-index: 2;
}

.yay-content h2 {
  margin: 0 0 28px;
  font-size: clamp(1.55rem, 7vw, 2.35rem);
  line-height: 1.12;
}

.yay-content p {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.gift-love-button {
  position: relative;
  z-index: 4;
  min-width: 178px;
  min-height: 54px;
  padding: 14px 28px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #d91b72, #ff4f9a, #ff8fc4);
  box-shadow: 0 18px 34px rgba(217, 27, 114, 0.32);
  pointer-events: auto;
  animation: floatButton 1.7s ease-in-out infinite;
  transition: opacity 280ms ease, transform 280ms ease;
}

.gift-love-button.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.94);
}

.love-fountain {
  display: grid;
  justify-items: center;
  gap: 22px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.94);
  transition: opacity 420ms ease, transform 420ms ease;
}

.love-fountain.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-8px) scale(1);
}

.heart-canvas {
  display: block;
  width: min(84vw, 330px);
  aspect-ratio: 5 / 6.4;
  border-radius: 8px;
  background: #070006;
  box-shadow:
    0 0 0 2px rgba(255, 143, 196, 0.34),
    0 18px 40px rgba(217, 27, 114, 0.28),
    0 0 34px rgba(255, 79, 154, 0.28);
}

.love-fountain p {
  width: min(86vw, 390px);
}

@keyframes heartbeat {
  0%,
  100% {
    transform: translate(-50%, -34%) scale(1);
  }
  35% {
    transform: translate(-50%, -34%) scale(1.12);
  }
  55% {
    transform: translate(-50%, -34%) scale(0.96);
  }
}

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

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


@keyframes neonPulse {
  0%,
  100% {
    opacity: 0.36;
    filter: blur(0);
  }
  50% {
    opacity: 0.72;
    filter: blur(0.3px);
  }
}

@keyframes floatLove {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8);
  }
  12% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
    transform: translate3d(22px, -112vh, 0) rotate(24deg) scale(1.25);
  }
}

@media (max-width: 430px) {
  .screen {
    padding: 18px;
  }

  .letter-paper {
    max-height: 84vh;
    padding: 50px 24px 62px;
  }

  .letter-paper p {
    font-size: 0.98rem;
  }

  .choice-actions {
    gap: 12px;
  }

  .spotify-embed {
    width: 100%;
  }
}
