feather.replace(); // Particles const particlesContainer = document.getElementById('particles'); for (let i = 0; i < 30; i++) { const particle = document.createElement('div'); particle.classList.add('particle'); particle.style.left = Math.random() * 100 + '%'; particle.style.animationDelay = Math.random() * 10 + 's'; particle.style.animationDuration = (Math.random() * 5 + 8) + 's'; particle.style.width = (Math.random() * 4 + 2) + 'px'; particle.style.height = particle.style.width; particlesContainer.appendChild(particle); } // Easter Egg: Konami Code (desktop) ou 10 taps (mobile) const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a']; let konamiIndex = 0; let tapCount = 0; let tapTimer = null; const REQUIRED_TAPS = 10; const errorCodeEl = document.querySelector('.error-code'); // Desktop: Konami Code document.addEventListener('keydown', (e) => { if (e.key === konamiCode[konamiIndex]) { konamiIndex++; if (konamiIndex === konamiCode.length) { startPortalTransition(); konamiIndex = 0; } } else { konamiIndex = 0; } }); // Mobile: 10 taps function handleTap(e) { if (e.type === 'touchend') e.preventDefault(); tapCount++; errorCodeEl.style.transform = 'scale(0.95)'; setTimeout(() => errorCodeEl.style.transform = '', 100); if (tapCount >= 3 && tapCount < REQUIRED_TAPS) { showTapCounter(tapCount, REQUIRED_TAPS); } if (tapTimer) clearTimeout(tapTimer); tapTimer = setTimeout(() => { tapCount = 0; hideTapCounter(); }, 500); if (tapCount >= REQUIRED_TAPS) { tapCount = 0; hideTapCounter(); startPortalTransition(); } } function showTapCounter(current, total) { let counter = document.getElementById('tap-counter'); if (!counter) { counter = document.createElement('div'); counter.id = 'tap-counter'; counter.style.cssText = 'position:fixed;top:20px;left:50%;transform:translateX(-50%);background:rgba(139,58,98,0.9);color:white;padding:0.5rem 1rem;border-radius:20px;font-size:0.85rem;font-weight:600;z-index:1000;'; document.body.appendChild(counter); } counter.textContent = current + ' / ' + total + ' 🔓'; } function hideTapCounter() { const counter = document.getElementById('tap-counter'); if (counter) counter.remove(); } errorCodeEl.addEventListener('click', handleTap); errorCodeEl.addEventListener('touchend', handleTap); // Portal Transition function startPortalTransition() { const transition = document.createElement('div'); transition.id = 'portal-transition'; transition.innerHTML = '
Le Jeu de la Vie de Conway
Règles : Cellule vivante avec 2-3 voisins survit. Cellule morte avec 3 voisins naît.