:root {
  color-scheme: dark;
  --void: #060c18;
  --deep: #0a1424;
  --surface: rgba(12, 20, 38, 0.94);
  --raised: rgba(17, 30, 54, 0.78);
  --overlay: rgba(22, 34, 64, 0.92);
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(0, 212, 255, 0.28);
  --text-primary: #f0f6ff;
  --text-secondary: #7a92b8;
  --text-muted: #3f5479;
  --cyan: #00d4ff;
  --green: #2f7dff;
  --red: #ff5566;
  --ok: #a7f3d0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 18% 16%, rgba(0, 212, 255, 0.2), transparent 30%),
    radial-gradient(circle at 82% 76%, rgba(47, 125, 255, 0.16), transparent 34%),
    linear-gradient(135deg, #060c18 0%, #0a1424 48%, #060c18 100%);
  overflow-x: hidden;
}

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

.neural-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.neural-background::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.44;
  background:
    linear-gradient(rgba(86, 144, 190, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 144, 190, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black 18%, transparent 76%);
}

.neural-node {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.85);
  opacity: 0.58;
  animation: neuralPulse 4s ease-in-out infinite;
}

.neural-node:nth-child(1) { top: 20%; left: 14%; animation-delay: 0s; }
.neural-node:nth-child(2) { top: 62%; left: 83%; animation-delay: 0.8s; }
.neural-node:nth-child(3) { top: 78%; left: 22%; animation-delay: 1.6s; background: var(--green); }
.neural-node:nth-child(4) { top: 30%; left: 72%; animation-delay: 2.4s; }
.neural-node:nth-child(5) { top: 12%; left: 60%; animation-delay: 3.2s; background: var(--green); }

.neural-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.35), transparent);
  transform-origin: left center;
  opacity: 0.48;
}

.line-a { width: 42vw; left: 14%; top: 21%; transform: rotate(14deg); }
.line-b { width: 38vw; left: 22%; top: 78%; transform: rotate(-23deg); }
.line-c { width: 34vw; right: 14%; top: 31%; transform: rotate(58deg); }

.login-layout {
  width: min(420px, 100%);
  position: relative;
  z-index: 1;
  animation: loginIn 680ms ease both;
}

.login-layout.is-leaving {
  animation: loginCompressOut 620ms cubic-bezier(.22, .8, .2, 1) forwards;
  transform-origin: center;
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 38px 32px 30px;
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(7, 13, 28, 0.96), rgba(6, 18, 30, 0.94));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58), 0 0 70px rgba(0, 212, 255, 0.08);
  backdrop-filter: blur(20px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(0, 212, 255, 0.08) 42%, transparent 58%);
  transform: translateX(-100%);
  animation: scanLine 4.8s ease-in-out infinite;
}

.ai-glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.12), transparent 68%);
  animation: aiGlow 6s ease-in-out infinite;
  pointer-events: none;
}

.login-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 34px;
}

.ai-logo {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
}

.logo-core {
  position: relative;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.34);
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 26px rgba(0, 212, 255, 0.16);
  animation: coreFloat 3.8s ease-in-out infinite;
}

.logo-core img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.logo-rings {
  position: absolute;
  inset: 0;
}

.ring {
  position: absolute;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 50%;
  animation: ringPulse 3s ease-in-out infinite;
}

.ring-1 { width: 60px; height: 60px; top: 11px; left: 11px; }
.ring-2 { width: 72px; height: 72px; top: 5px; left: 5px; animation-delay: 0.8s; border-color: rgba(47, 125, 255, 0.32); }
.ring-3 { width: 82px; height: 82px; top: 0; left: 0; animation-delay: 1.6s; }

.login-kicker {
  margin: 0 0 10px;
  color: var(--cyan);
  font: 800 12px/1 "DM Mono", monospace;
  text-transform: uppercase;
}

.login-header h1 {
  margin: 0;
  color: var(--text-primary);
  font: 900 31px/1 "Orbitron", sans-serif;
  letter-spacing: 0;
}

.login-header p:last-child {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
}

.login-form.is-locked {
  pointer-events: none;
}

.smart-field {
  position: relative;
  display: block;
  min-height: 54px;
}

