:root {
  color-scheme: light;
  --topbar-height: 68px;
  --footer-height: 70px;
  --sidebar-width: 270px;
  --accent: #704d2d;
  --accent-strong: #58391f;
  --canvas: #d9d0c3;
  --canvas-deep: #c8bdad;
  --panel: #f6f2eb;
  --panel-line: rgba(71, 51, 31, 0.14);
  --ink: #2f2922;
  --muted: #746b62;
  --page: #fffdf8;
  --page-alt: #faf5e9;
  --page-ink: #27231f;
  --shadow: rgba(54, 38, 24, 0.25);
  --focus: #2a66c9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="light"] {
  --accent: #4c5d73;
  --accent-strong: #344359;
  --canvas: #d9dde2;
  --canvas-deep: #c8cdd3;
  --panel: #f8f9fa;
  --panel-line: rgba(30, 40, 52, 0.14);
  --ink: #252b31;
  --muted: #69727b;
  --page: #ffffff;
  --page-alt: #f7f8fa;
  --page-ink: #20252a;
  color-scheme: light;
}

body[data-theme="dark"] {
  --accent: #b9926b;
  --accent-strong: #d1ad87;
  --canvas: #242322;
  --canvas-deep: #171716;
  --panel: #1d1c1b;
  --panel-line: rgba(255, 255, 255, 0.11);
  --ink: #eee8df;
  --muted: #aaa198;
  --page: #242320;
  --page-alt: #1f1e1c;
  --page-ink: #e9e2d8;
  --shadow: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.app { display: grid; grid-template-rows: var(--topbar-height) 1fr var(--footer-height); height: 100dvh; font-size: 16px; }
.topbar {
  position: relative; z-index: 20; display: grid;
  grid-template-columns: minmax(230px, var(--sidebar-width)) 1fr auto;
  align-items: center; gap: 20px; height: var(--topbar-height); padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--panel-line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; width: 54px; height: 40px; object-fit: contain; object-position: center; border: 0; border-radius: 0; box-shadow: none; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; }
.brand-byline { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .065em; text-transform: uppercase; }
.version-badge { display: inline-flex; align-items: center; padding: 2px 6px; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 999px; color: var(--muted); font: 600 9px/1.2 system-ui,sans-serif; letter-spacing: .03em; }
.document-heading { min-width: 0; text-align: center; }
.document-heading strong, .document-heading span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-heading strong { font-size: 14px; }
.document-heading span { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.button, .icon-button, .footer-nav, .edge-control { border: 0; cursor: pointer; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid var(--panel-line); border-radius: 9px; background: color-mix(in srgb, var(--panel) 90%, var(--ink) 10%); color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.button-primary { background: var(--accent); color: #fff; border-color: transparent; }
.button-large { min-height: 46px; padding: 0 20px; font-size: 14px; }
.button-small { min-height: 34px; padding: 0 12px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: transparent; color: var(--ink); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-button { display: none; }

.workspace { display: grid; grid-template-columns: var(--sidebar-width) minmax(0,1fr); min-height: 0; }
.sidebar { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--panel-line); scrollbar-width: thin; }
.panel-section { padding: 18px 20px; border-bottom: 1px solid var(--panel-line); }
.panel-section h2 { margin: 0 0 13px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.drop-zone { display: grid; justify-items: center; gap: 5px; padding: 21px 12px; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px; color: var(--muted); text-align: center; cursor: pointer; }
.drop-zone.is-dragging { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: var(--accent); }
.drop-zone svg { width: 27px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone strong { color: var(--ink); font-size: 13px; }
.drop-zone span { font-size: 11px; }
.field-label { display: block; margin: 13px 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.select, .number-input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--panel-line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.page-jump-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; }
.page-jump-row span { color: var(--muted); font-size: 12px; }
.range-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; }
.large-a { font-size: 20px; }
.field-note { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

.reader-area { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 28%, rgba(255,255,255,.22), transparent 35%), linear-gradient(145deg,var(--canvas),var(--canvas-deep)); }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.welcome-brand { display: grid; justify-items: center; gap: 8px; }
.welcome-logo { display: block; width: min(270px,58vw); max-height: 180px; object-fit: contain; border: 0; border-radius: 0; box-shadow: none; }
.welcome-brand strong { font-family: Georgia,"Times New Roman",serif; font-size: clamp(34px,5vw,58px); line-height: 1; color: var(--accent-strong); }
.welcome-byline { margin: 6px 0 0 !important; color: var(--accent) !important; font-family: Georgia,"Times New Roman",serif; font-size: 15px; font-style: italic; letter-spacing: .02em; }
.empty-state h1 { margin: 16px 0 8px; font-family: Georgia,"Times New Roman",serif; font-size: clamp(27px,4vw,42px); }
.empty-state p { max-width: 520px; margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
[data-theme="dark"] .welcome-logo, [data-theme="dark"] .brand-logo { mix-blend-mode: normal; opacity: .92; }

.reader { position: absolute; inset: 0; display: grid; grid-template-columns: 58px minmax(0,1fr) 58px; align-items: center; }
.edge-control { z-index: 8; display: grid; place-items: center; width: 42px; height: 76px; margin: auto; border-radius: 14px; background: color-mix(in srgb,var(--panel) 68%,transparent); color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,.11); backdrop-filter: blur(10px); opacity: .78; }
.edge-control:disabled { opacity: .2; cursor: default; }
.edge-control span { margin-top: -4px; font-family: Georgia,serif; font-size: 40px; font-weight: 300; }

.book-stage { position: relative; display: grid; place-items: center; width: min(1180px,calc(100% - 20px)); height: min(800px,calc(100% - 24px)); min-width: 220px; min-height: 220px; margin: auto; }
.book-shadow { position: absolute; left: 10%; right: 10%; bottom: 1%; height: 20px; border-radius: 50%; background: rgba(30,20,13,.10); filter: blur(13px); }
.book-shell { position: relative; display: grid; place-items: center; max-width: 100%; max-height: 100%; isolation: isolate; }
.flipbook { position: relative; max-width: 100%; max-height: 100%; }

/* StPageFlip's live HTML page elements are the reader. There is no separate
   snapshot or replacement layer in v9. */
.qr-page { position: relative; overflow: hidden; background: var(--page); color: var(--page-ink); border: 0 !important; outline: 0 !important; box-shadow: none !important; user-select: text; -webkit-user-select: text; }
/* A narrow graduated gutter replaces the former bright centre seam. */
.qr-page.--left { border-right-color: transparent; box-shadow: none; }
.qr-page.--right { border-left-color: transparent; box-shadow: none; }
.qr-page.--left::after,.qr-page.--right::before { content: ""; position: absolute; z-index: 10; top: 0; bottom: 0; width: 8px; pointer-events: none; }
.qr-page.--left::after { right: 0; background: linear-gradient(to left,rgba(39,29,20,.18),rgba(39,29,20,.065) 34%,rgba(39,29,20,0) 100%); }
.qr-page.--right::before { left: 0; background: linear-gradient(to right,rgba(39,29,20,.18),rgba(39,29,20,.065) 34%,rgba(39,29,20,0) 100%); }
.qr-page-number { position: absolute; z-index: 12; right: 18px; bottom: 10px; color: color-mix(in srgb,var(--page-ink) 45%,transparent); font: 10px/1 system-ui,sans-serif; pointer-events: none; }
.qr-page.--left .qr-page-number { right: auto; left: 18px; }
.qr-pdf-page { display: grid; place-items: center; background: #fff; }
.qr-pdf-surface { position: absolute; left: 50%; top: 50%; overflow: hidden; background: #fff; isolation: isolate; transform: translate(-50%,-50%) scale(var(--qr-page-fit-scale,1)); transform-origin: center center; }
.qr-pdf-canvas, .qr-pdf-svg { position: absolute; z-index: 1; inset: 0; display: block; width: 100% !important; height: 100% !important; background: #fff; pointer-events: none; user-select: none; -webkit-user-select: none; }
.qr-pdf-svg text { text-rendering: geometricPrecision; }
.qr-pdf-text-layer { position: absolute; z-index: 3; inset: 0; overflow: hidden; line-height: 1; pointer-events: auto; user-select: text; -webkit-user-select: text; text-size-adjust: none; -webkit-text-size-adjust: none; }
.qr-pdf-text-layer span { position: absolute; display: inline-block; margin: 0; padding: 0; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; line-height: 1; }
.qr-pdf-text-layer span::selection { color: transparent; background: rgba(48,112,205,.34); }
.qr-pdf-text-layer br { user-select: none; }
.qr-pdf-annotation-layer { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.qr-pdf-annotation-layer a { position: absolute; display: block; pointer-events: auto; border-radius: 2px; }
.qr-pdf-annotation-layer a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; background: rgba(42,102,201,.12); }
.qr-pdf-placeholder { display: grid; place-items: center; width: 100%; height: 100%; background: #fff; color: #8b837a; font: 12px/1.4 system-ui,sans-serif; }
.qr-pdf-page[data-render-state="rendering"] .qr-pdf-placeholder::after { content: "Preparing…"; display: block; margin-top: 6px; font-size: 10px; opacity: .7; }
.qr-pdf-page[data-pdf-renderer="svg"]::before { content: "SVG"; position: absolute; z-index: 11; left: 10px; bottom: 9px; padding: 2px 4px; border-radius: 3px; background: rgba(255,255,255,.72); color: rgba(30,30,30,.38); font: 8px/1 system-ui,sans-serif; pointer-events: none; }
.qr-pdf-page.--left[data-pdf-renderer="svg"]::before { left: auto; right: 10px; }
.qr-fixed-page iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* Paged.js page boxes are moved directly into StPageFlip. */
.qr-reflow-page { display: grid; place-items: center; padding: 0 !important; }
.qr-reflow-surface { position: absolute; left: 50%; top: 50%; overflow: hidden; background: var(--page); isolation: isolate; transform: translate(-50%,-50%) scale(var(--qr-page-fit-scale,1)); transform-origin: center center; }
.qr-reflow-surface > .pagedjs_page { position: relative !important; inset: auto !important; margin: 0 !important; width: 100% !important; height: 100% !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; transform: none !important; box-shadow: none !important; }
.qr-reflow-surface .pagedjs_sheet, .qr-reflow-surface .pagedjs_pagebox { width: 100% !important; height: 100% !important; box-shadow: none !important; }
.qr-reflow-surface .pagedjs_bleed, .qr-reflow-surface [class*="pagedjs_marks-"] { display: none !important; }
.qr-reflow-surface .pagedjs_area { overflow: hidden; }
.qr-reflow-page a { color: inherit; }
.qr-reflow-page img, .qr-reflow-page svg, .qr-reflow-page video { max-width: 100%; max-height: 100%; }

/* Transparent controls cover only a narrow outer strip, leaving nearby text
   selectable. Pointer-down plus movement begins a controllable live page curl. */
.page-turn-zone { position: absolute; z-index: 1000; width: clamp(30px,4.6%,48px); margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.page-turn-zone:active { cursor: grabbing; }
.page-turn-zone-left { left: 0; }
.page-turn-zone-right { right: 0; }
.page-turn-zone-top { top: 0; height: 22%; z-index: 1002; }
.page-turn-zone-side { top: 22%; bottom: 22%; z-index: 1001; }
.page-turn-zone-bottom { bottom: 0; height: 22%; z-index: 1002; }
.page-turn-zone:disabled { pointer-events: none; cursor: default; }



/* The visible side blocks are the actual page stacks: pages already passed on
   the left and pages remaining on the right. Total thickness is calculated from
   the book's page count, then divided between the two sides by reading progress. */
.page-stack-layer { position: absolute; z-index: 1250; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.page-stack-control { --stack-thickness: 0px; --stack-density: 0; --paper-spacing: 2.2px; --stack-phase: 0px; --stack-scrub-shift: 0px; position: absolute; top: 0; bottom: 0; width: min(var(--stack-thickness),52px); min-width: 0; max-width: 52px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; overflow: clip; clip-path: inset(0); contain: layout paint; isolation: isolate; transition: width 520ms cubic-bezier(.22,.72,.22,1); }
.page-stack-control:active,.page-stack-control.is-active { cursor: grabbing; }
.page-stack-control-left { right: 100%; left: auto; }
.page-stack-control-right { left: 100%; right: auto; }
.page-stack-control:disabled { opacity: 0; pointer-events: none; }
.page-stack-edge { position: absolute; top: 0; bottom: 0; width: 100%; min-width: 0; overflow: hidden; border: 0; background-color: color-mix(in srgb,var(--page) 97%,#9f9487 3%); background-image: repeating-linear-gradient(to right,rgba(78,61,44,.10) 0 1px,rgba(255,255,255,.10) 1px 2px); background-position: 0 0; background-size: 2px 100%; box-shadow: inset 0 0 1px rgba(62,45,29,.08),0 3px 8px rgba(35,24,14,.13); opacity: .99; pointer-events: none; transition: filter 140ms ease; }
.page-stack-edge::before { content: none; }
.page-stack-motion { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to right,transparent 0 1px,rgba(72,53,35,.16) 1px 2px); background-position-x: var(--stack-scrub-shift); background-size: 2px 100%; opacity: 0; transition: opacity 90ms ease,background-position 45ms linear; }
.page-stack-control-left .page-stack-edge { right: 0; border: 0; box-shadow: inset 1px 0 rgba(64,46,29,.12),0 3px 8px rgba(35,24,14,.13); border-radius: 1px 0 0 1px; }
.page-stack-control-right .page-stack-edge { left: 0; border: 0; box-shadow: inset -1px 0 rgba(64,46,29,.12),0 3px 8px rgba(35,24,14,.13); border-radius: 0 1px 1px 0; }
.page-stack-control:hover .page-stack-edge,.page-stack-control:focus-visible .page-stack-edge,.page-stack-control.is-active .page-stack-edge { filter: brightness(1.018) contrast(1.025); }
.page-stack-control.is-active .page-stack-motion,.page-stack-control.is-jumping .page-stack-motion { opacity: .9; }
.page-stack-control:focus-visible { outline: none; }
.page-stack-control:focus-visible .page-stack-edge { outline: 2px solid var(--focus); outline-offset: 2px; }
.page-stack-tooltip { position: absolute; z-index: 1510; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid color-mix(in srgb,var(--page-ink) 22%,transparent); border-radius: 7px; background: color-mix(in srgb,var(--panel) 94%,transparent); color: var(--ink); box-shadow: 0 7px 18px rgba(31,22,14,.18); font: 650 13px/1 system-ui,sans-serif; opacity: 0; pointer-events: none; transform: translateY(-50%) scale(.92); transition: opacity 90ms ease,transform 90ms ease; backdrop-filter: blur(7px); }
.page-stack-tooltip[data-direction="left"] { transform: translate(-100%,-50%) scale(.92); }
.page-stack-tooltip.is-visible { opacity: 1; transform: translateY(-50%) scale(1); }
.page-stack-tooltip[data-direction="left"].is-visible { transform: translate(-100%,-50%) scale(1); }
.book-shell.is-edge-dragging .page-stack-layer,.book-shell.is-page-jumping .page-stack-layer { pointer-events: none; }

.book-shell.is-page-jumping .qr-pdf-text-layer,.book-shell.is-page-jumping .qr-reflow-page { pointer-events: none; user-select: none; -webkit-user-select: none; }

.stf__parent, .stf__wrapper, .stf__block { overflow: visible !important; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { filter: none !important; }
.stf__parent,.stf__wrapper,.stf__block,.stf__item { border: 0 !important; outline: 0 !important; }
.stf__item { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }

.reader-footer { position: relative; z-index: 20; display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 0; background: var(--panel); border-top: 1px solid var(--panel-line); }
.footer-spacer { border-right: 1px solid var(--panel-line); }
.progress-group { display: grid; grid-template-columns: 42px minmax(0,760px) 42px; align-items: center; justify-content: center; gap: 12px; padding: 9px 28px; }
.footer-nav { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: transparent; color: var(--ink); font-family: Georgia,serif; font-size: 30px; }
.footer-nav:disabled { opacity: .25; cursor: default; }
.progress-group > .footer-nav:first-child { grid-column: 1; grid-row: 1; }
.progress-group > input { grid-column: 2; grid-row: 1; }
.progress-group > .footer-nav:last-of-type { grid-column: 3; grid-row: 1; }
.progress-labels { grid-column: 2; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.pagination-lab { position: fixed; z-index: -100; left: -30000px; top: 0; width: 1000px; min-height: 1000px; opacity: 0; pointer-events: none; overflow: visible; }
.toast { position: fixed; z-index: 50; left: calc(var(--sidebar-width) + (100% - var(--sidebar-width))/2); bottom: calc(var(--footer-height) + 18px); max-width: min(420px,calc(100vw - 40px)); padding: 10px 14px; border-radius: 9px; background: #20201e; color: #fff; font-size: 12px; box-shadow: 0 9px 24px rgba(0,0,0,.25); transform: translate(-50%,16px); opacity: 0; pointer-events: none; transition: opacity 180ms ease,transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }
.loading-overlay { position: fixed; z-index: 60; inset: 0; display: grid; place-content: center; justify-items: center; gap: 13px; background: color-mix(in srgb,var(--canvas-deep) 76%,transparent); backdrop-filter: blur(7px); }
.spinner { width: 36px; height: 36px; border: 3px solid color-mix(in srgb,var(--accent) 24%,transparent); border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; }
.loading-overlay strong { max-width: min(560px,80vw); padding: 8px 12px; border-radius: 8px; background: var(--panel); box-shadow: 0 5px 18px rgba(0,0,0,.15); text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }


/* A temporary visual cover keeps the reader canvas visible while fullscreen
   geometry settles and StPageFlip rebuilds. The snapshot is non-interactive
   and is removed only after the replacement spread has painted. */
.viewport-transition-cover { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 28%,rgba(255,255,255,.22),transparent 35%),linear-gradient(145deg,var(--canvas),var(--canvas-deep)); pointer-events: all; }
.viewport-transition-snapshot { position: relative; flex: none; transform-origin: center center; pointer-events: none; }
.viewport-transition-snapshot .book-shell { max-width: none; max-height: none; }
.viewport-transition-snapshot .page-turn-zone { display: none !important; }

/* Full screen keeps the physical left/right navigation bars beside the book,
   while hiding the top bar, settings panel and footer. */
.app:fullscreen, .app:-webkit-full-screen { display: block; width: 100vw; height: 100vh; background: var(--canvas); }
.app:fullscreen .topbar, .app:fullscreen .sidebar, .app:fullscreen .reader-footer,
.app:fullscreen .empty-state, .app:fullscreen .toast,
.app:-webkit-full-screen .topbar, .app:-webkit-full-screen .sidebar, .app:-webkit-full-screen .reader-footer,
.app:-webkit-full-screen .empty-state, .app:-webkit-full-screen .toast { display: none !important; }
.app:fullscreen .workspace, .app:-webkit-full-screen .workspace { display: block; width: 100%; height: 100%; }
.app:fullscreen .reader-area, .app:-webkit-full-screen .reader-area { position: absolute; inset: 0; width: 100%; height: 100%; }
.app:fullscreen .reader, .app:-webkit-full-screen .reader { display: grid; grid-template-columns: 64px minmax(0,1fr) 64px; inset: 0; }
.app:fullscreen .edge-control, .app:-webkit-full-screen .edge-control { display: grid !important; width: 44px; height: 104px; margin: auto; opacity: .72; }
.app:fullscreen .book-stage, .app:-webkit-full-screen .book-stage { width: 100%; height: 100vh; max-width: none; max-height: none; min-width: 0; min-height: 0; margin: 0; }
.app:fullscreen .book-shadow, .app:-webkit-full-screen .book-shadow { bottom: 0; }

@media (max-width: 900px) {
  :root { --sidebar-width: 220px; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .brand-byline { display: none; }
  .top-actions .button { width: 38px; padding: 0; font-size: 0; }
  .top-actions .button span { font-size: 20px; }
  .reader { grid-template-columns: 44px minmax(0,1fr) 44px; }
  .edge-control { width: 36px; }
}
@media (max-width: 720px) {
  :root { --footer-height: 64px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .sidebar-button { display: grid; }
  .brand-copy, .version-badge { display: none; }
  .document-heading { text-align: left; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; top: var(--topbar-height); bottom: var(--footer-height); left: 0; width: min(290px,88vw); transform: translateX(-102%); box-shadow: 12px 0 28px rgba(0,0,0,.2); transition: transform 200ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .reader { grid-template-columns: 0 minmax(0,1fr) 0; }
  .edge-control { position: absolute; z-index: 15; top: 50%; width: 39px; height: 68px; transform: translateY(-50%); }
  .edge-control-left { left: 5px; }
  .edge-control-right { right: 5px; }
  .reader-footer { grid-template-columns: 1fr; }
  .footer-spacer { display: none; }
  .progress-group { grid-column: 1; grid-template-columns: 38px minmax(0,1fr) 38px; padding-inline: 10px; }
  .toast { left: 50%; }
  .welcome-logo { max-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Physical book boundary and correctly layered gutter. */
:root { --book-border: rgba(137, 143, 150, .42); }
body[data-theme="dark"] { --book-border: rgba(190, 195, 201, .30); }

/* A restrained light-grey outline around the whole open book. It is an inset
   shadow on the spread block, so it never creates a white centre seam. */
.stf__block { box-shadow: inset 0 0 0 1px var(--book-border) !important; }

/* Permanent, narrow gutter shading. It sits above stationary pages but below
   the destination and actively turning sheets (StPageFlip uses z-index 3 for
   resting pages, 5 for the revealed page and 7 for the moving page). */
.stf__block::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 15px;
  transform: translateX(-50%);
  background: linear-gradient(to right,
    transparent 0%,
    rgba(36, 39, 42, .035) 18%,
    rgba(36, 39, 42, .16) 49%,
    rgba(36, 39, 42, .16) 51%,
    rgba(36, 39, 42, .035) 82%,
    transparent 100%);
  pointer-events: none;
}
body[data-theme="dark"] .stf__block::before {
  background: linear-gradient(to right,
    transparent 0%,
    rgba(0, 0, 0, .08) 20%,
    rgba(0, 0, 0, .34) 49%,
    rgba(0, 0, 0, .34) 51%,
    rgba(0, 0, 0, .08) 80%,
    transparent 100%);
}

/* Multi-page jumps now use StPageFlip directly, so no overlay gutter is needed. */

/* FlipReader v9.1.33: keep the animation thread light while a sheet is moving. */
.book-shell.is-page-turning .qr-pdf-text-layer,
.book-shell.is-page-turning .qr-pdf-annotation-layer {
  visibility: hidden !important;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}
.book-shell.is-page-turning .stf__item,
.book-shell.is-page-turning .qr-pdf-canvas,
.book-shell.is-page-turning .qr-pdf-svg,
.book-shell.is-page-turning .qr-reflow-surface {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, clip-path;
}
.book-shell.is-page-turning .page-stack-control {
  transition: none !important;
}
