/* ==========================================================================
   TKTOC 知识大纲指南 · v1.2.0 设计系统
   - 独立 .tg- 命名空间，不污染 onenav / onenav-child
   - 直接复用主题变量：--main-max-width / --main-bg-color / --body-bg-color
     / --theme-color / --main-radius / --main-nav-hight
   - 站点深色模式由 <html class="io-black-mode"> 切换，下面用同一组变量覆盖，
     主题切浅色时本栏目自动跟着切，无需 JS、无需刷新
   - 强调色沿用站内设计系统：TikTok 青 #25F4EE + 红 #FE2C55
   ========================================================================== */

.tg-wrap {
  --tg-canvas: var(--body-bg-color, #f2f4f7);
  --tg-surface: var(--main-bg-color, #fff);
  --tg-surface-2: #f7f8fa;
  --tg-surface-3: #eef1f5;
  --tg-ink: #171b22;
  --tg-ink-2: #525b68;
  --tg-ink-3: #8a929e;
  --tg-line: rgba(16, 24, 40, .10);
  --tg-line-soft: rgba(16, 24, 40, .055);
  --tg-shadow: 0 18px 48px rgba(16, 24, 40, .07);
  --tg-accent: var(--theme-color, #f1404b);
  --tg-accent-soft: rgba(241, 64, 75, .09);
  --tg-grad: linear-gradient(100deg, #25f4ee 0%, #fe2c55 100%);
  --tg-radius: var(--main-radius, 12px);
  --tg-radius-lg: calc(var(--tg-radius) + 10px);
  --tg-radius-sm: calc(var(--tg-radius) - 4px);
  --tg-max: var(--main-max-width, 1260px);
  --tg-nav-h: var(--main-nav-hight, 80px);
  --tg-ease: cubic-bezier(.22, .61, .36, 1);

  box-sizing: border-box;
  width: 100%;
  max-width: var(--tg-max);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px) clamp(64px, 8vw, 112px);
  color: var(--tg-ink);
  font-size: 15.5px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html.io-black-mode .tg-wrap {
  --tg-surface-2: rgba(255, 255, 255, .035);
  --tg-surface-3: rgba(255, 255, 255, .07);
  --tg-ink: rgba(255, 255, 255, .94);
  --tg-ink-2: rgba(255, 255, 255, .66);
  --tg-ink-3: rgba(255, 255, 255, .44);
  --tg-line: rgba(255, 255, 255, .11);
  --tg-line-soft: rgba(255, 255, 255, .06);
  --tg-shadow: 0 20px 56px rgba(0, 0, 0, .34);
  --tg-accent: #25f4ee;
  --tg-accent-soft: rgba(37, 244, 238, .10);
}
.tg-wrap *, .tg-wrap *::before, .tg-wrap *::after { box-sizing: border-box; }
.tg-wrap h1, .tg-wrap h2, .tg-wrap h3, .tg-wrap h4 { margin: 0; line-height: 1.32; font-weight: 650; letter-spacing: -.012em; }
.tg-wrap p { margin: 0; }
.tg-wrap a { color: inherit; text-decoration: none; }
.tg-wrap a:hover { text-decoration: none; }
.tg-wrap ul, .tg-wrap ol, .tg-wrap dl, .tg-wrap dd { margin: 0; padding: 0; list-style: none; }
.tg-wrap img, .tg-wrap svg { vertical-align: middle; }
.tg-wrap button, .tg-wrap input { font: inherit; }
.tg-wrap :focus-visible { outline: 2px solid var(--tg-accent); outline-offset: 3px; border-radius: 4px; }
.tg-wrap ::selection { background: var(--tg-accent-soft); color: var(--tg-ink); }
.tg-skip { position: absolute; left: -9999px; top: 0; z-index: 3000; padding: 10px 18px; background: var(--tg-surface); color: var(--tg-ink); border: 1px solid var(--tg-line); }
.tg-skip:focus { left: 16px; top: 16px; }

/* ---------------------------------------------------------------- 顶部进度 */
.tg-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 2000; pointer-events: none; }
.tg-progress > span { display: block; height: 100%; width: 0; background: var(--tg-grad); transition: width .12s linear; }

/* -------------------------------------------------------------------- 通用件 */
.tg-eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 700; letter-spacing: .18em; color: var(--tg-ink-3); text-transform: uppercase; }
.tg-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tg-grad); box-shadow: 0 0 0 4px var(--tg-accent-soft); }
.tg-eyebrow-plain { color: var(--tg-accent); }
.tg-crumb-sep { color: var(--tg-ink-3); }

