/* ==== 共用外壳 shell 开始｜真源 tools/site-shell/shell.css，勿在此改；改完跑 node tools/sync_site_shell.mjs ==== */
/* 子站共用外壳样式：腧穴／中药／方剂三站 styles.css 同一份；各站专用样式写在本区块之后。 */

:root {
  --font-book: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3efe4;
  --page: #fdfcf8;
  --surface: #f7f4eb;
  --ink: #1e1c18;
  --ink2: #48433a;
  --ink3: #756e62;
  --line: rgba(30, 28, 24, 0.13);
  --line-soft: rgba(30, 28, 24, 0.07);
  --line-strong: rgba(30, 28, 24, 0.28);
  --accent: #7b4b12;
  --accent-soft: rgba(123, 75, 18, 0.08);
  --cinnabar: #962b21;
  --topbar-bg: rgba(253, 252, 248, 0.97);
  --g-glass: rgba(253, 252, 248, 0.80);
  --g-edge: rgba(30, 28, 24, 0.10);
  --g-t: rgba(30, 28, 24, 0.52);
  --g-t-hi: rgba(30, 28, 24, 0.85);
  --g-on: rgba(30, 28, 24, 0.08);
  --g-on-t: #1e1c18;
  --g-field: rgba(30, 28, 24, 0.035);
  --g-field-edge: rgba(30, 28, 24, 0.12);
  --g-hover: rgba(30, 28, 24, 0.06);
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 42px rgba(30, 28, 24, 0.18);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0d10;
  --page: #14161c;
  --surface: #1b1e26;
  --ink: #ece8df;
  --ink2: #c5bfb4;
  --ink3: #8e887d;
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.24);
  --accent: #dbb960;
  --accent-soft: rgba(219, 185, 96, 0.12);
  --cinnabar: #e07b6d;
  --topbar-bg: rgba(20, 22, 28, 0.96);
  --g-glass: rgba(22, 25, 33, 0.80);
  --g-edge: rgba(255, 255, 255, 0.12);
  --g-t: rgba(236, 232, 223, 0.64);
  --g-t-hi: rgba(236, 232, 223, 0.92);
  --g-on: rgba(255, 255, 255, 0.15);
  --g-on-t: #fff;
  --g-field: rgba(255, 255, 255, 0.07);
  --g-field-edge: rgba(255, 255, 255, 0.13);
  --g-hover: hsla(0, 0%, 100%, 0.08);
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.font-book {
  font-family: var(--font-book);
}

.font-ui {
  font-family: var(--font-ui);
}

/* ── Topbar ──
   20261202：与主站同一套。外层只管吸顶、不画底条；第一行＝四站切换＋深浅钮，与主站同宽、同位、同字号，
   四站来回切换时顶栏不横跳；第二行是本站搜索。页顶无框，下滑过 80px 才淡入毛玻璃胶囊（app.js 加 is-scrolled）；
   往下读时第二行换成阅读条（见文末「阅读条与章节左栏」）。 */
.topbar {
  position: sticky;
  top: calc(8px + env(safe-area-inset-top));
  z-index: 46;
  margin-top: 8px;
  pointer-events: none;
}

.topbar::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(34px + env(safe-area-inset-top));
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--page) 0%,
    var(--page) calc(10px + env(safe-area-inset-top)),
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.35s ease-in-out;
}

.topbar.is-scrolled::before {
  opacity: 1;
}

.topbar-inner {
  --spring: cubic-bezier(0.22, 0.8, 0.32, 1);
  pointer-events: auto;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 4px;
  align-items: center;
  max-width: min(100vw - 32px, 588px);
  margin: 0 auto;
  padding: 4px 0;
  border: 1px solid transparent;
  border-radius: 22px;
  transition: max-width 0.6s var(--spring), padding 0.6s var(--spring);
}

@supports (transition-timing-function: linear(0, 1)) {
  .topbar-inner {
    --spring: linear(0, 0.09, 0.261, 0.435, 0.582, 0.698, 0.785, 0.848, 0.894, 0.926, 0.949, 0.964, 0.975, 0.983, 0.988, 0.992, 1);
  }
}

.topbar-inner::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  border: 1px solid var(--g-edge);
  background: var(--g-glass);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  backdrop-filter: blur(16px) saturate(135%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease-in-out, visibility 0.4s;
}

.topbar.is-scrolled .topbar-inner {
  max-width: min(100vw - 32px, 560px);
  padding: 4px 6px 6px;
}

