:root {
  --bg-color: #0b1118;
  --bg-elevated: #121a22;
  --card-bg: #151d26;
  --input-bg: #1a2330;
  --border-subtle: #2a3544;
  --accent: #00d9a5;
  --accent-hover: #00f0b5;
  --accent-soft: rgba(0, 217, 165, 0.14);
  --text-main: #ffffff;
  --text-muted: #8b97a8;
  --text-dim: #6b7789;
  --danger: #f87171;
  --success: #4ade80;
  --radius-card: 14px;
  --radius-ctrl: 8px;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "SF Mono", "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden;
}

.page {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--bg-color);
  background-image: url("background.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(11, 17, 24, 0.55);
  pointer-events: none;
}

/* 背景之上的粉尘 / 光线氛围层（位于登录卡片之下） */
.bg-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-fx__rays {
  position: absolute;
  inset: -10% -5%;
  background:
    linear-gradient(
      118deg,
      transparent 0%,
      transparent 38%,
      rgba(255, 236, 200, 0.03) 42%,
      rgba(255, 244, 220, 0.09) 46%,
      rgba(255, 236, 200, 0.03) 50%,
      transparent 56%,
      transparent 100%
    ),
    linear-gradient(
      108deg,
      transparent 0%,
      transparent 48%,
      rgba(180, 220, 255, 0.02) 52%,
      rgba(210, 235, 255, 0.07) 56%,
      rgba(180, 220, 255, 0.02) 60%,
      transparent 66%,
      transparent 100%
    ),
    linear-gradient(
      128deg,
      transparent 0%,
      transparent 28%,
      rgba(255, 250, 230, 0.025) 33%,
      rgba(255, 248, 220, 0.06) 37%,
      rgba(255, 250, 230, 0.02) 41%,
      transparent 48%,
      transparent 100%
    );
  mix-blend-mode: soft-light;
  opacity: 0.9;
  animation: bg-rays-drift 18s ease-in-out infinite alternate;
  transform-origin: 70% 40%;
}

.bg-fx__haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 55% 40% at 68% 42%,
      rgba(255, 240, 210, 0.1),
      transparent 70%
    ),
    radial-gradient(
      ellipse 40% 35% at 55% 55%,
      rgba(160, 200, 230, 0.05),
      transparent 65%
    );
  mix-blend-mode: screen;
  opacity: 0.85;
  animation: bg-haze-breathe 12s ease-in-out infinite alternate;
}

.bg-fx__dust {
  position: absolute;
  inset: 0;
}

.bg-fx__dust span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: rgba(255, 248, 230, 0.85);
  box-shadow: 0 0 7px rgba(255, 240, 210, 0.45);
  opacity: 0;
  animation-name: bg-dust-float;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}