.tg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 24px; border-radius: 999px; font-size: 14px; font-weight: 650; border: 1px solid transparent; cursor: pointer; transition: transform .22s var(--tg-ease), box-shadow .22s var(--tg-ease), border-color .22s var(--tg-ease), background .22s var(--tg-ease); }
.tg-btn:hover { transform: translateY(-2px); }
.tg-btn-primary { color: #fff; background: linear-gradient(100deg, #e62b4d 0%, #f1404b 55%, #fe2c55 100%); box-shadow: 0 10px 28px rgba(254, 44, 85, .22); }
.tg-btn-primary:hover { box-shadow: 0 14px 34px rgba(254, 44, 85, .32); }
html.io-black-mode .tg-btn-primary { background: linear-gradient(100deg, #25c9d0 0%, #25f4ee 40%, #fe2c55 100%); }
.tg-btn-ghost { color: var(--tg-ink); background: var(--tg-surface-2); border-color: var(--tg-line); }
.tg-btn-ghost:hover { border-color: var(--tg-accent); color: var(--tg-accent); }

.tg-chip { display: inline-flex; align-items: center; font-size: 12px; line-height: 1; white-space: nowrap; padding: 6px 12px; border-radius: 999px; color: var(--tg-ink-2); background: var(--tg-surface-2); border: 1px solid var(--tg-line-soft); }
.tg-chip-accent { color: var(--tg-accent); background: var(--tg-surface-2); border-color: var(--tg-line); }
.tg-badge { font-size: 11px; color: var(--tg-ink-3); border: 1px solid var(--tg-line); border-radius: 999px; padding: 2px 10px; }
/* 提权：上方 .tg-wrap h2 { margin:0 } 是 (0,1,1)，会压掉裸 .tg-h2 (0,1,0)。
   必须带 .tg-wrap 前缀才能拿到 (0,2,1)，否则所有章节标题上下间距长期为 0。 */
.tg-wrap h2.tg-h2 { position: relative; font-size: clamp(20px, 1.8vw, 25px); margin: clamp(40px, 4vw, 60px) 0 22px; padding-left: 16px; }
.tg-wrap h2.tg-h2::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 21px; border-radius: 3px; background: var(--tg-grad); }
.tg-wrap h2.tg-h2 > span { font-size: 13px; font-weight: 400; color: var(--tg-ink-3); margin-left: 10px; letter-spacing: 0; }

.tg-section { margin-top: clamp(64px, 7vw, 104px); scroll-margin-top: calc(var(--tg-nav-h) + 24px); }
.tg-section-head { margin-bottom: 32px; }
.tg-section-head h2 { font-size: clamp(22px, 2vw, 28px); margin: 12px 0 10px; }
.tg-section-lead { color: var(--tg-ink-2); max-width: 680px; font-size: 15px; }

/* -------------------------------------------------------------------- Hero */
.tg-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12.5px; color: var(--tg-ink-3); margin: clamp(24px, 3vw, 40px) 0 clamp(20px, 2.4vw, 32px); }
.tg-crumb a { color: var(--tg-ink-3); transition: color .18s; }
.tg-crumb a:hover { color: var(--tg-accent); }
.tg-crumb [aria-current="page"] { color: var(--tg-ink); }

.tg-hero { position: relative; overflow: hidden; border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); background: var(--tg-surface); padding: clamp(44px, 6.4vw, 88px) clamp(28px, 5.2vw, 72px); box-shadow: var(--tg-shadow); }
.tg-hero-glow { position: absolute; width: 620px; height: 620px; right: -180px; top: -320px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(37, 244, 238, .14) 0%, rgba(254, 44, 85, .10) 42%, transparent 70%); filter: blur(8px); }
html:not(.io-black-mode) .tg-hero-glow { opacity: .5; }
.tg-hero-inner { position: relative; max-width: 900px; }
.tg-hero h1 { font-size: clamp(31px, 4.2vw, 52px); font-weight: 720; letter-spacing: -.028em; margin: 22px 0 18px; }
.tg-hero-desc { color: var(--tg-ink-2); font-size: clamp(15px, 1.35vw, 17px); line-height: 1.85; max-width: 760px; }
.tg-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.tg-stats { display: flex; flex-wrap: wrap; gap: clamp(28px, 5vw, 72px); margin-top: clamp(44px, 5vw, 68px); padding-top: 30px; border-top: 1px solid var(--tg-line); }
.tg-stat { display: flex; flex-direction: column-reverse; gap: 4px; }
.tg-stat dt { font-size: 12.5px; color: var(--tg-ink-3); }
.tg-stat dd { font-size: clamp(28px, 3vw, 38px); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; background: var(--tg-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
html:not(.io-black-mode) .tg-stat dd { background: none; color: var(--tg-ink); }

/* ------------------------------------------------------------------- 卡片 */
.tg-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tg-card { position: relative; display: flex; flex-direction: column; min-height: 268px; padding: 30px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); background: var(--tg-surface); color: var(--tg-ink); overflow: hidden; transition: transform .26s var(--tg-ease), border-color .26s var(--tg-ease), box-shadow .26s var(--tg-ease); }
.tg-card:hover { transform: translateY(-4px); border-color: var(--tg-accent); box-shadow: var(--tg-shadow); }
.tg-card.is-disabled { background: var(--tg-surface-2); }
.tg-card.is-disabled:hover { transform: none; border-color: var(--tg-line); box-shadow: none; }
.tg-card.is-disabled .tg-card-icon { opacity: .35; }
.tg-card.is-disabled .tg-card-index { opacity: .15; }
.tg-card.is-disabled .tg-badge { color: var(--tg-accent); border-color: var(--tg-accent); }
.tg-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.tg-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 13px; color: var(--tg-accent); background: var(--tg-accent-soft); border: 1px solid var(--tg-line-soft); }
.tg-card-index { font-size: 34px; font-weight: 700; line-height: 1; color: var(--tg-ink-3); opacity: .32; font-variant-numeric: tabular-nums; }
.tg-card h3 { font-size: 17px; margin-bottom: 12px; }
.tg-card > p { color: var(--tg-ink-2); font-size: 13.5px; line-height: 1.8; flex: 1; text-wrap: pretty; }
.tg-card-line { height: 2px; width: 38px; border-radius: 2px; background: var(--tg-grad); margin: 22px 0 18px; transition: width .3s var(--tg-ease); }
.tg-card:hover .tg-card-line { width: 76px; }
.tg-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--tg-ink-3); border-top: 1px solid var(--tg-line-soft); padding-top: 16px; }
.tg-card-foot i { font-style: normal; margin: 0 4px; }
.tg-arrow { color: var(--tg-accent); transition: transform .24s var(--tg-ease); }
.tg-card:hover .tg-arrow { transform: translateX(4px); }

/* ------------------------------------------------------------------- 步骤 */
.tg-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: tgstep; }
.tg-steps > li { padding: 28px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); background: var(--tg-surface); }
.tg-step-n { display: block; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--tg-accent); margin-bottom: 18px; }
.tg-steps h3 { font-size: 16px; margin-bottom: 10px; }
.tg-steps p { color: var(--tg-ink-2); font-size: 13.5px; line-height: 1.85; }