.field-background {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 12px;
  background: rgba(17, 30, 54, 0.72);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.smart-field input {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 54px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  padding: 18px 50px 14px 16px;
  font: 800 15px/1 "DM Sans", sans-serif;
}

.smart-field input::placeholder {
  color: transparent;
}

.floating-label {
  position: absolute;
  z-index: 3;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
  transition: all 180ms ease;
  background: rgba(7, 13, 28, 0.86);
  padding: 0 4px;
}

.smart-field input:focus ~ .floating-label,
.smart-field input:not(:placeholder-shown) ~ .floating-label {
  top: 0;
  color: var(--cyan);
  font-size: 12px;
  transform: translateY(-50%);
}

.smart-field input:focus ~ .field-background,
.smart-field:focus-within .field-background {
  border-color: rgba(0, 212, 255, 0.86);
  background: rgba(17, 30, 54, 0.94);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.ai-indicator {
  position: absolute;
  right: 16px;
  top: 50%;
  z-index: 4;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
}

.ai-pulse {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0;
  animation: aiIndicator 2s ease-in-out infinite;
}

.smart-field input:focus ~ .ai-indicator .ai-pulse {
  opacity: 1;
}

.field-completion {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 4;
  width: 0;
  height: 2px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 320ms ease;
}

.smart-field input:valid ~ .field-completion {
  width: 100%;
}

.smart-field[data-field="password"] input {
  padding-right: 88px;
}

.smart-toggle {
  position: absolute;
  right: 46px;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 160ms ease, background 160ms ease;
}

.smart-toggle:hover,
.smart-toggle:focus-visible {
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.1);
}

.toggle-hide,
.smart-toggle.toggle-active .toggle-show {
  display: none;
}

.smart-toggle.toggle-active .toggle-hide {
  display: block;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 2px 0 8px;
  flex-wrap: wrap;
}

.smart-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #cfe0ef;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.smart-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-ai {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.checkbox-core {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(0, 212, 255, 0.38);
  border-radius: 5px;
  background: rgba(17, 30, 54, 0.72);
  transition: all 180ms ease;
}

.checkbox-ai svg {
  position: relative;
  z-index: 1;
  color: transparent;
  transition: color 180ms ease;
}

.smart-checkbox input:checked + .checkbox-ai .checkbox-core {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--cyan), var(--green));
  box-shadow: 0 0 14px rgba(47, 125, 255, 0.28);
}

.smart-checkbox input:checked + .checkbox-ai svg {
  color: #031018;
}

.neural-link {
  color: var(--green);
  font: 800 12px/1 "DM Mono", monospace;
  text-transform: uppercase;
}

.neural-link::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(47, 125, 255, 0.9);
}

.neural-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  margin-top: 2px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  font: 900 15px/1 "DM Sans", sans-serif;
  cursor: pointer;
}

.button-bg {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.58);
  background: linear-gradient(135deg, rgba(0, 92, 140, 0.98), rgba(17, 30, 54, 0.98));
  transition: transform 180ms ease, filter 180ms ease, border-color 180ms ease, background 180ms ease;
}

.neural-button:hover .button-bg {
  transform: scale(1.02);
  border-color: rgba(0, 212, 255, 0.86);
  background: linear-gradient(135deg, rgba(0, 118, 170, 0.98), rgba(18, 43, 76, 0.98));
  filter: brightness(1.04);
}

.neural-button:active .button-bg {
  transform: scale(0.98);
}

.neural-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.button-text {
  position: relative;
  z-index: 2;
}

.button-loader {
  position: absolute;
  z-index: 2;
  opacity: 0;
  transition: opacity 160ms ease;
}

.neural-button.loading .button-text {
  opacity: 0;
}

.neural-button.loading .button-loader {
  opacity: 1;
}

.neural-spinner {
  display: flex;
  gap: 4px;
}

.spinner-segment {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--text-primary);
  animation: neuralSpinner 1.2s ease-in-out infinite;
}

.spinner-segment:nth-child(2) { animation-delay: 0.1s; }
.spinner-segment:nth-child(3) { animation-delay: 0.2s; }

.button-glow {
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: 14px;
  background: rgba(0, 212, 255, 0.46);
  filter: blur(10px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.neural-button:hover .button-glow {
  opacity: 0.55;
}

.login-message {
  min-height: 22px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.login-message.warn {
  color: var(--red);
}

.login-message.ok {
  color: var(--ok);
}

.auth-separator {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}

.separator-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.32), transparent);
}

.separator-text {
  color: var(--text-muted);
  font: 800 11px/1 "DM Mono", monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.app-info {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-neural {
  position: relative;
  min-height: 62px;
  overflow: hidden;
  border-radius: 10px;
  padding: 10px 9px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: center;
}

.social-bg {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 10px;
  background: rgba(17, 30, 54, 0.58);
  transition: all 180ms ease;
}

.info-neural:hover .social-bg {
  border-color: rgba(47, 125, 255, 0.44);
  background: rgba(17, 30, 54, 0.82);
}

.info-neural strong,
.info-neural span:not(.social-bg):not(.social-glow) {
  position: relative;
  z-index: 2;
}

.info-neural strong {
  color: var(--text-primary);
  font: 700 14px/1 "Space Grotesk", "DM Sans", system-ui, sans-serif;
}

.info-neural span:not(.social-bg):not(.social-glow) {
  color: var(--text-secondary);
  font-family: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
}

.social-glow {
  position: absolute;
  inset: -1px;
  z-index: 0;
  border-radius: 11px;
  background: rgba(0, 212, 255, 0.2);
  filter: blur(5px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.info-neural:hover .social-glow {
  opacity: 1;
}

.login-transition {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(11, 45, 58, 0.52), rgba(3, 10, 18, 0.96) 58%),
    linear-gradient(135deg, rgba(4, 13, 23, 0.98), rgba(2, 8, 14, 0.98));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 20;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.login-transition::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(86, 144, 190, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 144, 190, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black 12%, transparent 72%);
}

.login-transition-stage {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 42px));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: scale(0.88);
  opacity: 0;
}

.transition-map {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle, transparent 0 18%, rgba(0, 212, 255, 0.12) 18.4% 18.8%, transparent 19.2% 35%, rgba(47, 125, 255, 0.14) 35.4% 35.8%, transparent 36.2% 52%, rgba(0, 212, 255, 0.1) 52.4% 52.8%, transparent 53.2%),
    conic-gradient(from -60deg, rgba(0, 212, 255, 0.18), transparent 22%, transparent 52%, rgba(47, 125, 255, 0.2), transparent 76%);
  box-shadow: inset 0 0 80px rgba(0, 212, 255, 0.08), 0 0 120px rgba(0, 212, 255, 0.12);
}

