:root{--paper:#fffefa;--canvas:#f8f7f3;--sidebar:#f0efea;--ink:#282c2a;--muted:#7c8078;--line:#e2e4db;--accent:#59735d;--accent-soft:#e3e9df;--reading-size:21px;--sidebar-width:292px;font-family:Inter,"Segoe UI",Arial,sans-serif;color:var(--ink);background:var(--canvas);font-synthesis:none;color-scheme:light;scrollbar-gutter:stable}

/* Exact Trends shades remain as fallbacks; each additional book supplies a palette. */
:root[data-book="trading-ranges"] {
  --paper:#fffefe;
  --canvas:#f9f7f8;
  --sidebar:#eee6ea;
  --ink:#342d33;
  --muted:#7f747d;
  --line:#e3dbe1;
  --accent:#84445f;
  --accent-soft:#eadde6;
  --heading-ink:#342d33;
  --reading-ink:#342d33;
  --ui-strong:#713b52;
  --ui-ink:#80596d;
  --ui-muted:#8b7482;
  --ui-faint:#a794a0;
  --control-border:#d9c9d3;
  --surface-hover:#ede2e8;
  --surface-soft:#f3edf1;
  --surface-raised:#fdfafb;
  --surface-translucent:#f9f5f7ee;
  --header-surface:rgba(249,247,248,.96);
  --selection:#e3cbd8;
  --figure-header:#eadde6;
  --figure-header-ink:#713b52;
  --status-accent:#b18a9f;
  --divider-surface:#eee6ea;
  --divider-active:#e6d7e0;
  --divider-handle:#b69aaa;
  --divider-handle-active:#84445f;
  --line-guide:rgba(132,68,95,.045);
  --shadow-faint:#342d3310;
  --shadow-panel:#342d3326;
  --dialog-backdrop:#342d3350;
  --drawer-backdrop:#342d3366;
  --toast-surface:#84445f;
  --toast-ink:#fffefe;
}
:root[data-book="reversals"] {
  --paper:#fefeff;
  --canvas:#f7f7fb;
  --sidebar:#ebecf4;
  --ink:#30313c;
  --muted:#797b8c;
  --line:#dfe1ed;
  --accent:#626f9a;
  --accent-soft:#e4e7f4;
  --heading-ink:#30313c;
  --reading-ink:#30313c;
  --ui-strong:#4d587e;
  --ui-ink:#626f8a;
  --ui-muted:#797f94;
  --ui-faint:#9a9eb0;
  --control-border:#cfd3e5;
  --surface-hover:#e6e8f3;
  --surface-soft:#f0f1f8;
  --surface-raised:#fbfbfe;
  --surface-translucent:#f6f6fbee;
  --header-surface:rgba(247,247,251,.96);
  --selection:#d5daf0;
  --figure-header:#e4e7f4;
  --figure-header-ink:#4d587e;
  --status-accent:#969fc2;
  --divider-surface:#ebecf4;
  --divider-active:#dce0ef;
  --divider-handle:#a1a9c5;
  --divider-handle-active:#626f9a;
  --line-guide:rgba(98,111,154,.045);
  --shadow-faint:#30314c10;
  --shadow-panel:#30314c26;
  --dialog-backdrop:#30314c50;
  --drawer-backdrop:#30314c66;
  --toast-surface:#58658d;
  --toast-ink:#fafaff;
}
.book-switcher {
  margin:0 25px 8px;
  flex-shrink:0;
}
.book-switcher label {
  display:block;
  margin-bottom:7px;
  font-size:8px;
  font-weight:650;
  letter-spacing:1.6px;
  color:var(--muted);
}
.book-switcher select {
  display:block;
  width:100%;
  min-width:0;
  min-height:38px;
  padding:8px 11px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--paper);
  color:var(--accent);
  font:600 13px/1.4 "Segoe UI",Arial,sans-serif;
  cursor:pointer;
}
.book-switcher select:hover { border-color:var(--accent); }
.book-switcher select:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media (pointer:coarse) { .book-switcher select { min-height:44px; } }
.modal-open,.mobile-nav-open{overflow:hidden}
*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button,a,input{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button{color:inherit}button:disabled{cursor:default;opacity:.35}a{color:inherit}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent);outline-offset:4px}svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}button{border:0;background:none}.icon-button{display:inline-flex;align-items:center;justify-content:center;width:37px;height:37px;border-radius:7px;color:var(--ui-ink,#667066);font-size:25px;flex-shrink:0}.icon-button:hover{background:var(--surface-hover,#e9ece4);color:var(--ink)}.skip-link{position:fixed;z-index:50;top:8px;left:8px;background:var(--paper);padding:12px;transform:translateY(-160%)}.skip-link:focus{transform:none}
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-width);background:var(--sidebar);border-right:1px solid var(--line);display:flex;flex-direction:column;z-index:25}.library-brand{height:75px;display:flex;align-items:center;gap:12px;padding:0 25px;font-size:9px;font-weight:650;letter-spacing:1.9px;color:var(--ui-muted,#787e73);flex-shrink:0}.brand-mark{font-family:Georgia,serif;font-weight:bold;font-size:34px;letter-spacing:-3px;color:var(--accent);line-height:1}.book-identity{display:block;text-decoration:none;margin:14px 26px 29px}.book-eyebrow{display:block;font-size:10px;font-weight:650;letter-spacing:2.4px;color:var(--accent);margin-bottom:12px}.book-identity strong{display:block;font-family:Georgia,"Times New Roman",serif;font-size:28px;line-height:1.17;font-weight:normal;letter-spacing:-.75px}.book-identity em{font-weight:normal;color:var(--accent)}.book-subtitle{display:block;margin-top:12px;font-size:11px;color:var(--muted)}.contents-label{display:flex;justify-content:space-between;padding:0 25px 13px;font-size:9px;letter-spacing:1.6px;font-weight:650;color:var(--ui-ink,#6b7568)}.contents-label span:last-child{font-size:10px;letter-spacing:0;font-weight:400;color:var(--ui-faint,#93988b)}#contents-tree{overflow-y:auto;overscroll-behavior:contain;flex:1;padding:0 13px 20px;scrollbar-width:thin;scrollbar-color:var(--control-border,#ccd0c5) transparent}.tree-group{margin:13px 0}.tree-group:first-child{margin-top:0}.tree-part{display:flex;align-items:center;gap:5px;min-height:33px}.part-toggle{display:flex;align-items:center;justify-content:center;width:20px;height:28px;color:var(--ui-muted,#808b7a);flex-shrink:0;border-radius:4px}.part-toggle:hover{background:var(--surface-hover,#e2e5da)}.part-chevron{font-size:13px;display:inline-block;transition:transform .15s}.tree-group.collapsed .part-chevron{transform:rotate(-90deg)}.tree-group.collapsed .tree-children{display:none}.part-link{font-size:10px;line-height:1.45;font-weight:650;letter-spacing:.7px;text-transform:uppercase;text-decoration:none;padding:7px 4px;flex:1;color:var(--ui-ink,#6b7964)}.part-link[aria-current=page]{color:var(--ui-strong,#345339)}.tree-item{display:flex;gap:10px;padding:9px 10px;line-height:1.45;border-radius:6px;text-decoration:none;font-size:11.5px;position:relative;margin:2px 0;color:var(--ui-ink,#666e62)}.tree-item:hover{background:var(--surface-hover,#e8ebe1)}.tree-item[aria-current=page]{background:var(--accent-soft);color:var(--ui-strong,#34513a)}.tree-item[aria-current=page]:before{content:"";position:absolute;left:0;top:9px;bottom:9px;width:2px;background:var(--accent);border-radius:2px}.tree-number{font-size:10px;color:var(--ui-faint,#92998c);font-variant-numeric:tabular-nums;padding-top:1px;min-width:16px}.tree-item[aria-current=page] .tree-number{color:var(--accent)}.tree-frontmatter .tree-item{padding-left:12px}.tree-children .tree-item{margin-left:15px}.tree-backmatter{border-top:1px solid var(--line);padding-top:10px;margin-top:15px}.sidebar-footer{padding:17px 25px 19px;border-top:1px solid var(--line);font-size:10px;color:var(--ui-muted,#7f887a);background:var(--sidebar);flex-shrink:0}.offline-dot{width:5px;height:5px;background:var(--status-accent,#83a17c);border-radius:50%;display:inline-block;margin-right:6px;vertical-align:middle}.sidebar-footer p{font-size:9px;margin:6px 0 0 12px;color:var(--ui-faint,#a0a595)}.footer-book{float:right;font-size:13px}.sidebar-close,.menu-button{display:none}
.reader-shell{margin-left:var(--sidebar-width);min-height:100vh}.topbar{height:75px;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 40px;position:sticky;top:0;z-index:17;background:var(--header-surface,rgba(248,247,243,.96));border-bottom:1px solid var(--line)}.topbar-location{display:flex;align-items:center;min-width:0;gap:12px}.breadcrumb{font-size:11px;color:var(--ui-muted,#89917f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:350px}.breadcrumb b{color:var(--ui-ink,#5e6a59);font-weight:500}.reader-tools{display:flex;align-items:center;gap:12px;flex-shrink:0}.tool-button{display:flex;align-items:center;gap:9px;font-size:11px;line-height:1;color:var(--ui-ink,#727c6d);border-radius:6px;padding:9px 10px}.tool-button:hover{background:var(--surface-soft,#eceee7)}.tool-button svg{width:16px;height:16px}kbd{font:9px "Segoe UI",sans-serif;border:1px solid var(--control-border,#dcded5);border-radius:4px;padding:3px 5px;color:var(--ui-faint,#91998b);box-shadow:0 1px 0 var(--surface-hover,#e4e5dd)}.search-trigger kbd{margin-left:12px}.toolbar-divider{height:20px;width:1px;background:var(--line)}.text-size-tools{display:flex;align-items:center;gap:0}.font-smaller{font-family:Georgia,serif;font-size:14px}.font-larger{font-family:Georgia,serif;font-size:20px}.font-smaller span,.font-larger span{font:9px Arial,sans-serif;margin-left:1px;align-self:flex-start;margin-top:7px}.reader-tools .icon-button{position:relative}.bookmark-count{position:absolute;top:3px;right:2px;background:var(--accent);color:white;border-radius:50%;font-size:8px;min-width:12px;height:12px;line-height:12px;text-align:center}.reading-progress-track{height:2px;background:transparent;position:sticky;top:74px;z-index:16}#reading-progress-bar{height:100%;background:var(--status-accent,#8ca282);width:0;transition:width .15s}
#reading-content{outline:none}.chapter-container{max-width:860px;padding:66px 60px 22px;margin:0 auto}.chapter-kicker{font-size:9px;line-height:1.6;font-weight:650;letter-spacing:2px;color:var(--ui-muted,#7b8a72);margin-bottom:20px}.chapter-heading-row{display:flex;align-items:flex-start;gap:20px;position:relative}h1{font-family:Georgia,"Times New Roman",serif;font-weight:400;font-size:44px;line-height:1.17;letter-spacing:-1.15px;margin:0;flex:1;color:var(--heading-ink,#30352f)}.save-position{margin-top:7px;color:var(--ui-faint,#a4ad9e)}.save-position.is-saved{color:var(--accent);background:var(--accent-soft)}.save-position.is-saved svg{fill:var(--control-border,#d2dfcd)}.save-position.is-saved .bookmark-plus{display:none}.chapter-meta{margin-top:21px;display:flex;gap:16px;align-items:center;font-size:10px;line-height:1.5;color:var(--ui-faint,#939b8c);flex-wrap:wrap}.meta-item{display:inline-flex;align-items:center;gap:6px}.meta-item svg{width:12px;height:12px}.meta-dot{width:2px;height:2px;border-radius:50%;background:var(--ui-faint,#acb3a5)}.chapter-rule{height:1px;background:var(--line);margin-top:31px;margin-bottom:35px}.chapter-body{font-family:Georgia,"Times New Roman",serif;font-size:var(--reading-size);line-height:1.82;color:var(--reading-ink,#3e433b);overflow-wrap:break-word}.chapter-body p{margin:0 0 1.25em}.chapter-body h2,.chapter-body h3{font-family:"Segoe UI",Arial,sans-serif;font-size:17px;letter-spacing:.3px;line-height:1.55;color:var(--ui-strong,#4d6247);margin:2.2em 0 1em;font-weight:600}.chapter-body .list-item{position:relative;padding-left:23px;margin-bottom:.7em}.chapter-body .list-item:before{content:"•";position:absolute;left:1px;color:var(--ui-muted,#84927b)}.chapter-body .source-page{display:block;font:9px "Segoe UI",Arial,sans-serif;letter-spacing:1px;color:var(--ui-faint,#a0a895);text-align:right;margin:18px 0 -8px}.chapter-body a.figure-reference{color:var(--accent);text-decoration-color:var(--ui-faint,#b6c4af);text-underline-offset:3px}.chapter-body strong{font-weight:700}.chapter-body mark,.search-result mark{background:var(--accent-soft);color:inherit;border-radius:2px;padding:0 1px}.chapter-body [id]{scroll-margin-top:110px}.chapter-body .jump-highlight{animation:jump-flash 2s ease-out}.chapter-body figure{margin:2.1em 0 2.3em;padding-top:1.6em;border:0;border-top:1px solid var(--line);border-radius:0;background:transparent;overflow:visible;box-shadow:none}.figure-open{display:block;width:100%;padding:0;text-align:left;background:transparent;position:relative}.figure-open img{display:block;width:100%;height:auto;border-radius:0}.figure-open:hover .figure-zoom-label{opacity:1;transform:none}.figure-zoom-label{position:absolute;bottom:23px;right:23px;background:var(--surface-translucent,#f6f8f1ee);color:var(--ui-ink,#52704d);border:1px solid var(--control-border,#dde3d6);border-radius:5px;padding:7px 10px;display:flex;align-items:center;gap:6px;font:10px "Segoe UI",sans-serif;opacity:.9;transition:opacity .2s,transform .2s;transform:translateY(2px)}.figure-zoom-label svg{width:13px;height:13px}.figure-label{display:block;font-size:9px;letter-spacing:1.4px;color:var(--ui-ink,#61765a);font-weight:650;margin-bottom:3px;text-transform:uppercase}.figure-image-error{padding:40px;font:13px/1.6 "Segoe UI",Arial,sans-serif;color:#8d5f4f;background:#fff6ed}.chapter-navigation{border-top:1px solid var(--line);margin-top:56px;padding-top:28px;display:grid;grid-template-columns:1fr 1fr;gap:32px}.chapter-nav-button{text-align:left;padding:0;display:flex;flex-direction:column;gap:10px;border-radius:3px}.chapter-nav-button:last-child{text-align:right;align-items:flex-end}.nav-direction{font-size:9px;font-weight:600;letter-spacing:1.6px;color:var(--ui-muted,#86947d)}.nav-title{font-family:Georgia,serif;font-size:18px;line-height:1.4;color:var(--ui-strong,#516348);max-width:280px}.chapter-nav-button:hover .nav-title{text-decoration:underline;text-underline-offset:4px}.chapter-nav-button:disabled{visibility:hidden}.reading-footer{margin-top:58px;border-top:1px solid var(--line);padding:19px 0 38px;display:flex;justify-content:space-between;gap:20px;font-size:8px;letter-spacing:1px;color:var(--ui-faint,#a5ac9d)}.reading-footer button{color:var(--ui-muted,#87947f);font-size:9px;letter-spacing:0;padding:0}
dialog{border:0;padding:0;color:var(--ink);background:var(--paper);box-shadow:0 25px 90px var(--shadow-panel,#1b291d30)}dialog::backdrop{background:var(--dialog-backdrop,#26352b50);backdrop-filter:blur(3px)}.panel-dialog{width:min(640px,calc(100vw - 32px));max-height:min(760px,calc(100dvh - 48px));border-radius:13px;overflow:hidden}.panel-dialog[open]{display:flex;flex-direction:column}.dialog-heading{display:flex;align-items:center;justify-content:space-between;padding:27px 28px 20px;gap:20px;flex-shrink:0}.dialog-eyebrow{font-size:8px;letter-spacing:1.7px;color:var(--ui-muted,#8a967f)}.dialog-heading h2{font:normal 29px/1.2 Georgia,serif;letter-spacing:-.6px;margin:7px 0 0}.dialog-heading>.icon-button{font-size:27px;color:var(--ui-faint,#929d89)}.search-field{margin:0 28px;display:flex;align-items:center;gap:11px;padding:0 14px;border:1px solid var(--control-border,#cdd7c6);background:var(--surface-raised,#fafbf6);border-radius:7px}.search-field svg{width:18px;height:18px;color:var(--ui-muted,#7d8e72)}.search-field input{border:0;background:none;outline:none!important;min-width:0;width:100%;height:48px;font-size:13px;color:var(--ui-strong,#465640)}.search-field:focus-within{outline:2px solid var(--ui-faint,#94aa87);outline-offset:1px}.search-field input::placeholder{color:var(--ui-faint,#9aa492)}.search-summary{padding:16px 28px 10px;font-size:11px;color:var(--ui-muted,#8a967f)}.search-results{overflow:auto;padding:0 13px 14px;min-height:130px}.search-result{display:block;width:100%;padding:14px 15px;text-align:left;border-radius:7px;line-height:1.6}.search-result:hover{background:var(--surface-soft,#f0f3e9)}.search-result .result-location{display:block;font-size:9px;letter-spacing:.6px;color:var(--ui-muted,#8c9d7f);text-transform:uppercase;margin-bottom:5px}.search-result strong{font-family:Georgia,serif;font-size:17px;font-weight:normal;display:block;margin-bottom:4px}.search-result .result-snippet{font-size:12px;color:var(--ui-muted,#808b76)}.dialog-hint{padding:13px 28px;display:flex;justify-content:space-between;gap:12px;font-size:10px;line-height:1.6;color:var(--ui-faint,#a0aa94);background:var(--surface-soft,#f4f5ee);border-top:1px solid var(--line);flex-shrink:0}.dialog-hint kbd{font-size:8px;padding:1px 4px}.empty-state{padding:35px 20px 45px;text-align:center;color:var(--ui-muted,#8a967f);font-size:13px;line-height:1.8}.empty-state strong{display:block;font:normal 23px Georgia,serif;color:var(--ui-ink,#617457);margin-bottom:10px}.bookmarks-list{padding:0 14px 20px;overflow:auto;min-height:170px}.bookmark-row{display:flex;align-items:center;gap:5px;padding:3px 0}.bookmark-jump{flex:1;text-align:left;min-width:0;padding:13px 15px;border-radius:7px}.bookmark-jump:hover{background:var(--surface-soft,#f0f3e9)}.bookmark-jump strong{display:block;font:normal 18px/1.4 Georgia,serif;margin-bottom:5px}.bookmark-jump span{display:block;font-size:11px;color:var(--ui-muted,#8e9b81);line-height:1.6}.bookmark-jump small{display:block;font-size:9px;color:var(--ui-faint,#a6af9b);margin-top:6px}.bookmark-remove{font-size:20px}.figure-dialog{width:calc(100vw - 36px);max-width:none;height:calc(100dvh - 36px);max-height:none;border-radius:10px;background:var(--surface-soft,#f6f7f0);overflow:hidden}.figure-dialog[open]{display:flex;flex-direction:column}.figure-toolbar{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:14px 20px;background:var(--surface-raised,#fcfcf8);border-bottom:1px solid var(--line);flex-shrink:0}.figure-toolbar>div:first-child{min-width:0;display:flex;flex-direction:column;gap:5px}.figure-toolbar strong{font-size:11px;color:var(--ui-ink,#617457)}.figure-toolbar>div>span{font-size:11px;color:var(--ui-muted,#909c84);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:700px}.figure-controls{display:flex;align-items:center;gap:7px;flex-shrink:0}.figure-controls .icon-button{font-size:22px}.figure-controls output{font-size:10px;min-width:37px;text-align:center;color:var(--ui-muted,#839176);font-variant-numeric:tabular-nums}.fit-button{padding:7px 12px;font-size:11px;background:var(--surface-hover,#e9eee1);color:var(--ui-ink,#657c58);border-radius:5px;margin:0 10px 0 2px}.fit-button:hover{background:var(--control-border,#dae5ce)}.figure-stage{flex:1;min-height:0;overflow:auto;padding:20px;overscroll-behavior:contain;text-align:center;touch-action:pan-x pan-y;display:block}.figure-stage img{display:block;max-width:none;height:auto;margin:0 auto;background:#fff;box-shadow:0 4px 25px var(--shadow-faint,#31432512)}.figure-viewer-hint{text-align:center;font-size:10px;padding:11px;color:var(--ui-faint,#91a083);border-top:1px solid var(--line);flex-shrink:0}.toast{position:fixed;bottom:45px;left:calc(50% + var(--sidebar-width)/2);transform:translate(-50%,15px);z-index:100;background:var(--toast-surface,#43573b);color:var(--toast-ink,#f7f9f2);border-radius:7px;font-size:12px;box-shadow:0 6px 25px var(--shadow-panel,#26352226);padding:12px 18px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;max-width:calc(100vw - 40px);text-align:center}.toast.visible{opacity:1;transform:translate(-50%,0)}.noscript-message{position:fixed;inset:100px 20px auto;z-index:200;background:#fff9de;color:#6a5e3a;border:1px solid #dacb88;padding:20px;text-align:center;border-radius:8px}.drawer-backdrop{position:fixed;inset:0;z-index:20;background:var(--drawer-backdrop,#24302666)}.loading-copy{color:var(--ui-faint,#929d88)}.load-error{padding:20px;background:#fff3e5;border:1px solid #e7d6bf;border-radius:8px;font:14px/1.7 "Segoe UI",sans-serif}.load-error strong{display:block;font-size:18px;margin-bottom:10px}@keyframes jump-flash{from{background:var(--accent-soft)}to{background:transparent}}
.bookmark-current{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:12px 16px;margin:0 28px 15px;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft,#f4f7ed)}.bookmark-current>span{font-size:11px;color:var(--ui-muted,#849277);line-height:1.5}.bookmark-current button{font-size:11px;white-space:nowrap;color:var(--ui-strong,#4d6a43);padding:8px 11px;border-radius:5px;background:var(--surface-hover,#e5ecd9)}.bookmark-current button:hover{background:var(--control-border,#dce7cd)}.tree-item{font-size:12.5px}.chapter-meta{font-size:11px}.chapter-body .book-list{margin:0 0 1.3em;padding-left:1.4em}.chapter-body .book-list li{padding-left:.25em;margin-bottom:.65em}.chapter-body .book-list li::marker{color:var(--ui-muted,#84927b)}.chapter-body a.chapter-reference{color:var(--accent);text-decoration-color:var(--ui-faint,#b6c4af);text-underline-offset:3px}
@media(min-width:1500px){.chapter-container{max-width:930px;padding-top:80px;padding-left:70px;padding-right:70px}.topbar{padding-left:52px;padding-right:52px}}
@media(max-width:1150px){:root{--sidebar-width:260px}.topbar{padding:0 24px;gap:12px}.reader-tools{gap:7px}.search-trigger kbd{display:none}.chapter-container{padding:55px 42px 22px}.breadcrumb{max-width:230px}h1{font-size:39px}.book-identity strong{font-size:27px}.tree-item{font-size:12px}}
@media(max-width:900px){.search-trigger span{display:none}.search-trigger{padding:9px}.topbar{padding:0 22px}.reader-tools{gap:5px}.breadcrumb{max-width:170px}.chapter-container{padding:45px 32px 22px}h1{font-size:35px}.chapter-heading-row{gap:8px}.figure-toolbar>div>span{max-width:350px}}
@media(max-width:760px){:root{--sidebar-width:292px;--reading-size:21px}.sidebar{transform:translateX(-101%);transition:transform .2s}.mobile-nav-open .sidebar{transform:none}.reader-shell{margin-left:0}.sidebar-close{display:flex;margin-left:auto;font-size:25px}.menu-button{display:inline-flex;margin-left:-8px}.topbar{height:62px;padding:0 15px;gap:8px}.reading-progress-track{top:61px}.reader-tools{gap:4px}.toolbar-divider{margin:0 3px}.text-size-tools .icon-button{width:31px}.reader-tools>.icon-button{width:34px}.breadcrumb{font-size:10px;max-width:min(32vw,250px)}.chapter-container{padding:40px 27px 12px;max-width:760px}.chapter-kicker{font-size:8px;letter-spacing:1.6px;margin-bottom:15px}h1{font-size:36px;letter-spacing:-.8px;line-height:1.2}.save-position{margin-top:2px;width:30px}.save-position svg{width:18px}.chapter-meta{margin-top:18px;font-size:9px;gap:12px}.chapter-rule{margin-top:25px;margin-bottom:28px}.chapter-body{line-height:1.8}.chapter-body figure{margin-left:0;margin-right:0}.chapter-body [id]{scroll-margin-top:85px}.chapter-navigation{gap:22px;margin-top:40px}.nav-title{font-size:17px}.reading-footer{margin-top:40px;font-size:7px;letter-spacing:.7px;padding-bottom:45px}.reading-footer button{font-size:9px;white-space:nowrap}.toast{left:50%;bottom:44px}.panel-dialog{max-height:calc(100dvh - 24px)}.figure-dialog{width:100vw;height:100dvh;border-radius:0}.figure-toolbar{padding:9px 12px;gap:8px;align-items:flex-start}.figure-toolbar>div:first-child{padding-top:8px}.figure-toolbar>div>span{max-width:32vw;font-size:10px}.figure-controls{gap:1px}.figure-controls .icon-button{width:32px;height:34px}.fit-button{padding:6px 8px;margin:0 4px}.figure-stage{padding:12px}.figure-viewer-hint{font-size:9px;padding:9px 18px}.figure-zoom-label{font-size:9px;padding:6px 8px;bottom:18px;right:18px}.book-identity{margin-top:10px}.sidebar-footer{padding-bottom:20px}}
@media(max-width:400px){.topbar{padding:0 11px}.breadcrumb{max-width:27vw}.reader-tools{gap:0}.toolbar-divider{margin:0 2px}.chapter-container{padding-left:22px;padding-right:22px}h1{font-size:32px}.chapter-meta{gap:8px}.search-trigger{padding:8px}.dialog-heading{padding:23px 21px 18px}.dialog-heading h2{font-size:27px}.search-field{margin:0 21px}.search-summary{padding-left:21px}.dialog-hint{padding:12px 21px;font-size:9px}.figure-toolbar>div>span{display:none}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media print{.sidebar,.topbar,.reading-progress-track,.save-position,.chapter-navigation,.reading-footer,.toast,.figure-zoom-label{display:none!important}.reader-shell{margin:0}.chapter-container{max-width:none;padding:0}.chapter-body{font-size:11pt;line-height:1.5}.chapter-body figure{break-inside:avoid;margin:20px 0}.chapter-body a{text-decoration:none;color:inherit}h1{font-size:30pt}dialog{display:none!important}body{background:white}}

/* Selection follows the active book's palette. */
::selection { background:var(--selection,#cbdcc6); color:var(--ink); }

/* Figure titles introduce each chart before the image. */
.chapter-body figcaption {
  border-top:0;
  border-bottom:0;
  padding:0 0 18px;
  background:transparent;
  color:var(--ink);
}
.chapter-body figcaption .figure-label {
  font-size:18px;
  font-weight:700;
  letter-spacing:.8px;
  margin-bottom:7px;
  color:var(--ui-strong,#4d6848);
}
.chapter-body figcaption h2 {
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:clamp(22px,2.2vw,27px);
  font-weight:700;
  line-height:1.35;
  letter-spacing:0;
  color:var(--ink);
}

/* Study view keeps the familiar reading page and adds an independent chart pane. */
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.study-workspace { min-width:0; }
.study-panel, .study-divider { display:none; }
.study-trigger[aria-pressed="true"] { color:var(--ui-strong,#34513a); background:var(--accent-soft); }
.study-trigger svg { width:17px; height:17px; }
.figure-pin-actions { display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap; padding:10px 18px; border-top:1px solid var(--line); background:var(--surface-raised,#fcfcf8); font-size:11px; flex-shrink:0; }
.figure-pin-actions span { color:var(--ui-muted,#8a967f); margin-right:6px; }
.figure-pin-actions button { padding:8px 12px; border-radius:5px; background:var(--surface-hover,#e8eee1); color:var(--ui-ink,#536d49); }
.figure-pin-actions button:hover { background:var(--control-border,#dce6d3); }
body.study-active { overflow:hidden; }
.study-active .reader-shell { display:flex; flex-direction:column; height:100vh; height:100dvh; min-height:0; }
.study-active .topbar { position:relative; flex-shrink:0; }
.study-active .reading-progress-track { position:relative; top:0; flex-shrink:0; }
.study-active .study-workspace { display:grid; flex:1; min-height:0; overflow:hidden; }
.study-active .study-workspace[data-layout="side"] { grid-template-areas:"text divider chart"; grid-template-columns:minmax(0,var(--study-text-fr,1fr)) 12px minmax(0,var(--study-chart-fr,1fr)); grid-template-rows:minmax(0,1fr); }
.study-active .study-workspace[data-layout="top"] { grid-template-areas:"chart" "divider" "text"; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,var(--study-chart-fr,1fr)) 12px minmax(0,var(--study-text-fr,1fr)); }
.study-active .study-workspace[data-layout="side"][data-flipped="true"] { grid-template-areas:"chart divider text"; grid-template-columns:minmax(0,var(--study-chart-fr,1fr)) 12px minmax(0,var(--study-text-fr,1fr)); }
.study-active .study-workspace[data-layout="top"][data-flipped="true"] { grid-template-areas:"text" "divider" "chart"; grid-template-rows:minmax(0,var(--study-text-fr,1fr)) 12px minmax(0,var(--study-chart-fr,1fr)); }
.study-active #reading-content { grid-area:text; height:100%; min-height:0; min-width:0; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.study-active .chapter-container { padding:32px clamp(22px,4vw,48px) 18px; }
.study-active h1 { font-size:clamp(27px,2.8vw,36px); }
.study-active .chapter-kicker { margin-bottom:12px; }
.study-active .chapter-meta { margin-top:16px; }
.study-active .chapter-rule { margin-top:22px; margin-bottom:28px; }
.study-active .chapter-body [id] { scroll-margin-top:24px; }
.study-active .chapter-body figure { margin-left:0; margin-right:0; }
.study-active .chapter-navigation { gap:20px; }
.study-active .study-panel:not([hidden]) { display:flex; flex-direction:column; grid-area:chart; container-type:inline-size; min-width:0; min-height:0; background:var(--surface-soft,#f3f5ee); overflow:hidden; }
.study-stage { flex:1; min-width:0; min-height:0; overflow:auto; overscroll-behavior:contain; padding:16px; display:flex; touch-action:pan-x pan-y; scrollbar-width:thin; scrollbar-color:var(--control-border,#c8d2c0) transparent; }
.study-stage img { display:block; flex:none; max-width:none; height:auto; margin:auto; background:#fff; box-shadow:0 3px 18px var(--shadow-faint,#31432512); user-select:none; -webkit-user-drag:none; }
.study-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 10px; background:var(--surface-raised,#fbfcf7); border-bottom:1px solid var(--line); flex-shrink:0; }
.study-layouts, .study-zoom { display:flex; align-items:center; gap:2px; padding:2px; border:1px solid var(--line); border-radius:7px; background:var(--surface-soft,#f1f4eb); flex-shrink:0; }
.study-footer button { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:28px; padding:0 8px; border-radius:5px; color:var(--ui-ink,#6e815f); font-size:10px; white-space:nowrap; }
.study-footer button:hover { background:var(--surface-hover,#e8eee1); color:var(--ui-strong,#36502e); }
.study-footer button svg { width:14px; height:14px; }
.study-layouts button[aria-pressed="true"] { background:var(--surface-raised,#fffefa); color:var(--ui-strong,#47603e); box-shadow:0 1px 3px var(--shadow-faint,#33442a10); }
.study-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.study-zoom .icon-button { width:24px; padding:0; font-size:20px; }
.study-zoom output { min-width:30px; text-align:center; color:var(--ui-muted,#809175); font-size:10px; font-variant-numeric:tabular-nums; }
.study-zoom .fit-button { margin:0; background:transparent; padding:0 7px; }
.study-footer .study-expand { height:34px; border:1px solid var(--line); border-radius:7px; }
.study-stage, .figure-stage { touch-action:none; }
.study-stage.can-pan, .figure-stage.can-pan { cursor:grab; }
.study-stage.is-panning, .figure-stage.is-panning { cursor:grabbing; user-select:none; }
.figure-stage img { user-select:none; -webkit-user-drag:none; }
.study-zoom .icon-button, .figure-controls .icon-button { line-height:1; }
.study-zoom .icon-button svg, .figure-controls .icon-button svg { display:block; width:14px; height:14px; stroke-width:1.8; }
.focus-reading .study-footer { display:none; }
.focus-reading .study-layouts button span, .focus-reading .study-expand span { display:none; }
.focus-reading .study-layouts button { width:28px; padding:0; }
.focus-reading .study-actions { gap:6px; }
.focus-reading .study-footer .study-expand { width:28px; padding:0; }
@container (max-width:440px) {
  .study-footer { gap:8px; padding:6px 8px; }
  .study-layouts button span, .study-expand span { display:none; }
  .study-layouts button { width:28px; padding:0; }
  .study-actions { gap:6px; }
  .study-footer .study-expand { width:28px; padding:0; }
}
.study-active .study-divider:not([hidden]) { display:flex; align-items:center; justify-content:center; grid-area:divider; position:relative; background:var(--divider-surface,#e9ede2); touch-action:none; user-select:none; z-index:2; }
.study-panel[hidden], .study-divider[hidden] { display:none!important; }
.study-workspace[data-layout="side"] .study-divider { cursor:col-resize; border-left:1px solid var(--control-border,#dce3d4); border-right:1px solid var(--control-border,#dce3d4); }
.study-workspace[data-layout="top"] .study-divider { cursor:row-resize; border-top:1px solid var(--control-border,#dce3d4); border-bottom:1px solid var(--control-border,#dce3d4); }
.study-divider span { display:block; background:var(--divider-handle,#9baa8e); border-radius:3px; pointer-events:none; }
.study-workspace[data-layout="side"] .study-divider span { height:44px; width:3px; }
.study-workspace[data-layout="top"] .study-divider span { width:44px; height:3px; }
.study-divider:hover, .study-divider:focus-visible, .study-workspace.is-resizing .study-divider { background:var(--divider-active,#dce5d3); }
.study-divider:hover span, .study-divider:focus-visible span { background:var(--divider-handle-active,#637d55); }
body.study-resizing, .study-workspace.is-resizing { user-select:none; }
body.study-resizing .study-stage { pointer-events:none; }
.focus-divider { display:none; }
.focus-divider[hidden] { display:none!important; }
body.focus-resizing { user-select:none; cursor:col-resize; }
@media (max-width:1150px) {
  .study-trigger span { display:none; }
  .study-trigger { padding:9px; }
  .study-active .search-trigger kbd { display:none; }
}
@media (max-width:760px) {
  .study-trigger { padding:7px; }
  .study-trigger svg { width:17px; height:17px; }
  .study-active .chapter-container { padding:24px 24px 16px; }
  .study-active h1 { font-size:29px; }
  .study-active .chapter-meta { font-size:10px; }
  .study-stage { padding:12px; }
  .figure-pin-actions { gap:6px; padding:7px 10px; }
  .figure-pin-actions span { display:none; }
  .figure-pin-actions button { font-size:10px; padding:7px 10px; }
}
@media (max-width:400px) {
  .study-trigger { padding:6px; }
  .study-active .topbar { gap:4px; }
  .study-active .breadcrumb { max-width:23vw; }
}
.study-workspace[data-layout="top"] .study-stage { border-top:1px solid var(--line); padding:10px; }
@media (max-width:760px) {
  .study-workspace[data-layout="top"] .study-stage { padding:8px; }
}
@media (max-height:540px) {
}
@media print {
  .study-panel, .study-divider, .study-trigger, .figure-pin-actions { display:none!important; }
  body.study-active { overflow:visible; }
  .study-active .reader-shell { display:block; height:auto; min-height:0; }
  .study-active .study-workspace { display:block; overflow:visible; }
  .study-active #reading-content { overflow:visible; height:auto; }
  .study-active .chapter-container { padding:0; }
}

/* Width is a percentage of the available reading pane, including in study view. */
.reader-shell .chapter-container {
  width:var(--reading-width,95%);
  max-width:none;
  min-width:min(100%,420px);
}
.reading-settings { position:relative; }
.reading-line-guide {
  position:fixed;
  z-index:4;
  pointer-events:none;
  background:var(--line-guide,rgba(89,115,93,.045));
  border-radius:3px;
}
.reading-line-guide[hidden] { display:none; }
@media print, (hover:none) {
  .reading-line-guide { display:none!important; }
}
.settings-trigger { gap:5px; padding:6px 9px; }
.settings-type-icon { font:22px/1 Georgia,"Times New Roman",serif; }
.settings-trigger svg { width:13px; height:13px; }
.settings-trigger[aria-expanded="true"] { background:var(--accent-soft); color:var(--ui-strong,#34513a); }
.reading-settings-panel {
  position:absolute;
  top:calc(100% + 14px);
  right:0;
  z-index:40;
  width:320px;
  max-height:calc(100dvh - 110px);
  overflow:auto;
  padding:21px;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--paper);
  box-shadow:0 12px 40px var(--shadow-panel,#24332a24);
  color:var(--ink);
  font-size:13px;
}
.reading-settings-panel[hidden] { display:none!important; }
.reading-settings-panel h2 { margin:0 0 15px; font:24px/1.3 Georgia,"Times New Roman",serif; }
.setting-row { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.setting-row .text-size-tools { gap:5px; }
.reading-settings-panel .icon-button { width:34px; height:34px; background:var(--surface-soft,#f0f3eb); }
#font-size-value { min-width:42px; text-align:center; font-size:12px; font-variant-numeric:tabular-nums; }
.width-setting-label { margin-top:22px; }
.width-number { display:flex; align-items:center; gap:4px; }
.width-number input { width:62px; padding:6px 4px 6px 8px; border:1px solid var(--control-border,#d4ddce); border-radius:5px; background:var(--surface-raised,#fafbf7); color:var(--ink); font:inherit; }
.reading-width-slider { display:block; width:100%; height:30px; margin:10px 0 9px; accent-color:var(--accent); cursor:pointer; }
.width-presets { display:flex; justify-content:space-between; gap:8px; }
.width-presets button { padding:7px 9px; background:var(--surface-soft,#f0f3eb); border-radius:5px; font-size:11px; color:var(--ui-ink,#62775a); }
.width-presets button[aria-pressed="true"] { background:var(--accent-soft); color:var(--ui-strong,#34513a); box-shadow:inset 0 0 0 1px var(--ui-faint,#9dad93); }
#reading-width-hint { margin:13px 0 0; color:var(--ui-muted,#7a8474); font-size:11px; line-height:1.6; }
.focus-trigger[aria-pressed="true"] { color:var(--ui-strong,#34513a); background:var(--accent-soft); }
@media (max-width:1050px) {
  .focus-trigger span { display:none; }
  .focus-trigger { padding:9px; }
}
@media (max-width:600px) {
  .settings-trigger { padding:6px; }
  .reading-settings-panel { position:fixed; top:69px; right:12px; left:12px; width:auto; max-height:calc(100dvh - 85px); }
}
/* Reading margins remain adjustable in both normal and focus mode. */
@media screen {
  #reading-content.reading-margin-enabled { padding-left:calc(var(--focus-inset,0px) + 12px); }
  #reading-content.reading-margin-enabled.reading-margin-right { padding-left:0; padding-right:calc(var(--focus-inset,0px) + 12px); }
  .focus-divider:not([hidden]) { display:flex; align-items:center; justify-content:center; position:fixed; width:12px; z-index:5; background:var(--divider-surface,#eef0e8); border-left:1px solid var(--surface-hover,#e2e7da); border-right:1px solid var(--surface-hover,#e2e7da); cursor:col-resize; touch-action:none; user-select:none; }
  .focus-divider span { width:3px; height:44px; background:var(--divider-handle,#a4b298); border-radius:3px; pointer-events:none; }
  .focus-divider:hover, .focus-divider:focus-visible, .focus-resizing .focus-divider { background:var(--divider-active,#dce5d3); }
  .focus-divider:hover span, .focus-divider:focus-visible span { background:var(--divider-handle-active,#637d55); }
  .focus-reading .sidebar { transform:translateX(-101%); visibility:hidden; }
  .focus-reading.mobile-nav-open .sidebar { transform:none; visibility:visible; }
  .focus-reading .reader-shell { margin-left:0; }
  .focus-reading .topbar { height:40px; padding:0 12px; gap:8px; }
  .focus-reading .topbar-location { gap:8px; }
  .focus-reading .menu-button, .focus-reading .sidebar-close { display:inline-flex; }
  .focus-reading .sidebar-close { margin-left:auto; }
  .focus-reading .topbar .icon-button { width:30px; height:30px; margin:0; }
  .focus-reading .breadcrumb { font-size:10px; max-width:min(25vw,350px); }
  .focus-reading .breadcrumb>span { display:none; }
  .focus-reading .reader-tools { gap:3px; }
  .focus-reading .topbar .tool-button { height:30px; padding:5px 7px; gap:5px; }
  .focus-reading .study-trigger span, .focus-reading .search-trigger span,
  .focus-reading .search-trigger kbd, .focus-reading .toolbar-divider { display:none; }
  .focus-reading .focus-trigger span { display:inline; }
  .focus-reading .settings-type-icon { font-size:20px; }
  .focus-reading .reading-settings-panel { top:calc(100% + 7px); max-height:calc(100dvh - 55px); }
  .focus-reading .reading-progress-track { top:39px; }
  .focus-reading.study-active .reading-progress-track { top:0; }
  .focus-reading .chapter-container { padding:20px clamp(20px,3vw,40px) 16px; }
  .focus-reading .chapter-kicker, .focus-reading .chapter-meta,
  .focus-reading .chapter-rule, .focus-reading .reading-footer{ display:none; }
  .focus-reading .chapter-heading-row { align-items:center; gap:10px; margin-bottom:20px; }
  .focus-reading h1 { font-size:24px; line-height:1.3; letter-spacing:-.3px; }
  .focus-reading .save-position { width:28px; height:28px; margin:0; }
  .focus-reading .save-position svg { width:17px; height:17px; }
  .focus-reading .chapter-body [id] { scroll-margin-top:75px; }
  .focus-reading.study-active .chapter-body [id] { scroll-margin-top:24px; }
  .focus-reading .chapter-navigation { margin-top:30px; padding-top:18px; }
  .focus-reading .nav-title { font-size:16px; }
  .focus-reading .toast { left:50%; }
  .focus-reading .study-workspace .study-stage { padding:6px; border-top:1px solid var(--line); }
}
@media screen and (max-width:600px) {
  .focus-reading .reading-settings-panel { top:47px; }
}
@media screen and (max-width:480px) {
  .focus-reading .breadcrumb { display:none; }
}
@media screen and (pointer:coarse) {
  .focus-reading .topbar { height:44px; }
  .focus-reading .topbar .icon-button, .focus-reading .topbar .tool-button { min-height:36px; }
  .focus-reading .reading-progress-track { top:43px; }
}
@media print {
  .reader-shell .chapter-container { width:100%; min-width:0; }
}

/* Reading typography uses installed fonts and stays fully offline. */
.font-setting { margin-bottom:18px; }
#reading-font {
  min-width:0;
  max-width:190px;
  padding:8px 10px;
  border:1px solid var(--control-border,#d4ddce);
  border-radius:5px;
  background:var(--surface-raised,#fafbf7);
  color:var(--ink);
  font:13px/1.5 "Segoe UI",Arial,sans-serif;
}
#reading-font:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.line-height-setting { margin-top:20px; }
@media screen {
  .chapter-body {
    font-family:var(--reading-font,Arial,Helvetica,sans-serif);
    line-height:var(--reading-line-height,1);
  }
}
@media (pointer:coarse) { #reading-font { min-height:44px; } }