/* -------------------------------------------------------------------- FAQ */
.tg-faq-list { display: grid; gap: 12px; max-width: 940px; }
.tg-faq-item { border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface); overflow: hidden; transition: border-color .22s; }
.tg-faq-item[open] { border-color: var(--tg-accent); }
.tg-faq-item > summary { display: flex; align-items: center; gap: 14px; cursor: pointer; list-style: none; padding: 18px 22px; }
.tg-faq-item > summary::-webkit-details-marker { display: none; }
.tg-faq-item h3 { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.tg-faq-mark { flex: none; width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--tg-accent); background: var(--tg-accent-soft); }
.tg-faq-sign { flex: none; position: relative; width: 16px; height: 16px; }
.tg-faq-sign::before, .tg-faq-sign::after { content: ""; position: absolute; left: 2px; top: 7px; width: 12px; height: 1.5px; background: var(--tg-ink-3); transition: transform .22s; }
.tg-faq-sign::after { transform: rotate(90deg); }
.tg-faq-item[open] .tg-faq-sign::after { transform: rotate(0); }
.tg-faq-a { padding: 18px 22px 22px 58px; color: var(--tg-ink-2); font-size: 14px; line-height: 1.9; text-wrap: pretty; }
.tg-faq-a a { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--tg-accent); font-size: 13px; font-weight: 600; }
.tg-faq-a a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ 页脚块 */
/* Hub 页脚与文档页同构：说明卡片占满整行，链接组另起一行。
   旧版 flex + max-width:720px 会让卡片只占半行、右侧留 370px 空白。 */
.tg-page-foot { display: block; margin-top: clamp(64px, 7vw, 104px); padding-top: 30px; border-top: 1px solid var(--tg-line); }
.tg-page-foot .tg-source { max-width: none; }
.tg-foot-links { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--tg-line-soft); font-size: 13px; color: var(--tg-ink-3); }
.tg-foot-links a:hover { color: var(--tg-accent); }
.tg-source { display: flex; gap: 14px; align-items: flex-start; padding: 20px 22px; border: 1px solid var(--tg-line-soft); border-radius: var(--tg-radius); background: var(--tg-surface-2); }
.tg-source-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--tg-accent); border: 1px solid var(--tg-accent); }
.tg-source strong { display: block; font-size: 13px; margin-bottom: 6px; }
.tg-source p { color: var(--tg-ink-2); font-size: 13px; line-height: 1.85; }

/* ------------------------------------------------------------- 文档页结构 */
.tg-doc-topbar { display: none; }
.tg-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 28px; align-items: start; }
.tg-side { position: sticky; top: calc(var(--tg-nav-h) + 16px); display: flex; flex-direction: column; max-height: calc(100vh - var(--tg-nav-h) - 32px); border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); background: var(--tg-surface); overflow: hidden; box-shadow: var(--tg-shadow); }
.tg-side-head { flex: none; padding: 20px 18px 16px; border-bottom: 1px solid var(--tg-line); }
.tg-side-title { display: block; font-size: 15px; font-weight: 650; line-height: 1.5; }
.tg-side-title:hover { color: var(--tg-accent); }
.tg-side-count { display: block; font-size: 11.5px; color: var(--tg-ink-3); margin-top: 3px; }
.tg-side-search { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0 10px; height: 38px; border: 1px solid var(--tg-line); border-radius: 9px; background: var(--tg-surface-2); color: var(--tg-ink-3); transition: border-color .2s; }
.tg-side-search:focus-within { border-color: var(--tg-accent); }
.tg-side-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--tg-ink); font-size: 12.5px; }
.tg-side-search input::placeholder { color: var(--tg-ink-3); }
.tg-side-search kbd { font: inherit; font-size: 11px; color: var(--tg-ink-3); border: 1px solid var(--tg-line); border-radius: 4px; padding: 0 5px; }
.tg-side-tools { display: flex; gap: 6px; margin-top: 10px; }
.tg-side-tools button { flex: 1; padding: 6px 4px; font-size: 11.5px; color: var(--tg-ink-2); background: var(--tg-surface-2); border: 1px solid var(--tg-line-soft); border-radius: 7px; cursor: pointer; transition: color .18s, border-color .18s; }
.tg-side-tools button:hover { color: var(--tg-accent); border-color: var(--tg-accent); }
.tg-side-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 12px 10px 20px; scrollbar-width: thin; }
.tg-side-body::-webkit-scrollbar { width: 6px; }
.tg-side-body::-webkit-scrollbar-thumb { background: var(--tg-line); border-radius: 6px; }
.tg-side-foot { flex: none; padding: 12px 18px; border-top: 1px solid var(--tg-line); }
.tg-side-foot a { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tg-ink-3); }
.tg-side-foot a:hover { color: var(--tg-accent); }

/* 折叠树 */
.tg-tree-ul { list-style: none; }
.tg-tree-ul .tg-tree-ul { padding-left: 13px; margin-left: 8px; border-left: 1px solid var(--tg-line); }
.tg-tree-li { margin: 1px 0; }
.tg-tree-li > details > summary { display: flex; align-items: flex-start; gap: 6px; padding: 5px 6px; border-radius: 7px; cursor: pointer; list-style: none; font-size: 12.8px; line-height: 1.6; }
.tg-tree-li > details > summary::-webkit-details-marker { display: none; }
.tg-tree-li > details > summary:hover { background: var(--tg-surface-2); }
.tg-tree-li > details > summary a, .tg-tree-li > a.tg-leaf { display: block; flex: 1; min-width: 0; padding: 2px 5px; border-radius: 6px; font-size: 12.8px; line-height: 1.6; color: var(--tg-ink-2); word-break: break-word; transition: color .16s, background .16s; }
.tg-tree-li > details > summary a:hover, .tg-tree-li > a.tg-leaf:hover { color: var(--tg-accent); background: var(--tg-accent-soft); }
.tg-tree-li.is-active > details > summary a, .tg-tree-li.is-active > a.tg-leaf { position: relative; color: var(--tg-accent); background: var(--tg-accent-soft); font-weight: 650; }
.tg-leaf { margin-left: 17px; }
.tg-caret { flex: none; width: 8px; height: 8px; margin-top: 7px; border-right: 1.5px solid var(--tg-ink-3); border-bottom: 1.5px solid var(--tg-ink-3); transform: rotate(-45deg); transition: transform .18s; }
.tg-tree-li > details[open] > summary .tg-caret { transform: rotate(45deg); }
.tg-depth-1 > li > details > summary a { font-weight: 650; color: var(--tg-ink); }
.tg-tree-li.is-hidden { display: none; }
.tg-empty { color: var(--tg-ink-3); font-size: 13px; padding: 14px; }
.tg-tree-noresult { display: none; color: var(--tg-ink-3); font-size: 12.5px; padding: 14px 8px; }

