/* 登录页样式 —— 赛博终端风格，取自 STARGATE（services/bastion/web/src/style.css）那套。
   单独一个样式表、**不引 style.css**：两边各有一套设计令牌，同时加载会互相覆盖。
   零依赖手写 CSS；颜色一律走令牌；`<html data-theme="light">` 切白天。
   注意：这个页面的主题偏好与课件页共用 localStorage['learn-docker-theme']。 */

:root {
  color-scheme: dark;

  --bg-deep: #01030a;
  --panel: rgba(10, 18, 30, 0.72);
  --surface: rgba(4, 8, 16, 0.82);
  --line: rgba(56, 189, 248, 0.16);
  --line-2: rgba(56, 189, 248, 0.42);
  --text: #d8e8f8;
  --dim: #7b93ac;
  --dim-2: #55697f;
  --accent: #2ee6c5;
  --accent-2: #7c5cff;
  --accent-3: #38bdf8;
  --warn: #ffb020;
  --err: #ff5c72;
  --danger-fg: #ff8d9c;
  --hero-fg: #eafcff;
  --violet-fg: #c6b6ff;

  --input-bg: rgba(4, 10, 20, 0.9);
  --input-bg-focus: rgba(6, 16, 28, 0.95);
  --tint-accent: rgba(46, 230, 197, 0.08);
  --btn-accent-a: rgba(46, 230, 197, 0.16);
  --btn-accent-b: rgba(46, 230, 197, 0.06);
  --btn-danger-b: rgba(255, 92, 114, 0.05);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);

  --grid: rgba(56, 189, 248, 0.055);
  --scan: rgba(255, 255, 255, 0.022);
  --vignette: rgba(0, 0, 0, 0.72);
  --orb-a: rgba(46, 230, 197, 0.16);
  --orb-b: rgba(124, 92, 255, 0.16);
  --orb-c: rgba(56, 189, 248, 0.12);
  --ring-1: rgba(56, 189, 248, 0.18);
  --ring-2: rgba(124, 92, 255, 0.16);
  --arc-1: rgba(46, 230, 197, 0.5);
  --arc-2: rgba(124, 92, 255, 0.5);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    "PingFang SC", "Microsoft YaHei", monospace;
  --glow-accent: 0 0 20px rgba(46, 230, 197, 0.32);
  --glow-violet: 0 0 22px rgba(124, 92, 255, 0.32);
  --radius: 4px;
}

html[data-theme="light"] {
  color-scheme: light;

  --bg-deep: #e6eef7;
  --panel: rgba(255, 255, 255, 0.8);
  --surface: rgba(255, 255, 255, 0.86);
  --line: rgba(12, 96, 132, 0.18);
  --line-2: rgba(12, 96, 132, 0.42);
  --text: #0d2135;
  --dim: #4d6679;
  --dim-2: #6d8397;
  --accent: #0e8f83;
  --accent-2: #6533e0;
  --accent-3: #0a6cb5;
  --warn: #a35f00;
  --err: #c62b45;
  --danger-fg: #b82741;
  --hero-fg: #08243a;
  --violet-fg: #5b3ad6;

  --input-bg: rgba(255, 255, 255, 0.94);
  --input-bg-focus: #ffffff;
  --tint-accent: rgba(14, 143, 131, 0.1);
  --btn-accent-a: rgba(14, 143, 131, 0.14);
  --btn-accent-b: rgba(14, 143, 131, 0.05);
  --btn-danger-b: rgba(198, 43, 69, 0.04);
  --shadow: 0 10px 30px rgba(16, 42, 74, 0.14);

  --grid: rgba(12, 96, 132, 0.07);
  --scan: rgba(12, 40, 70, 0.014);
  --vignette: rgba(255, 255, 255, 0.55);
  --orb-a: rgba(14, 143, 131, 0.16);
  --orb-b: rgba(101, 51, 224, 0.12);
  --orb-c: rgba(10, 108, 181, 0.12);
  --ring-1: rgba(12, 96, 132, 0.2);
  --ring-2: rgba(101, 51, 224, 0.16);
  --arc-1: rgba(14, 143, 131, 0.42);
  --arc-2: rgba(101, 51, 224, 0.36);

  --glow-accent: 0 0 14px rgba(14, 143, 131, 0.2);
  --glow-violet: 0 0 14px rgba(101, 51, 224, 0.18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ── 背景层：网格 + 光晕 + 扫描线 + 暗角 ───────────────────── */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.bg-grid {
  position: absolute; inset: -2px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

.bg-orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5;
  animation: drift 22s ease-in-out infinite alternate;
}
.bg-orb.a { width: 520px; height: 520px; top: -220px; left: -120px; background: var(--orb-a); }
.bg-orb.b { width: 620px; height: 620px; top: -180px; right: -200px; background: var(--orb-b); animation-delay: -8s; }
.bg-orb.c { width: 460px; height: 460px; bottom: -260px; left: 40%; background: var(--orb-c); animation-delay: -14s; }

.bg-scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, var(--scan) 0 1px, transparent 1px 3px);
  animation: scan 7s linear infinite;
}

