:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --accent:#087f75; --border:#dfe3e7; --muted:#667085; --surface:#fff; --panel:#f6f8f9; --text:#182026; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { margin:0; min-height:100%; overflow-x:hidden; }
body { background:var(--panel); color:var(--text); }
button, select, input { font:inherit; }
button, .open-button { border:1px solid var(--border); border-radius:9px; cursor:pointer; font-weight:650; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, .open-button:focus-visible { outline:3px solid rgba(8,127,117,.28); outline-offset:2px; }
button:disabled { cursor:not-allowed; opacity:.42; }
.reader-header { align-items:center; background:#fff; border-bottom:1px solid var(--border); display:grid; gap:18px; grid-template-columns:auto 1fr auto; height:64px; padding:0 18px; }
.reader-brand { color:#171923; font-size:1.2rem; font-weight:850; text-decoration:none; }
.reader-brand span { background:#df1f2d; border-radius:5px; color:#fff; font-size:.66rem; margin-right:3px; padding:5px 4px; }
.reader-file-state { display:flex; flex-direction:column; min-width:0; }
.reader-file-state strong, .reader-file-state span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reader-file-state span { color:var(--muted); font-size:.75rem; }
.header-actions { align-items:center; display:flex; gap:9px; }
#bookInput { height:1px; opacity:0; position:absolute; width:1px; }
.open-button { background:var(--accent); border-color:var(--accent); color:#fff; display:inline-flex; padding:9px 15px; }
.icon-button { background:#fff; min-width:39px; padding:8px 10px; }
.reader-shell { display:grid; grid-template-columns:300px minmax(0,1fr); height:calc(100vh - 104px); }
.reader-shell.sidebar-closed { grid-template-columns:0 minmax(0,1fr); }
.reader-sidebar { background:#fff; border-right:1px solid var(--border); display:flex; flex-direction:column; min-width:0; overflow:hidden; }
.reader-shell.sidebar-closed .reader-sidebar { border:0; visibility:hidden; }
.book-summary { align-items:center; border-bottom:1px solid var(--border); display:grid; gap:13px; grid-template-columns:56px minmax(0,1fr); padding:18px; }
.cover-wrap { align-items:center; background:linear-gradient(145deg,#32b6aa,#075c56); border-radius:6px; color:#fff; display:flex; font-size:.65rem; font-weight:850; height:76px; justify-content:center; overflow:hidden; width:56px; }
.cover-wrap img { height:100%; object-fit:cover; width:100%; }
.book-summary h2 { font-size:.95rem; line-height:1.25; margin:0 0 5px; }
.book-summary p { color:var(--muted); font-size:.78rem; margin:0; }
.toc-heading { align-items:center; display:flex; justify-content:space-between; padding:16px 18px 8px; }
.toc-heading h2 { font-size:.78rem; letter-spacing:.08em; margin:0; text-transform:uppercase; }
.toc-heading span { color:var(--muted); font-size:.72rem; }
.toc { flex:1; overflow:auto; padding:5px 10px 18px; }
.toc ul { list-style:none; margin:0; padding:0; }
.toc ul ul { border-left:1px solid var(--border); margin-left:10px; padding-left:8px; }
.toc button { background:transparent; border:0; color:var(--text); display:block; font-size:.84rem; font-weight:500; overflow:hidden; padding:7px 8px; text-align:left; text-overflow:ellipsis; white-space:nowrap; width:100%; }
.toc button:hover, .toc button.active { background:#e8f5f3; color:#05675f; }
.toc-empty, .privacy-note { color:var(--muted); font-size:.78rem; padding:0 8px; }
.privacy-note { border-top:1px solid var(--border); margin:0; padding:13px 18px; }
.reader-main { display:grid; grid-template-rows:auto minmax(0,1fr) auto; min-width:0; }
.reader-toolbar { align-items:center; background:#fff; border-bottom:1px solid var(--border); display:flex; flex-wrap:wrap; gap:12px; min-height:54px; padding:8px 14px; }
.toolbar-group { align-items:center; display:flex; gap:6px; }
.toolbar-group button, .reader-toolbar select, .close-button { background:#fff; min-height:34px; padding:6px 10px; }
.toolbar-group label { color:var(--muted); font-size:.76rem; font-weight:650; }
.toolbar-group output { color:var(--muted); font-size:.75rem; min-width:38px; text-align:center; }
.close-button { margin-left:auto; }
.reader-stage { align-items:stretch; display:flex; justify-content:center; min-height:0; overflow:hidden; position:relative; }
.reader-stage.drag-over { background:#dff4f1; box-shadow:inset 0 0 0 3px var(--accent); }
.empty-state, .loading-state, .error-state { align-items:center; align-self:center; display:flex; flex-direction:column; max-width:520px; padding:32px; text-align:center; }
.empty-state h2 { font-size:1.45rem; margin:15px 0 7px; }
.empty-state p, .error-state p { color:var(--muted); line-height:1.55; margin:0 0 20px; }
.empty-state > span { color:var(--muted); font-size:.78rem; margin-top:9px; }
.empty-mark { align-items:center; background:#dff4f1; border-radius:18px; color:var(--accent); display:flex; font-family:Georgia,serif; font-size:2rem; height:78px; justify-content:center; width:78px; }
.open-button--large { font-size:1rem; padding:11px 20px; }
.loading-state small { color:var(--muted); margin-top:5px; }
.spinner { animation:spin .8s linear infinite; border:3px solid #cbd5d3; border-top-color:var(--accent); border-radius:50%; height:34px; margin-bottom:13px; width:34px; }
@keyframes spin { to { transform:rotate(360deg); } }
.error-state strong { color:#b42318; font-size:1.1rem; margin-bottom:7px; }
.book-view-host, foliate-view { height:100%; width:100%; }
.reader-navigation { align-items:center; background:#fff; border-top:1px solid var(--border); display:grid; gap:12px; grid-template-columns:40px minmax(100px,1fr) 48px minmax(100px,auto) 40px; min-height:58px; padding:8px 14px; }
.reader-navigation button { background:#fff; height:38px; }
.progress-control input { accent-color:var(--accent); width:100%; }
.reader-navigation output { font-size:.78rem; font-weight:700; text-align:center; }
#locationText { color:var(--muted); font-size:.76rem; max-width:240px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.visually-hidden { height:1px!important; margin:-1px!important; overflow:hidden!important; padding:0!important; position:absolute!important; width:1px!important; clip:rect(0 0 0 0)!important; white-space:nowrap!important; }
body[data-theme="dark"] { --surface:#171b1e; --panel:#101315; --text:#edf1f2; --muted:#a7b0b5; --border:#343b3f; color-scheme:dark; }
body[data-theme="dark"] .reader-header, body[data-theme="dark"] .reader-sidebar, body[data-theme="dark"] .reader-toolbar, body[data-theme="dark"] .reader-navigation { background:var(--surface); }
body[data-theme="dark"] button, body[data-theme="dark"] select { background:#22282c; color:var(--text); }
body[data-theme="sepia"] { --surface:#fbf2dc; --panel:#efe3c5; --text:#382f25; --muted:#746653; --border:#d6c6a3; }
body[data-theme="sepia"] .reader-header, body[data-theme="sepia"] .reader-sidebar, body[data-theme="sepia"] .reader-toolbar, body[data-theme="sepia"] .reader-navigation { background:var(--surface); }
body[data-theme="sepia"] button, body[data-theme="sepia"] select { background:#fffaf0; color:var(--text); }
@media (max-width:760px) { .reader-header { gap:10px; padding:0 10px; } .reader-shell { grid-template-columns:1fr; } .reader-sidebar { bottom:0; box-shadow:8px 0 24px rgba(0,0,0,.18); left:0; position:fixed; top:104px; width:min(84vw,320px); z-index:5; } .reader-shell.sidebar-closed .reader-sidebar { transform:translateX(-100%); visibility:hidden; } .reader-file-state { display:none; } .header-actions { margin-left:auto; } .reader-toolbar { gap:7px; } .toolbar-group label { display:none; } #locationText { display:none; } .reader-navigation { grid-template-columns:40px 1fr 44px 40px; } .reader-navigation #locationText { display:none; } }

.reader-intro { align-items:center; background:var(--surface); border-bottom:1px solid var(--border); display:flex; height:40px; padding:0 18px; }
.reader-intro h1 { font-size:.95rem; font-weight:650; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reader-about { background:var(--surface); border-top:1px solid var(--border); line-height:1.6; margin:0 auto; max-width:820px; padding:32px 18px 48px; }
.reader-about h2 { font-size:1.25rem; margin:0 0 12px; }
.reader-about h3 { font-size:1rem; margin:22px 0 8px; }
.reader-about p, .reader-about li { color:var(--text); margin:0 0 10px; }
.reader-about ol { margin:0; padding-left:22px; }
body[data-theme="dark"] .reader-intro, body[data-theme="dark"] .reader-about { background:var(--surface); }
body[data-theme="sepia"] .reader-intro, body[data-theme="sepia"] .reader-about { background:var(--surface); }
