/* ==========================================================================
   ai-search-mcp 官网 — 设计系统 v2（大厂级重设计）
   --------------------------------------------------------------------------
   纯 CSS、零依赖、零构建。双主题：暗色默认 / 亮色可切换。
   结构：
     01 设计令牌        02 基础与重置      03 通用组件（按钮/徽章/标签/栅格）
     04 阅读进度条      05 头部导航        06 Hero + 终端 + 统计
     07 引擎跑马灯      08 区块与标题      09 对比表 + 核心能力
     10 工程细节 Bento  11 工作原理 + 架构图  12 四大工具 Tab
     13 代码块          14 引擎矩阵        15 环境变量卡片
     16 Callout / Steps / KV / 错误卡    17 手风琴
     18 文档站布局      19 页脚            20 回顶 / Toast
     21 快速跳转面板    22 入场动画        23 动效与可访问性
   硬性约定：
     - 断点固定 1180 / 980 / 760 / 660 / 520 / 420 + 横屏低矮
     - 可点元素命中区 ≥44px；≤660px 输入控件 font-size:16px
     - 入场隐藏规则只挂 html.reveal-armed（main.js 建立观察器后才加）
     - 固定大尺寸 width 仅允许出现在装饰光斑 .orb-* 上（.hero overflow:hidden）
   ========================================================================== */

/* ============================== 01 设计令牌 ============================== */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas,
    "Liberation Mono", Menlo, monospace;

  --container: 1180px;
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --header-h: 64px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --z-header: 60;
  --z-overlay: 80;
  --z-toast: 90;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #04060d;
  --bg-soft: #070b16;
  --bg-raise: #0a1020;
  --panel: #0b1122;
  --card: #0c1326;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e9eef8;
  --text-2: #a7b2c8;
  --text-3: #6d7992;
  --brand: #4f8cff;
  --brand-2: #22d3ee;
  --brand-ink: #0b1220;
  --brand-soft: rgba(79, 140, 255, 0.14);
  --tint: rgba(79, 140, 255, 0.09);
  --grad: linear-gradient(135deg, #4f8cff 0%, #22d3ee 100%);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --no: #f87171;
  --no-soft: rgba(248, 113, 113, 0.13);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --pink: #f472b6;
  --pink-soft: rgba(244, 114, 182, 0.13);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.13);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.12);
  --indigo: #818cf8;
  --indigo-soft: rgba(129, 140, 248, 0.14);
  --shadow-1: 0 1px 2px rgba(2, 4, 10, 0.5), 0 8px 28px rgba(2, 4, 10, 0.35);
  --shadow-2: 0 2px 6px rgba(2, 4, 10, 0.55), 0 18px 50px rgba(2, 4, 10, 0.5);
  --glow: 0 8px 30px rgba(79, 140, 255, 0.32), 0 2px 8px rgba(34, 211, 238, 0.2);
  --header-bg: rgba(4, 7, 14, 0.72);
  --header-line: rgba(148, 163, 184, 0.12);
  --orb-op: 1;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fc;
  --bg-soft: #edf1f8;
  --bg-raise: #ffffff;
  --panel: #ffffff;
  --card: #ffffff;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #0c1424;
  --text-2: #42506b;
  --text-3: #76839e;
  --brand: #2563eb;
  --brand-2: #0891b2;
  --brand-ink: #ffffff;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --tint: rgba(37, 99, 235, 0.07);
  --grad: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --no: #dc2626;
  --no-soft: rgba(220, 38, 38, 0.09);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --pink: #db2777;
  --pink-soft: rgba(219, 39, 119, 0.1);
  --cyan: #0e7490;
  --cyan-soft: rgba(14, 116, 144, 0.1);
  --orange: #c2410c;
  --orange-soft: rgba(194, 65, 12, 0.1);
  --teal: #0f766e;
  --teal-soft: rgba(15, 118, 110, 0.1);
  --indigo: #4f46e5;
  --indigo-soft: rgba(79, 70, 229, 0.1);
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 2px 6px rgba(15, 23, 42, 0.08), 0 20px 48px rgba(15, 23, 42, 0.14);
  --glow: 0 10px 30px rgba(37, 99, 235, 0.28), 0 2px 8px rgba(8, 145, 178, 0.18);
  --header-bg: rgba(245, 247, 252, 0.8);
  --header-line: rgba(15, 23, 42, 0.08);
  --orb-op: 0.5;
}