.bg-fx__dust span:nth-child(1)  { width: 2px; height: 2px; left: 12%; top: 70%; animation-duration: 17.2s; animation-delay: 0s; }
.bg-fx__dust span:nth-child(2)  { width: 1.5px; height: 1.5px; left: 22%; top: 78%; animation-duration: 14s; animation-delay: -3s; }
.bg-fx__dust span:nth-child(3)  { width: 2.5px; height: 2.5px; left: 31%; top: 65%; animation-duration: 20.3s; animation-delay: -7s; }
.bg-fx__dust span:nth-child(4)  { width: 1px; height: 1px; left: 40%; top: 82%; animation-duration: 12.5s; animation-delay: -1s; }
.bg-fx__dust span:nth-child(5)  { width: 2px; height: 2px; left: 48%; top: 72%; animation-duration: 18.7s; animation-delay: -11s; }
.bg-fx__dust span:nth-child(6)  { width: 1.5px; height: 1.5px; left: 55%; top: 60%; animation-duration: 15.6s; animation-delay: -5s; }
.bg-fx__dust span:nth-child(7)  { width: 3px; height: 3px; left: 62%; top: 68%; animation-duration: 21.8s; animation-delay: -14s; }
.bg-fx__dust span:nth-child(8)  { width: 1px; height: 1px; left: 70%; top: 55%; animation-duration: 13.3s; animation-delay: -2s; }
.bg-fx__dust span:nth-child(9)  { width: 2px; height: 2px; left: 76%; top: 48%; animation-duration: 17.9s; animation-delay: -9s; }
.bg-fx__dust span:nth-child(10) { width: 1.5px; height: 1.5px; left: 82%; top: 58%; animation-duration: 14.8s; animation-delay: -6s; }
.bg-fx__dust span:nth-child(11) { width: 2px; height: 2px; left: 18%; top: 58%; animation-duration: 19.5s; animation-delay: -12s; }
.bg-fx__dust span:nth-child(12) { width: 1px; height: 1px; left: 28%; top: 50%; animation-duration: 11.7s; animation-delay: -4s; }
.bg-fx__dust span:nth-child(13) { width: 2.5px; height: 2.5px; left: 36%; top: 44%; animation-duration: 21.1s; animation-delay: -16s; }
.bg-fx__dust span:nth-child(14) { width: 1.5px; height: 1.5px; left: 44%; top: 52%; animation-duration: 16.4s; animation-delay: -8s; }
.bg-fx__dust span:nth-child(15) { width: 2px; height: 2px; left: 52%; top: 40%; animation-duration: 22.6s; animation-delay: -10s; }
.bg-fx__dust span:nth-child(16) { width: 1px; height: 1px; left: 60%; top: 46%; animation-duration: 14s; animation-delay: -13s; }
.bg-fx__dust span:nth-child(17) { width: 2px; height: 2px; left: 68%; top: 38%; animation-duration: 18.7s; animation-delay: -1.5s; }
.bg-fx__dust span:nth-child(18) { width: 1.5px; height: 1.5px; left: 74%; top: 42%; animation-duration: 15.6s; animation-delay: -17s; }
.bg-fx__dust span:nth-child(19) { width: 3px; height: 3px; left: 85%; top: 36%; animation-duration: 23.4s; animation-delay: -7.5s; }
.bg-fx__dust span:nth-child(20) { width: 1px; height: 1px; left: 90%; top: 50%; animation-duration: 12.5s; animation-delay: -3.5s; }
.bg-fx__dust span:nth-child(21) { width: 2px; height: 2px; left: 8%; top: 62%; animation-duration: 17.2s; animation-delay: -15s; }
.bg-fx__dust span:nth-child(22) { width: 1.5px; height: 1.5px; left: 15%; top: 42%; animation-duration: 20.3s; animation-delay: -19s; }
.bg-fx__dust span:nth-child(23) { width: 2px; height: 2px; left: 58%; top: 78%; animation-duration: 14.8s; animation-delay: -0.8s; }
.bg-fx__dust span:nth-child(24) { width: 1px; height: 1px; left: 88%; top: 72%; animation-duration: 17.9s; animation-delay: -11.5s; }
.bg-fx__dust span:nth-child(25) { width: 2px; height: 2px; left: 5%; top: 75%; animation-duration: 16.4s; animation-delay: -2.2s; }
.bg-fx__dust span:nth-child(26) { width: 1.5px; height: 1.5px; left: 10%; top: 48%; animation-duration: 13.3s; animation-delay: -8.4s; }
.bg-fx__dust span:nth-child(27) { width: 2.5px; height: 2.5px; left: 16%; top: 85%; animation-duration: 19.5s; animation-delay: -14.1s; }
.bg-fx__dust span:nth-child(28) { width: 1px; height: 1px; left: 20%; top: 33%; animation-duration: 10.9s; animation-delay: -5.6s; }
.bg-fx__dust span:nth-child(29) { width: 2px; height: 2px; left: 25%; top: 68%; animation-duration: 17.9s; animation-delay: -18.2s; }
.bg-fx__dust span:nth-child(30) { width: 1.5px; height: 1.5px; left: 33%; top: 55%; animation-duration: 14.8s; animation-delay: -1.1s; }
.bg-fx__dust span:nth-child(31) { width: 3px; height: 3px; left: 38%; top: 88%; animation-duration: 21.1s; animation-delay: -9.7s; }
.bg-fx__dust span:nth-child(32) { width: 1px; height: 1px; left: 42%; top: 36%; animation-duration: 12.5s; animation-delay: -12.3s; }
.bg-fx__dust span:nth-child(33) { width: 2px; height: 2px; left: 46%; top: 62%; animation-duration: 17.2s; animation-delay: -4.8s; }
.bg-fx__dust span:nth-child(34) { width: 1.5px; height: 1.5px; left: 50%; top: 80%; animation-duration: 14s; animation-delay: -16.5s; }
.bg-fx__dust span:nth-child(35) { width: 2.5px; height: 2.5px; left: 54%; top: 28%; animation-duration: 21.8s; animation-delay: -6.9s; }
.bg-fx__dust span:nth-child(36) { width: 1px; height: 1px; left: 57%; top: 70%; animation-duration: 11.7s; animation-delay: -20s; }
.bg-fx__dust span:nth-child(37) { width: 2px; height: 2px; left: 64%; top: 52%; animation-duration: 18.7s; animation-delay: -3.2s; }
.bg-fx__dust span:nth-child(38) { width: 1.5px; height: 1.5px; left: 67%; top: 84%; animation-duration: 15.6s; animation-delay: -13.7s; }
.bg-fx__dust span:nth-child(39) { width: 3px; height: 3px; left: 72%; top: 30%; animation-duration: 22.6s; animation-delay: -7.8s; }
.bg-fx__dust span:nth-child(40) { width: 1px; height: 1px; left: 78%; top: 66%; animation-duration: 13.3s; animation-delay: -15.4s; }
.bg-fx__dust span:nth-child(41) { width: 2px; height: 2px; left: 80%; top: 44%; animation-duration: 16.4s; animation-delay: -0.4s; }
.bg-fx__dust span:nth-child(42) { width: 1.5px; height: 1.5px; left: 84%; top: 78%; animation-duration: 14.8s; animation-delay: -10.6s; }
.bg-fx__dust span:nth-child(43) { width: 2.5px; height: 2.5px; left: 87%; top: 24%; animation-duration: 20.3s; animation-delay: -18.8s; }
.bg-fx__dust span:nth-child(44) { width: 1px; height: 1px; left: 92%; top: 62%; animation-duration: 11.7s; animation-delay: -2.7s; }
.bg-fx__dust span:nth-child(45) { width: 2px; height: 2px; left: 94%; top: 40%; animation-duration: 16.4s; animation-delay: -11.9s; }
.bg-fx__dust span:nth-child(46) { width: 1.5px; height: 1.5px; left: 7%; top: 30%; animation-duration: 18.7s; animation-delay: -5.1s; }
.bg-fx__dust span:nth-child(47) { width: 2px; height: 2px; left: 14%; top: 90%; animation-duration: 14s; animation-delay: -14.6s; }
.bg-fx__dust span:nth-child(48) { width: 1px; height: 1px; left: 24%; top: 22%; animation-duration: 12.5s; animation-delay: -8.9s; }
.bg-fx__dust span:nth-child(49) { width: 2.5px; height: 2.5px; left: 30%; top: 76%; animation-duration: 21.1s; animation-delay: -1.8s; }
.bg-fx__dust span:nth-child(50) { width: 1.5px; height: 1.5px; left: 35%; top: 32%; animation-duration: 15.6s; animation-delay: -17.3s; }
.bg-fx__dust span:nth-child(51) { width: 2px; height: 2px; left: 43%; top: 92%; animation-duration: 17.2s; animation-delay: -6.2s; }
.bg-fx__dust span:nth-child(52) { width: 1px; height: 1px; left: 49%; top: 18%; animation-duration: 10.9s; animation-delay: -12.8s; }
.bg-fx__dust span:nth-child(53) { width: 3px; height: 3px; left: 56%; top: 88%; animation-duration: 23.4s; animation-delay: -4.1s; }
.bg-fx__dust span:nth-child(54) { width: 1.5px; height: 1.5px; left: 63%; top: 20%; animation-duration: 14.8s; animation-delay: -19.4s; }
.bg-fx__dust span:nth-child(55) { width: 2px; height: 2px; left: 69%; top: 74%; animation-duration: 19.5s; animation-delay: -9.3s; }
.bg-fx__dust span:nth-child(56) { width: 1px; height: 1px; left: 75%; top: 16%; animation-duration: 13.3s; animation-delay: -3.9s; }
.bg-fx__dust span:nth-child(57) { width: 2.5px; height: 2.5px; left: 81%; top: 86%; animation-duration: 21.8s; animation-delay: -15.7s; }
.bg-fx__dust span:nth-child(58) { width: 1.5px; height: 1.5px; left: 86%; top: 12%; animation-duration: 16.4s; animation-delay: -0.6s; }
.bg-fx__dust span:nth-child(59) { width: 2px; height: 2px; left: 91%; top: 32%; animation-duration: 17.9s; animation-delay: -13.1s; }
.bg-fx__dust span:nth-child(60) { width: 1px; height: 1px; left: 96%; top: 80%; animation-duration: 12.5s; animation-delay: -7.2s; }