.topbar.is-scrolled .topbar-inner::before {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease-in-out, visibility 0s;
}

:root[data-theme="dark"] .topbar.is-scrolled .topbar-inner::before {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
}

:root[data-theme="light"] .topbar.is-scrolled .topbar-inner::before {
  box-shadow: 0 6px 20px rgba(30, 28, 24, 0.07);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar-inner::before {
    background: var(--topbar-bg);
  }
}

.top-left,
.top-right {
  display: contents;
}

.site-seg {
  grid-row: 1;
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  border-radius: 100px;
  font-size: 13px;
}

.site-seg-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  color: var(--g-t);
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

a.site-seg-item:hover {
  color: var(--g-t-hi);
  background: var(--g-hover);
}

.site-seg-item.active {
  background: var(--g-on);
  color: var(--g-on-t);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: default;
}

.site-seg-item.active.is-clickable {
  cursor: pointer;
}

.site-seg-item.active.is-clickable:hover {
  color: var(--accent);
}

.site-seg-sep {
  display: none;
}

#themeBtn {
  grid-row: 1;
  grid-column: 2;
  justify-self: end;
  width: 30px;
  height: 30px;
  margin-right: 3px;
  border: 0;
  background: transparent;
  color: var(--g-on-t);
}

#themeBtn:hover {
  background: var(--g-hover);
  color: var(--g-on-t);
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 14px;
  border-radius: 100px;
  border: 1px solid var(--g-field-edge);
  background: var(--g-field);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.search-input::placeholder {
  color: var(--ink3);
}

@media (max-width: 430px) {
  .site-seg {
    padding: 0;
  }
  .site-seg-item {
    padding: 0 6px;
    font-size: 12px;
  }
  #themeBtn {
    width: 28px;
    margin-right: 0;
  }
}

.search-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink3);
}

.search-more-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  text-align: center;
}

.search-more-btn:hover {
  background: var(--accent-soft);
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink2);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.14s, color 0.14s, background-color 0.14s;
}

.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Main Layout ── */
.main-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 14px 36px;
}

.load-banner {
  max-width: 760px;
  margin: 24px auto;
  padding: 18px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--ink2);
  text-align: center;
}

.load-banner.err {
  color: var(--cinnabar);
  text-align: left;
  line-height: 1.7;
}

/* 20261202：整页「大纸框」（底色、边线、圆角、投影）已拆，正文直接落在页面上 */
.toc-page {
  max-width: 1020px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.chapter-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 24px 40px;
}

.chapter-top-nav {
  margin: -8px 0 10px;
}

.back-toc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--ink3);
  transition: color 0.14s;
}

.back-toc-link:hover {
  color: var(--accent);
}

.book-head {
  text-align: center;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.book-kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink3);
  margin-bottom: 4px;
}

.book-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.toc-chapter {
  margin-bottom: 26px;
}

.toc-ch-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.toc-ch-btn {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.toc-ch-btn:hover {
  color: var(--accent);
}

.toc-ch-count {
  font-size: 12px;
  color: var(--ink3);
}

.toc-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.toc-col-left {
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.toc-col-right {
  padding-left: 18px;
}

.toc-row-wrap {
  display: flex;
  flex-direction: column;
}

.toc-row-wrap + .toc-row-wrap {
  border-top: 1px solid var(--line-soft);
}

.toc-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 5px 8px;
  border-radius: 5px;
  text-align: left;
  transition: background-color 0.12s;
}

.toc-entry:hover {
  background: var(--accent-soft);
}

.toc-main {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.5;
}

.toc-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  border-radius: 4px;
  text-align: left;
  font-size: 14px;
  transition: background-color 0.12s;
}

.toc-item:hover {
  background: var(--accent-soft);
}

.toc-name {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.toc-entry .toc-name {
  font-size: 14.5px;
  font-weight: 600;
}

.toc-entry .toc-name:not(:last-child) {
  margin-right: 7px;
}

.toc-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--line-strong);
  margin: 0 2px;
  transform: translateY(-3px);
  min-width: 14px;
}

.toc-eff {
  font-size: 12.5px;
  color: var(--ink2);
}

/* ── Chapter Prose & Herb Monograph ── */
.overview-sec {
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.book-prose {
  margin: 0;
  line-height: 1.88;
  font-size: 15px;
  color: var(--ink2);
}

.book-prose + .book-prose {
  margin-top: 6px;
}

.indent-2em {
  text-indent: 2em;
}

.prose-k {
  font-weight: 700;
  color: var(--ink);
}

.cinnabar {
  font-weight: 700;
  color: var(--cinnabar);
}

.sec-block {
  margin-bottom: 36px;
  scroll-margin-top: calc(112px + env(safe-area-inset-top));
}

.sec-jump-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.sec-jump-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  font-size: 12px;
  line-height: 1.5;
  transition: border-color 0.14s, color 0.14s, background-color 0.14s;
}

