.birthday-scene {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 48px);
  color: #7a3048;
  background:
    radial-gradient(circle at 50% 16%, #fffdf4 0 9%, transparent 42%),
    linear-gradient(145deg, #ffd9c7, #fff0c6 44%, #fbc8d8);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.birthday-scene[hidden] {
  display: none;
}

.birthday-scene.is-visible {
  opacity: 1;
}

#birthday-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.birthday-content {
  position: relative;
  z-index: 2;
  width: min(760px, 94vw);
  text-align: center;
  animation: birthday-arrive 1.1s cubic-bezier(.2,.8,.2,1) both;
}

.birthday-banner {
  width: fit-content;
  margin: 0 auto clamp(10px, 2vh, 20px);
  padding: .25em .8em .35em;
  color: #fff9e8;
  font: 800 clamp(31px, 7vw, 72px)/1.05 Georgia, 'Times New Roman', serif;
  letter-spacing: .025em;
  text-shadow: 0 3px 0 #c55570, 0 8px 22px #9b3c6659;
  transform: rotate(-2deg);
}

.birthday-name {
  min-height: 1.15em;
  margin: 0;
  color: #c44868;
  font: 800 clamp(40px, 9vw, 96px)/1.05 ui-rounded, 'Microsoft YaHei', sans-serif;
  letter-spacing: .04em;
  text-shadow: 0 2px 0 #fff, 0 7px 20px #ad42673d;
  animation: birthday-sway 2.6s ease-in-out infinite;
}

.birthday-message {
  min-height: 2.6em;
  margin: clamp(8px, 1.5vh, 18px) auto 0;
  color: #7e5260;
  font: 500 clamp(18px, 3vw, 28px)/1.45 ui-rounded, 'Microsoft YaHei', sans-serif;
}

.birthday-message::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 5px;
  vertical-align: -.1em;
  background: currentColor;
  animation: birthday-caret .75s steps(1) infinite;
}

.birthday-cake {
  position: relative;
  width: clamp(180px, 28vw, 270px);
  height: clamp(160px, 25vw, 230px);
  margin: clamp(10px, 2vh, 24px) auto 0;
  filter: drop-shadow(0 18px 18px #a65b6b35);
}

.cake-base,
.cake-top,
.cake-plate,
.candles {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.cake-base {
  bottom: 14%;
  width: 82%;
  height: 48%;
  overflow: hidden;
  border-radius: 12% 12% 18% 18% / 14% 14% 12% 12%;
  background: linear-gradient(90deg, #e7897c, #ffb19b 46%, #e78379);
  box-shadow: inset 0 -14px 0 #d96e6d42;
}

.cake-base span {
  position: absolute;
  top: 30%;
  width: 17%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff1cf;
  box-shadow: inset 0 -3px 0 #e8bd9c;
}

.cake-base span:nth-child(1) { left: 14%; }
.cake-base span:nth-child(2) { left: 42%; }
.cake-base span:nth-child(3) { right: 14%; }

.cake-top {
  bottom: 54%;
  width: 86%;
  height: 20%;
  border-radius: 50%;
  background: #fff4d8;
  box-shadow: inset 0 -10px 0 #f7cbb5;
}

.cake-plate {
  bottom: 8%;
  width: 100%;
  height: 12%;
  border-radius: 50%;
  background: #fbfcff;
  box-shadow: inset 0 -5px 0 #d8e0eb;
}

.candles {
  bottom: 68%;
  z-index: 2;
  display: flex;
  gap: clamp(22px, 4vw, 42px);
}

.candles i {
  position: relative;
  display: block;
  width: 11px;
  height: clamp(38px, 6vw, 58px);
  border-radius: 4px 4px 2px 2px;
  background: repeating-linear-gradient(135deg, #5abdd1 0 7px, #fff 7px 13px);
}

.candles i::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  width: 15px;
  height: 23px;
  border-radius: 55% 55% 55% 55% / 68% 68% 35% 35%;
  background: radial-gradient(circle at 50% 68%, #fff8b3 0 14%, #ffc941 30%, #ff7b32 72%);
  box-shadow: 0 0 18px 6px #ffc84b8c;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: birthday-flame .55s ease-in-out infinite alternate;
}

.birthday-wish {
  margin: 0;
  color: #8b5665;
  font: 500 clamp(15px, 2.3vw, 20px)/1.5 ui-rounded, 'Microsoft YaHei', sans-serif;
  letter-spacing: .04em;
}

.balloon-curtain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balloon-curtain i {
  position: absolute;
  top: -18vh;
  width: clamp(44px, 7vw, 78px);
  aspect-ratio: .82;
  border-radius: 50% 50% 46% 46%;
  background: #e85d75;
  box-shadow: inset -9px -10px 15px #84283f2e, inset 7px 5px 12px #fff7;
  animation: balloon-drop 8s cubic-bezier(.15,.65,.2,1) both;
}

.balloon-curtain i::after {
  content: '';
  position: absolute;
  top: 96%;
  left: 50%;
  width: 1px;
  height: 38vh;
  background: #986e7773;
}

.balloon-curtain i:nth-child(1) { left: 2%; --y: 25vh; animation-delay: .1s; }
.balloon-curtain i:nth-child(2) { left: 14%; --y: 12vh; background: #f1b74a; animation-delay: .5s; }
.balloon-curtain i:nth-child(3) { left: 29%; --y: 19vh; background: #5eb7bb; animation-delay: .25s; }
.balloon-curtain i:nth-child(4) { left: 43%; --y: 9vh; background: #d873a5; animation-delay: .7s; }
.balloon-curtain i:nth-child(5) { right: 40%; --y: 22vh; background: #77b36c; animation-delay: .35s; }
.balloon-curtain i:nth-child(6) { right: 25%; --y: 13vh; background: #ef8a56; animation-delay: .85s; }
.balloon-curtain i:nth-child(7) { right: 11%; --y: 24vh; background: #6f91d2; animation-delay: .18s; }
.balloon-curtain i:nth-child(8) { right: 1%; --y: 10vh; background: #ee7091; animation-delay: .62s; }

@keyframes birthday-arrive {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
}

@keyframes birthday-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

@keyframes birthday-caret {
  50% { opacity: 0; }
}

@keyframes birthday-flame {
  to { transform: translateX(-50%) rotate(4deg) scale(.92, 1.06); }
}

@keyframes balloon-drop {
  to { transform: translateY(var(--y)) rotate(5deg); }
}

@media (max-height: 650px) {
  .birthday-scene { padding-block: 10px; }
  .birthday-banner { font-size: clamp(27px, 6vw, 48px); }
  .birthday-name { font-size: clamp(34px, 8vw, 62px); }
  .birthday-cake { width: 170px; height: 145px; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .birthday-scene,
  .birthday-content,
  .birthday-name,
  .birthday-message::after,
  .candles i::before,
  .balloon-curtain i {
    animation: none;
    transition: none;
  }

  .birthday-scene { opacity: 1; }
  .balloon-curtain i { transform: translateY(var(--y)); }
}