/* ============================== 02 基础与重置 ============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  vertical-align: middle;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

button {
  font-family: inherit;
  color: inherit;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

code {
  font-size: 0.88em;
}

:not(pre) > code {
  background: var(--brand-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.42em;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-raise);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  min-height: 20px;
}

::selection {
  background: rgba(79, 140, 255, 0.35);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: calc(var(--z-toast) + 1);
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  transition: top 0.2s var(--ease-out);
}

.skip-link:focus {
  top: 12px;
  text-decoration: none;
}

.muted {
  color: var(--text-3);
}

/* ============================== 03 通用组件 ============================== */
/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out),
    background 0.18s, border-color 0.18s, color 0.18s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 12px 36px rgba(79, 140, 255, 0.42), 0 4px 12px rgba(34, 211, 238, 0.26);
}

.btn-outline {
  background: var(--bg-raise);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: var(--shadow-1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-raise);
}

.btn-sm {
  min-height: 40px;
  padding: 7px 14px;
  font-size: 13.5px;
  border-radius: 10px;
}

.btn-lg {
  min-height: 50px;
  padding: 13px 26px;
  font-size: 15.5px;
  border-radius: 14px;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-blue {
  background: var(--brand-soft);
  border-color: rgba(79, 140, 255, 0.35);
  color: var(--brand);
}

html[data-theme="light"] .badge-blue {
  border-color: rgba(37, 99, 235, 0.3);
}

.badge-green {
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--ok);
}

.badge-cyan {
  background: var(--cyan-soft);
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--cyan);
}

.badge-purple {
  background: var(--violet-soft);
  border-color: rgba(167, 139, 250, 0.35);
  color: var(--violet);
}

.badge-amber {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--warn);
}

/* 小标签（表格内） */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--text-2);
  background: var(--bg-raise);
}

.tag-ok {
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--ok);
}

.tag-no {
  background: var(--no-soft);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--no);
}

.tag-yes {
  background: var(--brand-soft);
  border-color: rgba(79, 140, 255, 0.32);
  color: var(--brand);
}

.tag-key {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warn);
}

.tag-cn {
  background: var(--pink-soft);
  border-color: rgba(244, 114, 182, 0.3);
  color: var(--pink);
}

/* 渐变文字 */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 栅格工具 */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ============================== 04 阅读进度条 ============================== */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: calc(var(--z-header) + 1);
  background: var(--grad);
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.progress.is-visible {
  opacity: 1;
}

/* ============================== 05 头部导航 ============================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.site-header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom-color: var(--header-line);
  box-shadow: 0 6px 24px rgba(2, 4, 10, 0.16);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text);
  letter-spacing: -0.01em;
  min-height: 44px;
}

/* 品牌名不在窄屏 header 内折行（390px 下曾折成两行） */
.brand-text {
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-text em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.16s, background 0.16s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--brand-soft);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

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

.nav-links + .nav-actions {
  margin-left: 0;
}

/* 快速跳转触发按钮（main.js 注入） */
.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.cmdk-trigger:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-raise);
}

.cmdk-trigger kbd {
  display: none;
}

@media (min-width: 981px) {
  .cmdk-trigger kbd {
    display: inline-block;
  }
}

/* 主题切换 */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, transform 0.3s var(--ease-out);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
  transform: rotate(14deg);
}

html[data-theme="dark"] .icon-sun {
  display: none;
}

html[data-theme="light"] .icon-moon {
  display: none;
}

/* 移动端汉堡 */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.24s var(--ease-out), opacity 0.2s;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  display: none;
}