/* 正文容器 */
.tg-main { min-width: 0; padding: clamp(24px, 3.2vw, 48px); border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); background: var(--tg-surface); box-shadow: var(--tg-shadow); }
.tg-article-head { padding-bottom: 26px; margin-bottom: 30px; border-bottom: 1px solid var(--tg-line); }
.tg-article-head h1 { font-size: clamp(26px, 2.6vw, 36px); font-weight: 650; letter-spacing: -.022em; margin: 18px 0 14px; }
.tg-lead { color: var(--tg-ink-2); font-size: 15.5px; line-height: 1.85; max-width: 820px; text-wrap: pretty; }
.tg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 22px; line-height: 1; }

/* 摘要 / GEO 要点块 */
.tg-summary { position: relative; margin: 0 0 30px; padding: 26px 28px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface-2); overflow: hidden; }
.tg-summary::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tg-grad); }
.tg-summary-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tg-summary-tag { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--tg-accent); }
.tg-copy { padding: 4px 12px; font-size: 11.5px; color: var(--tg-ink-3); background: transparent; border: 1px solid var(--tg-line); border-radius: 999px; cursor: pointer; transition: color .18s, border-color .18s; }
.tg-copy:hover { color: var(--tg-accent); border-color: var(--tg-accent); }
.tg-summary h2 { font-size: 18px; margin-bottom: 14px; }
.tg-summary ul { display: grid; gap: 8px; margin-bottom: 16px; }
.tg-summary li { position: relative; padding-left: 20px; font-size: 14px; line-height: 1.8; color: var(--tg-ink-2); }
.tg-summary li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--tg-accent); }
.tg-summary-def { font-size: 13px; line-height: 1.85; color: var(--tg-ink-3); padding-top: 14px; border-top: 1px solid var(--tg-line-soft); }
.tg-summary-plain p { font-size: 14px; line-height: 1.9; color: var(--tg-ink-2); }

.tg-pending { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 28px; padding: 20px 22px; border: 1px dashed var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface-2); }
.tg-pending-mark { flex: none; color: var(--tg-accent); font-size: 20px; line-height: 1; }
.tg-pending strong { display: block; font-size: 14px; margin-bottom: 6px; }
.tg-pending p { font-size: 13.5px; color: var(--tg-ink-2); line-height: 1.8; }

/* 本页 TOC（内联 + 右侧） */
.tg-toc-inline { display: block; margin: 0 0 26px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface-2); }
.tg-toc-inline > summary { cursor: pointer; list-style: none; padding: 13px 18px; font-size: 13.5px; font-weight: 600; }
.tg-toc-inline > summary::-webkit-details-marker { display: none; }
.tg-toc-inline > summary span { color: var(--tg-ink-3); font-size: 12px; font-weight: 400; margin-left: 6px; }
.tg-toc-inline ol { padding: 0 18px 16px; }
.tg-toc-inline a { display: block; padding: 5px 0; font-size: 13px; color: var(--tg-ink-2); }
.tg-toc-inline a:hover { color: var(--tg-accent); }
.tg-toc-lv3 { padding-left: 14px !important; }
.tg-toc-lv4 { padding-left: 28px !important; }
.tg-toc-side { display: none; }
.tg-toc-side-inner { position: sticky; top: calc(var(--tg-nav-h) + 16px); max-height: calc(100vh - var(--tg-nav-h) - 36px); overflow: auto; padding: 4px 0 4px 16px; border-left: 1px solid var(--tg-line); scrollbar-width: thin; }
.tg-toc-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--tg-ink-3); margin-bottom: 16px; text-transform: uppercase; }
.tg-toc-side li { margin-bottom: 2px; }
.tg-toc-side a { display: block; padding: 5px 8px; font-size: 12.3px; line-height: 1.6; color: var(--tg-ink-3); border-left: 2px solid transparent; margin-left: -17px; padding-left: 15px; transition: color .18s, border-color .18s; }
.tg-toc-side a:hover, .tg-toc-side a.is-current { color: var(--tg-accent); border-left-color: var(--tg-accent); }
.tg-toc-top { display: inline-block; margin-top: 18px; font-size: 12px; color: var(--tg-ink-3); }
.tg-toc-top:hover { color: var(--tg-accent); }

/* 正文排版 */
.tg-content { font-size: 15.5px; line-height: 1.95; color: var(--tg-ink); overflow-wrap: break-word; }
.tg-content > :first-child { margin-top: 0; }
.tg-content h2, .tg-content h3, .tg-content h4 { scroll-margin-top: calc(var(--tg-nav-h) + 24px); color: var(--tg-ink); }
.tg-content h2 { font-size: 21px; margin: 40px 0 16px; padding: 0 0 10px 14px; border-bottom: 1px solid var(--tg-line); border-left: 3px solid var(--tg-accent); }
.tg-content h3 { font-size: 17.5px; margin: 30px 0 12px; }
.tg-content h4 { font-size: 15.5px; margin: 24px 0 10px; }
.tg-content p { margin: 14px 0; text-wrap: pretty; }
.tg-content ul, .tg-content ol { padding-left: 24px; margin: 14px 0; list-style: revert; }
.tg-content li { margin: 7px 0; }
.tg-content strong { font-weight: 650; }
.tg-content a { color: var(--tg-accent); text-decoration: underline; text-underline-offset: 3px; word-break: break-word; }
.tg-content blockquote { margin: 20px 0; padding: 12px 18px; border-left: 3px solid var(--tg-accent); border-radius: 0 var(--tg-radius-sm) var(--tg-radius-sm) 0; background: var(--tg-surface-2); color: var(--tg-ink-2); }
.tg-content img { max-width: 100%; height: auto; display: block; margin: 0 auto; border: 1px solid var(--tg-line-soft); border-radius: 8px; background: #fff; }
.tg-content figure { margin: 26px 0; padding: 12px; text-align: center; border: 1px solid var(--tg-line-soft); border-radius: var(--tg-radius); background: var(--tg-surface-2); }
.tg-content figcaption { font-size: 12px; color: var(--tg-ink-3); margin-top: 10px; line-height: 1.6; }
.tg-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 22px 0; border: 1px solid var(--tg-line); border-radius: var(--tg-radius-sm); }
.tg-content table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 13.5px; }
.tg-content th, .tg-content td { border: 1px solid var(--tg-line); padding: 10px 14px; vertical-align: top; text-align: left; line-height: 1.75; }
.tg-content th { background: var(--tg-surface-2); font-weight: 650; }
.tg-content pre { overflow: auto; padding: 16px; border-radius: var(--tg-radius-sm); background: var(--tg-surface-3); font-size: 13px; }
.tg-content hr { border: 0; border-top: 1px solid var(--tg-line); margin: 32px 0; }

