@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --rose-50: #fff3f6;
  --rose-100: #ffe1ea;
  --rose-200: #ffc3d6;
  --rose-300: #ff9fbe;
  --rose-400: #ff6d99;
  --rose-500: #e83b6f;
  --rose-600: #c52658;
  --ink-900: #180710;
  --ink-700: #3b0f2a;
  --ink-500: #5a2741;
  --plum-600: #2a0a2f;
  --plum-400: #4a1b4f;
  --gold-300: #ffd480;
  --sky-100: #f8fbff;
  --shadow: 0 20px 50px rgba(197, 38, 88, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink-700);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 10%, #fff 0%, var(--rose-50) 32%, #f5e2ea 70%, #f1dbe6 100%);
  overflow: hidden;
  padding: 24px 16px 40px;
}

body.screen-1-active {
  color: #f6eef4;
  background: radial-gradient(circle at 20% 10%, #2a0a2f 0%, #12060f 55%, #0c050a 100%);
}

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.bg::before,
.bg::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.75;
  animation: orbFloat 16s ease-in-out infinite;
}

.bg::before {
  background: radial-gradient(circle, rgba(74, 27, 79, 0.45), transparent 70%);
  top: -200px;
  left: -140px;
}

.bg::after {
  background: radial-gradient(circle, rgba(232, 59, 111, 0.35), transparent 70%);
  bottom: -220px;
  right: -120px;
  animation-delay: -6s;
}

.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.55), transparent 55%),
    radial-gradient(circle at 25% 75%, rgba(255, 212, 128, 0.18), transparent 45%);
  opacity: 0.7;
}

.gradient-orb {
  position: absolute;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 212, 128, 0.28), rgba(232, 59, 111, 0.12), transparent 70%);
  bottom: -160px;
  left: -140px;
  filter: blur(6px);
  animation: orbPulse 10s ease-in-out infinite;
}

.sparkles {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.25;
  animation: drift 18s linear infinite;
  mix-blend-mode: screen;
}

.bg .mist {
  position: absolute;
  inset: -40% -20%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(74, 27, 79, 0.18),
    transparent 40%,
    rgba(232, 59, 111, 0.15),
    transparent 70%,
    rgba(255, 212, 128, 0.2)
  );
  opacity: 0.5;
  animation: mistSpin 28s linear infinite;
}

.bg .ripple {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 55%);
  opacity: 0.35;
  animation: ripple 12s ease-in-out infinite;
}

body.screen-1-active .bg::before {
  background: radial-gradient(circle, rgba(95, 148, 255, 0.25), transparent 70%);
  top: -220px;
  left: -180px;
}

body.screen-1-active .bg::after {
  background: radial-gradient(circle, rgba(155, 77, 255, 0.25), transparent 70%);
  bottom: -240px;
  right: -160px;
}

body.screen-1-active .glow {
  background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.2), transparent 60%),
    radial-gradient(circle at 25% 75%, rgba(110, 200, 255, 0.12), transparent 55%);
  opacity: 0.5;
}

body.screen-1-active .gradient-orb {
  background: radial-gradient(circle at 30% 30%, rgba(110, 200, 255, 0.2), rgba(155, 77, 255, 0.12), transparent 70%);
  opacity: 0.85;
}

body.screen-1-active .sparkles {
  background-image: radial-gradient(rgba(180, 220, 255, 0.35) 1px, transparent 1px);
  opacity: 0.2;
}

body.screen-1-active .bg .mist {
  opacity: 0.65;
  filter: saturate(1.2);
}

body.screen-1-active .bg .ripple {
  opacity: 0.25;
}

body.screen-1-active .card {
  background: rgba(18, 8, 20, 0.78);
  border: 1px solid rgba(120, 160, 255, 0.25);
  box-shadow: 0 24px 60px rgba(10, 4, 12, 0.55);
}

body.screen-1-active .hint {
  color: #d9c9d8;
}

body.screen-1-active .letter p {
  color: var(--ink-700);
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-40px);
  }
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(20px, -30px);
  }
}

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

@keyframes mistSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes ripple {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.5;
  }
}

.card {
  position: relative;
  z-index: 1;
  width: min(96vw, 660px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-radius: 26px;
  padding: 28px 20px 34px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 59, 111, 0.2);
}

.screen {
  display: none;
  text-align: center;
  animation: fadeIn 0.55s ease;
}

