:root {
  --text: #f5ebe8;
  --text-muted: rgba(245, 235, 232, 0.82);
  --blush: #f4d4d0;
  --rose-gold: #e8c9a8;
  --candle: #f5d78e;
  --glow: rgba(201, 162, 122, 0.5);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #000;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
}

/* ——— Fullscreen video ——— */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}

body.video-on .bg-video {
  opacity: 1;
}

.video-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(8, 5, 12, 0.35);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}

body.video-on .video-scrim {
  opacity: 1;
}

body.scene-opening .video-scrim {
  background: #000;
  opacity: 1;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.55) 100%);
}

.music-toggle {
  position: fixed;
  top: calc(0.65rem + var(--safe-top));
  right: 0.65rem;
  z-index: 50;
  padding: 0.4rem 0.7rem;
  border-radius: 2rem;
  border: 1px solid rgba(232, 201, 168, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: var(--rose-gold);
  font-size: 0.75rem;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

/* ——— Tap-through scenes ——— */
.app {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.25rem + var(--safe-top)) 1.25rem calc(2.5rem + var(--safe-bottom));
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: inherit;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.scene-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.scene-exit {
  opacity: 0;
}

.line {
  margin: 0 0 0.85rem;
  max-width: 22rem;
  line-height: 1.55;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.75);
}

.opening-line {
  font-size: clamp(1.4rem, 5.5vw, 1.9rem);
  font-style: italic;
  color: var(--blush);
  text-shadow: 0 0 40px var(--glow);
}

.hero-sorry {
  font-size: clamp(2.75rem, 12vw, 4rem);
  color: var(--blush);
  margin-bottom: 0.5rem;
}

.sub {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-muted);
}

.letter-stack {
  max-width: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.letter {
  font-size: 1.05rem;
  text-align: center;
}

.letter.sign {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--rose-gold);
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.glow {
  font-size: clamp(1.85rem, 8vw, 2.65rem);
  color: var(--candle);
  text-shadow:
    0 0 20px var(--candle),
    0 0 50px var(--glow);
  max-width: 16rem;
}

.love-lead {
  font-size: clamp(2rem, 9vw, 2.75rem);
  color: var(--blush);
}

.love-rest {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--rose-gold);
}

.counter {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  color: var(--candle);
  min-height: 1.5em;
  margin-top: 0.75rem;
}

.ask {
  font-size: clamp(1.45rem, 6.5vw, 2.1rem);
  color: var(--blush);
  margin-bottom: 1.5rem;
  max-width: 19rem;
  line-height: 1.35;
}

.ask-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 18rem);
}

.btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.95rem 1.1rem;
  border-radius: 2rem;
  border: none;
  cursor: pointer;
}

.btn-yes {
  background: linear-gradient(135deg, #c9a27a, #a67c52);
  color: #1a0f18;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.btn-time {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(245, 235, 232, 0.35);
  backdrop-filter: blur(4px);
}

.response {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--blush);
  max-width: 18rem;
}

.tap-hint {
  position: fixed;
  bottom: calc(0.85rem + var(--safe-bottom));
  left: 0;
  right: 0;
  z-index: 20;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 235, 232, 0.45);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body.hide-hint .tap-hint,
body.scene-ask .tap-hint {
  opacity: 0;
}

/* ——— Sorry burst (page 2) ——— */
.sorry-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sorry-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  white-space: nowrap;
  color: var(--blush);
  text-shadow:
    0 0 12px rgba(244, 212, 208, 0.35),
    0 2px 18px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  animation:
    sorry-pop-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    sorry-drift 7s ease-in-out infinite;
  animation-delay: var(--delay, 0s), calc(var(--delay, 0s) + 0.55s);
}

.sorry-pop:nth-child(3n) {
  color: var(--rose-gold);
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 400;
}

@keyframes sorry-pop-in {
  to {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(var(--scale, 1)) rotate(var(--rot, 0deg));
  }
}

@keyframes sorry-drift {
  0%, 100% {
    margin-top: 0;
    margin-left: 0;
  }
  50% {
    margin-top: -8px;
    margin-left: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sorry-pop {
    animation: sorry-pop-in 0.01s forwards;
  }

  .bg-video,
  .video-scrim,
  .scene {
    transition: none;
  }
}