:root {
  --bg: #090b11;
  --bg-elevated: #10141d;
  --panel: rgba(17, 22, 32, 0.9);
  --panel2: #121826;
  --panel3: #0d121c;
  --border: rgba(145, 162, 196, 0.18);
  --border-strong: rgba(134, 153, 194, 0.28);
  --text: #edf2ff;
  --muted: #93a0b8;
  --muted-strong: #b3c0d8;
  --accent: #6f86ff;
  --accent-2: #7d62ff;
  --danger: #ff7b7b;
  font-family: -apple-system, "SF Pro", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
}

.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding: 32px 18px 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(92, 119, 255, 0.15), transparent 32%),
    radial-gradient(circle at 82% 20%, rgba(118, 79, 255, 0.12), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(76, 120, 255, 0.09), transparent 40%),
    linear-gradient(180deg, #0a0d14 0%, #090b11 44%, #0b0f17 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-page::before {
  background-image:
    linear-gradient(rgba(135, 153, 186, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 153, 186, 0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 78%);
  opacity: 0.34;
}

.login-page::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 22%),
    radial-gradient(circle at center, transparent 52%, rgba(3, 5, 9, 0.32) 100%);
}

.login-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-particles span {
  --x: 50%;
  --y: 50%;
  --size: 3px;
  --delay: 0s;
  --duration: 18s;
  --drift-x: 26px;
  --drift-y: -34px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: rgba(170, 184, 255, 0.68);
  box-shadow:
    0 0 14px rgba(111, 134, 255, 0.5),
    0 0 28px rgba(125, 98, 255, 0.2);
  opacity: 0;
  animation: login-particle-drift var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

.login-particles span:nth-child(1) { --x: 14%; --y: 24%; --size: 2px; --delay: -2s; --duration: 19s; --drift-x: 32px; --drift-y: -28px; }
.login-particles span:nth-child(2) { --x: 26%; --y: 68%; --size: 3px; --delay: -9s; --duration: 24s; --drift-x: -24px; --drift-y: -42px; }
.login-particles span:nth-child(3) { --x: 38%; --y: 18%; --size: 2px; --delay: -14s; --duration: 22s; --drift-x: 38px; --drift-y: 30px; }
.login-particles span:nth-child(4) { --x: 48%; --y: 78%; --size: 4px; --delay: -5s; --duration: 27s; --drift-x: -36px; --drift-y: -24px; }
.login-particles span:nth-child(5) { --x: 61%; --y: 32%; --size: 2px; --delay: -11s; --duration: 20s; --drift-x: 28px; --drift-y: -38px; }
.login-particles span:nth-child(6) { --x: 72%; --y: 60%; --size: 3px; --delay: -17s; --duration: 25s; --drift-x: -30px; --drift-y: 34px; }
.login-particles span:nth-child(7) { --x: 84%; --y: 22%; --size: 2px; --delay: -7s; --duration: 23s; --drift-x: -42px; --drift-y: 26px; }
.login-particles span:nth-child(8) { --x: 88%; --y: 74%; --size: 3px; --delay: -19s; --duration: 28s; --drift-x: 24px; --drift-y: -46px; }
.login-particles span:nth-child(9) { --x: 19%; --y: 42%; --size: 2px; --delay: -13s; --duration: 21s; --drift-x: 44px; --drift-y: 18px; }
.login-particles span:nth-child(10) { --x: 55%; --y: 12%; --size: 3px; --delay: -4s; --duration: 26s; --drift-x: -18px; --drift-y: 40px; }
.login-particles span:nth-child(11) { --x: 67%; --y: 84%; --size: 2px; --delay: -16s; --duration: 24s; --drift-x: 34px; --drift-y: -32px; }
.login-particles span:nth-child(12) { --x: 33%; --y: 88%; --size: 3px; --delay: -21s; --duration: 29s; --drift-x: -28px; --drift-y: -48px; }

@keyframes login-particle-drift {
  0%, 100% {
    opacity: 0.14;
    transform: translate3d(0, 0, 0) scale(0.88);
  }
  45% {
    opacity: 0.52;
    transform: translate3d(var(--drift-x), var(--drift-y), 0) scale(1);
  }
  70% {
    opacity: 0.28;
    transform: translate3d(calc(var(--drift-x) * -0.35), calc(var(--drift-y) * 0.5), 0) scale(0.94);
  }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(388px, calc(100vw - 36px));
  margin: 0 auto;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .login-particles span {
    animation: none;
    opacity: 0.22;
  }
}

.login-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 26%),
    linear-gradient(180deg, rgba(19, 25, 37, 0.97), rgba(12, 17, 26, 0.94));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 28px 20px;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.46),
    0 10px 26px rgba(6, 10, 18, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transform: none;
  animation: none;
}

.login-user-entry {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(145, 162, 196, 0.16);
  background: rgba(15, 20, 31, 0.46);
  color: rgba(193, 204, 229, 0.82);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.login-user-entry:hover {
  color: var(--text);
  border-color: rgba(145, 162, 196, 0.28);
  background: rgba(18, 24, 38, 0.7);
  transform: translateY(-1px);
}

.login-user-entry:active {
  transform: translateY(0);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(142, 160, 255, 0.45), transparent);
  opacity: 0.55;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.login-mark {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #dfe4ff;
  background:
    linear-gradient(180deg, rgba(110, 134, 255, 0.26), rgba(125, 98, 255, 0.14)),
    rgba(91, 123, 250, 0.09);
  border: 1px solid rgba(141, 160, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(52, 78, 167, 0.18);
}

.login-brand h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  font-weight: 680;
}

.login-eyebrow {
  margin: 8px 0 0;
  color: var(--muted-strong);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.login-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-captcha-field.is-hidden {
  display: none;
}

.login-security-tip {
  margin-top: -2px;
  color: rgba(147, 160, 184, 0.8);
  font-size: 11px;
  line-height: 1.5;
}

.login-field {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.login-field input {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    linear-gradient(180deg, rgba(20, 27, 41, 0.95), rgba(13, 18, 28, 0.95));
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.login-field input::placeholder {
  color: rgba(147, 160, 184, 0.6);
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(111, 134, 255, 0.16),
    0 0 0 1px rgba(125, 98, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent),
    linear-gradient(180deg, rgba(23, 31, 48, 0.98), rgba(15, 20, 32, 0.98));
}

.login-button {
  position: relative;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow:
    0 12px 28px rgba(71, 92, 194, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    transform 120ms ease,
    filter 120ms ease,
    box-shadow 120ms ease;
}

.login-button:hover {
  filter: brightness(1.05);
  box-shadow:
    0 16px 32px rgba(71, 92, 194, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.login-button:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.78;
  box-shadow: none;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(145, 162, 196, 0.1);
  color: rgba(147, 160, 184, 0.72);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-footnote {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1;
  margin: 0;
  white-space: nowrap;
  color: rgba(147, 160, 184, 0.42);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .login-page {
    padding: 24px 14px 36px;
  }

  .login-shell {
    width: min(388px, calc(100vw - 28px));
  }

  .login-panel {
    border-radius: 14px;
    padding: 24px 20px 18px;
    box-shadow:
      0 22px 54px rgba(0, 0, 0, 0.44),
      0 8px 20px rgba(6, 10, 18, 0.34);
  }

  .login-user-entry {
    top: 14px;
    right: 14px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .login-brand {
    gap: 12px;
    margin-bottom: 22px;
  }

  .login-brand h1 {
    font-size: 24px;
  }

  .login-description {
    font-size: 11px;
  }

  .login-footnote {
    bottom: 16px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-button,
  .login-field input {
    transition: none;
  }
}