/* 目录卡片 / 最近文档 / 下级条目 / 上下篇 */
.tg-cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tg-cat { position: relative; display: block; padding: 22px 24px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface-2); transition: transform .22s var(--tg-ease), border-color .22s, background .22s; }
.tg-cat:hover { transform: translateY(-3px); border-color: var(--tg-accent); background: var(--tg-surface); }
.tg-cat-index { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--tg-ink-3); margin-bottom: 14px; }
.tg-cat h3 { font-size: 15.5px; margin-bottom: 8px; padding-right: 20px; }
.tg-cat p { font-size: 12.5px; color: var(--tg-ink-3); margin-bottom: 8px; }
.tg-cat-sample { display: block; font-size: 12px; color: var(--tg-ink-3); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-cat-go { position: absolute; right: 18px; top: 22px; color: var(--tg-accent); opacity: 0; transform: translateX(-4px); transition: opacity .22s, transform .22s; }
.tg-cat:hover .tg-cat-go { opacity: 1; transform: translateX(0); }
.tg-recent ul { display: grid; gap: 2px; }
.tg-recent li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--tg-line-soft); font-size: 13.5px; border-radius: 8px; transition: background .18s; }
.tg-recent li:last-child { border-bottom: 0; }
.tg-recent li:hover { background: var(--tg-surface-2); }
.tg-recent a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tg-ink-2); }
.tg-recent a:hover { color: var(--tg-accent); }
.tg-recent time { flex: none; font-size: 12px; color: var(--tg-ink-3); font-variant-numeric: tabular-nums; }
.tg-children ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.tg-children li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 1px solid var(--tg-line-soft); border-radius: 9px; background: var(--tg-surface-2); font-size: 13px; transition: border-color .18s; }
.tg-children li:hover { border-color: var(--tg-accent); }
.tg-children a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-children a:hover { color: var(--tg-accent); }
.tg-tag { flex: none; font-size: 11px; color: var(--tg-accent); background: var(--tg-accent-soft); border-radius: 999px; padding: 1px 9px; }
.tg-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 46px; padding-top: 26px; border-top: 1px solid var(--tg-line); }
.tg-pager-item { display: flex; flex-direction: column; gap: 7px; padding: 16px 20px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface-2); transition: border-color .2s, transform .2s var(--tg-ease); }
.tg-pager-item:hover { border-color: var(--tg-accent); transform: translateY(-2px); }
.tg-pager-item.is-next { text-align: right; align-items: flex-end; }
.tg-pager-item.is-empty { border: 0; background: transparent; }
.tg-pager-item span { font-size: 11.5px; color: var(--tg-ink-3); }
.tg-pager-item strong { font-size: 13.5px; font-weight: 600; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* 与 .tg-pager / .tg-article-foot 保持同一区块节奏：上留白 + 细分隔线。
   标题由 h2 的 22px 下边距与 FAQ 卡片分开，杜绝「标题贴着上一篇 / 贴着卡片」。 */
.tg-faq-section { margin-top: 46px; padding-top: 26px; border-top: 1px solid var(--tg-line); }
.tg-wrap .tg-faq-section > h2.tg-h2 { margin: 0 0 22px; }
.tg-faq-section .tg-faq-list { margin-top: 0; }
.tg-article-foot { margin-top: 48px; padding-top: 26px; border-top: 1px solid var(--tg-line); }
/* 内容说明卡片与底部「所属知识树」区之间留出明显间距并加细分隔线，避免两块紧贴 */
.tg-article-foot-meta { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--tg-line-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--tg-ink-2); line-height: 1.7; }
.tg-foot-label { color: var(--tg-ink); font-weight: 600; margin-right: 2px; }
.tg-foot-chip { display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px; background: var(--tg-surface-2); border: 1px solid var(--tg-line-soft); color: var(--tg-ink-2); transition: color .18s, border-color .18s, background .18s; }
.tg-foot-chip:hover { color: var(--tg-accent); border-color: var(--tg-accent); background: var(--tg-accent-soft); }

