@import url("style/book-style.css");
:root { --page-ratio: .8; color: var(--ink); background: #fff; font-family: var(--book-serif); font-synthesis: none; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { overflow: hidden; background: #fff; }
button { color: inherit; font: inherit; }
.room { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; padding: 22px 24px 20px; }
.book-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; width: min(100%, 1100px); margin: auto; }
.book-header h1 { margin: 0; font: 400 16px/1.3 var(--book-serif); letter-spacing: -.01em; }
.book-header a, .book-header span { font: 400 10px/1.4 var(--book-sans); color: #6e7365; text-decoration: none; }
.book-header span:last-child { text-align: right; }
.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 16px 0; }
/* PageFlip derives leaf height from width. Reserve room for navigation. */
.book-rig { display: grid; place-items: center; width: min(100%, calc((100dvh - 140px) * var(--page-ratio) * 2), calc(640px * var(--page-ratio) * 2)); height: min(calc(100dvh - 140px), 640px); }
@media (max-width: 700px) { .room { padding: 8px 6px 6px; } .stage { padding: 6px 0; } .book-rig { width: min(100%, calc((100dvh - 88px) * var(--page-ratio) * 2)); height: min(calc(100dvh - 88px), 640px); } }
@media (max-height: 560px) { .room { padding: 6px 10px 4px; } .stage { padding: 2px 0; } .book-rig { width: min(100%, calc((100dvh - 66px) * var(--page-ratio) * 2)); height: min(calc(100dvh - 66px), 640px); } .book-header a, .book-header span { font-size: 10px; } .controls { width: min(100%, 300px); } .status small { display: none; } }
.book { position: relative; isolation: isolate; filter: drop-shadow(0 9px 12px rgb(29 37 21 / 15%)); transition: translate 760ms ease; }
.book[data-layout="landscape"][data-edge="front"] { translate: -25% 0; }
.book[data-layout="landscape"][data-edge="back"] { translate: 25% 0; }
.book-page { position: relative; overflow: hidden; background: var(--paper); }
.book-page.--left::before, .book-page.--right::before { position: absolute; inset-block: 0; z-index: 3; width: clamp(14px, 4%, 28px); content: ""; pointer-events: none; }
.book-page.--left::before { right: 0; background: linear-gradient(to left, rgb(28 30 24 / 12%), rgb(28 30 24 / 3%) 40%, transparent); }
.book-page.--right::before { left: 0; background: linear-gradient(to right, rgb(28 30 24 / 12%), rgb(28 30 24 / 3%) 40%, transparent); }
.controls { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 20px; width: min(100%, 280px); margin: auto; }
.controls button { border: 1px solid #dcdfd5; border-radius: 50%; width: 36px; height: 36px; padding: 0; background: #fff; font: 400 15px var(--book-sans); cursor: pointer; }
.controls button:disabled { opacity: .28; cursor: default; }
.status { display: grid; gap: 4px; text-align: center; }
.status span { font: 400 10px/1.4 var(--book-sans); letter-spacing: .04em; color: #666e5d; }
.status small { font: 400 9px/1.4 var(--book-sans); color: #969b8f; }
a:focus-visible, button:focus-visible { outline: 2px solid #6b735d; outline-offset: 4px; }
@media (max-width: 700px) { .room { padding: 16px 9px; } .book-header { grid-template-columns: 1fr auto; } .book-header h1 { font-size: 13px; } .book-header #orientation { display: inline; font-size: 10px; opacity: .75; } }
@media (prefers-reduced-motion: reduce) { .book { transition: none; } }
@media print { body { overflow: visible; } .book-header, .controls { display: none; } }

/* Neutral reading stage; artwork itself is unchanged. */
:root,body{background:#eeeae4}.room{background:#eeeae4}.controls{width:min(100%,390px)}.status small{font-size:10px}.book-header h1{font-family:"Source Serif 4","SimSun",serif;font-size:18px}.book-header a,.book-header span{font-family:Arial,"Microsoft YaHei",sans-serif;font-size:12px}.status{font-family:Arial,"Microsoft YaHei",sans-serif}@media(max-width:700px){.book-header h1{font-size:16px}.status small{font-size:9px}}
.generated-page{padding:0}.generated-artwork{display:block;width:100%;height:100%;object-fit:contain;max-width:100%;user-select:none}

:root,body,.room{background:#171717;color:#dedbd4}.book-header a,.book-header span,.status span{color:#b6b3ad}.controls button{background:#262626;border-color:#484848;color:#e5e1d8}.reading-tools{display:flex;gap:16px;align-items:center;justify-content:flex-end}.reading-tools button{background:none;border:0;color:#dedbd4;font-size:12px;padding:4px;cursor:pointer}.book{filter:drop-shadow(0 14px 20px #0008)}@media(max-width:700px){.book-header{grid-template-columns:auto 1fr}.book-header h1{display:none}.reading-tools{gap:10px}.book-header a{font-size:11px}}

/* 双击放大单页 */
.zoom-layer{position:fixed;inset:0;z-index:120;display:grid;place-items:center;background:#0b0b0b;padding:2vmin;cursor:zoom-out}
.zoom-layer[hidden]{display:none}
.zoom-figure{margin:0;display:grid;place-items:center;gap:10px;max-width:100%;max-height:100%}
.zoom-layer img{display:block;max-width:100%;max-height:calc(100dvh - 70px);width:auto;height:auto;object-fit:contain;box-shadow:0 24px 60px #000a}
.zoom-caption{font:400 11px/1.4 Arial,"Microsoft YaHei",sans-serif;color:#8b8880;letter-spacing:.04em}
body.zooming .room{filter:brightness(.4)}
@media (max-width: 700px){ .zoom-caption{font-size:10px} }