.sec-jump-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.toc-item.is-kb-active {
  background: var(--accent-soft);
  outline: 1px solid var(--accent);
}

.sec-heading {
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.sec-intro {
  margin-bottom: 20px;
}

.mono-entry {
  padding: 2px 0;
  scroll-margin-top: calc(112px + env(safe-area-inset-top));
}

.mono-entry + .mono-entry {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 24px;
}

@keyframes hl-flash {
  0%,
  30% {
    background: var(--accent-soft);
  }
  100% {
    background: transparent;
  }
}

.mono-name {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.mono-meta {
  font-size: 12.5px;
  color: var(--ink3);
}

.mono-apps {
  margin-top: 6px;
}

.mono-refs {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink3);
}

.mono-refs summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-block;
}

.mono-refs summary::-webkit-details-marker {
  display: none;
}

.mono-refs summary:hover {
  color: var(--accent);
}

.mono-ref-row + .mono-ref-row {
  margin-top: 4px;
}

.chapter-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* 手机上章名一长，「上一章／返回目录／下一章」三钮一行放不下，下一章会被挤出屏：
   ≤640 宽改成上一章、下一章各占一行（各自靠左／靠右，名字过长可在钮内折行），返回目录居中放最后一行 */
@media (max-width: 640px) {
  .chapter-pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .chapter-pager > :first-child {
    grid-row: 1;
    justify-self: start;
  }
  .chapter-pager > :last-child {
    grid-row: 2;
    justify-self: end;
  }
  .chapter-pager > span:empty {
    display: none;
  }
  .chapter-pager > [data-goto-view="toc"] {
    grid-row: 3;
    justify-self: center;
  }
  .chapter-pager > [data-open-ch] {
    max-width: 100%;
    height: auto;
    min-height: 30px;
    padding: 6px 10px;
    white-space: normal;
    line-height: 1.45;
  }
  .chapter-pager > [data-open-ch]:first-child {
    justify-content: flex-start;
    text-align: left;
  }
  .chapter-pager > [data-open-ch]:last-child {
    justify-content: flex-end;
    text-align: right;
  }
}

.site-footer {
  max-width: 880px;
  margin: 22px auto 0;
  padding-bottom: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--ink3);
}

.site-footer-fb {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 12px;
}

