:root { color-scheme: light; --paper: #fbfaf7; --panel: #fffefa; --ink: #273b42; --muted: #68777a; --line: #d8dfdc; --accent: #40665c; --soft: #edf1ed; --shadow: #1838321c; --font-size: 18px; }
:root[data-theme="sepia"] { --paper: #f2e9d6; --panel: #f9f1e2; --ink: #433b2d; --muted: #796d57; --line: #d4c7af; --accent: #5a6545; --soft: #e9dfc9; --shadow: #49371626; }
:root[data-theme="night"] { color-scheme: dark; --paper: #192328; --panel: #212e33; --ink: #dedfd8; --muted: #a4b2b0; --line: #405052; --accent: #a9c7b5; --soft: #2a393d; --shadow: #0004; }
:root[data-font="small"] { --font-size: 16px; }
:root[data-font="large"] { --font-size: 21px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; -webkit-text-size-adjust: 100%; }
button, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: .25em; }
button { color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -80px; left: 12px; padding: 12px; z-index: 100; background: var(--panel); }
.skip-link:focus { top: 8px; }
.site-header { height: 76px; max-width: 1420px; margin: auto; padding: 0 44px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 11px; font-size: 12px; letter-spacing: .12em; text-decoration: none; white-space: nowrap; }
.coin-mark { border: 1px solid var(--accent); color: var(--accent); border-radius: 50%; display: grid; place-items: center; width: 29px; height: 29px; font-family: Georgia, serif; font-size: 10px; letter-spacing: -.07em; }
.header-tools { display: flex; align-items: center; gap: 18px; }
.text-button { border: 0; background: transparent; padding: 12px 6px; font-size: 12px; line-height: 1.5; }
.text-button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; }
.cover-main { max-width: 1020px; padding: 0 40px; margin: 0 auto; }
.cover { padding: 79px 0 78px; text-align: center; }
.eyebrow { font-size: 10px; font-weight: 500; letter-spacing: .21em; line-height: 1.8; color: var(--muted); }
.cover-ornament { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 52px auto 32px; color: var(--accent); }
.cover-ornament span { height: 1px; width: 58px; background: var(--line); }
.cover-ornament b { display: grid; place-items: center; width: 45px; height: 45px; border: 1px solid var(--accent); border-radius: 50%; font: 20px "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif; }
.cover h1 { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", serif; font-size: clamp(28px, 4.2vw, 46px); line-height: 1.8; letter-spacing: .16em; font-weight: 500; margin: 0 auto 24px; text-wrap: balance; }
.cover-introduction { max-width: 590px; margin: auto; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 14px; line-height: 2.25; letter-spacing: .07em; }
.cover-introduction p { margin: 0 0 12px; }
.cover-edition { margin: 30px 0; font-size: 11px; letter-spacing: .13em; color: var(--muted); }
.cover-actions { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.primary-link { display: inline-flex; justify-content: space-between; align-items: center; gap: 60px; min-width: 254px; border: 1px solid var(--accent); padding: 18px 24px; font-size: 13px; letter-spacing: .08em; text-decoration: none; background: var(--accent); color: var(--paper); transition: opacity .15s ease; }
.primary-link:hover { opacity: .85; }
.resume-link { font-size: 12px; line-height: 1.8; }
#resume-label { display: block; color: var(--muted); font-size: 11px; }
.contents-section { padding: 38px 0 54px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 180px 1fr; gap: 34px; }
.section-label p { font-size: 9px; letter-spacing: .18em; color: var(--muted); margin: 5px 0 13px; }
.section-label h2 { font: 24px "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .16em; margin: 0; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list a { display: flex; align-items: baseline; gap: 18px; padding: 16px 2px; text-decoration: none; font-size: 13px; line-height: 1.8; border-bottom: 1px solid var(--line); }
.toc-list a:hover, .toc-list a[aria-current="page"] { color: var(--accent); background: var(--soft); }
.toc-number { color: var(--muted); font: 10px Georgia, serif; letter-spacing: .08em; flex: 0 0 20px; }
.cover-footer { border-top: 1px solid var(--line); padding: 30px 0 40px; display: flex; flex-wrap: wrap; gap: 20px 28px; }
.subtle-link { color: var(--muted); font-size: 12px; line-height: 1.9; }
.cover-footer p { width: 100%; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.9; }
.reading-main { max-width: 776px; padding: 0 36px 120px; margin: auto; }
.chapter-meta { display: flex; align-items: baseline; gap: 20px; justify-content: space-between; padding: 42px 0 30px; color: var(--muted); font-size: 10px; line-height: 1.9; letter-spacing: .08em; }
.chapter-meta a { text-decoration: none; }
.chapter-meta > span { white-space: nowrap; font-family: Georgia, serif; letter-spacing: .12em; }
.manuscript { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", "MS PMincho", serif; font-size: var(--font-size); line-height: 2.25; line-break: strict; overflow-wrap: anywhere; letter-spacing: .055em; }
.manuscript h1 { display: flex; flex-direction: column; gap: 18px; margin: 14px 0 58px; font-size: 1.65em; line-height: 1.8; font-weight: 500; letter-spacing: .1em; }
.chapter-kicker { font-family: "Yu Gothic", Meiryo, sans-serif; font-size: 11px; color: var(--muted); letter-spacing: .2em; }
.manuscript h2 { font-size: 1.5em; font-weight: 500; margin: 40px 0 30px; }
.manuscript h3, .manuscript h4 { font-size: 1.05em; font-weight: 500; margin: 42px 0 25px; color: var(--accent); }
.manuscript p { margin: 0 0 1.55em; }
.manuscript strong { font-weight: 600; }
.manuscript ul { padding-left: 1.3em; }
.scene-break { width: 34px; border: 0; border-top: 1px solid var(--line); margin: 48px auto; }
.scene-illustration { margin: 2.3em 0 2.5em; break-inside: avoid; }
.scene-illustration-link { display: block; position: relative; border: 1px solid var(--line); background: var(--panel); text-decoration: none; }
.scene-illustration img { display: block; width: 100%; max-width: 100%; height: auto; }
.scene-illustration-zoom { position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); font: 11px/1.7 "Yu Gothic", Meiryo, sans-serif; letter-spacing: .04em; }
.scene-illustration figcaption { margin-top: 12px; color: var(--muted); font: 12px/1.85 "Yu Gothic", Meiryo, sans-serif; letter-spacing: .04em; overflow-wrap: anywhere; }
.chapter-end { text-align: center; color: var(--muted); font-size: 15px; margin: 38px 0 50px; }
.review-section { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 24px; }
.review-section summary { font-size: 12px; padding: 21px 0; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.review-section summary::-webkit-details-marker { display: none; }
.review-section details[open] summary span { transform: rotate(45deg); }
.review-inner { padding-bottom: 18px; }
.small-note { font-size: 11px; line-height: 1.9; color: var(--muted); }
.review-inner label { display: block; font-size: 11px; line-height: 1.7; margin: 20px 0 10px; }
textarea { width: 100%; resize: vertical; min-height: 135px; border: 1px solid var(--line); border-radius: 0; padding: 14px; background: var(--panel); color: var(--ink); font-size: 16px; line-height: 1.8; }
textarea::placeholder { color: var(--muted); }
.export-buttons { display: flex; gap: 18px; flex-wrap: wrap; }
.export-preview { margin-top: 16px; padding: 0 15px 12px; background: var(--soft); border: 1px solid var(--line); }
.export-preview summary { padding: 16px 0; }
.export-preview label { overflow-wrap: anywhere; }
.export-preview textarea { font-family: Consolas, "Yu Gothic", Meiryo, monospace; font-size: 13px; line-height: 1.7; }
.chapter-navigation { margin: 42px 0 20px; display: flex; flex-direction: column; align-items: stretch; gap: 25px; }
.next-chapter { display: grid; grid-template-columns: 1fr 30px; column-gap: 12px; row-gap: 8px; text-decoration: none; border: 1px solid var(--line); padding: 24px; }
.next-chapter:hover { background: var(--soft); border-color: var(--accent); }
.next-chapter span { font-size: 10px; color: var(--muted); }
.next-chapter strong { font-size: 14px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-weight: 500; line-height: 1.8; }
.next-chapter b { grid-row: 1 / 3; grid-column: 2; align-self: center; text-align: right; font-size: 18px; font-weight: 400; }
.previous-chapter { font-size: 11px; color: var(--muted); align-self: flex-start; }
.local-footnote { color: var(--muted); font-size: 10px; line-height: 1.9; margin-top: 35px; }
.reading-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 770px); padding: 9px 12px max(9px, env(safe-area-inset-bottom)); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; display: flex; align-items: center; z-index: 5; box-shadow: 0 -8px 30px var(--shadow); }
.reading-bar > a { display: grid; place-items: center; width: 48px; height: 42px; flex: 0 0 48px; text-decoration: none; font-size: 20px; }
.reading-location { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--muted); text-align: center; line-height: 1.7; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 8px; }
.reading-location span { font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reading-location small { font-size: 10px; min-width: 29px; }
.reading-bar progress { position: absolute; top: -2px; left: 0; width: 100%; height: 2px; border: 0; border-radius: 0; appearance: none; background: var(--line); color: var(--accent); }
.reading-bar progress::-webkit-progress-bar { background: var(--line); }
.reading-bar progress::-webkit-progress-value { background: var(--accent); }
.reading-bar progress::-moz-progress-bar { background: var(--accent); }
.reader-dialog { width: min(580px, calc(100% - 32px)); max-height: 83vh; max-height: 83dvh; padding: 24px 30px 30px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 20px 100px #0003; }
.reader-dialog::backdrop { background: #111b2080; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.dialog-top h2 { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: .1em; }
.dialog-book-title { font: 13px/1.9 "Yu Mincho", "Hiragino Mincho ProN", serif; color: var(--muted); margin: 12px 0 22px; }
.dialog-cover { display: inline-block; margin-top: 28px; }
.settings-dialog { max-width: 440px; }
.settings-dialog fieldset { margin: 26px 0; padding: 0; border: 0; }
.settings-dialog legend { font-size: 12px; margin-bottom: 14px; }
.setting-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.setting-options button { padding: 13px 5px; font-size: 12px; background: transparent; border: 1px solid var(--line); }
.setting-options button[aria-pressed="true"] { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.toast { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); padding: 12px 20px; font-size: 12px; z-index: 30; pointer-events: none; opacity: 0; transition: opacity .15s ease; }
.toast.visible { opacity: 1; }
.storage-message { font-size: 11px; line-height: 1.8; color: var(--muted); margin-top: 30px; }
.notes-article { font-size: calc(var(--font-size) - 1px); }
.notes-article > h2:first-of-type { margin-top: 24px; }
.notes-main .chapter-navigation { border-top: 1px solid var(--line); padding-top: 32px; align-items: flex-start; }
.library-main { max-width: 1060px; margin: auto; padding: 0 40px; }
.library-intro { text-align: center; padding: 66px 0 48px; }
.library-intro h1 { font: 500 clamp(32px, 4.4vw, 48px)/1.8 "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .18em; margin: 16px 0 20px; }
.library-lead { font: 16px/2.1 "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .1em; }
.library-note { font-size: 11px; line-height: 1.95; color: var(--muted); margin-top: 24px; }
.book-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.book-card { display: flex; flex-direction: column; padding: 30px; text-decoration: none; border: 1px solid var(--line); border-top: 3px solid var(--accent); background: var(--panel); transition: background .15s; min-width: 0; }
.book-card:hover { background: var(--soft); }
.book-card-top, .book-card-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.book-route { font-size: 11px; letter-spacing: .16em; color: var(--accent); }
.book-number { font: 14px Georgia, serif; color: var(--muted); }
.book-line { margin: 32px 0 11px; font-size: 11px; line-height: 1.8; color: var(--muted); }
.book-card h2 { font: 500 clamp(23px, 2.6vw, 28px)/1.75 "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .07em; margin: 0 0 17px; }
.book-description { font-size: 12px; line-height: 2; margin: 0 0 28px; color: var(--muted); }
.book-card-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.9; }
.book-card-bottom span:last-child { white-space: nowrap; }
.book-bad { border-top-style: double; }
.book-hell { border-top-color: var(--ink); }
.library-footer { margin-top: 48px; }
@media (min-width: 1200px) { .reading-main { max-width: 800px; padding-right: 48px; padding-left: 48px; } }
@media (max-width: 600px) {
  .library-main { padding: 0 22px; }
  .library-intro { padding: 36px 0 32px; }
  .library-intro h1 { font-size: 32px; }
  .library-lead { font-size: 14px; }
  .library-note { font-size: 10px; }
  .book-grid { grid-template-columns: 1fr; gap: 18px; }
  .book-card { padding: 24px; }
  .book-line { margin-top: 22px; }
  .site-header { height: 65px; padding: 0 20px; }
  .wordmark { font-size: 10px; gap: 8px; letter-spacing: .06em; }
  .header-tools { gap: 8px; }
  .text-button { font-size: 11px; padding: 12px 5px; }
  .cover-main { padding: 0 26px; }
  .cover { padding: 49px 0 49px; }
  .eyebrow { font-size: 9px; letter-spacing: .15em; }
  .cover-ornament { margin: 40px auto 27px; }
  .cover h1 { font-size: 30px; letter-spacing: .1em; line-height: 1.8; }
  .cover-introduction { font-size: 13px; line-height: 2.15; }
  .cover-edition { margin: 25px 0; }
  .contents-section { grid-template-columns: 1fr; gap: 23px; padding: 27px 0 40px; }
  .section-label { display: flex; align-items: baseline; gap: 15px; }
  .section-label p { order: 2; margin: 0; }
  .section-label h2 { font-size: 21px; }
  .toc-list a { font-size: 12px; gap: 12px; padding: 15px 2px; }
  .cover-footer { flex-direction: column; gap: 16px; padding: 27px 0; }
  .cover-footer p { font-size: 10px; }
  .reading-main { padding: 0 23px 110px; }
  .chapter-meta { padding-top: 28px; padding-bottom: 27px; gap: 15px; font-size: 9px; }
  .manuscript { font-size: calc(var(--font-size) - 1px); line-height: 2.18; letter-spacing: .04em; }
  .manuscript h1 { font-size: 1.55em; margin: 11px 0 42px; gap: 14px; }
  .manuscript p { margin-bottom: 1.4em; }
  .chapter-kicker { font-size: 10px; }
  .scene-break { margin: 38px auto; }
  .next-chapter { padding: 22px 18px; }
  .reading-bar { padding-right: 5px; padding-left: 5px; }
  .reading-location { gap: 10px; padding: 8px 3px; }
  .reading-location span { font-size: 10px; }
  .reader-dialog { padding: 18px 22px 26px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
.narration-edition { color: var(--accent); font-size: 12px; line-height: 1.9; margin: 24px 0; }
.reader-dock { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 770px); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -8px 30px var(--shadow); z-index: 5; }
.reader-dock .reading-bar { position: relative; bottom: auto; left: auto; transform: none; width: 100%; border: 0; box-shadow: none; }
.narration-player { padding: 10px 16px 8px; }
.narration-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 12px; }
.narration-heading small { color: var(--muted); font-size: 10px; }
.narration-player audio { display: block; width: 100%; height: 38px; }
.narration-options { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin-top: 5px; font-size: 11px; }
.narration-options button, .narration-options select { color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 4px; font: inherit; min-height: 32px; padding: 4px 9px; }
.narration-seek { display: flex; gap: 6px; }
.audio-speed-label { display: flex; align-items: center; gap: 6px; }
.audio-continuous-label { display: flex; align-items: center; gap: 5px; margin-left: auto; min-height: 32px; cursor: pointer; }
.audio-continuous-label input { accent-color: var(--accent); width: 16px; height: 16px; }
.narration-options :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.audio-status { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
body[data-narration="true"] .reading-main { padding-bottom: calc(var(--reader-dock-height, 190px) + 42px); }
body[data-narration="true"] .toast { bottom: calc(var(--reader-dock-height, 190px) + 14px); }
html:has(.reader-dock) { scroll-padding-bottom: calc(var(--reader-dock-height, 190px) + 20px); }
@media (max-width: 420px) {
  .narration-player { padding: 8px 10px 6px; }
  .narration-options { gap: 4px 10px; font-size: 10px; }
  .narration-options button, .narration-options select { min-height: 34px; padding: 4px 6px; }
  .narration-heading small { font-size: 9px; }
  .audio-continuous-label { margin-left: 0; }
}
@media print { .site-header, .reading-bar, .reader-dock, .review-section, .chapter-navigation, .local-footnote, dialog, .toast, .skip-link { display: none; } body { background: white; color: black; } .reading-main, body[data-narration="true"] .reading-main { max-width: none; padding: 0; } .manuscript { font-size: 11pt; line-height: 1.9; } .chapter-meta { padding: 0 0 20px; } }
