:root {
  color-scheme: light;
  --paper: #faf9f3;
  --surface: #f1f1e6;
  --surface-strong: #e8ebdc;
  --ink: #292d24;
  --muted: #6b715e;
  --accent: #536137;
  --accent-strong: #35461f;
  --line: #dfe3d3;
  --gloss: #65714f;
  --reader-size: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1d211b;
  --surface: #252b21;
  --surface-strong: #333d2b;
  --ink: #e2e4d8;
  --muted: #b1b8a5;
  --accent: #bfcc9d;
  --accent-strong: #dde6c8;
  --line: #3d4835;
  --gloss: #b8c4a0;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.7; }
a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button, select, input[type="search"] { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
button, select { min-height: 38px; }
button { padding: 5px 11px; cursor: pointer; }
button:hover { background: var(--surface-strong); }
button:disabled { opacity: .4; cursor: default; }
select { padding: 5px 28px 5px 9px; max-width: 100%; }
input[type="search"] { width: 100%; min-height: 44px; padding: 9px 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.js-control { display: none; }
.js-ready .js-control { display: inline-flex; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 100; padding: 10px 18px; background: var(--paper); border: 2px solid var(--accent); }
.skip-link:focus { top: 10px; }

.site-header { position: sticky; top: 0; z-index: 30; min-height: 68px; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1440px; min-height: 68px; margin: auto; padding: 12px 32px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand strong { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.header-links { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 18px; font-size: 13px; }
.header-links a { text-decoration: none; }
#menu-toggle { display: none; }
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.sidebar { position: sticky; top: 69px; align-self: start; height: calc(100dvh - 69px); overflow-y: auto; overscroll-behavior: contain; padding: 26px 22px 36px 32px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.sidebar-title { margin: 0 0 12px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.sidebar h2, .sidebar h3 { margin: 23px 0 8px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .14em; }
.sidebar h2:first-child, .sidebar h3:first-child { margin-top: 0; }
.book-list { list-style: none; padding: 0; margin: 0; }
.book-list li { margin: 1px 0; }
.book-list a { display: block; border-radius: 3px; padding: 4px 10px; color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.7; }
.book-list a:hover { background: var(--surface); color: var(--accent-strong); }
.book-list a[aria-current], .book-list .active > a { color: var(--accent-strong); background: var(--surface-strong); font-weight: 600; }
.book-list small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; font-size: 12px; color: var(--muted); }
.sidebar-footer a { display: inline-block; margin-bottom: 7px; }
.menu-backdrop { display: none; }

.page { min-width: 0; max-width: 1056px; width: 100%; padding: 40px 48px 80px; }
.page-heading { margin: 0 auto 30px; max-width: 760px; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .15em; margin: 0 0 10px; }
.breadcrumb { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.breadcrumb a { text-decoration: none; }
h1, h2, h3 { text-wrap: pretty; }
h1 { font-family: var(--serif); font-size: clamp(29px, 3.5vw, 38px); font-weight: 600; line-height: 1.5; margin: 0 0 12px; letter-spacing: .035em; }
h1 small { display: block; font: 14px/1.8 var(--sans); color: var(--muted); letter-spacing: 0; margin-top: 8px; }
.lead, .subtitle { color: var(--muted); font-size: 15px; max-width: 680px; margin: 12px 0 0; }
.lead p { margin: 10px 0; }
.edition-label { display: inline-block; font-size: 12px; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin-bottom: 16px; }
.notice { background: var(--surface); border-left: 3px solid var(--line); padding: 13px 17px; margin: 24px 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.notice p { margin: 0 0 .65em; }
.notice p:last-child { margin-bottom: 0; }
.reading-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 26px 0; font-size: 13px; }
.reading-tools label { display: inline-flex; align-items: center; gap: 6px; }
.reading-tools .tool-group { display: inline-flex; align-items: center; gap: 6px; }
.reading-tools .font-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }
.reading-tools #book-select { max-width: 205px; }
#font-status { font-size: 12px; color: var(--muted); min-width: 2em; text-align: center; }
.section-links { display: flex; flex-wrap: wrap; gap: 22px; font-size: 14px; margin: 0 0 28px; }
.section-links a { text-decoration: none; }

.reader { max-width: 760px; margin: 0 auto; font-size: var(--reader-size); }
.scripture { font-family: var(--serif); line-height: 1.95; }
.reader .paragraph { margin: 0 0 1.95em; overflow-wrap: anywhere; }
.reader .verse-number { display: inline; font: 600 .64em/1.5 var(--sans); color: var(--muted); padding-right: .48em; vertical-align: .12em; font-variant-numeric: tabular-nums; text-decoration: none; }
.reader .verse-number:hover { color: var(--accent); }
.reader .gloss { color: var(--gloss); font-size: .92em; }
.reader h2 { font: 600 24px/1.7 var(--serif); margin: 44px 0 28px; color: var(--accent-strong); }
.reader h3 { font: 600 1em/1.8 var(--sans); margin: 1.8em 0 1.4em; }
.reader .note-heading, .reader .note_heading { font-family: var(--sans); color: var(--accent-strong); font-weight: 600; }
.reader .editorial-lead, .reader .editorial_lead { font-family: var(--sans); color: var(--muted); }
.notes-section { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 52px; font-family: var(--sans); font-size: .91em; line-height: 1.95; }
.notes-section > h2 { margin-top: 26px; }
.notes-section .paragraph { margin-bottom: 1.95em; }
.section-caption { font: 13px/1.8 var(--sans); color: var(--muted); margin: -17px 0 30px; }
.part-heading { padding-top: 20px; border-top: 1px dashed var(--line); }
.source-note { font: 13px/1.9 var(--sans); color: var(--muted); margin: 30px 0; }
.source-note p { margin: 0 0 1em; }
.chapter-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 15px; font: 14px/1.7 var(--sans); border-top: 1px solid var(--line); padding-top: 24px; margin: 40px auto 0; max-width: 760px; }
.chapter-nav a { text-decoration: none; }
.chapter-nav a:last-child { text-align: right; }
.chapter-nav .nav-label { display: block; font-size: 11px; color: var(--muted); }
.chapter-nav .disabled { opacity: .4; }
.page-footer { max-width: 760px; margin: 48px auto 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.page-footer a { color: var(--muted); }
.display-controls { gap: 5px; flex-shrink: 0; align-items: center; }
.display-controls button { min-width: 35px; padding: 4px 7px; font-size: 13px; }
.breadcrumbs { max-width: 760px; margin: 0 auto 20px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { text-decoration: none; }
.intro-text, .home-actions, .filter-box, .editor-note, .reading-tools, .section-jumps { max-width: 760px; margin-left: auto; margin-right: auto; }
.intro-text { font-size: 16px; line-height: 1.9; margin-bottom: 22px; }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-bottom: 25px; }
.primary-link { padding: 9px 16px; background: var(--accent-strong); color: var(--paper); border-radius: 3px; text-decoration: none; }
.primary-link:hover { background: var(--accent); color: var(--paper); }
.js-ready .filter-box { display: block; }
.filter-box label { display: block; margin: 15px 0 8px; font-size: 13px; color: var(--muted); }
.filter-box input { max-width: 520px; }
.filter-box { margin-bottom: 32px; }
.js-ready .reading-tools { display: flex; }
.section-jumps { display: flex; gap: 25px; margin-bottom: 18px; font-size: 14px; }
.chapter-nav span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.book-alt, .book-count { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.book-count { font-size: 11px; }
.editor-note { padding: 14px 18px; background: var(--surface); color: var(--muted); border-left: 3px solid var(--line); font-size: 14px; line-height: 1.9; }
.section-heading p { font: 13px/1.8 var(--sans); color: var(--muted); margin: -14px 0 30px; }
.intro-section { font-family: var(--sans); font-size: .91em; line-height: 1.95; }
.book-introductions, .chapter-grid { max-width: 760px; margin-left: auto; margin-right: auto; }
.book-introductions { margin-top: 40px; }
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.table-wrap th { background: var(--surface); }
.editorial-list { padding-left: 1.2em; font-size: 16px; }
.editorial-list li { margin: 0 0 1em; }
.sidebar-home { font-family: var(--serif); font-size: 18px; text-decoration: none; }
.sidebar-footer a { margin-right: 12px; }

.catalog { max-width: 850px; margin: 0 auto; }
.catalog h2 { font-family: var(--serif); font-size: 27px; font-weight: 600; margin: 45px 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.catalog h3, .catalog-group h3 { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .08em; margin: 24px 0 10px; }
.catalog-filter { max-width: 480px; margin: 25px 0 32px; }
.catalog-filter label { display: block; font-size: 12px; margin-bottom: 8px; color: var(--muted); }
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px 22px; list-style: none; margin: 0; padding: 0; }
.book-grid > li, .book-grid > a { border-bottom: 1px solid var(--line); }
.book-grid a { display: block; padding: 14px 1px; text-decoration: none; line-height: 1.5; }
.book-grid a:hover { color: var(--accent); }
.book-grid .book-name, .book-grid strong { font-size: 17px; font-family: var(--serif); font-weight: 600; }
.book-grid small, .book-grid .book-subtitle { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.book-grid .chapter-count { margin-left: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 9px; margin: 24px 0 36px; list-style: none; padding: 0; }
.chapter-grid a { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 5px 4px; border: 1px solid var(--line); border-radius: 3px; text-decoration: none; font-size: 15px; font-variant-numeric: tabular-nums; }
.chapter-grid a:hover, .chapter-grid a[aria-current] { background: var(--surface-strong); border-color: var(--accent); }
.document-list { list-style: none; margin: 18px 0 30px; padding: 0; }
.document-list li { border-bottom: 1px solid var(--line); }
.document-list a { display: block; padding: 13px 0; text-decoration: none; }
.document-list small { color: var(--muted); margin-left: 10px; }
.about { max-width: 760px; margin: 0 auto; font-size: 16px; line-height: 1.9; }
.about h2 { font-family: var(--serif); font-size: 25px; margin-top: 36px; }
.about p { margin: 0 0 1.5em; }
.about li { margin: .6em 0; }
.about table { width: 100%; border-collapse: collapse; font-size: 14px; }
.about th, .about td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.about th { background: var(--surface); }

@media (min-width: 1440px) { .page { padding-left: 76px; padding-right: 76px; } }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { padding-left: 20px; padding-right: 16px; }
  .page { padding: 32px 32px 64px; }
  .header-inner { padding-left: 22px; padding-right: 22px; }
  .brand small { display: none; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  html { scroll-padding-top: 84px; }
  .site-header, .header-inner { min-height: 61px; }
  .header-inner { padding: 10px 18px; gap: 13px; }
  .brand strong { font-size: 21px; }
  .header-links { gap: 13px; font-size: 12px; }
  .header-links .desktop-only { display: none; }
  .js-ready #menu-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 3px 9px; min-height: 34px; font-size: 13px; }
  .layout { display: block; }
  .sidebar { display: none; }
  .js-ready.menu-open .sidebar { display: block; position: fixed; left: 0; top: 61px; bottom: 0; z-index: 25; width: min(320px, 84vw); height: calc(100dvh - 61px); background: var(--paper); padding: 23px; box-shadow: 10px 0 26px #0001; }
  .js-ready.menu-open .menu-backdrop { display: block; position: fixed; inset: 61px 0 0 min(320px, 84vw); z-index: 24; border: 0; border-radius: 0; background: #0005; padding: 0; }
  .js-ready.menu-open body { overflow: hidden; }
  .page { padding: 28px 25px 56px; max-width: 850px; margin: auto; }
  .page-heading { margin-bottom: 24px; }
  .breadcrumb { margin-bottom: 19px; }
  .reader { font-size: var(--reader-size); }
  .chapter-nav { margin-top: 34px; }
  .catalog h2 { margin-top: 35px; }
}
@media (max-width: 480px) {
  .header-inner { padding-right: 14px; padding-left: 14px; gap: 10px; }
  .header-links { gap: 11px; }
  .brand strong { font-size: 20px; letter-spacing: .03em; }
  .page { padding: 25px 19px 50px; }
  h1 { font-size: 29px; }
  .lead { font-size: 14px; }
  .reading-tools { gap: 8px; margin-top: 22px; }
  .reading-tools #book-select { max-width: 165px; }
  .reading-tools .font-tools { margin-left: 0; }
  .section-links { gap: 18px; }
  .reader .verse-number { padding-right: .36em; }
  .book-grid { gap: 0 16px; }
  .book-grid .book-name, .book-grid strong { font-size: 16px; }
  .book-grid small, .book-grid .book-subtitle { font-size: 11px; }
  .chapter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .chapter-nav { font-size: 13px; gap: 10px; }
  .notes-section { margin-top: 40px; }
  .about { font-size: 15px; }
}
@media (prefers-reduced-motion: no-preference) { a, button { transition: color .12s, background-color .12s; } }
@media print {
  :root { color-scheme: light; --paper: white; --ink: black; --muted: #444; --accent: #333; --accent-strong: #222; --line: #bbb; --gloss: #444; --reader-size: 12pt; }
  .site-header, .sidebar, .reading-tools, .section-links, .chapter-nav, .menu-backdrop, .skip-link { display: none !important; }
  .layout { display: block; max-width: none; }
  .page { max-width: none; padding: 0; }
  .page-heading, .reader { max-width: none; }
  .paragraph { orphans: 3; widows: 3; }
  h1, h2, h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  .notes-section { break-before: auto; }
}
