/* 天宫Pro 使用教程 · 站点样式
   设计目标：文档型阅读体验，浅色为主、可切深色；深色截图嵌在柔和画框里；
   金色点缀呼应软件品牌；GIF 自动播放、图片点击放大。 */

:root {
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --fg: #1f2329;
  --fg-soft: #5b6472;
  --line: #e4e7ec;
  --brand: #b8862b;
  --brand-soft: #f3e6c7;
  --accent: #2f6feb;
  --code-bg: #0f1420;
  --figure-bg: #12161f;
  --tip-bg: #eef7ee;
  --tip-line: #4caf6d;
  --warn-bg: #fdf3e7;
  --warn-line: #e0912f;
  --radius: 12px;
  --maxw: 860px;
  --sidebar-w: 288px;
  --shadow: 0 2px 12px rgba(20, 24, 33, .06);
}
html[data-theme="dark"] {
  --bg: #0e1117;
  --bg-elev: #161b23;
  --fg: #e6e9ef;
  --fg-soft: #9aa4b2;
  --line: #262d38;
  --brand: #d7a94a;
  --brand-soft: #3a3016;
  --shadow: 0 2px 14px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 线性图标基样式 ---------- */
.ico { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -.18em; flex: 0 0 auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 18px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; }
.topbar .brand .logo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 1px var(--line); flex: 0 0 auto; }
.topbar .brand small { color: var(--fg-soft); font-weight: 500; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--fg);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px;
}
.topbar button:hover { border-color: var(--brand); color: var(--brand); }
.topbar a.site-link {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--fg);
  border-radius: 8px; padding: 6px 10px; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.topbar a.site-link:hover { border-color: var(--brand); color: var(--brand); }
.menu-toggle { display: none; }

/* ---------- 产品切换器 ---------- */
details.switcher { position: relative; }
details.switcher > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--fg);
  border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 600;
}
details.switcher > summary::-webkit-details-marker { display: none; }
details.switcher > summary:hover { border-color: var(--brand); color: var(--brand); }
details.switcher .caret { width: 14px; height: 14px; opacity: .6; margin-left: 2px; }
details.switcher .menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 60;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20, 24, 33, .18); padding: 6px;
}
details.switcher .menu .opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 11px; border-radius: 8px; text-decoration: none; color: var(--fg); font-size: 14.5px;
}
details.switcher .menu .opt:hover { background: var(--bg); }
details.switcher .menu .opt.cur { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
details.switcher .menu .pn em { font-style: normal; color: var(--fg-soft); font-weight: 500; margin-left: 6px; font-size: 12.5px; }
details.switcher .menu .tag { font-size: 12px; color: var(--fg-soft); white-space: nowrap; }
details.switcher .menu .tag.cur { color: var(--brand); font-weight: 700; }

/* ---------- 布局 ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: 56px; flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w); max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 22px 16px 60px; border-right: 1px solid var(--line);
}
.sidebar h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--fg-soft); margin: 18px 8px 8px; }
.sidebar a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--fg-soft); text-decoration: none; font-size: 14.5px; }
.sidebar a:hover { background: var(--bg); color: var(--fg); }
.sidebar a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar a .num { opacity: .6; font-variant-numeric: tabular-nums; margin-right: 6px; }
.sidebar a.pending { opacity: .45; }
.sidebar .toc-sub a { font-size: 13.5px; padding-left: 22px; }

.content { flex: 1 1 auto; min-width: 0; padding: 40px 32px 120px; }
article.page { max-width: var(--maxw); margin: 0 auto; }

/* ---------- 正文排版 ---------- */
.crumb { color: var(--fg-soft); font-size: 14px; margin-bottom: 6px; }
.crumb a { color: var(--fg-soft); text-decoration: none; }
.crumb a:hover { color: var(--brand); }
h1.title { font-size: 32px; line-height: 1.3; margin: 4px 0 10px; letter-spacing: .5px; }
.lead { font-size: 18px; color: var(--fg-soft); margin: 0 0 28px; }
h2 { font-size: 23px; margin: 44px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); scroll-margin-top: 72px; }
h3 { font-size: 18.5px; margin: 30px 0 10px; scroll-margin-top: 72px; }
p { margin: 14px 0; }
a.link { color: var(--accent); }
strong { color: var(--fg); }
kbd { background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }

ul.list, ol.steps { padding-left: 22px; }
ul.list li, ol.steps li { margin: 8px 0; }
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li {
  position: relative; padding: 12px 14px 12px 52px; margin: 10px 0;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
ol.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 14px; top: 12px; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}