@media (max-width: 980px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    left: 12px;
    right: 12px;
    z-index: calc(var(--z-header) + 1);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-2);
    opacity: 0;
    transform: translateY(-8px) scale(0.99);
    pointer-events: none;
    transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
  }

  .nav-links.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .nav-link {
    min-height: 48px;
    font-size: 15px;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    /* 必须低于 .site-header（60）：遮罩由 JS 追加在 body 末尾，同层级会盖住
       汉堡按钮，导致菜单打开后无法点击 X 关闭（仅能点遮罩/链接） */
    z-index: calc(var(--z-header) - 1);
    background: rgba(2, 4, 10, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
  }

  .nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .nav .btn-gh span.gh-label {
    display: none;
  }

  .nav .btn-gh {
    min-width: 40px;
    padding: 0 12px;
  }
}

/* ============================== 06 Hero ============================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--header-h) + 72px) 0 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 0%, #000 30%, transparent 74%);
  mask-image: radial-gradient(ellipse 78% 62% at 50% 0%, #000 30%, transparent 74%);
  opacity: 0.55;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--orb-op);
  will-change: transform;
}

.orb-1 {
  width: 560px;
  height: 560px;
  top: -180px;
  left: 50%;
  margin-left: -560px;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.34), transparent 68%);
  animation: orb-drift 16s ease-in-out infinite alternate;
}

.orb-2 {
  width: 460px;
  height: 460px;
  top: -60px;
  right: -120px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.26), transparent 68%);
  animation: orb-drift 19s ease-in-out infinite alternate-reverse;
}

.orb-3 {
  width: 380px;
  height: 380px;
  bottom: -180px;
  left: 30%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.18), transparent 68%);
  animation: orb-drift 22s ease-in-out infinite alternate;
}

@keyframes orb-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(34px, 26px, 0) scale(1.08);
  }
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 26px;
}

.hero-title {
  margin: 0 0 20px;
  font-size: clamp(2.15rem, 5.4vw, 3.7rem);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -0.028em;
  max-width: 18em;
}

.hero-sub {
  margin: 0 0 30px;
  max-width: 760px;
  font-size: clamp(1rem, 1.5vw, 1.13rem);
  line-height: 1.85;
  color: var(--text-2);
}

.hero-sub strong {
  color: var(--text);
}

.hero-sub code {
  font-size: 0.92em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 46px;
}

/* 终端（含逐行动画） */
.terminal {
  width: min(860px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #0a0f1e;
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  text-align: left;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  background: #0d1426;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot-r {
  background: #ff5f57;
}

.dot-y {
  background: #febc2e;
}

.dot-g {
  background: #28c840;
}

.terminal-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7d8aa5;
  letter-spacing: 0.04em;
}

.terminal-body {
  padding: 18px 20px 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.term-screen {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
}

.term-line {
  display: block;
  white-space: pre;
  color: #c7d2e8;
}

.term-prompt {
  color: #22d3ee;
  font-weight: 700;
  margin-right: 9px;
}

.term-cmd {
  color: #79c0ff;
}

.term-dim {
  color: #7d8aa5;
}

.term-flag {
  color: #fbbf24;
}

.term-ok {
  color: #34d399;
}

.term-str {
  color: #a5d6ff;
}

.term-num {
  color: #ffa657;
}

.term-key {
  color: #79c0ff;
}

.term-punct {
  color: #8b949e;
}

.term-caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: #22d3ee;
  animation: caret-blink 1s steps(2) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* 终端动画状态：JS 加 .is-armed 后先隐藏，逐行加 .is-on 显示 */
.terminal.is-armed .term-line {
  opacity: 0;
  transform: translateY(4px);
}

.terminal.is-armed .term-line.is-on {
  opacity: 1;
  transform: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

/* 统计 */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: min(860px, 100%);
  margin-top: 40px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.stat-num {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
}

@media (max-width: 660px) {
  .hero {
    padding-top: calc(var(--header-h) + 48px);
  }

  .hero-actions .btn-lg {
    width: min(100%, 340px);
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .terminal-body {
    padding: 14px;
  }

  .term-screen {
    font-size: 11.5px;
  }
}

/* ============================== 07 引擎跑马灯 ============================== */
.belt {
  border-block: 1px solid var(--line);
  background: var(--bg-soft);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  padding: 14px 0;
}

.belt-track {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: belt-scroll 36s linear infinite;
}

.belt:hover .belt-track {
  animation-play-state: paused;
}

@keyframes belt-scroll {
  to {
    transform: translateX(-50%);
  }
}

.belt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.belt-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  font-style: normal;
}

.belt-chip.is-paid i {
  background: var(--warn);
}

.belt-chip b {
  color: var(--text);
  font-weight: 600;
}

.belt-chip small {
  font-family: var(--font-sans);
  color: var(--text-3);
  font-size: 11.5px;
}

/* ============================== 08 区块与标题 ============================== */
.section {
  padding: 88px 0;
}

.section-alt {
  background: var(--bg-soft);
  border-block: 1px solid var(--line);
}

.section-head {
  max-width: 720px;
  margin: 0 auto 46px;
  text-align: center;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(79, 140, 255, 0.32);
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 3.1vw, 2.15rem);
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 1.02rem;
}

.feature-subhead {
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
}

.feature-subhead::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ============================== 09 对比表 + 核心能力 ============================== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table thead th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-soft);
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background 0.16s;
}