@keyframes bg-rays-drift {
  from {
    transform: translate3d(-1.2%, 0.6%, 0) rotate(-0.6deg) scale(1.02);
    opacity: 0.75;
  }
  to {
    transform: translate3d(1.4%, -0.8%, 0) rotate(0.8deg) scale(1.05);
    opacity: 1;
  }
}

@keyframes bg-haze-breathe {
  from {
    opacity: 0.55;
    transform: scale(1);
  }
  to {
    opacity: 0.95;
    transform: scale(1.04);
  }
}

@keyframes bg-dust-float {
  0% {
    transform: translate3d(0, 0, 0) scale(0.7);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  40% {
    opacity: 0.95;
  }
  70% {
    opacity: 0.45;
  }
  100% {
    transform: translate3d(56px, -130px, 0) scale(1.2);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-fx__rays,
  .bg-fx__haze,
  .bg-fx__dust span {
    animation: none !important;
  }

  .bg-fx__rays {
    opacity: 0.7;
  }

  .bg-fx__haze {
    opacity: 0.7;
  }

  .bg-fx__dust span {
    opacity: 0.35;
  }
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.card {
  position: relative;
  border-radius: var(--radius-card);
  padding: 36px 32px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-main);
  line-height: 1.3;
}

.auth-subtitle {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  line-height: 1.4;
}

.panel {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

input {
  flex: 1;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  border-radius: var(--radius-ctrl);
  border: 1px solid var(--border-subtle);
  padding: 0 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.25;
  background: var(--input-bg);
  color: var(--text-main);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

input::placeholder {
  color: var(--text-dim);
}

input:hover {
  border-color: #3a4658;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 1.4;
}

.field-hint--warn {
  margin: 0 0 18px;
  color: #fbbf24;
}

.panel[hidden] {
  display: none;
}

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  width: 100%;
  height: 46px;
  margin-top: 8px;
  border-radius: var(--radius-ctrl);
  padding: 0 16px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: #0b1118;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.18s ease,
    transform 0.15s ease,
    box-shadow 0.18s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 24px rgba(0, 217, 165, 0.28);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
}

.status-bar {
  margin-top: 16px;
  border-radius: var(--radius-ctrl);
  padding: 10px 12px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-muted);
  min-height: 36px;
}

.status-bar.hidden {
  display: none;
}

.status-dot-main {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-dim);
  flex-shrink: 0;
}

.status-bar.success {
  border-color: rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
}

.status-bar.success .status-dot-main {
  background: var(--success);
}

.status-bar.error {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.status-bar.error .status-dot-main {
  background: var(--danger);
}

.status-bar.loading {
  border-color: rgba(0, 217, 165, 0.4);
  color: #a7f3e0;
}

.status-bar.loading .status-dot-main {
  background: var(--accent);
}

.status-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(139, 151, 168, 0.45);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.password-row {
  position: relative;
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
}

.password-row input {
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding-right: 44px;
}

.password-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.password-toggle::before {
  content: "";
  width: 16px;
  height: 10px;
  border-radius: 999px / 80%;
  border: 2px solid currentColor;
  box-sizing: border-box;
  position: relative;
}

.password-toggle::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  position: absolute;
}

.password-toggle.on {
  color: var(--text-muted);
}

.password-toggle:hover {
  background: var(--accent-soft);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  .card {
    padding: 28px 20px 22px;
  }

  .auth-title {
    font-size: 1.25rem;
  }
}
