-
Interactive game access code form
HTML
CSS
JavaScript
Access Protocol
Hint: 123456
RESTART
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } body { height: 100vh; display: flex; justify-content: center; align-items: center; background: #000; color: #fff; overflow: hidden; } /* 🌌 PARTICLE BACKGROUND */ #bgCanvas { position: fixed; inset: 0; z-index: -1; } /* CONTAINER */ .container { text-align: center; width: 380px; padding: 20px; background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(10px); border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); } h2 { margin-bottom: 20px; letter-spacing: 2px; text-transform: uppercase; font-size: 1.2rem; color: #00f7ff; } /* PROGRESS */ .progress { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; margin-bottom: 30px; overflow: hidden; } .progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #00f7ff, #6c63ff); transition: width 0.3s ease; } /* OTP INPUTS */ .otp-box { display: flex; justify-content: space-between; gap: 10px; } .otp-box input { width: 50px; height: 65px; border-radius: 12px; border: 1px solid rgba(108, 99, 255, 0.4); background: rgba(20, 20, 25, 0.8); color: #fff; text-align: center; font-size: 24px; font-weight: bold; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); outline: none; } .otp-box input:focus { border-color: #00f7ff; background: rgba(108, 99, 255, 0.1); } /* STATE CLASSES */ .filled { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0, 247, 255, 0.2); border-color: #00f7ff !important; } .error input { border-color: #ff4d4d !important; animation: shake 0.4s focus; } @keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } } /* POPUP */ .popup { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.5s ease; z-index: 100; } .popup.show { opacity: 1; pointer-events: auto; } .popup-box { background: #111; padding: 40px; border-radius: 20px; border: 1px solid #00f7ff; text-align: center; transform: scale(0.8); transition: transform 0.3s ease; } .popup.show .popup-box { transform: scale(1); } .btn-retry { margin-top: 20px; padding: 10px 25px; background: #6c63ff; border: none; color: white; border-radius: 8px; cursor: pointer; } p {margin-top: 20px; font-size: 0.8rem; color: #555;} /* EXPLOSION PARTICLES */ #particles { position: fixed; inset: 0; pointer-events: none; } .particle { position: absolute; width: 6px; height: 6px; border-radius: 50%; animation: explode 1s forwards cubic-bezier(0, 0.5, 0.5, 1); } @keyframes explode { to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; } }
const canvas = document.getElementById("bgCanvas"); const ctx = canvas.getContext("2d"); let stars = []; function resize() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; } resize(); window.addEventListener("resize", resize); for (let i = 0; i < 150; i++) { stars.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, size: Math.random() * 1.5, speed: Math.random() * 0.8 + 0.1 }); } function animateBg() { ctx.fillStyle = "rgba(0, 0, 0, 0.2)"; ctx.fillRect(0, 0, canvas.width, canvas.height); for (let s of stars) { s.y += s.speed; if (s.y > canvas.height) s.y = 0; ctx.fillStyle = "#00f7ff"; ctx.beginPath(); ctx.arc(s.x, s.y, s.size, 0, Math.PI * 2); ctx.fill(); } requestAnimationFrame(animateBg); } animateBg(); /* OTP LOGIC */ const inputs = document.querySelectorAll(".otp-box input"); const progress = document.getElementById("progress"); const otpBox = document.getElementById("otpBox"); const popup = document.getElementById("popup"); const title = document.getElementById("title"); const particleContainer = document.getElementById("particles"); const CORRECT_OTP = "123456"; // Auto-focus first input inputs[0].focus(); function updateProgress() { let filled = [...inputs].filter(i => i.value).length; progress.style.width = (filled / 6) * 100 + "%"; } inputs.forEach((input, index) => { // Handle typing input.addEventListener("input", e => { const val = e.target.value; if (!/^[0-9]$/.test(val)) { input.value = ""; return; } input.classList.add("filled"); if (index < inputs.length - 1) inputs[index + 1].focus(); updateProgress(); checkOTP(); }); // Handle Backspace input.addEventListener("keydown", e => { if (e.key === "Backspace") { if (!input.value && index > 0) { inputs[index - 1].focus(); inputs[index - 1].value = ""; inputs[index - 1].classList.remove("filled"); } else { input.classList.remove("filled"); } updateProgress(); } }); // Handle Paste input.addEventListener("paste", e => { e.preventDefault(); const data = e.clipboardData.getData("text").slice(0, 6); if (!/^\d+$/.test(data)) return; data.split("").forEach((char, i) => { if (inputs[i]) { inputs[i].value = char; inputs[i].classList.add("filled"); } }); updateProgress(); checkOTP(); }); }); function checkOTP() { let otp = [...inputs].map(i => i.value).join(""); if (otp.length === 6) { if (otp === CORRECT_OTP) { createExplosion(); setTimeout(() => showPopup("SYSTEM OVERRIDE SUCCESSFUL", "Welcome back, Commander."), 500); } else { otpBox.classList.add("error"); // Vibrate effect for mobile if(navigator.vibrate) navigator.vibrate(200); setTimeout(() => { inputs.forEach(i => { i.value = ""; i.classList.remove("filled"); }); otpBox.classList.remove("error"); inputs[0].focus(); updateProgress(); }, 600); } } } function showPopup(t, m) { popup.classList.add("show"); title.innerText = t; document.getElementById("msg").innerText = m; } function createExplosion() { const colors = ["#00f7ff", "#6c63ff", "#ffffff"]; for (let i = 0; i < 60; i++) { const p = document.createElement("div"); p.className = "particle"; p.style.left = "50%"; p.style.top = "50%"; const angle = Math.random() * Math.PI * 2; const velocity = 100 + Math.random() * 200; p.style.setProperty("--x", Math.cos(angle) * velocity + "px"); p.style.setProperty("--y", Math.sin(angle) * velocity + "px"); p.style.background = colors[Math.floor(Math.random() * colors.length)]; particleContainer.appendChild(p); setTimeout(() => p.remove(), 1000); } }
Live Preview