.site-footer a {
  color: var(--ink2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.back-top-btn {
  position: fixed;
  right: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--topbar-bg);
  color: var(--ink2);
  font-size: 16px;
  line-height: 1;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.14s, color 0.14s, transform 0.14s;
}

.back-top-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* 新版已接管本页（SW controllerchange）时的底部提示：不挡操作、可关；左右各让出 68px 避开返回顶部按钮 */
.update-bar {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 46;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 136px);
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--topbar-bg);
  color: var(--ink2);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.update-bar-go {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.update-bar-x {
  border: 0;
  background: none;
  color: var(--ink2);
  opacity: 0.6;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

body.has-audio-dock .update-bar {
  bottom: calc(74px + env(safe-area-inset-bottom));
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .toc-grid-2 {
    grid-template-columns: 1fr;
  }
  .toc-col-left {
    padding-right: 0;
    border-right: 0;
  }
  .toc-col-right {
    padding-left: 0;
  }
  .toc-col-right .toc-row-wrap:first-child {
    border-top: 1px solid var(--line-soft);
  }
}

/* ── 阅读条与章节左栏（20261202；逻辑见 app.js「顶栏毛玻璃、阅读条与章节左栏」） ──
   手机／平板（<1280）：往下读时顶栏第二行的搜索框换成「当前条目 · 章 · 节」＋原声钮，点名字回到条目开头，
   一往上滑搜索框立刻回来；目录页这一行换成可横滑的章节条，当前章高亮。
   电脑（≥1280）：左侧固定一列章节，章节页里当前章展开列出本章条目，读到哪条亮哪条；搜索框始终保留。 */
.read-strip {
  display: none;
  grid-row: 2;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 34px;
  padding: 0 4px 0 14px;
  border-radius: 100px;
  border: 1px solid var(--g-field-edge);
  background: var(--g-field);
}

.topbar.is-reading .read-strip {
  display: flex;
  animation: rs-in 0.22s ease-out;
}

@keyframes rs-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.rs-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.rs-name {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.rs-ctx {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--g-t);
}

/* 目录页：章节横条 */
.read-strip.is-chips {
  gap: 0;
  padding: 0 3px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.read-strip.is-chips::-webkit-scrollbar {
  display: none;
}

.rs-chip {
  flex: 0 0 auto;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  font-size: 13px;
  line-height: 26px;
  color: var(--g-t);
  white-space: nowrap;
}

.rs-chip.on {
  background: var(--g-on);
  color: var(--g-on-t);
}

.rs-chip:first-child {
  margin-left: 6px;
}

.rs-chip:last-child {
  margin-right: 6px;
}

/* 电脑左栏 */
.side-nav {
  display: none;
}

@media (min-width: 1280px) {
  .toc-page {
    max-width: 880px;
  }
  .side-nav {
    --snw: min(188px, calc((100vw - 880px) / 2 - 40px));
    display: block;
    position: fixed;
    z-index: 5;
    top: 112px;
    left: max(16px, calc(50% - 440px - 24px - var(--snw)));
    width: var(--snw);
    max-height: calc(100vh - 136px);
    overflow: auto;
    scrollbar-width: none;
    font-size: 13px;
    line-height: 1.35;
  }
  .side-nav::-webkit-scrollbar {
    display: none;
  }
}

.sn-a,
.sn-e {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sn-a {
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--g-t);
}

.sn-a:hover {
  color: var(--g-t-hi);
  background: var(--g-hover);
}

.sn-a.on {
  background: var(--g-on);
  color: var(--g-on-t);
}

.sn-sub {
  margin: 3px 0 8px 12px;
  border-left: 1px solid var(--line);
}

.sn-sec {
  padding: 8px 10px 2px;
  font-size: 11.5px;
  color: var(--g-t);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sn-e {
  width: calc(100% + 1px);
  margin-left: -1px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: var(--g-t);
}

.sn-e:hover {
  color: var(--g-t-hi);
}

.sn-e.on {
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

@media print {
  .topbar::before,
  .read-strip,
  .update-bar,
  .side-nav {
    display: none !important;
  }
}
/* ==== 共用外壳 shell 结束 ==== */

/* ── 以下为本站专用样式 ── */

body.modal-open {
  overflow: hidden;
}

.quick-search-wrap {
  position: relative;
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
}

.search-drop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 300px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--page);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 45;
}

/* 腧穴站第二行：搜索框右边跟「分类」 */
#meridianBtn {
  grid-row: 2;
  grid-column: 2;
  height: 34px;
  padding: 0 14px;
  border-radius: 100px;
  border: 1px solid var(--g-field-edge);
  background: var(--g-field);
  color: var(--g-t-hi);
  font-size: 13px;
}

.mini-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.toc-sec-title {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.toc-meta {
  font-size: 12px;
  color: var(--ink3);
  white-space: nowrap;
}

.toc-entry .toc-meta {
  flex: 0 0 auto;
  text-align: right;
}

.appendix-box {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.appendix-summary {
  cursor: pointer;
  user-select: none;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink2);
  list-style: none;
}

.appendix-summary::-webkit-details-marker {
  display: none;
}

.appendix-summary:hover {
  color: var(--accent);
}

.appendix-hint {
  margin: 6px 0 12px;
  font-size: 12.5px;
  color: var(--ink3);
}

/* 20261202：选中条目到达时金底闪一下、约 1.8 秒淡掉，只留左侧一道细金线（不再整条金底金框常亮） */
.mono-entry.is-hl {
  margin-left: -14px;
  padding-left: 12px;
  box-shadow: inset 2px 0 0 var(--accent);
  animation: hl-flash 1.8s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .mono-entry.is-hl {
    animation: none;
  }
}

.mono-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.mono-sec-effs {
  color: var(--ink3);
}

.mono-refs-body {
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
  line-height: 1.68;
}

.mono-ref-tag {
  font-weight: 600;
  color: var(--ink2);
  margin-right: 4px;
}

.cross-note {
  margin: 22px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink3);
  line-height: 1.7;
}

.cross-link {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 600;
  color: var(--ink2);
  text-decoration: underline dotted var(--line-strong);
  text-underline-offset: 3px;
}

.cross-link:hover {
  color: var(--accent);
}

.pt-inline-link {
  border: 0;
  background: transparent;
  padding: 0 1px;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline dotted var(--line-strong);
  text-underline-offset: 3px;
}

.pt-inline-link:hover {
  text-decoration-style: solid;
}

/* ── Modal ── */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--page);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.is-wide {
  max-width: 960px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.close-btn {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink3);
}

.close-btn:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
}

