/* mdsite 主题「书口」。颜色、字号、间距、圆角只从下面的变量取。 */

:root {
  color-scheme: light;
  --paper: #FBFCFB;      /* 纸：底 */
  --ink: #1C2527;        /* 墨：正文 */
  --faded: #5A686A;      /* 淡墨：次要文字 */
  --rule: #DDE3E1;       /* 界：分隔、细边 */
  --green: #17695A;      /* 石绿：链接、当前位置 */
  --yellow: #F3D36B;     /* 雌黄：搜索命中、定位到的标题 */
  --edge: #F1F4F2;       /* 书口的底、代码块的底 */
  --shade-note: #F4F6F5; /* 提示块五档底色，由浅到深 */
  --shade-tip: #EAF2EF;
  --shade-important: #DCEBE6;
  --shade-warning: #E3E8E6;
  --shade-caution: #D3DBD9;
  --code-keyword: #1C2527;
  --code-string: #17695A;
  --code-number: #0E4F43;
  --code-comment: #5A686A;
  --code-name: #2E4B4A;
  --code-inserted: #0E4F43;
  --code-inserted-bg: #DCEBE6;
  --code-deleted: #4A5759;
  --code-deleted-bg: #E3E8E6;
  --shadow: 0 16px 48px rgb(28 37 39 / .22);
  --veil: rgb(21 25 26 / .4); /* 弹窗后面的遮罩 */

  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "Iowan Old Style", Georgia, "Microsoft YaHei", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Avenir Next", "Segoe UI Variable Text", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --s13: .8125rem;
  --s15: .9375rem;
  --s17: 1.0625rem;
  --s21: 1.3125rem;
  --s28: 1.75rem;
  --s38: 2.375rem;

  --r-small: 3px;
  --r-control: 6px;
  --r-dialog: 10px;

  --thumbs: 0px;
  --side: 248px;
  --measure: 42.5rem; /* 40 个汉字 */
}

/* 打印一律用浅色，所以深色只给 screen。两处深色的值必须一样（有测试）。 */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    color-scheme: dark;
    --paper: #15191A;
    --ink: #DCE2DF;
    --faded: #98A6A4;
    --rule: #2B3335;
    --green: #6EC7AC;
    --yellow: #6B5514;
    --edge: #1B2122;
    --shade-note: #1B2122;
    --shade-tip: #1A2826;
    --shade-important: #1D3530;
    --shade-warning: #2B3335;
    --shade-caution: #384245;
    --code-keyword: #DCE2DF;
    --code-string: #6EC7AC;
    --code-number: #A3DDCB;
    --code-comment: #98A6A4;
    --code-name: #B9D2CC;
    --code-inserted: #A3DDCB;
    --code-inserted-bg: #1D3530;
    --code-deleted: #B0BBB9;
    --code-deleted-bg: #2B3335;
    --shadow: 0 16px 48px rgb(0 0 0 / .6);
  }
}
@media screen {
  :root[data-scheme="dark"] {
    color-scheme: dark;
    --paper: #15191A;
    --ink: #DCE2DF;
    --faded: #98A6A4;
    --rule: #2B3335;
    --green: #6EC7AC;
    --yellow: #6B5514;
    --edge: #1B2122;
    --shade-note: #1B2122;
    --shade-tip: #1A2826;
    --shade-important: #1D3530;
    --shade-warning: #2B3335;
    --shade-caution: #384245;
    --code-keyword: #DCE2DF;
    --code-string: #6EC7AC;
    --code-number: #A3DDCB;
    --code-comment: #98A6A4;
    --code-name: #B9D2CC;
    --code-inserted: #A3DDCB;
    --code-inserted-bg: #1D3530;
    --code-deleted: #B0BBB9;
    --code-deleted-bg: #2B3335;
    --shadow: 0 16px 48px rgb(0 0 0 / .6);
  }
}

/* ---- 基础 ---- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--s17);
  line-height: 1.8;
  text-autospace: normal; /* 中西文之间留缝 */
}

a { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
main:focus { outline: none; }
html:not(.js) .needs-js { display: none; }
:where([role="list"]) { list-style: none; margin: 0; padding: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

kbd {
  font-family: var(--mono);
  font-size: var(--s13);
  line-height: 1;
  padding: 2px 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r-small);
}

.skip {
  position: fixed;
  top: -100px;
  left: 8px;
  z-index: 3;
  padding: 8px 16px;
  background: var(--green);
  color: var(--paper);
  border-radius: var(--r-control);
}
.skip:focus { top: 8px; }

/* ---- 版面 ---- */

.sheet {
  padding: 64px 32px 96px;
  margin: 0 auto;
  max-width: calc(var(--measure) + 64px);
}

[popover] {
  color: inherit;
  background: var(--paper);
  border: 0;
  margin: 0;
  padding: 0;
  inset: auto;
  width: auto;
  height: auto;
}

/* ---- 左侧：书口标签 + 目录 ---- */

.book { font-size: var(--s15); line-height: 1.6; }
.book-site, .book .chapter {
  font-family: var(--serif);
  font-size: var(--s21);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.book-site { color: var(--ink); text-decoration: none; }
.book .chapter { margin: 0 0 8px; }
.book .chapter > * { color: var(--ink); text-decoration: none; }

.book-search {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  color: var(--faded);
  text-align: start;
}

.tree li { margin: 0; }
.tree ul ul { margin-inline-start: 16px; }
.tree li > a, .tree li > span, .tree summary {
  display: block;
  padding: 4px 0;
  overflow-wrap: anywhere;
}
.tree a { color: var(--ink); text-decoration: none; }
.tree span { color: var(--faded); }
.tree a[aria-current="page"], .book .chapter > a[aria-current="page"] { color: var(--green); font-weight: 600; }
.tree summary { cursor: pointer; list-style: none; position: relative; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-start: 8px;
  border: solid var(--faded);
  border-width: 0 1px 1px 0;
  transform: translateY(-2px) rotate(-45deg);
}
.tree details[open] > summary::after { transform: translateY(-3px) rotate(45deg); }

.thumbs a { text-decoration: none; }

.scheme { border: 0; margin: 0; padding: 0; font-size: var(--s13); }
.scheme legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.scheme label { display: inline-block; cursor: pointer; }
.scheme input { position: absolute; opacity: 0; }
.scheme span { display: block; padding: 4px 8px; color: var(--faded); border-radius: var(--r-control); }
.scheme input:checked + span { color: var(--ink); background: var(--edge); }
.scheme input:focus-visible + span { outline: 2px solid var(--green); }

/* ---- 本页内容 ---- */

.outline { font-size: var(--s15); line-height: 1.5; }
.outline p { margin: 0 0 8px; color: var(--faded); font-size: var(--s13); }
.outline a { display: block; padding: 4px 0; color: var(--faded); text-decoration: none; overflow-wrap: anywhere; }
.outline .sub a { padding-inline-start: 16px; font-size: var(--s13); }
.outline a[aria-current] { color: var(--green); }

/* ---- 正文 ---- */

.body { overflow-wrap: break-word; }
.body > :first-child { margin-top: 0; }
.body :where(p, ul, ol, dl, blockquote, pre, .table, figure, details, aside) { margin: 0 0 20px; }
.body :where(ul, ol) { padding-inline-start: 1.6em; }
.body li > :is(ul, ol) { margin-bottom: 0; }
.body li { margin: 4px 0; }
.body li > p { margin-bottom: 8px; }
.body li::marker { color: var(--faded); font-variant-numeric: tabular-nums; }
.body dt { font-weight: 600; }
.body dd { margin: 0 0 8px 1.6em; }

.body :is(h1, h2, h3, h4, h5, h6) {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.4;
  margin: 48px 0 16px;
  scroll-margin-top: 32px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.body h1 { font-size: var(--s38); line-height: 1.25; margin-bottom: 32px; }
.body h2 { font-size: var(--s28); }
.body h3 { font-size: var(--s21); margin-top: 32px; }
.body :is(h4, h5, h6) { font-family: var(--sans); font-weight: 600; margin: 24px 0 8px; }
.body h4 { font-size: var(--s17); }
.body :is(h5, h6) { font-size: var(--s15); }
.body h6 { color: var(--faded); }
.body :is(h2, h3, h4) + :is(h3, h4, h5) { margin-top: 16px; }

.body .anchor { text-decoration: none; font-weight: 400; }
.body .anchor::before { content: "§"; padding-inline-start: 8px; color: var(--faded); opacity: 0; }
.body :is(:hover, :target) > .anchor::before, .body .anchor:focus-visible::before { opacity: 1; }

.body :is(h1, h2, h3, h4, h5, h6, li):target {
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow);
  color: var(--ink);
}
.body :is(h1, h2, h3, h4, h5, h6, li):target a { color: inherit; }
.body :is(h1, h2, h3, h4, h5, h6):target .anchor::before { color: var(--ink); }

.body a { text-decoration-thickness: 1px; text-underline-offset: 4px; }
.body a:hover { text-decoration-thickness: 2px; }
.body :is(strong, b) { font-weight: 600; }
.body mark { color: inherit; background: var(--shade-important); }
.body hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }
.body :is(img, video, svg, iframe) { max-width: 100%; }
.body :is(img, video) { height: auto; }
.body figcaption { color: var(--faded); font-size: var(--s15); }
.body blockquote { margin-inline: 2em 0; font-family: var(--serif); }
.body blockquote > :last-child, .body aside > :last-child, .body td > :last-child { margin-bottom: 0; }
.body summary { cursor: pointer; }
.body sup { line-height: 0; }
.body sup a { text-decoration: none; padding: 0 2px; }
.body :is(del, s) { color: var(--faded); }

.body li.task { list-style: none; }
.body li.task > input, .body li.task > p > input { margin: 0 8px 0 -1.5em; width: 1em; accent-color: var(--green); }

/* 代码 */
.body :is(code, kbd, samp) { text-autospace: no-autospace; }
.body code, .body samp { font-family: var(--mono); font-size: .88em; }
.body :not(pre) > code { background: var(--edge); padding: 2px 4px; border-radius: var(--r-small); overflow-wrap: anywhere; }
.body code.whole { white-space: nowrap; }
.body pre { background: var(--edge); overflow: auto; padding: 16px 20px; line-height: 1.65; tab-size: 4; }
.body pre code { font-size: var(--s15); }
.code { position: relative; }
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  font-size: var(--s13);
  color: var(--faded);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  opacity: 0;
}
.code:hover > .copy, .copy:focus-visible, .copy.done { opacity: 1; }
.copy:hover { color: var(--ink); }
@media (hover: none) {
  .copy { opacity: 1; }
  .code > pre { padding-top: 48px; }
}
.t-k { color: var(--code-keyword); font-weight: 600; }
.t-s { color: var(--code-string); }
.t-n { color: var(--code-number); }
.t-c { color: var(--code-comment); }
.t-f { color: var(--code-name); }
.t-i, .t-d { display: inline-block; min-width: 100%; }
.t-i { color: var(--code-inserted); background: var(--code-inserted-bg); }
.t-d { color: var(--code-deleted); background: var(--code-deleted-bg); }