.screen.active {
  display: block;
}

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

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(1.5rem, 4.2vw, 2.25rem);
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}

.hint {
  margin-top: 18px;
  font-weight: 600;
  color: var(--ink-500);
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.25s ease;
  width: min(92vw, 280px);
}

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

.btn.primary {
  background: linear-gradient(135deg, var(--rose-600), var(--rose-400));
  color: white;
  box-shadow: 0 12px 25px rgba(197, 38, 88, 0.35);
}

.btn.secondary {
  background: var(--sky-100);
  color: var(--ink-700);
  border: 2px solid rgba(232, 59, 111, 0.2);
}

.btn.danger {
  background: linear-gradient(135deg, #8c2450, #b43863);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(140, 36, 80, 0.35);
}

.btn:hover {
  transform: translateY(-2px);
}

.envelope {
  position: relative;
  width: min(84vw, 320px);
  height: 210px;
  margin: 0 auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  filter: drop-shadow(0 18px 24px rgba(197, 38, 88, 0.18));
}

.envelope:hover {
  transform: translateY(-4px);
  filter: drop-shadow(0 22px 28px rgba(197, 38, 88, 0.24));
}

.back {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #fff2f7, #ffd0df);
  border-radius: 18px;
  border: 1px solid rgba(197, 38, 88, 0.2);
}

.flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-bottom: 120px solid #ffb6cf;
  transform-origin: top;
  transition: transform 0.6s ease;
  filter: drop-shadow(0 6px 10px rgba(197, 38, 88, 0.15));
  z-index: 3;
}

.pocket {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

.pocket::before,
.pocket::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 0;
  border-top: 105px solid transparent;
  border-bottom: 105px solid transparent;
  filter: drop-shadow(0 8px 10px rgba(197, 38, 88, 0.08));
}

.pocket::before {
  left: 0;
  border-left: 160px solid #ffc1d6;
}

.pocket::after {
  right: 0;
  border-right: 160px solid #ffb2cb;
}

.bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 90px solid #ff94b6;
  z-index: 2;
}

.seal {
  position: absolute;
  width: 54px;
  height: 54px;
  background: radial-gradient(circle at 30% 30%, #ff99b6, var(--rose-600));
  border-radius: 50%;
  bottom: 38px;
  box-shadow: 0 10px 18px rgba(197, 38, 88, 0.25);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}

.seal::before {
  content: "XO";
}

.letter {
  position: absolute;
  bottom: 22px;
  width: 80%;
  background: #fff9fb;
  border-radius: 12px;
  padding: 18px 18px 22px;
  box-shadow: inset 0 0 0 2px rgba(197, 38, 88, 0.08);
  transform: translateY(68px);
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
  font-weight: 600;
  z-index: 4;
}

.letter p {
  margin: 0;
  color: var(--ink-700);
  line-height: 1.35;
}

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

.envelope.open .letter {
  transform: translateY(0);
  opacity: 1;
}


.no-zone {
  position: relative;
  min-height: 160px;
}

#no-btn {
  position: static;
  z-index: 2;
}

#no-btn.is-running {
  position: fixed;
  z-index: 6;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  width: 10px;
  height: 16px;
  opacity: 0.9;
  border-radius: 2px;
  animation: fall 3.4s linear infinite;
}

@keyframes fall {
  0% {
    transform: translateY(-120px) rotate(0deg);
  }
  100% {
    transform: translateY(520px) rotate(360deg);
  }
}

.sub {
  margin-top: 12px;
  font-weight: 600;
  color: var(--ink-500);
}

@media (min-width: 640px) {
  body {
    padding: 36px;
  }

  .card {
    padding: 36px 34px 42px;
  }

  .btn-row {
    flex-direction: row;
  }

  .btn {
    width: auto;
    min-width: 160px;
  }
}

@media (min-width: 860px) {
  .card {
    padding: 44px 44px 54px;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 24px 18px 32px;
  }

  .envelope {
    height: 190px;
  }

  .flap {
    border-left-width: 140px;
    border-right-width: 140px;
    border-bottom-width: 112px;
  }

  .pocket::before {
    border-left-width: 140px;
  }

  .pocket::after {
    border-right-width: 140px;
  }

  .bottom {
    border-left-width: 140px;
    border-right-width: 140px;
    border-top-width: 80px;
  }
}
