:root {
  --paper: #f2efe8;
  --surface: #fffdf7;
  --surface-alt: #e8efed;
  --ink: #152b36;
  --muted: #69777a;
  --line: #c8d3d1;
  --soft-line: #e2e8e5;
  --nav: #173f4b;
  --nav-mid: #2b6874;
  --accent: #d95f4d;
  --accent-soft: #fae7df;
  --gold: #d8a849;
  --blue-deep: #17566a;
  --blue-soft: #e6f0ef;
  --footer: #12313b;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: #d8e0dc;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
html[data-theme="dark"] { background: #14251f; color-scheme: dark; }
body {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 888px;
  min-width: 0;
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, rgba(21, 43, 54, .025) 0, rgba(21, 43, 54, .025) 1px, transparent 1px, transparent 5px), repeating-linear-gradient(90deg, rgba(21, 43, 54, .018) 0, rgba(21, 43, 54, .018) 1px, transparent 1px, transparent 8px);
  box-shadow: 0 0 34px rgba(23, 63, 75, .14);
  color: var(--ink);
  font: 14px/1.7 "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}
body::before { position: absolute; z-index: -1; top: 0; right: 0; left: 0; height: 7px; background: var(--accent); content: ""; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.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; }

.header { border-bottom: 1px solid var(--line); background: rgba(255, 253, 247, .96); box-shadow: 0 5px 18px rgba(23, 63, 75, .09); }
.header-main { display: flex; align-items: center; min-height: 64px; padding: 7px 14px; background: var(--nav); border-bottom: 3px solid var(--gold); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(255, 253, 247, .5); border-radius: 2px; background: var(--accent); color: #fff8ed; font: 700 20px/1 Georgia, "STSong", serif; box-shadow: 3px 3px 0 rgba(216, 168, 73, .9); }
.brand-name { max-width: 180px; overflow: hidden; color: #fff8ed; font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 19px; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid rgba(255, 255, 255, .34); border-radius: 50%; background: rgba(255, 248, 237, .13); color: #fff8ed; transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease; }
.icon-button:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.theme-icon { display: block; font-size: 17px; line-height: 1; }
.theme-icon-sun { display: none; }
.m-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: 44px; background: var(--nav-mid); }
.m-nav > a, .nav-menu { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; margin: 0; padding: 0; border-right: 1px solid rgba(255, 255, 255, .2); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .08em; line-height: 1; }
.m-nav > a:last-child { border-right: 0; }
.m-nav > a.is-active, .m-nav > a:hover, .nav-menu.is-active > summary, .nav-menu[open] > summary, .nav-menu > summary:hover { background: var(--accent); color: #fff; }
.nav-menu { position: relative; }
.nav-menu > summary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; margin: 0; padding: 0; list-style: none; cursor: pointer; line-height: 1; }
.nav-menu > summary::-webkit-details-marker, .nav-menu > summary::marker { display: none; content: ""; }
.nav-menu-panel { position: absolute; z-index: 5; top: calc(100% + 1px); left: 0; display: grid; grid-template-columns: repeat(2, minmax(78px, 1fr)); min-width: 190px; padding: 7px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0 0 3px 3px; background: var(--surface); box-shadow: 0 10px 24px rgba(23, 63, 75, .18); }
.nav-menu-panel a { min-width: 0; padding: 7px 8px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.nav-menu-panel a:hover { background: var(--accent-soft); color: var(--accent); }
.search_top { display: flex; height: 50px; padding: 7px 9px; background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.search_top input { min-width: 0; flex: 1; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 2px 0 0 2px; outline: 0; background: var(--surface); color: var(--ink); }
.search_top button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 72px; padding: 0 5px; border: 0; border-radius: 0 2px 2px 0; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; transition: background-color .18s ease; }
.search_top button:hover { background: var(--nav); }
.search_top input:focus, .search-line input:focus, .search-line select:focus { outline: 2px solid rgba(217, 95, 77, .42); outline-offset: -2px; }

.container { width: calc(100% - 22px); max-width: 888px; min-height: 300px; margin: 0 auto; padding: 18px 0 42px; }
.crumb-line { display: flex; align-items: center; gap: 8px; min-height: 27px; margin-bottom: 9px; padding: 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .04em; overflow: hidden; white-space: nowrap; }
.crumb-line a { color: var(--blue-deep); }
.crumb-line span:last-child { overflow: hidden; text-overflow: ellipsis; }
.header-kicker { margin-left: 16px; color: rgba(255, 248, 237, .68); font-family: Georgia, serif; font-size: 10px; letter-spacing: .14em; white-space: nowrap; }
.home-intro { display: grid; grid-template-columns: 80px minmax(0, 1fr) 180px; gap: 18px; align-items: end; margin-bottom: 14px; padding: 18px 14px 16px; border: 1px solid var(--line); border-top: 5px solid var(--accent); background: var(--surface); box-shadow: 0 6px 16px rgba(23, 63, 75, .06); }
.intro-index { align-self: start; color: var(--accent); font-family: Georgia, serif; font-size: 12px; letter-spacing: .12em; }
.intro-copy { min-width: 0; }
.intro-kicker { margin: 0 0 4px; color: var(--blue-deep); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.intro-copy h1 { max-width: 560px; margin: 0; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 31px; line-height: 1.25; letter-spacing: .04em; }
.intro-summary { max-width: 560px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.intro-facts { display: grid; gap: 7px; padding-left: 15px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.intro-facts span { display: flex; align-items: center; gap: 8px; }
.intro-facts b { color: var(--accent); font-family: Georgia, serif; font-weight: 400; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.portal-section, .chapter-card, .detail-card, .reader-card { min-width: 0; margin-bottom: 0; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); box-shadow: 0 6px 16px rgba(23, 63, 75, .07); overflow: hidden; }
.portal-section, .chapter-card { padding: 11px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; padding: 6px 10px; border-left: 4px solid var(--accent); border-radius: 0 2px 2px 0; background: var(--nav); color: #fff; }
.section-bar h1, .section-bar h2 { min-width: 0; margin: 0; overflow: hidden; color: #fff8ed; font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 17px; line-height: 1.4; font-weight: 700; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.section-bar > span { overflow: hidden; color: rgba(255, 248, 237, .75); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.section-bar > a { flex: 0 0 auto; color: var(--gold); font-size: 11px; font-weight: 700; }
.section-bar > a:hover { color: #fff; }
.portal-section > .section-bar, .chapter-card > .section-bar { margin: -11px -11px 5px; }
.text-list { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.text-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "index title meta"; align-items: center; gap: 8px; min-width: 0; min-height: 59px; padding: 8px 6px; border-bottom: 1px solid var(--soft-line); }
.text-row { transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.text-row:hover, .catalog-row:hover { background: var(--blue-soft); box-shadow: inset 4px 0 0 var(--accent); transform: translateX(2px); }
.text-row:last-child { border-bottom: 0; }
.text-row-index { grid-area: index; color: var(--accent); font-family: Georgia, serif; font-size: 12px; font-weight: 700; text-align: center; }
.text-row-title { grid-area: title; min-width: 0; overflow: hidden; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.text-row:hover .text-row-title { color: var(--accent); }
.text-row-meta { grid-area: meta; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 9px; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.text-row-meta span, .text-row-meta time { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-row-meta span:first-child { color: var(--blue-deep); }
.filter-strip { display: flex; align-items: center; gap: 7px; padding: 9px 1px; color: var(--muted); font-size: 12px; }
.list-lede, .search-lede, .catalog-lede { display: grid; gap: 3px; margin: 9px 1px 2px; padding: 10px 11px; border-left: 3px solid var(--gold); background: var(--surface-alt); }
.list-lede strong, .search-lede strong, .catalog-lede strong { color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 14px; }
.list-lede span, .search-lede span, .catalog-lede span { color: var(--muted); font-size: 11px; }
.filter-strip a { padding: 3px 8px; border: 1px solid transparent; border-radius: 2px; }
.filter-strip a.is-active, .filter-strip a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.book-table { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.book-row { display: block; min-width: 0; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.book-row:hover { background: var(--blue-soft); }
.book-row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { display: block; overflow: hidden; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; transition: color .18s ease; }
.row-title:hover { color: var(--accent); }
.row-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.row-meta a { color: var(--blue-deep); }
.row-meta span, .row-meta time { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-excerpt { display: -webkit-box; overflow: hidden; margin: 5px 0 0; color: #647276; font-size: 12px; line-height: 1.65; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.search-box { background: var(--surface-alt); }
.search-page-form { padding-top: 9px; }
.search-line { display: flex; height: 38px; }
.search-line select { width: 68px; border: 1px solid var(--line); border-right: 0; background: var(--surface); color: var(--muted); }
.search-line input { min-width: 0; flex: 1; padding: 0 9px; border: 1px solid var(--line); outline: 0; background: var(--surface); }
.blue-button, .plain-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--blue-deep); border-radius: 2px; background: var(--blue-deep); color: #fff; font-size: 12px; font-weight: 700; transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease; }
.blue-button:hover { border-color: var(--nav); background: var(--nav); color: #fff; transform: translateY(-1px); }
.search-line .blue-button { min-width: 66px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; padding-top: 9px; color: var(--muted); font-size: 11px; }
.search-filters label { display: inline-flex; align-items: center; gap: 4px; }
.search-filters select { max-width: 130px; padding: 3px 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.empty-state { padding: 36px 5px; color: var(--muted); text-align: center; }
.catalog-head, .catalog-row { display: grid; grid-template-columns: 42px 90px minmax(0, 1.8fr) 100px 70px 100px; gap: 8px; align-items: center; min-width: 0; }
.catalog-head { padding: 9px 6px; border-bottom: 2px solid var(--nav); background: var(--surface-alt); color: var(--muted); font-size: 11px; font-weight: 700; }
.catalog-head span:first-child { text-align: center; }
.catalog-row { min-height: 45px; padding: 7px 6px; border-bottom: 1px solid var(--soft-line); font-size: 12px; }
.catalog-row:last-child { border-bottom: 0; }
.catalog-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-index { color: var(--accent); font-family: Georgia, serif; text-align: center; }
.catalog-type { color: var(--blue-deep); }
.catalog-title { color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 13px; font-weight: 700; }
.catalog-title:hover { color: var(--accent); }
.catalog-author, .catalog-hits, .catalog-time { color: var(--muted); }
.pagination, .new_page { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding-top: 14px; }
.page-item, .pager-item { padding: 4px 9px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--blue-deep); font-size: 12px; }
.page-item:hover, .pager-item:hover { border-color: var(--accent); color: var(--accent); }
.page-item.is-current, .pager-item.is-current { border-color: var(--accent); background: var(--accent); color: #fff; }
.page-item.is-disabled, .pager-item.is-disabled { color: #a9b4b3; }

.detail-card { padding: 16px; }
.detail-info { min-width: 0; }
.detail-info h1 { margin: 0; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 25px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.detail-meta span, .detail-meta a, .detail-meta time { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-meta a { color: var(--blue-deep); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.detail-tags a { max-width: 100%; padding: 2px 7px; overflow: hidden; border: 1px solid rgba(217, 95, 77, .35); border-radius: 2px; background: var(--accent-soft); color: var(--accent); text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.plain-button { border-color: var(--line); background: var(--surface); color: var(--ink); }
.plain-button:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }
.detail-desc { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-desc h2 { margin: 0 0 6px; color: var(--blue-deep); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 16px; }
.detail-desc p { margin: 0; color: #647276; font-size: 12px; line-height: 1.8; }
.chapter-card { margin-top: 12px; }
.chapter-grid { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.chapter-grid a { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 7px; min-width: 0; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.chapter-grid a:hover { color: var(--accent); }
.chapter-grid a:last-child { border-bottom: 0; }
.chapter-grid b { color: var(--accent); font-size: 11px; font-weight: 700; }
.chapter-grid span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-card { padding: 14px 16px 23px; }
.reader-head { padding-bottom: 11px; border-bottom: 1px solid var(--line); text-align: center; }
.reader-head h1 { margin: 0; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 22px; line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; }
.reader-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.reader-nav { display: flex; justify-content: center; gap: 6px; padding: 11px 0; }
.reader-nav a, .reader-nav span { min-width: 76px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--blue-deep); font-size: 12px; text-align: center; }
.reader-nav a:hover { border-color: var(--accent); color: var(--accent); }
.reader-nav .is-disabled { color: #a9b4b3; }
.reader-content { max-width: 740px; margin: 0 auto; color: #2b3a3e; font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 16px; line-height: 2.05; overflow-wrap: anywhere; }
.reader-content p { margin: 0 0 1em; }
.reader-content img { display: block; height: auto; max-width: 100%; margin: 10px auto; }
.reader-nav-bottom { margin-top: 17px; border-top: 1px solid var(--line); }

.footer { padding: 24px 14px 30px; border-top: 5px solid var(--accent); background: var(--footer); color: #bed0cd; }
.footer_cont .brand { color: #fff8ed; }
.footer_cont .brand-mark { border-color: var(--gold); background: var(--gold); color: var(--nav); box-shadow: 3px 3px 0 var(--accent); }
.footer_cont p { max-width: 540px; margin: 10px 0 0; color: #bed0cd; font-size: 11px; }
.m-footer { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 13px; font-size: 11px; }
.m-footer a { color: var(--gold); }
.m-footer a:hover { color: #fff8ed; }
.back-top { position: fixed; left: calc(50% + 402px); right: auto; bottom: 16px; display: none; width: 40px; height: 40px; border: 1px solid var(--accent); border-radius: 50%; background: var(--accent); box-shadow: 3px 3px 0 var(--nav); color: #fff; transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.back-top:hover { background: var(--gold); color: var(--nav); transform: translateY(-3px); }
.back-top-glyph { display: block; font-family: Georgia, serif; font-size: 22px; line-height: 1; }
.back-top.is-visible { display: block; }

html[data-theme="dark"] { --paper: #111b1f; --surface: #1b2b31; --surface-alt: #17252b; --ink: #edf4f0; --muted: #a5b8b6; --line: #40565a; --soft-line: #2d4145; --nav: #0d2c36; --nav-mid: #21616a; --accent: #ef8268; --accent-soft: #4b2e2a; --gold: #e8bc69; --blue-deep: #9bd7d2; --blue-soft: #27464b; --footer: #091a21; }
html[data-theme="dark"] .search_top input, html[data-theme="dark"] .search-line input, html[data-theme="dark"] .search-line select, html[data-theme="dark"] .search-filters select, html[data-theme="dark"] .plain-button, html[data-theme="dark"] .reader-nav a, html[data-theme="dark"] .reader-nav span, html[data-theme="dark"] .page-item, html[data-theme="dark"] .pager-item { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .search-box { background: var(--surface-alt); }
html[data-theme="dark"] .footer { background: var(--footer); }
html[data-theme="dark"] .home-intro, html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { box-shadow: 0 8px 20px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .icon-button { border-color: rgba(232, 188, 105, .65); background: rgba(232, 188, 105, .16); color: var(--gold); }
html[data-theme="dark"] .back-top { box-shadow: 3px 3px 0 #07151b; }

@media (min-width: 641px) {
  .header-kicker { display: inline; }
  .container { width: calc(100% - 32px); padding: 20px 0 52px; }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
  .latest-section { grid-column: 1 / -1; }
  .text-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .text-row { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.2fr); }
  .book-table { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 19px; }
  .book-row:nth-last-child(-n + 2) { border-bottom: 0; }
  .detail-card { padding: 21px; }
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 25px; }
  .chapter-grid a:nth-last-child(-n + 2) { border-bottom: 0; }
}
@media (max-width: 420px) {
  .header-kicker { display: none; }
  .brand-name { max-width: 145px; }
  .home-intro { display: block; margin-bottom: 12px; padding: 14px 12px 13px; }
  .intro-index { margin-bottom: 8px; }
  .intro-copy h1 { font-size: 27px; }
  .intro-summary { margin-top: 7px; }
  .intro-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; padding: 10px 0 0; border-top: 1px solid var(--line); border-left: 0; font-size: 10px; }
  .intro-facts span { display: block; }
  .intro-facts b { display: block; margin-bottom: 2px; }
  .list-lede, .search-lede, .catalog-lede { margin-top: 8px; padding: 9px 10px; }
  .text-row { grid-template-columns: 23px minmax(0, 1fr); grid-template-areas: "index title" "index meta"; align-items: start; gap: 2px 8px; min-height: 65px; }
  .text-row-meta { justify-content: flex-start; gap: 0 8px; }
  .row-meta { gap: 2px 8px; }
  .detail-card { padding: 14px; }
  .detail-info h1 { font-size: 22px; }
  .reader-card { padding-right: 10px; padding-left: 10px; }
  .reader-content { font-size: 17px; line-height: 1.95; }
  .reader-nav a, .reader-nav span { min-width: 0; flex: 1 1 0; }
  .catalog-head { display: none; }
  .catalog-row { grid-template-columns: 25px minmax(0, 1fr); grid-template-areas: "index title" "index type" "index author" "index stats" "index time"; align-items: start; gap: 2px 7px; min-height: 84px; padding: 9px 0; }
  .catalog-index { grid-area: index; }
  .catalog-title { grid-area: title; }
  .catalog-type { grid-area: type; }
  .catalog-author { grid-area: author; }
  .catalog-hits { grid-area: stats; }
  .catalog-time { grid-area: time; display: block; }
}
@media (max-width: 888px) { .back-top { left: auto; right: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Flat blue-white reading system: color and depth are carried by borders and hierarchy. */
:root { --paper: #f1f8fe; --surface: #fff; --surface-alt: #eaf5fd; --ink: #163c59; --muted: #63809a; --line: #c5e1f7; --soft-line: #e1eef8; --nav: #245f8c; --nav-mid: #78c0ff; --accent: #78c0ff; --accent-soft: #eaf6ff; --gold: #b6ddfa; --blue-deep: #216a9f; --blue-soft: #f0f8ff; --footer: #194b70; }
html { background: #dceaf4; }
body { background-color: var(--paper); background-image: none; box-shadow: none; }
body::before { height: 4px; }
.header { background: var(--surface); box-shadow: none; }
.header-main { border-bottom-color: var(--accent); }
.brand-mark { border-radius: 0; background: var(--accent); color: var(--nav); box-shadow: none; }
.icon-button { border-radius: 0; background: rgba(255, 255, 255, .1); }
.icon-button:hover { background: var(--accent); transform: none; }
.m-nav > a, .nav-menu { border-right-color: rgba(255, 255, 255, .28); }
.nav-menu-panel { border-radius: 0; box-shadow: none; }
.search_top { background: var(--surface-alt); }
.search_top input, .search_top button, .search-line input, .search-line select { border-radius: 0; }
.search_top button { background: var(--accent); color: var(--nav); }
.search_top button:hover { background: var(--nav); }
.home-intro, .portal-section, .chapter-card, .detail-card, .reader-card { border-radius: 0; box-shadow: none; }
.section-bar { border-radius: 0; background: var(--nav); }
.section-bar > a { color: #bfe0f3; }
.text-row, .catalog-row { transition: background-color .16s ease, box-shadow .16s ease; }
.text-row:hover, .catalog-row:hover { transform: none; }
.list-lede, .search-lede, .catalog-lede { border-left-color: var(--accent); }
.filter-strip a, .blue-button, .plain-button, .page-item, .pager-item, .detail-tags a, .reader-nav a, .reader-nav span { border-radius: 0; }
.detail-tags a { border-color: #b6d9ee; background: var(--accent-soft); color: var(--blue-deep); }
.blue-button { background: var(--accent); border-color: var(--accent); color: var(--nav); }
.blue-button:hover { background: var(--nav); border-color: var(--nav); transform: none; }
.plain-button:hover { transform: none; }
.footer { border-top-color: var(--accent); }
.footer_cont .brand-mark { border-color: #a8d2ed; background: #fff; color: var(--nav); box-shadow: none; }
.m-footer a { color: #bfe0f3; }
.back-top { border-radius: 0; background: var(--accent); box-shadow: none; color: var(--nav); }
.back-top:hover { background: var(--nav); color: #fff; transform: none; }
html[data-theme="dark"] { --paper: #102a3d; --surface: #17384d; --surface-alt: #123047; --ink: #eff8ff; --muted: #abc5d7; --line: #3d657d; --soft-line: #2a4f67; --nav: #08263e; --nav-mid: #3e8fc8; --accent: #78c0ff; --accent-soft: #1b4a68; --gold: #b6ddfa; --blue-deep: #b7e1ff; --blue-soft: #1d4762; --footer: #061d30; }
html[data-theme="dark"] .home-intro, html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { box-shadow: none; }
html[data-theme="dark"] .footer_cont .brand-mark { background: var(--gold); color: var(--nav); }
.m-nav > a.is-active, .m-nav > a:hover, .nav-menu.is-active > summary, .nav-menu[open] > summary, .nav-menu > summary:hover { color: var(--nav); }
.search_top button:hover, .blue-button:hover { color: #fff; }

/* Light sky palette: keep the reading experience airy and avoid deep-blue blocks. */
:root { --paper: #f4faff; --surface: #fff; --surface-alt: #eaf5fd; --ink: #285878; --muted: #6688a1; --line: #c9e2f4; --soft-line: #e2eff8; --nav: #64afe6; --nav-mid: #78c0ff; --accent: #78c0ff; --accent-soft: #eaf6ff; --gold: #a8d4f1; --blue-deep: #4b91c2; --blue-soft: #f0f8ff; --footer: #e5f3fc; }
.header-main { background: #e8f4fc; color: #2b668e; }
.brand-name { color: #2b668e; }
.header-kicker { color: #5c94ba; }
.brand-mark { color: #2b668e; }
.icon-button { border-color: #8fc4e7; background: #fff; color: #2b668e; }
.m-nav > a, .nav-menu { border-right-color: rgba(75, 145, 194, .28); color: #28658d; }
.m-nav > a.is-active, .m-nav > a:hover, .nav-menu.is-active > summary, .nav-menu[open] > summary, .nav-menu > summary:hover { background: #78c0ff; color: #205b86; }
.search_top { background: #eaf5fd; }
.search_top button { color: #205b86; }
.section-bar { background: #78c0ff; }
.section-bar h1, .section-bar h2 { color: #205b86; }
.section-bar > span, .section-bar > a { color: #3f7da6; }
.footer { background: #e5f3fc; color: #4f7f9e; }
.footer_cont .brand, .footer_cont .brand-name { color: #2b668e; }
.footer_cont p { color: #5e86a2; }
.footer_cont .brand-mark { border-color: #8fc4e7; background: #78c0ff; color: #205b86; }
.m-footer a { color: #3f7da6; }
.blue-button, .back-top { color: #205b86; }
.blue-button:hover, .back-top:hover { color: #fff; }

/* Balanced sky-blue palette: the sampled blue is an accent, white remains the canvas. */
:root { --paper: #f6fafd; --surface: #fff; --surface-alt: #edf7fd; --ink: #31566e; --muted: #7892a4; --line: #d5e6f0; --soft-line: #e7f0f5; --nav: #3f7da4; --nav-mid: #fff; --accent: #78c0ff; --accent-soft: #eef8ff; --gold: #a9d8f5; --blue-deep: #4f8fb8; --blue-soft: #f3faff; --footer: #edf7fd; }
body { background-color: var(--paper); }
.header { background: #fff; border-bottom-color: #d7e8f2; }
.header-main { background: #fff; border-bottom: 1px solid #d7e8f2; color: var(--nav); }
.brand-name { color: var(--nav); }
.header-kicker { color: #83a2b6; }
.brand-mark { background: var(--accent); color: #fff; }
.icon-button { border-color: #b6d9ee; background: #f7fbfe; color: var(--blue-deep); }
.icon-button:hover { background: var(--accent-soft); color: var(--blue-deep); }
.m-nav { background: #fff; border-bottom: 1px solid #d7e8f2; }
.m-nav > a, .nav-menu { border-right-color: #e0edf4; color: #5b849f; }
.m-nav > a.is-active, .m-nav > a:hover, .nav-menu.is-active > summary, .nav-menu[open] > summary, .nav-menu > summary:hover { background: var(--accent-soft); color: #3e82ad; }
.m-nav > a.is-active, .nav-menu.is-active > summary { box-shadow: inset 0 -3px 0 var(--accent); }
.search_top { background: #f7fbfe; border-bottom-color: #d7e8f2; }
.search_top button { background: var(--accent); color: #f7fbff; }
.search_top button:hover { background: #68b3f0; color: #fff; }
.home-intro { border-top-color: var(--accent); }
.section-bar { background: var(--accent-soft); border: 1px solid #cae5f5; border-left: 4px solid var(--accent); }
.section-bar h1, .section-bar h2 { color: #3d78a0; }
.section-bar > span, .section-bar > a { color: #6d9ab5; }
.text-row:hover, .catalog-row:hover { background: #f2faff; }
.list-lede, .search-lede, .catalog-lede { border-left-color: var(--accent); background: #f3faff; }
.filter-strip a.is-active, .filter-strip a:hover { border-color: #a8d7f4; background: var(--accent-soft); color: #4f8fb8; }
.blue-button { background: var(--accent); border-color: var(--accent); color: #2f6f98; }
.blue-button:hover { background: #68b3f0; border-color: #68b3f0; }
.detail-tags a { border-color: #b9dcf2; background: var(--accent-soft); color: #4f8fb8; }
.catalog-head { background: #f3faff; }
.page-item.is-current, .pager-item.is-current { border-color: var(--accent); background: var(--accent); color: #2f6f98; }
.footer { background: var(--footer); border-top-color: var(--accent); color: #688da5; }
.footer_cont .brand, .footer_cont .brand-name { color: var(--nav); }
.footer_cont { text-align: center; }
.footer_cont .brand { justify-content: center; }
.footer_cont p { color: #7295aa; }
.footer_cont .brand-mark { border-color: #b9ddf3; background: #fff; color: #4f8fb8; }
.m-footer a { color: #4f8fb8; }
.back-top { background: var(--accent); color: #2f6f98; }
.back-top:hover { background: #68b3f0; color: #fff; }

/* Night reading: keep every layer blue-gray and reserve the bright swatch for focus states. */
html[data-theme="dark"] { --paper: #182531; --surface: #202f3c; --surface-alt: #243846; --ink: #e7f1f7; --muted: #a7bdca; --line: #3e5665; --soft-line: #304653; --nav: #dcecf5; --nav-mid: #213846; --accent: #78c0ff; --accent-soft: #2a4a5e; --gold: #a9d7f2; --blue-deep: #a9d8f4; --blue-soft: #294756; --footer: #142431; }
html[data-theme="dark"] .header, html[data-theme="dark"] .header-main { background: #192a37; border-color: #354d5c; color: #e7f1f7; }
html[data-theme="dark"] .brand-name, html[data-theme="dark"] .footer_cont .brand, html[data-theme="dark"] .footer_cont .brand-name { color: #e7f1f7; }
html[data-theme="dark"] .header-kicker { color: #9fbccc; }
html[data-theme="dark"] .brand-mark { background: #78c0ff; color: #214e70; }
html[data-theme="dark"] .icon-button { border-color: #55788e; background: #223a4a; color: #bfe3fb; }
html[data-theme="dark"] .m-nav { background: #213846; border-color: #3e5665; }
html[data-theme="dark"] .m-nav > a, html[data-theme="dark"] .nav-menu { border-right-color: #3e5665; color: #bfd6e3; }
html[data-theme="dark"] .m-nav > a.is-active, html[data-theme="dark"] .m-nav > a:hover, html[data-theme="dark"] .nav-menu.is-active > summary, html[data-theme="dark"] .nav-menu[open] > summary, html[data-theme="dark"] .nav-menu > summary:hover { background: #2f5368; color: #eef8ff; }
html[data-theme="dark"] .search_top { background: #1b2e3c; border-color: #3e5665; }
html[data-theme="dark"] .search_top input, html[data-theme="dark"] .search-line input, html[data-theme="dark"] .search-line select { background: #263d4b; border-color: #486271; color: #e7f1f7; }
html[data-theme="dark"] .search_top button { background: #4d95c5; color: #f1f8fc; }
html[data-theme="dark"] .section-bar { background: #2c4c60; border-color: #496a7b; border-left-color: #78c0ff; }
html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: #edf7fc; }
html[data-theme="dark"] .section-bar > span, html[data-theme="dark"] .section-bar > a { color: #b8d8e9; }
html[data-theme="dark"] .home-intro, html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .list-lede, html[data-theme="dark"] .search-lede, html[data-theme="dark"] .catalog-lede { background: var(--surface-alt); }
html[data-theme="dark"] .footer { background: var(--footer); border-color: #78c0ff; color: #b4cbd8; }
html[data-theme="dark"] .footer_cont p { color: #a7bdca; }
html[data-theme="dark"] .footer_cont .brand-mark { background: #78c0ff; color: #214e70; }
html[data-theme="dark"] .m-footer a { color: #acd8f4; }

/* Unified book cards: the whole row is the link on every list page. */
.book-row { display: block; min-width: 0; margin: 0 0 8px; padding: 13px 12px; border: 1px solid var(--line); border-left: 3px solid transparent; background-color: var(--surface); cursor: pointer; transition: background-color .16s ease, border-color .16s ease; }
.book-row:last-child { margin-bottom: 0; }
.book-row:hover { background-color: var(--blue-soft); border-color: #b5d9ef; border-left-color: var(--accent); }
.book-row:hover .row-title { color: var(--accent); }
.row-category { color: var(--blue-deep); }
html[data-theme="dark"] .book-row:hover { background-color: #294756; border-color: #4d6a79; border-left-color: #78c0ff; }
html[data-theme="dark"] .book-row:hover .row-title { color: #d7efff; }
html[data-theme="dark"] .catalog-head { background: #243846; color: #b8d8e9; border-bottom-color: #55788e; }

.rank-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding: 12px 12px 4px; }
.rank-tabs a { display: grid; place-items: center; min-height: 34px; padding: 7px 4px; border: 1px solid #b8d9ed; background: #fff; color: #5b849f; font-size: 12px; font-weight: 700; text-align: center; cursor: pointer; }
.rank-tabs a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--blue-deep); }
.rank-tabs a.is-active { border-color: #78c0ff; background: #78c0ff; color: #fff; box-shadow: 0 2px 0 rgba(63, 125, 164, .18); }
.rank-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.rank-index { display: grid; place-items: center; min-height: 24px; color: var(--blue-deep); font: 700 14px/1 Georgia, "STSong", serif; }
html[data-theme="dark"] .rank-tabs a { border-color: #55788e; background: #243846; color: #b8d8e9; }
html[data-theme="dark"] .rank-tabs a:hover { background: #294756; color: #d7efff; }
html[data-theme="dark"] .rank-tabs a.is-active { border-color: #78c0ff; background: #78c0ff; color: #214e70; }
html[data-theme="dark"] .rank-index { color: #bfe3fb; }


.category-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.category-link { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); background: var(--surface-alt); color: var(--ink); cursor: pointer; }
.category-link:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--blue-deep); }
.category-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-link i { flex: 0 0 auto; margin-left: 8px; color: var(--accent); }
html[data-theme="dark"] .category-link { background: #243846; color: #e7f1f7; }
html[data-theme="dark"] .category-link:hover { border-color: #78c0ff; background: #294756; color: #d7efff; }

@media (max-width: 420px) {
  .category-summary { grid-template-columns: minmax(0, 1fr); }
}

/* Production palette C: green across every page, preserving the existing layout. */
:root { --paper: #f1f5f2; --surface: #f9fcf8; --surface-alt: #dfece2; --ink: #203e31; --muted: #71897a; --line: #c4d7c8; --soft-line: #dce9df; --nav: #185b43; --nav-mid: #f9fcf8; --accent: #4fa875; --accent-soft: #d8eddd; --gold: #c2a664; --blue-deep: #2d7956; --blue-soft: #e5f3e8; --footer: #dcebe0; }
html { background: #edf2ef; }
body { background-color: var(--paper); color: var(--ink); }
.header { background: var(--surface); border-bottom-color: var(--line); box-shadow: none; }
.header-main { background: var(--nav); border-bottom-color: var(--nav); color: #fff; }
.brand-name { color: #fff; }
.header-kicker { color: #d2e8d5; }
.brand-mark { background: var(--accent); color: #fff; border-color: transparent; box-shadow: none; }
.icon-button { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; }
.icon-button:hover { background: var(--accent); color: #fff; }
.m-nav { background: var(--nav-mid); border-bottom-color: var(--line); }
.m-nav > a, .nav-menu { border-right-color: var(--line); color: var(--nav); }
.m-nav > a.is-active, .m-nav > a:hover, .nav-menu.is-active > summary, .nav-menu[open] > summary, .nav-menu > summary:hover { background: var(--accent-soft); color: var(--nav); box-shadow: inset 0 -3px 0 var(--accent); }
.nav-menu-panel { background: var(--surface); border-color: var(--line); }
.nav-menu-panel a { color: var(--ink); }
.nav-menu-panel a:hover { background: var(--accent-soft); color: var(--green); }
.search_top { background: var(--surface-alt); border-bottom-color: var(--line); }
.search_top input, .search-line input, .search-line select, .search-filters select { background: var(--surface); border-color: var(--line); color: var(--ink); }
.search_top button { background: var(--accent); color: #fff; }
.search_top button:hover { background: var(--nav); color: #fff; }
.crumb-line { color: var(--muted); }
.crumb-line a, .row-meta a { color: var(--green); }
.portal-section, .chapter-card, .detail-card, .reader-card { background: var(--surface); border-color: var(--line); box-shadow: none; }
.section-bar { background: var(--accent-soft); border-color: var(--line); border-left-color: var(--accent); }
.section-bar h1, .section-bar h2 { color: var(--nav); }
.section-bar > span, .section-bar > a { color: var(--muted); }
.text-row:hover, .catalog-row:hover { background: var(--blue-soft); box-shadow: inset 4px 0 0 var(--accent); }
.list-lede, .search-lede, .catalog-lede { background: var(--surface-alt); border-left-color: var(--accent); }
.book-row { background: var(--surface); border-color: var(--line); }
.book-row:hover { background: var(--blue-soft); border-color: var(--accent); }
.book-row:hover .row-title { color: var(--green); }
.row-title { color: var(--ink); }
.row-meta, .row-excerpt { color: var(--muted); }
.row-category { color: var(--green); }
.filter-strip a.is-active, .filter-strip a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--green); }
.blue-button { background: var(--accent); border-color: var(--accent); color: #fff; }
.blue-button:hover { background: var(--nav); border-color: var(--nav); color: #fff; }
.plain-button { background: var(--surface); border-color: var(--line); color: var(--ink); }
.plain-button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--green); }
.detail-tags a { border-color: var(--line); background: var(--accent-soft); color: var(--green); }
.catalog-head { background: var(--surface-alt); color: var(--muted); border-bottom-color: var(--nav); }
.rank-tabs a { border-color: var(--line); background: var(--surface); color: var(--muted); }
.rank-tabs a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--green); }
.rank-tabs a.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
.rank-index { color: var(--green); }
.category-link { background: var(--surface-alt); border-color: var(--line); color: var(--ink); }
.category-link:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--green); }
.page-item, .pager-item { background: var(--surface); border-color: var(--line); color: var(--green); }
.page-item.is-current, .pager-item.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.footer { background: var(--footer); border-top-color: var(--accent); color: var(--muted); }
.footer_cont .brand-name { color: var(--nav); }
.footer_cont p, .m-footer a { color: var(--muted); }
.back-top { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
.back-top:hover { background: var(--nav); color: #fff; }

/* Green night mode: no light-blue or white hover states remain. */
html[data-theme="dark"] { --paper: #14251f; --surface: #1c3229; --surface-alt: #213b30; --ink: #e7f1df; --muted: #a7bda9; --line: #365442; --soft-line: #2d4938; --nav: #0f3d2d; --nav-mid: #1c3229; --accent: #80c69a; --accent-soft: #294735; --gold: #d5bc77; --blue-deep: #b8e4b4; --blue-soft: #294735; --footer: #10261d; }
html[data-theme="dark"], html[data-theme="dark"] .header, html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { background-color: var(--paper); color: var(--ink); }
html[data-theme="dark"] .header, html[data-theme="dark"] .header-main { background: var(--nav); border-color: #2f6048; color: #e7f1df; }
html[data-theme="dark"] .brand-name, html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: #e7f1df; }
html[data-theme="dark"] .header-kicker { color: #a7cdb0; }
html[data-theme="dark"] .brand-mark { background: var(--accent); color: #173b2b; }
html[data-theme="dark"] .icon-button { background: #294735; border-color: #5e9874; color: #d8f0d9; }
html[data-theme="dark"] .m-nav { background: var(--nav-mid); border-color: var(--line); }
html[data-theme="dark"] .m-nav > a, html[data-theme="dark"] .nav-menu { color: #b8e4b4; border-color: var(--line); }
html[data-theme="dark"] .m-nav > a.is-active, html[data-theme="dark"] .m-nav > a:hover, html[data-theme="dark"] .nav-menu.is-active > summary, html[data-theme="dark"] .nav-menu[open] > summary, html[data-theme="dark"] .nav-menu > summary:hover { background: #294735; color: #e7f1df; box-shadow: inset 0 -3px 0 var(--accent); }
html[data-theme="dark"] .nav-menu-panel { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .nav-menu-panel a { color: var(--ink); }
html[data-theme="dark"] .search_top, html[data-theme="dark"] .search-box { background: var(--surface-alt); border-color: var(--line); }
html[data-theme="dark"] .search_top input, html[data-theme="dark"] .search-line input, html[data-theme="dark"] .search-line select, html[data-theme="dark"] .search-filters select { background: var(--surface); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .search_top button { background: #4f9b70; color: #f0faed; }
html[data-theme="dark"] .section-bar { background: #294735; border-color: #496f55; border-left-color: var(--accent); }
html[data-theme="dark"] .section-bar > span, html[data-theme="dark"] .section-bar > a { color: #b8d8ba; }
html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .book-row, html[data-theme="dark"] .plain-button, html[data-theme="dark"] .page-item, html[data-theme="dark"] .pager-item { background: var(--surface); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .book-row:hover, html[data-theme="dark"] .text-row:hover, html[data-theme="dark"] .catalog-row:hover { background: #294735; border-color: #5b9270; box-shadow: inset 4px 0 0 var(--accent); }
html[data-theme="dark"] .book-row:hover .row-title, html[data-theme="dark"] .row-title { color: #e7f1df; }
html[data-theme="dark"] .row-meta, html[data-theme="dark"] .row-excerpt, html[data-theme="dark"] .crumb-line { color: #a7bda9; }
html[data-theme="dark"] .row-category, html[data-theme="dark"] .crumb-line a, html[data-theme="dark"] .row-meta a { color: #b8e4b4; }
html[data-theme="dark"] .list-lede, html[data-theme="dark"] .search-lede, html[data-theme="dark"] .catalog-lede { background: var(--surface-alt); border-color: var(--accent); }
html[data-theme="dark"] .rank-tabs a, html[data-theme="dark"] .category-link { background: var(--surface); border-color: var(--line); color: #b8d8ba; }
html[data-theme="dark"] .rank-tabs a:hover, html[data-theme="dark"] .category-link:hover { background: #294735; border-color: var(--accent); color: #e7f1df; }
html[data-theme="dark"] .rank-tabs a.is-active { background: var(--accent); border-color: var(--accent); color: #173b2b; }
html[data-theme="dark"] .rank-index { color: #b8e4b4; }
html[data-theme="dark"] .footer { background: var(--footer); border-color: var(--accent); color: #a7bda9; }
html[data-theme="dark"] .footer_cont .brand-name { color: #d8f0d9; }
html[data-theme="dark"] .m-footer a { color: #b8e4b4; }

/* Combined list treatment: A-style title bar with C-style text rows. */
.section-bar { min-height: 42px; padding: 9px 12px; border: 0; border-left: 3px solid var(--accent); border-bottom: 1px solid var(--soft-line); border-radius: 0; background: var(--surface-alt); }
.section-bar h1, .section-bar h2 { color: var(--ink); font-size: 17px; letter-spacing: 0; }
.section-bar > span, .section-bar > a { color: var(--muted); }
.book-table { gap: 0; }
.book-row { margin: 0; padding: 14px 12px; border: 0; border-bottom: 1px solid var(--soft-line); border-left: 3px solid transparent; border-radius: 0; background: var(--surface); }
.book-row:last-child { border-bottom: 0; }
.book-row:hover { border-color: var(--soft-line); border-left-color: var(--accent); background: var(--blue-soft); }
.book-row:hover .row-title { color: var(--green); }
.row-title { line-height: 1.45; }
.row-meta { margin-top: 6px; gap: 3px 10px; }
.row-excerpt { margin-top: 7px; line-height: 1.6; }
html[data-theme="dark"] .section-bar { background: var(--surface-alt); border-color: var(--soft-line); border-left-color: var(--accent); }
html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: var(--ink); }
html[data-theme="dark"] .section-bar > span, html[data-theme="dark"] .section-bar > a { color: var(--muted); }

/* List title direction C: bookish left rail, title only. */
.section-bar { position: relative; min-height: 42px; padding: 13px 16px 13px 22px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: var(--surface); }
.section-bar:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #4f936d; }
.section-bar h1, .section-bar h2 { color: #315d49; font-size: 16px; font-weight: 700; letter-spacing: 0; }
.section-bar > span, .section-bar > a { display: none; }
html[data-theme="dark"] .section-bar { background: var(--surface); border-color: var(--soft-line); }
html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: #b8e4b4; }

/* Normalize home, latest, rank, category, and search section headings. */
.portal-section > .section-bar { min-height: 42px; padding: 13px 16px 13px 22px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: var(--surface); }
.portal-section > .section-bar:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #4f936d; }
.portal-section > .section-bar h1, .portal-section > .section-bar h2 { color: #315d49; font-size: 16px; font-weight: 700; letter-spacing: 0; }
.portal-section > .section-bar > span, .portal-section > .section-bar > a { display: none; }
html[data-theme="dark"] .portal-section > .section-bar { background: var(--surface); border-color: var(--soft-line); }
html[data-theme="dark"] .portal-section > .section-bar h1, html[data-theme="dark"] .portal-section > .section-bar h2 { color: #b8e4b4; }

/* Category entry direction A: airy two-column cards. */
.category-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 16px; }
.category-link { min-height: 44px; padding: 13px 14px; border: 1px solid #d4e5d8; border-radius: 4px; background: #f8fcf8; color: #315d49; }
.category-link:hover { border-color: #63a77d; background: #eef7f0; color: #397653; }
.category-link i { color: #63a77d; }
.category-link small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.featured-layout { display: block; padding: 14px; }
.random-feature { padding: 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.random-feature h2, .feature-list h2 { margin: 0 0 8px; font-size: 14px; color: var(--blue-deep); }
.featured-title { display: block; margin-bottom: 8px; color: var(--ink); font-size: 20px; font-weight: 700; text-decoration: none; }
.random-feature p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.featured-meta { display: flex; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.featured-stacks { display: grid; gap: 12px; margin-top: 12px; }
.feature-list { padding: 12px; border: 1px solid var(--line); background: var(--surface-alt); }
.feature-book-row { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 0; border-top: 1px solid var(--soft-line); color: var(--ink); text-decoration: none; }
.feature-book-row:first-of-type { border-top: 0; }
.feature-book-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-book-row small { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.home-hot-carousel { position: relative; min-height: 230px; margin: 14px; padding: 22px; border-left: 4px solid var(--accent); border-radius: 4px; background: var(--accent-soft); }
.home-hot-slide { display: none; }
.home-hot-slide.is-active { display: block; }
.home-hot-label { color: var(--accent); font-size: 12px; }
.home-hot-title { display: block; margin: 8px 0; color: var(--ink); font-size: 24px; font-weight: 700; text-decoration: none; }
.home-hot-slide p { margin: 0 0 10px; color: var(--muted); line-height: 1.8; }
.home-hot-meta { display: flex; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.home-hot-dots { position: absolute; right: 18px; bottom: 18px; display: flex; gap: 6px; }
.home-hot-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; background: var(--line); cursor: pointer; }
.home-hot-dots button.is-active { background: var(--accent); }
.home-latest-list { margin: 0 14px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.home-list-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.home-list-heading h2 { margin: 0; color: var(--ink); font-size: 16px; }
.home-list-heading span { color: var(--muted); font-size: 12px; }
.home-latest-row { display: flex; align-items: center; gap: 9px; min-height: 40px; border-top: 1px solid var(--soft-line); color: var(--ink); text-decoration: none; }
.home-latest-row:first-of-type { border-top: 0; }
.home-latest-row b { width: 20px; color: var(--accent); font-size: 12px; }
.home-latest-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-latest-row small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.crumb-line { display: none !important; }
.home-featured > .section-bar { display: none; }
.home-latest-row em { margin-left: auto; color: var(--muted); font-size: 11px; font-style: normal; white-space: nowrap; }
.home-latest-row small { margin-left: 12px; }
.home-hot-carousel { margin-left: 0; margin-right: 0; }
.home-latest-list { margin-left: 0; margin-right: 0; }
.home-latest-row em { margin: 0 5px 0 0; color: var(--accent); font-size: 11px; font-style: normal; }
.home-latest-row em { margin: 0; color: var(--accent); font-size: inherit; font-style: normal; white-space: nowrap; }
.home-latest-row small { margin-left: auto; }
.container { padding-top: 3px; }
.home-latest-row { border-radius: 3px; transition: background-color .15s ease; }
.home-latest-row:hover { background: var(--soft-line); color: var(--ink); }
.home-latest-row:hover span, .home-latest-row:hover em, .home-latest-row:hover small { color: inherit; }
.home-hot-title, .home-latest-row > span { font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; }
.home-featured { padding-top: 3px; }
.home-featured .home-hot-carousel { margin-top: 0; }
.home-featured .home-hot-carousel { margin-bottom: 8px; }
.home-featured .home-latest-list { margin-top: 0; }
.home-hot-slide { display: none; grid-template-columns: 46px minmax(0, 1fr) 82px; align-items: center; gap: 12px; min-height: 118px; padding: 14px; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); background: var(--surface); }
.home-hot-slide.is-active { display: grid; }
.home-featured { margin-bottom: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.home-featured > .section-bar { display: none; }
.home-featured .home-hot-carousel, .home-featured .home-latest-list { width: 100%; }
.home-hot-label { color: var(--accent); font-family: Georgia, serif; font-size: 17px; font-weight: 700; text-align: center; }
.home-hot-info { min-width: 0; }
.home-hot-title { display: block; margin: 0 0 7px; overflow: hidden; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 18px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.home-hot-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; color: var(--muted); font-size: 12px; }
.home-hot-meta span { white-space: nowrap; }
.home-hot-slide .blue-button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 8px; font-size: 11px; white-space: nowrap; }
.home-hot-dots { right: 14px; bottom: 8px; }
@media (max-width: 480px) { .home-hot-slide { grid-template-columns: 42px minmax(0, 1fr) 74px; gap: 8px; padding: 13px 10px; } .home-hot-title { font-size: 17px; } .home-hot-meta { gap: 3px 7px; font-size: 11px; } .home-hot-slide .blue-button { padding: 6px 5px; font-size: 10px; } }
.home-canvas { width: 100%; margin: 0; padding: 0; background: transparent; }
.home-canvas-carousel { position: relative; width: 100%; min-height: 118px; margin: 0 0 8px; padding: 14px; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); background: var(--surface); }
.home-canvas-slide { display: none; grid-template-columns: 46px minmax(0, 1fr) 82px; align-items: center; gap: 12px; min-height: 98px; }
.home-canvas-slide.is-active { display: grid; }
.home-canvas-rank { color: var(--accent); font-family: Georgia, serif; font-size: 17px; font-weight: 700; text-align: center; }
.home-canvas-info { min-width: 0; }
.home-canvas-title { display: block; margin-bottom: 7px; overflow: hidden; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 18px; font-weight: 700; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.home-canvas-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.home-canvas-meta span { white-space: nowrap; }
.home-canvas-read { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 8px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 11px; text-decoration: none; white-space: nowrap; }
.home-canvas-dots { position: absolute; right: 14px; bottom: 7px; display: flex; gap: 5px; }
.home-canvas-dots button { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--line); cursor: pointer; }
.home-canvas-dots button.is-active { background: var(--accent); }
.home-canvas-latest { width: 100%; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.home-canvas-latest-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.home-canvas-latest-head h2 { margin: 0; color: var(--ink); font-size: 16px; }
.home-canvas-latest-head span { color: var(--muted); font-size: 12px; }
.home-canvas-latest-more { color: var(--accent); font-size: 12px; text-decoration: none; }
.home-canvas-latest-more:hover, .home-canvas-latest-more:focus, .home-canvas-latest-more:active { background: transparent; color: var(--accent); outline: 0; }
.home-canvas-latest-more { display: inline-flex; align-items: center; gap: 10px; }
.home-canvas-latest-more:before, .home-canvas-latest-more:after { width: 22px; height: 1px; background: var(--line); content: ""; }
.home-canvas-latest-more:before, .home-canvas-latest-more:after { display: none; }
.home-canvas-latest-more i { color: var(--accent); font-size: 17px; line-height: 1; }
.home-canvas-latest-more .more-arrow-svg { width: 16px; height: 16px; color: var(--accent); }
.home-canvas-latest-more { gap: 3px; color: var(--accent); }
.home-canvas-latest-more span { color: var(--accent); }
.home-canvas-row { display: flex; align-items: center; gap: 4px; min-height: 40px; border-top: 1px solid var(--soft-line); color: var(--ink); text-decoration: none; }
.home-canvas-row:first-of-type { border-top: 0; }
.home-canvas-row b { width: 20px; color: var(--accent); font-size: 12px; }
.home-canvas-row span { min-width: 0; overflow: hidden; font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; text-overflow: ellipsis; white-space: nowrap; }
.home-canvas-row em { color: var(--accent); font-size: inherit; font-style: normal; }
.home-canvas-row small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.home-canvas-row:hover { background: transparent; color: var(--ink); }
.home-canvas-row:hover span, .home-canvas-row:hover em, .home-canvas-row:hover small { color: inherit; }
.home-canvas-row:hover em { color: var(--accent); }
.home-canvas-read, .home-canvas-read:hover, .home-canvas-read:focus, .home-canvas-read:active { color: #fff; }
.home-canvas-read:hover { background: var(--nav); border-color: var(--nav); }
html[data-theme="dark"] .home-canvas-read { background: #4f9b70; border-color: #4f9b70; color: #f0faed; }
html[data-theme="dark"] .home-canvas-read:hover, html[data-theme="dark"] .home-canvas-read:focus, html[data-theme="dark"] .home-canvas-read:active { background: #6dbb89; border-color: #6dbb89; color: #10261d; }
@media (max-width: 480px) { .home-canvas-slide { grid-template-columns: 42px minmax(0, 1fr) 74px; gap: 8px; } .home-canvas-title { font-size: 17px; } .home-canvas-meta { gap: 3px 7px; font-size: 11px; } .home-canvas-read { padding: 6px 5px; font-size: 10px; } }
.home-latest-more { display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--soft-line); color: var(--muted); font-size: 12px; text-align: center; text-decoration: none; }
.home-latest-more i { color: var(--accent); font-size: 18px; font-style: normal; line-height: 1; }
.home-latest-more:hover { background: transparent; color: var(--muted); }
.home-latest-more:hover i { color: var(--accent); }
.home-latest-more:focus, .home-latest-more:active { outline: 0; background: transparent; box-shadow: none; }
.home-latest-more { -webkit-tap-highlight-color: transparent; }
.home-latest-row { gap: 4px; }
.home-hot-carousel { min-height: 138px; padding: 15px 16px; }
.home-hot-head { display: flex; align-items: center; gap: 10px; }
.home-hot-label { flex: 0 0 auto; padding: 4px 7px; border: 1px solid #78b98e; border-radius: 3px; background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 700; }
.home-hot-title { display: block; margin: 0; overflow: hidden; color: var(--ink); font-size: 19px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.home-hot-slide p { display: none; }
.home-hot-meta { display: grid; grid-template-columns: repeat(3, max-content); gap: 7px 16px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.home-hot-meta span { white-space: nowrap; }
.home-hot-slide .blue-button { display: inline-block; padding: 6px 12px; font-size: 12px; }
.home-hot-dots { right: 16px; top: 15px; bottom: auto; }
.home-hot-carousel { min-height: 116px; padding: 15px 18px; }
.home-hot-title { display: inline; margin: 0 0 0 8px; font-size: 20px; }
.home-hot-slide p { margin: 7px 0 0; font-size: 12px; line-height: 1.5; }
.home-hot-slide p, .home-hot-meta, .home-hot-slide .blue-button { display: none; }
.home-hot-dots { right: 16px; bottom: 12px; }
.home-hot-carousel { min-height: 138px; padding: 15px 16px; }
.home-hot-meta { display: grid; grid-template-columns: repeat(3, max-content); gap: 7px 16px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.home-hot-meta span { white-space: nowrap; }
.home-hot-slide .blue-button { display: inline-block; padding: 6px 12px; font-size: 12px; }
.home-hot-dots { right: 16px; top: 15px; bottom: auto; }
@media (max-width: 600px) { .featured-layout { grid-template-columns: 1fr; } }
html[data-theme="dark"] .category-summary { background: var(--surface); }
html[data-theme="dark"] .category-link { border-color: var(--line); background: var(--surface-alt); color: #e7f1df; }
html[data-theme="dark"] .category-link:hover { border-color: var(--accent); background: #294735; color: #e7f1df; }
html[data-theme="dark"] .category-link i { color: var(--accent); }
html[data-theme="dark"] .book-row { background: var(--surface); border-color: var(--soft-line); }
html[data-theme="dark"] .book-row:hover { background: var(--blue-soft); border-color: var(--soft-line); border-left-color: var(--accent); }

/* Night mode: hide only the default title rail; keep list hover feedback intact. */
html[data-theme="dark"] .portal-section > .section-bar:before { display: block; }

/* Night mode list rows: remove the default left rail, retain it on hover only. */
html[data-theme="dark"] .book-row { border-left-color: transparent; }
html[data-theme="dark"] .book-row:hover { border-left-color: var(--accent); box-shadow: none; }

/* Shared page geometry: keep home, latest, and rank aligned at every viewport size. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.container {
  width: 100%;
  max-width: 888px;
  padding-top: 9px;
  padding-bottom: 42px;
}
.crumb-line {
  width: 100%;
  min-height: 20px;
  margin: 0 0 3px;
  padding: 0 12px;
}
.home-grid { gap: 12px; }
.portal-section,
.chapter-card {
  width: 100%;
}
.portal-section > .section-bar,
.chapter-card > .section-bar,
.catalog-section > .section-bar {
  height: 53px;
  min-height: 53px;
  align-items: center;
  padding: 0 16px 0 22px;
  margin: -11px -11px 5px;
}
.portal-section > .section-bar h1,
.portal-section > .section-bar h2,
.chapter-card > .section-bar h1,
.chapter-card > .section-bar h2,
.catalog-section > .section-bar h1,
.catalog-section > .section-bar h2 {
  font-size: 18px;
  line-height: 1.4;
}
.book-table {
  width: 100%;
  min-width: 0;
}
@media (min-width: 641px) {
  .container { padding-top: 12px; }
  .home-grid { gap: 12px; }
}

/* A-style list heading: quiet full-width band below the breadcrumb. */
.list-section > .section-bar, .catalog-section > .section-bar { min-height: 48px; padding: 14px 16px 13px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: #f4faf5; }
.list-section > .section-bar h1, .list-section > .section-bar h2, .catalog-section > .section-bar h1, .catalog-section > .section-bar h2 { color: var(--ink); font-size: 18px; font-weight: 700; }
html[data-theme="dark"] .list-section > .section-bar, html[data-theme="dark"] .catalog-section > .section-bar { background: var(--surface-alt); border-color: var(--soft-line); }
html[data-theme="dark"] .list-section > .section-bar h1, html[data-theme="dark"] .list-section > .section-bar h2, html[data-theme="dark"] .catalog-section > .section-bar h1, html[data-theme="dark"] .catalog-section > .section-bar h2 { color: var(--ink); }

/* Apply the same title and breadcrumb language across every page. */
.section-bar { min-height: 48px; padding: 14px 16px 13px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: #f4faf5; }
.section-bar h1, .section-bar h2 { color: var(--ink); font-size: 18px; font-weight: 700; letter-spacing: 0; }
.section-bar > span, .section-bar > a { color: var(--muted); }
.crumb-line { display: flex; align-items: center; gap: 7px; min-height: 24px; margin-bottom: 7px; padding: 0 4px; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.crumb-line a { color: var(--green); }
.crumb-line span { color: var(--muted); }
.crumb-line span:last-child { color: var(--ink); }
html[data-theme="dark"] .section-bar { background: var(--surface-alt); border-color: var(--soft-line); }
html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: var(--ink); }
html[data-theme="dark"] .section-bar > span, html[data-theme="dark"] .section-bar > a { color: var(--muted); }
html[data-theme="dark"] .crumb-line, html[data-theme="dark"] .crumb-line span { color: var(--muted); }
html[data-theme="dark"] .crumb-line a { color: var(--blue-deep); }
html[data-theme="dark"] .crumb-line span:last-child { color: var(--ink); }

/* List title direction F: compact label with a quiet dashed divider. */
.section-bar { min-height: 39px; padding: 11px 16px; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; background: var(--surface); }
.section-bar h1, .section-bar h2 { color: #397653; font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.section-bar > span, .section-bar > a { color: var(--muted); font-size: 10px; letter-spacing: 0; }
html[data-theme="dark"] .section-bar { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .section-bar h1, html[data-theme="dark"] .section-bar h2 { color: #b8e4b4; }
html[data-theme="dark"] .section-bar > span, html[data-theme="dark"] .section-bar > a { color: var(--muted); }

/* Let the breadcrumb and page sections reach both edges of the 888px container. */
.container { width: 100%; max-width: 888px; }

/* Breadcrumb direction A: quiet inline text with a thin baseline. */
.crumb-line { min-height: 28px; margin-bottom: 4px; padding: 8px 12px 6px; border-bottom: 1px solid var(--soft-line); background: var(--surface); font-size: 11px; }
.crumb-line a { color: var(--green); text-decoration: none; }
.crumb-line span { color: var(--muted); }
.crumb-line span:last-child { color: var(--ink); font-weight: 700; }
html[data-theme="dark"] .crumb-line { background: var(--surface); border-color: var(--soft-line); }
html[data-theme="dark"] .crumb-line a { color: var(--blue-deep); }
html[data-theme="dark"] .crumb-line span { color: var(--muted); }
html[data-theme="dark"] .crumb-line span:last-child { color: var(--ink); }
html[data-theme="dark"] .back-top { background: var(--accent); border-color: var(--accent); color: #173b2b; }
html[data-theme="dark"] .back-top:hover { background: #4f9b70; color: #f0faed; }

/* Article/detail night text: keep long-form reading copy bright enough on green surfaces. */
html[data-theme="dark"] .detail-info h1,
html[data-theme="dark"] .reader-head h1 { color: #eef7e9; }
html[data-theme="dark"] .detail-meta,
html[data-theme="dark"] .reader-head p { color: #b5cbb7; }
html[data-theme="dark"] .detail-meta a,
html[data-theme="dark"] .detail-tags,
html[data-theme="dark"] .detail-tags a { color: #b8e4b4; }
html[data-theme="dark"] .detail-tags a { background: #294735; border-color: #5b9270; }
html[data-theme="dark"] .detail-desc { border-top-color: #365442; }
html[data-theme="dark"] .detail-desc h2 { color: #b8e4b4; }
html[data-theme="dark"] .detail-desc p { color: #c0d2c2; }
html[data-theme="dark"] .chapter-grid a,
html[data-theme="dark"] .chapter-grid span { color: #d5e6d5; }
html[data-theme="dark"] .chapter-grid a { border-bottom-color: #365442; }
html[data-theme="dark"] .chapter-grid a:hover { color: #e7f1df; }
html[data-theme="dark"] .chapter-grid b { color: #80c69a; }
html[data-theme="dark"] .reader-head { border-bottom-color: #365442; }
html[data-theme="dark"] .reader-content,
html[data-theme="dark"] .reader-content p,
html[data-theme="dark"] .reader-content li,
html[data-theme="dark"] .reader-content blockquote { color: #e1eee0; }
html[data-theme="dark"] .reader-content a { color: #b8e4b4; }
html[data-theme="dark"] .reader-nav a,
html[data-theme="dark"] .reader-nav span { background: #1c3229; border-color: #365442; color: #b8e4b4; }
html[data-theme="dark"] .reader-nav a:hover { border-color: #80c69a; color: #e7f1df; }
html[data-theme="dark"] .reader-nav .is-disabled { color: #71897a; }
html[data-theme="dark"] .reader-nav-bottom { border-top-color: #365442; }

/* Reuse the semi-transparent favicon inside the existing brand mark slot. */
.brand-mark { padding: 0; background: transparent; border: 0; box-shadow: none; }
.brand-mark-icon { display: block; width: 100%; height: 100%; object-fit: contain; }
.header-main .brand-mark, html[data-theme="dark"] .header-main .brand-mark { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.header-main .brand-mark-icon { background: transparent; }
.footer_cont .brand-mark,
html[data-theme="dark"] .footer_cont .brand-mark { background: transparent; border: 0; box-shadow: none; }

/* Compact breadcrumb spacing without changing its typography or layout. */
.crumb-line { min-height: 22px; margin-bottom: 5px; }

/* Bring the breadcrumb closer to the header search without changing the page layout. */
.container { padding-top: 9px; }
.crumb-line { min-height: 20px; margin-bottom: 3px; }
@media (min-width:641px) {
  .container { padding-top: 12px; }
}

/* Detail metadata and tags: keep the label text separate from the clickable value. */
.detail-meta span { display: inline-flex; align-items: center; gap: 3px; }
.detail-tags { align-items: center; line-height: 1.7; }
.detail-tags > span { display: inline-flex; align-items: center; min-height: 1.7em; }
.detail-tags a { display: inline-flex; align-items: center; min-height: 1.7em; padding: 0 7px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--blue-deep); line-height: 1.7; }
html[data-theme="dark"] .detail-tags a { border-color: #5b9270; background: #294735; color: #b8e4b4; }

/* Reader controls stay local to the reading card and inherit the site theme by default. */
body.reader-page .reader-card { background: var(--reader-bg, var(--surface)); color: var(--reader-ink, var(--ink)); }
body.reader-page .reader-content,
body.reader-page .reader-content p,
body.reader-page .reader-content li,
body.reader-page .reader-content blockquote { color: var(--reader-ink, var(--ink)); font-size: var(--reader-font-size, 16px); }
body.reader-page .reader-content a { color: var(--blue-deep); }
body.reader-page .reader-head h1,
body.reader-page .reader-head p,
body.reader-page .reader-settings,
body.reader-page .reader-settings-label,
body.reader-page .reader-settings button,
body.reader-page .reader-settings output,
body.reader-page .reader-nav a,
body.reader-page .reader-nav span { color: var(--reader-ink, var(--ink)); }
body.reader-page .reader-head { border-bottom-color: color-mix(in srgb, var(--reader-ink, var(--ink)) 22%, var(--reader-bg, var(--line))); }
body.reader-page .reader-settings button,
body.reader-page .reader-settings output,
body.reader-page .reader-nav a,
body.reader-page .reader-nav span {
  border-color: color-mix(in srgb, var(--reader-ink, var(--ink)) 22%, var(--reader-bg, var(--line)));
  background: color-mix(in srgb, var(--reader-bg, var(--surface)) 88%, var(--reader-ink, var(--ink)));
}
body.reader-page .reader-settings output { background: color-mix(in srgb, var(--reader-bg, var(--surface)) 78%, var(--reader-ink, var(--ink))); }
body.reader-page .reader-nav a:hover { border-color: var(--reader-ink, var(--accent)); color: var(--reader-ink, var(--accent)); }
body.reader-page .reader-nav .is-disabled { color: color-mix(in srgb, var(--reader-ink, var(--ink)) 48%, var(--reader-bg, var(--surface))); }
html[data-theme="dark"] body.reader-page .reader-head h1,
html[data-theme="dark"] body.reader-page .reader-head p,
html[data-theme="dark"] body.reader-page .reader-settings,
html[data-theme="dark"] body.reader-page .reader-settings-label,
html[data-theme="dark"] body.reader-page .reader-settings button,
html[data-theme="dark"] body.reader-page .reader-settings output,
html[data-theme="dark"] body.reader-page .reader-nav a,
html[data-theme="dark"] body.reader-page .reader-nav span,
html[data-theme="dark"] body.reader-page .reader-content,
html[data-theme="dark"] body.reader-page .reader-content p,
html[data-theme="dark"] body.reader-page .reader-content li,
html[data-theme="dark"] body.reader-page .reader-content blockquote { color: var(--reader-ink, var(--ink)); }
.reader-settings { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; padding: 9px 0 3px; color: var(--muted); font-size: 11px; }
.reader-settings-label { margin-right: 2px; color: var(--muted); }
.reader-settings-bg-label { margin-left: 8px; }
.reader-settings button { display: inline-grid; place-items: center; min-width: 27px; height: 27px; padding: 0 7px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--blue-deep); cursor: pointer; }
.reader-settings output { display: inline-grid; place-items: center; min-width: 43px; height: 27px; padding: 0 5px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-alt); color: var(--ink); font-size: 11px; }
.reader-settings button:hover, .reader-settings button.is-active { border-color: var(--accent); color: var(--accent); }
.reader-settings .reader-swatch { width: 22px; min-width: 22px; height: 22px; padding: 0; border-radius: 50%; }
.reader-swatch-auto { background: linear-gradient(135deg, #f9fcf8 50%, #1a2430 50%) !important; }
.reader-swatch-paper { background: #f6f0e4 !important; }
.reader-swatch-green { background: #e5f3e8 !important; }
.reader-swatch-sepia { background: #f2ead8 !important; }
.reader-swatch-pink { background: #f8e7ee !important; }
.reader-swatch-blue { background: #e7f0f7 !important; }
.reader-settings .reader-swatch.is-active { outline: 2px solid var(--accent); outline-offset: 2px; }
.reader-custom-bg .reader-nav a, .reader-custom-bg .reader-nav span { background: color-mix(in srgb, var(--reader-bg) 82%, var(--reader-ink)); color: var(--reader-ink); }
.catalog-back { display: flex; justify-content: flex-end; padding: 9px 10px 0; }
.catalog-page .chapter-grid { padding: 0 10px 10px; }
.detail-latest { display: flex; align-items: baseline; gap: 5px; min-width: 0; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.detail-latest span { flex: 0 0 auto; }
.detail-latest a { min-width: 0; overflow: hidden; color: var(--blue-deep); text-overflow: ellipsis; white-space: nowrap; }
.detail-latest a:hover { color: var(--accent); }
.detail-tags a { border-radius: 0; }
.directory-page { overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.directory-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 16px 13px; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.directory-page-head h1 { min-width: 0; margin: 0; overflow: hidden; color: var(--ink); font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif; font-size: 20px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.directory-chapter-stat { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.directory-chapter-stat b { color: var(--accent); font-family: Georgia, serif; font-size: 20px; }
.directory-history-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--soft-line); font-size: 12px; }
.directory-history-row a { color: var(--blue-deep); }
.directory-history-row a:hover { color: var(--accent); }
.directory-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--soft-line); color: var(--muted); font-size: 11px; }
.directory-toolbar label { flex: 1 1 100%; }
.directory-toolbar input { width: 92px; height: 28px; padding: 0 7px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); }
.directory-toolbar button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--blue-deep); cursor: pointer; }
.directory-toolbar button:hover, .directory-toolbar button.is-reversed { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
#directory-list { margin: 0; padding: 0 16px; list-style: none; }
#directory-list li { border-bottom: 1px solid var(--soft-line); }
#directory-list li:last-child { border-bottom: 0; }
#directory-list a { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 11px 2px; color: var(--ink); font-size: 13px; }
#directory-list a:hover { color: var(--accent); }
#directory-list .chapter-number { flex: 0 0 32px; color: var(--accent); font-family: Georgia, serif; text-align: right; }
#directory-list li.is-target { background: var(--accent-soft); }
html[data-theme="dark"] .directory-page { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .directory-page-head { background: var(--surface-alt); border-color: var(--line); }
html[data-theme="dark"] .directory-history-row,
html[data-theme="dark"] .directory-toolbar,
html[data-theme="dark"] #directory-list li { border-color: var(--soft-line); }
html[data-theme="dark"] .detail-latest a { color: var(--blue-deep); }
@media (max-width: 420px) {
  .reader-settings { justify-content: flex-start; }
  .reader-settings-bg-label { margin-left: 3px; }
}

/* Search controls use the same soft green surface as the rest of the site. */
.search_top,
.search-box { background: var(--surface-alt); border-color: var(--line); }
.search_top input,
.search-line input,
.search-line select,
.search-filters select {
  background-color: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  accent-color: var(--accent);
}
.search-line select,
.search-filters select { color: var(--green, var(--blue-deep)); }
.search-line select option,
.search-filters select option { background: var(--surface); color: var(--ink); }
.search_top input::placeholder { color: var(--muted); }
.search_top input:focus,
.search-line input:focus,
.search-line select:focus,
.search-filters select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -2px; }
html[data-theme="dark"] .search_top,
html[data-theme="dark"] .search-box { background: var(--surface-alt); }
html[data-theme="dark"] .search_top input,
html[data-theme="dark"] .search-line input,
html[data-theme="dark"] .search-line select,
html[data-theme="dark"] .search-filters select { background-color: var(--surface); border-color: var(--line); color: var(--ink); color-scheme: dark; }
html[data-theme="dark"] .search-line select option,
html[data-theme="dark"] .search-filters select option { background: var(--surface); color: var(--ink); }

/* Theme switcher is a quiet icon label, without a button box. */
.header-actions .theme-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 58px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, .9);
  box-shadow: none;
  transform: none;
}
.header-actions .theme-toggle:hover,
.header-actions .theme-toggle:focus-visible { background: transparent; color: #fff; transform: none; }
.header-actions .theme-toggle .theme-icon { font-size: 17px; line-height: 1; }
.theme-toggle-label { font-size: 10px; line-height: 1.2; white-space: nowrap; }
html[data-theme="dark"] .header-actions .theme-toggle { background: transparent; border: 0; color: var(--gold); }
html[data-theme="dark"] .header-actions .theme-toggle:hover,
html[data-theme="dark"] .header-actions .theme-toggle:focus-visible { background: transparent; color: var(--accent); }

/* Directory layout follows the compact centered reading-directory pattern. */
.directory-page {
  margin: 0 auto;
  padding: 12px 10px 24px;
  border: 0;
  background: var(--surface);
}
.directory-page-head {
  position: relative;
  display: block;
  min-height: 80px;
  margin: 0;
  padding: 15px 14px;
  border: 0;
  background: transparent;
  text-align: center;
}
.directory-page-head::before {
  content: "";
  position: absolute;
  top: 30px;
  right: 14px;
  left: 14px;
  height: 1px;
  background: var(--accent);
  opacity: .45;
}
.directory-page-head h1 {
  position: relative;
  z-index: 1;
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.directory-chapter-stat {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  margin: 7px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
.directory-chapter-stat span { display: inline-block; padding: 0 7px; background: var(--surface); }
.directory-chapter-stat b { display: inline; font-size: 12px; font-weight: 700; line-height: 18px; }
.directory-history-row { justify-content: center; align-items: center; gap: 10px; margin: 12px 0; padding: 0; border: 0; text-align: center; }
.directory-history-row a { display: inline-block; padding: 6px 16px; border: 1px solid var(--accent); border-radius: 0; background: var(--surface); color: var(--accent); font-size: 13px; line-height: 20px; text-decoration: none; }
.directory-history-row a:hover { background: var(--accent); color: #fff; }
.directory-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; margin: 12px 0; padding: 9px; border: 1px solid var(--line); border-radius: 0; background: var(--surface-alt); }
.directory-toolbar label { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.directory-toolbar input { grid-column: 1; box-sizing: border-box; width: 100%; min-width: 0; height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); }
.directory-toolbar button { height: 31px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 0; background: var(--surface); color: var(--accent); font-size: 12px; white-space: nowrap; }
#chapter-jump-btn { background: var(--accent); color: #fff; }
#chapter-jump-btn:hover, #chapter-order:hover, #chapter-order.is-reversed { background: var(--accent); color: #fff; }
#directory-list { margin: 0; padding: 0; border-top: 1px solid var(--line); }
#directory-list li { padding: 0 10px; border-bottom: 1px dashed var(--line); }
#directory-list li:last-child { border-bottom: 0; }
#directory-list li:hover { background: var(--accent-soft); }
#directory-list li a { padding: 10px 4px; color: var(--ink); line-height: 22px; }
#directory-list li a:hover { background: transparent; color: var(--accent); }
#directory-list .chapter-number { min-width: 0; margin-right: 4px; color: var(--accent); font-weight: 700; }
html[data-theme="dark"] .directory-page-head h1,
html[data-theme="dark"] .directory-chapter-stat span { background: var(--surface); }
html[data-theme="dark"] .directory-page-head::before { background: var(--accent); }
html[data-theme="dark"] .directory-history-row a,
html[data-theme="dark"] .directory-toolbar button { background: var(--surface); color: var(--accent); }
html[data-theme="dark"] .directory-history-row a:hover,
html[data-theme="dark"] #chapter-jump-btn,
html[data-theme="dark"] #chapter-jump-btn:hover,
html[data-theme="dark"] #chapter-order:hover,
html[data-theme="dark"] #chapter-order.is-reversed { background: var(--accent); color: #173b2b; }
@media (max-width: 430px) {
  .directory-page { padding: 10px 8px 20px; }
  .directory-page-head { min-height: 78px; padding: 14px 10px; }
  .directory-page-head::before { right: 10px; left: 10px; }
  .directory-page-head h1 { font-size: 17px; }
  .directory-history-row { gap: 8px; margin: 10px 0; }
  .directory-history-row a { padding: 5px 14px; }
}

/* Selected direction B: a compact ledger header with title and chapter count side by side. */
.directory-page-head.directory-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--surface-alt);
  text-align: left;
}
.directory-page-head.directory-ledger-head::before { display: none; }
.directory-page-head.directory-ledger-head h1 {
  position: static;
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.45;
  text-align: left;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat span { padding: 0; background: transparent; }
.directory-page-head.directory-ledger-head .directory-chapter-stat b { display: block; color: var(--blue-deep); font-family: Georgia, serif; font-size: 24px; line-height: 1; }
html[data-theme="dark"] .directory-page-head.directory-ledger-head { background: var(--surface-alt); border-bottom-color: var(--line); border-left-color: var(--accent); }
@media (max-width: 430px) {
  .directory-page-head.directory-ledger-head { gap: 10px; padding: 14px 12px; }
  .directory-page-head.directory-ledger-head h1 { font-size: 17px; }
  .directory-page-head.directory-ledger-head .directory-chapter-stat { padding-left: 10px; }
}

/* Night palette B: deep ink with cool blue-gray layers and jade focus color. */
html[data-theme="dark"] {
  --paper: #10151d;
  --surface: #1a2430;
  --surface-alt: #202e3b;
  --ink: #e1eaf0;
  --muted: #9aafbd;
  --line: #304354;
  --soft-line: #263847;
  --nav: #182434;
  --nav-mid: #182434;
  --accent: #8bd6b0;
  --accent-soft: #25463d;
  --gold: #b9d8ee;
  --blue-deep: #b8d9e9;
  --blue-soft: #243342;
  --footer: #0c1118;
  --header: #151d28;
}
html[data-theme="dark"] { background-color: var(--paper); color: var(--ink); }
html[data-theme="dark"] .header, html[data-theme="dark"] .header-main { background: var(--header); border-color: var(--line); }
html[data-theme="dark"] .m-nav { background: var(--nav); border-color: var(--line); }
html[data-theme="dark"] .m-nav > a, html[data-theme="dark"] .nav-menu { color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] .m-nav > a.is-active, html[data-theme="dark"] .m-nav > a:hover, html[data-theme="dark"] .nav-menu.is-active > summary, html[data-theme="dark"] .nav-menu[open] > summary, html[data-theme="dark"] .nav-menu > summary:hover { background: #223447; color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
html[data-theme="dark"] .brand-name { color: var(--ink); }
html[data-theme="dark"] .brand-mark { background: transparent; color: var(--accent); }
html[data-theme="dark"] .icon-button { background: #202e3b; border-color: #486276; color: var(--accent); }
html[data-theme="dark"] .search_top, html[data-theme="dark"] .search-box { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .search_top input, html[data-theme="dark"] .search-line input, html[data-theme="dark"] .search-line select, html[data-theme="dark"] .search-filters select { background: #151f2a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .search_top button { background: var(--accent); color: #10251e; }
html[data-theme="dark"] .portal-section, html[data-theme="dark"] .chapter-card, html[data-theme="dark"] .detail-card, html[data-theme="dark"] .reader-card { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .portal-section > .section-bar { background: var(--surface-alt); border-color: var(--line); }
html[data-theme="dark"] .portal-section > .section-bar h1, html[data-theme="dark"] .portal-section > .section-bar h2 { color: var(--ink); }
html[data-theme="dark"] .book-row { background: var(--surface); border-color: var(--soft-line); }
html[data-theme="dark"] .book-row:hover { background: var(--blue-soft); border-color: var(--soft-line); border-left-color: var(--accent); }
html[data-theme="dark"] .row-title { color: var(--ink); }
html[data-theme="dark"] .row-meta, html[data-theme="dark"] .row-excerpt, html[data-theme="dark"] .crumb-line { color: var(--muted); }
html[data-theme="dark"] .row-category, html[data-theme="dark"] .crumb-line a, html[data-theme="dark"] .row-meta a { color: var(--accent); }
html[data-theme="dark"] .rank-tabs a, html[data-theme="dark"] .category-link, html[data-theme="dark"] .page-item, html[data-theme="dark"] .pager-item { background: var(--surface); border-color: var(--line); color: var(--muted); }
html[data-theme="dark"] .rank-tabs a:hover, html[data-theme="dark"] .category-link:hover { background: var(--blue-soft); border-color: var(--accent); color: var(--ink); }
html[data-theme="dark"] .rank-tabs a.is-active, html[data-theme="dark"] .page-item.is-current, html[data-theme="dark"] .pager-item.is-current { background: var(--accent); border-color: var(--accent); color: #10251e; }
html[data-theme="dark"] .rank-index { color: var(--accent); }
html[data-theme="dark"] .footer { background: var(--footer); border-color: var(--line); color: var(--muted); }
html[data-theme="dark"] .footer_cont .brand-name { color: var(--ink); }
html[data-theme="dark"] .m-footer a { color: var(--accent); }

/* Keep the detail-page reading action visible in every dark-mode pointer state. */
.detail-actions .blue-button,
.detail-actions .blue-button:hover,
.detail-actions .blue-button:focus,
.detail-actions .blue-button:focus-visible,
.detail-actions .blue-button:active {
  border: 1px solid var(--accent);
}
html[data-theme="dark"] .detail-actions .blue-button:hover,
html[data-theme="dark"] .detail-actions .blue-button:focus,
html[data-theme="dark"] .detail-actions .blue-button:focus-visible,
html[data-theme="dark"] .detail-actions .blue-button:active {
  border-color: var(--accent);
}
html[data-theme="dark"] .detail-actions .blue-button {
  background: #3d6555;
  border-color: #6fa789;
  color: #e1eaf0;
}
html[data-theme="dark"] .detail-actions .blue-button:hover,
html[data-theme="dark"] .detail-actions .blue-button:focus,
html[data-theme="dark"] .detail-actions .blue-button:focus-visible,
html[data-theme="dark"] .detail-actions .blue-button:active {
  background: #4b765f;
  border-color: #86c5a3;
  color: #f0f6f2;
}

/* Reader background choices must win over the global dark surface rule. */
html[data-theme="dark"] body.reader-page .reader-card {
  background: var(--reader-bg, var(--surface));
  color: var(--reader-ink, var(--ink));
}
html[data-theme="dark"] body.reader-page .reader-head h1,
html[data-theme="dark"] body.reader-page .reader-head p,
html[data-theme="dark"] body.reader-page .reader-settings,
html[data-theme="dark"] body.reader-page .reader-settings-label,
html[data-theme="dark"] body.reader-page .reader-settings button,
html[data-theme="dark"] body.reader-page .reader-settings output,
html[data-theme="dark"] body.reader-page .reader-nav a,
html[data-theme="dark"] body.reader-page .reader-nav span,
html[data-theme="dark"] body.reader-page .reader-content,
html[data-theme="dark"] body.reader-page .reader-content p,
html[data-theme="dark"] body.reader-page .reader-content li,
html[data-theme="dark"] body.reader-page .reader-content blockquote {
  color: var(--reader-ink, var(--ink));
}
html[data-theme="dark"] .book-row .row-category {
  color: var(--muted);
}
html[data-theme="dark"] .book-row { border-left-color: transparent; }
html[data-theme="dark"] .book-row:hover { border-left-color: var(--accent); box-shadow: none; }

/* Vertical covers: shared by homepage, latest, category, rank and search lists. */
.book-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 124px;
  padding: 13px 6px;
}
.book-cover,
.home-canvas-cover,
.home-canvas-row-cover {
  position: relative;
  display: grid;
  place-items: end center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-alt);
  color: var(--blue-deep);
  text-align: center;
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif;
}
.book-cover {
  width: 70px;
  height: 98px;
  grid-row: 1;
}
.book-cover::after,
.home-canvas-cover::after,
.home-canvas-row-cover::after {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 2px;
  content: "";
  pointer-events: none;
}
.book-cover img,
.home-canvas-cover img,
.home-canvas-row-cover img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-alt);
}
.cover-fallback {
  position: relative;
  z-index: 0;
  display: -webkit-box;
  width: 100%;
  padding: 8px 5px;
  overflow: hidden;
  background: rgba(35, 92, 69, .22);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.row-main { min-width: 0; }

.rank-row {
  grid-template-columns: 30px 62px minmax(0, 1fr);
  gap: 10px;
}
.rank-row .book-cover {
  width: 62px;
  height: 88px;
}
.rank-row .row-main { grid-column: 3; }

.home-canvas-slide {
  grid-template-columns: 76px 42px minmax(0, 1fr) 82px;
  min-height: 122px;
}
.home-canvas-cover {
  width: 76px;
  height: 108px;
}
.home-canvas-hero-cover .cover-fallback { font-size: 12px; }
.home-canvas-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 76px;
  padding: 7px 0;
}
.home-canvas-row-cover {
  width: 44px;
  height: 62px;
}
.home-canvas-row-cover .cover-fallback { padding: 5px 3px; font-size: 9px; }
.home-canvas-row-copy {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-canvas-row-copy em { color: var(--accent); font-style: normal; }
.home-canvas-row small { margin-left: 0; }

html[data-theme="dark"] .book-cover,
html[data-theme="dark"] .home-canvas-cover,
html[data-theme="dark"] .home-canvas-row-cover {
  border-color: var(--line);
  background: var(--surface-alt);
}
html[data-theme="dark"] .book-cover img,
html[data-theme="dark"] .home-canvas-cover img,
html[data-theme="dark"] .home-canvas-row-cover img { background: var(--surface-alt); }
html[data-theme="dark"] .cover-fallback { background: rgba(112, 200, 155, .2); color: var(--ink); }

@media (max-width: 640px) {
  .book-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    min-height: 108px;
    padding: 11px 0;
  }
  .book-cover { width: 58px; height: 82px; }
  .rank-row { grid-template-columns: 24px 56px minmax(0, 1fr); gap: 8px; }
  .rank-row .book-cover { width: 56px; height: 79px; }
  .rank-row .row-main { grid-column: 3; }
  .home-canvas-slide {
    grid-template-columns: 64px 30px minmax(0, 1fr);
    gap: 8px;
    min-height: 110px;
  }
  .home-canvas-cover { width: 64px; height: 91px; }
  .home-canvas-read { grid-column: 3; justify-self: start; min-height: 30px; padding: 5px 8px; }
  .home-canvas-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 7px; }
  .home-canvas-row-cover { width: 42px; height: 59px; }
}

/* Cover refinement: keep the content list dense and the cover treatment rectangular. */
.book-cover,
.home-canvas-cover,
.home-canvas-row-cover {
  border-radius: 0;
  place-items: center;
}
.book-cover::after,
.home-canvas-cover::after,
.home-canvas-row-cover::after {
  display: none;
}
.cover-fallback {
  display: block;
  width: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  -webkit-line-clamp: unset;
}

/* Homepage carousel: one clear cover column, with rank badge attached to the cover. */
.home-canvas-slide {
  position: relative;
  grid-template-columns: 86px minmax(0, 1fr) 86px;
  gap: 16px;
  min-height: 132px;
}
.home-canvas-cover {
  width: 86px;
  height: 122px;
}
.home-canvas-rank {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  padding: 2px 5px;
  background: rgba(33, 91, 64, .78);
  color: #fff;
  font: 700 10px/1.2 Georgia, "STSong", serif;
  text-align: center;
}
.home-canvas-info { align-self: center; }
.home-canvas-read { align-self: center; }

/* Homepage latest stays a pure text list. */
.home-canvas-row {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 0;
  gap: 8px;
}
.home-canvas-row-cover { display: none; }
.home-canvas-row-copy {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", "宋体", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-canvas-row-copy em { color: var(--accent); font-style: normal; }

/* Ranking: number, cover and text have independent aligned columns. */
.rank-row {
  grid-template-columns: 30px 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 114px;
}
.rank-row .book-cover {
  width: 64px;
  height: 90px;
}
.rank-index {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--accent);
  font-size: 14px;
}
.rank-row:nth-child(1) .rank-index { border-color: #d8b15e; color: #b98925; }
.rank-row:nth-child(2) .rank-index { border-color: #afc2cc; color: #718e9b; }
.rank-row:nth-child(3) .rank-index { border-color: #c99873; color: #a86d45; }

html[data-theme="dark"] .cover-fallback { color: var(--muted); }
html[data-theme="dark"] .rank-index { background: var(--surface-alt); border-color: var(--line); color: var(--accent); }

@media (max-width: 640px) {
  .home-canvas-slide {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    min-height: 110px;
  }
  .home-canvas-cover { width: 64px; height: 91px; }
  .home-canvas-read {
    grid-column: 2;
    justify-self: start;
    min-height: 30px;
    padding: 5px 8px;
  }
  .rank-row {
    grid-template-columns: 28px 56px minmax(0, 1fr);
    gap: 8px;
    min-height: 102px;
  }
  .rank-row .book-cover { width: 56px; height: 79px; }
  .rank-index { width: 28px; height: 28px; min-height: 28px; }
}

/* Rank order fix: keep the serial column before the cover column. */
.rank-row .rank-index { grid-column: 1; grid-row: 1; }
.rank-row .book-cover { grid-column: 2; grid-row: 1; }
.rank-row .row-main { grid-column: 3; grid-row: 1; }

/* Larger list covers and crown badges for ranking. */
.book-row {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  min-height: 140px;
}
.book-cover {
  width: 82px;
  height: 114px;
}
.rank-row {
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 14px;
  min-height: 138px;
  align-items: center;
}
.rank-row .book-cover {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  width: 78px;
  height: 110px;
  margin-top: 6px;
}
.rank-row .row-main {
  grid-column: 2;
  grid-row: 1;
}
.rank-row .rank-index {
  position: absolute;
  top: -10px;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  min-width: 38px;
  height: 27px;
  min-height: 27px;
  padding: 0 7px;
  transform: translateX(-50%);
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #fff;
  font: 700 13px/1 Georgia, "STSong", serif;
  box-shadow: 0 2px 0 rgba(26, 73, 49, .16);
}
.rank-row .rank-index i { font-size: 12px; line-height: 1; }
.rank-row:nth-child(1) .rank-index { border-color: #c49a35; background: #d8b15e; color: #604a19; }
.rank-row:nth-child(2) .rank-index { border-color: #8eaab7; background: #afc2cc; color: #415f6b; }
.rank-row:nth-child(3) .rank-index { border-color: #b67d58; background: #c99873; color: #633d27; }

@media (max-width: 640px) {
  .book-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 11px;
    min-height: 120px;
  }
  .book-cover { width: 68px; height: 96px; }
  .rank-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    min-height: 118px;
  }
  .rank-row .book-cover { width: 68px; height: 96px; }
  .rank-row .rank-index { top: -9px; min-width: 36px; height: 25px; min-height: 25px; }
}


/* codex rank badge scheme C */
.rank-row .book-cover { position: relative; overflow: visible; }
.rank-row .rank-index {
  position: absolute;
  top: 0; right: 0; bottom: auto; left: auto; z-index: 5;
  display: flex; align-items: flex-start; justify-content: flex-end;
  width: 42px; height: 42px; min-width: 0; min-height: 0;
  padding: 5px 6px 0 18px; border: 0; border-radius: 0;
  background: var(--accent-dark); color: #fff;
  font: 800 15px/1 Arial, sans-serif; text-align: right;
  box-shadow: none; clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.rank-row .rank-index i { display: none; }
.rank-row:nth-child(-n+3) .rank-index { background: var(--accent); color: #fff; }
html[data-theme="dark"] .rank-row .rank-index { background: #176b4a; color: #effff4; border-color: transparent; }
html[data-theme="dark"] .rank-row:nth-child(-n+3) .rank-index { background: #2fa875; color: #f2fff8; }
@media (max-width: 640px) {
  .rank-row .rank-index { width: 38px; height: 38px; padding: 4px 5px 0 16px; font-size: 14px; }
}

/* codex rank list left index + mobile carousel */
.rank-row { grid-template-columns: 30px 68px minmax(0, 1fr); gap: 12px; align-items: center; }
.rank-row .rank-index {
  position: static; grid-column: 1; grid-row: 1; display: grid; place-items: center;
  width: 30px; height: auto; min-width: 30px; min-height: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; color: var(--muted);
  font: 700 20px/1 Georgia, "STSong", serif; text-align: center;
  box-shadow: none; clip-path: none;
}
.rank-row .rank-index i { display: none; }
.rank-row:nth-child(-n+3) .rank-index { background: transparent; color: var(--accent-dark); }
.rank-row .book-cover { grid-column: 2; grid-row: 1; width: 68px; height: 96px; overflow: hidden; }
.rank-row .row-main { grid-column: 3; grid-row: 1; }
html[data-theme="dark"] .rank-row .rank-index { background: transparent; color: #a9bdb2; }
html[data-theme="dark"] .rank-row:nth-child(-n+3) .rank-index { color: #78d8a7; }
@media (max-width: 640px) {
  .rank-row { grid-template-columns: 24px 68px minmax(0, 1fr); gap: 10px; min-height: 118px; }
  .rank-row .rank-index { width: 24px; min-width: 24px; font-size: 18px; }
  .rank-row .book-cover { width: 68px; height: 96px; }
  .home-canvas-carousel { min-height: 160px; padding: 14px 12px 28px; }
  .home-canvas-slide { grid-template-columns: 82px minmax(0, 1fr); grid-template-rows: auto auto; align-items: start; gap: 8px 12px; min-height: 128px; }
  .home-canvas-cover { grid-column: 1; grid-row: 1 / span 2; width: 82px; height: 114px; }
  .home-canvas-info { grid-column: 2; grid-row: 1; align-self: start; padding-top: 2px; }
  .home-canvas-title { margin-bottom: 6px; font-size: 16px; line-height: 1.45; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .home-canvas-meta { gap: 3px 7px; font-size: 11px; line-height: 1.5; }
  .home-canvas-read { grid-column: 2; grid-row: 2; justify-self: start; align-self: start; min-height: 30px; margin-top: 2px; padding: 6px 10px; font-size: 11px; }
  .home-canvas-dots { right: 12px; bottom: 10px; }
}
@media (max-width: 360px) {
  .home-canvas-slide { grid-template-columns: 74px minmax(0, 1fr); gap: 8px 10px; }
  .home-canvas-cover { width: 74px; height: 104px; }
}


/* codex night rank index transparent */
html[data-theme="dark"] .rank-row .rank-index,
html[data-theme="dark"] .rank-row:nth-child(-n+3) .rank-index {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: #78d8a7;
}

/* codex catalog order toggle */
.directory-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; }
.directory-toolbar > label { grid-column: 1 / -1; }
.directory-toolbar > input { grid-column: 1; }
.directory-toolbar > #chapter-jump-btn { grid-column: 2; }
.chapter-order-toggle { display: inline-flex; grid-column: 3; min-width: 0; }
.chapter-order-toggle button { min-width: 43px; }
.chapter-order-toggle button + button { margin-left: -1px; }
.chapter-order-toggle button.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
html[data-theme="dark"] .chapter-order-toggle button { background: var(--surface); color: var(--muted); }
html[data-theme="dark"] .chapter-order-toggle button.is-active { border-color: var(--accent); background: var(--accent); color: #173b2b; }
@media (max-width: 640px) {
  .directory-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .directory-toolbar > label { grid-column: 1 / -1; }
  .directory-toolbar > input { grid-column: 1; }
  .directory-toolbar > #chapter-jump-btn { grid-column: 2; }
  .chapter-order-toggle { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .chapter-order-toggle button { width: 100%; }
}

/* codex cover hover rail */
/* Keep list hover feedback attached to the cover after vertical covers are present. */
.book-row,
.book-row:hover {
  border-left-width: 0 !important;
  border-left-color: transparent !important;
  box-shadow: none !important;
}
.book-row .book-cover::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 3px;
  background: transparent;
  content: "";
  pointer-events: none;
  transition: background-color .18s ease;
}
.book-row:hover .book-cover::before,
.book-row:focus-visible .book-cover::before {
  background: var(--accent);
}
html[data-theme="dark"] .book-row:hover .book-cover::before,
html[data-theme="dark"] .book-row:focus-visible .book-cover::before {
  background: var(--accent);
}


/* codex detail cover */
.detail-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.detail-cover {
  width: 168px;
  height: 236px;
  grid-row: auto;
}
.detail-cover .cover-fallback {
  width: 100%;
  padding: 0 10px;
  white-space: normal;
  text-align: center;
}
.detail-layout .detail-info {
  padding-top: 2px;
}
.detail-layout + .detail-desc {
  margin-top: 18px;
}
@media (max-width: 640px) {
  .detail-layout {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 13px;
  }
  .detail-cover {
    width: 112px;
    height: 157px;
  }
  .detail-layout .detail-info h1 { font-size: 20px; }
  .detail-layout .detail-meta { gap: 4px 9px; }
}
@media (max-width: 360px) {
  .detail-layout {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 11px;
  }
  .detail-cover {
    width: 100px;
    height: 140px;
  }
}

/* codex rank index transform reset */
/* The index is now a normal grid column; clear the old crown-badge offset. */
.rank-row .rank-index {
  transform: none !important;
}

/* codex hover effect e */
/* Use a restrained lift and side shadow for list rows; keep the homepage carousel untouched. */
.book-row .book-cover::before,
.book-row:hover .book-cover::before,
.book-row:focus-visible .book-cover::before {
  background: transparent !important;
}
.book-row:hover,
.book-row:focus-visible {
  border-left-width: 0 !important;
  border-left-color: transparent !important;
  background: var(--blue-soft) !important;
  box-shadow: -3px 0 0 var(--accent), 0 4px 12px rgba(27, 52, 41, .09) !important;
  transform: translateX(3px);
}
.book-row:hover .row-title,
.book-row:focus-visible .row-title {
  color: var(--accent);
}
html[data-theme="dark"] .book-row:hover,
html[data-theme="dark"] .book-row:focus-visible {
  box-shadow: -3px 0 0 var(--accent), 0 4px 12px rgba(0, 0, 0, .25) !important;
}

/* codex hover no rail */
/* Keep the lift and soft shadow from effect E, but remove the vertical rail. */
.book-row:hover,
.book-row:focus-visible {
  box-shadow: 0 4px 12px rgba(27, 52, 41, .09) !important;
}
html[data-theme="dark"] .book-row:hover,
html[data-theme="dark"] .book-row:focus-visible {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25) !important;
}

/* codex hover effect f */
/* Quiet hover state: background and title emphasis only. */
.book-row:hover,
.book-row:focus-visible {
  border-left-width: 0 !important;
  border-left-color: transparent !important;
  background: var(--blue-soft) !important;
  box-shadow: none !important;
  transform: none !important;
}
.book-row:hover .row-title,
.book-row:focus-visible .row-title {
  color: var(--accent);
}

/* codex hover f dark override */
html[data-theme="dark"] .book-row:hover,
html[data-theme="dark"] .book-row:focus-visible {
  box-shadow: none !important;
}

/* codex home carousel detail link */
/* The complete slide opens the detail page; the dots remain separate controls. */
.home-canvas-slide {
  grid-template-columns: 46px minmax(0, 1fr);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, outline-color .18s ease;
}
.home-canvas-slide:hover { background: var(--blue-soft); }
.home-canvas-slide:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.home-canvas-blurb {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
@media (max-width: 480px) {
  .home-canvas-slide { grid-template-columns: 82px minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .home-canvas-slide { grid-template-columns: 74px minmax(0, 1fr); }
}

/* codex home carousel desktop grid */
/* Match the desktop grid track to the actual vertical cover width. */
.home-canvas-slide {
  grid-template-columns: 86px minmax(0, 1fr);
}

/* codex home carousel mobile grid */
/* Re-apply the mobile cover tracks after the desktop grid override. */
@media (max-width: 480px) {
  .home-canvas-slide { grid-template-columns: 82px minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .home-canvas-slide { grid-template-columns: 74px minmax(0, 1fr); }
}

/* codex home top before title */
/* Keep the ranking cue in the title line instead of overlaying the cover. */
.home-canvas-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.home-canvas-title-line .home-canvas-rank {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: Georgia, "STSong", serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.home-canvas-title-line .home-canvas-title {
  min-width: 0;
  flex: 1 1 auto;
  margin-bottom: 0;
}

/* codex home rank position reset */
/* Clear the old cover-overlay positioning after moving TOP into the title line. */
.home-canvas-title-line .home-canvas-rank {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  transform: none;
}

/* codex home top light style */
/* Remove the legacy cover-badge block now that TOP is part of the title line. */
.home-canvas-title-line .home-canvas-rank {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .03em;
}

/* codex home top badge */
/* A restrained flat label gives TOP a clear visual container without overpowering the title. */
.home-canvas-title-line .home-canvas-rank {
  padding: 2px 6px;
  border: 1px solid #b9d9c4;
  border-radius: 3px;
  background: #eef8f1;
  color: #3f8c60;
  font-size: 11px;
  line-height: 1.25;
}
html[data-theme="dark"] .home-canvas-title-line .home-canvas-rank {
  border-color: #4e8667;
  background: #203d31;
  color: #a6e5bb;
}

/* codex home top title alignment */
/* Align the rank badge and book title as one coherent title row. */
.home-canvas-title-line {
  align-items: center;
  gap: 7px;
}
.home-canvas-title-line .home-canvas-rank {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  line-height: 1;
}
.home-canvas-title-line .home-canvas-title {
  line-height: 1.4;
}

/* codex home carousel cover size */
/* Reduce the cover slightly while preserving its vertical-cover ratio. */
.home-canvas-slide {
  grid-template-columns: 78px minmax(0, 1fr);
}
.home-canvas-cover {
  width: 78px;
  height: 110px;
}
@media (max-width: 480px) {
  .home-canvas-slide { grid-template-columns: 74px minmax(0, 1fr); }
  .home-canvas-cover { width: 74px; height: 104px; }
}
@media (max-width: 360px) {
  .home-canvas-slide { grid-template-columns: 68px minmax(0, 1fr); }
  .home-canvas-cover { width: 68px; height: 96px; }
}


/* codex detail responsive final */
/* Desktop keeps the live detail flow while reducing cover dominance. */
.detail-layout {
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.detail-layout .detail-cover {
  width: 128px;
  height: 180px;
  margin: 0;
}
.detail-layout .detail-info { min-width: 0; }
.detail-layout + .detail-desc { margin-top: 16px; }

/* Mobile: cover and short metadata share the first row; tags and actions move below. */
@media (max-width: 640px) {
  .detail-card { padding: 13px; }
  .detail-layout {
    display: grid;
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }
  .detail-layout .detail-cover {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 98px;
    height: 138px;
    margin: 0;
  }
  .detail-layout .detail-info { display: contents; }
  .detail-layout .detail-info h1 {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    font-size: 20px;
  }
  .detail-layout .detail-info .detail-meta {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    gap: 4px 9px;
    margin-top: 8px;
  }
  .detail-layout .detail-info .detail-latest {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
    margin-top: 8px;
  }
  .detail-layout .detail-info .detail-tags {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
  }
  .detail-layout .detail-info .detail-actions {
    grid-column: 1 / -1;
    grid-row: 5;
    justify-content: center;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .detail-layout .detail-info .detail-actions a {
    min-width: 120px;
    text-align: center;
  }
  .detail-layout + .detail-desc { margin-top: 15px; }
}
@media (max-width: 360px) {
  .detail-layout { grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
  .detail-layout .detail-cover { width: 92px; height: 129px; }
  .detail-layout .detail-info h1 { font-size: 19px; }
}

/* codex home mobile dots */
/* Bring the carousel dots closer to the cover and summary on small screens. */
@media (max-width: 480px) {
  .home-canvas-dots { bottom: 28px; }
}

/* codex home mobile carousel tight row */
/* Match the active row height to the resized cover and remove the lower blank band. */
@media (max-width: 480px) {
  .home-canvas-slide { min-height: 110px; }
}
@media (max-width: 360px) {
  .home-canvas-slide { min-height: 102px; }
}


/* codex detail mobile tags no separator */
/* Keep the mobile tag spacing, but remove the divider against the info row. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags { border-top: 0; }
}

/* codex home mobile dots bottom */
/* Reduce the unused band below the dots while keeping a small breathing space. */
@media (max-width: 480px) {
  .home-canvas-carousel { min-height: 152px; }
  .home-canvas-dots { bottom: 12px; }
}

/* codex home mobile carousel compact */
/* Keep the dots close to the summary while removing the lower empty band. */
@media (max-width: 480px) {
  .home-canvas-carousel {
    min-height: 132px;
    padding-bottom: 6px;
  }
  .home-canvas-dots { bottom: 14px; }
}
@media (max-width: 360px) {
  .home-canvas-carousel { min-height: 124px; }
  .home-canvas-dots { bottom: 12px; }
}


/* codex detail mobile tags spacing */
/* Tighten the tag block after removing its divider; desktop remains unchanged. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags {
    margin-top: 5px;
    padding-top: 0;
  }
}

/* codex rank list geometry */
/* Match latest-list geometry while retaining a dedicated serial column. */
.rank-row {
  grid-template-columns: 30px 82px minmax(0, 1fr);
  gap: 14px;
  min-height: 140px;
  align-items: start;
}
.rank-row .rank-index {
  grid-column: 1;
  grid-row: 1;
  width: 30px;
  min-width: 30px;
  min-height: 0;
  height: auto;
}
.rank-row .book-cover {
  grid-column: 2;
  grid-row: 1;
  width: 82px;
  height: 114px;
  margin-top: 0;
}
.rank-row .row-main {
  grid-column: 3;
  grid-row: 1;
}
@media (max-width: 640px) {
  .rank-row {
    grid-template-columns: 24px 68px minmax(0, 1fr);
    gap: 11px;
    min-height: 120px;
    align-items: start;
  }
  .rank-row .rank-index { width: 24px; min-width: 24px; }
  .rank-row .book-cover { width: 68px; height: 96px; }
}


/* codex reading record */
.header-actions .reading-record-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, .9);
  box-shadow: none;
  cursor: pointer;
}
.header-actions .reading-record-toggle:hover,
.header-actions .reading-record-toggle:focus-visible {
  background: transparent;
  color: #fff;
  outline: 0;
}
.reading-record-toggle i { font-size: 17px; line-height: 1; }
.reading-record-label { font-size: 10px; line-height: 1.2; white-space: nowrap; }
html[data-theme="dark"] .header-actions .reading-record-toggle { color: var(--gold); }
html[data-theme="dark"] .header-actions .reading-record-toggle:hover,
html[data-theme="dark"] .header-actions .reading-record-toggle:focus-visible { color: var(--accent); }

.reading-record-mask {
  position: fixed;
  z-index: 10000;
  inset: 0;
  padding: 10vh 12px 20px;
  background: rgba(12, 35, 30, .38);
}
.reading-record-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: 80vh;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(12, 35, 30, .2);
}
.reading-record-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
}
.reading-record-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 28px;
  cursor: pointer;
}
.reading-record-close:hover { color: var(--accent); }
.reading-record-empty { padding: 28px 14px; color: var(--muted); text-align: center; }
.reading-record-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; }
.reading-record-list { margin: 0; padding: 0 14px; list-style: none; }
.reading-record-list li { padding: 10px 0; border-bottom: 1px solid var(--soft-line); cursor: pointer; }
.reading-record-list li:last-child { border-bottom: 0; }
.reading-record-list li a { display: block; color: var(--ink); text-decoration: none; }
.reading-record-list li a:hover { color: var(--accent); }
.reading-record-book { display: block; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }
.reading-record-chapter { display: block; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.reading-record-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 0; color: var(--muted); }
.reading-record-pager button,
.reading-record-clear { height: 30px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 2px; background: var(--surface); color: var(--accent); cursor: pointer; }
.reading-record-pager button:disabled { border-color: var(--line); color: var(--muted); cursor: default; }
.reading-record-clear { display: block; margin: 12px auto; background: var(--accent); color: #fff; }
html[data-theme="dark"] .reading-record-mask { background: rgba(0, 0, 0, .56); }
html[data-theme="dark"] .reading-record-panel { box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
@media (max-width: 640px) {
  .reading-record-mask { padding: 8vh 10px 16px; }
  .reading-record-panel { max-height: 84vh; }
}

/* codex rank top title layout */
/* Ranking uses the same two-column geometry as other cover lists; TOP stays with the title. */
.rank-row {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  min-height: 140px;
  align-items: start;
}
.rank-row .book-cover {
  grid-column: 1;
  grid-row: 1;
  width: 82px;
  height: 114px;
  margin-top: 0;
}
.rank-row .row-main {
  grid-column: 2;
  grid-row: 1;
}
.rank-title-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.rank-title-label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid #b9d9c4;
  border-radius: 3px;
  background: #eef8f1;
  color: #3f8c60;
  font: 700 11px/1.25 Georgia, "STSong", serif;
  letter-spacing: .03em;
  white-space: nowrap;
}
.rank-title-line .row-title {
  min-width: 0;
  flex: 1 1 auto;
  margin-bottom: 0;
  line-height: 1.4;
}
html[data-theme="dark"] .rank-title-label {
  border-color: #4e8667;
  background: #203d31;
  color: #a6e5bb;
}
@media (max-width: 640px) {
  .rank-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 11px;
    min-height: 120px;
  }
  .rank-row .book-cover { width: 68px; height: 96px; }
}


/* codex header controls compact */
/* Keep the two header controls visually balanced with the brand block. */
.header-actions { gap: 4px; }
.header-actions .theme-toggle,
.header-actions .reading-record-toggle {
  width: 52px;
  height: 40px;
  gap: 1px;
}
.header-actions .theme-toggle .theme-icon,
.header-actions .reading-record-toggle i { font-size: 16px; }
.header-actions .theme-toggle .theme-toggle-label,
.header-actions .reading-record-label { font-size: 9px; }


/* codex reading record dark transparent */
/* Match the adjacent night-mode control instead of the generic button surface. */
html[data-theme="dark"] .header-actions .reading-record-toggle,
html[data-theme="dark"] .header-actions .reading-record-toggle:hover,
html[data-theme="dark"] .header-actions .reading-record-toggle:focus-visible {
  background: transparent;
  border-color: transparent;
}


/* codex mobile detail tags right expand */
/* Keep one compact tag line beside the cover; reveal the rest on demand. */
@media (max-width: 640px) {
  .detail-layout .detail-cover {
    grid-row: 1 / span 4;
  }
  .detail-layout .detail-info .detail-tags {
    grid-column: 2;
    grid-row: 3;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 5px;
    align-self: start;
    max-height: 24px;
    margin-top: 5px;
    padding: 0;
    overflow: hidden;
    border-top: 0;
    line-height: 20px;
  }
  .detail-layout .detail-info .detail-tags > span,
  .detail-layout .detail-info .detail-tags > a {
    min-height: 20px;
    line-height: 18px;
  }
  .detail-layout .detail-info .detail-tags > a { padding: 0 5px; }
  .detail-layout .detail-info .detail-tags.has-overflow { padding-right: 43px; }
  .detail-layout .detail-info .detail-tags.is-expanded {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .detail-tags-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 4px;
    border: 0;
    background: var(--surface);
    color: var(--accent);
    font-size: 11px;
    line-height: 20px;
    cursor: pointer;
  }
  .detail-layout .detail-info .detail-latest {
    grid-column: 2;
    grid-row: 4;
    align-self: start;
    margin-top: 5px;
  }
}


/* codex detail tags toggle hidden */
@media (max-width: 640px) {
  .detail-tags-toggle[hidden] { display: none; }
}

/* codex reading record modal focus */
/* Separate the record panel from the page with a quiet, blurred focus layer. */
.reading-record-mask {
  background: rgba(14, 31, 25, .50);
  -webkit-backdrop-filter: blur(4px) saturate(.92);
  backdrop-filter: blur(4px) saturate(.92);
}
.reading-record-panel {
  position: relative;
  border-color: rgba(78, 134, 103, .46);
  border-radius: 6px;
  box-shadow: 0 20px 56px rgba(12, 35, 30, .26), 0 0 0 1px rgba(255, 255, 255, .18);
}
.reading-record-header {
  background: rgba(255, 255, 255, .34);
}
html[data-theme="dark"] .reading-record-mask {
  background: rgba(4, 9, 15, .72);
}
html[data-theme="dark"] .reading-record-panel {
  border-color: #30495d;
  box-shadow: 0 20px 56px rgba(0, 0, 0, .52), 0 0 0 1px rgba(143, 214, 176, .08);
}
html[data-theme="dark"] .reading-record-header {
  background: rgba(27, 43, 58, .82);
}
@media (max-width: 640px) {
  .reading-record-mask { padding: 7vh 10px 16px; }
  .reading-record-panel { border-radius: 5px; }
}


/* codex mobile detail vertical balance */
/* Fit the four right-side information rows within the cover height. */
@media (max-width: 640px) {
  .detail-layout {
    row-gap: 4px;
  }
  .detail-layout .detail-info .detail-meta { margin-top: 4px; }
  .detail-layout .detail-info .detail-tags { margin-top: 2px; }
  .detail-layout .detail-info .detail-latest { margin-top: 2px; }
}

/* codex reading record modal icon clarity */
/* Keep the header controls recognizable while the modal still separates the page. */
.reading-record-mask {
  background: rgba(14, 31, 25, .58);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html[data-theme="dark"] .reading-record-mask {
  background: rgba(4, 9, 15, .68);
}


/* codex mobile actions single divider */
/* Let the description keep the only divider below the action buttons. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-actions {
    padding-top: 8px;
    padding-bottom: 8px;
    border-top: 0;
  }
}


/* codex expanded tags button row */
/* After expansion, move the control below the tags instead of overlaying them. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags.is-expanded .detail-tags-toggle {
    position: static;
    flex: 0 0 100%;
    width: 100%;
    height: 20px;
    margin-top: 2px;
    padding: 0;
    justify-content: flex-end;
    background: transparent;
  }
}


/* codex mobile tags arrow below */
/* Put the toggle in its own row below the tags so it never covers content. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags {
    display: block;
    max-height: none;
    overflow: visible;
    padding: 0;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 5px;
    max-height: 20px;
    overflow: hidden;
    line-height: 20px;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    max-height: none;
    overflow: visible;
  }
  .detail-layout .detail-info .detail-tags-content > span,
  .detail-layout .detail-info .detail-tags-content > a {
    min-height: 20px;
    line-height: 18px;
  }
  .detail-layout .detail-info .detail-tags-content > a { padding: 0 5px; }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle,
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    position: static;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 20px;
    margin-top: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 11px;
    line-height: 20px;
    cursor: pointer;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle[hidden] {
    display: none;
  }
  .detail-tags-toggle i {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    transition: transform .16s ease;
  }
  .detail-tags.is-expanded .detail-tags-toggle i { transform: rotate(180deg); }
}



/* codex mobile tags popover balance */
/* Keep the right-side detail rows compact; expanded tags float over the detail card instead of changing its height. */
@media (max-width: 640px) {
  .detail-layout {
    row-gap: 2px;
  }
  .detail-layout .detail-info .detail-meta {
    gap: 3px 8px;
    margin-top: 2px;
  }
  .detail-layout .detail-info .detail-tags {
    position: relative;
    display: block;
    align-self: start;
    height: 20px;
    min-height: 20px;
    max-height: none;
    margin-top: 0;
    padding: 0;
    overflow: visible;
    line-height: 20px;
    z-index: 2;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-content {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    gap: 3px 4px;
    width: 100%;
    height: 20px;
    max-height: 20px;
    overflow: hidden;
    line-height: 20px;
  }
  .detail-layout .detail-info .detail-tags.has-overflow > .detail-tags-content {
    padding-right: 34px;
  }
  .detail-layout .detail-info .detail-tags-content > span,
  .detail-layout .detail-info .detail-tags-content > a {
    min-height: 18px;
    line-height: 17px;
  }
  .detail-layout .detail-info .detail-tags-content > a {
    padding: 0 4px;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 20px;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--surface);
    color: var(--accent);
    font-size: 10px;
    line-height: 20px;
    cursor: pointer;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle span {
    display: none;
  }
  .detail-layout .detail-info .detail-tags-toggle i {
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    transition: transform .16s ease;
  }
  .detail-layout .detail-info .detail-tags.is-expanded {
    z-index: 8;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    width: auto;
    height: var(--detail-tags-panel-height, 72px);
    max-height: var(--detail-tags-panel-height, 72px);
    padding: 4px 5px 23px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(17, 44, 39, .16);
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    top: calc(var(--detail-tags-panel-height, 72px) - 20px);
    right: 1px;
    left: 1px;
    z-index: 5;
    width: auto;
    height: 19px;
    border-top: 1px solid var(--soft-line);
    background: var(--surface);
  }
  .detail-layout .detail-info .detail-tags.is-expanded .detail-tags-toggle i {
    transform: rotate(180deg);
  }
  .detail-layout .detail-info .detail-latest {
    align-self: start;
    margin-top: 0;
  }
  html[data-theme="dark"] .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content,
  html[data-theme="dark"] .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .34);
  }
}
@media (max-width: 360px) {
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    height: var(--detail-tags-panel-height, 64px);
    max-height: var(--detail-tags-panel-height, 64px);
  }
}



/* codex mobile tags popover position fix */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    position: absolute;
    display: inline-flex;
    margin: 0;
  }
}



/* codex mobile tags popover upward */
/* Expand above the tag row so latest chapter and actions remain visible below it. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    top: calc(20px - var(--detail-tags-panel-height, 72px));
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    top: 0;
  }
}



/* codex desktop tags spacing */
/* The tag script wraps links in a content span; restore clear desktop spacing inside it. */
@media (min-width: 641px) {
  .detail-layout .detail-info .detail-tags > .detail-tags-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
  }
}



/* codex mobile tags inline toggle */
/* Keep expansion in the document flow; no floating panel or covered metadata. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags.is-expanded {
    height: auto;
    min-height: 20px;
    max-height: none;
    overflow: visible;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    gap: 3px 4px;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 10px;
    line-height: 18px;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle span {
    display: inline;
  }
  .detail-layout .detail-info .detail-tags.is-expanded .detail-tags-toggle i {
    transform: rotate(180deg);
  }
}



/* codex mobile tags toggle below */
/* Keep the control in a consistent row below the visible tags in both states. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags {
    display: block;
    height: auto;
    min-height: 20px;
    max-height: none;
    overflow: visible;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-content,
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    gap: 3px 4px;
    width: 100%;
    height: 20px;
    max-height: 20px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-content {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle,
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 10px;
    line-height: 18px;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle span,
  .detail-layout .detail-info .detail-tags.is-expanded > .detail-tags-toggle span {
    display: inline;
  }
  .detail-layout .detail-info .detail-tags > .detail-tags-toggle[hidden] {
    display: none;
  }
}



/* codex mobile tags same line width */
/* The toggle now sits below the tags, so collapsed and expanded states need the same content width. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-tags.has-overflow {
    padding-right: 0;
  }
  .detail-layout .detail-info .detail-tags.has-overflow > .detail-tags-content {
    padding-right: 0;
  }
}

/* codex reading record scheme c */
/* Light floating panel: a quiet surface with spacious, readable rows. */
.reading-record-panel {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(10, 42, 28, .28);
}
.reading-record-header {
  height: 60px;
  padding: 0 20px;
  border-bottom: 0;
  background: transparent;
}
.reading-record-header strong { color: var(--ink); }
.reading-record-empty { padding: 44px 20px; }
.reading-record-list { padding: 0 20px 8px; }
.reading-record-list li { padding: 14px 0; }
html[data-theme="dark"] .reading-record-panel {
  border: 0;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .56);
}
html[data-theme="dark"] .reading-record-header {
  background: transparent;
}
@media (max-width: 640px) {
  .reading-record-panel { border-radius: 7px; }
  .reading-record-header { height: 56px; padding: 0 18px; }
  .reading-record-list { padding: 0 18px 6px; }
  .reading-record-list li { padding: 13px 0; }
}



/* codex mobile actions divider final */
/* Separate the latest chapter from the reading actions on mobile only. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-actions {
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
}

/* codex reading record buttons scheme c */
/* Text-first actions keep the light floating panel quiet and consistent. */
.reading-record-pager {
  gap: 10px;
  padding: 12px 20px 0;
}
.reading-record-pager button,
.reading-record-clear {
  min-height: 30px;
  height: 30px;
  padding: 4px 2px;
  border-color: transparent;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
}
.reading-record-pager button:hover:not(:disabled),
.reading-record-clear:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-dark, var(--accent));
}
.reading-record-pager button:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  opacity: .55;
}
.reading-record-clear {
  display: block;
  margin: 12px 20px 18px;
  text-align: left;
  color: var(--muted);
}
.reading-record-clear:hover { color: var(--accent); }
@media (max-width: 640px) {
  .reading-record-pager { padding: 11px 18px 0; }
  .reading-record-clear { margin: 11px 18px 16px; }
}



/* codex mobile actions divider scheme e */
/* Light dashed separation above the mobile reading actions. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-actions {
    border-top-style: dashed;
  }
}



/* codex mobile action dividers balanced */
/* Equalize the mobile breathing room above and below the action row. */
@media (max-width: 640px) {
  .detail-layout .detail-info .detail-actions {
    padding-top: 8px;
    padding-bottom: 0;
    border-top-style: dashed;
  }
  .detail-layout + .detail-desc {
    margin-top: 8px;
  }
  .detail-card > .detail-desc {
    padding-top: 8px;
    border-top-style: dashed;
  }
}

/* codex reading record clear centered */
.reading-record-clear {
  width: max-content;
  margin: 12px auto 18px;
  text-align: center;
}
@media (max-width: 640px) {
  .reading-record-clear { margin: 11px auto 16px; }
}



/* codex catalog scheme a */
/* Clean ledger treatment: transparent title band, quiet controls, continuous chapter rows. */
.directory-page-head.directory-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 15px 14px;
  border: 0;
  border-left: 4px solid var(--accent);
  border-bottom: 1px solid var(--soft-line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}
.directory-page-head.directory-ledger-head::before { display: none; }
.directory-page-head.directory-ledger-head h1 {
  position: static;
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.45;
  text-align: left;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding-left: 0;
  border-left: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  text-align: right;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat span {
  padding: 0;
  background: transparent;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat b {
  display: inline;
  color: var(--accent-deep);
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
}
.directory-history-row {
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
  margin: 9px 0;
  padding: 0 4px;
  border: 0;
  text-align: left;
}
.directory-history-row a {
  display: inline-block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  text-decoration: none;
}
.directory-history-row a:hover { background: transparent; color: var(--accent-deep); }
.directory-toolbar {
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.directory-toolbar input,
.directory-toolbar button { border-radius: 2px; }
#directory-list { border-top: 0; }
#directory-list li { padding: 0; border-bottom: 1px solid var(--soft-line); }
#directory-list li:hover { background: var(--accent-soft); }
#directory-list li a { padding: 10px 4px; line-height: 22px; }
html[data-theme="dark"] .directory-page-head.directory-ledger-head { background: transparent; border-left-color: var(--accent); border-bottom-color: var(--soft-line); }
html[data-theme="dark"] .directory-history-row a { background: transparent; color: var(--muted); }
html[data-theme="dark"] .directory-history-row a:hover { color: var(--accent); }
@media (max-width: 430px) {
  .directory-page-head.directory-ledger-head { gap: 10px; padding: 13px 10px; }
  .directory-page-head.directory-ledger-head h1 { font-size: 17px; }
  .directory-page-head.directory-ledger-head .directory-chapter-stat { font-size: 11px; }
  .directory-page-head.directory-ledger-head .directory-chapter-stat b { font-size: 11px; }
  .directory-history-row { gap: 12px; margin: 8px 0; padding: 0 2px; }
  .directory-toolbar { padding: 9px 0; }
}



/* codex catalog action controls */
/* Make detail navigation and chapter ordering read as deliberate controls, not plain text. */
.directory-history-row {
  justify-content: flex-start;
  gap: 7px;
  margin: 10px 0;
  padding: 0 4px;
}
.directory-history-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.directory-history-row a:hover,
.directory-history-row a:first-child:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.chapter-order-toggle {
  display: inline-flex;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}
.chapter-order-toggle button,
.chapter-order-toggle button + button {
  min-width: 52px;
  height: 27px;
  margin-left: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  line-height: 27px;
}
.chapter-order-toggle button:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.chapter-order-toggle button.is-active {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
html[data-theme="dark"] .directory-history-row a,
html[data-theme="dark"] .chapter-order-toggle { background: var(--surface); }
html[data-theme="dark"] .chapter-order-toggle button.is-active { color: #173b2b; }
@media (max-width: 430px) {
  .directory-history-row { gap: 7px; margin: 9px 0; padding: 0 2px; }
  .directory-history-row a { min-height: 29px; padding: 0 10px; }
  .chapter-order-toggle { width: 100%; }
  .chapter-order-toggle button { flex: 1 1 0; }
}

/* codex nav search scheme a */
/* Balanced cells, a quiet active surface, and one continuous search control. */
.m-nav {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.m-nav a {
  position: relative;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  box-shadow: none;
}
.m-nav a:last-child { border-right: 0; }
.m-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark, var(--accent));
  font-weight: 700;
  box-shadow: none;
}
.m-nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--accent);
  content: "";
}
.search_top {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface-2);
}
.search_top input:not([type="hidden"]) {
  min-width: 0;
  flex: 1 1 auto;
  height: 36px;
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--surface);
  color: var(--ink);
}
.search_top button {
  width: 74px;
  height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}


/* codex catalog action controls v2 */
/* Clear primary/secondary hierarchy and keep the label readable in both palettes. */
.directory-history-row {
  gap: 8px;
  margin: 11px 0;
}
.directory-history-row a {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 30px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
  transform: translateY(-1px);
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--blue-deep);
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep);
  transform: translateY(-1px);
}
.chapter-order-toggle {
  gap: 3px;
  padding: 3px;
  border-radius: 4px;
}
.chapter-order-toggle button,
.chapter-order-toggle button + button {
  height: 26px;
  border-radius: 3px;
  line-height: 26px;
  font-weight: 600;
}
.chapter-order-toggle button:hover {
  background: var(--accent-soft);
  color: var(--blue-deep);
}
.chapter-order-toggle button.is-active {
  background: var(--accent);
  color: #fff;
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible,
html[data-theme="dark"] .chapter-order-toggle button.is-active {
  color: #10251e !important;
}
@media (max-width: 430px) {
  .directory-history-row { gap: 7px; margin: 9px 0; }
  .directory-history-row a { min-height: 30px; padding: 0 11px; line-height: 28px; }
}


/* codex directory toolbar v2 */
/* Give chapter location its own visual group and keep the controls compact. */
.directory-toolbar {
  grid-template-columns: minmax(160px, 220px) auto max-content;
  justify-content: start;
  column-gap: 8px;
  row-gap: 8px;
  margin: 12px 0;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: var(--surface-alt);
}
.directory-toolbar > label {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}
.directory-toolbar > label::before {
  flex: 0 0 auto;
  width: 4px;
  height: 15px;
  border-radius: 1px;
  background: var(--accent);
  content: "";
}
.directory-toolbar > input {
  grid-column: 1;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  outline: 0;
}
.directory-toolbar > input::placeholder { color: var(--muted); }
.directory-toolbar > input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.directory-toolbar > #chapter-jump-btn {
  grid-column: 2;
  height: 32px;
  min-width: 56px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.directory-toolbar > #chapter-jump-btn:hover,
.directory-toolbar > #chapter-jump-btn:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  filter: brightness(.96);
}
.chapter-order-toggle {
  grid-column: 3;
  align-self: center;
  height: 32px;
}
html[data-theme="dark"] .directory-toolbar > #chapter-jump-btn,
html[data-theme="dark"] .directory-toolbar > #chapter-jump-btn:hover,
html[data-theme="dark"] .directory-toolbar > #chapter-jump-btn:focus-visible {
  color: #10251e;
}
@media (max-width: 640px) {
  .directory-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    padding: 10px;
  }
  .directory-toolbar > label { grid-column: 1 / -1; }
  .directory-toolbar > input { grid-column: 1; }
  .directory-toolbar > #chapter-jump-btn { grid-column: 2; }
  .chapter-order-toggle {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* codex directory detail dark contrast */
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #10251e !important;
}


/* codex directory toolbar scheme c */
/* Keep the label and jump action on one line; give ordering its own quiet row. */
.directory-toolbar {
  display: grid;
  grid-template-columns: auto minmax(160px, 220px) auto;
  align-items: center;
  justify-content: start;
  column-gap: 8px;
  row-gap: 9px;
  margin: 12px 0;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.directory-toolbar > label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 32px;
  white-space: nowrap;
}
.directory-toolbar > label::before {
  display: none;
  content: none;
}
.directory-toolbar > input {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  outline: 0;
}
.directory-toolbar > input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.directory-toolbar > #chapter-jump-btn {
  grid-column: 3;
  grid-row: 1;
  height: 32px;
  min-width: 56px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.chapter-order-toggle {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  width: auto;
  height: 32px;
}
html[data-theme="dark"] .directory-toolbar > #chapter-jump-btn {
  color: #10251e;
}
@media (max-width: 640px) {
  .directory-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    row-gap: 8px;
    padding: 10px 0;
  }
  .directory-toolbar > label {
    grid-column: 1 / -1;
    grid-row: 1;
    line-height: 18px;
  }
  .directory-toolbar > input {
    grid-column: 1;
    grid-row: 2;
  }
  .directory-toolbar > #chapter-jump-btn {
    grid-column: 2;
    grid-row: 2;
  }
  .chapter-order-toggle {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: stretch;
    width: 100%;
  }
}


/* codex catalog title actions scheme c */
/* Center the book identity and keep the two navigation actions light and balanced. */
.directory-page-head.directory-ledger-head {
  display: block;
  padding: 17px 14px 13px;
  border-left: 0;
  border-bottom: 1px solid var(--soft-line);
  text-align: center;
}
.directory-page-head.directory-ledger-head h1 {
  display: block;
  width: 100%;
  overflow: visible;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.45;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  display: block;
  width: auto;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.directory-history-row {
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
  padding: 0 8px;
  border-bottom: 0;
  text-align: center;
}
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  min-height: 31px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 29px;
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--blue-deep);
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-page-head.directory-ledger-head {
  border-left: 0;
  border-bottom-color: var(--soft-line);
  background: transparent;
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  color: #10251e !important;
}
@media (max-width: 430px) {
  .directory-page-head.directory-ledger-head {
    padding: 14px 10px 11px;
  }
  .directory-page-head.directory-ledger-head h1 {
    font-size: 19px;
  }
  .directory-history-row {
    gap: 7px;
    margin: 9px 0;
    padding: 0 6px;
  }
  .directory-history-row a,
  .directory-history-row a:first-child,
  .directory-history-row a:nth-child(2) {
    min-width: 0;
    padding: 0 12px;
  }
}


/* codex catalog title actions scheme d */
/* Ledger layout: book identity left, chapter count right, square actions below. */
.directory-page-head.directory-ledger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 15px 14px 13px 13px;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--soft-line);
  background: var(--surface-alt);
  text-align: left;
}
.directory-page-head.directory-ledger-head h1 {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  flex: 0 0 auto;
  width: auto;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-align: right;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.directory-history-row {
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
}
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  min-height: 31px;
  padding: 0 13px;
  border-radius: 0;
  font-size: 12px;
  line-height: 29px;
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--blue-deep);
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-page-head.directory-ledger-head {
  border-left-color: var(--accent);
  background: var(--surface-alt);
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  color: #10251e !important;
}
@media (max-width: 430px) {
  .directory-page-head.directory-ledger-head {
    gap: 10px;
    padding: 13px 10px 11px 9px;
  }
  .directory-page-head.directory-ledger-head h1 {
    font-size: 18px;
  }
  .directory-page-head.directory-ledger-head .directory-chapter-stat {
    margin-top: 1px;
    font-size: 10px;
  }
  .directory-history-row {
    gap: 7px;
    padding: 8px 10px;
  }
  .directory-history-row a,
  .directory-history-row a:first-child,
  .directory-history-row a:nth-child(2) {
    min-width: 0;
    padding: 0 11px;
  }
}


/* codex catalog title actions scheme g */
/* Light actions first, then a quiet book identity block. */
.directory-page {
  display: flex;
  flex-direction: column;
}
.directory-history-row {
  order: 1;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
  padding: 9px 12px 0;
  border-bottom: 0;
  text-align: right;
}
.directory-page-head.directory-ledger-head {
  order: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 10px 14px 14px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  text-align: left;
}
.directory-page-head.directory-ledger-head h1 {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  flex: 0 0 auto;
  width: auto;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-align: right;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  min-height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 25px;
  font-weight: 600;
}
.directory-history-row a:first-child {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  border-color: #365c4a;
  background: #294735;
  color: #b8e4b4 !important;
}
@media (max-width: 430px) {
  .directory-history-row {
    justify-content: flex-start;
    padding: 8px 10px 0;
  }
  .directory-page-head.directory-ledger-head {
    gap: 10px;
    padding: 9px 10px 12px;
  }
  .directory-page-head.directory-ledger-head h1 {
    font-size: 18px;
  }
  .directory-history-row a,
  .directory-history-row a:first-child,
  .directory-history-row a:nth-child(2) {
    padding: 0 10px;
  }
}


/* codex catalog title actions scheme g order fix */
/* Preserve the directory flow after moving the navigation actions above the title. */
.directory-toolbar { order: 3; }
#directory-list { order: 4; }


/* codex align title actions to preview g */
/* Match preview G: title first, light actions immediately below, no DOM reordering. */
.directory-page {
  display: block;
}
.directory-history-row,
.directory-page-head.directory-ledger-head,
.directory-toolbar,
#directory-list {
  order: initial;
}
.directory-page-head.directory-ledger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 10px 14px 14px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  text-align: left;
}
.directory-page-head.directory-ledger-head h1 {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat {
  flex: 0 0 auto;
  width: auto;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-align: right;
}
.directory-page-head.directory-ledger-head .directory-chapter-stat b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.directory-history-row {
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
  padding: 9px 12px 0;
  border-bottom: 0;
  text-align: right;
}
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  min-height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 25px;
  font-weight: 600;
}
.directory-history-row a:first-child {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  border-color: #365c4a;
  background: #294735;
  color: #b8e4b4 !important;
}
@media (max-width: 430px) {
  .directory-page-head.directory-ledger-head {
    gap: 10px;
    padding: 9px 10px 12px;
  }
  .directory-page-head.directory-ledger-head h1 {
    font-size: 18px;
  }
  .directory-history-row {
    justify-content: flex-start;
    padding: 8px 10px 0;
  }
}


/* codex center title actions g */
/* Keep the two directory actions centered on every viewport. */
.directory-history-row {
  justify-content: center;
  text-align: center;
}
@media (max-width: 430px) {
  .directory-history-row {
    justify-content: center;
    text-align: center;
  }
}


/* codex catalog divider scheme a */
/* Keep one clear title boundary and quiet separators inside the chapter list. */
.directory-page-head.directory-ledger-head {
  border-bottom: 1px solid var(--line);
}
.directory-history-row {
  border-bottom: 0;
}
.directory-toolbar {
  border-top: 0;
  border-bottom: 0;
  background: transparent;
}
#directory-list {
  border-top: 0;
}
#directory-list li {
  border-bottom: 1px solid var(--soft-line);
}
#directory-list li:last-child {
  border-bottom: 0;
}


/* codex catalog dashed chapter dividers */
/* Match the detail page: quiet dashed separators between chapter rows. */
#directory-list li {
  border-bottom: 1px dashed var(--line);
}
#directory-list li:last-child {
  border-bottom: 0;
}


/* codex catalog action scheme a */
/* Match the selected preview: square light-outline controls with a soft primary fill. */
.directory-history-row {
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 0;
  text-align: center;
}
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 600;
  line-height: 28px;
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:first-child:hover,
html[data-theme="dark"] .directory-history-row a:first-child:focus-visible {
  border-color: #365c4a;
  background: #294735;
  color: #b8e4b4 !important;
}
@media (max-width: 430px) {
  .directory-history-row {
    gap: 7px;
    padding: 9px 10px;
  }
  .directory-history-row a,
  .directory-history-row a:first-child,
  .directory-history-row a:nth-child(2) {
    padding: 0 11px;
  }
}


/* codex catalog action color scheme a */
/* Keep both actions in the same light-green family while preserving hierarchy. */
.directory-history-row a:first-child {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--muted);
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--surface-alt);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-history-row a:first-child {
  border-color: #365c4a;
  background: var(--accent-soft);
  color: #b8e4b4 !important;
}
html[data-theme="dark"] .directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--muted);
}


/* codex catalog action neutral colors */
/* Use one calm surface for both actions; hierarchy comes from border and text. */
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2) {
  border-color: var(--line);
  background: var(--surface);
}
.directory-history-row a:first-child {
  border-color: var(--accent);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2) {
  color: var(--muted);
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--blue-deep);
}
html[data-theme="dark"] .directory-history-row a:first-child,
html[data-theme="dark"] .directory-history-row a:nth-child(2) {
  background: var(--surface);
}
html[data-theme="dark"] .directory-history-row a:first-child {
  border-color: var(--accent);
  color: var(--blue-deep) !important;
}


/* codex catalog action static */
/* Keep the directory actions visually identical before and during pointer interaction. */
.directory-history-row a,
.directory-history-row a:first-child,
.directory-history-row a:nth-child(2),
.directory-history-row a:hover,
.directory-history-row a:focus-visible,
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible,
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  transform: none;
  transition: none;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}


/* codex catalog action hover without movement */
/* Restore color feedback while keeping the control's position fixed. */
.directory-history-row a,
.directory-history-row a:hover,
.directory-history-row a:focus-visible {
  transform: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.directory-history-row a:first-child:hover,
.directory-history-row a:first-child:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep) !important;
}
.directory-history-row a:nth-child(2):hover,
.directory-history-row a:nth-child(2):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--blue-deep);
}


/* codex reader h1 unified glyph baseline */
/* Keep Chinese and ASCII numerals on the same desktop font metrics. */
body.reader-page .reader-head h1 {
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "宋体", serif;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}


/* codex reader unified typography */
/* Keep every reader glyph on the same CJK-capable metrics across desktop and mobile. */
body.reader-page .reader-head h1,
body.reader-page .reader-content,
body.reader-page .reader-content * {
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "宋体", serif;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}


/* codex directory toolbar desktop centering */
/* Center the complete control group on desktop; preserve the full-width mobile rows. */
.directory-toolbar {
  justify-content: center;
}
.directory-toolbar .chapter-order-toggle {
  justify-self: center;
}
@media (max-width: 640px) {
  .directory-toolbar {
    justify-content: stretch;
  }
  .directory-toolbar .chapter-order-toggle {
    justify-self: stretch;
  }
}


/* codex unified CJK title font fallback */
/* The replacement above covers home, list, search, detail, and catalog title stacks. */


/* codex reader pre-paint and directory night title repair */
/* Keep the saved reader background available before editorial.js initializes the card. */
html.reader-prepaint body.reader-page .reader-card {
  transition: none !important;
}
/* The dark theme previously applied a black surface directly to the title text box. */
.directory-page-head.directory-ledger-head h1,
.directory-page-head.directory-ledger-head .directory-chapter-stat span {
  background: transparent;
}
html[data-theme="dark"] .directory-page-head.directory-ledger-head {
  background: var(--surface) !important;
  border-bottom-color: var(--line);
}
html[data-theme="dark"] .directory-page-head.directory-ledger-head h1,
html[data-theme="dark"] .directory-page-head.directory-ledger-head .directory-chapter-stat span {
  background: transparent !important;
  color: var(--ink);
}


/* codex reader chapter boundary notice */
/* Keep boundary feedback in the same restrained green treatment as the reader. */
.reader-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10001;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(23, 63, 75, .94);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  pointer-events: none;
}
.reader-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
html[data-theme="dark"] .reader-toast {
  background: rgba(9, 20, 17, .95);
  color: #eef7e9;
  border-left-color: #80c69a;
}
@media (max-width: 480px) {
  .reader-toast {
    width: max-content;
    max-width: calc(100vw - 32px);
    white-space: normal;
  }
}

/* codex top reservation order */
body::before { top: 28px; }

/* codex remove top decoration */
body::before { display: none; }
