:root {
  --dark: #292e1e;
  --purple: #7f0799;
  --violet: #9649cb;
  --lavender: #afbbf2;
  --mint: #d3fff3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--mint);
  background: radial-gradient(circle at 30% 20%, #3f174f 0%, var(--dark) 45%, #1a1d14 100%);
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.ambient-hearts {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.butterfly-layer {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.butterfly-sparkles,
.butterfly-petals {
  position: absolute;
  inset: 0;
}

.sparkle,
.petal-heart {
  position: absolute;
  user-select: none;
}

.sparkle {
  color: #c998ff;
  opacity: 0.3;
  animation: sparkle-pulse 1400ms ease-in-out infinite;
}

.s1 { left: 12%; top: 18%; font-size: 1rem; animation-delay: 0ms; }
.s2 { left: 24%; top: 66%; font-size: 0.78rem; animation-delay: 220ms; }
.s3 { right: 18%; top: 24%; font-size: 1.1rem; animation-delay: 460ms; }
.s4 { right: 28%; bottom: 20%; font-size: 0.76rem; animation-delay: 680ms; }
.s5 { left: 56%; top: 12%; font-size: 0.8rem; animation-delay: 910ms; }

.petal-heart {
  color: #d17dff;
  opacity: 0.2;
  animation: petal-drift 3800ms ease-in-out infinite alternate;
}

.p1 { left: 14%; top: 52%; }
.p2 { left: 36%; top: 76%; }
.p3 { right: 20%; top: 62%; }
.p4 { right: 34%; top: 36%; }

.cursor-butterfly {
  position: absolute;
  left: 0;
  top: 0;
  width: 118px;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  opacity: 0.9;
  filter: drop-shadow(0 0 14px rgba(255, 217, 93, 0.28));
  pointer-events: auto;
  cursor: pointer;
}

.cursor-butterfly svg {
  width: 100%;
  height: auto;
}

.cursor-butterfly .wing-left {
  transform-origin: 100% 50%;
  animation: wing-left-flap 150ms ease-in-out infinite alternate;
}

.cursor-butterfly .wing-right {
  transform-origin: 0% 50%;
  animation: wing-right-flap 150ms ease-in-out infinite alternate;
}

.cursor-butterfly.gone {
  pointer-events: none;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: linear-gradient(170deg, #21162f 0%, #130f19 70%, #0d0f0b 100%);
  transition: opacity 850ms ease, visibility 850ms ease;
}

.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-inner {
  position: relative;
  z-index: 2;
  text-align: center;
}

.splash-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lily {
  width: min(62vw, 340px);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.34)) drop-shadow(0 0 18px rgba(211, 255, 243, 0.22));
  opacity: 0;
  transform-origin: 50% 72%;
  animation:
    lily-appear 3400ms ease forwards,
    lily-sway 3200ms ease-in-out 3400ms infinite;
}

.draw {
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw 1550ms ease forwards;
}

.petal {
  fill: url(#petalShade);
  stroke: #e9ecfb;
  stroke-width: 2.2;
  opacity: 0;
  transform-origin: 50% 56%;
  animation:
    draw 1550ms ease forwards,
    petal-reveal 1300ms ease forwards;
  animation-delay: 220ms, 700ms;
}

.petal-back {
  fill-opacity: 0.78;
}

.petal-side {
  fill-opacity: 0.9;
  animation-delay: 400ms, 980ms;
}

.petal-front {
  fill-opacity: 0.98;
  animation-delay: 580ms, 1180ms;
}

.stem {
  fill: none;
  stroke: url(#stemShade);
  stroke-width: 4.4;
  animation-delay: 760ms;
}

.leaf {
  fill: url(#leafShade);
  stroke: #5ba17d;
  stroke-width: 2;
  opacity: 0;
  transform-origin: 50% 78%;
  animation:
    draw 1500ms ease forwards,
    leaf-reveal 1100ms ease forwards;
  animation-delay: 860ms, 1180ms;
}

.stamen {
  fill: none;
  stroke: #d8c28a;
  stroke-width: 1.8;
  animation-delay: 1260ms;
}

.pollen {
  fill: #f5d86f;
  stroke: #fff0be;
  stroke-width: 1.2;
  opacity: 0;
  animation:
    draw 900ms ease forwards,
    pollen-pop 520ms ease forwards;
  animation-delay: 1480ms, 1680ms;
}

.splash-text {
  margin-top: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: #bce8dd;
}

.birthday {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: clamp(28px, 6vh, 56px) 18px 44px;
  position: relative;
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--mint);
  text-shadow: 0 2px 14px rgba(127, 7, 153, 0.7);
  position: relative;
  z-index: 3;
}

.subtitle {
  margin: 0 0 10px;
  color: #d9d8ff;
  max-width: 36ch;
  position: relative;
  z-index: 3;
}

.cake-wrap {
  position: relative;
  margin-top: 6px;
  padding-top: 54px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 1;
  opacity: 0;
  transform: translateY(18px) scale(0.9);
  animation: cake-appear 1800ms ease 240ms forwards;
}

.plate {
  position: absolute;
  width: min(90vw, 420px);
  height: 38px;
  bottom: -12px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 36%, rgba(255, 255, 255, 0.82) 0%, rgba(214, 229, 255, 0.6) 44%, rgba(129, 142, 180, 0.4) 100%);
  box-shadow:
    0 14px 22px rgba(0, 0, 0, 0.32),
    inset 0 -6px 8px rgba(67, 76, 106, 0.34),
    inset 0 5px 8px rgba(255, 255, 255, 0.62);
}

.cake {
  width: min(82vw, 380px);
  height: 192px;
  border-radius: 22px 22px 26px 26px;
  background:
    radial-gradient(ellipse at 20% 26%, rgba(255, 210, 166, 0.2) 0 26%, transparent 45%),
    radial-gradient(ellipse at 78% 30%, rgba(255, 255, 255, 0.12) 0 18%, transparent 40%),
    repeating-linear-gradient(
      0deg,
      #70411f 0 14px,
      #7a4924 14px 30px,
      #5f3419 30px 42px
    );
  border: 2px solid #4c2812;
  box-shadow:
    0 26px 42px rgba(0, 0, 0, 0.46),
    inset 0 18px 18px rgba(255, 194, 137, 0.2),
    inset 0 -16px 18px rgba(51, 24, 12, 0.4);
  position: relative;
  overflow: visible;
  transform-origin: 50% 84%;
  animation: cake-sway 3200ms ease-in-out 2100ms infinite;
}

.cake-top {
  position: absolute;
  left: 14px;
  right: 14px;
  top: -16px;
  height: 30px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 34%, rgba(255, 255, 255, 0.85) 0 8%, transparent 30%),
    radial-gradient(circle at 68% 28%, rgba(255, 255, 255, 0.72) 0 7%, transparent 26%),
    linear-gradient(180deg, #b978ff 0%, #8e4cd8 55%, #7438c2 100%);
  box-shadow:
    0 8px 10px rgba(57, 20, 78, 0.44),
    inset 0 -6px 8px rgba(98, 30, 151, 0.6);
}

.icing-drips {
  position: absolute;
  inset: 6px 0 auto;
  display: flex;
  justify-content: space-evenly;
  align-items: flex-start;
  pointer-events: none;
}

.icing-drips span {
  width: clamp(26px, 7vw, 42px);
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, #aa68f0 0%, #8046cd 100%);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.2);
}

.icing-drips span:nth-child(1) { height: 26px; }
.icing-drips span:nth-child(2) { height: 34px; }
.icing-drips span:nth-child(3) { height: 24px; }
.icing-drips span:nth-child(4) { height: 39px; }
.icing-drips span:nth-child(5) { height: 28px; }

.cake-gloss {
  content: "";
  position: absolute;
  inset: 34px 20px auto;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 232, 204, 0.38) 0%, rgba(255, 232, 204, 0.04) 70%, transparent 100%);
  filter: blur(1px);
}

.candles {
  position: absolute;
  top: -50px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2.8vw, 24px);
}

.candle {
  width: 13px;
  height: 48px;
  border: 1px solid rgba(116, 84, 160, 0.7);
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 0 16%, transparent 34% 66%, rgba(255, 255, 255, 0.32) 86% 100%),
    repeating-linear-gradient(45deg, #fff6d8 0 4px, #f7deff 4px 8px, #ffe8f0 8px 12px);
  position: relative;
  cursor: pointer;
  box-shadow:
    0 3px 0 #9a84bb inset,
    0 2px 4px rgba(0, 0, 0, 0.28);
}

.candle::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #2f2a2a;
  border-radius: 999px;
}