/* --------------------------------------------------------------- 浮动按钮 */
.tg-to-top { position: fixed; right: 24px; bottom: 28px; z-index: 900; display: none; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--tg-line); color: var(--tg-ink); background: var(--tg-surface); box-shadow: var(--tg-shadow); cursor: pointer; transition: transform .2s, color .2s, border-color .2s; }
.tg-to-top.is-visible { display: grid; }
.tg-to-top:hover { transform: translateY(-3px); color: var(--tg-accent); border-color: var(--tg-accent); }
.tg-drawer-mask { position: fixed; inset: 0; z-index: 1000; background: rgba(6, 8, 12, .55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.tg-drawer-mask[hidden] { display: none; }

/* 404 */
.tg-404 { padding-top: clamp(80px, 12vw, 160px); padding-bottom: clamp(100px, 14vw, 200px); text-align: center; }
.tg-404 h1 { font-size: clamp(28px, 3.4vw, 42px); margin: 18px 0 14px; }
.tg-404 > p:not(.tg-eyebrow) { color: var(--tg-ink-2); margin-bottom: 30px; }

/* ==========================================================================
   响应式：<1000 单栏 + 抽屉 / <767 移动端 / <420 窄屏
   注意：列宽与三栏断点统一由下方「版式重构覆盖层」的 min-width:1480 /
   max-width:1479 严格互补定义，此处不再重复声明，避免两套 1480px
   媒体查询互相覆盖（历史「改了不生效」的根因之一）。
   ========================================================================== */
@media (max-width: 1000px) {
  .tg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-steps { grid-template-columns: 1fr; }
  .tg-layout { display: block; }
  .tg-doc-topbar { display: block; margin-bottom: 16px; }
  .tg-tree-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-surface); color: var(--tg-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
  .tg-tree-toggle:hover { border-color: var(--tg-accent); }
  .tg-topbar-tree { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--tg-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tg-side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1001; width: min(88vw, 360px); max-height: none; border-radius: 0 var(--tg-radius-lg) var(--tg-radius-lg) 0; transform: translateX(-102%); transition: transform .28s var(--tg-ease); box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  .tg-side.is-open { transform: translateX(0); }
  .tg-main { padding: 26px 22px; }
  .tg-toc-inline { display: block; }
  .tg-side-search kbd { display: none; }
}
@media (max-width: 767px) {
  .tg-wrap { font-size: 15px; padding-left: 16px; padding-right: 16px; }
  .tg-hero { padding: 40px 24px; border-radius: var(--tg-radius); }
  .tg-hero h1 { font-size: 30px; }
  .tg-hero-actions { gap: 10px; }
  .tg-btn { min-height: 44px; padding: 0 18px; }
  .tg-stats { gap: 22px; margin-top: 36px; }
  .tg-stat dd { font-size: 26px; }
  .tg-cards, .tg-cat-grid, .tg-children ul, .tg-pager { grid-template-columns: 1fr; }
  .tg-card { min-height: 0; padding: 24px; }
  .tg-card-top { margin-bottom: 18px; }
  .tg-section { margin-top: 60px; }
  .tg-main { padding: 22px 18px; }
  .tg-article-head h1 { font-size: 25px; }
  .tg-summary { padding: 20px; }
  .tg-content { font-size: 15px; }
  .tg-content table { min-width: 460px; }
  .tg-faq-a { padding: 0 18px 18px; }
  .tg-faq-item h3 { font-size: 14px; }
  .tg-page-foot .tg-source { padding: 16px 18px; }
  .tg-crumb { font-size: 12px; gap: 7px; }
}
@media (max-width: 420px) {
  .tg-hero { padding: 32px 18px; }
  .tg-hero h1 { font-size: 26px; }
  .tg-card { padding: 20px; }
  .tg-main { padding: 18px 14px; }
}

/* ==========================================================================
   v1.3.0 版式重构覆盖层
   1) 首屏不再被大 Hero 卡片占满，知识树入口首屏可见
   2) 主内容区占满可用宽度；只有「文档页且确有本页目录」才出现第三栏，杜绝右侧空列
   3) 栏目页按目录分组一页列出全部文章链接，不用逐层点击
   4) 搜索框单层边框，滚动条跟随深浅主题
   放在响应式段之后、打印段之前，确保同名规则由本层胜出。
   ========================================================================== */

.tg-wrap {
  --tg-max: 1600px;
  padding-left: clamp(16px, 2.4vw, 36px);
  padding-right: clamp(16px, 2.4vw, 36px);
  padding-bottom: clamp(56px, 6vw, 88px);
}
.tg-crumb { margin: 18px 0 20px; }

/* --- Hub：紧凑标题条 + 右侧小统计 --- */
.tg-hub-head {
  display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-end; justify-content: space-between;
  padding: 0 0 24px; border-bottom: 1px solid var(--tg-line);
}
.tg-hub-head-main { flex: 1 1 460px; min-width: 260px; }
.tg-hub-head h1 { font-size: clamp(27px, 2.6vw, 38px); font-weight: 700; letter-spacing: -.024em; margin: 12px 0 8px; }
.tg-hub-desc { color: var(--tg-ink-2); font-size: 14.5px; line-height: 1.8; max-width: 820px; text-wrap: pretty; }
/* 统计区：每项内部「数字在上、文字在下」且整体居中；成组右对齐；标签不加粗 */
.tg-hub-stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 3vw, 46px); align-items: flex-end; justify-content: flex-end; }
.tg-hub-stats > div { display: flex; flex-direction: column-reverse; align-items: center; gap: 5px; min-width: 76px; }
.tg-hub-stats dt { font-size: 11.5px; color: var(--tg-ink-3); font-weight: 500; letter-spacing: .04em; line-height: 1.3; }
.tg-hub-stats dd { font-size: clamp(22px, 2vw, 28px); font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--tg-ink); }
html.io-black-mode .tg-hub-stats dd { color: var(--tg-accent); }

.tg-section { margin-top: clamp(36px, 3.6vw, 56px); }
.tg-section-tight { margin-top: 36px; }
.tg-section-head { margin-bottom: 20px; }
.tg-section-head-tight h2 { font-size: clamp(20px, 1.8vw, 25px); margin: 0 0 8px; }
.tg-section-lead { font-size: 14px; }
.tg-section-count { font-size: 12px; font-weight: 400; color: var(--tg-ink-3); margin-left: 10px; letter-spacing: 0; }

/* 5 张卡：前 3 张各占 2 格，后 2 张各占 3 格，第二行不留空 */
.tg-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.tg-card { grid-column: span 2; min-height: 0; padding: 20px 22px; border-radius: var(--tg-radius); }
.tg-cards > :nth-child(4):nth-last-child(2),
.tg-cards > :nth-child(5):last-child { grid-column: span 3; }
.tg-card-top { margin-bottom: 14px; }
.tg-card-icon { width: 36px; height: 36px; border-radius: 10px; }
.tg-card-index { font-size: 22px; opacity: .22; }
.tg-card h3 { font-size: 15.5px; margin-bottom: 8px; }
.tg-card > p { font-size: 12.8px; line-height: 1.7; min-height: 44px; }
.tg-card-foot { padding-top: 12px; margin-top: 16px; font-size: 11.8px; }
.tg-hub-tips {
  display: flex; gap: 14px; align-items: center; margin-top: 28px; padding: 12px 18px;
  border: 1px solid var(--tg-line-soft); border-radius: var(--tg-radius); background: var(--tg-surface-2);
}
.tg-hub-tips-label { flex: none; font-size: 11.5px; font-weight: 700; color: var(--tg-accent); letter-spacing: .06em; }
.tg-hub-tips p { font-size: 13px; color: var(--tg-ink-2); line-height: 1.7; }
.tg-faq-list { max-width: none; }
.tg-page-foot { margin-top: clamp(40px, 4vw, 64px); }