.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 40%, var(--vignette) 100%);
}

/* ── 启动序列 ─────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: var(--bg-deep);
  transition: opacity 0.5s ease, visibility 0.5s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-mark {
  font-size: 30px; letter-spacing: 0.42em; color: var(--accent); font-weight: 600;
  text-shadow: var(--glow-accent); animation: flicker 1.6s ease-out both;
}
.boot-sub { color: var(--dim-2); font-size: 12px; letter-spacing: 0.3em; margin-top: 10px; }
.boot-bar {
  width: 220px; height: 2px; margin: 18px auto 0; background: var(--line);
  position: relative; overflow: hidden;
}
.boot-bar::after {
  content: ''; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 0.9s ease-in-out infinite;
}

/* ── 布局 ─────────────────────────────────────────────────── */
.shell { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100%; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 18px 96px; flex: 1; }

/* ── 顶栏 ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.5;
}

.brand { display: flex; align-items: center; gap: 11px; }

.gate { width: 30px; height: 30px; flex: none; position: relative; display: grid; place-items: center; }
.gate i {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--line-2);
  border-top-color: var(--accent);
  border-bottom-color: var(--accent-2);
  animation: spin 6s linear infinite;
}
.gate i:nth-child(2) {
  inset: 6px; border-top-color: var(--accent-2); border-left-color: var(--accent);
  animation-duration: 4s; animation-direction: reverse;
}
.gate b {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  box-shadow: var(--glow-accent); animation: pulse 2.4s ease-in-out infinite;
}

.brand-name { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.brand-cn { font-size: 17px; letter-spacing: 0.3em; font-weight: 600; text-shadow: 0 0 18px var(--line-2); }
.brand-en { font-size: 10.5px; letter-spacing: 0.28em; color: var(--dim-2); }

.nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── 面板（HUD 切角）──────────────────────────────────────── */
.panel {
  position: relative; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 20px;
}
.panel::before, .panel::after {
  content: ''; position: absolute; width: 13px; height: 13px; pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.panel::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--accent-2); border-right: 2px solid var(--accent-2); }

.panel-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; letter-spacing: 0.16em; color: var(--accent);
  margin: 0 0 14px; text-transform: uppercase;
}
.panel-title::before { content: '▸'; color: var(--accent-2); font-size: 12px; }
.panel-title .sub { letter-spacing: 0; color: var(--dim-2); font-size: 12px; text-transform: none; }