.transition-map::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, rgba(0, 212, 255, 0.78), transparent 18%, transparent 100%);
  animation: transitionSweep 1.8s linear infinite;
  mask-image: radial-gradient(circle, transparent 0 7%, black 7.5% 58%, transparent 59%);
}

.transition-map::after {
  content: "";
  position: absolute;
  inset: 49.5% 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent);
  animation: transitionLine 1.25s ease-in-out infinite alternate;
}

.transition-node,
.transition-sector {
  position: absolute;
  display: block;
}

.transition-node {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(47, 125, 255, 0.9);
  animation: nodePulse 1.2s ease-in-out infinite;
}

.node-a { left: 28%; top: 34%; }
.node-b { right: 24%; top: 42%; animation-delay: 220ms; }
.node-c { left: 47%; bottom: 24%; animation-delay: 440ms; }

.transition-sector {
  width: 34%;
  height: 1px;
  left: 50%;
  top: 50%;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent);
  transform-origin: left center;
}

.sector-a { transform: rotate(28deg); }
.sector-b { transform: rotate(148deg); }

.transition-center {
  position: relative;
  z-index: 2;
  width: min(250px, 58vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.transition-center img {
  width: 82px;
  height: 82px;
  animation: transitionMark 900ms ease-in-out infinite alternate;
}

.transition-center span {
  color: #dff8ff;
  font: 800 13px/1.05 "Space Grotesk", "DM Sans", system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  text-align: center;
}

.login-transition.is-visible {
  opacity: 1;
  visibility: visible;
}

.login-transition.is-visible .login-transition-stage {
  animation: transitionStageIn 520ms cubic-bezier(.22, .8, .2, 1) 80ms forwards;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@keyframes neuralPulse {
  0%, 100% { opacity: 0.36; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.7); }
}

@keyframes aiGlow {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
}

@keyframes coreFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes ringPulse {
  0%, 100% { opacity: 0.34; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.06); }
}

@keyframes aiIndicator {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.55); opacity: 1; }
}

@keyframes neuralSpinner {
  0%, 80%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  40% { transform: scaleY(1); opacity: 1; }
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginCompressOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  60% { opacity: 0.86; transform: translateY(-8px) scale(0.985); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.94); }
}

@keyframes scanLine {
  0%, 42% { transform: translateX(-105%); }
  68%, 100% { transform: translateX(105%); }
}

@keyframes transitionMark {
  from {
    transform: scale(0.94);
    filter: drop-shadow(0 0 14px rgba(0, 212, 255, 0.2));
  }
  to {
    transform: scale(1.04);
    filter: drop-shadow(0 0 34px rgba(0, 212, 255, 0.72));
  }
}

@keyframes transitionStageIn {
  to { opacity: 1; transform: scale(1); }
}

@keyframes transitionSweep {
  to { transform: rotate(360deg); }
}

@keyframes transitionLine {
  from { transform: rotate(-8deg); opacity: 0.45; }
  to { transform: rotate(8deg); opacity: 0.9; }
}

@keyframes nodePulse {
  0%, 100% { transform: scale(0.75); opacity: 0.55; }
  50% { transform: scale(1.25); opacity: 1; }
}

@media (max-width: 480px) {
  .login-shell {
    padding: 16px;
  }

  .login-card {
    padding: 32px 24px 26px;
    border-radius: 16px;
  }

  .login-header h1 {
    font-size: 25px;
  }

  .ai-logo {
    width: 64px;
    height: 64px;
  }

  .ring-1 { width: 46px; height: 46px; top: 9px; left: 9px; }
  .ring-2 { width: 56px; height: 56px; top: 4px; left: 4px; }
  .ring-3 { width: 64px; height: 64px; }

  .app-info {
    grid-template-columns: 1fr;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
  }
}

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