/* 格式工坊 —— 样式
   取舍：系统字体、无渐变、无玻璃拟态、无 emoji；用边框与留白建立层次。
   亮暗主题靠 <html data-theme>，与系统偏好联动（首屏由 app.mjs 决定）。
   CSP 里 style-src 'self'：所有样式都在本文件，页面里没有 style 属性。 */

:root {
  --bg: #fafaf9;
  --panel: #ffffff;
  --panel-2: #f4f5f6;
  --ink: #17191c;
  --muted: #63676f;
  --line: #e3e4e8;
  --line-strong: #cfd1d7;
  --accent: #2b56c8;
  --accent-ink: #ffffff;
  --accent-soft: #eef1fb;
  --ok: #1d7a4d;
  --bad: #b3261e;
  --warn: #8a5a00;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 18, 22, .06), 0 8px 24px -18px rgba(16, 18, 22, .35);
  /* 鼠标划选文字的高亮：默认那层深蓝太抢眼，这里改成"淡一层的墨色"——
     用当前主题的文字色兑透明，亮色下是一层浅灰，暗色下是一层浅光，
     所以不需要给两套主题各写一条硬编码色值。 */
  --select: color-mix(in srgb, var(--ink) 12%, transparent);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1013;
  --panel: #15181d;
  --panel-2: #1a1e24;
  --ink: #e6e8ec;
  --muted: #9aa1ac;
  --line: #262a31;
  --line-strong: #333944;
  --accent: #6b8dff;
  --accent-ink: #0e1013;
  --accent-soft: #1c2437;
  --ok: #5cc98d;
  --bad: #ff8b82;
  --warn: #e2b155;
  /* 暗色下同样的浓度会显得偏淡（背景本身就暗），所以调高到 22% —— 
     目标是"看得出选了什么"，又不至于把字盖掉。 */
  --select: color-mix(in srgb, var(--ink) 22%, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

/* 鼠标划选文字的高亮色（每个页面都生效，包括输入框、代码块、表格）。
   文字颜色不动（inherit）：选区是背景装饰，不该让正在读的字换色。 */
::selection {
  background: var(--select);
  color: inherit;
}
/* 老版 Firefox 只认带前缀的写法 */
::-moz-selection {
  background: var(--select);
  color: inherit;
}

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.shell { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: var(--accent); }

.skip {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.skip:focus { left: 1rem; top: 1rem; z-index: 40; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }

.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.topbar-actions { display: flex; align-items: center; gap: .25rem; }

/* 模块导航：四个对等模块之间的平级链接（不是下拉菜单 —— 菜单会把对等关系藏起来） */
.modnav { display: none; align-items: center; gap: .15rem; }
.modnav-link {
  padding: .3rem .55rem; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; text-decoration: none; white-space: nowrap;
}
.modnav-link:hover { background: var(--panel-2); color: var(--ink); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: transparent; color: var(--ink);
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); }

.lang-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px; margin: 0; padding: .25rem;
  list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 30;
}
.menu button, .menu a {
  display: block; width: 100%; padding: .45rem .6rem; text-align: left;
  background: transparent; color: var(--ink); border: 0; border-radius: var(--radius-sm);
  font: inherit; cursor: pointer; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--panel-2); }