.candle::before {
  content: "";
  position: absolute;
  top: -27px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 23px;
  border-radius: 55% 55% 62% 62%;
  background:
    radial-gradient(circle at 50% 24%, #fffde8 0 20%, #ffe797 35%, #ffb34d 64%, #ff7f1f 100%);
  filter:
    drop-shadow(0 0 11px rgba(255, 176, 72, 0.95))
    drop-shadow(0 0 18px rgba(255, 123, 32, 0.5));
  animation: flame-flicker 220ms infinite alternate;
}

.candle.snuffed::before {
  opacity: 0;
  animation: none;
}

.cat {
  margin-top: 14px;
  border: 2px solid #b7b2ff;
  border-radius: 999px;
  color: #f4efff;
  background: linear-gradient(180deg, rgba(150, 73, 203, 0.45), rgba(127, 7, 153, 0.35));
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
}

.cat.purr {
  animation: purr 280ms ease-in-out 3;
}

.cat-pop {
  position: fixed;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(20px, 4.5vh, 40px);
  width: clamp(130px, 24vw, 230px);
  aspect-ratio: 1 / 1;
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px) scale(0.72) rotate(-8deg);
}

.cat-pop.show {
  animation: cat-pop-in 580ms cubic-bezier(0.2, 0.75, 0.2, 1.2) forwards;
}

.cat-pop.hide {
  animation: cat-pop-out 560ms ease forwards;
}

.cat-pop-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 20px;
  filter:
    drop-shadow(0 16px 24px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 12px rgba(175, 187, 242, 0.58));
  animation: cat-float 2200ms ease-in-out infinite;
}