.table tbody tr:hover {
  background: var(--tint);
}

.table tr.is-hero-row td {
  background: var(--tint);
}

.compare tr.is-hero-row td strong {
  color: var(--brand);
}

@media (max-width: 760px) {
  .table[data-stack] thead {
    display: none;
  }

  .table[data-stack] {
    display: block;
  }

  .table[data-stack] tbody {
    display: block;
    padding: 12px;
  }

  .table[data-stack] tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-raise);
    padding: 4px 14px;
    margin-bottom: 12px;
  }

  .table[data-stack] tbody tr:last-child {
    margin-bottom: 0;
  }

  .table[data-stack] tbody tr:hover {
    background: var(--bg-raise);
  }

  .table[data-stack] tbody tr.is-hero-row {
    border-color: rgba(79, 140, 255, 0.45);
  }

  .table[data-stack] tbody td {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    text-align: left;
    white-space: normal;
  }

  .table[data-stack] tbody td:last-child {
    border-bottom: 0;
  }

  .table[data-stack] tbody td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
  }

  .table-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
}

/* 核心能力三大卡 */
.feature-grid-hero {
  margin-top: 4px;
}

.feature-card-lg {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.26s var(--ease-out), box-shadow 0.26s, border-color 0.26s;
}

.feature-card-lg::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.26s;
}

.feature-card-lg:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}

.feature-card-lg:hover::before {
  opacity: 1;
}

.feature-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feature-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: 0 0 auto;
}

.ic-blue {
  background: var(--brand-soft);
  color: var(--brand);
}

.ic-cyan {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.ic-purple {
  background: var(--violet-soft);
  color: var(--violet);
}

.ic-green {
  background: var(--ok-soft);
  color: var(--ok);
}

.ic-orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.ic-pink {
  background: var(--pink-soft);
  color: var(--pink);
}

.ic-teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.ic-indigo {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.feature-card-lg h3 {
  margin: 4px 0 0;
  font-size: 1.13rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.feature-card-lg p {
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.75;
}

@media (max-width: 980px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 660px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 64px 0;
  }
}

/* ============================== 10 工程细节 Bento ============================== */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}

.bento-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.26s var(--ease-out), box-shadow 0.26s, border-color 0.26s;
}

.bento-card::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bento-glow, rgba(79, 140, 255, 0.14)), transparent 68%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.bento-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}

.bento-card:hover::after {
  opacity: 1;
}

.bento-card h4 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bento-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-2);
}

.bento-card .feature-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  margin-bottom: 2px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-6 {
  grid-column: span 6;
}

@media (max-width: 980px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }

  .span-2,
  .span-3,
  .span-4,
  .span-6 {
    grid-column: span 2;
  }
}

@media (max-width: 660px) {
  .bento {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .span-2,
  .span-3,
  .span-4,
  .span-6 {
    grid-column: span 1;
  }
}

/* ============================== 11 工作原理 + 架构图 ============================== */
.how-steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
}

.how-step {
  position: relative;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  transition: transform 0.26s var(--ease-out), box-shadow 0.26s;
}