.menu button.active, .menu a[aria-current] { color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- 引导区 */

main { padding: 2.25rem 0 3rem; }

.intro h1 { margin: 0 0 .5rem; font-size: clamp(24px, 3.4vw, 32px); font-weight: 660; letter-spacing: -.01em; }
.lead { margin: 0 0 1.1rem; color: var(--muted); max-width: 46ch; }

.trust { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.trust li { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: 13px; }
.trust .ic { width: 15px; height: 15px; color: var(--accent); }

/* ---------------------------------------------------------------- 面板 / 拖放区 */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }

.drop {
  display: grid; place-items: center; gap: .35rem; padding: 2.5rem 1.25rem;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--panel-2); text-align: center; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-ic { width: 26px; height: 26px; color: var(--accent); }
.drop-title { margin: .35rem 0 0; font-weight: 600; }
.drop-hint { margin: 0 0 .9rem; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; font: inherit; font-size: 13.5px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.small { padding: .35rem; }
.btn[hidden] { display: none; }

/* ---------------------------------------------------------------- 队列 */

#queueWrap { margin-top: 1rem; }

.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
/* 标题分两档，每档只有一个值（量过再写，不要各写各的）：
     内容分节标题 17px / 620 —— 阅读区的层级
     界面标题 15px / 620     —— 控件区（如队列面板），不参与阅读节奏
     内容小节标题（h3）15px / 620 —— 与界面标题同字号，但出现在阅读区里，上下间距更大 */
.queue-head h2 { margin: 0; font-size: 15px; font-weight: 620; }
.queue-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* 选项栏：按【分组】排，组内自适应网格。以前所有选项挤在一条 flex 长龙里
   （宽屏乱、窄屏一团），用户反馈「排列太挤、布局也不 ok」。 */
.options { display: grid; gap: 1.05rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.opt-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); gap: .75rem 1.4rem; align-items: start; }
.opt-group > h3 { grid-column: 1 / -1; margin: 0; font-size: 11.5px; font-weight: 620; color: var(--muted); }
.opt { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; font-size: 12.5px; color: var(--muted); min-width: 0; }
.opt select { width: 100%; min-width: 0; }
.opt.is-muted { opacity: .45; }
/* 互斥说明行：横跨整组，跟在被停用的那一项下面 */
.opt-note { grid-column: 1 / -1; margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.opt select, .opt input[type="color"] {
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .2rem .35rem;
}
.opt input[type="range"] { accent-color: var(--accent); }
.opt em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 3ch; }
/* 手输的数字项：像素、体积上限、自定义采样率这些都能自己填，
   所以给足够宽的输入框 + 等宽数字，保证「填进去的值」和「生效的值」一眼可对 */
.opt-num { display: inline-flex; align-items: center; gap: .3rem; }
.opt-num .opt-input {
  width: 6.6ch;
  padding: .28rem .45rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  background: var(--bg-soft, transparent);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.opt-num .opt-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.opt-num .opt-input.is-clamped { border-color: var(--warn); }
.opt-num em { color: var(--muted); }
/* 分组之后数字框占满单元格，单位跟在后面 */
.opt .opt-num { width: 100%; }
.opt .opt-num .opt-input { width: auto; flex: 1 1 auto; min-width: 4.5rem; text-align: left; }
/* 维护页：把「什么时候好」放在最显眼的位置，其余信息做成一张尺子般的表 */
.maint { max-width: 760px; }
.maint-badge {
  display: inline-block;
  margin: 0 0 .6rem;
  padding: .22rem .6rem;
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.maint-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .6rem 1.1rem;
  margin: 1.1rem 0 .2rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.maint-meta div { min-width: 0; }
.maint-meta dt { font-size: 12px; color: var(--muted); margin-bottom: .18rem; }
.maint-meta dd { margin: 0; font-size: 14px; color: var(--ink); word-break: break-word; }
.maint-actions { margin: 1rem 0 .3rem; }
.maint-auto { font-size: 12.5px; margin: .2rem 0 .9rem; }
/* 彩蛋：没在维护时被打开 —— 一句轻松的话说明「站点没事，你是自己走过来的」，
   做成一条安静的左侧色条，不跟真正的维护公告抢注意力 */
.maint-idle-note {
  margin: 0 0 1rem;
  padding: .7rem .95rem;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* 错误页：把用户实际访问的地址摆出来，好让他自己判断是拼错了还是真没这页 */
.err-from {
  margin: .7rem 0 0;
  padding: .45rem .7rem;
  display: inline-block;
  max-width: 100%;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--bg-soft, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  word-break: break-all;
}

.items { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; max-height: 52vh; overflow: auto; }

.item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 116px minmax(118px, 190px) auto;
  align-items: center; gap: .75rem;
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
}
.item[data-status="failed"] { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.item-icon { color: var(--muted); display: grid; place-items: center; }
.item-text { display: flex; flex-direction: column; min-width: 0; }
.item-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--muted); font-size: 12px; display: inline-flex; gap: .4rem; }
.sep::before { content: "·"; }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none; width: 100%; padding: .3rem 1.5rem .3rem .5rem; font: inherit; font-size: 13px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer;
}
.select select:disabled { color: var(--muted); cursor: default; }
.select .ic { position: absolute; right: .4rem; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }

.item-progress { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.bar { display: block; height: 4px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .18s linear; }
.item-status { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-status.bad { color: var(--bad); }
.item[data-status="done"] .bar i { background: var(--ok); }

.item-actions { display: inline-flex; gap: .25rem; justify-content: flex-end; }
.item-actions .btn { color: var(--muted); }
.item-actions .btn:hover { color: var(--ink); }
.item[data-status="done"] .download { color: var(--accent); }

/* ---------------------------------------------------------------- 格式矩阵 / FAQ */

.formats, .faq { margin-top: 2.5rem; }
.formats h2, .faq h2 { margin: 0 0 .85rem; font-size: 17px; font-weight: 620; }

.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th, .matrix td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.matrix thead th { color: var(--muted); font-weight: 500; font-size: 12px; }
.matrix th[scope="row"] { width: 34%; color: var(--muted); font-weight: 500; }
.tag {
  display: inline-block; margin: 0 .3rem .3rem 0; padding: .1rem .45rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
}

.faq details { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.faq summary { cursor: pointer; font-weight: 550; }
.faq summary::marker { color: var(--muted); }
/* FAQ 回答不卡列宽：62ch 的容器里会把一句话硬挤成两行，末行只剩两三个字，
   看起来像“被截断”，用户实测反馈（常见问题部分） */
.faq p { margin: .55rem 0 0; color: var(--muted); max-width: none; text-wrap: pretty; }

/* ---------------------------------------------------------------- 多页站点的分节 */

.crumbs { margin: .35rem 0 1.1rem; font-size: 12.5px; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: 13px; }
.chips .ic { width: 15px; height: 15px; color: var(--ok); }

/* 四个内容分节共用一套排版：都强调「读得下去」，不靠颜色堆砌
   规范：
     1) 分节之间 2.5rem（顶间距）
     2) 一级标题 17px / 620；二级标题 15px / 620 且上间距 1.6rem
     3) 提示语固定用 .muted（13px，紧贴标题）
     4) 链接列表统一走同一个栅格与行高，不另起一套 */
.facts, .steps, .related, .popular, .groups, .glossary { margin-top: 2.5rem; }
.facts h2, .steps h2, .related h2, .popular h2, .groups h2, .glossary h2 { margin: 0 0 .85rem; font-size: 17px; font-weight: 620; }
.facts h3, .groups h3, .popular h3 { margin: 1.6rem 0 .35rem; font-size: 15px; font-weight: 620; }

.facts-list, .steps-list, .popular-list, .pair-list { margin: 0; padding: 0; list-style: none; }
.facts-list li, .steps-list li { position: relative; padding: .3rem 0 .3rem 1.5rem; max-width: 78ch; }
.facts-list li::before {
  content: ""; position: absolute; left: .35rem; top: .95rem;
  width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong);
}

.steps-list li { counter-reset: none; }
.steps-list .num {
  position: absolute; left: 0; top: .25rem;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 620;
}

/* 内链列表：图标 + 标签，网格排开（手机上一列、桌面两列） */
.related-list, .popular-list, .pair-list, .module-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .3rem .9rem; }
.related-list a, .popular-list a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .5rem;
  border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 13.5px;
}
.related-list a:hover, .popular-list a:hover { background: var(--panel-2); }
.related-list .ic, .popular-list .ic { color: var(--muted); }

/* 分节里的小标题：与上面两个小标题同字号、同间距，只是不能再抢主标题的份量 */
.section-sub { color: var(--ink); }

/* 索引页的转换对卡片：一行一个组合，名字加粗、说明淡一点 */
.pair-list a {
  display: block; padding: .55rem .6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: inherit; text-decoration: none;
}
.pair-list a:hover { border-color: var(--line-strong); background: var(--panel-2); }
.pair-list .ic { color: var(--accent); margin-right: .4rem; vertical-align: -3px; }
.pair-name { font-weight: 600; }
.pair-note { display: block; margin: .2rem 0 0 1.7rem; color: var(--muted); font-size: 12.5px; }
.popular .muted { margin: -.35rem 0 .85rem; }
.glossary .matrix th[scope="row"] { width: 22%; font-family: var(--mono); font-size: 12px; color: var(--ink); }

.more { margin: 1rem 0 0; }
.link { display: inline-flex; align-items: center; gap: .35rem; font-size: 13.5px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link .ic { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- 本机保管区 */

.vault { margin-top: 2.5rem; }
.vault h2 { margin: 0 0 .85rem; font-size: 17px; font-weight: 620; }
.vault-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 .35rem; }
.vault .muted { max-width: 100%; margin: .35rem 0 .45rem; text-wrap: pretty; }
.switch { display: inline-flex; align-items: center; gap: .4rem; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--accent); }
.vault-bar { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 .1rem; }
.vault-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 清空是个有后果的动作，别只当成一行灰字：给它描边，让它一眼看出是能按的 */
.vault-bar .btn { border: 1px solid var(--line-strong); background: var(--panel); }
.vault-list { margin: .35rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.vault-item {
  display: flex; align-items: center; gap: .75rem;
  /* 上内边距比下边多留 3px：叠起来时被压住的是这段留白，文字不会被盖掉 */
  padding: .82rem .8rem .6rem; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel);
  transition: transform .14s ease, box-shadow .14s ease;
}
/* 多条时叠成一小摞：后一张盖住前一张的底边（12px < 上内边距，压不到文字），
   再加一层浅投影，让「盖住」这件事看得出来 —— 否则看着只是挤在一堆。 */
.vault-list.is-stack .vault-item { box-shadow: 0 1px 2px rgba(16, 18, 22, .05); }
.vault-list.is-stack .vault-item + .vault-item { margin-top: -12px; }
/* 鼠标移上去或键盘 Tab 进去，那张就抬起来 —— 不然一堆卡片里分不清自己在看哪张。 */
.vault-list.is-stack .vault-item:hover,
.vault-list.is-stack .vault-item:focus-within {
  position: relative; z-index: 2; transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.vault-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.vault-name { font-weight: 550; overflow-wrap: anywhere; }
.vault-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.vault-actions { display: inline-flex; gap: .3rem; flex: 0 0 auto; }

/* hidden 属性必须真的生效。
   浏览器默认样式是 [hidden] { display: none }，但它的优先级低于任何作者规则 ——
   只要写过 .stats { display: flex }，hidden 就形同虚设（统计板会空着显示、
   选项栏会留一条多余的横线）。这一句是整站唯一的兜底，别再往各组件里补。 */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 右上角统计小面板 */

/* 小小的一个：图标 + 「今日」 + 数字（+ 宽屏时的截止时间）。
   信息全量放在 title 与 aria-label 里，鼠标停上去能看到「今日已转换 N 个文件；数据截止 HH:MM」。*/
.stat-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .55rem; margin-right: .15rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--muted);
  font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stat-pill .ic { width: 14px; height: 14px; color: var(--muted); }
.stat-pill b { color: var(--ink); font-weight: 620; font-size: 13px; }
.stat-pill .stat-asof { color: var(--muted); }
/* 窄屏只留图标与数字：顶栏空间要留给品牌与两个按钮 */
@media (max-width: 720px) {
  .stat-pill .stat-label, .stat-pill .stat-asof { display: none; }
}

/* ---------------------------------------------------------------- 滚动条 */

/* 自定义滚动条，跟随主题（原本只能拿到系统默认的白底灰块，暗色下很刺眼）。
   Chromium/Safari 用 ::-webkit-scrollbar；Firefox 用 scrollbar-width/color —— 两套都写。*/
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  border: 2px solid transparent; border-radius: 999px; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink) 52%, transparent); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* 锚点跳转后标题会被固定顶栏遮住（实测 headingTop=0 而 topbarBottom=59），
   给所有锚点目标与整页滚动都留出顶栏高度：目录点击、hash 直链、scrollIntoView 三条路径都覆盖。*/
