Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const card = document.querySelector('.card');
+ const buttons = document.querySelectorAll('.flip-button');
+
+ buttons.forEach(button => {
+ button.addEventListener('click', () => {
+ card.classList.toggle('flipped');
+ });
+ });
+
+ // Create floating hearts animation
+ const heartsContainer = document.querySelector('.hearts-container');
+
+ function createHeart() {
+ const heart = document.createElement('div');
+ heart.innerHTML = '❤️';
+ heart.style.position = 'absolute';
+ heart.style.fontSize = Math.random() * 20 + 10 + 'px';
+ heart.style.left = Math.random() * 100 + '%';
+ heart.style.opacity = '0';
+ heart.style.animation = `float ${Math.random() * 2 + 3}s ease-in forwards`;
+ heartsContainer.appendChild(heart);
+
+ setTimeout(() => heart.remove(), 5000);
+ }
+
+ setInterval(createHeart, 300);
+
+ // Add CSS animation for floating hearts
+ const style = document.createElement('style');
+ style.textContent = `
+ @keyframes float {
+ 0% {
+ transform: translateY(100%) rotate(0deg);
+ opacity: 1;
+ }
+ 100% {
+ transform: translateY(-100vh) rotate(360deg);
+ opacity: 0;
+ }
+ }
+ `;
+ document.head.appendChild(style);
+
+ // Create fireworks effect
+ const fireworks = document.querySelector('.fireworks');
+
+ function createParticle() {
+ const particle = document.createElement('div');
+ particle.style.position = 'absolute';
+ particle.style.width = '4px';
+ particle.style.height = '4px';
+ particle.style.background = `hsl(${Math.random() * 360}deg, 100%, 50%)`;
+ particle.style.borderRadius = '50%';
+ particle.style.left = Math.random() * 100 + '%';
+ particle.style.top = Math.random() * 100 + '%';
+ particle.style.animation = `sparkle ${Math.random() * 1 + 0.5}s ease-out forwards`;
+ fireworks.appendChild(particle);
+
+ setTimeout(() => particle.remove(), 1500);
+ }
+
+ setInterval(createParticle, 50);
+
+ // Add CSS animation for fireworks
+ const fireworksStyle = document.createElement('style');
+ fireworksStyle.textContent = `
+ @keyframes sparkle {
+ 0% {
+ transform: scale(0);
+ opacity: 1;
+ }
+ 100% {
+ transform: scale(20);
+ opacity: 0;
+ }
+ }
+ `;
+ document.head.appendChild(fireworksStyle);
+ });