.browse-mode-bar {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  margin-bottom: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  gap: 2px;
}

.browse-mode-btn {
  border: 0;
  background: transparent;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink3);
  transition: background-color 0.14s, color 0.14s;
}

.browse-mode-btn:hover {
  color: var(--ink);
}

.browse-mode-btn.is-active {
  background: var(--ink);
  color: var(--page);
  font-weight: 600;
}

.spec-sub-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
}

.tab-cnt {
  font-size: 11px;
  opacity: 0.72;
}

.toc-code {
  display: inline-block;
  margin-left: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink3);
  white-space: nowrap;
}

.toc-spec-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}

.toc-entry .toc-code:not(:last-child),
.toc-entry .toc-spec-tag:not(:last-child) {
  margin-right: 6px;
}

.meridian-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.meridian-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 8px;
}

.meridian-sub {
  font-size: 12.5px;
  color: var(--ink3);
}

.meridian-list {
  max-height: 52vh;
  overflow-y: auto;
  padding-top: 2px;
}

.chart-frame {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: auto;
  max-height: 60vh;
  padding: 8px;
}

:root[data-theme="dark"] .chart-frame {
  background: #161922;
}

:root[data-theme="dark"] .chart-frame.is-raw {
  background: #ffffff;
}

:root[data-theme="dark"] .chart-frame:not(.is-raw) .chart-svg-img {
  filter: invert(0.91) hue-rotate(180deg) brightness(0.96) contrast(0.95);
}

.chart-svg-img {
  display: block;
  width: 100%;
  height: auto;
}

.chart-svg-img.is-zoomed {
  width: auto;
  max-width: none;
}

/* ── Acupoint Atlas Trigger & Modal ── */
.atlas-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.14s, color 0.14s, background-color 0.14s;
}

.atlas-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.atlas-trigger svg {
  flex: 0 0 auto;
  color: var(--cinnabar);
}

.appendix-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.appendix-meta-text {
  font-size: 12.5px;
  color: var(--ink3);
}

.modal-card.is-atlas {
  max-width: 500px;
  max-height: 92vh;
}

.atlas-loc {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink2);
}

.atlas-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.atlas-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 5 / 6;
  max-height: 54vh;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #ffffff;
}

:root[data-theme="dark"] .atlas-stage {
  background: #1c2028;
}

.atlas-stage.is-plate {
  aspect-ratio: auto;
  max-width: 460px;
  max-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 6px;
}

:root[data-theme="dark"] .atlas-stage.is-plate {
  background: #f4f1ea;
}

.atlas-plate-img {
  display: block;
  max-width: 100%;
  max-height: calc(62vh - 12px);
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.atlas-mer-tag {
  font-size: 12px;
  color: var(--ink3);
}

.atlas-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.atlas-nav-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  transition: border-color 0.14s, color 0.14s, background-color 0.14s;
}

.atlas-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.atlas-note {
  max-width: 460px;
  margin: 8px auto 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink3);
  text-align: center;
}

.atlas-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 460px;
  margin: 8px auto 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.atlas-attr {
  font-size: 11px;
  color: var(--ink3);
  opacity: 0.82;
}

.atlas-goto-btn {
  border: 0;
  background: transparent;
  padding: 2px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}

.atlas-goto-btn:hover {
  text-decoration: underline;
}

@media (max-width: 680px) {
  .toc-entry {
    padding: 7px 6px;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .modal-layer {
    padding: 8px;
  }
  .modal-head {
    padding: 10px 12px;
  }
  .modal-body {
    padding: 10px 12px 12px;
  }
}

@media print {
  .topbar,
  .chapter-top-nav,
  .chapter-pager,
  .site-footer,
  .modal-layer,
  .back-top-btn {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .book-page {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

/* ── 20261202 骨架看齐主站：手机排版（拆纸框后正文直接贴页边距） ── */
@media (max-width: 640px) {
  .main-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
  .toc-page,
  .chapter-page {
    padding-left: 0;
    padding-right: 0;
  }
  .mono-entry.is-hl {
    margin-left: -10px;
    padding-left: 8px;
  }
}

.topbar.is-reading .quick-search-wrap,
.topbar.is-reading #meridianBtn {
  display: none;
}