/* --- 布局：主内容区占满，右侧不再留空列 --- */
.tg-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 24px; }
.tg-layout.has-toc { grid-template-columns: 300px minmax(0, 1fr) 220px; gap: 24px; }
.tg-toc-side { display: none; }
.tg-layout.has-toc .tg-toc-inline { display: block; }
/* 三栏只在 ≥1480px 且有本页目录时出现；≤1479px 一律两栏 + 内联目录，
   彻底杜绝「三栏留位但右侧栏隐藏」造成的空白列。两个断点严格互补，
   且全站只在此处声明一次，不再与上方响应式段打架。 */
@media (min-width: 1480px) {
  .tg-layout.has-toc .tg-toc-side { display: block; }
  .tg-layout.has-toc .tg-toc-inline { display: none; }
}
@media (max-width: 1479px) {
  /* 有目录 / 无目录统一 280px 左栏，避免 1200px 处出现 250↔300 宽度跳变 */
  .tg-layout,
  .tg-layout.has-toc { grid-template-columns: 280px minmax(0, 1fr); gap: 22px; }
  .tg-toc-side { display: none; }
  /* 窄屏无右侧栏时，让内联本页目录吸顶；展开后取消吸顶，避免长目录遮住正文 */
  .tg-toc-inline:not([open]) { position: sticky; top: calc(var(--tg-nav-h) + 12px); z-index: 6; }
  .tg-toc-inline[open] { position: static; }
}
@media (max-width: 1000px) {
  .tg-layout, .tg-layout.has-toc { display: block; }
  .tg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-cards > * { grid-column: span 1; }
}
.tg-main { padding: clamp(22px, 2.2vw, 34px); }
.tg-article-head { padding-bottom: 20px; margin-bottom: 22px; }
.tg-article-head h1 { font-size: clamp(25px, 2.2vw, 32px); margin: 12px 0 10px; }
.tg-lead { font-size: 15px; }
.tg-meta { margin-top: 16px; }

/* --- 搜索框：只保留一层边框；去掉浏览器自带 search 装饰 --- */
.tg-side-search { height: 36px; padding: 0 11px; border-radius: 8px; }
.tg-side-search:focus-within { box-shadow: none; }
.tg-side-search input[type="search"],
.tg-flat-search input[type="search"] {
  appearance: none; -webkit-appearance: none;
  border: 0; outline: 0; box-shadow: none; background: transparent; padding: 0; margin: 0;
}
.tg-side-search input::-webkit-search-decoration,
.tg-side-search input::-webkit-search-cancel-button,
.tg-flat-search input::-webkit-search-decoration,
.tg-flat-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* 焦点只由外层容器边框变化表示，input 不再叠一圈 outline（消除「多一个框」） */
.tg-side-search input:focus-visible,
.tg-flat-search input:focus-visible { outline: none; }

/* --- 滚动条：跟随深浅主题，深色下不出现白条 --- */
.tg-side-body, .tg-toc-side-inner, .tg-table-scroll { scrollbar-width: thin; scrollbar-color: rgba(140, 150, 165, .42) transparent; }
.tg-side-body::-webkit-scrollbar,
.tg-toc-side-inner::-webkit-scrollbar,
.tg-table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.tg-side-body::-webkit-scrollbar-track,
.tg-toc-side-inner::-webkit-scrollbar-track,
.tg-table-scroll::-webkit-scrollbar-track { background: transparent; }
.tg-side-body::-webkit-scrollbar-thumb,
.tg-toc-side-inner::-webkit-scrollbar-thumb,
.tg-table-scroll::-webkit-scrollbar-thumb {
  background: rgba(140, 150, 165, .36); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
html.io-black-mode .tg-side-body,
html.io-black-mode .tg-toc-side-inner,
html.io-black-mode .tg-table-scroll { scrollbar-color: rgba(255, 255, 255, .20) transparent; }
html.io-black-mode .tg-side-body::-webkit-scrollbar-thumb,
html.io-black-mode .tg-toc-side-inner::-webkit-scrollbar-thumb,
html.io-black-mode .tg-table-scroll::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, .20) !important; }
/* 主题全局滚动条往往是白色，深色下极刺眼；本栏目连页面级滚动条一并压暗 */
html.io-black-mode:has(.tg-wrap) { scrollbar-color: rgba(255, 255, 255, .22) var(--body-bg-color, #14161b); }
html.io-black-mode:has(.tg-wrap)::-webkit-scrollbar { width: 10px; }
html.io-black-mode:has(.tg-wrap)::-webkit-scrollbar-track { background: var(--body-bg-color, #14161b); }
html.io-black-mode:has(.tg-wrap)::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .22) !important; border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}

/* --- 索引页：紧凑头 + 目录锚点 + 一页直达的文章链接网格 --- */
.tg-index-head-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; justify-content: space-between; }
.tg-index-head-row > div:first-child { flex: 1 1 420px; min-width: 260px; }
.tg-index-stats { display: flex; gap: clamp(16px, 2.4vw, 36px); }
.tg-index-stats > div { display: flex; flex-direction: column-reverse; gap: 2px; }
.tg-index-stats dt { font-size: 11.5px; color: var(--tg-ink-3); }
.tg-index-stats dd { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tg-flat-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.tg-flat-h { position: relative; font-size: clamp(20px, 1.8vw, 24px); font-weight: 650; padding-left: 13px; }
.tg-flat-h::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 17px; border-radius: 3px; background: var(--tg-grad); }
.tg-flat-h > span { font-size: 12px; font-weight: 400; color: var(--tg-ink-3); margin-left: 10px; letter-spacing: 0; }
.tg-flat-search {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px; min-width: 210px;
  border: 1px solid var(--tg-line); border-radius: 8px; background: var(--tg-surface-2); color: var(--tg-ink-3);
}
.tg-flat-search:focus-within { border-color: var(--tg-accent); }
.tg-flat-search input { flex: 1; min-width: 0; color: var(--tg-ink); font-size: 12.5px; }
.tg-flat-search input::placeholder { color: var(--tg-ink-3); }
.tg-flat-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--tg-line-soft); }
.tg-flat-nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; font-size: 12.5px;
  border: 1px solid var(--tg-line); border-radius: 999px; color: var(--tg-ink-2);
  background: var(--tg-surface-2); transition: color .18s, border-color .18s, background .18s;
}
.tg-flat-nav a:hover { color: var(--tg-accent); border-color: var(--tg-accent); background: var(--tg-accent-soft); }
.tg-flat-nav a span { font-size: 11px; color: var(--tg-ink-3); font-variant-numeric: tabular-nums; }
.tg-flat-group { margin-bottom: 32px; scroll-margin-top: calc(var(--tg-nav-h) + 20px); content-visibility: auto; contain-intrinsic-size: auto 220px; }
.tg-flat-title { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 650; margin-bottom: 12px; }
.tg-flat-title a:hover { color: var(--tg-accent); }
.tg-flat-n { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--tg-accent); font-variant-numeric: tabular-nums; }
.tg-flat-count { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--tg-ink-3); }
.tg-flat-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 12px; }
.tg-flat-links li { min-width: 0; }
.tg-flat-links a {
  display: block; padding: 7px 10px; border-radius: 7px; font-size: 13px; line-height: 1.6;
  color: var(--tg-ink-2); border: 1px solid transparent;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  white-space: normal; overflow: hidden;
  min-height: 3.2em; transition: color .16s, background .16s, border-color .16s;
}
.tg-flat-links a:hover { color: var(--tg-accent); background: var(--tg-accent-soft); border-color: var(--tg-line-soft); }
.tg-flat-links li.is-hidden, .tg-flat-group.is-hidden { display: none; }
.tg-flat-noresult { padding: 24px; text-align: center; color: var(--tg-ink-3); font-size: 13.5px; }
.tg-recent-tight { margin-top: 40px; }
.tg-recent-tight .tg-flat-h { margin-bottom: 10px; }
.tg-recent li { font-size: 13px; padding: 8px 12px; }

