
:root {
  color-scheme: dark;
  --ink: #f4f6f2;
  --muted: #a4b8bc;
  --quiet: #799196;
  --accent: #ffb088;
  --mint: #b5ddcb;
  --line: rgba(210, 231, 232, .14);
  --surface: #17343c;
  --deep: #0b2028;
  --control: #1a3840;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: var(--deep); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .3; }
button:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button, a { -webkit-user-select: none; user-select: none; }
svg.icon { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.app { height: 100vh; height: 100dvh; width: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; overflow: hidden; background: radial-gradient(ellipse at 52% 40%, #22434a 0, #102b33 50%, #0b2028 100%); padding-top: env(safe-area-inset-top, 0px); }
.app:fullscreen { width: 100vw; height: 100vh; }
.masthead { min-height: 79px; padding: 13px 28px 11px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(8, 25, 33, .42); }
.brand { display: flex; align-items: center; min-width: 0; gap: 13px; }
.brand-mark { width: 44px; height: 48px; border: 1px solid rgba(255, 176, 136, .55); border-radius: 13px 13px 13px 4px; display: grid; place-items: center; color: var(--accent); background: rgba(255, 176, 136, .07); flex: 0 0 auto; }
.brand-mark .icon { width: 25px; height: 25px; }
.eyebrow { margin: 0 0 4px; font-size: 9px; font-weight: 700; letter-spacing: .19em; color: var(--mint); text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(19px, 2vw, 25px); font-weight: 750; line-height: 1.12; letter-spacing: -.035em; }
.header-tools { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.tool { min-height: 43px; min-width: 43px; padding: 10px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; background: transparent; border: 1px solid var(--line); font-size: 12px; font-weight: 620; }
.tool:hover:not(:disabled) { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .24); }
.tool[aria-pressed='true'] { background: var(--mint); color: #102e33; border-color: var(--mint); }
.icon-only { padding: 10px; }
.chapterline { min-height: 34px; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 5px 30px; font-size: 11px; color: var(--muted); letter-spacing: .015em; }
.chapterline .unit { color: var(--accent); text-transform: uppercase; font-size: 9px; font-weight: 750; letter-spacing: .14em; white-space: nowrap; }
.chapter-name { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; text-align: right; }
.stage-shell { min-width: 0; min-height: 0; position: relative; isolation: isolate; }
.viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; overscroll-behavior: none; outline-offset: -4px !important; perspective: 1800px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.viewport.is-zoomed { cursor: grab; }
.viewport.is-dragging { cursor: grabbing; }
.surface { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; overflow: hidden; background: #fff; border-radius: 2px; box-shadow: 0 3px 0 rgba(245, 240, 228, .85), 0 6px 0 -1px rgba(220, 218, 206, .6), 0 18px 30px rgba(0, 0, 0, .38), 0 1px 80px rgba(0, 0, 0, .15); }
.surface[data-mode='panel'] { border-radius: 3px; box-shadow: 0 14px 38px rgba(0, 0, 0, .32), 0 0 0 2px rgba(255,255,255,.08); }
.leaf { position: absolute; overflow: hidden; background: #fff; }
.leaf img { display: block; position: absolute; max-width: none; pointer-events: none; -webkit-user-drag: none; image-rendering: auto; }
.leaf.spread-left::after, .leaf.spread-right::after { content: ''; position: absolute; top: 0; bottom: 0; width: 14px; pointer-events: none; }
.leaf.spread-left::after { right: 0; background: linear-gradient(90deg, transparent, rgba(34,30,21,.18)); }
.leaf.spread-right::after { left: 0; background: linear-gradient(90deg, rgba(34,30,21,.13), transparent); }
.turn-layer { position: absolute; pointer-events: none; z-index: 3; transform-style: preserve-3d; backface-visibility: hidden; will-change: transform, opacity; }
.turn-layer .surface { top: 0; left: 0; }
.stage-arrow { position: absolute; z-index: 5; top: 50%; transform: translateY(-50%); width: 44px; height: 60px; border: 1px solid rgba(209,230,230,.16); background: rgba(9,30,38,.52); border-radius: 14px; display: grid; place-items: center; backdrop-filter: blur(5px); }
.stage-arrow.left { left: 14px; }
.stage-arrow.right { right: 14px; }
.stage-arrow .icon { width: 25px; height: 25px; }
.stage-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: #17363f; }
.loading-box, .error-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; border: 1px solid var(--line); background: rgba(9,29,37,.95); border-radius: 18px; padding: 24px 28px; box-shadow: 0 16px 50px rgba(0,0,0,.22); text-align: center; font-size: 13px; }
.loading-box { display: flex; align-items: center; gap: 12px; }
.spinner { display: block; width: 22px; height: 22px; border: 2px solid rgba(255,255,255,.14); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { width: min(360px, 87%); line-height: 1.65; }
.error-box h2 { font-size: 19px; line-height: 1.3; margin: 0 0 12px; }
.error-box p { color: var(--muted); margin: 0 0 18px; }
.dock { padding: 9px 18px 0; position: relative; z-index: 7; }
.controlbar { width: fit-content; max-width: 100%; margin: 0 auto; padding: 6px 8px; display: flex; align-items: center; justify-content: center; gap: 11px; border: 1px solid rgba(211,229,229,.18); border-radius: 17px; background: #132f38; box-shadow: 0 7px 24px rgba(0, 0, 0, .17); }
.navigation { display: flex; align-items: center; gap: 7px; min-width: 254px; }
.nav-btn { width: 43px; height: 44px; display: grid; place-items: center; border-radius: 11px; background: var(--control); border: 1px solid var(--line); }
.nav-btn:hover:not(:disabled) { color: var(--accent); border-color: rgba(255,176,136,.65); }
.nav-btn.next { background: var(--accent); color: #14313a; border-color: var(--accent); }
.nav-btn.next:hover:not(:disabled) { background: #ffc7aa; color: #102c32; }
.counter { width: 149px; min-height: 44px; padding: 3px 5px; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; gap: 4px; align-items: center; background: transparent; }
.counter:hover { background: rgba(255,255,255,.05); }
.counter-main { font-size: 13px; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.counter-sub { color: var(--muted); font-size: 10px; font-weight: 450; line-height: 1; }
.zoom-controls { display: flex; align-items: center; gap: 3px; }
.zoom-controls button { width: 40px; height: 44px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; }
.zoom-controls button:hover:not(:disabled) { background: var(--control); border-color: var(--line); }
.zoom-value { min-width: 52px; font-size: 12px; font-weight: 650; text-align: center; color: var(--mint); font-variant-numeric: tabular-nums; }
.separator { width: 1px; height: 27px; background: var(--line); }
.mode-controls { display: flex; align-items: center; gap: 7px; }
.mode-btn { height: 44px; padding: 9px 11px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--control); border-radius: 10px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.mode-btn:hover { border-color: var(--mint); }
.mode-btn[aria-pressed='true'] { background: var(--mint); color: #15333a; border-color: var(--mint); }
.mode-btn .icon { width: 18px; height: 18px; }
.gesture-hint { margin: 7px 0 0; min-height: 13px; color: #93afb5; font-size: 10px; line-height: 1.3; letter-spacing: .01em; text-align: center; }
.read-progress { display: flex; gap: 4px; height: 3px; width: min(274px, 60%); margin: 9px auto 0; }
.read-progress span { height: 3px; background: #335159; flex: 1; border-radius: 5px; transition: background .2s; }
.read-progress span.read { background: #87b4a5; }
.read-progress span.active { background: var(--accent); }
.attribution { margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 9px; letter-spacing: .015em; color: #819ca3; line-height: 1.4; }
.attribution strong { font-weight: 600; color: #a0b5b9; }
dialog { color: var(--ink); background: #122e37; border: 1px solid #3b535a; border-radius: 22px; box-shadow: 0 20px 100px rgba(0,0,0,.55); padding: 0; width: min(890px, calc(100% - 36px)); max-height: min(880px, 90vh); max-height: min(880px, 90dvh); overflow: hidden; }
dialog::backdrop { background: rgba(2,13,19,.78); backdrop-filter: blur(6px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 24px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 23px; line-height: 1.2; letter-spacing: -.035em; }
.dialog-head p { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.dialog-head .tool { flex: 0 0 auto; }
.dialog-content { padding: 20px 24px 24px; overflow-y: auto; max-height: calc(90dvh - 100px); overscroll-behavior: contain; scrollbar-color: #607b80 #122e37; touch-action: pan-y; }
.thumbnails { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.thumbnail { padding: 7px; text-align: left; color: var(--ink); background: #1b3740; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.thumbnail:hover { background: #25444c; border-color: var(--mint); }
.thumbnail.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,176,136,.25); }
.thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 1055 / 1491; object-fit: contain; border-radius: 5px; background: #fdfdfc; }
.thumbnail-label { display: flex; gap: 8px; align-items: baseline; padding: 1px 2px 3px; line-height: 1.3; }
.thumbnail-label b { color: var(--accent); font-size: 11px; font-variant-numeric: tabular-nums; }
.thumbnail-label span { font-size: 11px; font-weight: 600; }
.panel-thumbnails { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel-preview { width: 100%; background-repeat: no-repeat; background-color: #fff; border-radius: 4px; }
.panel-thumbnails .thumbnail-label { justify-content: space-between; }
.help-dialog { width: min(605px, calc(100% - 36px)); }
.help-block { display: grid; grid-template-columns: 42px 1fr; align-items: start; gap: 13px; padding: 0 0 20px; }
.help-block .help-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: #24414a; color: var(--accent); }
.help-block h3 { font-size: 15px; margin: 1px 0 6px; }
.help-block p { font-size: 13px; line-height: 1.65; margin: 0; color: #b9c9cc; }
.keyboard-help { padding: 16px 17px; background: #0e252e; border-radius: 12px; font-size: 12px; color: #bfd0d1; line-height: 2.35; }
kbd { display: inline-block; min-width: 23px; line-height: 1.6; text-align: center; border: 1px solid #5f777d; border-radius: 4px; padding: 0 5px; font: 11px ui-monospace, monospace; color: var(--ink); }
.help-note { font-size: 11px; color: #95adb3; margin: 15px 0 0; line-height: 1.65; }
.toast { position: absolute; z-index: 10; bottom: 135px; left: 50%; transform: translateX(-50%); max-width: min(390px, 90%); padding: 10px 15px; background: #f4ecda; color: #19353b; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.25); text-align: center; font-size: 12px; line-height: 1.5; pointer-events: none; }
.immersive .masthead { min-height: 49px; padding-top: 6px; padding-bottom: 6px; }
.immersive .brand-mark, .immersive .eyebrow, .immersive .attribution { display: none; }
.immersive h1 { font-size: 18px; }
.immersive .chapterline { min-height: 27px; }
.immersive .dock { padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px)); }
.no-script { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; padding: 30px; background: #102a33; text-align: center; font-size: 18px; line-height: 1.6; }
@media (max-width: 1050px) {
  .masthead { padding-left: 20px; padding-right: 20px; }
  .chapterline { padding-left: 22px; padding-right: 22px; }
  .controlbar { gap: 8px; }
  .navigation { min-width: 230px; gap: 4px; }
  .counter { width: 134px; }
  .mode-btn { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 900px) {
  .stage-arrow { display: none; }
  .header-tools .optional-label { display: none; }
  .header-tools .tool { padding: 10px; }
  .controlbar { flex-wrap: wrap; max-width: 660px; }
  .navigation { min-width: 242px; }
  .counter { width: 146px; }
  .thumbnails { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mode-btn.spread-button { display: none; }
}
@media (max-width: 620px) {
  .masthead { min-height: 69px; padding: 10px 14px 9px; gap: 12px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 40px; border-radius: 10px 10px 10px 3px; }
  .brand-mark .icon { width: 20px; height: 20px; }
  h1 { font-size: 20px; }
  .eyebrow { font-size: 8px; letter-spacing: .13em; }
  .header-tools { gap: 5px; }
  .header-tools .tool { min-height: 40px; min-width: 40px; padding: 9px; border-radius: 10px; }
  .header-tools .icon { width: 19px; height: 19px; }
  .chapterline { min-height: 29px; padding: 4px 16px; font-size: 10px; }
  .chapterline .unit { font-size: 8px; }
  .dock { padding: 7px 10px 0; }
  .controlbar { width: min(420px, 100%); border-radius: 16px; padding: 6px 8px; column-gap: 8px; row-gap: 4px; }
  .navigation { flex: 0 0 100%; justify-content: space-between; min-width: 0; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
  .counter { width: 190px; min-height: 40px; gap: 3px; }
  .nav-btn { width: 45px; height: 41px; }
  .counter-main { font-size: 13px; }
  .counter-sub { font-size: 10px; }
  .navigation + .separator { display: none; }
  .zoom-controls { gap: 1px; }
  .zoom-controls button { width: 41px; height: 41px; }
  .zoom-value { min-width: 48px; font-size: 11px; }
  .mode-controls { gap: 0; }
  .mode-btn { height: 41px; font-size: 11px; padding: 8px 9px; gap: 6px; }
  .mode-btn .icon { width: 17px; height: 17px; }
  .zoom-mode-separator { display: none; }
  .width-fit { display: none !important; }
  .gesture-hint { font-size: 9px; margin-top: 6px; }
  .read-progress { margin-top: 7px; height: 2px; width: min(220px, 63%); }
  .read-progress span { height: 2px; }
  .attribution { font-size: 8px; padding: 7px 9px calc(7px + env(safe-area-inset-bottom, 0px)); line-height: 1.4; }
  .attribution strong { white-space: nowrap; }
  dialog { width: calc(100% - 24px); border-radius: 18px; max-height: 93dvh; }
  .dialog-head { padding: 15px 16px 13px; }
  .dialog-head h2 { font-size: 21px; }
  .dialog-head p { font-size: 11px; }
  .dialog-content { padding: 15px 16px 19px; max-height: calc(93dvh - 95px); }
  .thumbnails { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
  .thumbnail { padding: 6px; border-radius: 10px; }
  .panel-thumbnails { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .panel-thumbnails .thumbnail-label { gap: 4px; padding-left: 0; padding-right: 0; }
  .panel-thumbnails .thumbnail-label span { font-size: 10px; }
  .help-dialog { width: calc(100% - 24px); }
  .toast { bottom: 155px; }
}
@media (max-width: 420px) {
  .brand-mark { display: none; }
  .brand { min-width: 0; }
  h1 { font-size: 19px; max-width: 210px; }
}
@media (max-width: 355px) {
  .masthead { padding-left: 11px; padding-right: 11px; gap: 8px; }
  h1 { font-size: 17px; max-width: 157px; }
  .header-tools { gap: 3px; }
  .header-tools .tool { min-width: 37px; min-height: 40px; padding: 8px; }
  .controlbar { column-gap: 4px; padding-left: 5px; padding-right: 5px; }
  .zoom-controls button { width: 38px; }
  .zoom-value { min-width: 45px; }
  .mode-btn { padding-left: 7px; padding-right: 7px; }
  .mode-btn .icon { width: 15px; }
  .attribution { font-size: 7.5px; }
  .chapterline { font-size: 9px; }
}
@media (max-height: 520px) and (min-width: 621px) {
  .masthead { min-height: 48px; padding-top: 5px; padding-bottom: 5px; }
  .brand-mark, .eyebrow, .attribution, .gesture-hint, .read-progress { display: none; }
  h1 { font-size: 18px; }
  .header-tools .tool { min-height: 36px; padding: 7px 10px; }
  .chapterline { min-height: 24px; padding-top: 3px; padding-bottom: 3px; }
  .dock { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); }
  .controlbar { flex-wrap: nowrap; padding-top: 3px; padding-bottom: 3px; }
  .navigation { min-width: 228px; }
  .counter { width: 132px; }
  .nav-btn, .counter, .mode-btn, .zoom-controls button { min-height: 39px; height: 39px; }
  .zoom-controls button { width: 34px; }
  .zoom-value { min-width: 40px; }
  .mode-btn { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}


/* Generic text pages and full-document printing. */
.masthead{flex-wrap:wrap;gap:10px}.print-tool{background:#b5ddcb;color:#102e33;font-weight:750}
.document-page{box-sizing:border-box;background:#fff;color:#182d35;padding:50px 60px;font:21px/1.6 Georgia,serif;overflow-wrap:anywhere}
.leaf>.document-page{position:absolute}.document-page h1,.document-page h2,.document-page h3{font-family:Arial,sans-serif;letter-spacing:0;color:#17343c;line-height:1.2;margin:0 0 20px}
.document-page h1{font-size:36px}.document-page h2{font-size:27px;margin-top:24px}.document-page p{margin:0 0 22px}
.document-page table{border-collapse:collapse;width:100%;font:18px/1.5 Arial,sans-serif}.document-page th,.document-page td{border:1px solid #aaa;padding:10px;text-align:left}
.document-page img{position:static;max-width:100%;height:auto}.document-page .ruled-space{height:160px;background:repeating-linear-gradient(transparent 0,transparent 31px,#bac5ca 31px,#bac5ca 32px)}
.measure-document{position:absolute;left:-20000px;top:0;visibility:hidden}.text-thumbnail{height:230px;display:grid;place-items:center;padding:20px;background:#f7f8f3;color:#123;font:24px Georgia}
.print-controls{display:grid;gap:16px}.print-controls label{display:grid;gap:8px}.print-controls select,.print-controls input{padding:12px;border:1px solid #799196;border-radius:8px;background:#17343c;color:#fff}
.print-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}.print-actions a{text-decoration:none;color:#102e33}.print-note{font-size:13px;line-height:1.7;color:var(--muted)}
#readTextBody{background:#fcfcf9;color:#152d35;font:21px/1.7 Georgia,serif;user-select:text;overflow-wrap:anywhere}#readTextBody h1{font-size:1.8em}#readTextBody img{max-width:100%;height:auto}
.text-size{padding:12px 22px;display:flex;align-items:center;gap:15px}#printArea{display:none}
@media(max-width:620px){.masthead{display:block;padding:10px 12px}.masthead h1{font-size:19px}.header-tools{margin-top:8px;gap:6px;flex-wrap:wrap}.print-tool .optional-label{display:inline}.header-tools .tool{min-height:42px}.immersive .brand{display:none}.immersive .header-tools{margin-top:0}}
@media print{
 @page{size:A4;margin:7mm}html,body{height:auto!important;width:auto!important;overflow:visible!important;background:white!important;color:black!important}
 body>*:not(#printArea){display:none!important}#printArea{display:block!important;padding:0!important;margin:0!important}
 .print-page{break-after:page;page-break-after:always;box-sizing:border-box}.print-page:last-child{break-after:auto;page-break-after:auto}
 .print-image{width:196mm;height:282mm;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-image img{width:100%;height:100%;object-fit:contain}
 .print-text{padding:5mm 6mm;font:12pt/1.5 Georgia,serif;overflow:visible;height:auto}.print-text h1{font-size:24pt}.print-text h2{font-size:19pt}.print-text h1,.print-text h2,.print-text h3{break-after:avoid}.print-text p{orphans:3;widows:3}.print-text tr,.print-text img{break-inside:avoid}.print-text table{font-size:11pt}
 *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}


.brand-logo-wrap{background:transparent;border:none;box-shadow:none;padding:0;display:flex;align-items:center;justify-content:center;min-width:72px;min-height:72px;width:auto;height:auto;border-radius:0;}
.brand-logo{display:block;width:72px;height:auto;max-height:72px;object-fit:contain;filter:drop-shadow(0 2px 4px rgba(0,0,0,.18));}
@media (max-width: 640px){.brand-logo{width:56px;max-height:56px}.brand-logo-wrap{min-width:56px;min-height:56px}}
