/* Pixel viewport and explicit classes work in Android WebView without :has/dvh. */
body.book-focus .reader-main{height:var(--reader-height,100vh);width:100%;position:relative}
body.book-focus .reading-sheet{position:absolute;top:0;right:0;bottom:0;left:0}
body.book-focus .reading-sheet.has-spread>.reading-page,
.app-shell.book-focus .reading-sheet.has-spread>.reading-page{display:none!important}
body.book-focus .reading-page,body.book-focus .reading-page.pdf-leaf{position:absolute;left:50%;top:50%;margin:0;transform:translate(-50%,-50%) scale(var(--page-scale,1));transform-origin:center}
body.book-focus .focus-spread{position:absolute;left:50%;top:50%;margin:0;max-width:none;transform:translate(-50%,-50%) scale(var(--page-scale,1))}
body.book-focus .focus-spread .spread-leaf{height:100%;width:calc((100% - 12px)/2);aspect-ratio:auto;min-height:0}
body.book-focus .focus-spread.stacked{flex-direction:column}
body.book-focus .focus-spread.stacked .spread-leaf{width:100%;height:calc((100% - 12px)/2)}
body.book-focus .focus-spread .spread-picture img{display:block;max-height:100%;width:100%;height:100%;object-fit:contain}
body.book-focus .reading-page.pdf-leaf .page-illustration{max-width:100%;max-height:none;width:100%;height:auto}
body.book-focus .focus-controls{box-sizing:border-box;bottom:8px;font-size:14px}
.focus-controls a{color:inherit;text-decoration:none;padding:8px;border:1px solid #ffffff60;border-radius:8px;white-space:nowrap}
body.book-focus .focus-controls button{font-size:14px;min-height:40px}
@media(max-width:700px){body.book-focus .focus-controls{gap:5px;padding:7px;width:calc(100% - 16px)}body.book-focus .focus-controls button{padding:7px;font-size:12px}}
.video-page{max-width:1280px;margin:auto;padding:24px 16px}.video-page h1{font-size:28px;margin:16px 0}.book-video{display:block;width:100%;max-height:75vh;background:#242721;margin:18px 0}.video-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:16px 0}.video-actions input{width:80px}.video-actions label{font-size:14px}.video-progress{padding:16px;background:#f5eddc;border-radius:12px}.video-page [hidden]{display:none!important}

/* Ending: one code beside the text; two codes above it. */
.ending-layout{display:flex;align-items:flex-start;gap:18px;width:100%;color:var(--ending-ink,#304b40)}
.ending-layout .ending-copy{order:1;flex:1;min-width:0;text-align:left}
.ending-layout h2{margin:0 0 12px;font-size:20px;line-height:1.3}
.ending-layout .ending-qr-row{order:2;display:flex;gap:18px;justify-content:center;flex-shrink:0}
.ending-layout .project-qr{width:140px;max-width:none;margin:0;text-decoration:none;color:inherit}
.ending-layout .project-qr span{display:block;text-align:center;font-size:12px;line-height:1.4;margin-top:6px}
.ending-layout.two-codes{flex-direction:column;align-items:center}
.ending-layout.two-codes .ending-qr-row{order:1}
.ending-layout.two-codes .ending-copy{order:2;width:100%;text-align:center}
.sheet-overlay .ending-layout .ending-copy{color:inherit}
@media(max-width:700px){.ending-layout{gap:10px}.ending-layout .project-qr{width:100px}.ending-layout h2{font-size:14px}.ending-layout .ending-qr-row{gap:12px}.ending-layout .project-qr span{font-size:10px}}

/* One persistent viewport and a compact floating toolbar, including Safari. */
html.reader-focus{background:#242721;overflow:hidden;overscroll-behavior:none}
body.book-focus{position:fixed;inset:0;width:100%;height:var(--reader-height,100%);overscroll-behavior:none}
body.book-focus .reader-shell{position:relative;width:100%;height:var(--reader-height,100vh)}
.reading-sheet{touch-action:pan-y pinch-zoom}
.reading-sheet img{-webkit-user-drag:none}
body.book-focus .focus-controls{position:absolute;display:flex;flex-direction:column;gap:8px;bottom:calc(12px + env(safe-area-inset-bottom,0px));left:50%;width:max-content;max-width:calc(100% - 24px);padding:0;border:0;border-radius:0;background:transparent;color:#535962;box-shadow:none;z-index:30}
.focus-toolbar,.focus-pagination{display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #eeedf0;box-shadow:0 5px 25px #0002;border-radius:999px}
.focus-toolbar{gap:4px;padding:8px 14px}
.focus-pagination{padding:0 4px;background:#fffffff5}
body.book-focus .focus-controls button,body.book-focus .focus-controls a{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;min-height:44px;flex:0 0 44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;text-decoration:none;line-height:1}
body.book-focus .focus-controls button:hover,body.book-focus .focus-controls a:hover{background:#f0f2f5;color:#2c3d45}
.focus-controls svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.focus-controls .focus-pause-icon{display:none}.focus-controls .is-playing .focus-play-icon{display:none}.focus-controls .is-playing .focus-pause-icon{display:block}
.focus-controls #focus-number{min-width:58px;text-align:center;font-size:12px;line-height:1.4}
body.book-focus .focus-controls label{display:flex;align-items:center;gap:8px;border-left:1px solid #e5e6e9;margin-left:4px;padding-left:14px;font-size:13px;white-space:nowrap}
.focus-controls label span{font-size:inherit}
body.book-focus .focus-controls #page-delay{appearance:textfield;-moz-appearance:textfield;width:44px;min-width:0;height:36px;min-height:36px;padding:4px 1px;border:0;border-radius:999px;box-shadow:inset 0 1px 5px #293b4012;background:#f1f2f5;color:#34414c;font-size:16px;font-weight:600;text-align:center;line-height:1.3}
.focus-controls #page-delay::-webkit-inner-spin-button,.focus-controls #page-delay::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
body.book-focus .focus-controls #auto-status{display:block}
body.book-focus .focus-controls #auto-status:not(.sr-only){width:100%;max-width:320px;padding:9px 12px;border-radius:14px;background:#20382e;color:#fff;font-size:12px;line-height:1.6}
@media(max-width:1100px), (pointer:coarse){body.book-focus .focus-controls{opacity:1;pointer-events:auto}}
@media(max-width:380px){.focus-toolbar{gap:2px;padding:7px 8px}body.book-focus .focus-controls label{gap:6px;margin-left:2px;padding-left:8px;font-size:12px}body.book-focus .focus-controls #page-delay{width:36px;font-size:16px}}
@media print{.mobile-nav-dock,body.book-focus .focus-controls{display:none!important}}

/* Draft pages stay review-only in every reader layout; PDF/video use the same mark. */
.draft-watermarked .reader-shell:before{content:'ЧЕРНОВИК · ДЛЯ СОГЛАСОВАНИЯ';display:block;margin:0 0 14px;padding:9px 14px;border:1px solid #b84c3f55;border-radius:10px;background:#fff0ed;color:#8d342c;font-size:12px;font-weight:700;letter-spacing:.08em;text-align:center}
.draft-watermarked .reading-page,.draft-watermarked .spread-leaf{position:relative;overflow:hidden}
.draft-watermarked .reading-page:after,.draft-watermarked .spread-leaf:after{content:'ЧЕРНОВИК';position:absolute;left:-22%;top:43%;z-index:20;width:144%;padding:12px 0;transform:rotate(-28deg);background:#fff9;color:#9a3d38aa;border-block:2px solid #9a3d3855;font:700 clamp(24px,5vw,54px)/1.2 Arial,sans-serif;letter-spacing:.18em;text-align:center;pointer-events:none;text-shadow:0 1px #fff}
.attached-videos{display:grid;gap:16px;margin-bottom:22px}.attached-videos.is-empty{display:none}.attached-videos article{padding:18px;border:1px solid #deddd5;border-radius:14px;background:#fffdf8}.attached-videos h2{font-size:22px}.attached-videos p:not(.eyebrow){margin-top:6px;color:#66726b}.attached-videos video{display:block;width:100%;max-height:65vh;margin:14px 0;background:#242721;border-radius:10px}
body.book-focus.book-has-attached-video .reading-sheet{display:none}
body.book-focus .attached-videos:not(.is-empty){position:absolute;inset:0;z-index:8;display:grid;align-content:start;justify-items:center;gap:16px;margin:0;padding:12px 12px 118px;overflow:auto;background:#242721}
body.book-focus .attached-videos:not(.is-empty) article{width:min(900px,100%);box-sizing:border-box}
body.book-focus .attached-videos:not(.is-empty) video{max-height:min(58vh,calc(var(--video-space,700px) - 190px));object-fit:contain}
@media print{.draft-watermarked .reading-page:after,.draft-watermarked .spread-leaf:after{background:#fff8;color:#9a3d3899}}
