.ebook-page {
    --ebook-paper: #fffdfa;
    --ebook-ink: #28342f;
    --ebook-muted: #69746d;
    --ebook-border: #e7e1d6;
    --ebook-accent: #86683c;
    --ebook-font-size: 19px;
    min-height: 75vh;
    padding: 1.8rem 0 5rem;
    background: #f5f2eb;
}
.ebook-page[data-theme="sepia"] {
    --ebook-paper: #f2e9d4;
    --ebook-ink: #42382a;
    --ebook-muted: #766a56;
    --ebook-border: #dbcfb4;
    --ebook-accent: #79552c;
    background: #e8dec9;
}
.ebook-page[data-theme="night"] {
    --ebook-paper: #1d2927;
    --ebook-ink: #e6e5da;
    --ebook-muted: #b1bdb4;
    --ebook-border: #3a4b45;
    --ebook-accent: #e0c18a;
    background: #14211f;
}
.ebook-breadcrumb { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.5rem; color: #777e75; font-size: .82rem; }
.ebook-breadcrumb a { color: #50665a; text-decoration: none; }
.ebook-breadcrumb a:hover { text-decoration: underline; }
.ebook-page[data-theme="night"] .ebook-breadcrumb, .ebook-page[data-theme="night"] .ebook-breadcrumb a { color: #c3ccbf; }
.ebook-header { max-width: 880px; margin: 0 auto 1.5rem; text-align: center; }
.ebook-kicker { color: #9a7447; font-size: .7rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.ebook-kicker span { padding: 0 .35rem; }
.ebook-header h1 { margin: .8rem auto .65rem; color: var(--ebook-ink); font-size: clamp(2rem, 3.6vw, 3.4rem); line-height: 1.18; letter-spacing: -.045em; }
.ebook-header p { margin: 0; color: var(--ebook-muted); font-size: .91rem; }
.ebook-header a { color: var(--ebook-accent); }
.ebook-shell { max-width: 920px; margin: 0 auto; overflow: hidden; border: 1px solid var(--ebook-border); border-radius: 16px; color: var(--ebook-ink); background: var(--ebook-paper); box-shadow: 0 24px 58px rgba(37, 46, 40, .10); }
.ebook-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: .6rem 1.5rem; border-bottom: 1px solid var(--ebook-border); }
.ebook-topbar-label { color: var(--ebook-muted); font-size: .7rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.ebook-settings { display: none; gap: .35rem; }
.ebook-ready .ebook-settings { display: flex; }
.ebook-settings button { min-width: 39px; min-height: 36px; padding: 0 .7rem; border: 1px solid var(--ebook-border); border-radius: 6px; color: var(--ebook-ink); background: transparent; font-weight: 700; }
.ebook-settings button:hover { background: rgba(130, 118, 88, .12); }
.ebook-settings button:focus-visible, .ebook-page-button:focus-visible, .ebook-edge:focus-visible, .ebook-progress input:focus-visible { outline: 3px solid var(--ebook-accent); outline-offset: 2px; }
.ebook-stage { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: stretch; padding: 1.7rem 1.35rem 1.25rem; }
.ebook-viewport { min-width: 0; }
.ebook-text { max-width: 66ch; margin: 0 auto; color: var(--ebook-ink); font-family: Georgia, 'Times New Roman', serif; font-size: var(--ebook-font-size); line-height: 1.78; overflow-wrap: break-word; }
.ebook-text p { margin: 0 0 1.3em; }
.ebook-text p:first-child::first-letter { float: left; padding: .07em .12em 0 0; color: var(--ebook-accent); font-family: 'Libre Baskerville', Georgia, serif; font-size: 3.1em; line-height: .85; }
.ebook-ready .ebook-viewport { height: clamp(320px, calc(100dvh - 340px), 650px); overflow: hidden; }
.ebook-ready .ebook-text { width: 100%; max-width: none; height: 100%; margin: 0; overflow: hidden; column-count: 1; column-gap: 0; column-fill: auto; scrollbar-width: none; }
.ebook-ready .ebook-text::-webkit-scrollbar { display: none; }
.ebook-edge { display: none; align-self: center; width: 40px; height: 72px; border: 0; border-radius: 8px; color: var(--ebook-accent); background: transparent; font-family: Georgia, serif; font-size: 2.5rem; line-height: 1; }
.ebook-ready .ebook-edge { display: block; }
.ebook-edge:hover:not(:disabled) { background: rgba(130, 118, 88, .12); }
.ebook-edge:disabled { opacity: .25; cursor: default; }
.ebook-navigation { display: none; align-items: center; justify-content: space-between; gap: 1rem; min-height: 65px; padding: .6rem 1.5rem; border-top: 1px solid var(--ebook-border); }
.ebook-ready .ebook-navigation { display: flex; }
.ebook-page-button { display: inline-flex; align-items: center; gap: .65rem; min-width: 110px; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--ebook-border); border-radius: 8px; color: var(--ebook-ink); background: transparent; font-size: .85rem; font-weight: 700; }
.ebook-page-button:last-child { justify-content: flex-end; }
.ebook-page-button:hover:not(:disabled) { background: rgba(130, 118, 88, .12); }
.ebook-page-button:disabled { opacity: .35; cursor: default; }
.ebook-page-count { color: var(--ebook-muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ebook-progress { display: none; padding: 0 1.5rem .35rem; }
.ebook-ready .ebook-progress { display: block; }
.ebook-progress input { display: block; width: 100%; height: 24px; margin: 0; accent-color: var(--ebook-accent); cursor: pointer; }
.ebook-progress-labels { display: flex; justify-content: space-between; color: var(--ebook-muted); font-size: .68rem; letter-spacing: .03em; }
.ebook-help { display: none; margin: 0; padding: .4rem 1.5rem 1.1rem; color: var(--ebook-muted); font-size: .72rem; text-align: center; }
.ebook-ready .ebook-help { display: block; }
.ebook-unavailable { padding: 3rem; color: var(--ebook-muted); }
.ebook-ready .ebook-end { display: none; }
.ebook-ready .ebook-end.ebook-end-visible { display: block; }
.ebook-end { max-width: 920px; margin: 1.25rem auto 0; padding: 1.7rem 2rem; border: 1px solid var(--ebook-border); border-radius: 14px; color: var(--ebook-ink); background: var(--ebook-paper); text-align: center; }
.ebook-end-mark { color: var(--ebook-accent); font-size: 1.5rem; }
.ebook-end h2 { margin: .3rem 0; font-size: 1.3rem; }
.ebook-end p { margin: 0 0 .8rem; color: var(--ebook-muted); font-size: .9rem; }
.ebook-end a { color: var(--ebook-accent); font-weight: 700; text-decoration: none; }
.ebook-related { max-width: 920px; margin: 3rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--ebook-border); }
.ebook-related-heading span { color: var(--ebook-accent); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.ebook-related-heading h2 { margin: .4rem 0 1.2rem; color: var(--ebook-ink); font-size: 1.4rem; }
.ebook-related-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.ebook-related-list a { display: flex; justify-content: space-between; gap: 1rem; min-height: 72px; padding: 1rem; border: 1px solid var(--ebook-border); border-radius: 8px; color: var(--ebook-ink); background: var(--ebook-paper); text-decoration: none; font-family: Georgia, serif; }
.ebook-related-list a:hover { border-color: var(--ebook-accent); }
@media (max-width: 767px) {
    .ebook-page { padding: 1rem 0 3rem; }
    .ebook-breadcrumb { margin-bottom: 1rem; }
    .ebook-header { margin-bottom: 1.1rem; }
    .ebook-header h1 { font-size: clamp(1.75rem, 7vw, 2.4rem); }
    .ebook-shell { margin: 0 -.35rem; border-radius: 11px; }
    .ebook-topbar { min-height: 52px; padding: .5rem .9rem; }
    .ebook-stage { display: block; padding: 1.25rem 1.25rem 1rem; }
    .ebook-edge { display: none !important; }
    .ebook-ready .ebook-viewport { height: clamp(320px, calc(100dvh - 320px), 620px); }
    .ebook-text { font-size: var(--ebook-font-size); line-height: 1.72; }
    .ebook-navigation { position: sticky; bottom: 0; z-index: 2; padding: .5rem .9rem; background: var(--ebook-paper); }
    .ebook-page-button { min-width: 95px; }
    .ebook-progress { padding: 0 .9rem .35rem; }
    .ebook-help { padding: .4rem .9rem 1rem; }
    .ebook-related { margin-top: 2rem; }
    .ebook-related-list { grid-template-columns: 1fr; }
}
@media (max-width: 390px) { .ebook-settings button span { display: none; } .ebook-page-button { min-width: 82px; } }
