/* Book design system */
:root {
  --bg:#faf6ec; --surface:#fffcf5; --soft:#eee6f2; --line:#d9cfdd;
  --ink:#241c2a; --accent:#593e81; --gold:#987247;
  --serif:Georgia,'Times New Roman',serif; --control:2.75rem; --motion:150ms;
}
:root[data-theme="white"] { --bg:#fff; --surface:#fff; --line:#ddd5e4; }
:root[data-theme="cream"] { --bg:#f1e7d2; --surface:#fbf3e4; --soft:#eee1d7; --line:#d4c5bd; }
:root[data-theme="lavender"] { --bg:#f8f5fc; --surface:#fdfaff; --soft:#ede5f5; --line:#d8cce3; }
:root[data-theme="dark"] {
  --bg:#292039; --surface:#302641; --soft:#3b2e4d; --ink:#f6eef8;
  --line:#665674; --muted:#d4c3df; --accent:#dac1f8; --on-accent:#2c1845; --gold:#d4af78;
}

.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(1rem, 4vw, 4rem); align-items: center; padding-block: clamp(2.25rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.hero p { max-width: 34rem; color: var(--muted); font-size: 1.08rem; }
.hero-logo { display:block; width: min(13rem,75%); height:auto; margin-inline-start: -.9rem; margin-block-end: .5rem; }
.hero-logo-dark { display:none; }
[data-theme="dark"] .hero-logo:not(.hero-logo-dark) { display:none; }
[data-theme="dark"] .hero-logo-dark { display:block; }
.hero-shortcuts { display:grid; align-content:center; gap:.7rem; align-self:stretch; padding:1.4rem; border-block:1px solid var(--line); }
.hero-shortcuts h2 { margin-block-end:.3rem; }
.hero .book-subtitle { color: var(--ink); font: 1.35rem/1.32 var(--serif); margin-block: .52rem .7rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; margin-block-start: 1.35rem; }
.button { display: inline-block; text-decoration: none; }
.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.hero { grid-template-columns:minmax(0,1.55fr) minmax(0,1fr); padding-block:clamp(2rem,5vw,4.5rem); }
.hero .eyebrow { color:var(--muted); font-size:.78rem; }
.hero h1 { max-width:11ch; }
.hero .book-subtitle { font-size:clamp(1.2rem,2.6vw,1.75rem); }
.book-jacket {
  container-type:inline-size; width:min(100%,21rem); aspect-ratio:210/297; margin:0; justify-self:center;
  padding:1rem; background:#f2e7d1; color:#342147; border:1px solid #bc9a6c;
  background-image:repeating-conic-gradient(from 4deg at 50% 42%,transparent 0 13.92deg,#bd92542d 14deg 14.13deg,transparent 14.21deg 15deg);
}
[data-theme="dark"] .book-jacket {
  background-color:#261934; color:#fff1dd;
  background-image:repeating-conic-gradient(from 4deg at 50% 42%,transparent 0 13.92deg,#c8a37e3c 14deg 14.13deg,transparent 14.21deg 15deg);
}
.jacket-rule { height:100%; border:1px solid #ac8555; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:4.2cqw; padding:5cqw; }
.jacket-rule img { width:49cqw; aspect-ratio:1; object-fit:contain; clip-path:circle(46.3%); }
.jacket-rule img:nth-of-type(2), [data-theme="dark"] .jacket-rule:has(img:nth-of-type(2)) img:first-of-type { display:none; }
[data-theme="dark"] .jacket-rule img:nth-of-type(2) { display:block; }

.site-header .book-header {
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;
  width:min(100% - 2.5rem,72rem);margin-inline:auto;gap:.45rem 1rem;min-height:67px;padding:.5rem 0;
  font:500 .875rem/1.35 var(--sans,system-ui);
}
.book-header :is(nav,.header-tools) {display:flex;align-items:center;justify-content:flex-end;gap:.3rem;flex-wrap:wrap}
.book-header :is(.book-brand,nav a,.header-tools button) {
  display:inline-flex;align-items:center;min-height:44px;border-radius:.42rem;padding:.38em .6em;
  white-space:nowrap;text-decoration:none;
}
.book-header .book-brand {padding:0;gap:.48rem;color:var(--ink);font-weight:600}
.book-brand img {width:34px;height:34px;object-fit:contain;clip-path:circle(46.3%);flex:none}
.book-brand span {color:var(--muted);font-weight:450}
.book-header nav a[aria-current] {background:var(--soft);color:var(--accent)}
.book-header :is(.book-brand,nav a):hover {text-decoration:none}
.site-header .book-header .header-tools button {border:1px solid var(--line);font:inherit;min-width:0;background:var(--surface);color:var(--ink)}
.book-header .header-tools button[aria-pressed=true] {background:var(--soft);color:var(--accent)}
.site-header .book-header #search-open {min-width:44px;justify-content:center}
.book-header .compact-label {display:none}
.book-panel-button {min-height:2.55rem;font-size:.85rem}
.book-panel-button::after {content:"";display:inline-block;width:.38em;height:.38em;margin-inline-start:.55em;border:solid currentColor;border-width:0 1px 1px 0;transform:rotate(45deg) translateY(-.1em)}
.book-panel-button[aria-expanded=true]::after {transform:rotate(225deg) translateY(-.1em)}
.book-choice {border:0;background:transparent}
@media(max-width:70rem){
  .site-header .book-header {grid-template-columns:minmax(0,1fr) auto;gap:.2rem .6rem}
  .book-header nav {grid-row:2;grid-column:1/-1;justify-content:flex-start}
}
@media(max-width:46rem){
  .site-header .book-header {width:calc(100% - 1.2rem)}
  .book-header .wide-label {display:none}
  .book-header .compact-label {display:inline}
  .book-header .book-brand {font-size:.77rem;gap:.28rem}
  .book-brand img {width:28px;height:28px}
  .book-header .header-tools button {padding-inline:.43em;font-size:.82rem}
  .site-header .book-header nav {display:grid;grid-template-columns:repeat(4,max-content);gap:.15rem;justify-content:space-between}
  .book-header nav a {font-size:.76rem;padding-inline:.12rem;min-height:34px}
}
@media(max-width:25rem){.book-brand span {display:none}}
@media(max-width:24rem){
  .site-header .book-header {grid-template-columns:minmax(0,1fr)}
  .site-header .book-header nav {grid-column:1;grid-row:auto}
  .book-header .header-tools {grid-column:1;justify-content:flex-start}
  .site-header .book-header .header-tools button {min-width:44px;justify-content:center}
}
@media(max-width:21rem){.site-header .book-header nav {grid-template-columns:repeat(2,max-content);justify-content:start;column-gap:1rem}}
:root[data-motion="false"] {--motion:0ms}
@media(prefers-reduced-motion:reduce){
  :root {--motion:0ms}
  html:focus-within {scroll-behavior:auto}
}
.book-search {
  position:fixed;inset:0 0 0 auto;margin:0;padding:1.15rem;box-sizing:border-box;
  width:min(30rem,100%);height:100%;max-width:none;max-height:100dvh;
  color:var(--ink);background:var(--surface);border:1px solid var(--line);overflow:auto;
}
.book-search::backdrop {background:#15102380}
.book-search > header {display:flex;align-items:center;justify-content:space-between;gap:.7rem;margin-bottom:.75rem}
.book-search > header h2 {margin:0;font:500 clamp(1.35rem,5vw,1.8rem)/1.2 var(--serif)}
.book-search button {min-height:44px}
.book-search [type="search"] {
  display:block;width:100%;min-width:0;min-height:44px;box-sizing:border-box;
  padding:.55rem .65rem;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:.42rem
}
.book-search .tool-row {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end;gap:.65rem;justify-content:stretch}
.book-search .tool-row > :first-child {grid-column:1/-1}
.book-search .tool-row :is(label,.book-choice) {min-width:0;width:100%;max-width:100%}
.book-search .book-choice > summary {min-width:0}
.book-search .tool-row > button {justify-self:start}
.book-search [data-search-results] {margin-block-start:.75rem}
.book-search li {overflow-wrap:anywhere}
.book-practice {border-block-start:1px solid var(--line);padding-block-start:.45rem;margin-block:1rem;text-align:start}
.book-practice a {display:inline-flex;align-items:center;min-height:44px}
.book-practice small {display:block;color:var(--muted);font:500 .8rem/1.35 var(--sans,system-ui)}
@media(max-width:46rem){
  .book-search {inset:auto 0 0;width:100%;height:auto;max-height:80dvh;border-radius:.65rem .65rem 0 0}
}
@media(max-width:27rem){
  .book-search .tool-row {grid-template-columns:minmax(0,1fr)}
}
.jacket-rule small { font-size:clamp(.57rem,3.5cqw,.82rem); }
.jacket-rule strong { font:500 12cqw/.99 var(--serif); letter-spacing:-.035em; }
.jacket-rule span { font:5.6cqw/1.24 var(--serif); }
.jacket-rule small:last-child { border-top:1px solid #ac8555; padding-top:4cqw; margin-top:3cqw; }
.book-tools { display:flex; flex-wrap:wrap; gap:.5rem 1rem; padding-block:.8rem; border-bottom:1px solid var(--line); }
.book-tools a { display:inline-flex; align-items:center; min-height:44px; }

.hero h1 { font:500 clamp(2.55rem,7vw,5.6rem)/1.14 var(--serif); letter-spacing:-.045em; overflow-wrap:break-word; }
.hero .eyebrow { font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.hero .edition-links { display:flex; flex-wrap:wrap; gap:.7rem 1rem; }
.hero p { margin-block:.7em; }
.book-tools a { text-decoration:none; }
@media (max-width:500px) {
  .hero { grid-template-columns:minmax(0,1fr); gap:1.4rem; }
  .hero h1 { max-width:none; font-size:clamp(2.2rem,10vw,3.4rem); }
  .hero .book-subtitle { max-width:28ch; }
  .hero .book-jacket { width:min(100%,12rem); justify-self:start; }
  .jacket-rule { gap:3.5cqw; }
}
.book-choice { position:relative; min-width:0; max-width:100%; margin:0; padding:0; border:0; background:transparent; color:var(--ink); font:inherit; }
.book-choice > summary { display:flex; align-items:center; justify-content:space-between; gap:.85rem; list-style:none; min-height:2.75rem; min-width:11rem; padding:calc(.45rem + .9px) .72rem calc(.45rem - .9px); border:1px solid var(--line); border-radius:.45rem; background:var(--surface); }
.book-choice > summary::-webkit-details-marker { display:none; }
.book-choice > summary::after { content:''; width:.42rem; height:.42rem; margin-top:-.23rem; transform:rotate(45deg); border:solid currentColor; border-width:0 1.5px 1.5px 0; }
.book-choice[open] > summary::after { transform:rotate(225deg); margin-top:.26rem; }
.book-choice > fieldset { display:grid; position:absolute; inset:calc(100% + .25rem) 0 auto; z-index:5; min-width:0; max-height:min(17rem,45dvh); overflow:auto; gap:.12rem; margin:0; padding:.25rem; border:1px solid var(--line); border-radius:.45rem; background:var(--surface); box-shadow:0 6px 20px #211c2b24; }
.book-choice > fieldset label { display:flex; align-items:center; gap:.55rem; min-height:2.5rem; margin:0; border-radius:.3rem; padding:.28rem .4rem; overflow-wrap:anywhere; cursor:pointer; }
.book-choice > fieldset label:has(input:checked) { background:var(--soft); }
.book-choice input { width:auto; margin:0; padding:0; flex:none; accent-color:var(--accent); }
.book-choice-value,.book-voice { position:absolute; width:1px; min-height:0; height:1px; margin:0; padding:0; border:0; opacity:0; pointer-events:none; clip-path:inset(50%); }
.book-choice-field { display:grid; gap:.35rem; min-width:0; align-self:end; position:relative; }
html body #welcome { position:fixed; z-index:8; inset:0; margin:auto; width:min(27rem,calc(100% - 2rem)); max-width:none; max-height:calc(100dvh - 2rem); height:max-content; padding:1.2rem 1.3rem; border:1px solid var(--line); border-radius:.7rem; background:var(--surface); color:var(--ink); box-shadow:0 8px 30px #241c2a22; }
#welcome h2 { font:500 clamp(1.55rem,4vw,1.75rem)/1.14 var(--serif); margin:0; outline:0; }
#welcome p { margin:.75rem 0 1rem; }
.book-welcome-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:.45rem; }
.book-welcome-actions button,.hero .button { min-height:2.75rem; padding:.45rem .8rem; border:1px solid var(--line); border-radius:.45rem; background:var(--surface); text-decoration:none; }
.book-welcome-actions button { padding-block:calc(.45rem + .95px) calc(.45rem - .95px); }
.book-welcome-actions .primary,.hero .button.primary { background:var(--accent); border-color:var(--accent); color:var(--on-accent); }

/* Keyboard focus stays inside the control. Tour draws its own teaching highlight. */
:where(button,a,summary,input,select,textarea,[tabindex]):focus {outline:none}
:root:not([data-book-pointer]) :where(button,a,summary,input,select,textarea,[tabindex]:not([tabindex="-1"])):focus-visible {
  outline:2px solid var(--accent);
  outline-offset:-2px;
}

/* Common reading surface and controls */
html[data-reader-gamut="classic"] {
  --bg:#faf7f0; --surface:#fffdf8; --ink:#242333; --muted:#625d69;
  --line:#ddd6ca; --accent:#594078; --soft:#eee7f5;
}
html[data-reader-gamut="academic"] {
  --bg:#fff; --surface:#fff; --ink:#23232b; --muted:#5b5964;
  --line:#dedde3; --accent:#554279; --soft:#eeebf4;
}
html[data-reader-gamut="warm"] {
  --bg:#f4ead8; --surface:#fbf2e3; --ink:#342b25; --muted:#665748;
  --line:#d7c7b1; --accent:#654573; --soft:#eadeee;
}
html[data-reader-gamut="classic"][data-theme="dark"] {
  --bg:#141d2f; --surface:#1a2539; --ink:#f3eef5; --muted:#c0bbcd;
  --line:#3f4a61; --accent:#d8bdf3; --soft:#303653;
}
html[data-reader-gamut="academic"][data-theme="dark"] {
  --bg:#202126; --surface:#26272d; --ink:#f2eff4; --muted:#c2bfca;
  --line:#494952; --accent:#dcc3f4; --soft:#3b3547;
}
html[data-reader-gamut="warm"][data-theme="dark"] {
  --bg:#2c2421; --surface:#362d29; --ink:#f6eee3; --muted:#d0c0af;
  --line:#54463e; --accent:#e0c3f1; --soft:#4b394b;
}
[data-reader-gamut="warm"] body:not(.print) {background-image:repeating-linear-gradient(123deg,transparent 0 3px,#89694709 3px 4px)}
.reader-home[hidden],.reader-contents[hidden],.reader-progress[hidden],.reader-pagination[hidden] {display:none!important}
.site-header.top {min-height:0}
.site-header {transition:transform var(--motion,150ms) ease}
:root[data-reader-mode="scroll"].header-away .site-header:not(:focus-within,:has([aria-expanded="true"])) {transform:translateY(-105%)}
[data-reader-chapter="true"] .site-header .book-header {
  grid-template-columns:minmax(0,1fr) auto;min-height:2.9rem;gap:.35rem;padding-block:.2rem;
}
[data-reader-chapter="true"] .book-header :is(nav,.book-brand,#focus-mode) {display:none}
[data-reader-chapter="true"][data-focus="true"] .book-header #focus-mode {display:inline-flex}
[data-reader-chapter="true"][data-focus="true"] .book-header :is(.reader-contents,#search-open,#theme) {display:none}
.reader-home {display:inline-flex;align-items:center;gap:.3rem;justify-self:start;min-height:44px;color:var(--ink);font:600 1rem/1.22 var(--serif)}
.reader-home:hover,.reader-home:focus-visible {text-decoration:none}
.reader-home svg,.reader-pagination svg {width:1rem;height:1rem;flex:none;fill:none;stroke:currentColor;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
[data-reader-chapter="true"] .site-header .book-header .header-tools {grid-column:2;flex-wrap:nowrap;justify-content:flex-end;gap:.12rem}
[data-reader-chapter="true"] .site-header .book-header .header-tools button {min-width:44px;justify-content:center;gap:.34rem;border-color:transparent;background:transparent}
[data-reader-chapter="true"] .site-header .book-header .header-tools [aria-pressed="true"] {color:var(--accent)}
html body > button.reader-progress {
  position:fixed;inset:0 0 auto;z-index:6;width:100%;height:4px;min-height:0;padding:0;border:0;border-radius:0;
  background:linear-gradient(to right,var(--accent) var(--chapter-progress,0%),var(--line) 0);
}
.reader-progress span {position:absolute;right:.8rem;top:.7rem;max-width:90vw;padding:.3rem .7rem;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:.35rem;font-size:.84rem}
.reader-pagination {
  position:fixed;inset:auto 0 0;z-index:5;display:grid;grid-template-columns:3rem 1fr 3rem;
  align-items:center;justify-items:center;min-height:48px;
  padding:0 max(env(safe-area-inset-right),1rem) env(safe-area-inset-bottom) max(env(safe-area-inset-left),1rem);
  border-top:1px solid var(--line);background:var(--bg);color:var(--ink);font:500 1rem/1 var(--serif);
}
.reader-pagination button {display:grid;place-items:center;min-width:44px;min-height:44px;border:0;background:transparent;padding:0}
.reader-pagination button:disabled {opacity:.33}
[data-reader-mode="pages"] body {padding-bottom:calc(48px + env(safe-area-inset-bottom))}
html[data-reader-chapter="true"] #reading .chapter {grid-template-columns:minmax(0,1fr);grid-template-areas:'tools' 'head' 'content'}
[data-reader-chapter="true"] #reading .chapter-tools:not(:has([data-return]:not([hidden]))),
[data-reader-chapter="true"] #reading .chapter-tools > :not([data-return]),
[data-reader-chapter="true"] #reading .chapter-aside,
[data-reader-chapter="true"] .layout .colloid-panels,
[data-reader-chapter="true"] .layout #context {display:none}
html[data-reader-chapter="true"] body .layout {
  grid-template-columns:minmax(0,1fr);grid-template-areas:'chapter';width:min(100% - 2.5rem,72rem);margin-inline:auto;
}
[data-reader-chapter="true"] :is(.chapter-body,.chapter-head,.chapter-preview) {line-height:var(--reader-leading,1.6)}
html[data-reader-chapter="true"] #main > .chapter :is(.chapter-head,.lesson-section,.chapter-source,.chapter-nav) {
  max-width:min(100%,var(--book-measure,46rem));margin-inline:auto;
}
[data-reader-chapter="true"] #main > .chapter {--leading:var(--reader-leading,1.6)}
:root:is([data-reading-leading="compact"],[data-leading="compact"]) {--reader-leading:1.3}
:root:is([data-reading-leading="relaxed"],[data-leading="relaxed"]) {--reader-leading:1.9}
[data-reader-chapter="true"] .chapter :is(h1,h2,h3) {color:var(--ink)}
[data-reader-chapter="true"] .chapter-head h1 {max-width:none;font-size:clamp(2rem,4.5vw,3.55rem);text-wrap:balance}
[data-reader-chapter="true"] .chapter :is(.chapter-label,.section-number) {color:var(--muted)}
:root[data-reading-face="mixed"] .chapter-body,:root[data-face="mixed"] body:not(.print) .chapter .lesson-section {font-family:var(--body,system-ui)}
:root:is([data-reading-face="mixed"],[data-face="mixed"]) .chapter :is(h1,h2,h3) {font-family:var(--serif)}
:root:is([data-reading-face="golos"],[data-face="golos"]) .chapter :is(h1,h2,h3) {font-family:var(--body,system-ui)}
[data-reader-chapter="true"] .chapter :is(.formula,math,.chem-label) {font-family:var(--serif)}
[data-reader-chapter="true"] .chapter :is(.theory-reference,.glossary-term,.chapter-nav a):hover {text-decoration:none}
.chapter-complete,.check-mark[aria-pressed="true"] {color:#287747}
[data-theme="dark"] :is(.chapter-complete,.check-mark[aria-pressed="true"]) {color:#91d6aa}
.check-mark[aria-pressed="true"] .check-ring,.check-mark[aria-pressed="true"] .check-ring .progress-fill {stroke:currentColor}
.chapter :is(.check-status,[data-check-summary]) {display:none}
html[data-reader-chapter="true"] body :is(.chapter-toc,#sidebar).reader-drawer:not([hidden]) {
  display:block;position:fixed;z-index:4;inset:var(--reader-header-height,51px) auto 0 0;
  margin:0;padding:1rem;width:min(23rem,85vw);max-height:none;overflow:auto;overscroll-behavior:contain;
  border:0;border-inline-end:1px solid var(--line);border-radius:0;background:var(--surface);box-shadow:8px 0 28px #15102320;
}
.reader-drawer a[aria-current="location"] {color:var(--accent);background:var(--soft);border-radius:.25rem}
.reader-drawer .part,.reader-drawer .toc-chapter {background:transparent;border:0;border-radius:0}
html body #preferences {
  position:fixed;inset:var(--settings-top,60px) var(--settings-right,12px) auto auto;
  margin:0;padding:0;width:min(25rem,calc(100% - 24px));height:auto;
  max-height:calc(100dvh - var(--settings-top,60px) - 12px);max-width:100%;
  overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:.7rem;
  background:var(--surface);color:var(--ink);box-shadow:0 10px 40px #17112524;
}
#preferences::backdrop {background:transparent}
.settings-sheet {padding:.8rem 1rem 1rem}
.settings-sheet header {display:flex;justify-content:space-between;align-items:center;gap:.5rem}
.settings-sheet h2 {margin:0;font:600 1.24rem/1.2 var(--serif)}
.settings-sheet button {min-height:44px;padding:.42rem .52rem;font-size:.85rem}
.settings-sheet [data-close] {min-width:44px;border-color:transparent;font-size:1.35rem}
.settings-tabs {display:grid;grid-template-columns:1fr 1fr;gap:.3rem;border-block-end:1px solid var(--line);margin-block:.15rem .65rem}
.settings-tabs button {border:0;border-block-end:2px solid transparent;border-radius:0;background:transparent}
.settings-tabs button[aria-selected="true"] {border-color:var(--accent);color:var(--accent)}
.settings-sheet fieldset {margin:.5rem 0;padding:0;border:0;min-width:0}
.settings-sheet legend {margin-bottom:.24rem;color:var(--muted);font-size:.84rem}
.reader-choice-row {display:flex;flex-wrap:wrap;align-items:center;gap:.25rem}
.reader-choice-row button[aria-pressed="true"],#reading-panel button[aria-pressed="true"] {background:var(--soft);color:var(--accent);border-color:transparent}
.font-size output {min-width:3rem;text-align:center;font-variant-numeric:tabular-nums}
.font-size button {min-width:44px}
#reading-panel:not([hidden]) {display:grid;gap:.38rem;justify-items:start}
.settings-footer {margin-top:.65rem;display:flex;gap:.5rem;align-items:center}
.settings-footer button {border:0;background:transparent;color:var(--accent)}
@media(max-width:46rem) {
  .site-header .book-header nav {display:flex;flex-wrap:wrap;justify-content:flex-start;column-gap:.6rem}
  .book-header .reader-contents span {display:none}
  [data-reader-chapter="true"] .site-header .book-header #theme {font-size:.72rem;min-width:36px}
  html[data-reader-chapter="true"] body .layout {width:calc(100% - 1.2rem)}
  html[data-reader-chapter="true"] body :is(.chapter-toc,#sidebar).reader-drawer:not([hidden]) {
    inset:auto 0 0;width:100%;height:auto;max-height:85dvh;border:0;border-block-start:1px solid var(--line);
    border-radius:.8rem .8rem 0 0;animation:reader-sheet-in var(--motion,150ms) ease both;
  }
  html body #preferences {inset:auto 0 0;width:100%;max-height:87dvh;padding-bottom:env(safe-area-inset-bottom);border-radius:.8rem .8rem 0 0}
  #preferences[open] {animation:reader-sheet-in var(--motion,150ms) ease both}
  #preferences::backdrop {background:#15102355}
}
@keyframes reader-sheet-in {from {transform:translateY(1.2rem);opacity:0}to {transform:translateY(0);opacity:1}}

/* Scientific objects and personal records */
[data-reader-chapter="true"] .chapter-head {background-image:none}
.chapter-outline {margin-block:.9rem 0}
.chapter-outline summary {color:var(--accent)}
[data-reader-chapter="true"] :is(.theory-reference,.term-inline,.reader-home):is(:hover,:focus-visible) {text-decoration:none}
[data-reader-chapter="true"] .theory-reference {border:0;color:var(--accent)}
[data-reader-chapter="true"] .chapter :is(.reaction-frame,.academic-table,.science,.formula) {border:0;background:transparent}
[data-reader-chapter="true"] .chapter :is(.reaction-frame,.academic-table) {padding-inline:0}
[data-reader-chapter="true"] .chapter :is(.table-wrap,.diagram-scroll,.math-scroll) {overflow-x:auto;max-width:100%}
[data-reader-chapter="true"] .chapter .table-wrap th,[data-reader-chapter="true"] .chapter .table-wrap td {border-inline:0;padding:.48rem .6rem}
[data-reader-chapter="true"] .chapter .table-wrap tr:nth-child(even) {background:color-mix(in srgb,var(--soft) 48%,transparent)}
[data-reader-chapter="true"] .chapter .check-mark[aria-pressed="true"] {background:transparent}
.chapter :is(.check-question,.self-check) details > summary {
  display:flex;align-items:center;justify-content:space-between;gap:.65rem;list-style:none;padding-inline-end:.2rem;
}
.chapter :is(.check-question,.self-check) details > summary::-webkit-details-marker {display:none}
.chapter :is(.check-question,.self-check) details > summary::before {display:none}
.chapter :is(.check-question,.self-check) details > summary::after {
  content:'';flex:none;width:.46rem;height:.46rem;margin-inline-end:.22rem;
  border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);
}
.chapter :is(.check-question,.self-check) details[open] > summary::after {transform:rotate(225deg)}
.reader-notebook {padding-block:1.75rem;border-top:1px solid var(--line);margin-block:2rem;color:var(--ink)}
.reader-record-tabs {display:flex;flex-wrap:wrap;align-items:center;gap:.15rem .4rem;border-block-end:1px solid var(--line);margin-block-end:.65rem}
.reader-record-tabs > button {min-height:44px;background:transparent;border:0;border-bottom:2px solid transparent;border-radius:0;padding:.35rem .45rem}
.reader-record-tabs > button[aria-pressed="true"] {color:var(--accent);border-color:var(--accent)}
.reader-record-filter {position:relative;margin:0 0 0 auto;padding:0;border:0;background:transparent}
.reader-record-filter[open] {min-width:9rem}
.reader-record-filter summary {display:grid;place-items:center;list-style:none;min-height:44px;min-width:44px}
.reader-record-filter summary::-webkit-details-marker {display:none}
.reader-record-filter svg {width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.3}
.reader-record-filter button {display:block;width:100%;margin-block:.2rem;text-align:start}
.reader-records {list-style:none;padding:0;margin:0}
.reader-records li {padding:.6rem 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.reader-records li p {margin:.3rem 0 0;color:var(--muted)}
.reader-records a:hover {text-decoration:none}
.reader-toast {position:fixed;z-index:9;inset:auto 1rem 4rem auto;padding:.45rem .8rem;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:.5rem;box-shadow:0 6px 22px #15102322}
.reader-markers {display:flex;flex-wrap:wrap;gap:.4rem;margin-block:.6rem}
.reader-markers button {min-height:44px;min-width:44px}
.reader-markers button[style] {background:var(--swatch);color:#211c2b}
.reader-markers button:focus-visible {outline-color:#291c36}
.bookmark-flag,.reaction-reading-menu summary {
  display:inline-grid;place-items:center;min-height:44px;min-width:44px;list-style:none;padding:0;
  color:var(--accent);background:transparent;border:0;
}
.bookmark-flag svg,.reaction-reading-menu summary svg,.margin-note summary svg {width:1.12rem;height:1.12rem;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.bookmark-flag[aria-pressed="true"] svg,.reaction-reading-menu[data-saved="true"] summary svg {fill:currentColor}
[data-reader-chapter="true"] #reading .chapter .margin-notes {position:static;width:auto}
.chapter :is(.margin-note,.margin-notes details) {padding:0 0 .25rem;background:none;border:0}
.chapter :is(.margin-note,.margin-notes details) summary {display:inline-flex;align-items:center;gap:.3rem;min-height:44px;list-style:none;color:var(--accent)}
.chapter :is(.margin-note,.margin-notes details) summary::after {content:none}
.chapter :is(.margin-note,.margin-notes details) summary::-webkit-details-marker {display:none}
.chapter .reaction-frame {position:relative;min-height:4rem;padding-inline-end:2.9rem}
.chapter .reaction-frame > .reaction-reading-menu {position:absolute;inset:.2rem .15rem auto auto;opacity:0}
.chapter .reaction-frame:is(:hover,:focus-within) > .reaction-reading-menu,.chapter .reaction-reading-menu[data-saved="true"] {opacity:1}
.reaction-reading-menu {position:relative;margin:0;padding:0;background:transparent;border:0}
.reaction-reading-menu summary::-webkit-details-marker {display:none}
.reaction-reading-menu summary::after {display:none}
.reaction-reading-menu > div {position:absolute;inset:100% 0 auto auto;z-index:2;min-width:max-content;padding:.2rem;background:var(--surface);border:1px solid var(--line);border-radius:.35rem}
.reaction-reading-menu > div button {display:block;width:100%;border:0;text-align:start}
.zoom-dialog .reaction-reading-menu > div {inset:auto auto 100% 0}
:is(.zoom-picture,#zoom-content) {overflow:auto}
:is(.zoom-picture,#zoom-content).magnified > :first-child {zoom:1.6}
html body #zoom > header {display:grid;grid-template-columns:auto auto 1fr;gap:.45rem}
#zoom > header h2 {grid-column:1/-1;margin:0;min-width:0;overflow-wrap:break-word}
#zoom > header form {justify-self:end}
#zoom > header button {min-height:44px}
html body #zoom-content:not(.magnified) .diagram {
  display:block;min-width:0;max-width:calc(100% - 1rem);height:auto;margin-inline:auto;overflow:visible;
}
.diagram-zoom {display:block;min-width:max-content;margin:auto;padding:.3rem;border:0;background:transparent}
.formula-display {display:flex;align-items:center;justify-content:center;gap:.8rem}
.formula-display .math-scroll {min-width:0}
.formula-definition,.figure-explanation {position:relative;margin:0;padding:0;border:0;background:transparent}
.formula-definition summary,.figure-explanation summary {display:grid;place-items:center;min-width:44px;min-height:44px;list-style:none;color:var(--accent)}
.formula-definition summary::-webkit-details-marker,.figure-explanation summary::-webkit-details-marker {display:none}
.formula-definition summary::after {content:'';width:.43rem;height:.43rem;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}
.formula-definition[open] summary::after {transform:rotate(225deg)}
.figure-explanation {display:inline-block;vertical-align:middle}
.figure-explanation[open] {display:block;text-align:start}
.book-search mark,.search-results mark {background:var(--soft);color:var(--accent);border-radius:.15rem}
.book-search li > p {margin:.2rem 0 .45rem}
[data-reader-chapter="true"] #editor-dialog.glossary-popover {inset:var(--definition-y,20px) auto auto var(--definition-x,12px);width:min(24rem,calc(100% - 24px));max-height:58dvh;border-radius:.65rem}
@media (pointer:coarse) {
  .chapter .reaction-frame > .reaction-reading-menu:not([data-saved="true"]) {display:none}
}
@media (max-width:46rem) {
  html body #editor-dialog.zoom-dialog,html body #zoom {inset:0;margin:0;width:100%;height:100%;max-width:none;max-height:none;border:0;border-radius:0}
}

[data-reader-chapter="true"] .chapter .reaction-frame {overflow:visible}
[data-reader-chapter="true"] .chapter .reaction-frame .equation {
  width:100%;overflow-x:auto;flex-wrap:nowrap;justify-content:safe center;
}
.chapter .reaction-frame .equation > * {flex:none}

html[data-reader-chapter="true"] body > .site-header {position:fixed;inset:0 0 auto;z-index:5}
html[data-reader-chapter="true"] body {padding-top:var(--reader-header-height,51px)}

[data-reader-chapter="true"] .chapter [data-semantic] {border:0;border-inline-start:2px solid var(--meaning,var(--accent));padding-inline:.85rem 0;background:transparent;border-radius:0}
[data-semantic="rule"] {--meaning:#70529b}
[data-semantic="caution"] {--meaning:#92631e}
[data-semantic="error"] {--meaning:#a34451}
[data-semantic="result"] {--meaning:#327b53}
[data-semantic="extra"] {--meaning:#486f9c}
[data-theme="dark"] [data-semantic="rule"] {--meaning:#bc9ae4}
[data-theme="dark"] [data-semantic="caution"] {--meaning:#e1b466}
[data-theme="dark"] [data-semantic="error"] {--meaning:#f39aa5}
[data-theme="dark"] [data-semantic="result"] {--meaning:#8dceaa}
[data-theme="dark"] [data-semantic="extra"] {--meaning:#95b9e8}

@media(min-width:46.001rem) {
  html[data-reader-chapter="true"] body :is(.chapter-toc,#sidebar).reader-drawer:not([hidden]) {
    grid-area:auto;inset-block:var(--reader-header-height,52px) auto;
    height:calc(100dvh - var(--reader-header-height,52px));align-self:auto;
  }
}

html[data-reader-mode="pages"] {overscroll-behavior:none}

.zoom-dialog .reaction-reading-menu {order:2;margin-inline-start:auto}
.zoom-dialog .reaction-reading-menu > div {inset:auto 0 100% auto}

.reader-contents svg {display:block;flex:none;transform:none;align-self:center}
.reader-contents span {display:block;line-height:1}
.book-header .header-tools button {align-items:center}
[data-direct-zoom] {cursor:zoom-in}
[data-direct-zoom] :is(button,input,summary,details,a) {cursor:auto}
html[data-book-pointer] :is(button.check-mark,button.self-mark):focus {outline:0;box-shadow:none}
html:not([data-book-pointer]) :is(button.check-mark,button.self-mark):focus-visible {
  outline:2px solid currentColor;outline-offset:-2px;border-radius:50%;
}
:is(.check-mark,.self-mark)[aria-pressed="true"] {color:light-dark(#216b45,#91d5ab)}
.self-mark[aria-pressed="true"]::before,.self-mark[aria-pressed="true"]::after {border-color:currentColor}
.check-mark {position:relative}
.check-mark[data-book-guide-checked] svg {visibility:hidden}
.check-mark[data-book-guide-checked]::after {content:"✓";position:absolute;inset:0;display:grid;place-items:center}
:is(.check-question,.self-check) details::details-content {
  interpolate-size:allow-keywords;block-size:0;overflow:clip;opacity:0;
  transition:block-size .19s ease,opacity .19s ease,content-visibility .19s allow-discrete;
}
:is(.check-question,.self-check) details[open]::details-content {block-size:auto;opacity:1}
html body :is(#preferences,#book-search) {
  opacity:0;translate:0 .35rem;
  transition:opacity .19s ease,translate .19s ease,display .19s allow-discrete,overlay .19s allow-discrete;
}
html body :is(#preferences,#book-search)[open] {opacity:1;translate:0 0}
@starting-style {
  html body :is(#preferences,#book-search)[open] {opacity:0;translate:0 .35rem}
}
@media(prefers-reduced-motion:reduce) {
  html body :is(#preferences,#book-search),:is(.check-question,.self-check) details::details-content {transition:none}
}
html[data-motion="false"] body :is(#preferences,#book-search),
html[data-motion="false"] :is(.check-question,.self-check) details::details-content {transition:none}

.book-guide {
  position:fixed;z-index:11;inset:auto auto max(.5rem,env(safe-area-inset-bottom)) 50%;translate:-50% 0;
  box-sizing:border-box;width:min(34rem,calc(100vw - 1rem));padding:.7rem 1rem;
  border:1px solid var(--line);border-radius:.7rem;background:var(--surface);color:var(--ink);
  box-shadow:0 5px 25px #21183144;font:.9rem/1.35 var(--sans,system-ui);
}
[data-reader-mode="pages"] body > .book-guide {bottom:3.6rem}
html[data-book-guide] .site-header {transform:none!important}
html[data-book-guide][data-reader-chapter="true"] .book-header .reader-contents {display:inline-flex}
.book-guide header {display:flex;align-items:center;justify-content:space-between;gap:.45rem}
.book-guide p {margin:.3rem 0 .45rem}
.book-guide button {min-height:2.75rem}
.book-guide header button {min-width:2.75rem;line-height:1;font-size:1.25rem}
[data-book-guide-target] {outline:2px solid var(--accent)!important;outline-offset:3px!important;scroll-margin-block:5rem 9rem}
dialog > .book-guide {position:sticky;inset:auto 0 0;translate:none;width:auto;margin:.4rem .45rem}
html[data-reader-mode="pages"] {--reader-pagination-inset:3.6rem}
html body > .selection-tools {z-index:12}
@media(max-width:46rem) {
  html body > .selection-tools {
    inset:auto .5rem calc(max(.5rem,env(safe-area-inset-bottom)) + var(--reader-pagination-inset,0px) + var(--reader-guide-inset,0px)) !important;
    transform:none;justify-content:center;
  }
}