.cat-pop-glow {
  position: absolute;
  inset: -16px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(211, 255, 243, 0.28) 0%, rgba(175, 187, 242, 0.16) 38%, transparent 70%);
  z-index: -1;
  animation: cat-glow-pulse 1200ms ease-in-out infinite;
}

.memory-pop {
  position: fixed;
  left: 50%;
  top: 50%;
  width: clamp(150px, 30vw, 280px);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65) rotate(-6deg);
}

.memory-pop.show {
  animation: memory-pop-in 520ms cubic-bezier(0.24, 0.78, 0.22, 1.18) forwards;
}

.memory-pop.hide {
  animation: memory-pop-out 500ms ease forwards;
}

.memory-pop-image {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(175, 187, 242, 0.44);
}

.cat-note {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message {
  margin-top: 18px;
  font-size: clamp(1.4rem, 6vw, 2.75rem);
  color: #fff;
  text-align: center;
  text-shadow: 0 0 16px rgba(175, 187, 242, 0.9), 0 0 30px rgba(211, 255, 243, 0.65);
  max-width: 90vw;
  line-height: 1.2;
  animation: message-glow 2200ms ease-in-out infinite;
}

.hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.heart {
  position: absolute;
  bottom: -24px;
  font-size: clamp(14px, 2.5vw, 28px);
  animation: float-up linear forwards;
}

.heart.red-heart {
  color: #ff2f58;
  text-shadow: 0 0 10px rgba(255, 47, 88, 0.52), 0 0 18px rgba(255, 0, 63, 0.36);
}

.heart.red-heart.soft {
  color: rgba(255, 78, 119, 0.78);
  text-shadow: 0 0 8px rgba(255, 78, 119, 0.35);
}

.splash-heart {
  color: rgba(211, 255, 243, 0.78);
  text-shadow: 0 0 10px rgba(175, 187, 242, 0.55);
  font-size: clamp(12px, 2.2vw, 22px);
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes wing-left-flap {
  from { transform: rotate(0deg); }
  to { transform: rotate(-12deg); }
}

@keyframes wing-right-flap {
  from { transform: rotate(0deg); }
  to { transform: rotate(12deg); }
}

@keyframes sparkle-pulse {
  0%, 100% { opacity: 0.24; transform: scale(0.84); }
  50% { opacity: 0.74; transform: scale(1.12); }
}

@keyframes petal-drift {
  0% {
    opacity: 0.2;
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  100% {
    opacity: 0.46;
    transform: translateY(-12px) translateX(8px) rotate(20deg);
  }
}

@keyframes lily-appear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  65% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes lily-sway {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-1.8deg) scale(1.004); }
  75% { transform: rotate(1.8deg) scale(1.004); }
}

@keyframes petal-reveal {
  0% {
    opacity: 0;
    transform: scale(0.86) rotate(-3deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.04) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes leaf-reveal {
  0% {
    opacity: 0;
    transform: scale(0.84);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pollen-pop {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  70% {
    opacity: 1;
    transform: scale(1.18);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes flame-flicker {
  from { transform: translateX(-50%) scale(1) rotate(-1.5deg); }
  to { transform: translateX(-50%) scale(0.88, 1.06) translateY(1px) rotate(1.5deg); }
}

@keyframes purr {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes cat-pop-in {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.58) rotate(-12deg);
  }
  65% {
    opacity: 1;
    transform: translateY(-4px) scale(1.04) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes cat-pop-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(18px) scale(0.74) rotate(8deg);
  }
}

@keyframes cat-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes cat-glow-pulse {
  0%, 100% { opacity: 0.48; transform: scale(0.96); }
  50% { opacity: 0.9; transform: scale(1.06); }
}

@keyframes memory-pop-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6) rotate(-9deg);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes memory-pop-out {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72) rotate(8deg);
  }
}

@keyframes float-up {
  0% {
    transform: translateY(0) scale(0.8) rotate(0deg);
    opacity: 0.95;
  }
  100% {
    transform: translateY(-110vh) scale(1.2) rotate(18deg);
    opacity: 0;
  }
}

@keyframes float-swirl {
  0% {
    transform: translateY(0) scale(0.78) rotate(-8deg);
    opacity: 0.8;
  }
  40% {
    transform: translateY(-36vh) translateX(12px) scale(1.02) rotate(6deg);
    opacity: 0.95;
  }
  100% {
    transform: translateY(-108vh) translateX(-12px) scale(1.16) rotate(18deg);
    opacity: 0;
  }
}

@keyframes message-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 0, 63, 0)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 0, 63, 0.45)); }
}

@keyframes cake-appear {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.85);
  }
  68% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cake-sway {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(-1px) rotate(-1.1deg) scale(1.002); }
  75% { transform: translateY(-1px) rotate(1.1deg) scale(1.002); }
}

@media (min-width: 768px) {
  .birthday {
    gap: 16px;
  }

  .cake-wrap {
    margin-top: 16px;
  }

  .cat {
    margin-top: 16px;
  }

  .message {
    margin-top: 22px;
  }
}
