/* ============================================================
   iStats 介绍页 / 使用说明（独立静态页）
   这两页要被搜索引擎直接抓，所以样式自成一体：不依赖控制台的
   app.css，也不依赖任何 JS 才有内容。变量沿用控制台那套配色。
   ============================================================ */

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E6E8EE;
  --border-strong: #D6DAE3;
  --text: #14161A;
  --text-2: #4A5160;
  --muted: #7A8291;
  --faint: #9AA1AE;

  --primary: #3B5BDB;
  --primary-hover: #2F4AC4;
  --primary-soft: #EEF1FD;

  --green: #0CA678;
  --green-soft: #E6F7F1;
  --red: #E03131;
  --amber: #E8890C;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .04);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* sticky 顶栏 62px，锚点跳转别被它压住 */
  scroll-padding-top: 78px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 460px at 50% -160px, #EDF1FE 0%, rgba(237, 241, 254, 0) 70%),
    var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, dt, ul, ol, figure, pre { margin: 0; }
button { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); }
svg { display: block; }

/* ---------------- 顶栏 ---------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  background: rgba(255, 255, 255, .84);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
}
.brand__mark { color: var(--primary); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.brand__text em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .02em;
}

.top__nav { display: flex; align-items: center; gap: 6px; }

.top__link {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
.top__link:hover { color: var(--text); background: var(--surface-2); }
.top__link.is-current {
  color: var(--primary);
  background: var(--surface-2);
  font-weight: 600;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn--ghost:hover { border-color: var(--faint); color: var(--text); }
.btn--lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: 9px; }
.top__nav .btn { margin-left: 4px; }

/* ---------------- 版心 ---------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 72px; }

/* ---------------- Hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  gap: 56px;
  align-items: center;
  padding: 76px 0 84px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  padding: 5px 11px 5px 9px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
}
.tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .14);
}

.h1 {
  font-size: clamp(31px, 4.1vw, 46px);
  font-weight: 680;
  line-height: 1.16;
  letter-spacing: -.025em;
  color: var(--text);
}

.lead {
  margin-top: 18px;
  max-width: 44ch;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-2);
}

.actions { display: flex; align-items: center; gap: 10px; margin-top: 28px; }

.hint { margin-top: 16px; font-size: 12.5px; color: var(--faint); }

/* ---------------- 迷你控制台预览（纯装饰） ---------------- */
.preview { position: relative; }

.preview__inner {
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .04);
}

.preview__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.preview__dots { display: flex; gap: 4px; }
.preview__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.preview__title { font-size: 11.5px; color: var(--muted); letter-spacing: .01em; }