.how-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}

.how-step-num {
  position: absolute;
  top: 18px;
  right: 20px;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--line-strong);
  letter-spacing: -0.02em;
}

.how-step-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.how-step h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  font-weight: 700;
}

.how-step > p {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.72;
}

.how-step-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.how-step-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-3);
}

.how-step-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad);
}

.how-step-arrow {
  align-self: center;
  color: var(--text-3);
  display: inline-flex;
}

/* 架构图 */
.arch {
  margin-top: 46px;
  padding: 30px 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--tint), transparent 70%),
    var(--panel);
  display: grid;
  gap: 16px;
}

.arch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.arch-node {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-raise);
  transition: border-color 0.2s, transform 0.2s var(--ease-out);
}

.arch-node:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.arch-node-icon {
  display: block;
  color: var(--brand);
  margin-bottom: 8px;
}

.arch-node h4 {
  margin: 0 0 3px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.arch-node p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.arch-node.is-accent {
  border-color: rgba(79, 140, 255, 0.4);
  background: var(--brand-soft);
}

.arch-node.is-accent h4 {
  color: var(--brand);
}

.arch-link {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

@media (max-width: 980px) {
  .how-steps {
    grid-template-columns: 1fr;
  }

  .how-step-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }
}

@media (max-width: 660px) {
  .arch {
    padding: 18px 14px;
  }

  .arch-row {
    grid-template-columns: 1fr;
  }
}

/* ============================== 12 四大工具 Tab ============================== */
.tool-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.tool-nav {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.tool-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.tool-nav-item:hover {
  background: var(--tint);
}

.tool-nav-item.is-active {
  background: var(--brand-soft);
  border-color: rgba(79, 140, 255, 0.35);
}

.tool-nav-item > svg {
  flex: 0 0 auto;
  color: var(--text-3);
  transition: color 0.18s;
}

.tool-nav-item.is-active > svg {
  color: var(--brand);
}

.tool-nav-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tool-nav-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.tool-nav-desc {
  font-size: 12px;
  color: var(--text-3);
}

.tool-detail {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  padding: 28px;
}

.tool-detail.is-active {
  animation: panel-in 0.3s var(--ease-out);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tool-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.tool-detail-head h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-detail > p {
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.78;
  margin: 0 0 14px;
}

.tool-block-title {
  margin: 20px 0 10px !important;
  font-size: 12px !important;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3) !important;
}

.tool-points {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.tool-points li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
}

.tool-points li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad);
}

@media (max-width: 980px) {
  .tool-layout {
    /* 必须用 minmax(0, 1fr)：纯 1fr 的 auto 最小值会被面板内代码行的
       min-content 撑破（长 JSON 行比可用宽度宽约 2px → 文档横向溢出） */
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-nav {
    position: static;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 660px) {
  .tool-nav {
    grid-template-columns: 1fr;
  }

  .tool-detail {
    padding: 20px 16px;
  }
}

/* ============================== 13 代码块 ============================== */
.code-block {
  position: relative;
  margin: 14px 0 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-md);
  background: #0a0f1e;
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: #0d1426;
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d8aa5;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #a7b2c8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.copy-btn:hover {
  color: #fff;
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.08);
}

.copy-btn.is-done {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-block code {
  font-size: 13px;
  line-height: 1.75;
  color: #c7d2e8;
  white-space: pre;
}

/* JSON / bash 语法着色（main.js 注入 + 终端静态） */
.tk-key {
  color: #79c0ff;
}

.tk-str {
  color: #a5d6ff;
}

.tk-num {
  color: #ffa657;
}

.tk-bool {
  color: #ff7b72;
}

.tk-punct {
  color: #8b949e;
}

.tk-cmd {
  color: #79c0ff;
}

.tk-dim {
  color: #7d8aa5;
}

.tk-blue {
  color: #79c0ff;
}

.tk-green {
  color: #34d399;
}

.tk-yellow {
  color: #fbbf24;
}

.tk-cyan {
  color: #22d3ee;
}

.tk-arrow {
  color: #f472b6;
}

@media (max-width: 420px) {
  .code-block code {
    font-size: 12px;
  }
}

/* ============================== 14 引擎矩阵 ============================== */
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.seg-btn {
  min-height: 38px;
  padding: 6px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text-3);
  transition: border-color 0.16s, box-shadow 0.16s;
  min-width: min(300px, 100%);
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  min-height: 42px;
}

