:root {
  --night-transition-duration-ms: 5000ms;
  --confetti-duration-ms: 5000ms;
  --title-glitter-duration-ms: 10000ms;
  --lotus-settle-duration-ms: 1800ms;
  --lotus-height: 190px;
  --lotus-bottom-gap: 10px;
  --bg-1: #fff6d8;
  --bg-2: #ffcfa8;
  --bg-3: #ffd9ef;
  --ink: #2f1d14;
  --card: #fffaf1a8;
  --line: #f3bd8c;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow: hidden;
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 18%, #223058 0 18%, #00000000 19%),
    radial-gradient(circle at 74% 24%, #182847 0 16%, #00000000 17%),
    radial-gradient(circle at 44% 82%, #101c37 0 20%, #00000000 21%),
    linear-gradient(170deg, #081225 0%, #0f1f3f 52%, #1a2952 100%);
  padding: 24px;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 20%, #fff2b7 0 16%, transparent 17%),
    radial-gradient(circle at 84% 72%, #ffc8a8 0 14%, transparent 15%),
    linear-gradient(130deg, var(--bg-1) 0%, var(--bg-2) 58%, var(--bg-3) 100%);
  opacity: 0;
  transition: opacity var(--night-transition-duration-ms) ease-out;
}

body.phase-1-to-day::before {
  opacity: 1;
}

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

body.mobile-lite #confetti-canvas,
body.mobile-lite .ambient,
body.mobile-lite .ribbon {
  display: none;
}

body.mobile-lite .stars::after {
  display: none;
}

body.mobile-lite .stars .star:nth-child(n + 11) {
  display: none;
}

body.mobile-lite .card,
body.mobile-lite .video-shell {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--night-transition-duration-ms) linear;
}

body.phase-1-to-day .stars {
  opacity: 0;
}

.stars::before,
.stars::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: #ffffffc7;
  box-shadow:
    18vw 6vh #ffffffdd,
    9vw 18vh #ffffffc9,
    31vw 12vh #d9e6ffcc,
    42vw 7vh #ffffffd6,
    53vw 17vh #f4f8ffda,
    64vw 10vh #ffffffce,
    72vw 5vh #ffffffdc,
    83vw 15vh #dfe9ffd8,
    92vw 11vh #ffffffdd,
    5vw 28vh #d7e2ffcf,
    14vw 35vh #ffffffd3,
    25vw 27vh #ffffffcf,
    36vw 31vh #dce8ffd2,
    47vw 24vh #ffffffdb,
    58vw 33vh #ffffffcf,
    69vw 26vh #dfe9ffce,
    79vw 34vh #ffffffd8,
    88vw 29vh #ecf2ffd7,
    97vw 23vh #ffffffd1,
    11vw 46vh #d5e2ffcf,
    22vw 51vh #ffffffd8,
    34vw 44vh #e9f1ffd2,
    44vw 49vh #ffffffcd,
    55vw 42vh #ffffffd7,
    67vw 50vh #e0ebffd3,
    78vw 43vh #ffffffd8,
    89vw 47vh #d7e5ffd2,
    96vw 54vh #ffffffcf;
  animation: twinkle-weak 3.1s ease-in-out infinite alternate;
}

.stars::before {
  top: 0;
  left: 0;
}

.stars::after {
  top: 0;
  left: 0;
  opacity: 0.72;
  transform: translateY(5vh);
  animation-duration: 4.1s;
  animation-delay: -1.4s;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 10px #fff7, 0 0 16px #c7d5ff66;
  opacity: 0.25;
  animation: twinkle ease-in-out infinite alternate;
}

.s1 { top: 8%; left: 8%; animation-duration: 1.8s; animation-delay: -0.7s; }
.s2 { top: 11%; left: 18%; animation-duration: 2.4s; animation-delay: -1.2s; }
.s3 { top: 14%; left: 31%; animation-duration: 1.5s; animation-delay: -0.4s; }
.s4 { top: 6%; left: 44%; animation-duration: 2.1s; animation-delay: -1.4s; }
.s5 { top: 9%; left: 56%; animation-duration: 1.9s; animation-delay: -0.2s; }
.s6 { top: 12%; left: 67%; animation-duration: 2.7s; animation-delay: -1.9s; }
.s7 { top: 7%; left: 79%; animation-duration: 2.2s; animation-delay: -0.9s; }
.s8 { top: 15%; left: 90%; animation-duration: 1.7s; animation-delay: -1.1s; }
.s9 { top: 22%; left: 13%; animation-duration: 2.3s; animation-delay: -0.6s; }
.s10 { top: 19%; left: 25%; animation-duration: 1.6s; animation-delay: -1.7s; }
.s11 { top: 26%; left: 38%; animation-duration: 2s; animation-delay: -0.3s; }
.s12 { top: 21%; left: 49%; animation-duration: 2.8s; animation-delay: -2s; }
.s13 { top: 24%; left: 60%; animation-duration: 1.7s; animation-delay: -0.1s; }
.s14 { top: 28%; left: 72%; animation-duration: 2.1s; animation-delay: -0.8s; }
.s15 { top: 20%; left: 84%; animation-duration: 2.4s; animation-delay: -1.5s; }
.s16 { top: 31%; left: 8%; animation-duration: 1.8s; animation-delay: -1s; }
.s17 { top: 33%; left: 20%; animation-duration: 2.5s; animation-delay: -0.5s; }
.s18 { top: 36%; left: 57%; animation-duration: 1.9s; animation-delay: -1.3s; }
.s19 { top: 34%; left: 76%; animation-duration: 2.2s; animation-delay: -0.4s; }
.s20 { top: 30%; left: 92%; animation-duration: 2.6s; animation-delay: -1.6s; }

.lotus-stars {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(420px, 96vw);
  height: var(--lotus-height);
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  transition:
    top var(--lotus-settle-duration-ms) cubic-bezier(0.2, 0.75, 0.28, 1),
    transform var(--lotus-settle-duration-ms) cubic-bezier(0.2, 0.75, 0.28, 1);
}

body.lotus-settled .lotus-stars {
  top: calc(100% - var(--lotus-bottom-gap) - var(--lotus-height));
  transform: translate(-50%, 0);
}

.lotus-stars::before {
  content: "";
  position: fixed;
  left: 50%;
  bottom: -2px;
  width: min(1600px, 150vw);
  height: min(820px, 76vw);
  transform: translateX(-50%);
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(ellipse at 50% 100%, #22172b46 0%, #271b3042 26%, #2a1f322d 44%, #00000000 72%),
    radial-gradient(ellipse at 50% 100%, #1a132219 0%, #00000000 78%);
  filter: blur(10px);
  opacity: 0.88;
  mix-blend-mode: multiply;
  z-index: 0;
  pointer-events: none;
}

.lotus-svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lotus-path {
  fill: none;
  stroke: #fff7d6;
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 0 12;
  opacity: 0.84;
  filter: drop-shadow(0 0 7px #fff4cfaa) drop-shadow(0 0 14px #ffd9a16e);
  transform-origin: center;
  animation: lotus-path-twinkle 3.1s ease-in-out infinite;
}

.lotus-path.lp1 { animation-duration: 2.6s; }
.lotus-path.lp2 { animation-duration: 2.9s; animation-delay: -0.7s; }
.lotus-path.lp3 { animation-duration: 3s; animation-delay: -1.2s; }
.lotus-path.lp4 { animation-duration: 3.3s; animation-delay: -0.5s; }
.lotus-path.lp5 { animation-duration: 3.2s; animation-delay: -1.1s; }
.lotus-path.lp6 { animation-duration: 3.4s; animation-delay: -0.3s; }
.lotus-path.lp7 { animation-duration: 3.5s; animation-delay: -1.3s; }
.lotus-path.lp8 { animation-duration: 2.8s; animation-delay: -0.9s; }
.lotus-path.water {
  stroke-width: 3.2;
  stroke-dasharray: 0 11;
  opacity: 0.7;
  animation-duration: 3.8s;
}

.ambient {
  position: fixed;
  inset: -10%;
  z-index: 2;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 999px;
  opacity: 0.55;
  filter: blur(0.5px);
  animation: orb-drift linear infinite;
}

.orb-1 {
  width: 220px;
  height: 220px;
  left: 10%;
  top: 14%;
  background: radial-gradient(circle at 40% 40%, #fff7ca 0%, #ffd88e 70%);
  animation-duration: 17s;
}

.orb-2 {
  width: 280px;
  height: 280px;
  right: 4%;
  top: 8%;
  background: radial-gradient(circle at 30% 30%, #ffeec8 0%, #ffb6ab 75%);
  animation-duration: 21s;
  animation-delay: -5s;
}

.orb-3 {
  width: 240px;
  height: 240px;
  left: 16%;
  bottom: -2%;
  background: radial-gradient(circle at 40% 40%, #ffd9f5 0%, #ffc0df 70%);
  animation-duration: 24s;
  animation-delay: -9s;
}

.orb-4 {
  width: 200px;
  height: 200px;
  right: 17%;
  bottom: 3%;
  background: radial-gradient(circle at 32% 32%, #fff0b8 0%, #ffd09d 68%);
  animation-duration: 19s;
  animation-delay: -3s;
}

.balloons {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 700ms ease-out;
}

.balloon {
  position: absolute;
  bottom: -200px;
  width: clamp(58px, 8vw, 76px);
  aspect-ratio: 0.8;
  border-radius: 52% 48% 50% 50%;
  box-shadow: inset -8px -12px 24px #00000022, 0 8px 22px #00000024;
  animation:
    balloon-rise linear infinite,
    balloon-sway ease-in-out infinite;
  animation-play-state: paused;
}

.balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -7px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #c58568;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 96%;
  width: 1.5px;
  height: 148px;
  background: linear-gradient(to bottom, #af8b76, #7f624f88);
}

.b1 {
  left: 7%;
  background: linear-gradient(160deg, #ff8b85, #ff7a58);
  animation-duration: 20s, 5s;
}

.b2 {
  left: 22%;
  background: linear-gradient(160deg, #ffd379, #ffb24d);
  animation-duration: 24s, 6s;
  animation-delay: -11s, -1s;
}

.b3 {
  right: 18%;
  background: linear-gradient(160deg, #95dbff, #5cabff);
  animation-duration: 23s, 5.5s;
  animation-delay: -7s, -2s;
}

.b4 {
  right: 4%;
  background: linear-gradient(160deg, #ff9fdd, #ec78be);
  animation-duration: 21s, 6.5s;
  animation-delay: -14s, -4s;
}

.ribbon {
  position: absolute;
  top: -140px;
  width: 14px;
  height: 280px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff00 0%, #ffffff99 20%, #ffffff15 100%);
  opacity: 0.35;
  animation: ribbon-fall linear infinite;
  animation-play-state: paused;
}

body.phase-3-balloons .balloons {
  opacity: 1;
}

body.phase-3-balloons .balloon,
body.phase-3-balloons .ribbon {
  animation-play-state: running;
}

.r1 {
  left: 38%;
  animation-duration: 12s;
  animation-delay: -3s;
}

.r2 {
  left: 62%;
  animation-duration: 14s;
  animation-delay: -8s;
}

.r3 {
  left: 78%;
  animation-duration: 11s;
  animation-delay: -5s;
}

.content-stack {
  position: relative;
  z-index: 5;
  width: min(560px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 1px solid #f0bf9770;
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(10px) saturate(1.05);
  padding: 30px 28px;
  text-align: center;
  box-shadow:
    0 18px 48px #3a1b051f,
    inset 0 1px 0 #fff9e9a8;
  opacity: 1;
  transform: none;
}

body.js-ready .card {
  opacity: 0;
  transform: translateY(22px) scale(0.96);
}

body.js-ready.phase-2-card .card {
  animation: card-enter 900ms cubic-bezier(0.18, 0.85, 0.3, 1.1) 120ms forwards;
}

.video-shell {
  width: min(420px, 92vw);
  border: 1px solid #efc39e66;
  border-radius: 18px;
  background: #fff6ec87;
  backdrop-filter: blur(10px) saturate(1.03);
  padding: 10px;
  box-shadow:
    0 14px 28px #2c160e1f,
    inset 0 1px 0 #fff4e1b5;
  opacity: 1;
  transform: none;
  -webkit-touch-callout: none;
}

body.js-ready .video-shell {
  opacity: 0;
  transform: translateY(14px) scale(0.97);
}

body.js-ready.phase-2-video .video-shell {
  animation: video-enter 760ms cubic-bezier(0.2, 0.86, 0.34, 1.05) forwards;
}

.video-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  object-fit: cover;
  background: #00000045;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.hero-title {
  position: relative;
  isolation: isolate;
}

.hero-title .word {
  position: relative;
  display: inline-block;
  color: #2f1d14;
  opacity: 1;
  transform: none;
  animation: none;
  text-shadow: 0 0 0 #2f1d14;
}

.hero-title .word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  background: linear-gradient(102deg, #fff7e7 14%, #ffd9ad 42%, #fff5e0 70%, #f8c58e 96%);
  background-size: 180% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 6px #ffe7c491;
  opacity: 0.58;
  pointer-events: none;
  animation:
    glitter-shift 2.7s ease-in-out infinite,
    glitter-fade var(--title-glitter-duration-ms) ease-out forwards;
}

.hero-title::before,
.hero-title::after {
  content: "";
  position: absolute;
  top: 8%;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background:
    radial-gradient(circle, #fffffc 0%, #fff6d6 42%, #0000 72%);
  filter: drop-shadow(0 0 7px #fffce0b7) drop-shadow(0 0 12px #ffe7bf66);
  opacity: 0.5;
  pointer-events: none;
  z-index: 2;
  animation:
    sparkle-twinkle 1.9s ease-in-out 1.1s infinite,
    glitter-fade var(--title-glitter-duration-ms) linear forwards;
}

.hero-title::before {
  left: 12%;
}

.hero-title::after {
  right: 10%;
  top: 52%;
  animation-delay: 1.55s, 0s;
}

.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px) rotate(3deg);
}

body.phase-2-card .hero-subtitle .word {
  animation: word-in 780ms cubic-bezier(0.21, 0.82, 0.33, 1) forwards;
  animation-delay: 400ms;
}

.card-divider {
  margin: 18px auto 16px;
  width: min(290px, 82%);
  border: 0;
  border-top: 1px solid #b7865d66;
}

.message-line {
  margin: 0;
  font-size: clamp(0.98rem, 2.2vw, 1.12rem);
  line-height: 1.45;
  color: #3c2418;
}

.message-line + .message-line {
  margin-top: 6px;
}

.signature {
  margin-top: 10px;
  text-align: right;
  padding-right: min(24px, 5%);
  font-style: italic;
}

@keyframes card-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes word-in {
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes video-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sparkle-twinkle {
  0% {
    transform: scale(0.72) rotate(0deg);
    filter: brightness(0.9);
  }
  35% {
    transform: scale(1.15) rotate(48deg);
    filter: brightness(1.1);
  }
  100% {
    transform: scale(0.8) rotate(95deg);
    filter: brightness(0.96);
  }
}

@keyframes glitter-shift {
  0% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 0% 50%;
  }
  100% {
    background-position: -10% 50%;
  }
}

@keyframes glitter-fade {
  0% {
    opacity: 0.58;
  }
  85% {
    opacity: 0.18;
  }
  100% {
    opacity: 0;
  }
}

@keyframes orb-drift {
  0% {
    transform: translateY(0) translateX(0) scale(1);
  }
  50% {
    transform: translateY(-18px) translateX(8px) scale(1.03);
  }
  100% {
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes sky-to-day {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes twinkle {
  from {
    opacity: 0.16;
    transform: scale(0.8);
  }
  to {
    opacity: 0.95;
    transform: scale(1.75);
  }
}

@keyframes twinkle-weak {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0.9;
  }
}

@keyframes stars-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes lotus-path-twinkle {
  0% {
    opacity: 0.45;
    filter: saturate(0.85);
  }
  50% {
    opacity: 1;
    filter: saturate(1.1);
  }
  100% {
    opacity: 0.55;
    filter: saturate(0.9);
  }
}

@keyframes balloon-rise {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-140vh);
  }
}

@keyframes balloon-sway {
  0% {
    margin-left: -10px;
  }
  50% {
    margin-left: 10px;
  }
  100% {
    margin-left: -10px;
  }
}

@keyframes ribbon-fall {
  0% {
    transform: translateY(0) rotate(-7deg);
  }
  100% {
    transform: translateY(130vh) rotate(8deg);
  }
}

@media (max-width: 720px) {
  :root {
    --lotus-height: 146px;
    --lotus-bottom-gap: 4px;
  }

  .content-stack {
    gap: 12px;
  }

  .card {
    padding: 24px 20px;
  }

  .video-shell {
    width: min(380px, 94vw);
    padding: 8px;
  }

  .balloon::after {
    height: 110px;
  }

  .lotus-stars {
    height: var(--lotus-height);
  }

  .lotus-stars::before {
    width: 170vw;
    height: 84vw;
    filter: blur(8px);
    opacity: 0.82;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    transition: none !important;
    opacity: 1;
  }

  .stars {
    transition: none !important;
    opacity: 0;
  }

  .lotus-path {
    animation: none !important;
  }

  .hero-title .word {
    animation: none !important;
    background: none;
    color: #2f1d14;
  }

  .hero-title::before,
  .hero-title::after {
    animation: none !important;
    opacity: 0;
  }

  .hero-title .word::after {
    animation: none !important;
    opacity: 0;
    background: none;
    text-shadow: none;
  }

  .card,
  .video-shell,
  .word,
  .orb,
  .balloon,
  .ribbon {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.hero-subtitle,
.hero-subtitle .word {
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.35;
}