.preview__kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 12px;
}
.kpi {
  padding: 10px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.kpi em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
.kpi b {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.kpi i { display: block; margin-top: 2px; font-style: normal; font-size: 10.5px; color: var(--green); }

.preview__chart { display: block; width: 100%; height: 92px; margin-bottom: 12px; }

.preview__rows { margin: 0; padding: 0; list-style: none; }
.preview__rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 2px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.preview__rows span { font-family: var(--mono); color: var(--text-2); }
.preview__rows b { color: var(--text); font-variant-numeric: tabular-nums; }

.preview__badge {
  position: absolute;
  right: -10px;
  bottom: -16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
}

/* ---------------- 小节 ---------------- */
.sec { padding: 56px 0; border-top: 1px solid var(--border); }
.sec__head { max-width: 620px; margin-bottom: 30px; }

.h2 {
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -.015em;
  color: var(--text);
}
.sec__sub { margin-top: 9px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }

/* ---------------- 能力卡片 ---------------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.card {
  padding: 20px 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.card__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
}
.card h3 { font-size: 14.5px; font-weight: 620; letter-spacing: -.005em; }
.card p { margin-top: 7px; font-size: 12.8px; line-height: 1.68; color: var(--text-2); }

/* ---------------- 接入步骤 ---------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  padding: 16px 18px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: step;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--primary);
  letter-spacing: .04em;
}
.steps b { display: block; font-size: 13.5px; font-weight: 620; }
.steps span { display: block; margin-top: 5px; font-size: 12.3px; line-height: 1.6; color: var(--muted); }

/* 代码块前的端名小标题 */
.code__label {
  margin: 26px 0 12px;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.005em;
  color: var(--text);
}

/* ---------------- 代码块 ---------------- */
.code {
  background: #14161A;
  border-radius: var(--radius);
  overflow: hidden;
}
.code__head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
  color: rgba(255, 255, 255, .55);
}
.code__head b { font-weight: 500; color: rgba(255, 255, 255, .8); }
.code pre {
  margin: 0;
  padding: 18px 20px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.6px;
  line-height: 1.85;
  color: #E4E7EE;
  tab-size: 2;
}
.code code { font: inherit; white-space: pre; }
.code .k { color: #8AB4FF; }
.code .a { color: #C7B3FF; }
.code .s { color: #9BE3B8; }
.code .c { color: rgba(255, 255, 255, .38); }
.code__foot {
  padding: 0 20px 18px;
  font-size: 12px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .45);
}
.code__foot code { font-family: var(--mono); font-size: 11.6px; color: rgba(255, 255, 255, .7); }

/* ---------------- 口径 / 安全 ---------------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 40px;
  align-items: start;
}
.panel .h2 { margin-bottom: 20px; }

.facts { margin: 0; }
.facts > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { font-size: 12.5px; font-weight: 600; color: var(--text); }
.facts dd { margin: 0; font-size: 12.8px; line-height: 1.7; color: var(--text-2); }
.facts code, .card code, .doc code.inline {
  font-family: var(--mono);
  font-size: 11.8px;
  padding: 1px 4px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.panel--secure {
  padding: 22px 22px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel--secure .h2 { font-size: 17px; margin-bottom: 14px; }

.secure { margin: 0; padding: 0; list-style: none; }
.secure li { padding: 10px 0; border-top: 1px solid var(--border); }
.secure li:first-child { border-top: 0; padding-top: 0; }
.secure b { display: block; font-size: 12.6px; font-weight: 620; color: var(--text); }
.secure span { display: block; margin-top: 4px; font-size: 12.2px; line-height: 1.62; color: var(--muted); }

/* ---------------- 页脚 ---------------- */
.foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 30px 0 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--faint);
}
.foot a { color: var(--faint); text-decoration: none; }
.foot a:hover { color: var(--primary); }
.foot__sep { width: 1px; height: 11px; background: var(--border-strong); }

/* ============================================================
   使用说明页（/usage.html）：两栏目录 + 正文
   ============================================================ */

.doc-head {
  padding: 56px 0 34px;
  border-bottom: 1px solid var(--border);
}
.doc-head h1 {
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 680;
  letter-spacing: -.02em;
  line-height: 1.22;
}
.doc-head p {
  margin-top: 12px;
  max-width: 62ch;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.doc-meta span {
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.doc-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 48px;
  padding: 34px 0 40px;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 86px;
  font-size: 12.8px;
}
.doc-toc__title {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.doc-toc li { counter-increment: toc; }
.doc-toc a {
  display: block;
  padding: 6px 10px 6px 30px;
  position: relative;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 6px;
  line-height: 1.45;
}
.doc-toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}
.doc-toc a:hover { color: var(--primary); background: var(--primary-soft); }

.doc { min-width: 0; }

.doc section { padding: 26px 0 8px; border-top: 1px solid var(--border); }
.doc section:first-child { border-top: 0; padding-top: 0; }

.doc h2 {
  font-size: 19px;
  font-weight: 660;
  letter-spacing: -.012em;
  margin-bottom: 12px;
  scroll-margin-top: 84px;
}
.doc h3 {
  font-size: 14px;
  font-weight: 620;
  margin: 22px 0 8px;
  color: var(--text);
}
.doc p { margin: 10px 0; font-size: 13.4px; line-height: 1.78; color: var(--text-2); }
.doc ul, .doc ol.doclist { margin: 10px 0; padding-left: 20px; }
.doc li { margin: 6px 0; font-size: 13.4px; line-height: 1.75; color: var(--text-2); }
.doc li b, .doc p b { color: var(--text); font-weight: 620; }

.doc pre {
  margin: 12px 0;
  padding: 15px 17px;
  overflow-x: auto;
  background: #14161A;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.4px;
  line-height: 1.8;
  color: #E4E7EE;
  tab-size: 2;
}
.doc pre code { font: inherit; white-space: pre; }

.doc .note {
  margin: 14px 0;
  padding: 12px 15px;
  font-size: 12.8px;
  line-height: 1.72;
  color: var(--text-2);
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.doc .note--warn { background: #FDF6EA; border-left-color: var(--amber); }

.doc table {
  width: 100%;
  margin: 14px 0;
  border-collapse: collapse;
  font-size: 12.8px;
}
.doc th, .doc td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.doc th { font-weight: 600; color: var(--text); background: var(--surface-2); }
.doc td code, .doc th code { font-family: var(--mono); font-size: 11.8px; }

/* ---------------- 窄屏 ---------------- */
@media (max-width: 980px) {
  .top { padding: 0 18px; }
  .top__link { display: none; }
  .wrap { padding: 0 18px 56px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 44px 0 52px; }
  .lead { max-width: none; }
  .preview__badge { right: 8px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .facts > div { grid-template-columns: 84px minmax(0, 1fr); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .doc-toc { position: static; }
  .doc-toc ol { display: flex; flex-wrap: wrap; gap: 4px; }
  .doc-toc a { padding: 5px 9px; }
  .doc-toc a::before { display: none; }
}

@media (max-width: 640px) {
  .top { height: 56px; }
  .brand__text em { display: none; }
  .top__nav .btn--ghost { display: none; }
  .top__nav .top__link { display: none; }
  .h1 { font-size: 28px; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 140px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .code pre { padding: 14px 14px 16px; font-size: 11.8px; }
  .code__foot { padding: 0 14px 14px; }
  .doc pre { font-size: 11.6px; }
  .doc table { font-size: 12px; }
  .doc th, .doc td { padding: 7px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
