#birthday-cake {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    cursor: pointer;
    font-size: 120px;
    filter: drop-shadow(0 0 30px rgba(255, 180, 50, 0.7));
    transition: filter 0.2s ease, transform 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    display: none;
}

#birthday-cake:hover {
    filter: drop-shadow(0 0 50px rgba(255, 220, 100, 1));
    transform: translateX(-50%) scale(1.12);
}

#birthday-cake.show {
    display: block;
    animation: cakeFall 6s linear forwards;
}

@keyframes cakeFall {
    0% {
        top: -200px;
        opacity: 0;
        transform: translateX(-50%) rotate(-10deg) scale(0.7);
    }

    5% {
        opacity: 1;
        transform: translateX(-50%) rotate(0deg) scale(1);
    }

    90% {
        opacity: 1;
    }

    100% {
        top: calc(100vh + 200px);
        opacity: 0;
        transform: translateX(-50%) rotate(10deg) scale(0.8);
    }
}

#birthday-cake.clicked {
    animation: cakeExplode 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes cakeExplode {
    0% {
        transform: translateX(-50%) translateY(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) translateY(-50%) scale(1.5);
        opacity: 0.6;
    }

    100% {
        transform: translateX(-50%) translateY(-50%) scale(0);
        opacity: 0;
    }
}

#birthday-cake.missed {
    display: none;
}

#birthday-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    display: none;
}

#birthday-overlay.active {
    display: block;
    pointer-events: auto;
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 20px;
    top: -20px;
    z-index: 100001;
    opacity: 0;
    animation: confettiFall var(--fall-duration, 3s) var(--fall-delay, 0s) ease-in forwards;
    border-radius: 2px;
}

@keyframes confettiFall {
    0% {
        top: -20px;
        opacity: 1;
        transform: rotate(0deg) translateX(0px);
    }

    25% {
        opacity: 1;
        transform: rotate(180deg) translateX(var(--sway, 30px));
    }

    50% {
        transform: rotate(360deg) translateX(calc(var(--sway, 30px) * -0.5));
    }

    75% {
        transform: rotate(540deg) translateX(var(--sway, 30px));
    }

    100% {
        top: 110vh;
        opacity: 0.6;
        transform: rotate(720deg) translateX(calc(var(--sway, 30px) * -1));
    }
}

#birthday-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 100002;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(28px, 6vw, 72px);
    font-weight: bold;
    color: transparent;
    background: linear-gradient(135deg,
            #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #ff6b6b);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    text-align: center;
    white-space: nowrap;
    text-shadow: none;
    opacity: 0;
    display: none;
    animation: none;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

#birthday-text.show {
    display: block;
    animation: textAppear 0.8s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        rainbowShift 3s 1s ease-in-out infinite;
}

@keyframes textAppear {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-10deg);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes rainbowShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

#birthday-text::before,
#birthday-text::after {
    content: '✨';
    position: absolute;
    font-size: 0.5em;
    animation: sparkleFloat 2s ease-in-out infinite;
}

#birthday-text::before {
    top: -20px;
    left: -30px;
    animation-delay: 0s;
}

#birthday-text::after {
    bottom: -20px;
    right: -30px;
    animation-delay: 1s;
}

@keyframes sparkleFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-10px) scale(1.3);
        opacity: 0.6;
    }
}

#birthday-shockwave {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 3px solid rgba(255, 215, 0, 0.8);
    transform: translate(-50%, -50%) scale(0);
    z-index: 100000;
    pointer-events: none;
    display: none;
}

#birthday-shockwave.active {
    display: block;
    animation: shockwaveExpand 0.8s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
        border-width: 4px;
    }

    100% {
        transform: translate(-50%, -50%) scale(80);
        opacity: 0;
        border-width: 1px;
    }
}

.firework {
    position: fixed;
    z-index: 100001;
    pointer-events: none;
}

.firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: fireworkBurst 1.2s ease-out forwards;
}

@keyframes fireworkBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--fx, 50px), var(--fy, -50px)) scale(0);
        opacity: 0;
    }
}

#birthday-dimmer {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 99998;
    opacity: 0;
    display: none;
    transition: opacity 0.5s ease;
}

#birthday-dimmer.show {
    display: block;
    opacity: 1;
}

#birthday-cake.fade-out,
#birthday-overlay.fade-out,
#birthday-text.fade-out,
#birthday-dimmer.fade-out {
    animation: fadeOutAll 1.5s ease-out forwards !important;
}

@keyframes fadeOutAll {
    to {
        opacity: 0;
    }
}