html { scroll-padding-top: 4.6rem; }
[id] { scroll-margin-top: 4.6rem; }

/* 段落末行只剩两三个字（孤儿行）在中文里特别碍眼。两个根因一起治：
   ① 额外的 max-width 把列宽卡窄（FAQ 62ch、隐私 70ch、提示块 88ch）→ 那些限制已去掉；
   ② 浏览器默认断行不避讳孤儿 → 交给 text-wrap: pretty（Chromium 117+ 生效，其它浏览器自动忽略）。*/
p, li, dd, dt, summary, figcaption, blockquote { text-wrap: pretty; }

/* ---------------------------------------------------------------- 接入 API 页面 */

/* 文档页的骨架：左边贴住的本页目录 + 右边的正文。
   长文档里「我在哪、怎么跳」比什么都重要，所以目录不是装饰而是结构。 */
.api-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 2.5rem; margin-top: 2.5rem; align-items: start; }

.api-nav { position: sticky; top: 4.5rem; font-size: 13px; }
.api-nav-title { margin: 0 0 .6rem; color: var(--muted); font-size: 12px; font-weight: 620; letter-spacing: .02em; }
.api-nav nav { display: flex; flex-direction: column; gap: .1rem; }
.api-nav a {
  display: block; padding: .3rem .5rem; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow-wrap: anywhere;
}
.api-nav a:hover { color: var(--ink); background: var(--panel-2); }
.api-nav a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); background: var(--panel-2); font-weight: 550; }
.api-nav-base { margin: 1rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.api-nav-base span { display: block; margin-bottom: .2rem; }
.api-nav-base code { font-family: var(--mono); font-size: 11.5px; color: var(--ink); overflow-wrap: anywhere; }

.api-main { min-width: 0; }
/* 每一节都跟其它页面同一条节奏：2.5rem 起头、17px/620 的标题（见 docs/排版规范.md） */
.api-section { margin-top: 2.5rem; }
.api-section:first-child { margin-top: 0; }
.api-section > h2 { margin: 0 0 .85rem; font-size: 17px; font-weight: 620; scroll-margin-top: 4.5rem; }
.api-section h3 { margin: 1.6rem 0 .5rem; font-size: 15px; font-weight: 620; }
.api-section > p { max-width: none; margin: .35rem 0; text-wrap: pretty; }
.api-section strong { font-weight: 620; }

/* 标题右侧的 # 锚点：平时藏着，鼠标移到这一节才出现 */
.anchor {
  margin-left: .4rem; color: var(--muted); text-decoration: none; font-weight: 400;
  opacity: 0; transition: opacity .12s ease;
}
.api-section h2:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }

