:root {
  color-scheme: light;
  --primary: #305d56;
  --background: #f5f7f6;
  --surface: #ffffff;
  --text: #243b38;
  --muted: #64736f;
  --border: #dce4df;
  --hover: #eaf0ed;
  --scroll-thumb: #a3b3ab;
  --scroll-hover: #748d81;
  --scroll-active: #305d56;
  --scroll-track: #f5f7f6;
  --cover: #274e47;
  --cover-text: #f5f3df;
  --font-body: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-reading: 'Songti SC', STSong, SimSun, serif;
  --reading-size: 20px;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --primary: #a5cbbd;
  --background: #182321;
  --surface: #202e2b;
  --text: #dce7e0;
  --muted: #a5b7ae;
  --border: #3a4c44;
  --hover: #2c3d36;
  --scroll-thumb: #627e6e;
  --scroll-hover: #8ba597;
  --scroll-active: #a5cbbd;
  --scroll-track: #182321;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scroll-track); }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid var(--scroll-track); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
*::-webkit-scrollbar-thumb:active { background: var(--scroll-active); }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--background); color: var(--text); font: 16px/1.7 var(--font-body); overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; cursor: pointer; }
a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 5px; }
button, input { font: inherit; }
button, .button { cursor: pointer; border: 1px solid var(--border); border-radius: 8px; padding: 9px 17px; min-height: 44px; background: var(--surface); color: var(--text); }
button:hover, .button:hover { background: var(--hover); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
[hidden] { display: none !important; }
::selection { color: var(--background); background: var(--primary); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.4; }
h1 { font-family: var(--font-reading); font-size: clamp(30px, 4vw, 44px); font-weight: 600; }
.site-header { max-width: 1184px; margin: auto; padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.site-header .brand { font: 600 24px var(--font-reading); letter-spacing: .12em; display: inline-flex; align-items: center; gap: 12px; }
.site-header .brand::before { content: '羽'; width: 34px; height: 38px; display: grid; place-items: center; background: var(--primary); color: var(--background); border-radius: 2px 7px 7px 2px; font-size: 20px; letter-spacing: 0; }
.site-header nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.site-header nav a { padding: 10px 0; }
#theme-toggle { font-size: 13px; background: transparent; }
.container { width: min(1120px, calc(100% - 64px)); margin: 0 auto; min-height: 65vh; }
.library-intro { padding: 70px 0 32px; max-width: 720px; }
.eyebrow { color: var(--primary); font-size: 12px; letter-spacing: .16em; margin-bottom: 14px; }
.library-intro h1 { margin-bottom: 18px; letter-spacing: .04em; }
.library-intro > p:last-child { color: var(--muted); }
.search-box { position: relative; max-width: 420px; margin-bottom: 20px; }
.search-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
#book-search { width: 100%; min-height: 48px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 75px 10px 16px; appearance: none; }
#book-search::-webkit-search-cancel-button { display: none; }
#clear-search { position: absolute; right: 4px; bottom: 2px; border: none; font-size: 13px; padding: 7px 12px; background: transparent; }
#search-status { color: var(--muted); font-size: 13px; min-height: 24px; margin: 20px 0; }
.book-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.book-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 25px; padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.book-cover { position: relative; isolation: isolate; aspect-ratio: 2 / 3; width: 100%; min-width: 0; padding: 27px 18px 22px 23px; display: flex; flex-direction: column; justify-content: space-between; background: var(--cover); color: var(--cover-text); border-radius: 2px 9px 9px 2px; border-left: 7px solid #203e38; box-shadow: 6px 7px 0 -2px #d4dfd6; overflow: hidden; }
.book-cover::before, .book-cover::after { content: ''; position: absolute; z-index: -1; border: 1px solid #65887a; width: 240px; height: 145px; border-radius: 50%; transform: rotate(-28deg); right: -95px; bottom: -62px; }
.book-cover::after { right: -78px; bottom: -77px; }
.cover-title { font: 600 24px/1.6 var(--font-reading); letter-spacing: .12em; }
.cover-subtitle { font-size: 10px; letter-spacing: .2em; margin-top: 20px; }
.book-cover:hover { color: var(--cover-text); }
.book-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.book-info h2 { font: 600 22px/1.5 var(--font-reading); margin: 3px 0 12px; }
.book-info .description, .book-info > p:not(.book-meta) { font-size: 14px; line-height: 1.85; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tags span { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--muted); }
.book-meta { color: var(--muted); font-size: 12px; margin-bottom: 15px; }
.book-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; }
.button.primary, .button-primary, .book-actions .button:first-child { background: var(--primary); color: var(--background); border-color: var(--primary); }
.button.primary:hover, .button-primary:hover, .book-actions .button:first-child:hover { filter: brightness(.9); }
.resume-link { font-size: 13px; color: var(--primary); padding: 10px 0; }
#no-results { text-align: center; padding: 60px 24px; border: 1px dashed var(--border); border-radius: 16px; color: var(--muted); }
.site-footer { width: min(1120px, calc(100% - 64px)); margin: 72px auto 0; padding: 25px 0 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 13px; padding: 25px 0; }
.book-detail { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 45px; padding: 30px 0 45px; max-width: 900px; }
.book-detail h1 { font-size: 34px; margin-bottom: 14px; }
.book-detail .book-description { max-width: 630px; color: var(--muted); }
.book-detail .book-info > p { font-size: 16px; }
.chapter-section { margin-top: 20px; }
.chapter-section h2 { font-size: 22px; font-family: var(--font-reading); }
.chapter-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; gap: 0 36px; }
.chapter-list li { border-bottom: 1px solid var(--border); min-width: 0; }
.chapter-list a { display: flex; align-items: center; gap: 14px; padding: 19px 12px; border-radius: 7px; font-size: 15px; }
.chapter-list a:hover { background: var(--hover); text-decoration: none; }
.chapter-list .chapter-number { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.reader-shell { max-width: 800px; margin: auto; }
.reader-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.reader-toolbar button { padding: 6px 15px; font-size: 14px; }
.font-size-label { min-width: 44px; text-align: center; color: var(--muted); font-size: 13px; }
.reader-heading { text-align: center; padding: 50px 0 34px; }
.reader-heading h1 { font-size: clamp(27px, 3vw, 36px); margin: 0 0 17px; }
.chapter-meta { font-size: 13px; color: var(--muted); }
.chapter-content { max-width: 720px; margin: 0 auto; font-family: var(--font-reading); font-size: var(--reading-size); line-height: 2; letter-spacing: .025em; }
.chapter-content p { text-indent: 2em; margin: 0 0 1.25em; }
.chapter-content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 20%; }
.chapter-navigation { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin: 50px 0 22px; }
.chapter-navigation > a, .chapter-navigation > span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 14px; }
.chapter-navigation > a:hover { background: var(--hover); text-decoration: none; }
.chapter-navigation > span { color: var(--muted); border-style: dashed; }
.progress-note { font-size: 12px; color: var(--muted); text-align: center; }
.reading-progress { height: 3px; background: var(--primary); width: 0; position: fixed; top: 0; left: 0; z-index: 10; pointer-events: none; }
.skip-link { position: absolute; left: 16px; top: -100px; padding: 10px; z-index: 20; background: var(--surface); }
.skip-link:focus { top: 10px; }
body[data-page='reader'] .site-footer { max-width: 800px; }
@media (max-width: 1000px) { .book-grid { grid-template-columns: 1fr; } .book-card { max-width: 740px; grid-template-columns: 170px minmax(0, 1fr); } }
@media (max-width: 600px) {
  .site-header { padding: 17px 20px; }
  .site-header .brand { font-size: 20px; gap: 8px; }
  .site-header nav { gap: 12px; }
  .site-header nav a { font-size: 12px; }
  #theme-toggle { padding: 7px 10px; font-size: 12px; }
  .container, .site-footer { width: calc(100% - 40px); }
  .library-intro { padding: 43px 0 22px; }
  .library-intro h1 { font-size: 30px; }
  .library-intro > p:last-child { font-size: 14px; }
  .book-card { grid-template-columns: 110px minmax(0, 1fr); gap: 18px; padding: 18px; }
  .book-cover { padding: 20px 12px 15px; }
  .cover-title { font-size: 19px; }
  .book-info h2 { font-size: 19px; }
  .book-info .description, .book-info > p:not(.book-meta) { font-size: 13px; }
  .book-card .tags { gap: 5px; }
  .book-actions { gap: 8px; }
  .book-actions .button { padding: 8px 12px; }
  .site-footer { margin-top: 45px; }
  .book-detail { grid-template-columns: 110px minmax(0, 1fr); gap: 22px; padding: 20px 0; }
  .book-detail h1 { font-size: 25px; }
  .book-detail .book-description { font-size: 14px; }
  .chapter-list { grid-template-columns: 1fr; }
  .reader-heading { padding: 35px 0 28px; }
  .reader-toolbar { justify-content: center; }
  .chapter-content { letter-spacing: .01em; }
  .chapter-navigation { gap: 8px; }
}
@media (max-width: 360px) { .site-header .brand::before { display: none; } .book-card { grid-template-columns: 85px minmax(0, 1fr); padding: 12px; gap: 12px; } .cover-title { font-size: 17px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media (forced-colors: active) { * { scrollbar-color: auto; } .book-cover { border: 1px solid CanvasText; } }
@media print { .site-header, .site-footer, .reader-toolbar, .chapter-navigation, .progress-note { display: none; } body { color: #000; background: #fff; } .container { width: 100%; } }
/* Shared template geometry. */
.site-header { display: block; }
.header-inner.container { width: 100%; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-brand { font: 600 24px var(--font-reading); letter-spacing: .1em; display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand-mark { width: 34px; height: 38px; display: grid; place-items: center; background: var(--primary); color: var(--background); border-radius: 2px 7px 7px 2px; font-size: 20px; letter-spacing: 0; }
.site-footer.container { min-height: 0; }
.site-footer p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 15px 0 24px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2 { margin-bottom: 0; font-size: 22px; }
.book-count { font: 13px var(--font-body); color: var(--muted); margin-left: 8px; }
.search-box { margin-bottom: 0; flex: 0 1 320px; }
.search-box > span[aria-hidden] { display: none; }
.book-meta > span:not(.status-dot) { margin-left: 16px; }
.latest-chapter { font-size: 12px !important; }
.cover-link { display: block; align-self: start; }
.cover-link:hover { text-decoration: none; }
.cover-kicker { font-size: 9px; letter-spacing: .12em; margin-bottom: 15px; }
.cover-seal { display: none; }
.book-detail > .book-cover { align-self: start; }
.chapter-arrow { margin-left: auto; color: var(--muted); }
.chapter-total { font-size: 13px; color: var(--muted); }
.reader-toolbar { justify-content: space-between; }
.reader-toolbar > a { font-size: 14px; padding: 10px 8px; }
.font-controls { display: flex; align-items: center; gap: 10px; }
.empty-state { padding: 65px 0; }
@media (max-width: 600px) {
  .site-brand { font-size: 20px; gap: 8px; }
  .section-heading { gap: 16px; flex-wrap: wrap; }
  .library-section .section-heading { align-items: stretch; }
  .library-section .search-box { flex-basis: 100%; max-width: none; }
  .cover-kicker { font-size: 8px; letter-spacing: 0; }
  .cover-title { line-height: 1.45; }
  .cover-subtitle { letter-spacing: 0; }
}
@media (max-width: 360px) { .brand-mark { display: none; } .site-header nav { gap: 8px; } }
.cover-title { font-size: 21px; line-height: 1.45; letter-spacing: .04em; }
.cover-subtitle { margin-top: 12px; }
@media (max-width: 600px) {
  .book-card .cover-title { font-size: 15px; line-height: 1.45; }
  .book-card .cover-kicker { font-size: 7px; margin-bottom: 8px; }
  .book-card .cover-subtitle { font-size: 8px; margin-top: 8px; }
  .book-detail .cover-title { font-size: 15px; line-height: 1.45; }
  .book-detail .cover-kicker { font-size: 7px; margin-bottom: 8px; }
  .book-detail .cover-subtitle { font-size: 8px; margin-top: 8px; }
}
@media (max-width: 360px) { .book-card .cover-kicker, .book-card .cover-subtitle { display: none; } .book-card .cover-title { font-size: 14px; } }
