:root{color-scheme:light;--header-height:56px;--bg:#f5f3ed;--ink:#243d34;--muted:#85867d;--line:#deded3;--panel:#fffdf7;--green:#294e3e;--soft:#e6eadf;--shadow:rgba(38,42,29,.2)}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;transition:background .3s,color .3s}
body::before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.22;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23787769' opacity='.18' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E")}
button,input,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer}
button:disabled{opacity:.3;cursor:default}
button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid #6f9576;outline-offset:5px}
button{border:0;background:none}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.app{height:100vh;height:100dvh;min-height:340px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--header-height) minmax(0,1fr);overflow:hidden}
.topbar{position:relative;z-index:15;padding:0 20px;border-bottom:1px solid var(--line);background:var(--bg);display:flex;align-items:center;gap:20px;min-width:0}
.brand{display:flex;align-items:center;flex-shrink:0}
.brand-logo{display:block;width:160px;height:auto;max-height:36px;object-fit:contain;mix-blend-mode:multiply}
.book-title{flex:1;min-width:0;font-size:12px;letter-spacing:.7px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.pill{font-size:10px;letter-spacing:1px;border:1px solid var(--line);border-radius:20px;padding:7px 12px;white-space:nowrap}
.pill::before{content:"";width:5px;height:5px;display:inline-block;background:#72906d;border-radius:50%;margin:0 7px 1px 0}
.icon-button{width:35px;height:35px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;transition:background .2s}
.icon-button:hover{background:var(--soft)}
.reading-room{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;padding:8px 44px 16px}
.reading-room::before{content:"";position:absolute;width:60%;height:65%;background:radial-gradient(ellipse,#c3c4ad45,transparent 70%);filter:blur(35px);bottom:-7%;pointer-events:none}
.book-wrap{position:relative;flex-shrink:0;isolation:isolate;transition:filter .25s}
.book-wrap::before{content:"";position:absolute;inset:13px -4px -9px;background:repeating-linear-gradient(to bottom,#d5d1c5 0px,#f6f2e7 1px,#f6f2e7 2px);border:1px solid #cac5b7;border-radius:2px 3px 4px 4px;box-shadow:0 22px 35px -13px var(--shadow),0 6px 12px #29281719;z-index:-1}
.book-wrap::after{content:"";position:absolute;inset:-1px -5px -12px;border:1px solid #88796255;border-bottom:4px solid #637363;border-radius:3px 3px 5px 5px;z-index:-2}
.book{position:relative;width:100%;height:100%;background:#faf8f0;border-radius:2px;touch-action:pan-y;user-select:none;-webkit-user-select:none;cursor:grab}
.book:active{cursor:grabbing}
.page-surface{position:absolute;inset:0;overflow:hidden;border-radius:inherit}
.base-page{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-user-drag:none}
.base-left{clip-path:inset(0 50% 0 0)}
.base-right{clip-path:inset(0 0 0 50%)}
.spine{position:absolute;left:calc(50% - 13px);width:26px;top:0;bottom:0;background:linear-gradient(90deg,transparent,rgba(0,0,0,.07) 28%,rgba(0,0,0,.22) 49%,rgba(255,255,255,.13) 51%,rgba(0,0,0,.07) 67%,transparent);pointer-events:none;z-index:3;mix-blend-mode:multiply}
.page-sheen{position:absolute;inset:0;pointer-events:none;background:linear-gradient(105deg,#fff1,transparent 35%,transparent 65%,#00000006);z-index:2}
.turn-shade{position:absolute;inset:0;opacity:0;pointer-events:none;z-index:4;background:linear-gradient(90deg,transparent 28%,#0008 49.8%,#0005 50.1%,transparent 84%)}
#turnCanvas,.fallback-canvas{position:absolute;left:-25%;top:-25%;width:150%;height:150%;pointer-events:none;z-index:5;display:none}
.purchase-hotspot{position:absolute;left:50%;right:0;top:0;bottom:0;z-index:7;cursor:zoom-in;border-radius:0;background:transparent}
.purchase-hotspot[hidden]{display:none}
.purchase-hotspot:focus-visible{outline-offset:-8px}
.book.locked .corner-hint{display:none}
.corner-hint{position:absolute;right:0;bottom:0;width:40px;height:40px;overflow:hidden;pointer-events:none;z-index:6;opacity:0;transition:opacity .3s}
.corner-hint::after{content:"";position:absolute;width:56px;height:56px;left:15px;top:15px;transform:rotate(45deg);background:linear-gradient(135deg,#f7f4e7,#b9b5a7);box-shadow:-4px -4px 10px #0002}
.book:hover .corner-hint{opacity:.8}
.book.turning .corner-hint{opacity:0}
.side-arrow{position:absolute;top:50%;transform:translateY(-50%);width:30px;height:30px;border:1px solid var(--line);border-radius:50%;display:grid;place-items:center;background:var(--bg);transition:background .2s,transform .2s;z-index:7}
.side-arrow:hover:not(:disabled){background:var(--soft);transform:translateY(-50%) scale(1.06)}
.side-arrow.prev{left:6px}.side-arrow.next{right:6px}
.toolbar{display:flex;align-items:center;gap:3px;margin-left:auto;flex-shrink:0}
.tool{display:flex;align-items:center;gap:6px;border-radius:7px;height:34px;padding:0 8px;font-size:11px;white-space:nowrap}
.tool:hover,.tool[aria-pressed=true],.tool[aria-expanded=true]{background:var(--soft)}
.tool svg{width:17px;height:17px}
.divider{height:22px;width:1px;background:var(--line);margin:0 7px;flex-shrink:0}
.pager{display:flex;align-items:center;gap:4px}
.page-input{background:transparent;color:var(--ink);font:500 13px Georgia,serif;border:0;border-bottom:1px solid var(--line);width:28px;text-align:center;padding:5px 0;border-radius:0;-moz-appearance:textfield}
.page-input::-webkit-inner-spin-button,.page-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.page-total{font:12px Georgia,serif;color:var(--muted);padding:0 7px 0 2px}
.loading{position:absolute;inset:0;display:grid;place-content:center;background:var(--bg);z-index:20;text-align:center;gap:15px;font-size:12px;color:var(--muted)}
.loading[hidden]{display:none}
.spinner{margin:auto;width:25px;height:25px;border:2px solid var(--line);border-top-color:var(--green);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,10px);opacity:0;background:var(--ink);color:var(--bg);border-radius:10px;padding:11px 18px;font-size:12px;z-index:60;pointer-events:none;transition:opacity .2s,transform .2s;max-width:90vw;text-align:center}
.toast.visible{opacity:1;transform:translate(-50%,0)}
.drawer{position:fixed;inset:0;z-index:40}
.drawer[hidden],dialog:not([open]){display:none}
.scrim{position:absolute;inset:0;background:#172b2340;backdrop-filter:blur(4px)}
.drawer-panel{position:absolute;left:0;top:0;bottom:0;width:min(350px,88vw);background:var(--panel);padding:29px;overflow-y:auto;box-shadow:20px 0 60px #0001;animation:slide-in .25s ease-out}
@keyframes slide-in{from{transform:translateX(-100%)}}
.drawer-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.drawer-heading h2{font-family:"Songti SC",serif;font-size:24px;font-weight:500;letter-spacing:2px;margin:0}
.drawer-note{font-size:11px;color:var(--muted);line-height:1.9;margin-bottom:27px}
.chapter{width:100%;text-align:left;border-top:1px solid var(--line);padding:19px 0;display:flex;gap:15px;align-items:flex-start}
.chapter.active{color:#7a9768}
.chapter-num{font:italic 22px Georgia,serif;opacity:.6}
.chapter-title{font-size:13px;line-height:1.6}
.chapter-sub{display:block;color:var(--muted);font-size:9px;letter-spacing:.7px;margin-top:5px}
.thumb-panel{position:fixed;top:calc(var(--header-height) + 10px);right:20px;z-index:25;background:var(--panel);padding:17px 18px;border:1px solid var(--line);border-radius:15px;box-shadow:0 12px 45px #0002;width:min(720px,calc(100vw - 32px));max-height:calc(100dvh - var(--header-height) - 24px);overflow-y:auto}
.thumb-panel[hidden]{display:none}
.thumb-header{font-size:10px;letter-spacing:1px;display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;color:var(--muted)}
#closeThumbs{width:22px;height:22px}
#closeThumbs svg{width:14px;height:14px}
.thumbs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.thumb{padding:0;min-width:0;text-align:left}
.thumb-image{position:relative;display:block;width:100%;aspect-ratio:3000/2063;overflow:hidden;box-shadow:0 2px 5px #0001;border:2px solid transparent;border-radius:3px}
.thumb-image img{position:absolute;inset:0;width:100%;height:100%;max-width:none}
.thumb.active .thumb-image{border-color:#6f8c64;box-shadow:0 0 0 2px #6f8c6422}
.thumb span{display:block;font-size:9px;margin:8px 0 0;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
dialog{border:1px solid var(--line);background:var(--panel);color:var(--ink);border-radius:18px;padding:25px;width:min(1800px,96vw);max-height:94dvh;box-shadow:0 20px 90px #0004}
dialog::backdrop{background:#101f19bb;backdrop-filter:blur(7px)}
.zoom-header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:15px;font-size:12px}
.zoom-title{margin-right:auto}.zoom-buttons{display:flex;gap:5px;align-items:center}
#zoomViewport{max-height:calc(90dvh - 130px);overflow:auto;background:#d6d4cc;border-radius:4px;touch-action:pan-x pan-y}
#zoomImage{display:block;width:100%;max-width:none;transform-origin:top left}
.zoom-note{font-size:10px;color:var(--muted);margin:13px 0 0}
#purchaseDialog{max-width:460px;text-align:center}
#purchaseDialog .drawer-heading h2{font-family:inherit;font-size:21px;letter-spacing:0}
.purchase-qr{display:block;width:260px;max-width:78%;height:auto;margin:23px auto;padding:12px;background:white;border:1px solid var(--line);border-radius:8px}
.purchase-message{font-size:14px;line-height:1.95;text-align:left;color:var(--ink);margin:20px 4px 8px}
body.dark{color-scheme:dark;--bg:#1e2823;--ink:#e0e5d7;--muted:#9aa99b;--line:#3a493e;--panel:#28342c;--green:#52795a;--soft:#3b4e3e;--shadow:#0007}
.dark .book-wrap::before{box-shadow:0 22px 45px -8px #0007}
.dark .brand{padding:4px 7px;background:#fff;border-radius:5px}
.dark .brand-logo{mix-blend-mode:normal}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.single-page .reading-room{padding:10px 7px 18px;overflow:hidden;touch-action:none;overscroll-behavior:contain}
.single-page .book{touch-action:none}
.single-page .base-left{width:200%;left:var(--page-offset,0%);clip-path:none}
.single-page .base-right,.single-page .spine,.single-page .corner-hint{display:none}
.single-page .page-sheen{background:linear-gradient(90deg,#00000008,transparent 4%,transparent 96%,#00000006)}
.single-page .turn-shade{background:linear-gradient(90deg,#0004,transparent 60%)}
.single-page .purchase-hotspot{left:0;touch-action:none}
.single-page .thumbs{grid-template-columns:repeat(4,minmax(0,1fr))}
.single-page .thumb-image{aspect-ratio:1500/2063}
.single-page .thumb-image img{width:200%}
.single-page .page-input{font-size:16px}
.single-page .side-arrow{display:none}
.single-page .book-wrap{will-change:transform}
@media(max-width:1200px){.book-title{display:none}.pill{display:none}.topbar{gap:12px;padding:0 16px}.brand-logo{width:150px}}
@media(max-width:700px){:root{--header-height:92px}.topbar{display:grid;grid-template-columns:1fr auto;grid-template-rows:40px 44px;gap:0 10px;padding:4px 12px}.brand{grid-column:1;grid-row:1}.brand-logo{width:130px;max-height:32px}.top-actions{grid-column:2;grid-row:1;gap:5px}.pill{display:inline-block;font-size:9px;padding:6px 9px}.toolbar{grid-column:1/-1;grid-row:2;justify-content:center;margin-left:0;gap:2px}.tool{padding:0 6px;height:32px;gap:4px}.tool span{font-size:10px}.tool svg{width:16px;height:16px}.divider{margin:0 4px}.pager{gap:1px}.pager .icon-button{width:28px;height:30px}.page-input{width:27px}.page-total{padding:0 4px;font-size:11px}.reading-room{padding:8px 36px 16px}.thumb-panel{right:12px;width:calc(100vw - 24px);padding:14px}.thumbs{gap:7px}}
@media(max-width:480px){.topbar{padding:4px 10px}.toolbar{gap:1px}.tool{padding:0 5px}.divider{margin:0 3px}.pager{gap:0}.page-total{padding:0 3px}.reading-room{padding:8px 7px 16px}.side-arrow{top:auto;bottom:8px;transform:none;width:28px;height:28px}.side-arrow:hover:not(:disabled){transform:scale(1.05)}.side-arrow.prev{left:12px}.side-arrow.next{right:12px}dialog{padding:14px}.zoom-header{font-size:10px}}
@media(max-width:380px){.pill{display:none}.tool span{display:none}}
@media(max-height:650px) and (min-width:701px){:root{--header-height:48px}.topbar{padding:0 16px}.reading-room{padding:6px 42px 14px}.brand-logo{width:140px;max-height:30px}.tool{height:30px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
