/* ==========================================================
   help.css — 帮助中心阅读器（js/help/viewer.js），聊天端与后台共用
   颜色取宿主的变量：聊天端 --text / --bg / --accent，后台 --ink / --surface / --accent；都没有时用后备值
   ========================================================== */
.hp {
  --hp-text: var(--text, var(--ink, #1c1c1a)); --hp-muted: var(--text-2, var(--ink-2, #6f6f6a)); --hp-line: var(--border, var(--line, #e6e6e1));
  --hp-bg: var(--bg, var(--surface, #fff)); --hp-soft: var(--bg-soft, var(--bg, #f6f6f3)); --hp-accent: var(--accent, #3390ec); --hp-on-accent: var(--on-accent, #fff);
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; height: 100%; min-height: 0; color: var(--hp-text);
}
.hp-toc-btn { display: none; }
.hp-nav { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--hp-line); padding: 12px; gap: 10px; }
.hp-search { position: relative; display: block; }
.hp-search > svg, .hp-search > i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--hp-muted); }
.hp-search input { width: 100%; height: 36px; padding: 0 10px 0 32px; border: 1px solid var(--hp-line); border-radius: 8px; background: var(--hp-bg); color: inherit; font: inherit; }
.hp-search input:focus { outline: 2px solid var(--hp-accent); outline-offset: -1px; }
.hp-toc { overflow-y: auto; min-height: 0; }
.hp-toc ul { list-style: none; margin: 0; padding: 0; }
.hp-toc button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; cursor: pointer; }
.hp-toc button:hover { background: var(--hp-soft); }
.hp-toc li.on > button { background: color-mix(in srgb, var(--hp-accent) 12%, transparent); color: var(--hp-accent); font-weight: 600; }
.hp-sub { margin: 2px 0 6px 10px !important; border-left: 2px solid var(--hp-line); }
.hp-sub a { display: block; padding: 4px 10px; font-size: 13px; color: var(--hp-muted); text-decoration: none; }
.hp-sub a:hover { color: var(--hp-accent); }
.hp-hits button { display: flex; flex-direction: column; gap: 2px; }
.hp-hits span { font-size: 12px; color: var(--hp-muted); }
.hp-count, .hp-empty { margin: 4px 10px; font-size: 13px; color: var(--hp-muted); }
.hp mark { background: color-mix(in srgb, #ffd54f 70%, transparent); color: inherit; border-radius: 2px; }

.hp-main { overflow-y: auto; min-height: 0; padding: 20px 32px 40px; outline: 0; }
.hp-where { display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto 16px; padding: 10px 12px; border: 1px solid var(--hp-line); border-radius: 10px; background: var(--hp-soft); }
.hp-where[hidden], .hp-fallback[hidden] { display: none; }
.hp-where-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--hp-bg); color: var(--hp-accent); flex-shrink: 0; }
.hp-where-ic svg { width: 18px; height: 18px; }
.hp-where-t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.hp-where-t small { font-size: 12px; color: var(--hp-muted); }
.hp-go { padding: 7px 14px; border: 0; border-radius: 8px; background: var(--hp-accent); color: var(--hp-on-accent); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hp-fallback { max-width: 760px; margin: 0 auto 12px; font-size: 13px; color: var(--hp-muted); }
.hp-article { max-width: 760px; margin: 0 auto; line-height: 1.7; font-size: 15px; }
.hp-article h1 { font-size: 24px; margin: 0 0 12px; }
.hp-article h2 { font-size: 18px; margin: 28px 0 8px; padding-top: 4px; }
.hp-article h3 { font-size: 15px; margin: 18px 0 6px; }
.hp-article p, .hp-article ul, .hp-article ol { margin: 0 0 10px; }
.hp-article ul, .hp-article ol { padding-left: 22px; }
.hp-article code { padding: 1px 5px; border-radius: 4px; background: var(--hp-soft); font-size: 13px; }
.hp-article a { color: var(--hp-accent); }
.hp-tip { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--hp-accent); border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--hp-accent) 7%, transparent); font-size: 14px; }
.hp-article figure { margin: 12px 0 18px; }
.hp-article figure img { display: block; max-width: 100%; max-height: 460px; border: 1px solid var(--hp-line); border-radius: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.hp-article figcaption { margin-top: 6px; font-size: 12px; color: var(--hp-muted); }
.hp-pager { display: flex; justify-content: space-between; gap: 12px; max-width: 760px; margin: 32px auto 0; padding-top: 16px; border-top: 1px solid var(--hp-line); }
.hp-pager button { display: flex; flex-direction: column; gap: 2px; max-width: 48%; padding: 10px 14px; border: 1px solid var(--hp-line); border-radius: 10px; background: var(--hp-bg); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hp-pager .hp-next { margin-left: auto; text-align: right; }
.hp-pager small { font-size: 12px; color: var(--hp-muted); }
.hp-pager button:hover { border-color: var(--hp-accent); }

@media (max-width: 760px) {
  .hp { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .hp-toc-btn { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 8px 12px; border: 1px solid var(--hp-line); border-radius: 8px; background: var(--hp-bg); color: inherit; font: inherit; }
  .hp-toc-btn svg { width: 18px; height: 18px; }
  .hp-nav { display: none; border-right: 0; border-bottom: 1px solid var(--hp-line); }
  .hp.toc-open .hp-nav { display: flex; max-height: 60vh; }
  .hp.toc-open .hp-main { display: none; }
  .hp-main { padding: 14px 16px 32px; }
  .hp-article { font-size: 15px; }
  .hp-article figure img { max-height: 520px; }
  .hp-where { flex-wrap: wrap; }
}
