:root {
  --bg: #4c0519;
  --rose: #fb7185;
  --rose-strong: #f43f5e;
  --rose-soft: #fda4af;
  --text: #fff1f2;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
}

.experience {
  position: fixed;
  inset: 0;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

.background,
.scene,
.scene-inner {
  position: absolute;
  inset: 0;
}

.background {
  z-index: 0;
  pointer-events: none;
}

.background-image {
  position: absolute;
  inset: -2%;
  background: url("images/bg-romantic.png") center / cover;
  opacity: 0.24;
  transform: translateZ(0) scale(1.02);
  animation: slow-breathe 20s linear infinite;
}

.ambient {
  position: absolute;
  width: 42vmax;
  height: 42vmax;
  border-radius: 999px;
  opacity: 0.28;
  background: radial-gradient(circle, rgba(244, 63, 94, 0.7), transparent 66%);
  transform: translateZ(0);
  will-change: transform, opacity;
}

.ambient-one {
  left: -18vmax;
  top: 4vmax;
  animation: drift-one 12s ease-in-out infinite;
}

.ambient-two {
  right: -20vmax;
  bottom: -18vmax;
  animation: drift-two 14s ease-in-out infinite;
}

.scene {
  z-index: 1;
}

.scene-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  animation: scene-in 720ms ease-out both;
}

.intro {
  flex-direction: column;
  text-align: center;
  perspective: 1200px;
}

.intro-kicker,
.intro-last,
.word,
.love-line,
.memory-heading,
.memory-text,
.memory-close,
.neon-heart,
.outro-lines h2,
.outro-lines p,
.dedication,
.dedication-love,
.signature,
.floating-heart {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 900ms ease, transform 900ms ease;
  will-change: opacity, transform;
}

.intro-kicker {
  margin: 0 0 14px;
  color: rgba(255, 241, 242, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: clamp(0.95rem, 3vw, 1.55rem);
}

.intro-title {
  max-width: 980px;
  margin: 0;
  font: 900 clamp(2.7rem, 8.8vw, 6.8rem) / 0.98 var(--font-display);
  text-shadow: 0 4px 26px rgba(244, 63, 94, 0.38);
}

.word {
  display: inline-block;
  margin-right: 0.18em;
  transform: translate3d(0, 42px, 0) rotateX(-45deg);
  transition-delay: calc(var(--i) * 100ms);
}

.intro-last {
  margin: 18px 0 0;
  color: var(--rose);
  font: 900 clamp(3rem, 9vw, 7rem) / 1 var(--font-display);
  text-shadow: 0 4px 28px rgba(251, 113, 133, 0.55);
  transform: scale(0.86);
}

.scene-intro.phase-1 .intro-kicker,
.scene-intro.phase-2 .word,
.scene-intro.phase-3 .intro-last,
.scene-intro.phase-1 .floating-heart {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotateX(0) scale(1);
}

.floating-heart {
  position: absolute;
  color: var(--rose);
  font-size: clamp(2.4rem, 6vw, 4rem);
  animation: float-heart 4.8s ease-in-out infinite;
}

.heart-one {
  left: 22%;
  top: 24%;
}

.heart-two {
  right: 24%;
  bottom: 24%;
  color: var(--rose-strong);
  font-size: clamp(2rem, 5vw, 3.4rem);
  animation-delay: 1s;
}

.memory {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  padding: 0;
}

.memory-image {
  position: relative;
  min-width: 0;
  overflow: hidden;
  transform: translate3d(-100%, 0, 0);
  transition: transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
}

.memory-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg));
}

.memory-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
}

.memory-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 84px);
}

.love-line {
  margin: 0 0 24px;
  color: var(--rose);
  font: 900 clamp(3.2rem, 8vw, 7rem) / 0.92 var(--font-display);
  text-shadow: 0 4px 28px rgba(251, 113, 133, 0.48);
  transform: scale(0.76);
}

.memory-heading h2 {
  margin: 0 0 18px;
  font: 800 clamp(2rem, 4.7vw, 4.8rem) / 1.05 var(--font-display);
}

.memory-heading span {
  display: block;
  width: 88px;
  height: 4px;
  background: var(--rose);
}

.memory-text,
.memory-close {
  max-width: 680px;
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 2.15rem);
  line-height: 1.45;
}

.memory-text {
  color: rgba(255, 241, 242, 0.9);
  margin-top: 28px;
}

.memory-close {
  color: var(--rose-soft);
  margin-top: 24px;
  font-style: italic;
  font-weight: 600;
}