.search-box input::placeholder {
  color: var(--text-3);
}

.engine-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  font-size: 13.5px;
}

.alias {
  color: var(--text-3);
  font-weight: 400;
  font-size: 12px;
}

#engine-empty {
  margin: 18px 0 0;
}

/* ============================== 15 环境变量卡片 ============================== */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.env-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-1);
  transition: transform 0.22s var(--ease-out), border-color 0.22s, box-shadow 0.22s;
}

.env-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 140, 255, 0.4);
  box-shadow: var(--shadow-2);
}

.env-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.env-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  word-break: break-all;
}

.env-default {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px 8px;
  background: var(--bg-soft);
}

.env-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-2);
}

/* ============================== 16 Callout / Steps / KV / 错误卡 ============================== */
.callout {
  display: flex;
  gap: 12px;
  margin: 18px 0;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--tint);
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-2);
}

.callout > svg {
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--brand);
}

.callout-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.callout-tip {
  border-left-color: var(--ok);
  background: var(--ok-soft);
}

.callout-tip > svg {
  color: var(--ok);
}

.callout-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.callout-warn > svg {
  color: var(--warn);
}

.callout-danger {
  border-left-color: var(--no);
  background: var(--no-soft);
}

.callout-danger > svg {
  color: var(--no);
}

/* 步骤列表（文档页） */
.steps {
  margin: 14px 0 18px;
  padding: 0;
  counter-reset: step;
  list-style: none;
  display: grid;
  gap: 14px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 16px 18px 14px 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  color: var(--brand);
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.steps p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.72;
}

/* KV 列表 */
.kv-list {
  margin: 12px 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.kv-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 14px;
}

.kv-k {
  flex: 0 0 auto;
  min-width: 130px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
  word-break: break-all;
}

.kv-v {
  color: var(--text-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 错误码卡片 */
.err-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0 20px;
}

.err-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--no);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.err-card code {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--no);
  background: none;
  border: 0;
  padding: 0;
}

.err-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.68;
}

@media (max-width: 660px) {
  .err-grid {
    grid-template-columns: 1fr;
  }

  .kv-list li {
    flex-direction: column;
    gap: 4px;
  }
}

/* ============================== 17 手风琴（FAQ） ============================== */
.accordion {
  display: grid;
  gap: 10px;
  margin: 14px 0 24px;
}

.acc-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.2s;
}

.acc-item[open] {
  border-color: rgba(79, 140, 255, 0.4);
}

.acc-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  transition: color 0.16s;
}

.acc-item summary::-webkit-details-marker {
  display: none;
}

.acc-item summary::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.24s var(--ease-out);
}

.acc-item[open] summary::after {
  transform: rotate(225deg);
}

.acc-item summary:hover {
  color: var(--brand);
}

.acc-body {
  padding: 2px 18px 18px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
  animation: acc-in 0.28s var(--ease-out);
}

.acc-body p {
  margin: 8px 0;
}

.acc-body ul,
.acc-body ol {
  margin: 8px 0;
  padding-left: 20px;
}

