/* =============================================================================
   yizhan-api · 基础样式
   重置 + 排版 + 通用组件（按钮 / 输入 / 卡片 / 胶囊 / 提示）
   所有颜色取自 tokens.css，不在这里写死色值。
   ============================================================================= */

/* ── 重置 ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--dur-mid) var(--ease),
              color var(--dur-mid) var(--ease);
}

/* 极淡的光晕，让纯色底不呆板（只加在 ::before，不挡点击） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 460px at 82% -12%, var(--glow-1) 0%, transparent 68%),
    radial-gradient(700px 340px at 4% 0%, var(--glow-2) 0%, transparent 72%);
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--primary); }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; border: 0; background: none; }

code, pre, .mono { font-family: var(--mono); }

::selection { background: var(--primary-soft); color: var(--primary-hi); }

/* 键盘可达性：只在键盘导航时显示焦点环 */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── 布局容器 ─────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  .wrap { padding: 0 20px; }
}

/* ── 顶栏 ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.topbar.is-stuck {
  border-bottom-color: var(--line);
  background: var(--topbar-bg-solid);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 40px;
}

/* ── 品牌 ─────────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  flex: none;
}

.brand__sub {
  color: var(--text-3);
  font-weight: 400;
  font-size: 12.5px;
  margin-left: 2px;
}

/* ── 导航 ─────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.nav a {
  padding: 7px 11px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.nav a:hover { background: var(--card-3); color: var(--text); }

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .nav, .brand__sub { display: none; }
}

/* ── 主题切换按钮 ─────────────────────────────────────── */
.theme-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.theme-btn:hover { background: var(--card-3); color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }

/* 三档图标：跟随系统的显示"半明半暗"，其余按当前模式 */
.theme-btn .ico-sun, .theme-btn .ico-moon, .theme-btn .ico-auto { display: none; }
html[data-theme-mode="light"] .theme-btn .ico-sun  { display: block; }
html[data-theme-mode="dark"]  .theme-btn .ico-moon { display: block; }
html[data-theme-mode="auto"]  .theme-btn .ico-auto { display: block; }

/* 锚点容器 */
.theme-switch { position: relative; display: inline-flex; }

/* 浮动版（登录 / 注册页右上角） */
.theme-fab-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
}
.theme-fab {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.theme-fab:hover { color: var(--text); background: var(--card-3); }
.theme-fab svg { width: 16px; height: 16px; }
.theme-fab .ico-sun, .theme-fab .ico-moon, .theme-fab .ico-auto { display: none; }
html[data-theme-mode="light"] .theme-fab .ico-sun  { display: block; }
html[data-theme-mode="dark"]  .theme-fab .ico-moon { display: block; }
html[data-theme-mode="auto"]  .theme-fab .ico-auto { display: block; }

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
/* ⚠️ a:hover 的优先级是 (0,1,1)，比 .btn 的 (0,1,0) 高，
   会把按钮文字改成主色蓝 —— 在蓝色按钮上就是"字消失了"。
   所以这里显式把颜色钉回 --btn-fg，并用 a.btn 再抬一级。 */
.btn:hover,
a.btn:hover,
.btn:focus-visible {
  color: var(--btn-fg);
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--primary-on);
  --btn-bd: var(--primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, .28),
              0 10px 24px -14px rgba(37, 99, 235, .85);
}
.btn--primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }

.btn--ghost { --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn--ghost:hover { --btn-fg: var(--text); background: var(--card-3); }

.btn--block { width: 100%; height: 42px; font-size: 14px; }

.btn__arrow { transition: transform var(--dur-fast) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(2px); }

/* 下划线按钮（了解更多） */
.link-underline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 2px;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.link-underline:hover { color: var(--primary); border-color: var(--primary-line); }

/* ── 卡片 ─────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ── 胶囊标签 ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  flex: none;
}

/* ── 表单 ─────────────────────────────────────────────── */
.field { display: grid; gap: 7px; }

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}

.field__row { display: flex; gap: 8px; }
.field__row > .input { flex: 1; min-width: 0; }

.input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--card);
  font-size: 14px;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--line-hover); }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input--code {
  font-family: var(--mono);
  letter-spacing: .14em;
  text-align: center;
  font-size: 15px;
}
/* 占位符不要跟着拉宽，否则「6位数字」会变成散开的字 */
.input--code::placeholder {
  letter-spacing: .02em;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-3);
}
.input--mono { font-family: var(--mono); letter-spacing: .06em; }