/* ---------- 提示框 ---------- */
.callout { border-radius: 10px; padding: 14px 16px 14px 46px; margin: 18px 0; position: relative; border: 1px solid var(--line); }
.callout .ci { position: absolute; left: 14px; top: 14px; width: 19px; height: 19px; }
.callout.tip { background: var(--tip-bg); border-color: color-mix(in srgb, var(--tip-line) 40%, var(--line)); }
.callout.tip .ci { color: var(--tip-line); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn-line) 40%, var(--line)); }
.callout.warn .ci { color: var(--warn-line); }
.callout.note { background: var(--bg-elev); }
.callout.note .ci { color: var(--accent); }
.callout .ct { font-weight: 700; margin-right: 4px; }

/* ---------- 图形 ---------- */
figure.shot { margin: 22px 0; }
figure.shot .frame {
  background: var(--figure-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow); overflow: hidden;
}
figure.shot img { display: block; width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
figure.shot figcaption { margin-top: 10px; color: var(--fg-soft); font-size: 14px; text-align: center; }
figure.shot figcaption .badge { display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 1px 10px; font-size: 12px; margin-right: 8px; font-weight: 600; }
figure.shot.gif .frame { position: relative; }
figure.shot .miss { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 160px; color: var(--fg-soft); font-size: 14px; }
figure.shot .miss .ico { width: 20px; height: 20px; }
figcaption .badge .ico { width: 12px; height: 12px; vertical-align: -.12em; margin-right: 3px; }
.gif-badge { position: absolute; right: 18px; top: 18px; display: inline-flex; align-items: center; gap: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 6px; pointer-events: none; z-index: 2; }
.gif-badge .ico { width: 12px; height: 12px; }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; background: var(--bg-elev); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
table.tbl th, table.tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { background: var(--bg); font-weight: 700; color: var(--fg); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td.k { white-space: nowrap; font-weight: 600; color: var(--brand); }

/* 40 维总表：板块分组条 */
.dim-board { margin: 26px 0 8px; font-weight: 700; color: var(--fg); display: flex; align-items: center; gap: 10px; }
.dim-board .bi { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px; }
.dim-board .rng { color: var(--fg-soft); font-weight: 500; font-size: 13px; }

/* ---------- 页脚翻页 ---------- */
.pager { max-width: var(--maxw); margin: 60px auto 0; display: flex; justify-content: space-between; gap: 16px; }
.pager a { flex: 1; text-decoration: none; color: var(--fg); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.pager a:hover { border-color: var(--brand); }
.pager a .dir { color: var(--fg-soft); font-size: 13px; }
.pager a .tt { font-weight: 700; margin-top: 2px; }
.pager a.next { text-align: right; }

/* ---------- 首页章节卡 ---------- */
.hero { text-align: center; padding: 30px 0 10px; }
.hero .hero-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 6px 22px rgba(20, 24, 33, .14), 0 0 0 1px var(--line); margin-bottom: 14px; }
.hero h1 { font-size: 36px; margin: 0 0 10px; }
.hero p { color: var(--fg-soft); font-size: 18px; max-width: 640px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin: 36px 0; }
.card { display: block; text-decoration: none; color: var(--fg); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card .cn { font-size: 13px; color: var(--brand); font-weight: 700; letter-spacing: .5px; }
.card .ch { font-size: 19px; font-weight: 700; margin: 6px 0; }
.card .cd { color: var(--fg-soft); font-size: 14px; min-height: 40px; }
.card .st { margin-top: 12px; font-size: 12.5px; }
.card .st .pill { padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.card .st .pill.plan { background: var(--bg); color: var(--fg-soft); }
.card.pending { opacity: .72; }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(8,10,14,.9); display: none; align-items: center; justify-content: center; z-index: 100; padding: 30px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lightbox .lb-close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 30px; cursor: pointer; background: none; border: none; }

/* ---------- 全站版权页脚 ---------- */
.site-foot { text-align: center; padding: 26px 16px 40px; border-top: 1px solid var(--line); color: var(--fg-soft); font-size: 13.5px; line-height: 2; }
.site-foot a { color: var(--fg-soft); text-decoration: none; }
.site-foot a:hover { color: var(--brand); }

/* ---------- 首页二维码页脚 ---------- */
.qr-footer { margin-top: 64px; padding-top: 30px; border-top: 1px solid var(--line); text-align: center; }
.qr-footer .qr-title { font-size: 15px; color: var(--fg-soft); letter-spacing: .5px; margin-bottom: 20px; }
.qr-list { display: flex; gap: 40px; justify-content: center; flex-wrap: wrap; }
.qr { margin: 0; }
.qr img { width: 152px; height: 152px; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: contain; box-shadow: var(--shadow); padding: 6px; }
.qr figcaption { margin-top: 10px; font-size: 14px; color: var(--fg-soft); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .menu-toggle { display: inline-block; }
  .sidebar { position: fixed; left: 0; top: 56px; z-index: 39; background: var(--bg-elev); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: translateX(0); }
  .content { padding: 28px 18px 100px; }
  h1.title { font-size: 26px; }
}
