:root {
  --color-blush: #ff5c8d;
  --color-blush-2: #ff9dbd;
  --color-rose: #d93a73;
  --color-ink: #8a3358;
  --color-cream: #fff8fb;
  --color-soft: #ffe3ed;
  --font-script: "Dancing Script", "Segoe Script", cursive;
  --font-ui: "Quicksand", system-ui, sans-serif;
}

  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  html,
  body,
  #root {
    height: 100%;
  }
  body {
    margin: 0;
    overflow: hidden;
    background: #fde7ef;
    color: var(--color-ink);
    font-family: var(--font-ui);
    -webkit-tap-highlight-color: transparent;
  }
}

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--color-ink);
  background:
    radial-gradient(90% 70% at 50% 18%, #fff7fa 0%, transparent 55%),
    radial-gradient(80% 60% at 50% 100%, #ffd0e2 0%, #fde7ef 42%, #fff1f6 100%);
  touch-action: none;
  user-select: none;
}
.scene.is-night {
  background: radial-gradient(80% 70% at 50% 40%, #2a1020 0%, #12060d 70%);
}

.sky { position: absolute; inset: 0; pointer-events: none; }
.cloud {
  position: absolute;
  background: #fff;
  border-radius: 999px;
  filter: blur(0.5px);
  opacity: 0.85;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 999px;
}
.cloud-a { width: 180px; height: 54px; top: 12%; left: 6%; animation: drift 14s ease-in-out infinite; }
.cloud-a::before { width: 70px; height: 70px; left: 28px; top: -36px; }
.cloud-a::after { width: 90px; height: 80px; left: 78px; top: -44px; }
.cloud-b { width: 140px; height: 42px; top: 22%; right: 4%; opacity: 0.7; animation: drift 18s ease-in-out infinite reverse; }
.cloud-b::before { width: 60px; height: 56px; left: 24px; top: -28px; }
.cloud-b::after { width: 72px; height: 64px; left: 64px; top: -34px; }
.cloud-c { width: 90px; height: 28px; top: 8%; left: 46%; opacity: 0.65; }
.cloud-c::before { width: 36px; height: 36px; left: 16px; top: -18px; }
.cloud-c::after { width: 44px; height: 40px; left: 40px; top: -22px; }
.is-night .cloud { opacity: 0.08; }

.bokeh {
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle, #fff 0%, #ffd0e2 70%, transparent 72%);
  opacity: 0.55;
  animation: floaty 7s ease-in-out infinite;
}
.b1 { width: 18px; height: 18px; left: 18%; top: 38%; }
.b2 { width: 10px; height: 10px; left: 72%; top: 30%; animation-delay: -2s; }
.b3 { width: 14px; height: 14px; left: 80%; top: 62%; animation-delay: -4s; }
.b4 { width: 8px; height: 8px; left: 22%; top: 68%; animation-delay: -1s; }
.is-night .bokeh { opacity: 0; }

.bunting {
  position: absolute;
  top: 0;
  display: flex;
  gap: 4px;
  z-index: 3;
  pointer-events: none;
}
.bunting i {
  width: 18px;
  height: 26px;
  background: linear-gradient(#fff, #ffb3cc);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  animation: flag 2.8s ease-in-out infinite;
}
.bunting i:nth-child(odd) { background: linear-gradient(#ff8fb3, #ff5c8d); }
.bunting-left { left: 0; transform: rotate(8deg); transform-origin: left top; }
.bunting-right { right: 0; transform: rotate(-8deg); transform-origin: right top; flex-direction: row-reverse; }
.is-night .bunting { opacity: 0; }

.orb {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(78vw, 520px);
  height: min(78vw, 520px);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #ffd0e280 0%, transparent 68%);
  pointer-events: none;
}
.is-night .orb { opacity: 0.15; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(120% 90% at 50% 40%, #fff6f9 0%, #ffe4ee 55%, #fbd3e2 100%);
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader p {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.loader-heart {
  position: relative;
  width: 46px;
  height: 42px;
  animation: beat 1.25s ease-in-out infinite;
}
.loader-heart::before,
.loader-heart::after {
  content: "";
  position: absolute;
  top: 0;
  width: 24px;
  height: 38px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #ff8db4, #ff5c8d);
}
.loader-heart::before { left: 23px; transform: rotate(-45deg); transform-origin: 0 100%; }
.loader-heart::after { left: -1px; transform: rotate(45deg); transform-origin: 100% 100%; }

.intro {
  position: absolute;
  left: 0;
  right: 0;
  top: 11%;
  z-index: 6;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.intro.is-on { opacity: 1; transform: none; transition: opacity 0.6s ease; }
.intro.is-bye { opacity: 0; transform: translateY(-12px); transition: 0.6s ease; }
.intro-eye { margin: 0; font-weight: 600; letter-spacing: 0.04em; }
.intro-title {
  margin: 4px 0 0;
  font-family: var(--font-script);
  font-size: clamp(40px, 9vw, 68px);
  line-height: 1.05;
  color: var(--color-rose);
}

.gift-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}
.gift-stage.is-on { opacity: 1; pointer-events: auto; transition: opacity 0.5s ease; }
.gift-stage.is-open { opacity: 0; transition: opacity 0.8s ease 0.45s; }
.gift-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff9dbd88, transparent 70%);
  filter: blur(6px);
}
.gift-hit {
  border: 0;
  background: none;
  padding: 24px;
  transform: translateY(6%);
}
.gift {
  width: 196px;
  height: 176px;
  position: relative;
  perspective: 700px;
  animation: gift-bob 3.2s ease-in-out infinite;
}
.gift-shadow {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 6px;
  height: 18px;
  border-radius: 50%;
  background: #e0709a55;
  filter: blur(2px);
}
.gift-box {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  height: 108px;
  border-radius: 8px;
  background:
    linear-gradient(#ff9dbe, #ff5c8d 58%, #ee4b82);
  box-shadow:
    inset 16px 0 0 #ffffff2e,
    inset -14px 0 0 #c43268aa,
    0 16px 0 #e23d78;
}
.ribbon-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  background: linear-gradient(#fff, #ffe4ee);
  box-shadow: inset 0 0 0 1px #ffd0e0;
}
.ribbon-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 38px;
  height: 22px;
  background: linear-gradient(#fff, #ffe8f0);
}
.gift-lid {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 28px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(#ffe3ef, #ff8eb6);
  box-shadow:
    inset 0 -8px 0 #ff6f9d,
    0 8px 16px #ff5c8d33;
  transform-origin: center top;
  transition: transform 0.85s cubic-bezier(0.2, 0.85, 0.2, 1);
  z-index: 2;
}
.gift-lid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  background: #fff;
}
.is-open .gift-lid {
  transform: translateY(-86px) rotateX(-78deg);
}
.bow {
  position: absolute;
  left: 50%;
  top: -30px;
  width: 92px;
  height: 46px;
  transform: translateX(-50%);
}
.bow i {
  position: absolute;
  top: 8px;
  width: 42px;
  height: 28px;
  border: 7px solid #fff;
  border-bottom-color: #ffe4ee;
  border-radius: 40px 40px 12px 40px;
  background: linear-gradient(#fff, #ffe9f2);
}
.bow i:first-child { left: 0; transform: rotate(-18deg); }
.bow i:last-of-type { right: 0; transform: scaleX(-1) rotate(-18deg); }
.bow b {
  position: absolute;
  left: 35px;
  top: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ffd5e4);
  box-shadow: 0 2px 0 #ffb3cc;
}

.bday {
  position: absolute;
  left: 0;
  right: 0;
  top: max(18px, env(safe-area-inset-top));
  margin: 0;
  text-align: center;
  font-family: var(--font-script);
  font-size: clamp(46px, 11vw, 84px);
  line-height: 1;
  color: var(--color-rose);
  text-shadow: 0 8px 24px #ff8cb466;
  z-index: 14;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
}
.is-night .bday { color: #ffe4ee; text-shadow: 0 0 18px #ff5c8d88; }
.who {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(max(18px, env(safe-area-inset-top)) + clamp(54px, 12vw, 92px));
  margin: 0;
  text-align: center;
  font-family: var(--font-script);
  font-size: clamp(28px, 6.4vw, 46px);
  color: #ff4d86;
  z-index: 14;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.who.is-on { opacity: 1; transform: none; transition: 0.8s ease 0.15s; }
.is-night .who { color: #ffe4ee; }

.memory {
  position: absolute;
  inset: 0;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
}
.memory.is-on { opacity: 1; pointer-events: auto; transition: opacity 0.9s ease; }
.cake-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.slash {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 48%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  transform: rotate(-8deg);
  animation: slash 0.45s ease;
  pointer-events: none;
}
.slash-off { display: none; }

.story {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 132px);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 10px #00000055;
}
.is-night .story { color: #fff6fa; }
.story-title {
  margin: 0;
  font-family: var(--font-script);
  font-size: clamp(28px, 7vw, 44px);
  line-height: 1.15;
}
.story-sub { margin: 6px 0 0; font-weight: 600; font-size: 15px; }

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 18px);
  display: flex;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.stack { flex-direction: column; align-items: center; gap: 10px; }

.hint, .pill, .mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 999px;
  padding: 10px 18px;
  font: 700 15px/1.2 var(--font-ui);
  border: 0;
}
.hint {
  color: var(--color-ink);
  background: #ffffffd4;
  box-shadow: 0 10px 28px #d63a7330;
  backdrop-filter: blur(8px);
  margin: 0;
}
.hint svg, .pill svg, .mic svg { width: 22px; height: 22px; flex: none; }
.pill {
  color: white;
  background: linear-gradient(135deg, var(--color-blush-2) -20%, var(--color-blush) 45%, var(--color-rose) 120%);
  box-shadow: 0 10px 26px #d63a7347, inset 0 2px 0 #ffffff59;
}
.pill.soft {
  color: var(--color-ink);
  background: #fff8fb;
  box-shadow: 0 10px 26px #d63a7333;
}
.pill:disabled { opacity: 0.45; }
.mic {
  color: white;
  background: linear-gradient(135deg, var(--color-blush-2), var(--color-rose));
  box-shadow: 0 10px 26px #d63a7347;
  max-width: min(92vw, 420px);
  text-align: left;
}
.mic.is-on { animation: pulse 1.1s ease-in-out infinite; }
.dots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 0; }
.dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd0e0;
}
.dots i.on { background: var(--color-blush); }

.torch {
  position: fixed;
  z-index: 46;
  width: 56px;
  height: 120px;
  border: 0;
  background: none;
  padding: 0;
  touch-action: none;
}
.torch-stick {
  position: absolute;
  left: 24px;
  top: 48px;
  width: 8px;
  height: 70px;
  border-radius: 8px;
  background: linear-gradient(#c9844a, #6b3a1e);
}
.torch-head {
  position: absolute;
  left: 16px;
  top: 34px;
  width: 24px;
  height: 22px;
  border-radius: 8px 8px 4px 4px;
  background: #3a2418;
}
.torch-flame {
  position: absolute;
  left: 18px;
  top: 6px;
  width: 20px;
  height: 32px;
  border-radius: 50% 50% 50% 50%;
  background: radial-gradient(circle at 50% 70%, #fff6c8, #ffb03a 40%, #ff5a1f 70%, transparent 72%);
  animation: flicker 0.35s ease-in-out infinite alternate;
}
.torch-glow {
  position: absolute;
  left: -10px;
  top: -8px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffb15a88, transparent 70%);
}

.wall {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: radial-gradient(90% 70% at 50% 42%, #fff6f9ee, #ffe4eef2);
  opacity: 0;
  pointer-events: none;
}
.wall.is-on { opacity: 1; pointer-events: auto; transition: opacity 0.7s ease; }
.wall-hit {
  border: 0;
  background: none;
  width: min(100%, 560px);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: inherit;
}
.heart-collage {
  position: relative;
  width: 460px;
  height: 400px;
  margin-top: 4px;
}
@media (max-width: 480px) {
  .heart-collage { transform: scale(0.72); margin-top: 0; }
}
.heart-collage img {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 72px;
  height: 72px;
  margin-left: -36px;
  margin-top: -36px;
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid white;
  box-shadow: 0 8px 18px #d63a7340;
  animation: pop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.wall-copy { text-align: center; padding: 0 18px 8px; }
.wall-title {
  margin: 8px 0;
  font-family: var(--font-script);
  font-size: clamp(32px, 8vw, 48px);
  color: var(--color-rose);
  line-height: 1.1;
}
.wall-sub { margin: 10px auto 0; max-width: 360px; font-weight: 600; font-size: 14px; line-height: 1.45; }
.wall-hint { margin: 0 auto; }

.letter {
  position: absolute;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
}
.letter.is-on { opacity: 1; pointer-events: auto; transition: opacity 0.6s ease; }
.letter-back {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 70% at 50% 45%, #fffafcb8, #ffe2eedb);
  opacity: 0;
}
.letter.is-reading .letter-back { opacity: 1; transition: opacity 0.6s; }
.envelope {
  width: min(84vw, 380px);
  height: calc(min(84vw, 380px) / 1.55);
  border: 0;
  padding: 0;
  position: relative;
  background: none;
  filter: drop-shadow(0 18px 30px #d63a7340);
  animation: bob 3.4s ease-in-out infinite;
}
.env-body {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background:
    linear-gradient(#fff8fb, #ffe1ec);
  box-shadow: inset 0 0 0 2px #ffd6e5;
}
.env-body::before {
  content: "";
  position: absolute;
  inset: 10px;
  background:
    linear-gradient(160deg, transparent 46%, #ffb4cc 47% 53%, transparent 54%),
    repeating-linear-gradient(-18deg, transparent 0 18px, #ffffff88 18px 19px);
  border-radius: 8px;
  opacity: 0.8;
}
.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 58%;
  background: linear-gradient(#fff4f8, #ffd9e6);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 12px 12px 0 0;
  transform-origin: top center;
}
.env-seal {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffb3cb, #ff7aa4 40%, #d43a72 78%);
  box-shadow: 0 6px 10px #9c1d4f44;
}
.env-seal::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 22px;
  height: 20px;
  background: #fff;
  clip-path: path("M11 18 C4 12 2 8 6 5 C8 3 11 5 11 7 C11 5 14 3 16 5 C20 8 18 12 11 18Z");
}
.paper {
  position: relative;
  width: min(92vw, 460px);
  max-height: min(68vh, 560px);
  overflow: auto;
  background:
    linear-gradient(#fffdfb, #fffdfb) padding-box;
  border-radius: 18px;
  padding: 28px 22px 22px;
  box-shadow: 0 24px 50px #d63a7330;
  color: #5e3044;
  animation: rise 0.7s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.paper h2 {
  margin: 0 0 12px;
  text-align: center;
  font-family: var(--font-script);
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.15;
  color: var(--color-rose);
}
.paper p {
  margin: 0;
  white-space: pre-wrap;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.55;
  min-height: 8em;
}
.close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #ffe4ee;
  color: var(--color-rose);
  font-size: 22px;
  line-height: 1;
}

.finale {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 44;
  opacity: 0;
  pointer-events: none;
  padding-bottom: 70px;
}
.finale.is-on { opacity: 1; transition: opacity 0.8s ease; }
.polaroid {
  width: min(78vw, 320px);
  background: #fffdfb;
  border-radius: 8px 8px 16px 16px;
  padding: 12px 12px 16px;
  box-shadow: 0 24px 50px #5a173644;
  transform: rotate(-3deg);
  animation: bob 4s ease-in-out infinite;
}
.polaroid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.polaroid figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  color: var(--color-rose);
}
.polaroid b {
  font-family: var(--font-script);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.polaroid span { font-weight: 700; letter-spacing: 0.08em; }

.music {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  color: var(--color-ink);
  background: #ffffffd0;
  box-shadow: 0 8px 18px #d63a7330;
  display: grid;
  place-items: center;
}
.music svg { width: 22px; height: 22px; }
.music.is-off { opacity: 0.55; }
.music.is-off svg { position: relative; }
.music.is-off::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: var(--color-rose);
  transform: rotate(-35deg);
}
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@keyframes beat {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.12); }
}
@keyframes gift-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes drift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(16px); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes flag {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(4deg); }
}
@keyframes flicker {
  from { transform: scale(1) rotate(-4deg); }
  to { transform: scale(1.08, 1.16) rotate(4deg); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes slash {
  from { opacity: 0; transform: translateX(-12%) rotate(-12deg); }
  to { opacity: 1; transform: translateX(8%) rotate(-6deg); }
}
@keyframes pop {
  from { opacity: 0; scale: 0.4; }
  to { opacity: 1; scale: 1; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

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