:root {
  --bg: #03050a;
  --panel: rgba(6, 10, 20, 0.82);
  --panel-border: rgba(0, 229, 255, 0.22);
  --text: #eef6ff;
  --muted: #7a94b8;
  --accent: #00e5ff;
  --accent-2: #8b5cf6;
  --danger: #ff5c7a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(0, 229, 255, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', 'Space Grotesk', sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0, 40, 90, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(60, 10, 120, 0.45) 0%, transparent 50%),
    var(--bg);
  overflow-x: hidden;
}

button,
input,
a {
  font: inherit;
}

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
}

.cyber-grid,
.glow-blob,
.scan-h,
.stream,
.node,
.circuit,
.corner-tl,
.corner-br {
  position: absolute;
}

.cyber-grid {
  inset: -30%;
  background-image: radial-gradient(circle, rgba(0, 229, 255, 0.35) 1px, transparent 1px);
  background-size: 42px 42px;
  transform: perspective(520px) rotateX(72deg) translateY(-8%);
  transform-origin: center 40%;
  opacity: 0.14;
  animation: gridScroll 16s linear infinite;
}

.circuit {
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 999px;
  opacity: 0.35;
}

.circuit-a {
  width: 55vw;
  height: 55vw;
  top: -20%;
  right: -10%;
  animation: circuitPulse 8s ease-in-out infinite;
}

.circuit-b {
  width: 40vw;
  height: 40vw;
  bottom: -15%;
  left: -8%;
  border-color: rgba(139, 92, 246, 0.18);
  animation: circuitPulse 11s ease-in-out infinite reverse;
}

.glow-blob {
  border-radius: 50%;
  filter: blur(90px);
  mix-blend-mode: screen;
}

.glow-cyan {
  width: 50vw;
  height: 50vw;
  top: -12%;
  left: -10%;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.42) 0%, transparent 70%);
  animation: glowFloat 10s ease-in-out infinite alternate;
}

.glow-violet {
  width: 58vw;
  height: 58vw;
  bottom: -18%;
  right: -12%;
  background: radial-gradient(circle, rgba(120, 40, 255, 0.38) 0%, transparent 70%);
  animation: glowFloat 13s ease-in-out infinite alternate-reverse;
}

.scan-h {
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.7), transparent);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.45);
  animation: scanMove 7s linear infinite;
}

.stream {
  width: 1px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(0, 229, 255, 0.65), transparent);
  opacity: 0.35;
}

.stream-1 { left: 18%; animation: streamFall 5s linear infinite; }
.stream-2 { left: 42%; animation: streamFall 7s linear infinite 1s; }
.stream-3 { left: 78%; animation: streamFall 6s linear infinite 2s; }

.node {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.node-1 { top: 22%; left: 30%; animation: nodeBlink 3s ease-in-out infinite; }
.node-2 { top: 68%; left: 72%; animation: nodeBlink 4s ease-in-out infinite 1s; }

.corner-tl,
.corner-br {
  width: 80px;
  height: 80px;
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.corner-tl {
  top: 24px;
  left: 24px;
  border-right: none;
  border-bottom: none;
}

.corner-br {
  bottom: 24px;
  right: 24px;
  border-left: none;
  border-top: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

.auth-panel {
  width: min(100%, 440px);
  padding: 32px 28px 28px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-header h1 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
}

.app-context {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}

.mode-button {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-button.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(139, 92, 246, 0.18));
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.25);
}

.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 92, 122, 0.12);
  border: 1px solid rgba(255, 92, 122, 0.35);
  color: #ffb3c1;
  font-size: 0.9rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group[hidden] {
  display: none !important;
}

.field-group label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.field-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(0, 229, 255, 0.55);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle[aria-pressed='true'] .icon-eye-open {
  display: none;
}

.password-toggle[aria-pressed='true'] .icon-eye-closed {
  display: block;
}

.password-toggle[aria-pressed='false'] .icon-eye-closed {
  display: none;
}

.field-group input::placeholder {
  color: rgba(122, 148, 184, 0.7);
}

.field-group input:focus {
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12), 0 0 20px rgba(0, 229, 255, 0.08);
  transform: translateY(-1px);
}

.field-group input.invalid {
  border-color: rgba(255, 92, 122, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.12);
  animation: shake 0.35s ease;
}

.field-error {
  min-height: 1rem;
  font-size: 0.8rem;
  color: var(--danger);
}

.submit-button {
  position: relative;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  overflow: hidden;
  color: #001018;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #4dd9ff 40%, var(--accent-2));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 229, 255, 0.28), 0 0 24px rgba(139, 92, 246, 0.2);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.submit-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.submit-button:hover:not(:disabled) .submit-glow {
  transform: translateX(120%);
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.divider::before,
.divider::after {
  content: '';
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.social-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.social-button svg {
  width: 18px;
  height: 18px;
}

.social-button:hover:not(.disabled) {
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.06);
  transform: translateY(-1px);
}

.social-button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.security-note svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

@keyframes gridScroll {
  from { transform: perspective(520px) rotateX(72deg) translateY(-8%); }
  to { transform: perspective(520px) rotateX(72deg) translateY(12%); }
}

@keyframes glowFloat {
  from { transform: translate(0, 0); }
  to { transform: translate(3%, -4%); }
}

@keyframes scanMove {
  0% { top: -2px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes streamFall {
  0% { transform: translateY(-140px); opacity: 0; }
  15% { opacity: 0.5; }
  100% { transform: translateY(110vh); opacity: 0; }
}

@keyframes nodeBlink {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

@keyframes circuitPulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.03); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (max-width: 480px) {
  .auth-panel {
    padding: 24px 18px 20px;
    border-radius: 16px;
  }

  .social-row {
    grid-template-columns: 1fr;
  }

  .corner-tl,
  .corner-br {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
