:root{font:16px/1.45 system-ui,sans-serif;color:#2d171c;background:#f8f3f3;--red:#a5162b;--border:#ead9dd;--ink:#2d171c}
*{box-sizing:border-box}body{margin:0}
[hidden]{display:none!important}
a{color:inherit}
button,input,select{font:inherit}
button,input,select,nav a{min-height:40px;border:1px solid var(--border);border-radius:8px;background:#fff;color:var(--ink);padding:6px 9px}
button{font-weight:650;cursor:pointer}button:disabled{opacity:.42;cursor:default}
button[aria-pressed=true]{background:#fae7eb;border-color:#e3adba;color:#8b1224}
:focus-visible{outline:3px solid #d23e52;outline-offset:2px}
.masthead{height:62px;padding:0 clamp(12px,3vw,36px);display:flex;align-items:center;justify-content:space-between;gap:10px;background:#fff;border-bottom:1px solid var(--border)}
.brand{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--red);font-weight:850;font-size:1.02rem;line-height:1.1;white-space:nowrap}
.brand small{display:block;margin-top:4px;color:var(--ink);font-size:.72rem;font-weight:600}
nav,.pager,.view-controls{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
nav a{font-size:.84rem;display:inline-flex;align-items:center;text-decoration:none;font-weight:700;white-space:nowrap}
nav .cta{background:var(--red);border-color:var(--red);color:white}
.workspace{height:calc(100vh - 62px);height:calc(100dvh - 62px);display:grid;grid-template-columns:222px minmax(0,1fr);min-height:375px}
.library{background:white;border-right:1px solid var(--border);padding:14px 12px;overflow:auto}
.library h2{font-size:.94rem;margin:0 0 10px}
.covers{display:grid;gap:7px}
.cover{display:grid;grid-template-columns:40px minmax(0,1fr);align-items:center;gap:8px;text-align:left;padding:5px 7px;width:100%;font-size:.79rem;overflow-wrap:anywhere}
.cover img{height:53px;width:40px;object-fit:contain;background:#f4edef;border-radius:3px}
.cover small{display:block;color:#71565e;font-size:.7rem;margin-top:2px}
.reader{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;min-width:0;min-height:0;background:#f8f3f3}
.reader:fullscreen{height:100vh;height:100dvh;width:100%;background:#f8f3f3}
.reader-heading{padding:8px clamp(10px,2vw,24px);display:flex;justify-content:space-between;align-items:center;gap:10px}
.reader-heading h1{font-size:clamp(1.08rem,2vw,1.55rem);line-height:1.15;margin:0}
.reader-heading p{font-size:.79rem;color:#725660;margin:3px 0 0}
.document-select{display:none}
.toolbar{display:flex;justify-content:space-between;gap:6px;flex-wrap:wrap;padding:0 clamp(10px,2vw,24px) 7px}
.toolbar button,.toolbar input{min-height:35px;font-size:.8rem}
.toolbar input{width:59px;text-align:center}
.toolbar .arrow{font-size:1.3rem;line-height:1;min-width:38px}
#total{font-size:.8rem;min-width:45px}
.stage{min-height:0;min-width:0;overflow:auto;background:radial-gradient(ellipse at 50% 45%,#4b323c,#241b23);overscroll-behavior:contain;touch-action:pan-y}
.leaves{height:100%;min-width:0;min-height:0;display:flex;justify-content:center;align-items:center;gap:12px;padding:10px 14px}
.leaves figure{height:100%;min-width:0;max-width:48%;margin:0;display:flex;justify-content:center;align-items:center}
.leaves:not(.spread) figure{max-width:100%}
.leaves img{width:auto;height:auto;max-width:100%;max-height:100%;display:block;box-shadow:0 7px 25px #13090e88;background:#fff;border-radius:2px}
.stage.is-zoom{touch-action:auto}
.stage.is-zoom .leaves{height:auto;width:max-content;min-width:100%;min-height:100%;align-items:flex-start;justify-content:center}
.stage.is-zoom figure{height:auto;max-width:none}
.stage.is-zoom img{width:min(1080px,185vw);height:auto;max-width:none;max-height:none}
.reader-footer{display:flex;align-items:center;justify-content:center;gap:12px;min-height:40px;background:#fff;border-top:1px solid var(--border);color:#51333c;padding:5px 10px;font-size:.83rem;text-align:center;flex-wrap:wrap}
.reader-footer a{color:#921426;text-underline-offset:3px;font-weight:650;white-space:nowrap}
.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:840px){.workspace{grid-template-columns:minmax(0,1fr)}.library{display:none}.document-select{display:flex;max-width:53%}.document-select select{width:100%;font-size:.8rem}}
@media(max-width:620px){.masthead{height:54px}.workspace{height:calc(100vh - 54px);height:calc(100dvh - 54px)}.reader-heading{padding:6px 8px}.toolbar{padding:0 8px 6px}.leaves{padding:6px}.reader-footer{font-size:.77rem;gap:8px}.reader-footer span{display:none}.masthead nav a:first-child{display:none}.document-select select{min-height:33px}.toolbar button,.toolbar input{min-height:34px}}
@media(max-height:540px) and (min-width:621px){.reader-heading p{display:none}.masthead{height:44px}.workspace{height:calc(100dvh - 44px)}.reader-footer{min-height:30px}}


.footer-pager{display:flex;gap:5px}
.footer-pager button{min-height:36px;padding:3px 9px}
#footer-next{background:var(--red);color:white;border-color:var(--red)}
@media(max-width:350px){.masthead nav .cta,.reader-footer>a:last-child{display:none}}

.workspace{height:100vh;height:100dvh;min-height:0;grid-template-columns:minmax(0,1fr)}
.reader{grid-template-rows:auto minmax(0,1fr) auto}
.reader-chrome{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:3px 12px;padding:5px 12px;border-bottom:1px solid var(--border)}
.reader-heading{padding:0;flex:1 1 370px}
.reader-heading h1{font-size:clamp(.95rem,1.4vw,1.2rem)}
.reader-heading p{display:block;font-size:.72rem;margin:0}
.document-select{display:block;max-width:50%;flex:0 1 230px}
.document-select select{width:100%;font-size:.78rem;min-height:32px;padding:3px 5px}
.toolbar{padding:0;gap:4px 8px}
.toolbar button,.toolbar input{min-height:32px;padding-block:3px}
.leaves{padding:4px 8px;gap:8px}
@media(max-width:620px){.reader-chrome{padding:4px 6px}.toolbar{gap:3px 6px}}

.library .brand{margin-bottom:14px}
.library-links{margin-top:12px}
@media(min-width:841px){
  .workspace{grid-template-columns:200px minmax(0,1fr)}
  .document-select{display:none}
}
.reader-chrome{padding-block:2px}
.reader-heading{flex-basis:245px}
.reader-heading h1{font-size:.97rem}
.reader-heading p{line-height:1.15}
.toolbar button,.toolbar input{min-height:30px}
@media(min-width:1120px){.reader-chrome{flex-wrap:nowrap}.toolbar{flex-wrap:nowrap}.view-controls{flex-wrap:nowrap}}

