:root {
  --doug-cake-chocolate: #6b351b;
  --doug-cake-icing: #fff3bb;
  --doug-cake-pink: #ff6fb1;
  --doug-cake-blue: #4cc9f0;
  --doug-cake-green: #78e08f;
  --doug-cake-gold: #ffd166;
}

.doug-birthday-stage {
  position: fixed;
  inset: 0;
  z-index: 3100;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 240ms ease, transform 800ms cubic-bezier(.17, .84, .44, 1);
}

.doug-birthday-stage.is-active {
  opacity: 1;
  transform: scale(1);
}

.doug-birthday-stage::before,
.doug-birthday-stage::after {
  content: "";
  position: absolute;
  inset: -20vmax;
  background:
    conic-gradient(from 0deg, transparent 0 8deg, rgba(255, 209, 102, .28) 8deg 12deg, transparent 12deg 18deg),
    repeating-conic-gradient(from 12deg, rgba(76, 201, 240, .18) 0 6deg, rgba(255, 111, 177, .16) 6deg 12deg, rgba(120, 224, 143, .14) 12deg 18deg, transparent 18deg 28deg);
  mix-blend-mode: screen;
  animation: dougSpinSky 7s linear infinite;
}

.doug-birthday-stage::after {
  inset: -12vmax;
  filter: blur(6px);
  opacity: .7;
  animation-direction: reverse;
  animation-duration: 11s;
}

.doug-birthday-banner {
  position: absolute;
  left: 50%;
  top: clamp(18px, 6vh, 52px);
  transform: translateX(-50%);
  min-width: min(92vw, 780px);
  padding: clamp(14px, 2.5vw, 24px) clamp(18px, 4vw, 36px);
  border: 3px solid rgba(255, 255, 255, .78);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(18, 18, 18, .92), rgba(59, 22, 74, .82)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 12px, transparent 12px 24px);
  box-shadow:
    0 0 0 8px rgba(255, 209, 102, .2),
    0 16px 55px rgba(0, 0, 0, .48),
    0 0 90px rgba(76, 201, 240, .5);
  color: white;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: clamp(2rem, 7vw, 5.6rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: .95;
  text-align: center;
  text-shadow:
    0 4px 0 #7b2cbf,
    0 8px 0 #0f766e,
    0 13px 24px rgba(0, 0, 0, .55);
  animation:
    dougBannerDrop 900ms cubic-bezier(.2, 1.5, .4, 1) both,
    dougBannerWobble 1.7s ease-in-out 900ms infinite;
}

.doug-birthday-banner span {
  display: inline-block;
  animation: dougLetterPulse 1.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 65ms);
}

.doug-birthday-cake {
  position: absolute;
  right: clamp(18px, 8vw, 120px);
  bottom: clamp(24px, 8vh, 90px);
  width: min(38vw, 260px);
  aspect-ratio: 1.15;
  animation:
    dougCakeEntrance 1.1s cubic-bezier(.17, 1.45, .34, 1) both,
    dougCakeDance 1.2s ease-in-out 1.2s infinite;
}

