:root {
  color-scheme: dark;
  --bg: #090b13;
  --panel: rgba(18, 21, 34, 0.88);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f4fb;
  --muted: #979aaa;
  --purple: #8f7cff;
  --purple-soft: #b7acff;
  --mint: #47e6c1;
  --danger: #ff6b85;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.017) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.017) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
  overflow: hidden;
}

button { font: inherit; }

.ambient {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
}

.ambient-one { top: -220px; right: -120px; background: var(--purple); }
.ambient-two { bottom: -300px; left: -180px; background: var(--mint); opacity: 0.09; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  padding: 36px 38px 30px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(143, 124, 255, 0.42);
  border-radius: 18px;
  background: rgba(143, 124, 255, 0.12);
  box-shadow: inset 0 0 22px rgba(143, 124, 255, 0.09);
}

.brand-mark svg {
  width: 30px;
  fill: none;
  stroke: var(--purple-soft);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--purple-soft);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.85rem, 7vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

.subtitle {
  max-width: 310px;
  margin: 14px auto 25px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.username-field {
  display: grid;
  gap: 7px;
  margin: 0 auto 22px;
  text-align: left;
}

.username-field span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.username-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: rgba(255,255,255,.035);
  font: inherit;
}

.username-field input:focus {
  border-color: rgba(143,124,255,.65);
  box-shadow: 0 0 0 3px rgba(143,124,255,.1);
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 15px;
  min-height: 25px;
  margin-bottom: 25px;
}

.pin-display i {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(183, 172, 255, 0.5);
  border-radius: 50%;
  background: rgba(143, 124, 255, 0.05);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.pin-display i.filled {
  transform: scale(1.12);
  border-color: var(--purple-soft);
  background: var(--purple);
  box-shadow: 0 0 15px rgba(143, 124, 255, 0.55);
}

.keypad {
  width: min(100%, 296px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 1.12rem;
  font-weight: 750;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.keypad button:hover { border-color: rgba(143, 124, 255, 0.55); background: rgba(143, 124, 255, 0.1); }
.keypad button:active { transform: scale(0.95); }
.keypad button:disabled { opacity: 0.45; cursor: wait; }
.keypad .utility { color: var(--muted); }
.keypad .confirm { color: #08120f; border-color: transparent; background: var(--mint); }
.keypad .confirm:hover { background: #6af0d0; }
.keypad svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.message {
  min-height: 20px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.message.error { color: #ffc4ce; }
.message.success { color: #bffbed; }
.login-card.shake { animation: shake 0.32s ease; }

@keyframes shake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@media (max-width: 480px) {
  .login-card { padding: 29px 22px 24px; border-radius: 21px; }
  .keypad { width: min(100%, 280px); }
  .keypad button { min-height: 59px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
