// index.js — landing page logic /** * Handle the "Create game" button click. * Validates the lobby name, persists it, and navigates to the lobby page. */ document.getElementById("reg-btn")?.addEventListener("click", () => { const lobbyInput = /** @type {HTMLInputElement|null} */ ( document.getElementById("username") ); const lobbyName = lobbyInput ? lobbyInput.value.trim() : ""; if (lobbyName) { Storage.saveLobbyName(lobbyName); window.location.href = "lobby.html"; } else { lobbyInput?.focus(); } }); // Scroll reveal — animate elements into view as they enter the viewport const reveals = document.querySelectorAll(".reveal"); const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add("visible"); observer.unobserve(entry.target); } }); }, { threshold: 0.12 }, ); reveals.forEach((el) => observer.observe(el));