/* ===== 设计变量 ===== */
:root {
  --bg: #0b0f17;
  --bg-elevated: #131a26;
  --bg-card: #18212f;
  --border: #243140;
  --text: #e8eef6;
  --text-muted: #9fb0c3;
  --text-dim: #6b7d92;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1100px;
  --nav-h: 68px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    Menlo, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(129, 140, 248, 0.12), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(56, 189, 248, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: #7dd3fc;
}

/* ===== 顶部导航 ===== */
#nav_div {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgba(11, 15, 23, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

#nav_div .nav_logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
}

#nav_title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#nav_contact_info {
  margin-left: auto;
  display: flex;
  gap: 22px;
  font-size: 13px;
  color: var(--text-muted);
}
#nav_contact_info a,
#nav_contact_info span {
  color: var(--text-muted);
}
#nav_contact_info a:hover {
  color: var(--accent);
}

/* ===== 页面容器 ===== */
#external_div {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 0;
}

.page {
  padding: 64px 0 80px;
  min-height: calc(100vh - var(--nav-h) - 160px);
}

/* ===== 章节标题 ===== */
#body_chapter {
  margin: 56px 0 22px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}
#body_chapter::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.lead {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.9;
}
.lead .en {
  color: var(--text-dim);
  font-size: 14px;
}

/* ===== 功能卡片 ===== */
.func-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 8px 0 8px;
}
.func-grid.second {
  grid-template-columns: repeat(3, 1fr);
  max-width: 560px;
}
.body_function_div {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  font-size: 15px;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.body_function_div:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px -12px var(--accent-glow);
}

/* ===== 图片 ===== */
.shot {
  margin: 12px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== 接口文档 ===== */
[id^="api-"] {
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

/* 左侧悬浮目录 */
.api-toc {
  position: fixed;
  top: calc(var(--nav-h) + 24px);
  left: 24px;
  z-index: 40;
  width: 188px;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  background: rgba(19, 26, 38, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.api-toc a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: all 0.16s ease;
}
.api-toc a:hover {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  border-left-color: var(--accent);
}
.api-toc-title {
  font-family: var(--font) !important;
  font-weight: 600;
  font-size: 13px;
  color: var(--text) !important;
  padding: 4px 12px 8px !important;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}
/* 桌面端为正文让出左侧空间 */
#external_div {
  padding-left: 228px;
}

.api-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 18px 0;
}
.body_function_name {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.body_function_description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}

.body_function_interface_table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.body_function_interface_table th,
.body_function_interface_table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.body_function_interface_table thead th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}
.body_function_interface_table tbody tr:last-child td {
  border-bottom: none;
}
.body_function_interface_table tbody tr:hover {
  background: rgba(56, 189, 248, 0.05);
}
.body_function_interface_table code,
.ret {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
}
.ret {
  margin-top: 8px;
  display: block;
  color: var(--text-dim);
  font-size: 13px;
}

.api-badge {
  margin-top: 18px;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 999px;
  padding: 3px 12px;
}
.err-list {
  list-style: none;
  margin: 12px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.err-list li {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.err-code {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 10px;
}

.pipeline {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: inline-block;
}
.pipeline .arrow {
  color: var(--accent);
  margin: 0 8px;
}

/* ===== 首页 Hero ===== */
.hero {
  text-align: center;
  padding: 90px 0 70px;
}
.hero h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, #fff 10%, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 16px;
}
.hero .en {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 6px;
}
.hero-qq {
  margin-top: 22px;
  text-align: right;
  font-size: 14px;
  color: var(--text-muted);
}
.hero-qq a {
  color: var(--accent);
}

/* ===== 404 ===== */
.notfound {
  text-align: center;
  padding: 120px 0;
}
.notfound .code {
  font-size: 120px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.notfound p {
  margin-top: 18px;
  font-size: 18px;
  color: var(--text-muted);
}
.notfound .en {
  color: var(--text-dim);
  font-size: 14px;
}

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 22px 24px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.site-footer .sep {
  margin: 0 8px;
  opacity: 0.5;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  /* 窄屏取消左侧悬浮目录，改为内联块 */
  #external_div {
    padding-left: 24px;
  }
  .api-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    max-height: none;
    overflow: visible;
    margin: 14px 0 26px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .api-toc a {
    border-left: none;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 5px 13px;
  }
  .api-toc a:hover {
    color: #06121f;
    background: var(--accent);
    transform: translateY(-2px);
  }
  .api-toc-title {
    border-bottom: none;
    width: 100%;
  }
}

@media (max-width: 860px) {
  .func-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .func-grid.second {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
  }
  .hero h1 {
    font-size: 30px;
  }
  #nav_contact_info {
    display: none;
  }
}

@media (max-width: 520px) {
  .func-grid,
  .func-grid.second {
    grid-template-columns: 1fr;
  }
  #nav_title {
    font-size: 16px;
  }
  #external_div {
    padding: 0 16px;
  }
}

/* ===== RPA 宣传页 ===== */
/* 覆盖 km 页为左侧目录预留的 228px 左边距 */
.rpa#external_div {
  padding-left: 24px;
  max-width: 980px;
}

.edition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 18px 0 8px;
}
.edition-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.edition-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 36px -16px var(--accent-glow);
}
.edition-card.edition-core {
  border-color: var(--accent-2);
  background: linear-gradient(
    160deg,
    rgba(129, 140, 248, 0.12),
    var(--bg-card) 55%
  );
}
.edition-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}
.edition-tag-core {
  color: #c7d2fe;
  background: rgba(129, 140, 248, 0.16);
  border-color: rgba(129, 140, 248, 0.4);
}
.edition-name {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}
.edition-desc {
  margin: 10px 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}
.edition-feats {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.edition-feats li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  color: var(--text-muted);
}
.edition-feats li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}
.edition-core .edition-feats li::before {
  color: var(--accent-2);
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 6px 0 4px;
}

.qq-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 16px 0 4px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
}
.qq-label {
  font-size: 14px;
  color: var(--text-muted);
}
.qq-number {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}
.qq-link {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: #06121f;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  padding: 8px 18px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.qq-link:hover {
  color: #06121f;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px var(--accent-glow);
}

@media (max-width: 680px) {
  .edition-grid,
  .shot-grid {
    grid-template-columns: 1fr;
  }
  .qq-link {
    margin-left: 0;
  }
}