/* 表格：三线表 */
.body .table { overflow-x: auto; }
.body table {
  border-collapse: collapse;
  border-block: 2px solid var(--ink);
  width: max-content;
  min-width: 100%;
  font-size: var(--s15);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.body :is(th, td) { padding: 8px 16px 8px 0; max-width: 22em; vertical-align: top; }
.body :is(th, td):last-child { padding-inline-end: 0; }
.body th { font-weight: 600; border-bottom: 1px solid var(--ink); }
.body th:not([align]) { text-align: start; }
.body tr + tr td { border-top: 1px solid var(--rule); }

/* 提示块：靠标题和底色深浅区分 */
.body .note { --faded: var(--ink); padding: 16px 20px; } /* 深底上淡墨不够清楚 */
.body .note::before { display: block; font-weight: 600; font-size: var(--s15); margin-bottom: 4px; }
.body .note :not(pre) > code { background: none; padding: 0; }
.body .note pre { background: var(--paper); }
.body .note-note { background: var(--shade-note); }
.body .note-tip { background: var(--shade-tip); }
.body .note-important { background: var(--shade-important); }
.body .note-warning { background: var(--shade-warning); }
.body .note-caution { background: var(--shade-caution); }
.body .note-note::before { content: "Note"; }
.body .note-tip::before { content: "Tip"; }
.body .note-important::before { content: "Important"; }
.body .note-warning::before { content: "Warning"; }
.body .note-caution::before { content: "Caution"; }
:root:lang(zh) .note-note::before { content: "【说明】"; }
:root:lang(zh) .note-tip::before { content: "【提示】"; }
:root:lang(zh) .note-important::before { content: "【重要】"; }
:root:lang(zh) .note-warning::before { content: "【注意】"; }
:root:lang(zh) .note-caution::before { content: "【当心】"; }
:root:lang(zh) .body .note::before { margin-inline-start: -.5em; }

/* 脚注号紧跟前面的字，不落到下一行行首（U+2060 不许断行） */
.body .footnote-ref { text-autospace: no-autospace; }
.body .footnote-ref::before { content: "\2060"; }
.body .footnotes { margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: var(--s15); }
.body .footnotes hr { display: none; }

.turn {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.turn a { min-width: 0; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.turn a:hover { color: var(--green); }
.turn span { display: block; font-family: var(--sans); font-weight: 400; font-size: var(--s13); color: var(--faded); }
.turn-next { margin-inline-start: auto; text-align: end; }

/* ---- 搜索 ---- */

.search {
  width: min(640px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 128px));
  margin: 96px auto 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-dialog);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
  line-height: 1.6;
}
.search[open] { display: flex; flex-direction: column; }
.search::backdrop { background: var(--veil); }
html:has(dialog.search[open]) { overflow: hidden; }
.search-box { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--rule); }
.search-box input { flex: 1; min-width: 0; height: 56px; padding: 0; font: inherit; font-size: var(--s17); color: inherit; background: none; border: 0; outline: 0; }
.search-box input::placeholder { color: var(--faded); opacity: 1; }
.search-close { display: none; color: var(--green); font-size: var(--s15); }
.search-note { display: flex; gap: 16px; padding: 8px 20px; font-size: var(--s13); color: var(--faded); }
.search-note p { margin: 0; overflow-wrap: anywhere; }
.search-retry { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }
.search-hits { overflow-y: auto; overscroll-behavior: contain; }
.search-hits a { display: block; padding: 8px 20px; color: inherit; text-decoration: none; font-size: var(--s15); overflow-wrap: anywhere; }
.search-hits a[aria-selected="true"] { background: var(--shade-tip); }
.search-hits .where { display: block; font-weight: 600; }
.search-hits .where span { font-weight: 400; color: var(--faded); }
.search-hits .where span::before { content: "／"; }
.search-hits .snippet { display: block; font-size: var(--s13); color: var(--faded); }
.search-hits mark { background: var(--yellow); color: var(--ink); }
.search-keys { display: flex; gap: 20px; margin: 0; padding: 8px 20px; border-top: 1px solid var(--rule); font-size: var(--s13); color: var(--faded); }
.search-keys span { display: flex; gap: 4px; align-items: center; }

