* { box-sizing:border-box }
html,body { margin:0; height:100%; overflow:hidden }
body { height:100dvh; display:grid; grid-template-rows:auto minmax(0,1fr); font:14px/1.2 system-ui,sans-serif; color:#322522; background:#eae7e4 }
header,nav,form,.zoom { display:flex; align-items:center; flex-wrap:nowrap; gap:4px }
header { min-width:0; padding:4px 10px; gap:12px; background:white; border-bottom:2px solid #5c1810; overflow-x:auto; white-space:nowrap }
header > :not(h1) { flex:none }
.logo { width:clamp(60px,15vw,185px); height:44px; object-fit:contain }
h1 { font-size:1rem; flex:1; overflow:hidden; text-overflow:ellipsis; margin:0 }
header a,button,input { display:inline-grid; place-items:center; height:38px; min-width:36px; padding:0 4px; border:0; border-radius:4px; font:inherit; text-decoration:none }
header a,button { background:#5c1810; color:white; cursor:pointer; font-size:20px }
a[aria-disabled=true] { background:#ece6e4; color:#846f69; cursor:default }
#fit { width:49px; font-variant-numeric:tabular-nums; font-size:13px }
#page { width:4em; appearance:textfield; text-align:center; border:1px solid #b6aaa7 }
#page::-webkit-inner-spin-button { appearance:none }
:focus-visible { outline:2px solid #2468ad; outline-offset:-2px }
main { min-height:0; min-width:0; overflow:auto; overscroll-behavior:contain; overflow-anchor:none }
.paper { display:grid; grid-template: minmax(0,1fr) / minmax(0,1fr); place-items:center; width:var(--scale,100%); height:var(--scale,100%); margin-inline:auto }
.paper img { display:block; width:100%; height:100%; min-height:0; min-width:0; object-fit:contain }
main[data-zoom="50"] { --scale:50% } main[data-zoom="75"] { --scale:75% }
main[data-zoom="125"] { --scale:125% } main[data-zoom="150"] { --scale:150% }
main[data-zoom="200"] { --scale:200% } main[data-zoom="250"] { --scale:250% } main[data-zoom="300"] { --scale:300% }
#status:not(:empty) { position:fixed; bottom:.7em; left:50%; transform:translateX(-50%); background:#322522; color:white; padding:.5em .8em; border-radius:4px }
@media(max-width:650px) {
 header { gap:4px; padding:2px 3px } h1 { position:absolute; width:1px; height:1px; clip-path:inset(50%) }
 nav,form,.zoom { gap:2px } .logo { width:clamp(43px,calc(100vw - 277px),130px); height:36px }
 header a,button,input { min-width:26px; height:36px }
 #fit { width:38px; font-size:12px } #page { width:3em } form span { font-size:12px }
}

.overview { display:inline-flex; align-items:center; gap:4px; padding-inline:9px; font-size:14px }
@media(max-width:650px) {
 .overview { width:28px; padding:0; font-size:18px }
 .overview span { display:none }
 .logo { width:clamp(33px,calc(100vw - 300px),130px) }
}