@media (max-width: 767px) {
  .tg-hub-stats, .tg-index-stats { gap: 18px; }
  .tg-hub-head, .tg-index-head-row { gap: 16px; }
  .tg-cards { grid-template-columns: 1fr; }
  .tg-cards > * { grid-column: 1 / -1; }
  .tg-flat-links { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .tg-hub-tips { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tg-flat-search { width: 100%; }
}

/* ------------------------------------------------------------- 无障碍 / 打印 */
@media (prefers-reduced-motion: reduce) {
  .tg-wrap *, .tg-side, .tg-progress > span { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .tg-side, .tg-toc-side, .tg-toc-inline, .tg-doc-topbar, .tg-to-top, .tg-progress,
  .tg-pager, .tg-faq-section, .tg-hero-actions, .tg-crumb, .tg-drawer-mask { display: none !important; }
  .tg-wrap { max-width: none; padding: 0; color: #000; }
  .tg-main, .tg-hero, .tg-card { border: 0; box-shadow: none; background: #fff; }
  .tg-content a { color: #000; }
  .tg-content a::after { content: " (" attr(href) ")"; font-size: 11px; }
  .tg-content h2, .tg-content h3 { break-after: avoid; }
  .tg-content figure, .tg-table-scroll { break-inside: avoid; }
}


/* ==========================================================================
   v1.4.8 全局一致性修正
   1) 正文编号小标题：源站导出把章节标题压成 <p>，只做视觉分层，不改文字
   2) 页脚胶囊：hub 与 doc 两套页脚统一（原先 hub 是裸文字链接）
   3) 统计数字：深色模式下 hub / 栏目页保持一致
   ========================================================================== */

/* 编号章节用真实 h2/h3；[id] 提升优先级，压过主题
   .panel-body h2:not(.item-title) 的 font-size 与 body h3 的 margin-bottom */
.tg-content h2.tg-num-head[id],
.tg-content h3.tg-num-head[id] {
  position: relative;
  margin: 30px 0 12px;
  padding-left: 14px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.55;
  color: var(--tg-ink);
  border: 0;
  scroll-margin-top: calc(var(--tg-nav-h) + 24px);
}
.tg-content h2.tg-num-head[id]::before,
.tg-content h3.tg-num-head[id]::before {
  content: ""; position: absolute; left: 0; top: .2em; bottom: .2em;
  width: 3px; height: auto; margin: 0; padding: 0; border-radius: 3px;
  background: var(--tg-grad); box-shadow: none; vertical-align: baseline;
}
.tg-content h3.tg-num-head[id] { font-size: 15.5px; padding-left: 12px; }
.tg-content .tg-num-head + p,
.tg-content .tg-num-head + ul,
.tg-content .tg-num-head + .tg-table-scroll { margin-top: 4px; }

/* hub 页脚：复用 doc 页的胶囊，不再裸文字 */
.tg-foot-links { gap: 10px; align-items: center; }
.tg-foot-links a.tg-foot-chip { font-size: 12.5px; }
.tg-foot-links a.tg-foot-chip:hover { color: var(--tg-accent); border-color: var(--tg-accent); background: var(--tg-accent-soft); }

/* 栏目页统计数字与聚合页一致 */
html.io-black-mode .tg-index-stats dd { color: var(--tg-accent); }

@media (max-width: 767px) {
  .tg-content h2.tg-num-head[id],
  .tg-content h3.tg-num-head[id] { margin: 24px 0 10px; font-size: 16px; }
  .tg-flat-links a { min-height: 3.2em; }
}
