styles.css
* {
margin: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(160deg, #050608, #0a1422 60%, #0e1d33);
font-family: system-ui, sans-serif;
}
.card {
width: 400px;
border-radius: 4px;
overflow: hidden;
position: relative;
background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
border: 1px solid rgba(255,255,255,0.08);
box-shadow: 0 0 80px rgba(59,130,246,0.06), 0 30px 80px rgba(0,0,0,0.7);
}
.content {
padding: 44px 40px;
text-align: center;
}
.shield {
width: 64px;
height: 64px;
border-radius: 50%;
background: rgba(59,130,246,0.08);
border: 1px solid rgba(59,130,246,0.15);
font-size: 28px;
line-height: 64px;
margin: 0 auto 20px;
}
h2 {
font-size: 22px;
font-weight: 700;
color: #f1f5f9;
margin-bottom: 6px;
}
.subtitle {
font-size: 13px;
color: rgba(255,255,255,0.4);
margin-bottom: 32px;
}
.digits {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
margin-bottom: 28px;
}
.digits input {
width: 46px;
height: 54px;
border-radius: 4px;
border: 1px solid rgba(59,130,246,0.2);
background: rgba(0,0,0,0.3);
color: #93c5fd;
font-size: 22px;
font-weight: 700;
text-align: center;
}
.digits input:focus {
outline: none;
border-color: rgba(59,130,246,0.6);
box-shadow: 0 0 15px rgba(59,130,246,0.2);
}
button {
width: 100%;
padding: 14px;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: 700;
color: #fff;
background: linear-gradient(135deg, #1d4ed8, #2563eb, #1d4ed8);
background-size: 200% 200%;
background-position: left center;
cursor: pointer;
transition: background-position 0.3s ease;
}
button:hover {
background-position: right center;
}
.card::before {
content: "";
position: absolute;
top: 12px;
left: 12px;
width: 24px;
height: 24px;
border-top: 2px solid #3b82f6;
border-left: 2px solid #3b82f6;
}
.card::after {
content: "";
position: absolute;
bottom: 12px;
right: 12px;
width: 24px;
height: 24px;
border-bottom: 2px solid #3b82f6;
border-right: 2px solid #3b82f6;
}
script.js
document.addEventListener("DOMContentLoaded", () => {
const inputs = document.querySelectorAll(".digits input");
inputs.forEach((input, index) => {
input.addEventListener("input", () => {
const value = input.value.replace(/\D/g, "");
input.value = value.slice(0, 1);
if (value && index < inputs.length - 1) {
inputs[index + 1].focus();
}
});
input.addEventListener("keydown", (e) => {
if (e.key === "Backspace" && !input.value && index > 0) {
inputs[index - 1].focus();
}
});
});
if (inputs[0]) inputs[0].focus();
});