body:has(.pdf-viewer) { overflow: hidden; background: #191c1a; }
.pdf-viewer { position: fixed; inset: 0; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #191c1a; color: #f5f6f2; z-index: 10; }
.pdf-viewer-header { display: flex; align-items: center; gap: 20px; min-height: 72px; padding: max(10px, env(safe-area-inset-top)) 24px 10px; border-bottom: 1px solid #ffffff16; }
.pdf-control { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; color: inherit; background: transparent; font: 500 14px/1.3 var(--font-ui); text-decoration: none; cursor: pointer; transition: background .15s; }
.pdf-control:hover { background: #ffffff14; }
.pdf-control:focus-visible, .pdf-pages:focus-visible { outline: 2px solid #bcd6bc; outline-offset: -3px; }
.pdf-control:disabled { opacity: .3; cursor: default; }
.pdf-control[aria-pressed=true] { background: #ffffff20; }
.pdf-viewer-title { flex: 1; min-width: 0; }
.pdf-viewer-title h1 { font: 500 15px/1.5 var(--font-ui); max-width: none; margin: 0; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer-title span { font: 12px/1.6 var(--font-ui); color: #bec9bd; }
.pdf-reader { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; position: relative; }
.pdf-pages { overflow: auto; overscroll-behavior: contain; touch-action: pinch-zoom; scrollbar-color: #697269 transparent; outline: none; position: relative; display: grid; place-items: center; padding: 16px 64px; }
.pdf-sheet { margin: auto; background: #fff; box-shadow: 0 3px 18px #0003; }
.pdf-sheet canvas, .pdf-sheet img { display: block; width: 100%; height: 100%; }
.pdf-viewer-footer { padding: 4px 16px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid #ffffff16; }
.pdf-page-controls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pdf-page-position { min-width: 108px; text-align: center; font: 500 13px var(--font-ui); font-variant-numeric: tabular-nums; }
.pdf-zoom { margin-left: 16px; }
.pdf-loading { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 85%; margin: 0; border-radius: 6px; padding: 8px 12px; background: #191c1ae8; color: #c9d0c8; text-align: center; font: 12px/1.6 var(--font-ui); pointer-events: none; }
.pdf-no-script { position: absolute; top: 40%; padding: 24px; background: #191c1a; }
.pdf-document-nav { position: absolute; right: 8px; top: 40%; display: grid; gap: 12px; }
.pdf-document-nav .pdf-control { background: #ffffff0d; border-radius: 50%; }
.pdf-pages.is-zoomed { display: block; place-items: normal; touch-action: pinch-zoom; }
.pdf-pages.is-zoomed .pdf-sheet { margin: 0; }
.pdf-viewer [hidden] { display: none !important; }
@media (max-width: 600px) {
  .pdf-viewer-header { min-height: 62px; gap: 8px; padding-left: 8px; padding-right: 8px; }
  .pdf-viewer-title h1 { font-size: 13px; }
  .pdf-pages { padding: 8px; }
  .pdf-viewer-footer { min-height: 56px; box-sizing: border-box; padding-right: 92px; padding-left: 4px; padding-top: 4px; }
  .pdf-page-controls { gap: 0; }
  .pdf-page-position { min-width: 82px; }
  .pdf-document-nav { display: flex; top: auto; bottom: max(8px, env(safe-area-inset-bottom)); right: 4px; gap: 0; }
  .pdf-zoom { margin-left: 0; }
  .pdf-control { padding: 8px 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .pdf-control { transition: none; } }

.pdf-document-transition { position: fixed; overflow: hidden; pointer-events: none; background: #191c1a; z-index: 2; }
.pdf-document-transition > canvas, .pdf-document-transition > img { display: block; background: white; box-shadow: 0 3px 18px #0003; }

.pdf-pages.is-document-transitioning { overflow: hidden; }

.pdf-sheet[data-quality="placeholder"] { background: #252b27; box-shadow: none; }
.pdf-page-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #b9c5ba; font: 14px var(--font-ui); }