/* 提示块：左侧一条色带 + 极淡底色，读起来是「备注」而不是「正文」 */
.callout {
  margin: 1rem 0; padding: .7rem .85rem;
  border-left: 3px solid var(--line-strong); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--panel); font-size: 13.5px;
}
.callout p { margin: .2rem 0; max-width: none; text-wrap: pretty; }
.callout.info { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.callout.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.callout.ok { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }

/* 端点卡片：方法徽章 + 等宽路径 + 一句话 */
.endpoint-list { margin: 1rem 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.endpoint {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .7rem;
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
}
.endpoint .method {
  flex: 0 0 auto; min-width: 3.6rem; text-align: center;
  padding: .15rem .4rem; border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 620; letter-spacing: .03em;
}
.endpoint .method.post { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.endpoint .method.get { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.endpoint .path { font-family: var(--mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.endpoint .endpoint-note { color: var(--muted); font-size: 13px; flex: 1 1 16ch; min-width: 0; }

/* 代码块与复制按钮 */
.code { margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.code figcaption {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .4rem .7rem; border-bottom: 1px solid var(--line); background: var(--panel-2);
  font-size: 12.5px; color: var(--muted);
}
.code.bare figcaption { justify-content: flex-end; }
.code pre { margin: 0; padding: .8rem .9rem; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; color: var(--ink); }
.copy-btn { flex: 0 0 auto; }
/* 复制成功：按钮自己变色并改字，颜色一变就说明「这次点到了」 */
.copy-btn[data-copied="1"] {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

/* 语言页签：同一件事只占一块面积，想换写法点一下 */
.code-tabs { margin: 1rem 0; }
.tablist { display: flex; flex-wrap: wrap; gap: .1rem; border-bottom: 1px solid var(--line); }
.tablist .tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: .45rem .7rem; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--muted);
  font-family: var(--mono); font-size: 12.5px;
}
.tablist .tab:hover { color: var(--ink); }
.tablist .tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.code-tabs .code { margin: .85rem 0 0; }

/* ---- 试一下面板 ---- */
.try-panel { margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.try-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.try-field { display: inline-flex; align-items: center; gap: .45rem; font-size: 12.5px; color: var(--muted); }
.try-status {
  margin-left: auto; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
  padding: .15rem .5rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
}
.try-status[data-state="ok"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.try-status[data-state="failed"] { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

.try-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.try-box { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.try-box + .try-box { border-left: 1px solid var(--line); }
.try-box-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .7rem; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line);
}
.try-count { font-variant-numeric: tabular-nums; }

/* 输入框一律【固定高度】+ 内部滚动条（用户明确要求：不要让框跟着内容长高） */
.try-box textarea {
  resize: none; overflow-y: auto;
  scrollbar-gutter: stable;
  width: 100%; height: 240px; min-height: 240px; max-height: 240px;
  padding: .6rem .7rem; border: 0; outline: none;
  /* 输入区得看得出来是个输入区：给底色与内描边，
     否则亮色主题下它跟面板是同一片白，“输入框”根本看不见边界 */
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 65%, transparent);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: var(--ink);
}
.try-box textarea:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.try-box textarea:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.api-output {
  margin: 0; padding: .6rem .7rem; height: 240px; min-height: 240px; max-height: 240px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: transparent;
}
.api-output[data-empty="1"] { color: var(--muted); }
.api-output[data-empty="1"]::before { content: attr(data-placeholder); }

.api-errors .matrix th[scope="row"] { font-family: var(--mono); font-size: 12px; width: 26%; }
.api-section .matrix code { font-family: var(--mono); font-size: 12px; }

/* 窄屏：目录从侧栏变成顶部一条可横向滑动的条目，正文占满 */
@media (max-width: 980px) {
  .api-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .api-nav { position: static; }
  .api-nav nav { flex-direction: row; overflow-x: auto; gap: .25rem; padding-bottom: .35rem; }
  .api-nav a { border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--radius-sm); white-space: nowrap; }
  .api-nav a[aria-current="true"] { border-left-color: transparent; border-bottom-color: var(--accent); }
  .api-nav-base { display: none; }
  .try-grid { grid-template-columns: minmax(0, 1fr); }
  .try-box + .try-box { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------------------------------------------------------------- 页脚 / 提示 */

.footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2.5rem; margin-top: 1rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-left { display: inline-flex; align-items: center; gap: .6rem; font-size: 13px; color: var(--muted); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.friend { display: inline-flex; align-items: center; gap: .4rem; font-size: 13px; text-decoration: none; }
.friend:hover { text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
.privacy { margin: 1rem 0 0; max-width: none; text-wrap: pretty; }

/* 宽度够的时候才展开头部模块导航：窄屏硬塞会挤掉品牌与语言按钮 */
@media (min-width: 860px) {
  .modnav { display: flex; }
}

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, .5rem);
  max-width: min(560px, calc(100% - 2rem));
  padding: .55rem .9rem; font-size: 13px;
  background: var(--ink); color: var(--bg); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); opacity: 0; transition: opacity .18s, transform .18s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- 窄屏 */

@media (max-width: 720px) {
  .shell { width: calc(100% - 1.5rem); }
  .item { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "icon text actions" "prog prog prog"; row-gap: .5rem; }
  .item-icon { grid-area: icon; }
  .item-text { grid-area: text; }
  .item-progress { grid-area: prog; }
  .item-actions { grid-area: actions; }
  .select { grid-column: 2 / 4; width: 100%; }
  .select select { width: 100%; }
  .options { gap: .6rem 1rem; }
  .queue-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
