:root { color-scheme: light; --paper: #fff; --ink: #202020; --line: #bcbcbc; --stage: #e7e7e7; --active: #075eb5; }
:root[data-theme="dark"] { color-scheme: dark; --paper: #202020; --ink: #f4f4f4; --line: #777; --stage: #121212; --active: #78baff; }
* { box-sizing: border-box; letter-spacing: 0; }
html, body { width: 100%; height: 100%; margin: 0; }
body { display: flex; flex-direction: column; font: 14px/1.4 system-ui, sans-serif; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select, a { font: inherit; color: inherit; }
button, select, input { border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
button, a, select { touch-action: manipulation; }
button, select { cursor: pointer; }
button { min-height: 44px; padding: 8px 12px; }
button:disabled, select:disabled, input:disabled { opacity: .45; cursor: default; }
button:not(:disabled):hover, a.icon:hover { background: var(--stage); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, #viewport:focus-visible { outline: 3px solid var(--active); outline-offset: -3px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.languages, .pagination, .tools { display: flex; align-items: center; gap: 4px; }
.languages { gap: 0; }
.languages button { border-radius: 0; min-width: 80px; }
.languages button:first-child { border-radius: 4px 0 0 4px; }
.languages button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.languages button[aria-pressed="true"] { color: var(--active); box-shadow: inset 0 -3px var(--active); font-weight: 650; }
.icon { width: 44px; height: 44px; padding: 10px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 0; border-radius: 4px; flex: 0 0 44px; }
.icon span { width: 22px; height: 22px; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.i-previous { --icon: url("icons/chevron-left.svg"); }
.i-next { --icon: url("icons/chevron-right.svg"); }
.i-fullscreen { --icon: url("icons/maximize.svg"); }
.i-open { --icon: url("icons/external-link.svg"); }
.i-download { --icon: url("icons/download.svg"); }
#page { width: 48px; height: 44px; padding: 4px; text-align: center; appearance: textfield; }
#page::-webkit-inner-spin-button, #page::-webkit-outer-spin-button { appearance: none; }
#total { min-width: 32px; white-space: nowrap; }
#zoom { width: 94px; height: 44px; padding: 4px; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; background: var(--stage); }
#viewport { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }
.pdfViewer .page { border: 0; margin: 0 auto; }
.pdfViewer .dummyPage { display: none; }
.statusbar { flex: 0 0 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 12px; border-top: 1px solid var(--line); gap: 8px; }
#status { font-size: 13px; }
#error { position: absolute; inset: 0; padding: 24px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; background: var(--stage); }
#error p { max-width: 50ch; margin: 0 0 12px; }
.no-script { position: absolute; inset: 120px 16px auto; padding: 16px; background: var(--paper); }
@media (max-width: 550px) {
    .languages { width: 100%; justify-content: center; }
    .toolbar { gap: 4px; }
    .pagination { gap: 0; }
    .tools { gap: 0; }
    #fullscreen { display: none; }
    #zoom { width: 82px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media (max-width: 350px) {
    .toolbar { padding-inline: 6px; }
    #page { width: 32px; }
    #total { min-width: 24px; }
    #zoom { width: 80px; }
}