.scene-memory.phase-1 .memory-image,
.scene-memory.phase-1 .love-line,
.scene-memory.phase-2 .memory-heading,
.scene-memory.phase-3 .memory-text,
.scene-memory.phase-4 .memory-close {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.outro {
  text-align: center;
}

.heart-part,
.dedication {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
}

.heart-part {
  background: rgba(0, 0, 0, 0.34);
  transition: opacity 1200ms ease;
}

.scene-outro.phase-4 .heart-part {
  opacity: 0;
  pointer-events: none;
}

.neon-heart {
  position: absolute;
  width: min(58vw, 420px);
  aspect-ratio: 1;
  transform: scale(0.2) rotate(-35deg);
}

.neon-heart img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.82;
  mix-blend-mode: screen;
}

.neon-heart span {
  position: absolute;
  inset: 14%;
  border-radius: 999px;
  box-shadow: 0 0 50px rgba(244, 63, 94, 0.75);
  animation: glow 3s ease-in-out infinite;
}

.outro-lines {
  position: relative;
  z-index: 2;
  max-width: 960px;
  margin-top: 28vh;
}

.outro-lines h2 {
  margin: 0;
  font: 900 clamp(2.5rem, 7vw, 6rem) / 1.05 var(--font-display);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.75);
}

.outro-lines p {
  margin: 8px 0 0;
  color: var(--rose);
  font: 900 clamp(2.6rem, 7.8vw, 6.6rem) / 1.02 var(--font-display);
  text-shadow: 0 4px 22px rgba(251, 113, 133, 0.48);
  transform: scale(0.9);
}

.dedication {
  opacity: 0;
}

.dedication h1 {
  margin: 28px 0 8px;
  font: 900 clamp(3rem, 8vw, 7rem) / 1 var(--font-display);
}

.dedication-love,
.signature {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 3.6rem);
  font-weight: 300;
  letter-spacing: 0.14em;
}

.dedication-love {
  color: var(--rose);
}

.signature {
  margin-top: 8px;
  color: rgba(255, 241, 242, 0.82);
  font-family: var(--font-display);
}

.line {
  display: block;
  width: 1px;
  height: min(18vh, 128px);
  background: linear-gradient(180deg, transparent, var(--rose), transparent);
  transform: scaleY(0);
  transition: transform 900ms ease;
}

.scene-outro.phase-1 .neon-heart,
.scene-outro.phase-2 .outro-lines h2,
.scene-outro.phase-3 .outro-lines p,
.scene-outro.phase-4 .dedication,
.scene-outro.phase-4 .line,
.scene-outro.phase-5 .dedication-love,
.scene-outro.phase-6 .signature {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0) scale(1);
}

.start-button {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  width: 100%;
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border: 0;
  color: var(--text);
  background: rgba(76, 5, 25, 0.84);
  cursor: pointer;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.start-title {
  font: 900 clamp(2.6rem, 10vw, 7rem) / 1 var(--font-display);
  text-shadow: 0 4px 26px rgba(244, 63, 94, 0.45);
}

.start-subtitle {
  max-width: 300px;
  color: rgba(255, 241, 242, 0.72);
  font-size: 1rem;
}

.start-button.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.start-button.loading .start-subtitle {
  opacity: 0.64;
}

@keyframes scene-in {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slow-breathe {
  50% {
    transform: translateZ(0) scale(1.06);
  }
}

@keyframes drift-one {
  50% {
    transform: translate3d(58vw, 18vh, 0) scale(1.12);
  }
}

@keyframes drift-two {
  50% {
    transform: translate3d(-48vw, -20vh, 0) scale(1.08);
  }
}

@keyframes float-heart {
  50% {
    transform: translate3d(0, -24px, 0) rotate(9deg) scale(1.12);
  }
}

@keyframes glow {
  50% {
    box-shadow: 0 0 82px rgba(244, 63, 94, 0.88);
  }
}

@media (max-width: 720px) {
  .ambient {
    opacity: 0.18;
  }

  .memory {
    display: flex;
    flex-direction: column;
  }

  .memory-image {
    position: absolute;
    inset: 0;
    opacity: 0.26;
  }

  .memory-image::after {
    background: rgba(76, 5, 25, 0.52);
  }

  .memory-copy {
    position: relative;
    z-index: 1;
    min-height: 100%;
    padding: 26px;
  }

  .memory-text,
  .memory-close {
    max-width: 100%;
  }

  .outro-lines {
    margin-top: 24vh;
  }

  .dedication-love,
  .signature {
    letter-spacing: 0.08em;
  }
}

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