:root {
  color-scheme: dark;
  --bg: #242424;
  --surface: #171717;
  --line: #363636;
  --text: #f4f1eb;
  --muted: #aaa69d;
  --accent: #e6ff43;
  --toolbar-h: 58px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.controls, .page-control, .zoom-control { display: flex; align-items: center; }
.controls { gap: 10px; }
.page-control, .zoom-control { height: 40px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.page-control > *, .zoom-control > * { border-radius: 0; }

.icon-button, .zoom-value {
  min-width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.page-control .icon-button, .zoom-control .icon-button, .zoom-value { border: 0; }
.icon-button:hover, .zoom-value:hover { background: #242424; }
.icon-button:focus-visible, .zoom-value:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.icon-button:disabled { opacity: .35; cursor: default; }

#page-number { width: 42px; height: 40px; border: 0; border-inline: 1px solid var(--line); background: #101010; color: var(--text); text-align: center; }
#page-count { min-width: 34px; padding-inline: 8px; color: var(--muted); font-size: 13px; }
.zoom-value { min-width: 66px; color: var(--muted); font-size: 12px; }

.viewer-shell { height: calc(100% - var(--toolbar-h)); }
.document-stage { position: relative; width: 100%; height: 100%; overflow: auto; display: grid; place-items: start center; padding: 22px; background: var(--bg); overscroll-behavior: contain; }
.page-container { position: relative; flex: none; box-shadow: 0 8px 32px #0008; }
#page-canvas { display: block; background: white; max-width: none; }

.annotation-layer { position: absolute; inset: 0; pointer-events: none; }
.annotation-hotspot { position: absolute; margin: 0; padding: 0; border: 0; background: transparent; color: transparent; cursor: pointer; pointer-events: auto; }
.annotation-hotspot:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.annotation-hotspot[href] { display: block; text-decoration: none; }
.annotation-rollover { display: block; width: 100%; height: 100%; object-fit: fill; opacity: 0; pointer-events: none; transition: opacity 80ms ease-out; }
.annotation-hotspot:is(:hover, :focus-visible, :active) .annotation-rollover { opacity: 1; }

.loading, .error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; }
.error { padding: 24px; text-align: center; }
.spinner { width: 18px; height: 18px; border: 2px solid #666; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 600px) {
  :root { --toolbar-h: 54px; }
  .toolbar { padding: 7px 10px; }
  .controls { width: 100%; justify-content: center; gap: 8px; }
  .document-stage { padding: 10px 6px 24px; }
}

@media (max-width: 420px) {
  .zoom-control { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.analytics-settings { position: fixed; bottom: 6px; left: 8px; z-index: 25; padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 11px; cursor: pointer; }
.analytics-consent { position: fixed; bottom: 38px; left: 12px; z-index: 30; width: min(440px, calc(100% - 24px)); max-height: calc(100% - 100px); overflow: auto; padding: 18px; border: 1px solid #666; border-radius: 8px; background: var(--surface); box-shadow: 0 5px 24px #0008; color: var(--text); font-size: 13px; line-height: 1.5; }
.analytics-consent p { margin: 10px 0; }
.analytics-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.analytics-actions button { padding: 8px 10px; border: 1px solid #666; border-radius: 5px; background: #242424; color: var(--text); cursor: pointer; }
.analytics-actions button:disabled { opacity: .45; cursor: default; }
.analytics-settings:focus-visible, .analytics-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The PDF provides its own navigation; use the entire browser viewport. */
body { height: 100dvh; }
.viewer-shell { height: 100%; }
