:root { color-scheme: light; --page: #f7f8fa; --ink: #222; --muted: #626669; --line: #d4d7db; --surface: #fff; --accent: #495a50; --reader-size: 1.375rem; --bar-height: 110px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
:root[data-theme="dark"] { color-scheme: dark; --page: #141713; --ink: #e6e9e3; --muted: #a7afa5; --line: #3a4138; --surface: #1c211a; --accent: #b9cbb7; }
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .25em; }
button { font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 2px; min-height: 44px; min-width: 44px; padding: .55rem .75rem; cursor: pointer; }
button:hover:not(:disabled) { background: var(--surface); border-color: var(--muted); }
button:disabled { opacity: .35; cursor: default; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 100; background: var(--surface); padding: .75rem; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.home-bar { width: min(100% - 3rem, 1080px); margin-inline: auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1.25rem; font-size: .875rem; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.book-home { width: min(100% - 3rem, 584px); margin: 1rem auto 5rem; }
:root[data-theme="dark"] .closing-art a img { filter: invert(1) grayscale(1); }
.book-cover { display: block; }
.book-cover img { width: 100%; }
.book-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1.5rem; margin-top: 2rem; }
.primary-link { display: inline-block; min-height: 44px; padding: .65rem 0; border-bottom: 1px solid var(--accent); }
.primary-link:hover { text-decoration: none; border-color: var(--ink); }
.resume-panel { border-block: 1px solid var(--line); margin-top: 2rem; padding: 1rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .9375rem; }
.resume-panel p { margin: 0; }
.resume-panel .muted { display: block; }
.muted { color: var(--muted); }
.reader-bar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px) minmax(0, 1fr); align-items: center; gap: 1.5rem; padding: .75rem clamp(1rem, 3vw, 3rem); background: var(--page); border-bottom: 1px solid var(--line); }
.home-link { grid-column: 1; grid-row: 1; justify-self: start; font-family: Georgia, serif; letter-spacing: .04em; font-size: 1.125rem; }
.chapter-banner-button { grid-column: 2; grid-row: 1; justify-self: center; display: block; border: 0; padding: 0; min-width: 0; width: 420px; max-width: 100%; }
.chapter-banner-button:hover:not(:disabled) { background: none; }
.chapter-banner-button img { width: 100%; max-height: 112px; object-fit: contain; background: #f7f8fa; }
.reader-controls { grid-column: 3; grid-row: 1; justify-self: end; flex-wrap: nowrap; font-size: .875rem; }
.reading-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; pointer-events: none; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.chapter { padding: 2.75rem 0 4rem; }
.chapter-opening { width: min(100% - 2rem, 780px); margin: 0 auto 4rem; }
.chapter-header { width: 100%; background: #f7f8fa; box-shadow: 0 .75rem 3rem #22222260; }
.chapter-copy { width: min(100% - 3rem, 680px); margin-inline: auto; font-size: var(--reader-size); line-height: 1.5; scroll-margin-top: calc(var(--bar-height) + 1rem); overflow-wrap: break-word; }
.chapter-copy p { margin: 0 0 1.1rem; }
.chapter-section + .chapter-section { margin-top: 1.1rem; }
.chapter-copy em { font-style: italic; }
.chapter-copy strong { font-weight: 700; }
.chapter-copy:focus { outline: 0; }
.closing-art { width: min(100% - 2rem, 780px); margin: 6rem auto 3rem; }
.closing-art a { display: block; margin-top: 2rem; }
.chapter-navigation { width: min(100% - 3rem, 680px); margin: 3rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; font-size: .9375rem; }
.chapter-navigation a { display: inline-flex; align-items: center; min-height: 44px; }
.chapter-navigation a:last-child { justify-self: end; text-align: right; }
.site-footer { width: min(100% - 3rem, 1080px); margin: 0 auto; padding: 1.5rem 0 2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .8125rem; }
.contents-dialog { width: min(100% - 2rem, 540px); max-height: calc(100dvh - 2rem); padding: 1.5rem; border: 1px solid var(--line); border-radius: 0; background: var(--page); color: var(--ink); }
.contents-dialog::backdrop { background: #0008; }
.contents-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.contents-heading h2 { font-size: 1.125rem; font-weight: 500; margin: 0; }
.contents-heading button { font-size: .875rem; }
.contents-art { width: 100%; margin: 1.5rem 0 .75rem; }
.contents-list { list-style: none; padding: 0; margin: 0; }
.contents-list li { border-bottom: 1px solid var(--line); }
.contents-list a { display: block; padding: .85rem .25rem; min-height: 48px; }
.chapter-summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.chapter-name { padding-top: .1rem; }
.chapter-status { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.chapter-progress { font-size: .8125rem; font-weight: 400; white-space: nowrap; }
.contents-list a[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 var(--accent); padding-left: .75rem; }
.contents-list .chapter-meta { margin-top: .1rem; color: var(--muted); font-size: .75rem; font-style: italic; font-weight: 400; white-space: nowrap; }
.contents-home { display: inline-block; margin-top: 1rem; padding-block: .5rem; font-size: .875rem; }
.share-status { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--page); padding: .75rem 1rem; margin: 0; max-width: calc(100% - 2rem); font-size: .875rem; overflow-wrap: anywhere; }
.share-status:empty { display: none; }
.load-status { width: min(100% - 3rem, 680px); margin: 2rem auto; color: var(--muted); }
@media (max-width: 1200px) {
  .reader-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem 1rem; }
  .chapter-banner-button { grid-column: 1 / -1; grid-row: 1; }
  .home-link { grid-row: 2; }
  .reader-controls { grid-column: 2; grid-row: 2; }
}
@media (max-width: 650px) {
  .home-bar { width: calc(100% - 2rem); }
  .reader-bar { padding: .65rem 1rem; }
  .home-link { display: none; }
  .chapter-banner-button { width: 360px; }
  .chapter-banner-button img { max-height: 90px; }
  .reader-controls { grid-column: 1 / -1; justify-self: center; flex-wrap: wrap; justify-content: center; gap: .3rem; font-size: .8125rem; }
  .reader-controls button { padding-inline: .6rem; }
  .chapter { padding-top: 2rem; }
  .chapter-opening { margin-bottom: 2.5rem; }
  .chapter-copy { width: calc(100% - 2.5rem); }
  .chapter-header { box-shadow: 0 .5rem 2rem #22222240; }
  .book-actions { gap: 1rem; font-size: .9375rem; }
  .resume-panel { flex-direction: column; align-items: flex-start; }
  .chapter-navigation { width: calc(100% - 2.5rem); gap: .65rem; font-size: .8125rem; }
  .contents-dialog { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
