document.querySelectorAll('[data-confetti]').forEach(btn => {
btn.addEventListener('click', e => {
const colors = ['#6366f1','#ec4899','#f59e0b','#22c55e','#ef4444','#3b82f6'];
for (let i = 0; i < 30; i++) {
const dot = document.createElement('span');
Object.assign(dot.style, {
position: 'fixed',
left: e.clientX + 'px', top: e.clientY + 'px',
width: Math.random() * 8 + 4 + 'px',
height: Math.random() * 8 + 4 + 'px',
background: colors[Math.floor(Math.random() * colors.length)],
borderRadius: Math.random() > 0.5 ? '50%' : '2px',
pointerEvents: 'none', zIndex: 9999,
transform: `translate(${(Math.random()-0.5)*80}px,0)`,
animation: `confettiFly ${Math.random()*0.5+0.5}s ease-out forwards`,
});
document.body.appendChild(dot);
dot.addEventListener('animationend', () => dot.remove());
}
});
});