:root {
  --bg-top: #fff6f3;
  --bg-mid: #ffe2e2;
  --bg-bottom: #ffd0d5;
  --ink: #5f3340;
  --muted: #8b5d68;
  --panel: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(255, 250, 250, 0.8);
  --line: rgba(135, 89, 102, 0.14);
  --shadow: 0 24px 60px rgba(170, 111, 127, 0.18);
  --glow: 0 0 40px rgba(255, 244, 214, 0.8);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(255, 244, 214, 0.78), transparent 22%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
}

code {
  font-size: 0.92em;
}

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

.page-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.glow-left {
  top: 8%;
  left: -6rem;
  width: 18rem;
  height: 18rem;
  background: rgba(255, 214, 214, 0.9);
}

.glow-right {
  right: -4rem;
  bottom: 12%;
  width: 14rem;
  height: 14rem;
  background: rgba(255, 239, 208, 0.85);
}

.letter-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 5rem 1.5rem 7rem;
}

.hero,
.message-panel,
.voice-panel,
.affirmations,
.final-panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  min-height: 88vh;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 36px;
  padding: 3rem 1.5rem;
}

.hero h1,
.voice-panel h2,
.affirmations h2,
.final-message h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hero h1 {
  font-size: clamp(3rem, 9vw, 5.8rem);
  line-height: 0.94;
  max-width: 8ch;
}

.hero-copy {
  margin: 1rem 0 2rem;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--muted);
}

.primary-button,
.play-button {
  border: none;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.primary-button {
  padding: 1rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #d97085, #f3aa99);
  color: #fffaf7;
  box-shadow: 0 16px 30px rgba(195, 102, 124, 0.28);
}

.primary-button:hover,
.primary-button:focus-visible,
.play-button:hover,
.play-button:focus-visible {
  transform: translateY(-2px) scale(1.02);
}

.letter-stream {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

.message-panel,
.voice-panel,
.affirmations,
.final-panel {
  border-radius: 32px;
  padding: clamp(1.6rem, 5vw, 3rem);
}

.message-panel {
  min-height: 34vh;
  display: flex;
  align-items: center;
}

.message-panel p {
  margin: 0;
  max-width: 16ch;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.06;
}

.voice-panel,
.affirmations,
.final-panel {
  text-align: center;
}

.voice-panel h2,
.affirmations h2,
.final-message h2 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1;
}

.play-button {
  width: 112px;
  height: 112px;
  margin: 2rem auto 1rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #fff4ee 0%, #ffd8cf 48%, #e89aa4 100%);
  box-shadow:
    0 0 0 12px rgba(255, 244, 239, 0.45),
    0 22px 40px rgba(208, 124, 143, 0.26);
}

.play-button.is-playing {
  animation: pulse 1.8s ease-in-out infinite;
}

.play-icon {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 24px solid #7f4053;
}

.play-button.is-playing .play-icon {
  width: 20px;
  height: 24px;
  margin-left: 0;
  border: none;
  background:
    linear-gradient(90deg, #7f4053 0 36%, transparent 36% 64%, #7f4053 64% 100%);
}

.voice-note {
  margin: 0;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.affirmation-card {
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  text-align: left;
  padding: 1.4rem;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(147, 95, 109, 0.1);
}

.affirmation-card p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.final-panel {
  position: relative;
  overflow: hidden;
}

.final-trigger {
  margin-bottom: 1.5rem;
}

.final-message {
  padding: 1rem 0 0.5rem;
  animation: riseIn 900ms ease forwards;
}

.final-message::before {
  content: "";
  position: absolute;
  inset: 20% 12%;
  background: radial-gradient(circle, rgba(255, 246, 215, 0.88), transparent 62%);
  filter: blur(18px);
  z-index: -1;
}

.reveal {
  opacity: 0;
  transform: translateY(42px);
  transition: opacity 820ms ease, transform 820ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  0%, 100% {
    box-shadow:
      0 0 0 12px rgba(255, 244, 239, 0.45),
      0 22px 40px rgba(208, 124, 143, 0.26);
  }
  50% {
    box-shadow:
      0 0 0 18px rgba(255, 244, 239, 0.3),
      0 28px 46px rgba(208, 124, 143, 0.34);
  }
}

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

@media (max-width: 720px) {
  .letter-shell {
    padding: 1rem 1rem 5rem;
  }

  .hero {
    min-height: 92vh;
  }

  .message-panel {
    min-height: 28vh;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .affirmation-card {
    min-height: 148px;
  }
}
