:root {
  color-scheme: dark;
  --paper: #f0e6d2;
  --muted: #b9b19f;
  --gold: #e3bf78;
  --edge: #393b33;
  --story-size: 1.125rem;
  font-family: system-ui, sans-serif;
  background: #141c19;
  color: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--gold); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
button { font: inherit; }
[hidden] { display: none !important; }
.site-bar { max-width: 1220px; margin: auto; padding: 24px 32px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--edge); font-size: .85rem; }
.brand { font-weight: 750; letter-spacing: .2em; text-decoration: none; color: var(--gold); }
.reader-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 64px; max-width: 1180px; margin: auto; padding: 52px 32px; }
.chapter-shelf { align-self: start; position: sticky; top: 32px; }
.eyebrow { color: var(--gold); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; line-height: 1.6; }
.chapter-shelf h2 { font-family: Georgia, serif; font-size: 2.3rem; font-weight: 400; margin: 14px 0; }
.shelf-intro { color: var(--muted); font-size: .85rem; line-height: 1.7; }
.chapter-shelf ol { list-style: none; margin: 28px 0; padding: 0; display: grid; gap: 8px; }
.chapter-shelf a { display: grid; gap: 6px; padding: 16px; border: 1px solid transparent; border-radius: 6px; text-decoration: none; font-size: .95rem; line-height: 1.5; }
.chapter-shelf a[aria-current="page"] { background: #242d25; border-color: #655b3f; }
.chapter-number { display: block; font: 500 .75rem/1.6 system-ui, sans-serif; color: var(--gold); margin-bottom: 4px; }
.chapter-shelf .language-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chapter-shelf .language-switch a { padding: 8px 14px; min-height: 44px; align-content: center; border-color: var(--edge); }
.chapter-shelf .language-switch a[aria-current="true"] { color: var(--gold); background: #242d25; border-color: #655b3f; }
:lang(ja) #story { font-family: 'Noto Serif CJK JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif; line-height: 1.95; line-break: strict; }
:lang(ja) #story h1 { font-size: clamp(1.6rem, 4vw, 3.1rem); line-height: 1.5; letter-spacing: 0; text-wrap: balance; }
.reading-pane { min-width: 0; max-width: 44rem; }
.reader-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding-bottom: 20px; border-bottom: 1px solid var(--edge); font-size: .75rem; color: var(--muted); }
.text-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.text-controls button { background: #242d25; color: var(--paper); border: 1px solid #646855; border-radius: 5px; cursor: pointer; min-width: 44px; min-height: 44px; }
.text-controls button:disabled { opacity: .4; cursor: default; }
#story { font: var(--story-size)/1.85 Georgia, 'Times New Roman', serif; overflow-wrap: break-word; }
#story h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 400; line-height: 1.18; letter-spacing: -.025em; margin: 38px 0 32px; }
#story p { margin: 0 0 1.3em; }
#story strong { font-weight: 700; color: #ffedc7; }
#story hr { border: 0; text-align: center; margin: 2.5em 0; height: 1.5em; }
#story hr::after { content: '✦  ✦  ✦'; color: var(--gold); letter-spacing: .6em; font-size: .65em; }
.chapter-pagination { display: flex; gap: 24px; justify-content: space-between; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--edge); }
.chapter-pagination a { max-width: 48%; text-decoration: none; line-height: 1.5; }
.chapter-pagination .next { margin-left: auto; text-align: right; }
.reader-end { text-align: center; color: var(--muted); font-size: .75rem; margin: 60px 0 0; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { display: block; padding: 16px; }
.embedded .reader-layout { padding-top: 28px; }
@media (max-width: 800px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 20px 40px; }
  .chapter-shelf { position: static; }
  .chapter-shelf h2 { font-size: 1.75rem; margin: 8px 0; }
  .chapter-shelf ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px 0 0; gap: 8px; }
  .chapter-shelf a { padding: 12px; font-size: .85rem; border-color: var(--edge); height: 100%; }
  .shelf-intro { display: none; }
  .site-bar { padding: 20px; }
  #story h1 { margin-top: 28px; }
}
@media print {
  :root { color-scheme: light; background: white; color: black; }
  .site-bar, .chapter-shelf, .reader-tools, .chapter-pagination, .skip-link { display: none; }
  .reader-layout { display: block; padding: 0; }
  #story strong { color: black; }
}
