/* SZDAPI 统一身份服务 —— 登录/注册界面
 * 设计基线：SZDAPI_UIUX_Skill_Audit.md §3.1/3.3（电影级深空底 + 白色表单卡）
 * 纪律：品牌蓝系、6/12 两级圆角、AA 对比度、44px 触控目标、reduced-motion
 */

@font-face {
  font-family: 'InterVariable';
  src: url('/assets/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 品牌 —— 收自主站 site.css 实测值（UIUX 审计 §3.1） */
  --brand-300: #9cd5ff;
  --brand-400: #7db9ff;   /* 暗底 focus ring / 装饰 */
  --brand-500: #49a9fc;   /* logo 主笔 / 暗底强调 */
  --brand-600: #1668c8;   /* 白卡上的按钮/链接/focus（白底对比度 5.4:1，AA） */
  --brand-700: #125cb3;

  /* 暗色层级 —— 主站同源 */
  --bg-hero:   #061522;
  --bg-elev-1: #0e1d2b;
  --bg-deep:   #08131d;

  /* 白卡 */
  --card:      #ffffff;
  --ink:       #0a1929;
  --dim-strong:#5d7080;   /* 白底次级文字 4.6:1（替代不达标的 #6d7c87） */
  --line:      #dbe3ea;
  --field-bg:  #f7f9fb;

  /* 状态 */
  --error:      #dc2626;
  --error-bg:   #fef2f2;
  --error-line: #fecaca;
  --ok:         #15803d;

  /* 形状 / 字体 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --sans: "InterVariable", "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 900px 520px at 18% -8%, rgba(73, 169, 252, 0.13), transparent 60%),
    radial-gradient(ellipse 700px 420px at 88% 108%, rgba(73, 169, 252, 0.07), transparent 55%),
    var(--bg-hero);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 40px);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #eaf3fb;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
}
.logo__mark {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}
.logo__dot { color: var(--brand-400); }
.topbar__back {
  color: #86a3bd;
  text-decoration: none;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: color .18s ease, background-color .18s ease;
}
.topbar__back:hover { color: #cfe4f7; background: rgba(73,169,252,.12); }
.topbar__back:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }

/* ===== 主区 ===== */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 56px;
}

.card {
  width: min(440px, 100%);
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 38px 36px 32px;
  box-shadow: 0 24px 64px rgba(2, 10, 18, 0.55), 0 2px 8px rgba(2, 10, 18, 0.35);
}
@media (max-width: 480px) {
  .card { padding: 28px 22px 24px; }
}

.card__kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: 10px;
}
.card__title {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.card__sub {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--dim-strong);
}

/* ===== 错误摘要（焦点容器） ===== */
.error-summary {
  display: none;
  margin: 20px 0 4px;
  padding: 12px 14px;
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 13.5px;
  line-height: 1.55;
}
.error-summary.is-visible { display: block; }
.error-summary a { color: var(--error); font-weight: 600; text-decoration: underline; }

/* ===== 表单 ===== */
.form { margin-top: 22px; }

.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}
.field__label .optional { color: var(--dim-strong); font-weight: 400; }

.field__control { position: relative; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.input::placeholder { color: #9aa9b6; }
.input:hover { border-color: #c2ceda; }
.input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 2px rgba(22, 104, 200, 0.28);
}
.input[aria-invalid="true"] { border-color: var(--error); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22); }

/* 有尾部按钮（密码可见性）时右侧留白 */
.field__control .input { padding-right: 48px; }

.field__hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--dim-strong);
  line-height: 1.5;
}
.field__error {
  display: none;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--error);
  line-height: 1.5;
}
.field__error.is-visible { display: block; }

/* 密码可见性切换 */
.eye-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--dim-strong);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.eye-btn:hover { color: var(--ink); background: #eef2f6; }
.eye-btn:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.eye-btn svg { width: 19px; height: 19px; }
.eye-btn .i-eye-off { display: none; }
.eye-btn[aria-pressed="true"] .i-eye { display: none; }
.eye-btn[aria-pressed="true"] .i-eye-off { display: block; }

/* ===== 主按钮 ===== */
.btn-primary {
  width: 100%;
  height: 46px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--brand-600);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .18s ease, transform .12s ease;
}
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.btn-primary[disabled] { opacity: .62; cursor: not-allowed; transform: none; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.btn-primary.is-loading .spinner { display: inline-block; }
.btn-primary.is-loading .btn-primary__label { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 卡内切换链接 ===== */
.switch-line {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eef2f6;
  font-size: 13.5px;
  color: var(--dim-strong);
  text-align: center;
}
.switch-line a {
  color: var(--brand-600);
  font-weight: 600;
  text-decoration: none;
}
.switch-line a:hover { text-decoration: underline; }
.switch-line a:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; border-radius: 3px; }

/* ===== 已登录面板（index） ===== */
.session-rows { margin-top: 22px; border-top: 1px solid #eef2f6; }
.session-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f6;
  font-size: 14px;
}
.session-row dt { color: var(--dim-strong); flex-shrink: 0; }
.session-row dd { color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere; }

/* 登出按钮与信息面板的间距（原为 inline style，CSP style-src 'self' 禁止内联样式） */
.logout-btn { margin-top: 24px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(73, 169, 252, 0.14);
  color: var(--brand-600);
}
.badge--admin { background: #fef3c7; color: #92400e; }

/* ===== 页脚 ===== */
.footer {
  padding: 18px 20px 26px;
  text-align: center;
  font-size: 12.5px;
  color: #698396; /* 暗底 4.7:1 */
}
.footer a { color: #86a3bd; text-decoration: none; }
.footer a:hover { color: #cfe4f7; text-decoration: underline; }
.footer a:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; border-radius: 3px; }

/* ===== 动效弱化 ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}
