:root{color-scheme:dark;--navy:#0b1e40;--gold:#f5cf71;--ink:#eff4ff;--line:rgba(220,235,255,.14)}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;height:100dvh;min-height:380px;overflow:hidden}
body{display:flex;flex-direction:column;background:var(--navy);color:var(--ink);font-family:Arial,Helvetica,sans-serif}
.header{height:76px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:0 30px;border-bottom:1px solid var(--line);background:#0a1a37}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{height:38px;width:38px;border:1px solid #f5cf7180;border-radius:10px;display:grid;place-items:center;font-size:25px;font-weight:800;color:var(--gold)}
.brand b{font-size:14px;letter-spacing:2px;color:var(--gold)}
.brand p{margin:5px 0 0;font-size:16px;line-height:1.2}
.sample-tag{flex:none;padding:8px 12px;border:1px solid #f5cf7155;border-radius:100px;font-size:12px;letter-spacing:1.5px;color:var(--gold)}
.stage{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:20px 28px;background:radial-gradient(ellipse at 50% 35%,#193766 0%,#0b1e40 68%);perspective:2200px;touch-action:pan-y}
.book{position:relative;display:flex;flex:none;isolation:isolate;filter:drop-shadow(0 18px 26px #0006);perspective:2200px}
.book[hidden],.turning-sheet[hidden],.error[hidden],.loading[hidden]{display:none!important}
.paper{width:50%;height:100%;position:relative;background:white;overflow:hidden;box-shadow:0 0 0 1px #d8e0ed;flex:none}
.paper img,.sheet-face img{width:100%;height:100%;display:block;object-fit:contain;background:white;user-select:none;-webkit-user-select:none}
.left-paper{border-radius:3px 0 0 3px}
.right-paper{border-radius:0 3px 3px 0}
.paper.empty{opacity:0;pointer-events:none;box-shadow:none}
.spine{position:absolute;z-index:2;top:0;bottom:0;left:50%;width:26px;transform:translateX(-50%);pointer-events:none;background:linear-gradient(90deg,transparent,#00000022 40%,#00000033 50%,#00000010 65%,transparent)}
.book.single .paper{width:100%;border-radius:3px}
.book.single .right-paper,.book.single .spine,.book.last-spread .spine{display:none}
.turning-sheet{position:absolute;top:0;left:50%;width:50%;height:100%;z-index:4;transform-origin:left center;transform-style:preserve-3d}
.sheet-face{position:absolute;inset:0;background:white;backface-visibility:hidden;overflow:hidden;box-shadow:0 0 1px #121e3880}
.sheet-front{transform:rotateY(0deg);background:linear-gradient(90deg,#0001,white)}
.sheet-back{transform:rotateY(180deg)}
.sheet-face:after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,#00000012,transparent 35%)}
.book.single .turning-sheet{left:0;width:100%;transform-origin:left center}
.stage.zoomed{overflow:auto;align-items:flex-start;justify-content:flex-start;touch-action:pan-x pan-y}
.stage.zoomed .book{margin:auto}
.toolbar{min-height:78px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 28px;border-top:1px solid var(--line);background:#0a1a37}
.navigation,.tools{display:flex;align-items:center;gap:8px}
button,select{min-height:42px;font-family:inherit;font-size:14px;font-weight:600;border:1px solid #a9c6ef40;border-radius:10px;padding:0 15px;background:#14305a;color:#f4f7ff;cursor:pointer}
button:hover:not(:disabled){background:#1d4275;border-color:#9db9e580}
button.primary{background:var(--gold);border-color:var(--gold);color:#102447}
button.primary:hover:not(:disabled){background:#ffdd8f}
button:disabled{opacity:.35;cursor:default}
button:focus-visible,select:focus-visible,a:focus-visible{outline:3px solid #84beff;outline-offset:3px}
.page-info{text-align:center;min-width:180px;display:flex;align-items:center;gap:10px;justify-content:center}
select{max-width:220px;min-width:160px;font-weight:500}
select option{background:#14305a;color:#fff}
#position{font-size:13px;color:#a8bbd9;white-space:nowrap}
.tools button{background:transparent;font-weight:500}
.tools button[aria-pressed=true]{background:#1d4275;border-color:#91b8ef}
.loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:12px;font-size:16px;color:#dbe8fd}
.spinner{height:20px;width:20px;border:2px solid #fff3;border-top-color:var(--gold);border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.error{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:24px;text-align:center;background:#0a1a37ee;border:1px solid var(--line);border-radius:16px;z-index:8;min-width:240px}
.error p{font-size:16px;margin:0 0 16px}.error a{display:inline-block;margin:0 14px 0 0;color:var(--gold);font-size:14px}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.embed .header{display:none}
@media(max-width:800px){.toolbar{flex-wrap:wrap;justify-content:center;gap:10px;padding:12px 14px}.page-info{order:-1;width:100%}.toolbar .tools{margin-left:auto}.navigation{margin-right:auto}.toolbar button{padding:0 12px}.header{padding:0 18px;height:70px}.brand p{font-size:14px;max-width:270px}.stage{padding:14px 12px}.tools button{font-size:13px}}
@media(max-width:480px){.brand-mark{display:none}.brand p{max-width:245px}.sample-tag{padding:6px 8px;font-size:11px;letter-spacing:1px}.header{gap:8px;padding:0 14px}.toolbar{gap:8px}.toolbar button{font-size:13px;min-height:42px;padding:0 10px}.tools{gap:6px}.navigation{gap:6px}.page-info select{max-width:210px}.stage{padding:10px 8px}}
@media(prefers-reduced-motion:reduce){.spinner{animation:none}}