/* ---- 窄屏：顶栏 + 抽屉 ---- */

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  font-size: var(--s15);
}
.bar button { min-height: 44px; padding: 0 8px; white-space: nowrap; color: var(--green); }
.bar-site {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

@media not all and (min-width: 1000px) {
  .sheet { padding: 32px 20px 64px; }
  .body :is(h1, h2, h3, h4, h5, h6) { scroll-margin-top: 72px; }
  .body h1 { font-size: var(--s28); margin-bottom: 24px; }
  .body h2 { font-size: var(--s21); margin-top: 40px; }
  .body h3 { font-size: var(--s17); }
  .body blockquote { margin-inline-start: 1em; }

  .book { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); max-height: none; height: 100%; padding: 16px 20px 32px; overflow-y: auto; overscroll-behavior: contain; border-inline-end: 1px solid var(--rule); }
  .book:not(:popover-open) { display: none; }
  .book::backdrop { background: var(--veil); }
  html:has(.book:popover-open) { overflow: hidden; }
  .book-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 12px; margin-bottom: 20px; }
  .book-search { grid-column: 1 / -1; height: 44px; order: 3; }
  .book-search kbd { display: none; }
  .book-close { min-height: 32px; color: var(--green); }
  .tree li > a, .tree li > span, .tree summary { padding: 8px 0; }

  .thumbs > li { border-top: 1px solid var(--rule); }
  .thumbs > li:last-child { border-bottom: 1px solid var(--rule); }
  .thumbs > li > a { display: block; padding: 12px; margin-inline: -12px; font-family: var(--serif); font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
  .thumbs > .on > a { background: var(--green); color: var(--paper); }
  .thumbs .tree { padding: 8px 0 16px; }
  .thumbs .tree .chapter { display: none; }
  .scheme { margin: 24px -8px 0; }
  .scheme span { padding: 8px; }

  .outline { position: fixed; inset: 56px 8px auto auto; width: min(320px, calc(100vw - 16px)); max-height: calc(100vh - 72px); overflow-y: auto; padding: 16px 20px; border: 1px solid var(--rule); border-radius: var(--r-control); }
  .outline:not(:popover-open) { display: none; }
  .outline a { padding: 8px 0; }
}

