.ebr-status { margin: 16px 0 0; text-align: center; }
.ebr-error { margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--seal); border-radius: var(--radius-card); color: var(--seal); background: var(--seal-soft); font-size: .9rem; }
.ebr-note { margin: 18px 0 0; font-size: .82rem; line-height: 1.7; }
body.ebr-reading > :not(#ebr) { display: none !important; }
body.ebr-reading { padding-top: 0 !important; background: var(--r-bg); }
body.ebr-reading {
  --r-bg: #f7f1e3; --r-text: #2a241d; --r-text-2: #4a4036; --r-muted: #7a6c58; --r-surface: #efe7d4; --r-surface-2: #e6dcc6;
  --r-border: #ddd1b9; --r-border-strong: #c8b99e; --r-accent: #8b2c20; --r-pill: 999px;
  --reader-font-size: 18px; --reader-line-height: 1.9; --reader-max-width: 34em; --reader-para-gap: 1em;
  --reader-font-family: var(--font-serif);
}
body.ebr-reading[data-ebr-font="sans"] { --reader-font-family: var(--font-sans); }
#ebr { background: var(--r-bg); color: var(--r-text); min-height: 100vh; font-family: var(--font-sans); }
body.ebr-reading[data-ebr-theme="warm"] { --r-bg: #e9d9b6; --r-text: #2d2418; --r-text-2: #4d3f2c; --r-muted: #75644a; --r-surface: #e0cea6; --r-surface-2: #d6c296; --r-border: #cdb98f; --r-border-strong: #b7a175; }
body.ebr-reading[data-ebr-theme="white"] { --r-bg: #fff; --r-text: #000; --r-text-2: #222; --r-muted: #555; --r-surface: #fff; --r-surface-2: #e8e8e8; --r-border: #999; --r-border-strong: #555; --r-accent: #000; }
body.ebr-reading[data-ebr-theme="dark"] { --r-bg: #1d1b18; --r-text: #e6dccb; --r-text-2: #c9bfad; --r-muted: #958a77; --r-surface: #26231f; --r-surface-2: #302c27; --r-border: #3a352e; --r-border-strong: #4d463d; --r-accent: #c97864; }
@media (min-width: 768px) { body.ebr-reading { --reader-font-size: 20px; } }
#ebr[hidden] { display: none; }
.ebr-bar { position: sticky; top: 0; z-index: 30; background: var(--r-bg); border-bottom: 1px solid var(--r-border); padding-top: env(safe-area-inset-top); }
.ebr-bar .bar-in { height: 52px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; max-width: 960px; margin: 0 auto; padding: 0 8px; }
.ebr-bar .bar-left { display: flex; }
.ebr-bar .bar-btn { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--r-text-2); font-size: .875rem; border-radius: var(--r-pill); cursor: pointer; }
.ebr-bar .bar-btn:hover, .ebr-bar .bar-btn[aria-expanded="true"] { background: var(--r-surface); color: var(--r-text); }
.ebr-bar .bar-title { margin: 0; text-align: center; font-size: .875rem; color: var(--r-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ebr-bar .bar-title b { font-weight: 500; color: var(--r-text); }
@media (max-width: 520px) { .ebr-bar .bar-title b, .ebr-bar .bar-sep { display: none; } }
.ebr-bar .aa-btn { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 600; width: 44px; height: 44px; border-radius: var(--r-pill); border: 0; background: none; color: var(--r-text-2); cursor: pointer; }
.ebr-bar .aa-btn:hover, .ebr-bar .aa-btn[aria-expanded="true"] { background: var(--r-surface); color: var(--r-text); }
.ebr-bar .progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.ebr-bar .progress span { display: block; height: 100%; width: 0; background: var(--r-accent); opacity: .7; }
#ebr .settings { border-top: 1px solid var(--r-border); background: var(--r-surface); }
#ebr .settings[hidden] { display: none; }
#ebr .settings-in { max-width: 560px; margin: 0 auto; padding: 16px 20px 20px; display: grid; gap: 16px; }
#ebr .set-row { display: grid; grid-template-columns: 4em minmax(0, 1fr); align-items: center; gap: 12px; }
#ebr .set-label { font-size: .875rem; color: var(--r-muted); }
#ebr .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--r-border-strong); border-radius: var(--r-pill); padding: 3px; gap: 3px; }
#ebr .seg input { position: absolute; opacity: 0; pointer-events: none; }
#ebr .seg label { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; border-radius: var(--r-pill); font-size: .875rem; cursor: pointer; color: var(--r-text-2); }
#ebr .seg input:checked + label { background: var(--r-text); color: var(--r-bg); }
#ebr .seg input:focus-visible + label { outline: 2px solid var(--r-accent); outline-offset: 1px; }
#ebr .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--r-border-strong); flex-shrink: 0; }
#ebr .sw-white { background: #fff; } #ebr .sw-light { background: #f7f1e3; } #ebr .sw-warm { background: #e9d9b6; } #ebr .sw-dark { background: #1d1b18; }
#ebr .stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; border: 1px solid var(--r-border-strong); border-radius: var(--r-pill); }
#ebr .stepper button { height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; line-height: 1; border: 0; background: none; border-radius: var(--r-pill); font-family: var(--font-serif); color: var(--r-text); cursor: pointer; }
#ebr .stepper button:hover { background: var(--r-surface-2); }
#ebr .stepper button:disabled { opacity: .35; cursor: default; background: none; }
#ebr .stepper output { text-align: center; font-family: var(--font-mono); font-size: .875rem; color: var(--r-text-2); }
#ebr .set-foot { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--r-muted); }
#ebr .set-foot button { border: 0; background: none; color: var(--r-text-2); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; font-size: .875rem; cursor: pointer; }
#ebr .set-foot .set-done { text-decoration: none; border: 1px solid var(--r-border-strong); border-radius: var(--r-pill); padding: 0 20px; color: var(--r-text); font-weight: 500; }
#ebr .set-foot .set-done:hover { background: var(--r-surface-2); }
.ebr-toc { position: sticky; top: calc(53px + env(safe-area-inset-top)); z-index: 25; max-height: min(70vh, 560px); overflow-y: auto; background: var(--r-surface); border-bottom: 1px solid var(--r-border); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.ebr-toc[hidden] { display: none; }
body.ebr-reading[data-ebr-theme="white"] .ebr-toc { box-shadow: none; border-bottom-color: var(--r-border-strong); }
.ebr-toc .toc-foot { padding: 0 20px 16px; text-align: center; }
.ebr-toc .toc-close { min-height: 36px; padding: 0 20px; border: 1px solid var(--r-border-strong); border-radius: var(--r-pill); background: none; color: var(--r-text); font-size: .875rem; font-weight: 500; cursor: pointer; }
.ebr-toc .toc-close:hover { background: var(--r-surface-2); }
.ebr-toc ol { list-style: none; margin: 0 auto; padding: 8px 20px 16px; max-width: 640px; }
.ebr-toc li a { display: block; padding: 10px 6px; color: var(--r-text-2); text-decoration: none; font-family: var(--font-serif); border-bottom: 1px solid var(--r-border); }
.ebr-toc li a:hover { color: var(--r-text); background: var(--r-surface-2); }
.ebr-toc li a[aria-current] { color: var(--r-accent); font-weight: 600; }
.ebr-main { max-width: none; margin: 0; padding: 0 20px 48px; }
@media (min-width: 768px) { .ebr-main { padding: 0 40px 64px; } }
#ebr .chapter { font-size: var(--reader-font-size); max-width: var(--reader-max-width); margin: 0 auto; padding: 2em 0 0; }
#ebr .chapter-body { font-family: var(--reader-font-family); line-height: var(--reader-line-height); color: var(--r-text); text-align: justify; text-justify: inter-character; overflow-wrap: anywhere; }
#ebr .chapter-body p { margin: 0 0 var(--reader-para-gap); }
#ebr .chapter-body h1, #ebr .chapter-body h2, #ebr .chapter-body h3, #ebr .chapter-body h4, #ebr .chapter-body h5, #ebr .chapter-body h6 { font-family: var(--reader-font-family); line-height: 1.5; margin: 1.2em 0 .8em; letter-spacing: .04em; }
#ebr .chapter-body h1 { font-size: 1.5em; } #ebr .chapter-body h2 { font-size: 1.3em; } #ebr .chapter-body h3 { font-size: 1.15em; }
#ebr .chapter-body h4, #ebr .chapter-body h5, #ebr .chapter-body h6 { font-size: 1em; }
#ebr .chapter-body blockquote { margin: 1em 0; padding: .5em .8em; border-left: 2px solid var(--r-border-strong); background: var(--r-surface); color: var(--r-text-2); }
#ebr .chapter-body blockquote p:last-child { margin-bottom: 0; }
#ebr .chapter-body em { font-style: normal; -webkit-text-emphasis: filled circle; text-emphasis: filled circle; -webkit-text-emphasis-position: under right; text-emphasis-position: under right; }
#ebr .chapter-body img { display: block; max-width: 100%; height: auto; margin: 1em auto; }
#ebr .chapter-body hr { border: 0; margin: 2em auto; text-align: center; height: auto; }
#ebr .chapter-body hr::before { content: "＊　＊　＊"; color: var(--r-muted); letter-spacing: .2em; }
#ebr .chapter-body a[data-target] { color: var(--r-accent); text-decoration: underline; text-underline-offset: 3px; }
#ebr .chapter-body table { border-collapse: collapse; margin: 1em 0; font-size: .9em; }
#ebr .chapter-body td, #ebr .chapter-body th { border: 1px solid var(--r-border-strong); padding: .3em .6em; }
#ebr .chapter-body pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: .85em; text-align: start; }
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
#ebr .v-pager { margin: 0; height: 32px; line-height: 32px; box-sizing: content-box; padding-bottom: max(12px, var(--safe-bottom)); text-align: center; font-family: var(--font-mono); font-size: .75rem; color: var(--r-muted); }
#ebr .v-pager[hidden] { display: none; }
.ebr-chnav { display: flex; justify-content: space-between; gap: 12px; max-width: var(--reader-max-width); font-size: var(--reader-font-size); margin: 3em auto 0; }
.ebr-chnav button { font-size: 1rem; min-width: 8em; }
.ebr-chnav button:disabled { opacity: .35; cursor: default; }
html[data-layout="v"] body.ebr-reading { --reader-font-size: 18px; }
@media (min-width: 768px) { html[data-layout="v"] body.ebr-reading { --reader-font-size: 22px; } }
html[data-layout="v"] .ebr-main { padding-bottom: 0; }
html[data-layout="v"] .v-stage { display: flex; justify-content: center; padding-top: 12px; touch-action: pan-y pinch-zoom; margin: 0 -20px; }
@media (min-width: 768px) { html[data-layout="v"] .v-stage { margin: 0 -40px; } }
html[data-layout="v"] .v-win { position: relative; overflow: hidden; flex: none; }
html[data-layout="v"] .v-stage { position: relative; }
html[data-layout="v"] .v-stage.is-wait .v-win { visibility: hidden; }
html[data-layout="v"] .v-pre { position: absolute; top: 0; left: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
#ebr .v-retry { font: inherit; font-size: .875rem; color: var(--r-text); background: var(--r-surface); border: 1px solid var(--r-border-strong); border-radius: var(--r-pill); padding: 0 16px; min-height: 32px; line-height: 30px; cursor: pointer; }
#ebr .v-retry:hover { background: var(--r-surface-2); }
html[data-layout="v"] .v-stage > .v-retry { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); min-height: 44px; font-family: var(--font-serif); font-size: 1rem; }
html[data-layout="v"] .v-stage.is-spread::before { content: ""; position: absolute; top: 12px; bottom: 0; left: 50%; border-left: 1px dashed var(--r-border-strong); pointer-events: none; }
html[data-layout="v"] #ebr .v-win > .chapter, html[data-layout="v"] #ebr .v-pre > .chapter { position: absolute; top: 0; right: 0; height: 100%; max-width: none; margin: 0; padding: 1.2em 0; writing-mode: vertical-rl; text-orientation: mixed; }
html[data-layout="v"] #ebr .chapter-body { line-break: strict; text-align: justify; text-justify: inter-character; overflow-wrap: normal; }
html[data-layout="v"] #ebr .chapter-body td, html[data-layout="v"] #ebr .chapter-body th { overflow-wrap: anywhere; }
html[data-layout="v"] #ebr .chapter-body p { margin: 0; text-indent: 2em; }
html[data-layout="v"] #ebr .chapter-body h1, html[data-layout="v"] #ebr .chapter-body h2, html[data-layout="v"] #ebr .chapter-body h3,
html[data-layout="v"] #ebr .chapter-body h4, html[data-layout="v"] #ebr .chapter-body h5, html[data-layout="v"] #ebr .chapter-body h6 { margin: 0; margin-block: .5em 1em; }
html[data-layout="v"] #ebr .chapter-body blockquote { margin: 0; margin-block: 1em; margin-inline-start: 2em; padding: .5em .8em; border: 0; border-block-start: 2px solid var(--r-border-strong); background: var(--r-surface); font-size: .95em; color: var(--r-text-2); }
html[data-layout="v"] #ebr .chapter-body blockquote p { text-indent: 0; }
html[data-layout="v"] #ebr .chapter-body hr { margin: 0; block-size: calc(var(--reader-line-height) * 2em); }
@font-face { font-family: "ReaderTone"; src: url("reader-tone.woff2?v=1792572313") format("woff2"); unicode-range: U+02C7, U+02CA-02CB, U+02D9, U+3105-312F; font-display: swap; }
html[data-layout="v"] #ebr .chapter-body rt { font-family: "ReaderTone", var(--font-sans); text-orientation: upright; }
html[data-layout="v"] #ebr .chapter-body pre { margin: 0; margin-block: 1em; padding: .8em; border: 1px solid var(--r-border); border-radius: 3px; background: var(--r-surface); font-size: .9em; line-height: 1.4; overflow-wrap: anywhere; max-inline-size: 100%; box-sizing: border-box; }
html[data-layout="v"] #ebr .chapter-body .horizontal-wrap-h:not(.is-v) { writing-mode: horizontal-tb; width: fit-content; max-width: calc(var(--v-w, 100vw) - 1em); box-sizing: border-box; margin: 0 1em; padding: .8em; border: 1px solid var(--r-border); border-radius: 3px; background: var(--r-surface); font-size: .9em; }
html[data-layout="v"] #ebr .chapter-body .horizontal-wrap-h:not(.is-v) pre { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 1em; }
html[data-layout="v"] #ebr .chapter-body img { margin: 0 auto; max-width: calc(var(--v-w, 100vw) - 1em); max-height: calc(var(--v-h, 100vh) - 2.4em); width: auto; height: auto; }
html[data-layout="v"] .ebr-chnav { display: none; }
html[data-layout="v"] #ebr .tcy { text-combine-upright: all; -webkit-text-combine: horizontal; margin-inline: .25em; position: relative; }
html[data-layout="v"] #ebr .latin-v { margin-inline: .25em; word-break: keep-all; vertical-align: .1em; line-height: 1; }
html[data-layout="v"] #ebr .sideways-punct { text-orientation: sideways; }
html[data-layout="v"] #ebr .chapter-body sup, html[data-layout="v"] #ebr .chapter-body sub { font-size: .7em; line-height: 0; }
html[data-layout="v"] #ebr sub .latin-v, html[data-layout="v"] #ebr sup .latin-v, html[data-layout="v"] #ebr sub .tcy, html[data-layout="v"] #ebr sup .tcy { margin-inline: 0; }
html[data-layout="v"] #ebr sub + .latin-v, html[data-layout="v"] #ebr sup + .latin-v, html[data-layout="v"] #ebr sub + .tcy, html[data-layout="v"] #ebr sup + .tcy { margin-inline-start: 0; }
html[data-layout="v"] #ebr .latin-v-pre-sub { margin-inline-end: 0; }
html[data-layout="v"] #ebr .chapter-body :not(pre) > code { font-family: var(--font-mono); font-size: .9em; background: var(--r-surface); border-radius: 2px; margin-inline: .2em; padding-inline: .15em; word-break: keep-all; overflow-wrap: break-word; }
html[data-layout="v"] #ebr .upright { text-orientation: upright; }
#ebr .tts[hidden], #ebr .tts-panel[hidden] { display: none; }
#ebr .tts-fab { position: fixed; z-index: 40; right: calc(12px + env(safe-area-inset-right)); bottom: calc(max(12px, var(--safe-bottom)) - 6px); width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--r-text); color: var(--r-bg); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); cursor: pointer; }
#ebr .tts-fab svg { width: 20px; height: 20px; fill: currentColor; }
#ebr .tts-fab .i-play, #ebr .tts-fab.is-playing .i-play { display: none; }
#ebr .tts-fab:not(.is-playing) .i-play { display: block; }
#ebr .tts-fab:not(.is-playing) .i-pause { display: none; }
#ebr .tts-panel { position: fixed; z-index: 40; right: calc(12px + env(safe-area-inset-right)); bottom: calc(max(12px, var(--safe-bottom)) + 48px); width: min(320px, calc(100vw - 24px)); max-height: calc(100vh - 140px); overflow: auto; box-sizing: border-box; padding: 12px 16px 16px; display: grid; gap: 12px; background: var(--r-surface); color: var(--r-text); border: 1px solid var(--r-border-strong); border-radius: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
body.ebr-reading[data-ebr-theme="white"] #ebr .tts-fab, body.ebr-reading[data-ebr-theme="white"] #ebr .tts-panel { box-shadow: none; }
#ebr .tts-head { display: flex; align-items: center; gap: 8px; }
#ebr .tts-head b { font-weight: 600; font-size: .95rem; }
#ebr .tts-status { flex: 1; min-width: 0; font-size: .8rem; color: var(--r-muted); }
#ebr .tts-hide { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--r-text-2); font-size: 1.25rem; line-height: 1; cursor: pointer; }
#ebr .tts-hide:hover { background: var(--r-surface-2); }
#ebr .tts-voice { margin: -6px 0 0; font-size: .75rem; color: var(--r-muted); overflow-wrap: anywhere; }
#ebr .tts-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#ebr .tts-ops button { min-height: 42px; border-radius: var(--r-pill); font-size: .875rem; cursor: pointer; border: 1px solid var(--r-border-strong); background: none; color: var(--r-text); }
#ebr .tts-ops .tts-play { border-color: var(--r-text); background: var(--r-text); color: var(--r-bg); font-weight: 500; }
::highlight(ebr-tts) { background-color: rgba(139, 44, 32, .14); }
body.ebr-reading[data-ebr-theme="dark"] ::highlight(ebr-tts) { background-color: rgba(201, 120, 100, .3); }
body.ebr-reading[data-ebr-theme="white"] ::highlight(ebr-tts) { background-color: #ddd; }
@media print {
  .ebr-bar, .ebr-toc, .ebr-chnav, #ebr .v-pager, #ebr .tts { display: none !important; }
  html[data-layout="v"] .v-stage { display: block; padding: 0; }
  html[data-layout="v"] .v-stage::before { display: none; }
  html[data-layout="v"] .v-win { overflow: visible; clip-path: none !important; width: auto !important; height: auto !important; }
  html[data-layout="v"] .v-win[inert], html[data-layout="v"] .v-pre { display: none; }
  html[data-layout="v"] #ebr .v-win > .chapter { position: static; height: auto; max-width: var(--reader-max-width); margin: 0 auto; transform: none !important; visibility: visible !important; writing-mode: horizontal-tb; }
}
.ebr-shelf { margin: 0 0 24px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-card); background: var(--surface); }
.ebr-shelf[hidden] { display: none; }
.ebr-shelf-head { margin: 0 0 10px; font-size: .75rem; letter-spacing: .2em; color: var(--muted); }
.ebr-shelf-book { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.ebr-shelf-info { display: grid; gap: 2px; min-width: 0; }
.ebr-shelf-info b { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ebr-shelf-info span { font-size: .8rem; overflow-wrap: anywhere; }
.ebr-shelf-ops { display: flex; gap: 8px; }
.ebr-shelf-ops button { width: auto; padding: 10px 18px; }
.ebr-shelf-tip { margin: 12px 0 0; font-size: .8rem; }
