/* YDATA AI 使用文档站样式：与新版蓝白薰衣草首页保持同一视觉系统 */
:root {
  color-scheme: light;
  --bg: #f7f8ff;
  --surface: #ffffff;
  --surface-soft: #f5f6fe;
  --ink: #151633;
  --ink2: #4c506b;
  --ink3: #686d8a;
  --blue: #3354f4;
  --blue-hover: #2443d9;
  --blue-soft: #e9efff;
  --lav: #ece8ff;
  --lav-strong: #ded7ff;
  --lav-ink: #4b39c6;
  --yellow: #f6c750;
  --yellow-soft: #fff3cc;
  --yellow-ink: #734c00;
  --line: #e4e7f6;
  --line-strong: #cfd5ee;
  --shadow-sm: 0 10px 26px -16px rgba(34, 48, 128, .20);
  --shadow-md: 0 24px 60px -28px rgba(37, 52, 138, .20);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(720px 480px at 90% 4%, rgba(193, 181, 255, .30), transparent 68%),
    radial-gradient(600px 440px at 4% 12%, rgba(191, 212, 255, .26), transparent 68%),
    var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
button, input { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(51, 84, 244, .45); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.copy-fallback { position: fixed; left: -9999px; top: 0; }
.icon {
  display: inline-block; flex: none; width: 17px; height: 17px;
  vertical-align: middle; fill: none; stroke: currentColor;
  stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}

/* 顶部导航栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 248, 255, .86);
  border-bottom: 1px solid rgba(228, 231, 246, .9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.nav-inner {
  width: min(100%, 1380px); height: 72px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; flex: none;
  color: var(--ink); white-space: nowrap;
}
.brand-mark { width: 32px; height: 32px; display: block; filter: drop-shadow(0 6px 12px rgba(51, 84, 244, .30)); }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-name b { color: var(--blue); }
.brand-badge {
  margin-left: 2px; padding: 3px 9px; border-radius: 999px;
  background: var(--lav); color: var(--lav-ink);
  font-size: 11.5px; font-weight: 700;
}

.doc-search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; max-width: 420px;
  margin-left: auto; padding: 6px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.doc-search:focus-within { border-color: rgba(51, 84, 244, .55); box-shadow: 0 0 0 3px rgba(51, 84, 244, .12); }
.doc-search .icon { color: var(--ink3); width: 16px; height: 16px; }
.doc-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13.5px; color: var(--ink); }
.doc-search input::placeholder { color: var(--ink3); }
.search-count { font-size: 11.5px; color: var(--lav-ink); font-weight: 650; white-space: nowrap; }
.search-clear {
  display: none; border: 0; background: var(--surface-soft); color: var(--ink2);
  width: 22px; height: 22px; border-radius: 50%; place-items: center; font-size: 13px;
}
.search-clear.show { display: grid; }

.top-links { display: flex; align-items: center; gap: 8px; flex: none; }
.top-links a {
  padding: 8px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--ink2); white-space: nowrap; transition: background .16s, color .16s;
}
.top-links a:hover { background: var(--lav); color: var(--lav-ink); }
.top-links a.cta {
  background: var(--ink); color: #fff; padding: 9px 17px;
  box-shadow: 0 10px 22px -12px rgba(21, 22, 51, .55);
}
.top-links a.cta:hover { background: #262854; color: #fff; }
.toc-toggle {
  display: none; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 650; flex: none;
}

/* 主体双栏布局 */
.docs-shell {
  width: min(100%, 1380px); margin: 0 auto; padding: 28px 28px 64px;
  display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 32px; align-items: start;
}

/* 左侧粘性目录 */
.sidebar {
  position: sticky; top: 92px; max-height: calc(100vh - 112px); overflow-y: auto;
  padding: 20px 16px; border-radius: 22px;
  background: rgba(255, 255, 255, .86); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(14px);
  scrollbar-width: thin;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 12px; margin-bottom: 10px; border-bottom: 1px solid var(--line);
}
.sidebar-head strong { font-size: 13px; letter-spacing: .06em; color: var(--ink3); text-transform: uppercase; }
.sidebar-close { display: none; border: 0; background: transparent; color: var(--ink2); padding: 4px; }
.toc-group { margin-bottom: 14px; }
.toc-group-title {
  padding: 6px 10px 4px; font-size: 11px; font-weight: 750;
  letter-spacing: .08em; color: var(--lav-ink); text-transform: uppercase;
}
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block; padding: 7px 10px; border-radius: 10px;
  font-size: 13.5px; font-weight: 550; color: var(--ink2); line-height: 1.45;
  transition: background .15s, color .15s;
}
.toc-list a.sub { padding-left: 22px; font-size: 12.5px; color: var(--ink3); }
.toc-list a:hover { background: var(--surface-soft); color: var(--ink); }
.toc-list a.active { background: var(--lav); color: var(--lav-ink); font-weight: 700; }

/* 主文档内容区 */
.doc-main { min-width: 0; }
.doc-hero {
  padding: 32px 36px; border-radius: 26px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); margin-bottom: 24px;
}
.doc-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .1em; color: var(--lav-ink);
  text-transform: uppercase; margin-bottom: 12px;
}
.doc-eyebrow i { width: 8px; height: 8px; border-radius: 3px; background: var(--blue); }
.doc-hero h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.22; font-weight: 850; letter-spacing: -.025em; }
.doc-hero p.lead { margin-top: 12px; color: var(--ink2); font-size: 15px; line-height: 1.75; max-width: 720px; }
.helper-callout {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-top: 22px; padding: 16px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #eef2ff 0%, #f1edff 100%);
  border: 1px solid var(--lav-strong);
}
.helper-callout strong { display: block; font-size: 14.5px; color: var(--ink); }
.helper-callout span { display: block; margin-top: 3px; font-size: 13px; color: var(--ink2); }
.helper-callout a {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 10px 18px; border-radius: 12px; background: var(--blue); color: #fff;
  font-size: 13.5px; font-weight: 650; box-shadow: 0 10px 20px -10px rgba(51, 84, 244, .55);
}
.helper-callout a:hover { background: var(--blue-hover); color: #fff; }

/* 章节卡片 */
.doc-section {
  padding: 30px 36px; margin-bottom: 22px; border-radius: 24px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.doc-section.hidden-by-search { display: none; }
.heading-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.heading-row h2 {
  font-size: clamp(21px, 2vw, 26px); line-height: 1.32; font-weight: 800;
  letter-spacing: -.02em; color: var(--ink); overflow-wrap: anywhere;
}
.sub-heading {
  display: flex; align-items: center; gap: 8px;
  margin: 26px 0 12px; font-size: 18px; font-weight: 760; color: var(--ink);
}
.sub-heading.h3 { font-size: 16px; color: var(--lav-ink); margin-top: 22px; }
.anchor-btn {
  border: 0; background: var(--surface-soft); color: var(--ink3);
  width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 700; transition: background .15s, color .15s;
}
.anchor-btn:hover { background: var(--lav); color: var(--lav-ink); }

.doc-p { margin: 12px 0; color: var(--ink2); font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.doc-p strong { color: var(--ink); }
.doc-p a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; font-weight: 550; }
.hl-warn {
  padding: 2px 7px; border-radius: 6px;
  background: var(--yellow-soft); color: var(--yellow-ink); font-weight: 650;
}
.hl-red {
  padding: 2px 7px; border-radius: 6px;
  background: #fde8e8; color: #9b1c1c; font-weight: 650;
}

/* 代码块与复制 */
.code-wrap {
  position: relative; margin: 16px 0; border-radius: 16px;
  background: #161836; border: 1px solid #262952; overflow: hidden;
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: rgba(255, 255, 255, .05);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 11.5px; color: #b7c0e8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.code-copy {
  padding: 4px 11px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08); color: #fff; font-size: 12px; font-weight: 600;
}
.code-copy:hover { background: var(--blue); border-color: var(--blue); }
.code-wrap pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  color: #edf1ff; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}

/* 附件下载卡 */
.attachment-card {
  display: inline-flex; align-items: center; gap: 12px;
  margin: 14px 0; padding: 12px 16px; border-radius: 14px;
  background: var(--surface-soft); border: 1px solid var(--lav-strong);
  color: var(--ink); font-size: 14px; font-weight: 650;
  transition: background .16s, transform .16s;
}
.attachment-card:hover { background: var(--lav); color: var(--lav-ink); transform: translateY(-1px); }
.attachment-card small { display: block; font-size: 12px; font-weight: 500; color: var(--ink3); }

/* 截图与双列网格 */
.doc-figure {
  margin: 16px 0; padding: 10px; border-radius: 16px;
  background: var(--surface-soft); border: 1px solid var(--line);
}
.doc-figure img {
  display: block; max-width: 100%; height: auto; margin: 0 auto;
  border-radius: 10px; cursor: zoom-in;
}
.img-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin: 16px 0;
}
.img-grid .doc-figure { margin: 0; }