@keyframes acc-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 参数表 req/opt 徽标 */
.req,
.opt {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

.req {
  background: var(--no-soft);
  color: var(--no);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.opt {
  background: var(--bg-soft);
  color: var(--text-3);
  border: 1px solid var(--line);
}

.table-params td:first-child {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ============================== 18 文档站布局 ============================== */
.docs-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 200px;
  gap: 40px;
  padding-top: calc(var(--header-h) + 36px);
  padding-bottom: 72px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  gap: 22px;
  align-self: start;
}

.docs-group-title {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.docs-nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  border-left: 1px solid var(--line);
}

.docs-nav-link {
  display: block;
  min-height: 40px;
  padding: 9px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  border-radius: 0 9px 9px 0;
  color: var(--text-2);
  font-size: 13.5px;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.docs-nav-link:hover {
  color: var(--text);
  background: var(--tint);
  text-decoration: none;
}

.docs-nav-link.is-active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

#docs-menu-toggle {
  display: none;
}

.docs-main {
  min-width: 0;
}

.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 18px;
}

.docs-breadcrumb a {
  color: var(--text-3);
}

.docs-breadcrumb a:hover {
  color: var(--brand);
  text-decoration: none;
}

.docs-breadcrumb .sep {
  opacity: 0.55;
}

.docs-breadcrumb .crumb-current {
  color: var(--text);
  font-weight: 600;
}

.docs-title {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.25;
}

.docs-lede {
  margin: 0 0 30px;
  font-size: 1.04rem;
  line-height: 1.8;
  color: var(--text-2);
  max-width: 720px;
}

.doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 22px;
}

/* 正文排版 */
.prose {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-2);
}

.prose h2 {
  margin: 44px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -0.016em;
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.prose h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.prose h3 {
  margin: 30px 0 10px;
  font-size: 1.13rem;
  font-weight: 700;
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.prose p {
  margin: 10px 0 14px;
}

.prose ul,
.prose ol {
  margin: 10px 0 16px;
  padding-left: 22px;
}

.prose li {
  margin: 5px 0;
}

.prose li::marker {
  color: var(--text-3);
}

.prose strong {
  color: var(--text);
}

.prose a {
  color: var(--brand);
}

.anchor-link {
  margin-left: 8px;
  color: var(--text-3);
  opacity: 0;
  font-weight: 500;
  transition: opacity 0.16s, color 0.16s;
}

.prose h2:hover .anchor-link,
.prose h3:hover .anchor-link,
.anchor-link:focus-visible {
  opacity: 1;
}

.anchor-link:hover {
  color: var(--brand);
  text-decoration: none;
}

/* 页内目录 */
.docs-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  font-size: 12.5px;
}

.docs-toc-title {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.docs-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--line);
}

.docs-toc-list li a {
  display: block;
  padding: 6px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-3);
  line-height: 1.5;
  border-radius: 0 8px 8px 0;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.docs-toc-list li a:hover {
  color: var(--text);
  text-decoration: none;
}

.docs-toc-list li.lvl-3 a {
  padding-left: 24px;
}

.docs-toc-list li a.is-active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--brand-soft);
}

/* 上一页 / 下一页 */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 46px;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 44px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  transition: border-color 0.2s, transform 0.2s var(--ease-out), box-shadow 0.2s;
}

.pager-link:hover {
  text-decoration: none;
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}

.pager-link.is-next {
  text-align: right;
  grid-column: 2;
}

.pager-link.is-prev {
  grid-column: 1;
}

.pager-link:only-child {
  grid-column: 1 / -1;
}

.pager-dir {
  font-size: 12px;
  color: var(--text-3);
}

.pager-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.pager-link:hover .pager-title {
  color: var(--brand);
}

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 980px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-top: calc(var(--header-h) + 22px);
  }

  #docs-menu-toggle {
    display: inline-flex;
    width: 100%;
  }

  .docs-sidebar {
    position: static;
  }

  .docs-sidebar.is-collapsed {
    display: none;
  }

  .docs-pager {
    grid-template-columns: 1fr;
  }

  .pager-link.is-next,
  .pager-link.is-prev {
    grid-column: 1;
  }
}

/* ============================== 19 页脚 ============================== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 52px 0 0;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 36px;
  padding-bottom: 40px;
}

.footer-brand .brand {
  margin-bottom: 14px;
}

.footer-brand > p {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.75;
  max-width: 340px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 13px;
  color: var(--text-2);
}

.footer-links a:hover {
  color: var(--brand);
}

.footer-col {
  display: grid;
  gap: 2px;
  align-content: start;
}

.footer-col h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  font-size: 13.5px;
  color: var(--text-2);
  width: fit-content;
}

.footer-col a:hover {
  color: var(--brand);
  text-decoration: none;
}

.foot-item {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
  padding: 5px 0;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-3);
}

.footer-bottom a {
  color: var(--text-3);
}

.footer-bottom a:hover {
  color: var(--brand);
}

@media (max-width: 980px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
}

/* ============================== 20 回顶 / Toast ============================== */
.back-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-2);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s var(--ease-out), color 0.16s, border-color 0.16s;
}