/* 校验状态 */
.field.is-ok .input  { border-color: var(--ok-line); }
.field.is-bad .input { border-color: var(--fail-line); background: var(--fail-soft); }

.hint {
  font-size: 12px;
  color: var(--text-3);
  min-height: 17px;
  transition: color var(--dur-fast) var(--ease);
}
.hint.is-ok  { color: var(--ok); }
.hint.is-bad { color: var(--fail); }
.hint.is-warn{ color: var(--warn); }

/* 获取验证码按钮（贴输入框） */
.btn-code {
  flex: none;
  min-width: 104px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--card-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn-code:hover:not(:disabled) { background: var(--card-3); color: var(--text); }
.btn-code:disabled { opacity: .55; cursor: not-allowed; }

/* ── 提示条 ───────────────────────────────────────────── */
.alert {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.55;
  border: 1px solid transparent;
}
.alert--info {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-hi);
}
.alert--warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn-fg);
}
.alert--fail {
  background: var(--fail-soft);
  border-color: var(--fail-line);
  color: var(--fail-fg);
}
.alert--ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok-fg);
}

/* ── Toast ────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--toast-bg);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .55);
  animation: toast-in .22s var(--ease) both;
}
.toast--ok   { background: var(--ok); color: #062e14; font-weight: 500; }
.toast--fail { background: var(--fail); color: #3b0808; font-weight: 500; }
.toast.is-out { animation: toast-out .18s var(--ease) both; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ── 工具类 ───────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.center { text-align: center; }
[hidden] { display: none !important; }
/* ── 主题菜单（三档）──────────────────────────────────── */
.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 168px;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}

.theme-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.theme-menu__item:hover { background: var(--card-3); color: var(--text); }
.theme-menu__item.is-on { color: var(--primary); }

.theme-menu__ico { display: grid; place-items: center; width: 16px; height: 16px; }
.theme-menu__ico svg { width: 15px; height: 15px; }
.theme-menu__label { flex: 1; }

.theme-menu__check {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.theme-menu__item.is-on .theme-menu__check { opacity: 1; }

/* 禁用态：统一成灰底灰字，别让半透明的蓝看起来还能点 */
.btn[disabled],
.btn:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: var(--card-3);
  color: var(--text-3);
  border-color: var(--line-2);
  box-shadow: none;
}
.btn--primary[disabled],
.btn--primary:disabled {
  background: var(--card-3);
  color: var(--text-3);
  border: 1px solid var(--line-2);
}

/* ── 新版本提示条 ─────────────────────────────────────
   部署替换文件后出现，用户自己决定什么时候刷新。 */
.updatebar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, #0f172a 92%, transparent);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 12px 30px -12px rgba(15, 23, 42, .55);
  animation: updatebar-in .28s var(--ease);
}

@keyframes updatebar-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.updatebar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
}

.updatebar__text { white-space: nowrap; }

.updatebar__btn {
  height: 28px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 0;
  background: #fff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.updatebar__btn:hover { background: #e2e8f0; }

@media (max-width: 520px) {
  .updatebar { left: 12px; right: 12px; transform: none; justify-content: space-between; }
  @keyframes updatebar-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}



/* deploy-sim */

/* ── 侧边栏品牌：头像 + 名称 + 版本徽标 ─────────────────── */
.side__brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  /* 左侧对齐导航项文字（.nav a 的 padding-left 是 11px） */
  padding: 1px 0 1px 11px;
  text-decoration: none;
  min-width: 0;
}
.brand__logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  flex: none;
  /* 一圈极细内描边，浅色背景下轮廓更清楚 */
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .07), 0 2px 6px -2px rgba(15, 23, 42, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}
.side__brand:hover .brand__logo {
  transform: scale(1.04);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .1), 0 4px 10px -3px rgba(15, 23, 42, .34);
}
.brand__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  /* 让名称的首行与头像顶部视觉对齐，而不是整体居中 */
  padding-top: 3px;
  line-height: 1;
}
.brand__meta .side__brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.008em;
  color: var(--text-1);
  /* 中英混排时字母间距略紧，避免显得松散 */
  font-feature-settings: "kern" 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__ver {
  align-self: flex-start;
  max-width: 100%;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .015em;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* 侧栏收窄时整段隐藏日期，不留半截字 */
@media (max-width: 1180px) {
  .brand__ver .ver__date { display: none; }
}