/* 搜索空态与高亮 */
.search-empty {
  display: none; padding: 40px 24px; text-align: center;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink2);
}
.search-empty.show { display: block; }
mark.hit { background: #ffea8a; color: var(--ink); padding: 0 2px; border-radius: 4px; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  padding: 28px; background: rgba(15, 17, 40, .82); backdrop-filter: blur(8px);
}
.lightbox.open { display: grid; }
.lightbox img { max-width: min(94vw, 1320px); max-height: 86vh; border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); background: #fff; }
.lightbox-close {
  position: fixed; top: 18px; right: 20px; width: 42px; height: 42px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(21, 22, 51, .75); color: #fff; font-size: 20px; display: grid; place-items: center;
}

/* 页脚与版权署名 */
.doc-footer {
  margin-top: 32px; padding: 24px 0 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px;
  font-size: 13px; color: var(--ink2);
}
.doc-footer a { color: var(--blue-hover); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* 移动端适配 */
@media (max-width: 1024px) {
  .docs-shell { grid-template-columns: 1fr; padding: 20px 18px 48px; }
  .top-links { display: none; }
  .toc-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(310px, 86vw);
    max-height: 100dvh; border-radius: 0 22px 22px 0;
    transform: translateX(-105%); transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 24px 70px rgba(15, 17, 40, .35); }
  .sidebar-close { display: inline-grid; place-items: center; }
  .sidebar-scrim {
    position: fixed; inset: 0; z-index: 55; display: none;
    background: rgba(21, 22, 51, .35); backdrop-filter: blur(3px);
  }
  .sidebar-scrim.open { display: block; }
}

@media (max-width: 640px) {
  .nav-inner { height: auto; padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .brand-badge { display: none; }
  .doc-search { order: 3; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .doc-hero, .doc-section { padding: 20px 18px; border-radius: 18px; }
  .img-grid { grid-template-columns: 1fr; }
}
