: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;
}

.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;
}

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;
  }
}