/* ── 表单 ─────────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; letter-spacing: 0.08em; }

input {
  width: 100%; padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); font-family: var(--mono); font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
input::placeholder { color: var(--dim-2); }
input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tint-accent), var(--glow-accent);
  background: var(--input-bg-focus);
}

/* ── 按钮 ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
  background: linear-gradient(180deg, var(--btn-accent-a), var(--btn-accent-b));
  border: 1px solid var(--line-2); color: var(--accent);
  text-decoration: none;
  transition: box-shadow 0.18s, background 0.18s, transform 0.08s, border-color 0.18s;
}
.btn:hover { box-shadow: var(--glow-accent); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--dim); border-color: var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-2); box-shadow: none; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; letter-spacing: 0.08em;
  border: 1px solid var(--line); color: var(--dim); background: var(--tint-accent);
  white-space: nowrap;
}
.pill.err { color: var(--err); border-color: var(--err); background: var(--btn-danger-b); }
.pill.ok { color: var(--accent); border-color: var(--accent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: pulse 2s ease-in-out infinite; }

/* ── 认证视图（左：门环 + 标题；右：面板）──────────────────── */
.auth {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 34px; align-items: center;
  padding: 34px 0 10px; min-height: calc(100vh - 210px);
}
.auth-hero { position: relative; padding: 20px 0; }
.auth-ring {
  position: absolute; left: 50%; top: 50%; width: 640px; height: 640px;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; opacity: 0.6;
}
.auth-ring::before, .auth-ring::after { content: ''; position: absolute; border-radius: 50%; }
.auth-ring::before { inset: 0; border: 1px solid var(--ring-1); }
.auth-ring::after { inset: 78px; border: 1px solid var(--ring-2); }
.auth-ring i {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 60%, var(--arc-1) 76%, transparent 88%);
  filter: blur(5px); animation: spin 11s linear infinite;
}
.auth-ring i:nth-child(2) {
  inset: 78px;
  background: conic-gradient(from 180deg, transparent 0 68%, var(--arc-2) 82%, transparent 92%);
  animation-duration: 8s; animation-direction: reverse;
}
.auth-hero h1 {
  position: relative; font-size: 44px; letter-spacing: 0.26em; margin: 0 0 6px;
  color: var(--hero-fg);
  text-shadow: 0 0 32px var(--arc-1), 0 0 70px var(--arc-2);
}
.auth-hero .en { position: relative; font-size: 13px; letter-spacing: 0.42em; color: var(--accent); opacity: 0.85; }
.auth-hero .desc { position: relative; color: var(--dim); margin: 22px 0 20px; max-width: 36ch; font-size: 13px; }
.auth-facts { position: relative; display: grid; gap: 7px; }
.auth-facts div { display: flex; gap: 10px; font-size: 12.5px; color: var(--dim); }
.auth-facts b { color: var(--accent-3); font-weight: 500; min-width: 68px; letter-spacing: 0.1em; }
.auth-facts a { color: var(--accent-3); text-decoration: none; border-bottom: 1px dashed var(--line-2); }

.cursor::after { content: '▏'; color: var(--accent); animation: blink 1.05s step-end infinite; }

.hint { color: var(--dim); font-size: 12.5px; margin: 8px 0; }
.hint.warn { color: var(--warn); }
.hint.err { color: var(--danger-fg); }

/* ── 底部状态条 ───────────────────────────────────────────── */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 8px 18px; font-size: 11.5px; color: var(--dim-2);
  background: var(--surface); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.statusbar .seg { display: flex; align-items: center; gap: 6px; }
.statusbar .k { color: var(--dim-2); letter-spacing: 0.1em; }
.statusbar .v { color: var(--accent-3); }
.statusbar .spacer { margin-left: auto; }
.statusbar button {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  font-family: var(--mono); font-size: 11.5px; padding: 3px 9px; border-radius: 3px; cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
}
.statusbar button:hover { color: var(--accent); border-color: var(--accent); }

/* ── 动画 ─────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.32; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes scan { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }
@keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(40px, 30px, 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes flicker {
  0% { opacity: 0; }
  12% { opacity: 1; } 16% { opacity: 0.35; } 22% { opacity: 1; }
  40% { opacity: 0.7; } 60% { opacity: 1; }
}
.rise { animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rise-2 { animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.06s both; }

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 12px; padding-top: 12px; min-height: 0; }
  .auth-hero { text-align: center; padding: 8px 0; }
  .auth-hero .desc { margin-inline: auto; }
  .auth-facts { justify-items: center; }
  .auth-ring { width: 420px; height: 420px; }
  .auth-ring::after { inset: 52px; }
  .auth-ring i:nth-child(2) { inset: 52px; }
  .auth-hero h1 { font-size: 30px; letter-spacing: 0.18em; }
  .auth-hero .en { letter-spacing: 0.28em; }
  .brand-cn { font-size: 14px; letter-spacing: 0.18em; }
  .brand-en { display: none; }
  .gate { width: 24px; height: 24px; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .wrap { padding: 16px 14px 132px; }
  .panel { padding: 16px 14px; }
  .statusbar { gap: 10px 14px; padding: 7px 14px; }
  .statusbar .spacer { display: none; }
  .statusbar .seg-opt { display: none; }
}

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