document.getElementById("celebrateBtn").addEventListener("click", function() { // Play champagne sound const popSound = document.getElementById("popSound"); popSound.currentTime = 0; popSound.play(); // Add bottle neck if not already if (!document.querySelector(".bottle-neck")) { const bottle = document.createElement("div"); bottle.classList.add("bottle-neck"); document.body.appendChild(bottle); } // Create cork const cork = document.createElement("div"); cork.classList.add("cork"); document.body.appendChild(cork); cork.style.opacity = 1; // Animate cork upward let pos = 0; const rise = setInterval(() => { pos += 14; cork.style.bottom = (120 + pos) + "px"; if (pos > 500) { // flies off screen clearInterval(rise); cork.remove(); } }, 30); // Confetti spray burst confetti({ particleCount: 150, spread: 80, origin: { y: 0.9 } }); // Release bubbles for (let i = 0; i < 15; i++) { const bubble = document.createElement("div"); bubble.classList.add("bubble"); const size = Math.random() * 12 + 8; bubble.style.width = size + "px"; bubble.style.height = size + "px"; bubble.style.left = (window.innerWidth / 2 + (Math.random() * 60 - 30)) + "px"; bubble.style.bottom = "140px"; document.body.appendChild(bubble); let riseHeight = 0; const floatUp = setInterval(() => { riseHeight += 4; bubble.style.bottom = (140 + riseHeight) + "px"; if (riseHeight > 200) { clearInterval(floatUp); bubble.remove(); } }, 60); } });