[hidden]{display:none!important}
#viewer[hidden],#epub[hidden],#audioWrap[hidden],#empty[hidden],#loadMask[hidden]{display:none!important}
:root{--navy:#17345b;--navy2:#102847;--ink:#17233a;--muted:#6b788c;--line:#dfe4e8;--paper:#f8f6ef;--workspace:#e9edf0;--gold:#f3c65c;--blue:#356ee8;--side:330px;--rail:68px;--top:64px;--reader-size:16px}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{font:14px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:var(--workspace)}button,select,textarea,input{font:inherit}button{cursor:pointer}.reader-app{height:100%;display:flex;flex-direction:column}.topbar{height:var(--top);flex:0 0 var(--top);display:grid;grid-template-columns:220px 1fr auto;align-items:center;padding:0 16px;background:var(--navy);color:white;border-bottom:1px solid #ffffff12}.reader-brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:white;font-size:16px}.brand-mark{display:grid;grid-template-columns:1fr 1fr;width:24px;height:27px}.brand-mark i{background:var(--gold);border-radius:4px 0 0 2px}.brand-mark b{background:white;border-radius:0 4px 2px 0}.book-heading{min-width:0;text-align:center}.book-heading strong,.book-heading small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.book-heading strong{font-size:13px}.book-heading small{font-size:10px;color:#aebdd0;margin-top:2px}.top-actions{display:flex;gap:7px}.icon-btn{width:34px;height:34px;border:1px solid #ffffff20;border-radius:8px;background:#ffffff0b;color:white}.mobile-info{display:none}.reader-progress{height:3px;position:fixed;top:var(--top);left:0;right:0;z-index:30;background:transparent}.reader-progress i{display:block;width:0;height:100%;background:var(--gold);transition:width .25s}.workspace{min-height:0;flex:1;display:grid;grid-template-columns:var(--rail) minmax(0,1fr) var(--side)}.rail{background:#132e50;border-right:1px solid #ffffff0e;display:flex;flex-direction:column;padding:9px 7px;gap:5px;color:#b9c7d8}.rail button{height:52px;border:0;border-radius:9px;background:transparent;color:inherit;display:grid;place-items:center;padding:5px}.rail button span{font-size:17px;line-height:1}.rail button small{font-size:9px}.rail button:hover,.rail button.active{background:#ffffff0d;color:white}.stage{min-width:0;min-height:0;display:grid;grid-template-rows:46px 1fr 30px;background:var(--workspace);position:relative}.reader-toolbar{display:flex;align-items:center;justify-content:center;gap:7px;padding:6px 10px;border-bottom:1px solid #d9dfe4;background:#f9fafb}.tool-group{display:flex;align-items:center;background:white;border:1px solid var(--line);border-radius:8px;overflow:hidden}.tool-group button,.reader-toolbar>button{height:31px;min-width:32px;border:0;background:white;color:#536176}.tool-group span{min-width:44px;text-align:center;font-size:11px;color:#68768a}.reader-toolbar select{height:31px;border:1px solid var(--line);border-radius:7px;background:white;color:#536176;font-size:11px;padding:0 7px}.toolbar-sep{width:1px;height:22px;background:#d7dde2}.paper-shell{min-height:0;position:relative;margin:18px auto;width:min(1040px,calc(100% - 36px));background:white;border:1px solid #d5dce1;border-radius:5px;box-shadow:0 12px 35px rgba(26,44,67,.12);overflow:hidden;transition:.2s}.welcome{height:100%;min-height:360px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:35px}.welcome-illustration{position:relative;width:180px;height:120px;margin-bottom:15px}.sheet{position:absolute;left:52px;top:5px;width:83px;height:105px;background:#fbf5df;box-shadow:7px 9px 16px #2b3c5431;transform:rotate(4deg);padding-top:28px}.sheet i{display:block;height:2px;background:#c8bda7;margin:10px 15px}.glasses{position:absolute;left:18px;bottom:10px;width:45px;height:22px;border:4px solid #31445d;border-radius:50% 50% 45% 45%;box-shadow:36px 0 0 -4px #fff,36px 0 0 0 #31445d}.glasses:after{content:"";position:absolute;left:39px;top:5px;width:12px;height:3px;background:#31445d}.pencil{position:absolute;right:14px;bottom:16px;width:85px;height:8px;background:#e4b33f;border-radius:5px;transform:rotate(-19deg);box-shadow:inset 14px 0 #dc8068}.mini-kicker{font-size:10px;text-transform:uppercase;letter-spacing:.15em;color:#94712c;font-weight:800}.welcome h1{font:38px/1 Georgia,serif;letter-spacing:-.035em;margin:9px 0}.welcome p{max-width:510px;color:var(--muted);margin:0 0 19px}.welcome small{margin-top:12px;color:#8390a0}.welcome small a{color:var(--blue)}.upload-main{display:inline-flex;align-items:center;justify-content:center;background:var(--blue);color:white;border-radius:8px;padding:10px 15px;font-weight:700;cursor:pointer}.upload-main input,.upload-secondary input{display:none}#viewer,#epub{width:100%;height:100%;border:0;background:white}#epub{font-size:var(--reader-size)}.audio-wrap{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;background:linear-gradient(145deg,#f5f2e8,#e7edf1)}.audio-art{width:130px;height:130px;display:grid;place-items:center;border-radius:50%;background:var(--navy);color:var(--gold);font-size:50px;box-shadow:0 18px 40px #243f6030}.audio-wrap h2{font:26px Georgia,serif}.audio-wrap audio{width:min(540px,100%)}.load-mask{position:absolute;inset:0;background:#fffffff0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;z-index:10}.load-mask span{width:36px;height:36px;border:3px solid #dbe2e7;border-top-color:var(--blue);border-radius:50%;animation:spin .8s linear infinite}.load-mask b{font-size:11px;color:var(--muted)}@keyframes spin{to{transform:rotate(360deg)}}.stage-footer{display:flex;justify-content:space-between;align-items:center;padding:0 12px;background:#f7f8f9;border-top:1px solid #d8dee4;color:#7a8797;font-size:9px;text-transform:uppercase;letter-spacing:.05em}.side{min-width:0;background:#fbfcfd;border-left:1px solid #d9dfe4;overflow:auto}.side-head{height:45px;display:flex;align-items:center;justify-content:space-between;padding:0 15px;border-bottom:1px solid var(--line)}.side-head strong{font-size:12px}.side-head button{display:none;border:0;background:transparent;font-size:20px}.tabs{display:grid;grid-template-columns:repeat(3,1fr);padding:8px 10px 0;border-bottom:1px solid var(--line)}.tab{border:0;background:transparent;color:#758296;font-size:10px;padding:8px 3px 10px;border-bottom:2px solid transparent}.tab.active{color:var(--navy);border-color:var(--blue);font-weight:800}.pane{display:none;padding:17px 18px 30px}.pane.active{display:block}.pane h2{font:17px Georgia,serif;margin:14px 0 7px}.pane h2:first-child{margin-top:0}.badge{display:inline-block;font-size:9px;letter-spacing:.08em;background:#e8edf4;color:#516277;padding:3px 6px;border-radius:4px}.summary{font-size:12px;line-height:1.55;color:#647286}.source-link{font-size:11px;color:var(--blue);text-decoration:none}.pane hr{border:0;border-top:1px solid var(--line);margin:18px 0}.field{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11px;margin:8px 0}.field select{border:1px solid var(--line);border-radius:6px;padding:5px 7px;background:white}.side-btn{display:block;width:100%;margin-top:7px;border:1px solid var(--line);border-radius:7px;background:white;color:#4c5b70;padding:8px 9px;text-align:left;font-size:11px}.side-btn:hover{border-color:#b7c5d5;background:#f7f9fb}.side-btn.primary{background:var(--navy);color:white;border-color:var(--navy);text-align:center}.upload-secondary{cursor:pointer}.local-note,.hint{font-size:10px;color:#8a96a5}.pane textarea{width:100%;min-height:260px;resize:vertical;border:1px solid var(--line);border-radius:8px;padding:10px;outline:0;font-size:12px;line-height:1.55}.pane textarea:focus{border-color:#9bb6de;box-shadow:0 0 0 3px #3b73d510}.pane>small{font-size:9px;color:#8995a4}.saved-list{margin-top:10px}.saved-item{position:relative;border:1px solid var(--line);border-radius:7px;background:white;padding:9px 28px 9px 9px;margin:6px 0;font-size:11px}.saved-item small{display:block;color:#8a96a5;font-size:9px;margin-top:3px}.saved-item button{position:absolute;right:6px;top:6px;border:0;background:transparent;color:#9aa5b1}.toast{position:fixed;left:50%;bottom:38px;z-index:100;transform:translate(-50%,10px);background:#17253a;color:white;padding:8px 12px;border-radius:7px;font-size:11px;opacity:0;pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:translate(-50%,0)}body.paper-mode{--workspace:#e4ddcf}body.paper-mode .paper-shell{filter:sepia(.12)}body.eink{--workspace:#dedede;filter:grayscale(1)}body.eink .paper-shell{box-shadow:none;border-color:#aaa}body.night{--workspace:#121923;--ink:#dae2ec;--muted:#9ba9ba;--line:#364251}body.night .reader-toolbar,body.night .stage-footer,body.night .side{background:#18212d;color:#c6d1df;border-color:#33404e}body.night .reader-toolbar button,body.night .reader-toolbar select,body.night .tool-group{background:#222d3a;color:#d5deea;border-color:#3b4857}body.night .paper-shell{background:#202b37;border-color:#394858}body.night .welcome{color:#e4ebf3}body.night .welcome p{color:#aebdcd}body.night .pane textarea,body.night .side-btn,body.night .field select,body.night .saved-item{background:#202b37;color:#d9e3ec;border-color:#394858}@media(max-width:1000px){:root{--side:285px}.paper-shell{margin:12px auto;width:calc(100% - 24px)}}@media(max-width:820px){:root{--rail:54px}.workspace{grid-template-columns:var(--rail) 1fr}.side{position:fixed;z-index:60;right:0;top:var(--top);bottom:0;width:min(340px,92vw);transform:translateX(105%);transition:.22s;box-shadow:-15px 0 45px #13223833}.side.open{transform:translateX(0)}.side-head button{display:block}.mobile-info{display:block}.rail small{display:none}.rail button{height:44px}.paper-shell{margin:8px auto;width:calc(100% - 16px)}.shortcut{display:none}}@media(max-width:560px){:root{--top:58px;--rail:0px}.topbar{grid-template-columns:auto 1fr auto;padding:0 10px}.reader-brand span:last-child{display:none}.rail{display:none}.workspace{grid-template-columns:1fr}.reader-toolbar{justify-content:flex-start;overflow:auto}.toolbar-sep{display:none}.reader-toolbar select{margin-left:auto}.paper-shell{border-radius:0;margin:0;width:100%;border-inline:0}.welcome{padding:25px 18px}.welcome h1{font-size:31px}.stage{grid-template-rows:44px 1fr 27px}.stage-footer{padding-inline:8px}.stage-footer span:nth-child(2){margin-left:auto}.book-heading{text-align:left;padding-left:8px}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* PDF shell with progressive viewer fallback: embed → object → iframe */
.app-loader{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#eef1f2;color:#17345b;transition:opacity .34s ease,visibility .34s ease}.app-loader.done{opacity:0;visibility:hidden;pointer-events:none}.app-loader strong{font:700 20px/1.1 Georgia,serif;margin-top:16px}.app-loader small{font-size:10px;color:#758396;margin-top:5px}.boot-track{width:min(255px,66vw);height:4px;background:#d7dfe4;border-radius:99px;overflow:hidden;margin-top:13px}.boot-track i{display:block;width:7%;height:100%;background:#356ee8;border-radius:99px;transition:width .26s ease}.loader-desk{width:142px;height:88px;position:relative}.loader-book{position:absolute;left:23px;top:11px;width:92px;height:62px;background:#fffdf6;border-radius:4px 10px 10px 4px;box-shadow:0 15px 28px #17345b22;overflow:hidden;animation:reader-book 2s ease-in-out infinite}.loader-book:before{content:"";position:absolute;left:45px;top:0;bottom:0;width:2px;background:#e6decb}.loader-book i{position:absolute;width:32px;height:2px;background:#c8bfa9;left:7px}.loader-book i:nth-child(1){top:19px}.loader-book i:nth-child(2){top:31px}.loader-book i:nth-child(3){top:43px}.loader-pencil{position:absolute;right:1px;bottom:4px;width:84px;height:7px;background:#efbd43;border-radius:8px;transform:rotate(-17deg);box-shadow:inset 13px 0 #dc7f67;animation:reader-pencil 1.6s ease-in-out infinite}.native-viewer{width:100%;height:100%;border:0;background:white;display:block;overflow:hidden}.native-viewer .pdf-engine{width:100%;height:100%;border:0;background:white;display:block}.native-viewer object.pdf-engine>.viewer-fallback{display:flex;min-height:100%;align-items:center;justify-content:center;flex-direction:column;gap:10px;padding:30px;text-align:center;color:#657287}.viewer-fallback button{border:1px solid #c9d3df;background:white;color:#27476f;border-radius:7px;padding:8px 12px;cursor:pointer}.viewer-fallback{padding:40px;text-align:center;color:#657287}.epub-reader{height:100%;overflow:auto;background:#fff;color:#202936;font-size:var(--reader-size);padding:0}.epub-reader #epubContent{width:min(780px,calc(100% - 46px));margin:0 auto;padding:46px 10px 80px;line-height:1.72}.epub-reader h1,.epub-reader h2,.epub-reader h3{font-family:Georgia,serif;line-height:1.2}.epub-reader img,.epub-reader svg{max-width:100%;height:auto}.epub-reader table{max-width:100%;border-collapse:collapse}.epub-reader a{color:#356ee8}.load-mask{background:#fffffff7;gap:9px}.loader-orbit{position:relative;width:50px;height:50px}.load-mask .loader-orbit span{position:absolute;inset:0;width:auto;height:auto;margin:0;border:3px solid #dce4e9;border-top-color:#356ee8;border-right-color:#f3c65c;border-radius:50%;animation:spin .9s linear infinite}.loader-orbit i{position:absolute;left:21px;top:21px;width:8px;height:8px;border-radius:50%;background:#17345b}.doc-track{width:min(280px,65%);height:5px;background:#dde4e8;border-radius:99px;overflow:hidden;margin-top:3px}.doc-track i{display:block;width:0;height:100%;background:linear-gradient(90deg,#356ee8,#6d91e8);border-radius:99px;transition:width .22s ease}.load-mask b{font-size:12px;color:#4f5e72}.load-mask small{font-size:9px;color:#8591a0}.paper-shell.page-arrive{animation:page-arrive .34s ease}.paper-shell{transform-origin:center}.reader-progress i{box-shadow:0 0 13px #f3c65c80}body.night .epub-reader{background:#202b37;color:#dbe4ed}body.night .load-mask{background:#202b37f4}body.night .load-mask b{color:#d8e1eb}body.night .load-mask small{color:#9aaabd}body.eink .epub-reader{background:#f1f1f1;color:#111}.stage-footer:before{content:"STATIC · FALLBACK PDF";font-size:8px;color:#8e9aaa}.reader-toolbar button:hover{background:#edf2f8}.rail button span{transition:transform .2s}.rail button:hover span{transform:translateY(-2px)}
@keyframes reader-book{50%{transform:translateY(-4px) rotate(.8deg)}}@keyframes reader-pencil{50%{transform:translateY(-4px) rotate(-14deg)}}@keyframes page-arrive{0%{opacity:.65;transform:scale(.994) translateY(3px)}100%{opacity:1;transform:none}}
@media(max-width:560px){.epub-reader #epubContent{width:calc(100% - 24px);padding:28px 4px 60px}.doc-track{width:72%}.stage-footer:before{display:none}}
@media(prefers-reduced-motion:reduce){.app-loader{transition:none}.loader-book,.loader-pencil,.paper-shell.page-arrive{animation:none!important}}

#proxyFallback{font-size:10px;padding:0 9px;color:#6b5b2e!important;background:#fffaf0!important;border:1px solid #ead8a1!important;border-radius:7px}#proxyFallback:hover{background:#fff3cf!important}

/* v8 — PDF.js canvas reader */
.stage-footer:before{content:"PDF.JS · STATIC READER"!important}
.native-viewer{background:#dfe4e8;overflow:hidden!important}
.pdfjs-layout{height:100%;display:grid;grid-template-columns:126px minmax(0,1fr);background:#dfe4e8}
.pdfjs-thumbs{overflow:auto;padding:12px 9px;background:#eef2f4;border-right:1px solid #ccd5dc;scrollbar-width:thin}
.pdf-thumb{width:100%;border:1px solid transparent;background:transparent;border-radius:8px;padding:7px 5px 5px;margin:0 0 8px;display:flex;flex-direction:column;align-items:center;gap:5px;color:#697789}
.pdf-thumb:hover{background:#fff;border-color:#d8e0e6}.pdf-thumb.active{background:#fff;border-color:#8eabd8;box-shadow:0 4px 14px #17345b14;color:#234f8f}
.pdf-thumb canvas{max-width:94px;max-height:134px;background:white;box-shadow:0 2px 7px #1e2d3f24;border-radius:2px}.pdf-thumb span{font-size:9px;font-weight:700}
.pdfjs-stage{height:100%;overflow:auto;padding:20px 20px 46px;display:flex;flex-direction:column;align-items:center;scrollbar-width:thin;overscroll-behavior:contain}
.pdfjs-page-card{position:relative;flex:0 0 auto;background:white;box-shadow:0 10px 30px #182d4522;border:1px solid #cbd3da;min-width:120px;min-height:160px;transition:opacity .18s,transform .18s}
.pdfjs-page-card.rendering{opacity:.55;transform:scale(.997)}
#pdfCanvas{display:block;background:white;max-width:none}
.pdfjs-hint{margin-top:14px;font-size:9px;color:#7b8794;background:#edf1f4cc;border:1px solid #cfd8df;border-radius:99px;padding:5px 10px;position:sticky;bottom:10px;backdrop-filter:blur(5px)}
.pdf-error-card{height:100%;min-height:360px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:34px;background:linear-gradient(145deg,#f8fafb,#edf2f5);color:#536276}.pdf-error-icon{width:68px;height:82px;border:2px solid #d1d9df;border-radius:8px;background:white;display:grid;place-items:center;color:#d85757;font-weight:900;font-size:18px;box-shadow:0 8px 20px #1c2c3c17;position:relative}.pdf-error-icon:after{content:"";position:absolute;right:-2px;top:-2px;border-top:19px solid #edf2f5;border-left:19px solid transparent}.pdf-error-card h2{font:24px Georgia,serif;color:#263b56;margin:17px 0 7px}.pdf-error-card p{max-width:520px;font-size:11px;line-height:1.6;color:#718093}.pdf-error-card>div:last-child{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin-top:8px}.pdf-error-card button{border:1px solid #cad4df;background:white;color:#36506d;border-radius:8px;padding:8px 11px;font-weight:700;font-size:10px}.pdf-error-card button:first-child{background:#17345b;color:white;border-color:#17345b}
body.night .pdfjs-layout{background:#121923}body.night .pdfjs-thumbs{background:#18212d;border-color:#35404d}body.night .pdf-thumb{color:#9dafc1}body.night .pdf-thumb:hover,body.night .pdf-thumb.active{background:#202b37;border-color:#4a6178}body.night .pdfjs-page-card{border-color:#3b4857;box-shadow:0 12px 32px #0005}body.night .pdfjs-hint{background:#1a2430dd;border-color:#344354;color:#aebccc}body.night .pdf-error-card{background:#202b37;color:#d7e0e9}body.night .pdf-error-card h2{color:#eef3f8}body.night .pdf-error-card p{color:#9eafbf}
@media(max-width:760px){.pdfjs-layout{grid-template-columns:1fr}.pdfjs-thumbs{display:none}.pdfjs-stage{padding:10px 6px 38px}.pdfjs-hint{font-size:8px}.pdfjs-page-card{max-width:100%}}


/* v9 fixes: layered reader, opaque loading, richer themes */
.paper-shell{height:calc(100% - 0px);display:grid;isolation:isolate}
.paper-shell>.welcome,
.paper-shell>#viewer,
.paper-shell>#epub,
.paper-shell>#audioWrap,
.paper-shell>.load-mask{grid-area:1/1;min-height:0}
body.reading .welcome{display:none!important}
#viewer,#epub,.audio-wrap{height:100%;min-height:0}
.native-viewer,.epub-reader,.audio-wrap{position:relative;z-index:1}
.load-mask{z-index:5;background:rgba(255,255,255,.985)!important;backdrop-filter:blur(8px)}
body.dark-mode .load-mask{background:rgba(18,25,35,.96)!important}
body.eink-gray .load-mask{background:rgba(244,244,244,.985)!important}
body.eink-color .load-mask{background:rgba(246,247,239,.985)!important}

body.dark-mode{--workspace:#121923;--ink:#dae2ec;--muted:#9ba9ba;--line:#364251}
body.dark-mode .reader-toolbar,body.dark-mode .stage-footer,body.dark-mode .side{background:#18212d;color:#c6d1df;border-color:#33404e}
body.dark-mode .reader-toolbar button,body.dark-mode .reader-toolbar select,body.dark-mode .tool-group{background:#222d3a;color:#d5deea;border-color:#3b4857}
body.dark-mode .paper-shell{background:#202b37;border-color:#394858}
body.dark-mode .welcome{color:#e4ebf3}
body.dark-mode .welcome p{color:#aebdcd}
body.dark-mode .pane textarea,body.dark-mode .side-btn,body.dark-mode .field select,body.dark-mode .saved-item{background:#202b37;color:#d9e3ec;border-color:#394858}
body.dark-mode .topbar,body.dark-mode .rail{background:#0f1926}
body.dark-mode .native-viewer,body.dark-mode .pdfjs-layout{background:#121923}
body.dark-mode .pdfjs-thumbs{background:#18212d;border-color:#35404d}
body.dark-mode .pdf-thumb{color:#9dafc1}
body.dark-mode .pdf-thumb:hover,body.dark-mode .pdf-thumb.active{background:#202b37;border-color:#4a6178}
body.dark-mode .pdfjs-page-card{border-color:#3b4857;box-shadow:0 12px 32px #0005}
body.dark-mode .pdfjs-hint{background:#1a2430dd;border-color:#344354;color:#aebccc}
body.dark-mode .pdf-error-card{background:#202b37;color:#d7e0e9}
body.dark-mode .pdf-error-card h2{color:#eef3f8}
body.dark-mode .pdf-error-card p{color:#9eafbf}

body.eink-gray{--workspace:#dadada;--ink:#111;--muted:#525252;--line:#b6b6b6}
body.eink-gray .topbar,body.eink-gray .rail{background:#595959;color:#f0f0f0}
body.eink-gray .reader-toolbar,body.eink-gray .stage-footer,body.eink-gray .side{background:#ededed;color:#2d2d2d;border-color:#b8b8b8}
body.eink-gray .reader-toolbar button,body.eink-gray .reader-toolbar select,body.eink-gray .tool-group,body.eink-gray .side-btn,body.eink-gray .field select,body.eink-gray .saved-item,body.eink-gray .pane textarea{background:#fff;color:#222;border-color:#bcbcbc}
body.eink-gray .paper-shell,body.eink-gray .native-viewer,body.eink-gray .epub-reader,body.eink-gray .pdfjs-layout,body.eink-gray .pdfjs-page-card,body.eink-gray .audio-wrap{filter:grayscale(1) contrast(1.03)}
body.eink-gray .pdfjs-thumbs{background:#e4e4e4;border-color:#bdbdbd}
body.eink-gray .pdf-thumb.active{border-color:#7b7b7b;box-shadow:none}
body.eink-gray .pdfjs-page-card{box-shadow:none;border-color:#8e8e8e}
body.eink-gray .pdfjs-hint{background:#ebebeb;border-color:#b8b8b8;color:#4e4e4e}

body.eink-color{--workspace:#e5e5dc;--ink:#22302a;--muted:#5c6a60;--line:#c6c6b5}
body.eink-color .topbar{background:#5c6e6c;color:#f5f3ea}
body.eink-color .rail{background:#6c7c79;color:#edf0ea}
body.eink-color .reader-toolbar,body.eink-color .stage-footer,body.eink-color .side{background:#f4f1e7;color:#33443c;border-color:#d3d0c3}
body.eink-color .reader-toolbar button,body.eink-color .reader-toolbar select,body.eink-color .tool-group,body.eink-color .side-btn,body.eink-color .field select,body.eink-color .saved-item,body.eink-color .pane textarea{background:#fffdfa;color:#33443c;border-color:#d0cdbd}
body.eink-color .paper-shell,body.eink-color .native-viewer,body.eink-color .epub-reader,body.eink-color .pdfjs-layout,body.eink-color .audio-wrap{filter:saturate(.72) contrast(1.02)}
body.eink-color .pdfjs-thumbs{background:#ece8dc;border-color:#d4cfbf}
body.eink-color .pdf-thumb.active{background:#fffefa;border-color:#b6c5be;color:#2e5b50}
body.eink-color .pdfjs-page-card{box-shadow:0 8px 22px rgba(88,102,96,.12);border-color:#d2ccbd}
body.eink-color .pdfjs-hint{background:#f2efe5cc;border-color:#d4cfbf;color:#64756c}

/* keep old night class as alias if cached */
body.night .reader-toolbar,body.night .stage-footer,body.night .side,body.night .reader-toolbar button,body.night .reader-toolbar select,body.night .tool-group,body.night .paper-shell,body.night .welcome,body.night .pane textarea,body.night .side-btn,body.night .field select,body.night .saved-item{ }


/* v12 responsive layout + chips + view modes */
.reader-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;background:#f9fafb;border-bottom:1px solid #d9dfe4}
.toolbar-block{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.toolbar-nav{flex:0 1 auto}.toolbar-theme{flex:1 1 520px;justify-content:center}.toolbar-actions{flex:0 1 auto;justify-content:flex-end}.reader-toolbar > button,.toolbar-actions > button{height:34px;min-width:36px;border:1px solid var(--line);border-radius:9px;background:white;color:#536176}.toolbar-actions > button.active{background:#17345b;color:white;border-color:#17345b}
.chip-strip{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.mode-chip{display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 10px;border:1px solid #d6dce2;border-radius:999px;background:white;color:#495b72;font-size:11px;font-weight:700}.mode-chip.small{height:32px;padding:0 9px}.mode-chip:hover{background:#eff4f8}.mode-chip.active{background:#17345b;color:white;border-color:#17345b;box-shadow:0 6px 16px rgba(23,52,91,.16)}.mode-chip.active .chip-swatch{box-shadow:0 0 0 2px rgba(255,255,255,.22)}
.chip-swatch{width:18px;height:18px;border-radius:50%;border:1px solid #cfd8df;display:inline-block;box-shadow:inset 0 0 0 1px rgba(255,255,255,.25)}.sw-normal{background:linear-gradient(135deg,#ffffff,#dfe8f2)}.sw-paper{background:linear-gradient(135deg,#f8f0d7,#d8c8a7)}.sw-dark{background:linear-gradient(135deg,#1b2430,#47617f)}.sw-eink-gray{background:linear-gradient(135deg,#f5f5f5,#8a8a8a)}.sw-eink-color{background:linear-gradient(135deg,#f6f4e8,#87a08c)}
.stage{grid-template-rows:auto minmax(0,1fr) 24px}.stage-footer{padding:0 10px;position:relative;z-index:2}.paper-shell{margin:10px auto; width:min(1200px,calc(100% - 20px)); height:calc(100% - 20px); border-radius:14px}.reader-progress{top:var(--top)}
.pdfjs-layout{height:100%;display:grid;grid-template-columns:118px minmax(0,1fr);background:#dfe4e8}.pdfjs-thumbs{width:118px}.pdfjs-stage{padding:16px 16px 60px;display:flex;flex-direction:column;align-items:center;overflow:auto}.pdfjs-page-card{position:relative;margin:0 auto;border-radius:10px;overflow:visible;transform-origin:center center;max-width:100%}.pdfjs-page-card canvas{border-radius:3px;max-width:100%;height:auto}.page-shadow{position:absolute;top:20px;bottom:20px;width:14px;pointer-events:none;opacity:.18;filter:blur(6px)}.page-shadow-left{left:-8px;background:linear-gradient(90deg,#00000035,transparent)}.page-shadow-right{right:-8px;background:linear-gradient(270deg,#00000035,transparent)}
body.hide-thumbs .pdfjs-layout{grid-template-columns:minmax(0,1fr)}body.hide-thumbs .pdfjs-thumbs{display:none!important}body.hide-side .workspace{grid-template-columns:var(--rail) minmax(0,1fr) 0px}body.hide-side .side{display:none!important}body.focus-reader .workspace{grid-template-columns:0 minmax(0,1fr) 0!important}body.focus-reader .rail,body.focus-reader .side{display:none!important}body.focus-reader .topbar{padding-inline:12px}body.focus-reader .book-heading small{display:none}
body.view-scroll .pdfjs-stage{align-items:flex-start;padding-inline:12px}body.view-scroll .pdfjs-page-card{margin-inline:auto}body.view-single .pdfjs-stage{align-items:center}body.view-flip .pdfjs-stage{perspective:1800px;background:radial-gradient(circle at center,#eef1f3 0%,#d7dde2 100%)}body.view-flip .pdfjs-page-card{box-shadow:0 18px 44px rgba(27,41,56,.22)}body.view-flip .pdfjs-page-card.flip-next{animation:flip-next .48s ease}body.view-flip .pdfjs-page-card.flip-prev{animation:flip-prev .48s ease}
@keyframes flip-next{0%{transform:rotateY(-14deg) scale(.985);opacity:.85}100%{transform:none;opacity:1}}@keyframes flip-prev{0%{transform:rotateY(14deg) scale(.985);opacity:.85}100%{transform:none;opacity:1}}
#bookmarkQuick{font-size:17px;line-height:1}.reader-toolbar .tool-group{height:34px}.reader-toolbar .tool-group button{height:34px}.reader-toolbar .tool-group span{min-width:56px;font-weight:700}
#viewerFallback,#proxyFallback{padding-inline:10px;font-size:10px}#proxyFallback{background:#fffaf0!important}.stage-footer:before{content:"RESPONSIVE READER · PDF.JS"!important}
body.dark-mode .reader-toolbar{background:#18212d;border-color:#33404e}body.dark-mode .mode-chip{background:#202b37;color:#d5deea;border-color:#3b4857}body.dark-mode .mode-chip:hover{background:#253241}body.dark-mode .mode-chip.active{background:#47617f;border-color:#47617f}body.dark-mode .toolbar-actions>button,body.dark-mode .reader-toolbar .tool-group,body.dark-mode .reader-toolbar .tool-group button,body.dark-mode .reader-toolbar select{background:#222d3a;color:#d5deea;border-color:#3b4857}body.dark-mode .paper-shell{box-shadow:0 18px 40px rgba(0,0,0,.35)}
body.eink-gray .mode-chip{background:#fff;color:#222;border-color:#bcbcbc}body.eink-gray .mode-chip.active{background:#666;color:#fff;border-color:#666;box-shadow:none}body.eink-color .mode-chip{background:#fffdfa;color:#33443c;border-color:#d0cdbd}body.eink-color .mode-chip.active{background:#6b7b74;color:#fff;border-color:#6b7b74}
@media(max-width:1200px){:root{--side:300px}.toolbar-theme{flex-basis:100%;justify-content:flex-start}.paper-shell{width:calc(100% - 16px)}}
@media(max-width:900px){.workspace{grid-template-columns:58px minmax(0,1fr)}.side{position:fixed;z-index:60;right:0;top:var(--top);bottom:0;width:min(360px,94vw);transform:translateX(105%);transition:.22s;box-shadow:-15px 0 45px #13223833}.side.open{transform:translateX(0)}.side-head button{display:block}.mobile-info{display:block}.toolbar-theme{order:3}.toolbar-actions{margin-left:auto}.paper-shell{margin:8px auto;height:calc(100% - 16px)}body.hide-side .workspace{grid-template-columns:58px minmax(0,1fr)}}
@media(max-width:760px){.reader-toolbar{padding:8px}.toolbar-block{width:100%}.toolbar-nav,.toolbar-theme,.toolbar-actions{justify-content:flex-start}.theme-strip,.view-strip{overflow:auto hidden;flex-wrap:nowrap;padding-bottom:2px}.mode-chip{flex:0 0 auto}.pdfjs-layout{grid-template-columns:minmax(0,1fr)}.pdfjs-thumbs{display:none!important}.pdfjs-stage{padding:10px 8px 50px}.stage-footer{font-size:8px}.paper-shell{border-radius:10px}.book-heading strong{font-size:12px}}
@media(max-width:560px){:root{--top:58px}.topbar{grid-template-columns:auto 1fr auto;padding:0 8px}.workspace{grid-template-columns:1fr}.paper-shell{width:100%;height:100%;margin:0;border-radius:0;border-inline:0}.reader-toolbar{gap:7px;border-bottom:1px solid #d9dfe4;overflow:visible}.toolbar-nav{justify-content:space-between}.reader-toolbar .tool-group span{min-width:48px}.toolbar-actions{gap:6px}.toolbar-actions>button{min-width:34px;height:34px}.mode-chip{height:32px;padding:0 9px;font-size:10px}.chip-swatch{width:16px;height:16px}.stage{grid-template-rows:auto minmax(0,1fr) 22px}.side{top:58px}.welcome p{font-size:13px}}


/* v13 fixes: stable loading, improved focus, fit chips, responsive polish */
body.focus-reader .workspace{grid-template-columns:minmax(0,1fr)!important}body.focus-reader .stage{grid-column:1/-1}body.focus-reader .paper-shell{width:min(1380px,calc(100% - 12px));margin:6px auto;height:calc(100% - 12px);border-radius:12px}body.focus-reader .reader-toolbar{padding-inline:10px}body.focus-reader .stage-footer{padding-inline:8px}.toolbar-theme{flex:1 1 620px}.fit-strip{margin-left:4px}.fit-strip .mode-chip span:first-child{font-size:12px}.mode-chip.small span:first-child{display:inline-flex;align-items:center;justify-content:center;min-width:14px}.reader-toolbar .toolbar-actions{row-gap:8px}
.load-mask{align-items:center;justify-content:center}.load-mask[hidden]{display:none!important}.pdfjs-stage{min-height:0}.pdfjs-page-card.rendering{opacity:.88}.pdfjs-page-card{transition:transform .22s ease,box-shadow .22s ease,opacity .22s ease}.pdfjs-hint{bottom:12px}body.focus-reader .pdfjs-stage{padding-bottom:40px}
.stage-footer{display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;white-space:nowrap;overflow:hidden}.stage-footer span:nth-child(2){overflow:hidden;text-overflow:ellipsis}.shortcut{justify-self:end}.stage-footer:before{display:none!important}
.side{min-width:0}.pane{overflow:auto}.native-viewer{min-height:0}.paper-shell{display:grid}.paper-shell>.welcome,.paper-shell>#viewer,.paper-shell>#epub,.paper-shell>#audioWrap,.paper-shell>.load-mask{grid-area:1/1}.audio-wrap{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;padding:24px}
body.hide-side .paper-shell, body.focus-reader .paper-shell{width:min(1380px,calc(100% - 16px))}.toolbar-actions > button,.reader-toolbar .tool-group, .reader-toolbar .tool-group button{box-shadow:none}
@media(max-width:1024px){.toolbar-theme{flex-basis:100%}.fit-strip{margin-left:0}}
@media(max-width:900px){body.focus-reader .paper-shell{width:calc(100% - 10px)} .stage-footer{grid-template-columns:auto 1fr}.shortcut{display:none}.toolbar-actions{width:100%;justify-content:flex-start}}
@media(max-width:760px){.toolbar-theme{gap:8px}.fit-strip{padding-bottom:2px;overflow:auto hidden;flex-wrap:nowrap}.fit-strip .mode-chip{flex:0 0 auto}.stage-footer{grid-template-columns:auto 1fr;gap:8px}.paper-shell{height:calc(100% - 10px)} }
@media(max-width:560px){body.focus-reader .paper-shell, .paper-shell{width:100%;height:100%;margin:0;border-radius:0}.reader-toolbar{position:relative;z-index:3}.toolbar-nav{width:100%;justify-content:space-between}.toolbar-actions{width:100%;overflow:auto hidden;flex-wrap:nowrap;padding-bottom:2px}.toolbar-actions>button{flex:0 0 auto}.stage-footer{font-size:9px;padding:0 8px}.fit-strip,.theme-strip,.view-strip{scrollbar-width:none}.fit-strip::-webkit-scrollbar,.theme-strip::-webkit-scrollbar,.view-strip::-webkit-scrollbar{display:none}}


/* v14 — stable surfaces + spread/search/mobile polish */
.paper-shell>#viewer:not([hidden]),.paper-shell>#epub:not([hidden]){display:block!important}.paper-shell>#audioWrap:not([hidden]){display:flex!important}.paper-shell>#empty:not([hidden]){display:flex!important}.load-mask[hidden]{display:none!important}
.pdf-spread{display:flex;align-items:flex-start;justify-content:center;gap:18px;max-width:100%;perspective:1800px}.pdf-spread .second-page[hidden]{display:none!important}body.view-spread .pdfjs-stage{background:linear-gradient(90deg,#e5e9ec,#d9dfe3 50%,#e5e9ec)}body.view-spread .pdfjs-page-card{box-shadow:0 12px 28px #17253622}.pdf-spread.flip-next{animation:v14flipNext .45s ease}.pdf-spread.flip-prev{animation:v14flipPrev .45s ease}@keyframes v14flipNext{0%{transform:rotateY(-11deg) scale(.989);opacity:.84}100%{transform:none;opacity:1}}@keyframes v14flipPrev{0%{transform:rotateY(11deg) scale(.989);opacity:.84}100%{transform:none;opacity:1}}
body.focus-reader .workspace{grid-template-columns:minmax(0,1fr)!important}body.focus-reader .rail,body.focus-reader .side{display:none!important}body.focus-reader .pdfjs-thumbs{display:none!important}body.focus-reader .pdfjs-layout{grid-template-columns:minmax(0,1fr)!important}body.focus-reader .paper-shell{width:min(1460px,calc(100% - 10px));height:calc(100% - 10px);margin:5px auto}body.focus-reader .toolbar-theme{justify-content:center}
#searchPdf,#speakPage{font-size:15px}.toolbar-actions{overflow:auto hidden;scrollbar-width:none}.toolbar-actions::-webkit-scrollbar{display:none}.stage-footer:before{display:none!important}.stage-footer{display:grid;grid-template-columns:auto 1fr auto;gap:10px;white-space:nowrap;overflow:hidden}.stage-footer span:nth-child(2){overflow:hidden;text-overflow:ellipsis}.shortcut{justify-self:end}
body.dark-mode.view-spread .pdfjs-stage{background:linear-gradient(90deg,#101720,#17212d 50%,#101720)}body.eink-gray.view-spread .pdfjs-stage{background:#d9d9d9}body.eink-color.view-spread .pdfjs-stage{background:#e4e3d8}
@media(max-width:700px){body.view-spread .second-page{display:none!important}.pdf-spread{display:block}.toolbar-actions{width:100%;justify-content:flex-start}.stage-footer{grid-template-columns:auto 1fr}.shortcut{display:none}}
@media(max-width:560px){.rail{position:fixed!important;left:0;right:0;bottom:0;top:auto!important;height:56px;z-index:80;display:grid!important;grid-template-columns:repeat(4,1fr)!important;padding:4px 8px!important}.rail button{height:48px!important}.rail button small{display:block!important}.workspace{grid-template-columns:1fr!important}.stage{padding-bottom:56px}.stage-footer{display:none}.side{bottom:56px!important}.paper-shell,body.focus-reader .paper-shell{width:100%;height:100%;margin:0;border-radius:0}.toolbar-theme,.toolbar-actions{overflow:auto hidden;flex-wrap:nowrap}.mode-chip{flex:0 0 auto}}
#pageNum{cursor:pointer;border-radius:6px}#pageNum:hover{background:#eef3f8;color:#244d7a}body.dark-mode #pageNum:hover{background:#2c3948;color:#fff}

/* v15 — search/toc/command palette + real flip integration */
.tabs-scroll{display:flex;overflow-x:auto;scrollbar-width:none;gap:2px}.tabs-scroll::-webkit-scrollbar{display:none}.tabs-scroll .tab{flex:1 0 auto;padding-inline:8px}
.doc-search{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;margin:10px 0}.doc-search input{min-width:0;border:1px solid var(--line);border-radius:8px;padding:9px 10px;background:white;color:var(--ink);outline:0}.doc-search input:focus{border-color:#8eabd8;box-shadow:0 0 0 3px #356ee812}.doc-search button{border:0;border-radius:8px;background:var(--navy);color:white;padding:0 12px;font-weight:800}.search-status{font-size:10px;color:var(--muted);margin:5px 0 8px}.search-results{display:grid;gap:7px}.search-hit{display:grid;gap:4px;width:100%;text-align:left;border:1px solid var(--line);border-radius:9px;background:white;padding:9px;color:var(--ink)}.search-hit:hover{border-color:#9fb5d1;background:#f8fbfe}.search-hit b{font-size:10px;color:var(--navy)}.search-hit span{font-size:10px;line-height:1.45;color:var(--muted)}
.toc-list{display:grid;gap:5px}.toc-item{--depth:0;width:100%;text-align:left;border:0;border-left:2px solid #dce3e9;background:#f8fafb;color:#4a5b70;border-radius:0 7px 7px 0;padding:8px 9px 8px calc(9px + var(--depth)*12px);font-size:10px}.toc-item:hover{background:#edf4fa;border-left-color:#356ee8;color:#19345e}
.command-backdrop{position:fixed;inset:0;z-index:300;background:#0f1f3042;backdrop-filter:blur(5px);display:flex;align-items:flex-start;justify-content:center;padding:11vh 18px}.command-backdrop[hidden]{display:none!important}.command-palette{width:min(620px,100%);max-height:min(620px,76vh);overflow:hidden;background:white;border:1px solid #d3dbe2;border-radius:16px;box-shadow:0 30px 90px #0e1d3048;display:grid;grid-template-rows:auto minmax(0,1fr) auto}.command-search{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:9px;padding:12px 14px;border-bottom:1px solid var(--line)}.command-search span{color:#6a788b}.command-search input{border:0;outline:0;background:transparent;font-size:14px;color:var(--ink);min-width:0}.command-search kbd,.command-list kbd{font:9px ui-monospace,SFMono-Regular,Consolas,monospace;border:1px solid #d8dfe5;border-bottom-width:2px;border-radius:5px;padding:2px 5px;background:#f7f9fa;color:#758194}.command-list{overflow:auto;padding:7px}.command-list button{width:100%;display:flex;justify-content:space-between;align-items:center;gap:10px;border:0;background:transparent;border-radius:9px;padding:9px 10px;text-align:left;color:#475970;font-size:11px}.command-list button:hover,.command-list button.active{background:#edf3f9;color:#17345b}.command-help{padding:8px 13px;border-top:1px solid var(--line);color:#8a96a4;font-size:9px}.command-empty{padding:22px;color:#8a96a4;text-align:center}
.session-time{font-variant-numeric:tabular-nums;color:#7b8795}.stage-footer{grid-template-columns:auto minmax(0,1fr) auto auto!important}.stage-footer #statusText{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.flipbook-host{width:100%;height:100%;min-height:420px;display:flex;align-items:center;justify-content:center;padding:16px;overflow:hidden}.flipbook-host[hidden]{display:none!important}.flipbook-root{width:100%;height:100%;max-width:1000px;max-height:100%;margin:auto}.flip-real-page{background:white;display:flex!important;align-items:center;justify-content:center;position:relative;overflow:hidden}.flip-real-page img{display:block;width:100%;height:100%;object-fit:contain;background:white}.flip-real-page small{position:absolute;right:9px;bottom:7px;padding:3px 6px;border-radius:99px;background:#ffffffc9;color:#667486;font-size:8px;box-shadow:0 2px 8px #0001}.flip-preparing{font-size:11px;color:var(--muted);padding:20px}
body.dark-mode .doc-search input,body.dark-mode .search-hit,body.dark-mode .command-palette{background:#202b37;color:#dbe4ed;border-color:#394858}body.dark-mode .search-hit:hover,body.dark-mode .command-list button:hover,body.dark-mode .command-list button.active{background:#263443;color:white}body.dark-mode .search-hit b{color:#b8d1ef}body.dark-mode .toc-item{background:#202b37;color:#becbd8;border-left-color:#455568}body.dark-mode .toc-item:hover{background:#263443;border-left-color:#78a1d6}body.dark-mode .command-search,body.dark-mode .command-help{border-color:#394858}body.dark-mode .command-search input{color:#e6edf5}body.dark-mode .command-search kbd,body.dark-mode .command-list kbd{background:#17212c;border-color:#3c4b5a;color:#b7c3cf}
body.eink-gray .command-palette,body.eink-gray .doc-search input,body.eink-gray .search-hit{filter:grayscale(1);box-shadow:none}body.eink-color .command-palette,body.eink-color .doc-search input,body.eink-color .search-hit{filter:saturate(.75)}
@media(max-width:760px){.command-backdrop{padding:7vh 10px}.command-palette{max-height:82vh}.stage-footer{grid-template-columns:auto minmax(0,1fr) auto!important}.session-time{display:none}.tabs-scroll .tab{font-size:9px}.flipbook-host{min-height:320px;padding:7px}}
.saved-item[data-jump]{cursor:pointer}.saved-item[data-jump]:hover{border-color:#9fb5d1;background:#f7fafc}.saved-item b{font-size:10px;font-weight:800}
@media(max-width:560px){
  .workspace{padding-bottom:56px!important}.rail{display:flex!important;position:fixed;left:0;right:0;bottom:0;top:auto;width:100%;height:56px;z-index:80;flex-direction:row;align-items:stretch;padding:4px 6px;gap:3px;overflow-x:auto;overflow-y:hidden;border-right:0;border-top:1px solid #ffffff16;scrollbar-width:none}.rail::-webkit-scrollbar{display:none}.rail button{flex:1 0 58px;height:48px!important;display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:2px}.rail button small{display:block!important;font-size:8px}.rail button span{font-size:14px}.side{bottom:56px!important}.stage-footer{display:none!important}body.focus-reader .workspace{padding-bottom:0!important}body.focus-reader .rail{display:none!important}
}

/* v16 — compact adaptive toolbar + smart pane */
.compact-toolbar{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 10px;overflow:visible!important}
.toolbar-primary,.toolbar-secondary,.compact-actions{display:flex;align-items:center;gap:7px;min-width:0}.toolbar-secondary{justify-content:center;overflow:visible}.compact-actions{justify-content:flex-end}.page-number{min-width:72px!important;padding-inline:10px!important;font-weight:800!important;color:#294666!important}.toolbar-menu-button,.action-icon{height:34px;border:1px solid var(--line);border-radius:9px;background:#fff;color:#4b5c72;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 10px}.toolbar-menu-button b{font-size:10px;white-space:nowrap}.toolbar-menu-button i{font-style:normal;font-size:9px;opacity:.6}.action-icon{width:36px;padding:0;font-size:15px}.smart-action{color:#6a4a00;background:#fffaf0}.theme-dot{width:15px;height:15px;border-radius:50%;background:linear-gradient(135deg,#fff,#dbe5ee);box-shadow:inset 0 0 0 1px #bdc8d3}.popover-wrap{position:relative;display:inline-flex}.toolbar-popover{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);z-index:90;width:330px;max-width:min(92vw,380px);background:#fff;border:1px solid #d8e0e6;border-radius:14px;box-shadow:0 20px 55px rgba(20,38,61,.22);padding:14px;color:#26384e}.toolbar-popover[hidden]{display:none!important}.toolbar-popover>strong{display:block;font:700 14px Georgia,serif}.toolbar-popover>small{display:block;color:#7a889a;font-size:9px;margin:2px 0 11px}.compact-popover{width:270px}.more-popover{right:0;left:auto;transform:none;width:290px}.popover-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.popover-grid>button,.more-grid>button{border:1px solid #e0e6eb;background:#f9fbfc;border-radius:10px;padding:10px;text-align:left;color:#43556d}.popover-grid>button:hover,.popover-grid>button.active,.more-grid>button:hover,.more-grid>button.active{border-color:#9bb3d4;background:#eef4fb}.popover-grid>button span{display:block;font-size:16px}.popover-grid>button b{display:block;font-size:11px;margin-top:5px}.popover-grid>button small{display:block;font-size:9px;color:#8190a2;margin-top:1px}.popover-row{width:100%;display:grid;grid-template-columns:30px 1fr;align-items:center;gap:8px;border:0;border-radius:9px;background:transparent;color:#40536b;padding:8px;text-align:left}.popover-row:hover,.popover-row.active{background:#eef4fb}.popover-row>span{font-weight:800;text-align:center}.popover-row b,.popover-row small{display:block}.popover-row b{font-size:11px}.popover-row small{font-size:9px;color:#8793a2}.theme-cards{display:grid;grid-template-columns:repeat(5,1fr);gap:7px}.theme-cards button{border:1px solid #e1e6eb;border-radius:9px;background:#fbfcfd;padding:7px 4px;color:#40536b}.theme-cards button.active{border-color:#688dbb;background:#edf4fb}.theme-preview{display:block;width:100%;aspect-ratio:1.4;border-radius:6px;margin-bottom:5px;border:1px solid #d8dfe5}.theme-cards b{font-size:8px;line-height:1.1}.more-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.more-grid button{text-align:center;padding:10px 5px}.more-grid button span,.more-grid button b{display:block}.more-grid button span{font-size:17px}.more-grid button b{font-size:9px;margin-top:4px}
.rights-badge{display:inline-flex;margin-left:8px;border:1px solid #d6dde5;border-radius:999px;padding:3px 7px;font-size:8px;color:#69798e}.source-meta{display:flex;align-items:center;flex-wrap:wrap;gap:3px}.smart-pane-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.smart-pane-head h2{margin:5px 0}.smart-pane-head>small{border:1px solid var(--line);padding:3px 6px;border-radius:99px;font-size:8px;color:#758497}.smart-badge{font-size:8px;font-weight:900;letter-spacing:.12em;color:#80620c}.smart-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:12px 0}.smart-actions .side-btn{margin:0;text-align:center}.smart-query{display:grid;grid-template-columns:1fr auto;gap:6px;margin:12px 0}.smart-query input{min-width:0;border:1px solid var(--line);border-radius:8px;padding:9px 10px;background:#fff}.smart-query button{border:0;border-radius:8px;background:var(--navy);color:#fff;padding:0 11px;font-weight:800}.smart-result{display:grid;gap:8px}.smart-answer{border:1px solid var(--line);background:#fff;border-radius:10px;padding:11px}.smart-answer small{font-size:8px;color:#8794a4;text-transform:uppercase;letter-spacing:.08em}.smart-answer h3{font:16px Georgia,serif;margin:4px 0 7px}.smart-answer p{font-size:11px;line-height:1.6;color:#58687c;margin:0;white-space:pre-wrap}.ai-answer{border-color:#eadba7;background:#fffaf0}.smart-loading{padding:18px;text-align:center;color:#7b8998;font-size:10px}.smart-hit-list{display:grid;gap:6px}.smart-hit-list button{border:1px solid var(--line);border-radius:9px;background:#fff;text-align:left;padding:9px;color:#526278}.smart-hit-list button:hover{border-color:#8da9cd;background:#f6f9fc}.smart-hit-list b,.smart-hit-list span{display:block}.smart-hit-list b{font-size:9px;color:#315f99}.smart-hit-list span{font-size:10px;line-height:1.45;margin-top:3px}.ai-details{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}.ai-details summary{font-size:10px;font-weight:800;cursor:pointer}.ai-details p{font-size:9px;color:#7b8999;line-height:1.5}.ai-details code{font-size:8px}
body.dark-mode .toolbar-popover{background:#202b37;color:#e1e8ef;border-color:#3b4857}.dark-mode .popover-grid>button,.dark-mode .more-grid>button,.dark-mode .theme-cards button,.dark-mode .smart-answer,.dark-mode .smart-hit-list button{background:#18212d;color:#d6e0e9;border-color:#3a4755}.dark-mode .popover-row{color:#d4dfe8}.dark-mode .popover-row:hover,.dark-mode .popover-row.active,.dark-mode .popover-grid>button:hover,.dark-mode .popover-grid>button.active{background:#273647}.dark-mode .smart-query input{background:#18212d;color:#e4eaf0;border-color:#3a4755}.dark-mode .smart-answer p{color:#b9c6d3}.dark-mode .ai-answer{background:#332f22;border-color:#5f5738}
@media(max-width:1100px){.compact-toolbar{grid-template-columns:auto 1fr auto}.toolbar-menu-button b{display:none}.toolbar-menu-button{padding-inline:9px}.toolbar-secondary{justify-content:flex-end}.zoom-tools{display:none}}
@media(max-width:760px){.compact-toolbar{display:flex;align-items:center;gap:7px;padding:7px 8px;flex-wrap:nowrap}.toolbar-primary{flex:1}.page-tools{width:100%;justify-content:space-between}.page-tools button{flex:0 0 38px}.page-number{flex:1!important}.toolbar-secondary{display:none}.compact-actions{gap:5px}.compact-actions>.action-icon:nth-of-type(3){display:none}.smart-actions{grid-template-columns:1fr}.toolbar-popover{position:fixed;left:10px!important;right:10px!important;bottom:74px;top:auto!important;transform:none!important;width:auto!important;max-width:none!important}.more-popover{bottom:74px}.theme-cards{grid-template-columns:repeat(5,minmax(54px,1fr))}.zoom-tools{display:none}.smart-action{display:inline-flex}.reader-toolbar{min-height:50px}}
@media(max-width:480px){.compact-actions #bookmarkQuick{display:none}.compact-actions .action-icon{width:34px}.page-number{min-width:52px!important}.more-grid{grid-template-columns:repeat(3,1fr)}}
.pdf-continuous{width:100%;display:grid;justify-items:center;gap:18px;padding:4px 0 40px}.pdf-continuous[hidden]{display:none!important}.continuous-page{position:relative;min-width:260px;min-height:360px;background:#fff;border:1px solid #cbd3da;border-radius:4px;box-shadow:0 10px 28px rgba(20,38,61,.16);display:grid;place-items:center}.continuous-page canvas{display:block;max-width:100%;height:auto;background:#fff}.continuous-page>span{position:absolute;right:7px;bottom:6px;background:#172b45d9;color:#fff;border-radius:999px;padding:2px 6px;font-size:8px}.view-scroll .pdfjs-hint{display:none}.dark-mode .continuous-page{border-color:#3b4857;box-shadow:0 12px 30px #0005}.eink-gray .continuous-page{box-shadow:none;border-color:#8e8e8e;filter:grayscale(1)}.eink-color .continuous-page{filter:saturate(.72);box-shadow:0 7px 18px rgba(80,98,91,.14)}
@media(max-width:760px){.pdf-continuous{gap:10px}.continuous-page{min-width:220px;min-height:300px;border-inline:0;border-radius:0;box-shadow:none}}

/* v17 — clearer page navigation + favicon/PWA pass */
.edge-nav{display:none;position:absolute;z-index:8;top:50%;transform:translateY(-50%);width:42px;height:64px;border:1px solid rgba(120,137,157,.28);background:rgba(255,255,255,.86);backdrop-filter:blur(10px);color:#40536b;border-radius:12px;font-size:32px;line-height:1;box-shadow:0 10px 30px rgba(18,35,56,.12);opacity:.48;transition:.18s}.edge-nav:hover{opacity:1;transform:translateY(-50%) scale(1.03)}.edge-prev{left:12px}.edge-next{right:12px}body[data-format="pdf"] .edge-nav,body[data-format="epub"] .edge-nav{display:block}body.focus-reader .edge-prev{left:8px}body.focus-reader .edge-next{right:8px}body.dark-mode .edge-nav{background:rgba(31,43,56,.9);color:#dce6f0;border-color:#46586c}body.eink-gray .edge-nav{background:#eee;color:#222;box-shadow:none}body.eink-color .edge-nav{background:#f6f2e7;color:#40534b}
@media(max-width:900px){.edge-nav{width:38px;height:54px;font-size:28px}.edge-prev{left:6px}.edge-next{right:6px}}
@media(max-width:620px){.edge-nav{display:none!important}}


/* v17.2 — fullscreen/focus state polish */
.fullscreen-toggle{position:relative;display:inline-grid;place-items:center;padding:0}.fullscreen-toggle .fs-icon{display:grid;place-items:center;width:18px;height:18px}.fullscreen-toggle .fs-icon[hidden]{display:none!important}.fullscreen-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.fullscreen-toggle:hover{background:#ffffff16;border-color:#ffffff38}.fullscreen-toggle.active,.fullscreen-toggle[data-fullscreen="true"]{background:#ffffff1c;border-color:#8fb9ff;box-shadow:0 0 0 2px #8fb9ff22 inset}.fullscreen-toggle.active:hover{background:#ffffff28}.fullscreen-toggle:focus-visible{outline:2px solid #9bc1ff;outline-offset:2px}
#focusMode .focus-enter[hidden],#focusMode .focus-exit[hidden]{display:none!important}#focusMode.active{background:var(--navy);color:#fff;border-color:var(--navy)}body.dark-mode #focusMode.active{background:#47617f;border-color:#5a7390}
body.is-fullscreen .topbar{padding-top:env(safe-area-inset-top,0px)}body.is-fullscreen .reader-app{height:100dvh}body.is-fullscreen .toast{bottom:max(38px,env(safe-area-inset-bottom,0px))}
@media(max-width:560px){.fullscreen-toggle{width:36px;height:36px}.fullscreen-toggle svg{width:17px;height:17px}}