.doug-cake-plate {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 2%;
  height: 13%;
  border-radius: 999px;
  background: linear-gradient(180deg, #e7f9ff, #8bd3e6);
  box-shadow: 0 11px 22px rgba(0, 0, 0, .42);
}

.doug-cake-layer {
  position: absolute;
  left: 16%;
  right: 16%;
  height: 28%;
  border-radius: 14px 14px 22px 22px;
  background:
    radial-gradient(circle at 15% 30%, #fff6 0 4px, transparent 5px),
    radial-gradient(circle at 45% 70%, #fff4 0 5px, transparent 6px),
    linear-gradient(180deg, #9f5528, var(--doug-cake-chocolate));
  border: 3px solid #3f1f10;
}

.doug-cake-layer.layer-one {
  bottom: 12%;
}

.doug-cake-layer.layer-two {
  left: 22%;
  right: 22%;
  bottom: 38%;
  background:
    radial-gradient(circle at 25% 65%, #fff7 0 5px, transparent 6px),
    radial-gradient(circle at 70% 35%, #fff5 0 4px, transparent 5px),
    linear-gradient(180deg, #ff9fd0, var(--doug-cake-pink));
}

.doug-cake-icing {
  position: absolute;
  left: 21%;
  right: 21%;
  bottom: 61%;
  height: 14%;
  border-radius: 18px 18px 10px 10px;
  background: var(--doug-cake-icing);
  box-shadow:
    -20px 18px 0 -10px var(--doug-cake-icing),
    18px 19px 0 -9px var(--doug-cake-icing),
    54px 15px 0 -11px var(--doug-cake-icing),
    -55px 14px 0 -12px var(--doug-cake-icing);
}

.doug-candle {
  position: absolute;
  bottom: 73%;
  width: 8%;
  height: 22%;
  border-radius: 4px;
  background: repeating-linear-gradient(135deg, #fff 0 7px, var(--doug-cake-blue) 7px 14px);
  transform-origin: 50% 100%;
  animation: dougCandleSway 900ms ease-in-out infinite;
}

.doug-candle:nth-of-type(5) {
  left: 38%;
}

.doug-candle:nth-of-type(6) {
  left: 55%;
  animation-delay: 130ms;
  background: repeating-linear-gradient(135deg, #fff 0 7px, var(--doug-cake-green) 7px 14px);
}

.doug-candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -42%;
  width: 120%;
  aspect-ratio: .72;
  transform: translateX(-50%);
  border-radius: 60% 60% 52% 52%;
  background:
    radial-gradient(circle at 50% 70%, #fff 0 15%, transparent 16%),
    radial-gradient(circle at 50% 65%, #fffb99 0 38%, transparent 40%),
    linear-gradient(180deg, #ff6b35, #ffb703);
  box-shadow: 0 0 18px #ffb703, 0 0 38px rgba(255, 107, 53, .8);
  animation: dougFlame 260ms ease-in-out infinite alternate;
}

.doug-confetti,
.doug-streamer,
.doug-spark {
  position: absolute;
  top: -8vh;
  left: calc(var(--x) * 1%);
  width: var(--w);
  height: var(--h);
  background: var(--c);
  border-radius: var(--r);
  transform: rotate(var(--rot));
  animation: dougConfettiFall var(--d) linear var(--delay) infinite;
}

.doug-streamer {
  height: 70px;
  border-radius: 999px;
  background: repeating-linear-gradient(180deg, var(--c) 0 9px, transparent 9px 17px);
  animation-name: dougStreamerFall;
}

.doug-spark {
  top: calc(var(--y) * 1%);
  width: 12px;
  height: 12px;
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
  animation: dougSparkPop var(--d) ease-in-out var(--delay) infinite;
}

.doug-birthday-inline {
  display: block;
  margin: 18px auto 10px;
  padding: 14px 12px;
  border: 2px solid rgba(255, 209, 102, .82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(76, 201, 240, .18), rgba(255, 111, 177, .2)),
    #171717;
  color: #fff;
  text-align: center;
  box-shadow: 0 0 28px rgba(255, 209, 102, .25);
}

.doug-birthday-inline-title {
  display: block;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 #7b2cbf, 0 6px 18px rgba(0, 0, 0, .35);
}

.doug-mini-cake {
  position: relative;
  display: inline-block;
  width: 68px;
  height: 54px;
  margin-top: 10px;
}

.doug-mini-cake::before,
.doug-mini-cake::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 22px;
  border-radius: 8px 8px 12px 12px;
  background: linear-gradient(180deg, #ff9fd0, #7a3b1e);
  border: 2px solid #3f1f10;
}

.doug-mini-cake::after {
  left: 18px;
  right: 18px;
  bottom: 28px;
  height: 14px;
  background: var(--doug-cake-icing);
  border-color: transparent;
  box-shadow: 0 -17px 0 -5px #4cc9f0, 12px -17px 0 -5px #78e08f;
}

@keyframes dougSpinSky {
  to { transform: rotate(360deg); }
}

@keyframes dougBannerDrop {
  0% { opacity: 0; transform: translate(-50%, -150%) rotate(-7deg) scale(.75); }
  68% { opacity: 1; transform: translate(-50%, 8%) rotate(3deg) scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, 0) rotate(-1deg) scale(1); }
}

@keyframes dougBannerWobble {
  0%, 100% { transform: translateX(-50%) rotate(-1deg); }
  50% { transform: translateX(-50%) rotate(1deg); }
}

@keyframes dougLetterPulse {
  0%, 100% { transform: translateY(0) scale(1); color: #fff; }
  45% { transform: translateY(-8px) scale(1.08); color: var(--doug-cake-gold); }
}

@keyframes dougCakeEntrance {
  0% { opacity: 0; transform: translate(70%, 70%) rotate(28deg) scale(.35); }
  70% { opacity: 1; transform: translate(-4%, -5%) rotate(-8deg) scale(1.1); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}

@keyframes dougCakeDance {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

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

@keyframes dougFlame {
  0% { transform: translateX(-50%) scale(.9) rotate(-6deg); }
  100% { transform: translateX(-50%) scale(1.16) rotate(7deg); }
}

@keyframes dougConfettiFall {
  0% { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate3d(var(--drift), 112vh, 0) rotate(1080deg); opacity: 0; }
}

@keyframes dougStreamerFall {
  0% { transform: translate3d(0, -18vh, 0) rotate(0deg) scaleY(.5); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate3d(var(--drift), 116vh, 0) rotate(540deg) scaleY(1.2); opacity: 0; }
}

@keyframes dougSparkPop {
  0%, 100% { transform: scale(.15) rotate(0deg); opacity: 0; }
  45% { transform: scale(2.4) rotate(160deg); opacity: 1; }
}

@media (max-width: 700px) {
  .doug-birthday-banner {
    top: 12px;
    min-width: 90vw;
  }

  .doug-birthday-cake {
    right: 50%;
    bottom: 18px;
    width: min(58vw, 220px);
    transform: translateX(50%);
  }
}

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