:root {
  --plum: #160a1f;
  --plum-2: #24102f;
  --rose: #ff4d6d;
  --rose-soft: #ff8fa3;
  --gold: #ffd166;
  --cream: #fff5f7;
  --muted: rgba(255, 245, 247, 0.66);
  --card: rgba(38, 17, 48, 0.62);
  --line: rgba(255, 143, 163, 0.22);
}

* { box-sizing: border-box; }

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

html { overflow-x: hidden; }

body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1200px 700px at 15% -10%, #3a1442 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #4a1030 0%, transparent 50%),
    radial-gradient(1000px 800px at 50% 120%, #2a0f3a 0%, transparent 60%),
    linear-gradient(160deg, var(--plum) 0%, #1d0c28 55%, #120818 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#hearts {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(72px + env(safe-area-inset-top)) 20px
    calc(36px + env(safe-area-inset-bottom));
}

/* iOS Safari: keep full height when the toolbar shows/hides */
@supports (-webkit-touch-callout: none) {
  html { height: -webkit-fill-available; }
  body { min-height: -webkit-fill-available; }
}

.screen {
  width: 100%;
  max-width: 620px;
  margin: auto;
  text-align: center;
  animation: rise 0.9s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.hidden { display: none !important; }

/* ---------- Intro ---------- */
.intro { position: relative; }

.intro-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 77, 109, 0.32), transparent 68%);
  filter: blur(28px);
  z-index: -1;
  animation: breathe 6s ease-in-out infinite;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--rose-soft);
  margin: 0 0 14px;
  padding-left: 0.42em;
}

.names {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 12vw, 4.6rem);
  line-height: 1.02;
  margin: 0 0 22px;
  background: linear-gradient(100deg, #fff 0%, var(--rose-soft) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(255, 77, 109, 0.25);
}

.names .amp {
  font-style: italic;
  font-weight: 400;
  opacity: 0.85;
}

.intro-text {
  font-size: clamp(1rem, 3.8vw, 1.12rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto 34px;
}

.hint {
  margin: 22px 0 0;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: rgba(255, 245, 247, 0.4);
}

/* ---------- Buttons ---------- */
.btn-primary {
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #2a0511;
  background: linear-gradient(135deg, var(--gold), var(--rose) 90%);
  border: none;
  border-radius: 999px;
  padding: 16px 34px;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(255, 77, 109, 0.42);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: pulseGlow 3.2s ease-in-out infinite;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 52px rgba(255, 77, 109, 0.6);
  outline: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary .heart { display: inline-block; animation: beat 1.4s ease-in-out infinite; }

.btn-ghost {
  margin-top: 34px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--rose-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.btn-ghost:hover { border-color: var(--rose); background: rgba(255, 77, 109, 0.08); }

/* ---------- Quiz ---------- */
.quiz { max-width: 560px; }

.progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 26px;
}
.progress .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 245, 247, 0.18);
  transition: background 0.4s ease, transform 0.4s ease;
}
.progress .dot.done { background: var(--rose); transform: scale(1.15); }
.progress .dot.current { background: var(--gold); transform: scale(1.35); box-shadow: 0 0 14px var(--gold); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: clamp(26px, 6vw, 42px) clamp(20px, 5vw, 38px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.counter {
  margin: 0 0 12px;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rose-soft);
}

.question {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1.55rem, 5.6vw, 2.1rem);
  line-height: 1.25;
  margin: 0 0 12px;
}

.subtext {
  font-size: 0.92rem;
  font-weight: 300;
  color: var(--muted);
  margin: 0 0 26px;
  min-height: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.option:hover,
.option:focus-visible {
  border-color: var(--rose);
  background: rgba(255, 77, 109, 0.1);
  transform: translateY(-1px);
  outline: none;
}
.option.chosen {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(255, 77, 109, 0.14));
  transform: scale(1.015);
}

.reply {
  margin: 22px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.28rem;
  line-height: 1.45;
  color: var(--gold);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reply.show { opacity: 1; transform: translateY(0); }

.fade-out { animation: fadeOut 0.42s ease forwards; }

/* ---------- Finale ---------- */
.finale-inner { animation: rise 1s cubic-bezier(0.19, 1, 0.22, 1) both; }

.letter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: clamp(28px, 6vw, 46px) clamp(22px, 5vw, 40px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.big-heart {
  font-size: 4.6rem;
  line-height: 1;
  color: var(--rose);
  filter: drop-shadow(0 0 26px rgba(255, 77, 109, 0.7));
  animation: beat 1.6s ease-in-out infinite;
  margin-bottom: 14px;
}

.finale h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 7.5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 22px;
  background: linear-gradient(100deg, #fff, var(--rose-soft) 55%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.finale-text {
  font-size: clamp(1rem, 4vw, 1.18rem);
  font-weight: 300;
  line-height: 1.78;
  color: rgba(255, 245, 247, 0.84);
  max-width: 480px;
  margin: 0 auto 18px;
}
.finale-text strong {
  color: var(--gold);
  font-weight: 600;
}
.finale-text.strong {
  color: var(--cream);
  font-weight: 500;
  font-size: clamp(1.1rem, 4.6vw, 1.32rem);
  margin-top: 24px;
}
.finale-text.small { font-size: 0.98rem; color: var(--rose-soft); }
.signature {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--cream);
  margin-top: 26px;
}

/* ---------- Sound toggle ---------- */
.sound-toggle {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(38, 17, 48, 0.6);
  color: var(--rose-soft);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.sound-toggle:hover { border-color: var(--rose); color: var(--cream); }
.sound-toggle.muted { color: rgba(255, 245, 247, 0.35); text-decoration: line-through; }

/* ---------- Floating hearts ---------- */
.fheart {
  position: absolute;
  bottom: -40px;
  font-size: 20px;
  color: var(--rose);
  opacity: 0;
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}

/* ---------- Animations ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-14px); }
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 12px 40px rgba(255, 77, 109, 0.42); }
  50% { box-shadow: 0 12px 56px rgba(255, 209, 102, 0.55); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.8); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-105vh) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