.back-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-top:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: calc(var(--z-toast) + 1);
  transform: translate(-50%, 16px);
  padding: 10px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================== 21 快速跳转面板 ============================== */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 16px 16px;
}

.cmdk[hidden] {
  display: none;
}

.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s var(--ease-out);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.cmdk-panel {
  position: relative;
  width: min(600px, 100%);
  max-height: min(460px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
  animation: cmdk-in 0.24s var(--ease-out);
}

@keyframes cmdk-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
  }
}

.cmdk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
}

.cmdk-head input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

.cmdk-head input::placeholder {
  color: var(--text-3);
}

.cmdk-list {
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  cursor: pointer;
}

.cmdk-item svg {
  flex: 0 0 auto;
  color: var(--text-3);
}

.cmdk-item .cmdk-text {
  display: grid;
  min-width: 0;
}

.cmdk-item .cmdk-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk-item .cmdk-hint {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk-item .cmdk-group {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.cmdk-item.is-active {
  background: var(--brand-soft);
}

.cmdk-item.is-active svg {
  color: var(--brand);
}

.cmdk-empty {
  padding: 26px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-3);
}

.cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 11.5px;
  color: var(--text-3);
}

.cmdk-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ============================== 22 入场动画 ============================== */
/* 隐藏规则只挂在 html.reveal-armed 上：main.js 真正建立观察器时才添加，
   保证任何情况下（JS 失效 / 中途抛错）内容始终可见。 */
html.reveal-armed .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}

html.reveal-armed .reveal.is-visible {
  opacity: 1;
  transform: none;
}

html.reveal-armed .stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

html.reveal-armed .stagger.is-visible > * {
  opacity: 1;
  transform: none;
}

html.reveal-armed .stagger.is-visible > *:nth-child(1) {
  transition-delay: 0.02s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(2) {
  transition-delay: 0.09s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(3) {
  transition-delay: 0.16s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(4) {
  transition-delay: 0.23s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(5) {
  transition-delay: 0.3s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(6) {
  transition-delay: 0.37s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(7) {
  transition-delay: 0.44s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(8) {
  transition-delay: 0.51s;
}
html.reveal-armed .stagger.is-visible > *:nth-child(n + 9) {
  transition-delay: 0.58s;
}

/* ============================== 23 动效与可访问性 ============================== */
@media (hover: none) {
  .btn:hover,
  .feature-card-lg:hover,
  .bento-card:hover,
  .how-step:hover,
  .env-card:hover,
  .pager-link:hover,
  .arch-node:hover,
  .theme-toggle:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .belt-track {
    animation: none;
  }

  .orb {
    animation: none;
  }

  .terminal .term-caret {
    animation: none;
  }
}

/* 横屏低矮（手机横屏） */
@media (max-height: 520px) and (orientation: landscape) {
  .hero {
    padding-top: calc(var(--header-h) + 28px);
    padding-bottom: 36px;
  }

  .section {
    padding: 44px 0;
  }

  .docs-sidebar,
  .docs-toc {
    max-height: calc(100vh - var(--header-h) - 24px);
    overflow-y: auto;
  }

  .cmdk {
    padding-top: 8vh;
  }
}

/* 窄屏微调 */
@media (max-width: 660px) {
  .container {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }

  /* 输入控件统一 16px，防 iOS Safari 聚焦时自动放大页面 */
  .search-box input,
  .cmdk-head input {
    font-size: 16px;
  }

  .orb {
    filter: blur(70px);
  }

  .hero-bg::before {
    background-size: 32px 32px;
  }

  .tool-nav-item,
  .seg-btn,
  .nav-link {
    min-height: 48px;
  }
}

@media (max-width: 520px) {
  .section-head {
    margin-bottom: 34px;
  }

  .table-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .table-tools .seg {
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
  }
}