@media not all and (min-width: 600px) {
  .search { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .search-close { display: block; min-height: 44px; }
  .search-keys { display: none; }
}

/* 没有 popover 的老浏览器：目录直接排在页首，本页内容不列 */
@supports not selector(:popover-open) {
  .bar-menu, .bar-outline, .book-close { display: none; }
  @media not all and (min-width: 1000px) {
    .book { display: block; position: static; width: auto; height: auto; }
    .outline { display: none; }
  }
}

/* ---- 宽屏 ---- */

@media (min-width: 1000px) {
  body { padding-inline-start: calc(var(--thumbs) + var(--side)); }
  body.tabbed { --thumbs: 60px; }

  .book { display: block; position: fixed; inset: 0 auto 0 0; width: calc(var(--thumbs) + var(--side)); height: 100vh; overflow: hidden; }
  .book-head { position: absolute; inset: 0 0 auto var(--thumbs); height: 140px; padding: 0 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; }
  .book-site { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .book-close { display: none; }
  .book .tree { position: absolute; inset: 164px 0 56px var(--thumbs); overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 16px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .book .scheme { position: absolute; inset: auto 0 0 var(--thumbs); height: 56px; padding: 12px 16px; }

  /* 书口：标签从上到下排开，三级一组错落，像词典切口 */
  .thumbs { /* 不能定位：里面的 .tree 要以 .book 为准 */
    width: var(--thumbs);
    height: 100%;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--edge);
    border-inline-end: 1px solid var(--rule);
    overflow: hidden;
  }
  .thumbs > li { display: flex; flex: 0 1 auto; min-height: 48px; max-height: 240px; }
  .thumbs > li > a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    writing-mode: vertical-rl;
    overflow: hidden;
    padding: 20px 0;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-right: 0;
    border-radius: var(--r-control) 0 0 var(--r-control);
    font-family: var(--serif);
    font-size: var(--s17);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 2px;
    white-space: nowrap;
  }
  .thumbs > li > a > span { min-height: 0; overflow: hidden; text-overflow: ellipsis; }
  .thumbs:has(> li:nth-child(8)) > li > a { padding: 8px 0; font-size: var(--s15); letter-spacing: 1px; }
  .thumbs > li:nth-child(3n + 1) { margin-left: 4px; }
  .thumbs > li:nth-child(3n + 2) { margin-left: 12px; }
  .thumbs > li:nth-child(3n) { margin-left: 20px; }
  .thumbs > li > a:hover { color: var(--green); }
  .thumbs > li.on { margin-left: 0; }
  .thumbs > li.on > a { background: var(--green); border-color: var(--green); color: var(--paper); }

  /* 正文贴着目录，不居中：纸装订在左边 */
  .sheet { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(0, 220px); gap: 72px; padding: 96px 48px 160px 56px; margin: 0; max-width: none; }

  .outline { display: block; position: sticky; top: 112px; align-self: start; max-height: calc(100vh - 160px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .bar { display: none; }
}

/* 放不下右栏：本页内容收进右上角的按钮 */
@media (min-width: 1000px) and (max-width: 1319px) {
  .sheet { display: block; max-width: calc(var(--measure) + 104px); }
  .bar { display: block; position: fixed; inset: 16px 16px auto auto; height: auto; padding: 0; border: 0; background: none; }
  .bar > :not(.bar-outline) { display: none; }
  .bar-outline { background: var(--paper); }
  .outline { position: fixed; inset: 64px 16px auto auto; width: 280px; max-height: calc(100vh - 88px); padding: 16px 20px; border: 1px solid var(--rule); border-radius: var(--r-control); }
  .outline:not(:popover-open) { display: none; }
  @supports not selector(:popover-open) { .outline { display: none; } }
}

@media (min-width: 1000px) and (max-height: 759px) {
  .thumbs { padding-block: 8px; }
  .thumbs:has(> li:nth-child(8)) > li > a { padding: 4px 0; font-size: var(--s13); letter-spacing: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  button:active { transform: translateY(1px); }
}

/* ---- 打印 ---- */

@media print {
  .bar, .book, .outline, .turn, .copy, .skip, .search, .anchor { display: none !important; }
  body { padding: 0; font-size: 11pt; line-height: 1.6; }
  .sheet { display: block; padding: 0; max-width: none; }
  .body :is(h1, h2, h3, h4, h5, h6) { break-after: avoid; }
  .body h1 { font-size: 22pt; }
  .body h2 { font-size: 16pt; }
  .body h3 { font-size: 13pt; }
  .body :is(pre, .note, tr, img) { break-inside: avoid; }
  .body pre { white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--rule); }
  .body table { width: 100%; }
  .body :is(th, td) { max-width: none; }
  .body :target { background: none !important; box-shadow: none !important; }
  .body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; overflow-wrap: anywhere; }
  .body .note { border: 1px solid var(--rule); }
}
