@font-face { font-family: "Sorts Mill Goudy"; src: url("fonts/SortsMillGoudy-Regular.ttf"); font-style: normal; }
@font-face { font-family: "Sorts Mill Goudy"; src: url("fonts/SortsMillGoudy-Italic.ttf"); font-style: italic; }
:root { --band:#e8edf2; --sidehead:#3d5a78; --sideq:#2368b0; --sidew:minmax(15rem, 21rem); --ink:#1d1b18; --muted:#6b645a; --rule:#b9b1a4; --paper:#fffdf8; --lds:#7a5c1e; --tn:#2f5d7c; --bar:#fffdf8;
  --btn:#faf7f0; --card:#fff; --accent:#7a5c1e; --onaccent:#fff; --flash:#f6edd6; --scrim:rgba(40,35,25,.25);
  --bandrule:#b5c3d1; --bandline:#cdd6df; --bandink:#24303c; --bandmuted:#56626e; color-scheme: light;
  --font-body: "Sorts Mill Goudy", Georgia, serif; --fs: 20px; --lh: 1.42; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-variant-numeric: lining-nums; margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body);
  font-size: var(--fs); -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; color: inherit; }
/* toolbar */
#bar { transition: padding-left .25s cubic-bezier(.2,.8,.2,1); position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem;
  padding: calc(.45rem + env(safe-area-inset-top)) .8rem .45rem; background: var(--bar); border-bottom: 1px solid var(--rule);
  font-family: -apple-system, system-ui, sans-serif; font-size: .78rem; }
#bar .tb { border: 1px solid var(--rule); background: var(--btn); border-radius: 6px; padding: .3rem .6rem; cursor: pointer; }
#bar .tb.ib { border: 0; background: none; color: var(--accent); width: 2.6rem; height: 2.3rem; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 9px; }
#bar .tb.ib svg { width: 1.45rem; height: 1.45rem; }
#bar .tb.ib.on { background: color-mix(in srgb, var(--accent) 15%, transparent); }
#bar .tb.aa { font-family: -apple-system, system-ui, sans-serif; font-size: 1.15rem; font-weight: 500; letter-spacing: -.02em; }
#bar .tb.aa small { font-size: .72em; }
#bar .title { color: var(--ink); }
#bar .title { font-family: "Sorts Mill Goudy", serif; font-size: 1.05rem; border: 0; background: none; letter-spacing: .02em; }
#bar .sp { flex: 1; }
#bar .sel select { border: 1px solid var(--rule); border-radius: 6px; background: var(--btn); padding: .2rem .3rem; max-width: 13rem; }
#bar label.tog { display: inline-flex; align-items: center; gap: .3rem; }
#bar .tog input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
#bar .cnt:not(:empty) { background: var(--tn); color: var(--onaccent); border-radius: 999px; padding: 0 .4em; font-size: .8em; }
/* page */
#page { max-width: 46rem; margin: 0 auto; padding: 1rem 1.2rem 6rem; }
.welcome { text-align: center; margin-top: 18vh; }
.welcome h1 { font-weight: normal; font-size: 2.6rem; letter-spacing: .03em; margin: 0 0 .5rem; }
.welcome p { color: var(--muted); max-width: 30rem; margin: .6rem auto; line-height: 1.45; }
.btn { border: 1px solid var(--rule); background: var(--btn); border-radius: 8px; padding: .45rem 1rem; cursor: pointer; font-family: -apple-system, system-ui, sans-serif; font-size: .9rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--onaccent); }
.booktitle { text-align: center; margin: 1.2rem 0 1rem; text-transform: uppercase; }
.booktitle .t-pre { font-size: 1.3rem; letter-spacing: .07em; }
.booktitle .t-mid { font-size: .78rem; letter-spacing: .12em; margin-top: .15rem; }
.booktitle .t-main { font-size: 3.1rem; line-height: 1.1; letter-spacing: .02em; margin-top: .25rem; }
.booktitle .t-by { font-size: .82rem; letter-spacing: .1em; margin-top: .3rem; }
h2.chap, .row { scroll-margin-top: 7.5rem; }
h2.chap { text-align: center; text-transform: uppercase; font-weight: normal; font-size: 1.02rem; letter-spacing: .06em;
  margin: 2rem 0 .7rem; }
p.v, .pl { margin: 0 0 .12rem; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
p.v { text-indent: .6em; }
p.v.open { text-indent: 0; display: flow-root; }   /* contain the drop cap */
.pl { text-align: left; padding-left: calc(.6em + 1.6em); text-indent: -1.6em; }
.pl.l1 { padding-left: 3.2em; } .pl.l2 { padding-left: 4.2em; } .pl.l3 { padding-left: 5.2em; }
p.title { text-align: center; font-size: .86em; margin: .1rem 0 .5rem; text-indent: 0; }
.vn { font-variant-numeric: lining-nums; cursor: pointer; }
.sc, .fw { font-size: .8em; letter-spacing: .02em; }
.dropcap { float: left; font-size: 3.05em; line-height: .82; margin: .06em .08em 0 0; }
.row.flash, .row:target { background: var(--flash); }
sup.m { cursor: pointer; font-size: .62em; line-height: 0; padding: 0 .06em; }
sup.m.lds { font-style: italic; color: var(--lds); }
sup.m.tn { color: var(--tn); font-family: Georgia, serif; font-size: .55em; }
.notes { font-size: .78rem; line-height: 1.35; margin: .9rem 0 0; padding-top: .45rem; border-top: 1px solid var(--rule); }
.notes .nh { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.notes ol { list-style: none; padding: 0; margin: 0; columns: 2 16rem; column-gap: 1.6rem; column-rule: 1px solid var(--rule); }
.notes li { break-inside: avoid; margin: 0 0 .2rem; padding-left: 1.6em; text-indent: -1.6em; }
.notes .nl { margin-right: .25em; } .notes.lds .nl { color: var(--lds); } .notes.tn .nl { color: var(--tn); }
.notes.tn ol { columns: 1; }
.notes .nv { color: var(--muted); font-size: .9em; }
.booknav { display: flex; justify-content: space-between; margin: 2.5rem 0 0; gap: 1rem; }
/* popups & overlays */
#note-pop { position: absolute; z-index: 2000; max-width: min(28rem, 92vw); background: var(--card); border: 1px solid var(--rule);
  box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: .55rem .75rem; font-size: .85rem; line-height: 1.4; border-radius: 6px; display: none; }
#note-pop .nl { color: var(--muted); margin-right: .3em; }
.overlay { position: fixed; inset: 0; z-index: 1500; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start;
  padding: calc(3.5rem + env(safe-area-inset-top)) 1rem 1rem; }
.overlay[hidden] { display: none; }
.sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.2);
  width: min(52rem, 100%); max-height: 100%; overflow-y: auto; padding: 1rem 1.2rem 1.4rem; }
.sheet h3 { font-weight: normal; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; color: var(--muted); margin: 1rem 0 .4rem; }
.sheet .close { float: right; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .3rem; }
.grid button { text-align: left; border: 1px solid transparent; background: none; padding: .3rem .4rem; border-radius: 6px; cursor: pointer; }
.grid button:hover, .grid button.cur { border-color: var(--rule); background: var(--btn); }
.grid button.missing { color: var(--muted); }
.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: .3rem; }
.chgrid button { border: 1px solid var(--rule); background: var(--btn); border-radius: 6px; padding: .35rem 0; cursor: pointer; }
.packrow { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .55rem 0; border-bottom: 1px dotted var(--rule);
  font-family: -apple-system, system-ui, sans-serif; font-size: .85rem; }
.packrow .pt { font-family: "Sorts Mill Goudy", serif; font-size: 1.05rem; }
.packrow .pm { color: var(--muted); font-size: .78rem; }
.libopts { font-family: -apple-system, system-ui, sans-serif; font-size: .85rem; }
.libopts label { margin-right: 1rem; }
/* highlights & notes (same as the website) */
mark.hl { padding: 0; border-radius: 2px; color: inherit; cursor: pointer; }
.hl-yellow { background: rgba(255,221,87,.55); } .hl-green { background: rgba(140,214,140,.5); }
.hl-blue { background: rgba(125,185,240,.45); } .hl-pink { background: rgba(245,150,190,.45); }
.note-ico { border: 0; background: none; padding: 0 0 0 .25em; margin: 0; color: var(--tn); font-size: .9em; cursor: pointer; font-family: Georgia, serif; }
.annot-menu, .annot-pop { position: absolute; z-index: 2100; display: none; background: var(--card); border: 1px solid var(--rule);
  box-shadow: 0 6px 24px rgba(0,0,0,.15); border-radius: 8px; font-family: -apple-system, system-ui, sans-serif; font-size: .85rem; }
.annot-menu { padding: .35rem .4rem; white-space: nowrap; }
.annot-menu .sw { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin: 0 .15rem; vertical-align: middle; cursor: pointer; }
.sw-yellow { background: #ffdd57; } .sw-green { background: #8cd68c; } .sw-blue { background: #7db9f0; } .sw-pink { background: #f596be; }
.annot-menu .act, .annot-pop button, .annot-panel button { border: 1px solid var(--rule); background: var(--btn); border-radius: 6px;
  padding: .3rem .65rem; margin-left: .3rem; cursor: pointer; }
.annot-pop { width: min(34rem, 94vw); padding: .65rem .75rem; }
.annot-pop .ah { font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
.annot-pop blockquote { margin: 0 0 .4rem; padding: .2rem .5rem; border-left: 3px solid var(--rule); font-family: "Sorts Mill Goudy", serif; color: var(--muted); }
.annot-pop textarea { width: 100%; font: inherit; font-size: .95rem; border: 1px solid var(--rule); border-radius: 6px; padding: .4rem; }
.annot-pop .ab { margin-top: .45rem; text-align: right; }
.annot-pop .primary { background: var(--accent); color: var(--onaccent); border-color: var(--accent); }
.annot-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(24rem, 94vw); background: var(--paper); z-index: 2050;
  border-left: 1px solid var(--rule); box-shadow: -6px 0 24px rgba(0,0,0,.12); padding: calc(.9rem + env(safe-area-inset-top)) 1rem 2rem;
  overflow-y: auto; transform: translateX(105%); transition: transform .2s ease; font-size: .92rem; }
.annot-panel.open { transform: none; }
.annot-panel .ph { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; }
.annot-panel .pt, .annot-panel .pf, .annot-panel .pe0 { color: var(--muted); font-size: .82rem; margin: .3rem 0; font-family: -apple-system, system-ui, sans-serif; }
.annot-panel .ps { margin-top: .9rem; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule); }
.annot-panel .pi { padding: .4rem 0; border-bottom: 1px dotted var(--rule); }
.annot-panel .pi a { color: var(--tn); text-decoration: none; }
.annot-panel .pq { color: var(--muted); font-size: .88rem; }
.annot-panel .pn { margin-top: .15rem; font-size: .85rem; }
.annot-panel .dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; }
.snote { font-family: -apple-system, system-ui, sans-serif; font-size: .74rem; line-height: 1.42; color: var(--bandink); }
.side .snote { position: absolute; left: 1rem; right: 1rem; z-index: 1; padding: 0 0 .4rem; cursor: pointer; border-bottom: 1px solid var(--bandline); }
.snote > :first-child { margin-top: 0; }
.snote p { margin: .3em 0; }
.snote h3, .snote h4 { color: var(--sidehead); font-size: 1.32em; line-height: 1.25; font-weight: 700; margin: .5em 0 .35em; }
.snote h5, .snote h6 { color: var(--sideq); font-size: 1.04em; font-weight: 700; margin: .4em 0 .1em; }
.snote .sref { color: var(--sideq); font-weight: 700; }
.snote .sq { font-style: italic; color: var(--bandmuted); }
.snote ul, .snote ol { margin: .3em 0; padding-left: 1.3em; }
.snote blockquote { margin: .35em 0; padding: .05em .6em; border-left: 3px solid var(--bandrule); color: var(--bandmuted); }
.snote code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; background: rgba(0,0,0,.05); padding: 0 .2em; border-radius: 3px; }
.snote hr { border: 0; border-top: 1px solid var(--bandrule); margin: .6em 0; }
.snote a.mdlink { color: var(--sideq); }
.annot-pop .mdprev { background: var(--band); border-radius: 6px; padding: .55rem .8rem; min-height: 9rem; max-height: 50vh; overflow-y: auto; }
.annot-pop .mdhint { color: var(--muted); font-size: .72rem; margin-top: .3rem; }
.annot-pop .ab .lft { float: left; margin-left: 0; }
.colheads .sharebtn { border: 0; background: none; color: var(--sideq); font: inherit; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; padding: 0 0 0 .6em; }

/* ---- columns: 1–3 texts side by side (--ncol set on #page), plus the optional notes band */
#page { --ncol: 1; }
body.cols-2 #page { max-width: 74rem; }
body.cols-3 #page { max-width: 100rem; font-size: .88em; }
body.notescol.cols-1 #page { max-width: 70rem; }
body.notescol.cols-2 #page { max-width: 98rem; }
body.notescol.cols-3 #page { max-width: 120rem; font-size: .84em; }
.row { line-height: var(--lh); }
.row, .nrow, .colheads { display: grid; grid-template-columns: repeat(var(--ncol), minmax(0, 1fr)); column-gap: 2.2rem; }
body.notescol .row, body.notescol .nrow, body.notescol .colheads { grid-template-columns: repeat(var(--ncol), minmax(0, 1fr)) var(--sidew); }
.row > .cell + .cell { position: relative; }
.row > .cell + .cell::before { content: ""; position: absolute; left: -1.1rem; top: 0; bottom: 0; border-left: 1px solid var(--rule); }
.colheads { text-align: center; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.colheads .ch-text { padding-top: .45rem; }
body.cols-1:not(.notescol) .colheads { display: none; }
body.cols-1 .colheads .ch-text { visibility: hidden; }
.side, .colheads .ch-side { display: none; }
body.notescol .colheads .ch-side { display: block; background: var(--band); color: var(--sidehead); padding: .45rem 0 .2rem; }
body.notescol .side { display: block; background: var(--band); position: relative; }
body.notescol .note-ico { display: none; }
.colheads .sharebtn { border: 0; background: none; color: var(--sideq); font: inherit; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; padding: 0 0 0 .6em; }
@media (max-width: 1100px) {
  body.notescol.cols-2, body.cols-3 { --sidew: minmax(12rem, 15rem); }
  body.notescol.cols-2 #page { font-size: .88em; }
  body.cols-3 #page { font-size: .8em; padding-left: .7rem; padding-right: .7rem; }
  body.cols-3 .row, body.cols-3 .nrow, body.cols-3 .colheads { column-gap: 1.4rem; }
  body.cols-3 .row > .cell + .cell::before { left: -.7rem; }
}
@media (max-width: 760px) {
  body { font-size: calc(var(--fs) * .9); }
  body.notescol .row, body.notescol .nrow, body.notescol .colheads { grid-template-columns: repeat(var(--ncol), minmax(0, 1fr)); }
  body.notescol .side, body.notescol .colheads .ch-side { display: none; }
  body.notescol .note-ico { display: inline; }
  .row, .nrow, .colheads { column-gap: 1rem; }
  .row > .cell + .cell::before { left: -.5rem; }
  body.parallel #page { font-size: .9em; padding: .8rem .6rem 5rem; }
}


/* ---- themes: sepia (default, above), light, dark */
:root[data-theme="light"] { --paper:#ffffff; --bar:#ffffff; --ink:#16181b; --muted:#646a72; --rule:#d3d6db; --btn:#f3f4f6; --card:#fff;
  --accent:#5b4a2c; --lds:#8a6420; --tn:#2c5d86; --flash:#fff3c4; --band:#eef2f6; --sidehead:#34506d; --sideq:#1f63aa;
  --bandrule:#bccad8; --bandline:#d5dde6; --bandink:#1f2933; --bandmuted:#55606b; }
:root[data-theme="dark"] { --paper:#17181a; --bar:#1d1e21; --ink:#e4e0d8; --muted:#9a958c; --rule:#3d3c39; --btn:#26272b; --card:#222326;
  --accent:#c9a25a; --onaccent:#17181a; --lds:#d2ab61; --tn:#8fbbe3; --flash:#3a3424; --scrim:rgba(0,0,0,.55);
  --band:#1e2731; --sidehead:#a9c3df; --sideq:#82b4ec; --bandrule:#3b4d61; --bandline:#2e3c4b; --bandink:#d7dee6; --bandmuted:#a3aeb9;
  color-scheme: dark; }
:root[data-theme="dark"] mark.hl { color: #17181a; }
:root[data-theme="dark"] .hl-yellow { background: rgba(240,205,80,.75); } :root[data-theme="dark"] .hl-green { background: rgba(130,200,130,.7); }
:root[data-theme="dark"] .hl-blue { background: rgba(120,175,235,.7); } :root[data-theme="dark"] .hl-pink { background: rgba(235,140,180,.7); }
:root[data-theme="dark"] .snote code { background: rgba(255,255,255,.08); }

/* ---- sidebar (Apple-style grouped lists) */
:root { --sb-bg:#f3eee3; --group:#fffdf8; --sep:#e3dac8; --ui:-apple-system, system-ui, "Helvetica Neue", sans-serif; --danger:#c0392b; }
:root[data-theme="light"] { --sb-bg:#f2f2f7; --group:#ffffff; --sep:#e3e3e8; }
:root[data-theme="dark"] { --sb-bg:#1c1c1e; --group:#2c2c2e; --sep:#3a3a3c; --danger:#ff6b5e; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(22rem, 90vw); z-index: 1400; background: var(--sb-bg);
  border-right: 1px solid var(--sep); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem 2.5rem; transform: translateX(-105%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
  font-family: var(--ui); font-size: 1rem; color: var(--ink); }
.drawer.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.08); }
.drawer button { font-family: var(--ui); color: inherit; }
.drawer .ic { width: .95rem; height: .95rem; flex: none; }
.drawer .chev { width: .5rem; height: .85rem; color: var(--muted); opacity: .7; }
.sb-top { display: flex; align-items: center; justify-content: space-between; min-height: 2.6rem; }
.sb-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.sb-title2 { font-size: 1.6rem; font-weight: 700; margin: .2rem 0 .9rem; }
.sb-x, .sb-back { border: 0; background: none; color: var(--accent); font-size: 1rem; padding: .4rem 0; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.sb-back .ic { width: .6rem; height: 1.05rem; }
.seg { display: flex; background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 9px; padding: 2px; margin: .6rem 0 .2rem; }
.seg button { flex: 1; border: 0; background: none; border-radius: 7px; padding: .42rem .3rem; font-size: .86rem; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--group); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }
.sec-h { margin: 1.4rem .9rem .4rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.sec-f { margin: .45rem .9rem 0; font-size: .78rem; line-height: 1.35; color: var(--muted); }
.group { background: var(--group); border-radius: 11px; overflow: hidden; }
.srow, .srow-wrap { position: relative; }
.srow { display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 2.9rem; padding: .5rem .9rem; border: 0; background: var(--group);
  text-align: left; font-size: 1rem; cursor: pointer; transition: transform .2s ease; touch-action: pan-y; }
.group > .srow + .srow::before, .group > .srow-wrap + .srow::before, .group > .srow-wrap + .srow-wrap > .srow::before,
.group > .srow + .srow-wrap > .srow::before {
  content: ""; position: absolute; top: 0; left: .9rem; right: 0; border-top: .5px solid var(--sep); }
.srow:active:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, var(--group)); }
.srow:disabled { cursor: default; }
.srow:disabled .t1 { color: var(--muted); }
.srow .grow { flex: 1; min-width: 0; }
.srow .t1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .t2 { display: block; font-size: .8rem; color: var(--muted); margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .val { color: var(--muted); font-size: .95rem; }
.srow .accent { color: var(--accent); }
.srow.danger .t1 { color: var(--danger); text-align: center; }
.srow.add { color: var(--accent); }
.srow.add .ic { width: .85rem; height: .85rem; }
.srow .ck { color: var(--accent); width: 1rem; }
.srow.tr { gap: .55rem; padding-left: .55rem; }
.srow.tr .rmain { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: .1rem 0; cursor: pointer; font-size: 1rem; }
.grip { color: var(--muted); opacity: .55; padding: .5rem .25rem; cursor: grab; touch-action: none; display: inline-flex; }
.grip .ic { width: 1rem; }
.chevw { display: inline-flex; }
.srow-wrap .del { position: absolute; top: 0; right: 0; bottom: 0; width: 92px; border: 0; background: var(--danger); color: #fff;
  font-size: .95rem; font-weight: 500; z-index: 0; cursor: pointer; }
.srow-wrap > .srow { z-index: 1; }
.srow-wrap.open > .srow { transform: translateX(-92px); }
.srow-wrap.dragging { z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.18); border-radius: 11px; }
.srow-wrap.dragging > .srow { background: color-mix(in srgb, var(--accent) 6%, var(--group)); }
/* iOS switch */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 31px; background: color-mix(in srgb, var(--ink) 16%, transparent); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
/* portrait: the sidebar floats over the text with a scrim; landscape: it pushes the text */
#scrim { position: fixed; inset: 0; z-index: 1390; background: rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .25s; }
@media (max-width: 999px) { body.drawer-open #scrim { opacity: 1; pointer-events: auto; } }
@media (min-width: 1000px) {
  body.drawer-open #page, body.drawer-open .booknav { margin-left: min(22rem, 90vw); }
  body.drawer-open #bar { padding-left: calc(min(22rem, 90vw) + .8rem); }
  body.drawer-open #b-drawer { color: var(--accent); }
  .drawer .sb-x { display: none; }
}
/* ---- Aa popover */
.aa-pop { position: fixed; z-index: 2200; top: calc(3.4rem + env(safe-area-inset-top)); right: .8rem; width: min(20rem, 92vw);
  background: var(--group); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.22), 0 0 0 .5px rgba(0,0,0,.08);
  padding: .9rem; font-family: var(--ui); color: var(--ink); max-height: 80vh; overflow-y: auto; }
.aa-pop[hidden] { display: none; }
.aa-pop button { font-family: inherit; color: inherit; cursor: pointer; }
.aa-themes { display: flex; justify-content: space-around; margin-bottom: .9rem; }
.aa-theme { width: 3.1rem; height: 3.1rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); font-family: Georgia, serif !important; font-size: 1.05rem; }
.aa-theme.t-light { background: #fff; color: #16181b !important; }
.aa-theme.t-sepia { background: #f4ecd8; color: #3b2f1e !important; }
.aa-theme.t-dark { background: #1c1c1e; color: #e4e0d8 !important; border-color: #444; }
.aa-theme.on { box-shadow: 0 0 0 2.5px var(--group), 0 0 0 4.5px var(--accent); }
.aa-size { display: flex; align-items: center; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 10px; margin-bottom: .7rem; }
.aa-size button { flex: 1; border: 0; background: none; padding: .55rem 0; font-family: Georgia, serif !important; }
.aa-size .aa-val { min-width: 4.2rem; text-align: center; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums;
  border-left: .5px solid var(--sep); border-right: .5px solid var(--sep); }
.aa-lh { display: flex; gap: .4rem; margin-bottom: .8rem; }
.aa-lh button { flex: 1; border: 0; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 10px; padding: .5rem 0 .4rem;
  display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.aa-lh button.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.aa-lh small { font-size: .68rem; }
.aa-lh .lines { display: flex; flex-direction: column; width: 1.4rem; }
.aa-lh .lines i { display: block; height: 2px; background: currentColor; border-radius: 1px; }
.aa-lh .l-compact i + i { margin-top: 2px; } .aa-lh .l-normal i + i { margin-top: 4px; } .aa-lh .l-relaxed i + i { margin-top: 6px; }
.aa-fonts { border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.aa-fonts button { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none;
  padding: .62rem .8rem; font-size: 1.05rem; text-align: left; position: relative; }
.aa-fonts button + button::before { content: ""; position: absolute; top: 0; left: .8rem; right: 0; border-top: .5px solid var(--sep); }
.aa-fonts .ck { width: 1rem; height: .9rem; color: var(--accent); }
sup.msep { font-size: .62em; line-height: 0; color: var(--muted); }
body.hide-summaries p.title.summary { display: none; }
p.title.summary { font-style: normal; color: var(--muted); }
body { padding-top: var(--barh, 4.75rem); }
h2.chap, .row { scroll-margin-top: calc(var(--barh, 4.75rem) + 1rem); }

/* ---- underline style for highlights (stored as colour "u-<colour>" in DuckDB) */
mark.hl.ul { background: none !important; text-decoration: underline; text-decoration-thickness: .14em; text-underline-offset: .2em; text-decoration-skip-ink: none; }
mark.hl.ul.hl-yellow { text-decoration-color: #e0ad00; } mark.hl.ul.hl-green { text-decoration-color: #3c9e4a; }
mark.hl.ul.hl-blue { text-decoration-color: #2b7bd0; } mark.hl.ul.hl-pink { text-decoration-color: #d6458a; }
:root[data-theme="dark"] mark.hl.ul { color: inherit; }
:root[data-theme="dark"] mark.hl.ul.hl-yellow { text-decoration-color: #f0cd50; } :root[data-theme="dark"] mark.hl.ul.hl-green { text-decoration-color: #7fd08a; }
:root[data-theme="dark"] mark.hl.ul.hl-blue { text-decoration-color: #7db6f0; } :root[data-theme="dark"] mark.hl.ul.hl-pink { text-decoration-color: #f08cbc; }
.annot-menu .mode { display: inline-flex; vertical-align: middle; margin-right: .35rem; border-radius: 8px; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 2px; }
.annot-menu .mode button { border: 0; background: none; border-radius: 6px; height: 1.9rem; min-width: 2.3rem; cursor: pointer; color: var(--ink); font: 600 .9rem Georgia, serif; }
.annot-menu .mode button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.annot-menu .mode .mh { background: rgba(255,221,87,.8); padding: 0 .2em; border-radius: 2px; color: #1d1b18; }
.annot-menu .mode .mu { text-decoration: underline; text-decoration-color: #e0ad00; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.annot-menu[data-style="underline"] .sw { box-shadow: inset 0 0 0 .5rem var(--card); }

/* ---- notes column: open tab, hint, and the writing area */
#notes-tab { display: none; position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 900; border: 1px solid var(--bandrule); border-right: 0;
  background: var(--band); color: var(--sidehead); border-radius: 10px 0 0 10px; padding: .7rem .4rem; cursor: pointer;
  font: 600 .7rem -apple-system, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; box-shadow: -2px 2px 10px rgba(0,0,0,.08);
  flex-direction: column; align-items: center; gap: .45rem; }
#notes-tab svg { width: 18px; height: 18px; }
#notes-tab span { writing-mode: vertical-rl; }
body.notes-off #notes-tab { display: flex; }
@media (max-width: 760px) { body.notes-off #notes-tab { display: none; } }
.colheads .ch-side .hint { display: none; text-transform: none; letter-spacing: 0; font-size: .7rem; color: var(--bandmuted); padding-top: .15rem; font-family: -apple-system, system-ui, sans-serif; }
body.notes-empty .colheads .ch-side .hint { display: block; }
body.notescol .side { cursor: text; }
.side .snote.composer { cursor: auto; z-index: 3; background: var(--card); border: 1px solid var(--bandrule); border-radius: 10px; padding: .5rem .6rem .45rem;
  left: .5rem; right: .5rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.composer .chd { font-size: .95em; color: var(--sidehead); margin-bottom: .25rem; font-weight: 600; }
.composer .sq { margin-bottom: .3rem; }
.composer textarea { display: block; width: 100%; box-sizing: border-box; resize: none; border: 0; border-radius: 6px; outline: none;
  background: repeating-linear-gradient(transparent 0 1.55em, var(--bandline) 1.55em calc(1.55em + 1px)), var(--band);
  background-attachment: local; line-height: 1.55em; padding: .1em .45em .3em; font: 16px/1.55em -apple-system, system-ui, sans-serif; color: var(--bandink); }
.composer textarea:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--sideq) 45%, transparent); }
.composer .mdh { color: var(--bandmuted); font-size: .85em; margin: .3rem 0 .2rem; }
.composer .cbar { display: flex; gap: .35rem; align-items: center; }
.composer .cbar .sp { flex: 1; }
.composer .cbar button { border: 1px solid var(--bandrule); background: var(--btn); color: var(--ink); border-radius: 7px; padding: .3rem .7rem; font: inherit; font-size: .95em; cursor: pointer; }
.composer .cbar .primary { background: var(--accent); color: var(--onaccent); border-color: var(--accent); }
.composer .cbar .cdel { color: #c0392b; }

/* ---- notes column width: drag handle in the gap at its left edge */
#side-grip { display: none; position: fixed; top: 50%; width: 22px; height: 72px; margin-top: -36px; z-index: 950; cursor: col-resize; touch-action: none; }
#side-grip::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 6px; border-radius: 3px;
  background: color-mix(in srgb, var(--sidehead) 35%, transparent); transition: background .15s, transform .15s; }
#side-grip.on::before, #side-grip:hover::before { background: var(--sideq); transform: scaleX(1.3); }
body.notescol.sidew-custom #page { max-width: calc(var(--ncol) * 42rem + var(--sidew) + 6rem); }

/* ---- a note covering several verses: a bar down the band beside them */
.side .vspan { position: absolute; left: .3rem; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--sideq) 45%, transparent); pointer-events: none; z-index: 1; }

/* ---- verse-number selection */
.vsel { background: color-mix(in srgb, var(--sideq) 14%, transparent); border-radius: 3px; }
.annot-menu .vhint { display: block; text-align: center; font-size: .72rem; color: var(--muted); margin-top: .25rem; }

/* ---- composer: verse range and markdown keys */
.composer .chd { display: flex; align-items: center; gap: .35rem; }
.composer .chd .ct { flex: 1; }
.composer .rng { display: inline-flex; align-items: center; gap: .2rem; font-weight: 400; color: var(--bandmuted); font-size: .9em; }
.composer .rng button { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid var(--bandrule); background: var(--btn); color: var(--ink); font: 600 1rem/1 -apple-system, system-ui, sans-serif; cursor: pointer; padding: 0; }
.composer .mdkeys { display: flex; flex-wrap: wrap; gap: 3px; margin: .35rem 0 .3rem; touch-action: manipulation; }
.composer .mdkeys button { flex: 1 0 2rem; min-width: 2rem; height: 2rem; padding: 0 .2rem; border: 1px solid var(--bandrule); border-radius: 6px;
  background: var(--band); color: var(--bandink); font: 600 .82rem/1 -apple-system, system-ui, sans-serif; cursor: pointer; -webkit-user-select: none; user-select: none; }
.composer .mdkeys button:active { background: color-mix(in srgb, var(--sideq) 25%, var(--band)); }
.composer .mdkeys i { font-family: Georgia, serif; font-size: 1.05em; }
.snote .stag { display: inline-block; font-size: .78em; font-weight: 600; letter-spacing: .04em; color: var(--bandmuted); border: 1px solid var(--bandrule); border-radius: 4px; padding: 0 .3em; line-height: 1.35; vertical-align: .08em; }
.composer .tsel { font: 600 .9em -apple-system, system-ui, sans-serif; color: var(--sideq); background: var(--band); border: 1px solid var(--bandrule); border-radius: 6px; padding: .1rem .3rem; max-width: 9rem; }
/* keep text clear of the "My notes" tab on the right edge */
@media (min-width: 761px) { body.notes-off #page { padding-right: 2.6rem; } }

/* ---- writing a note without the column (iPhone, or column off): a sheet at the top */
.sheet-scrim { position: fixed; inset: 0; z-index: 2190; background: var(--scrim, rgba(0,0,0,.3)); }
.snote.composer.sheet { position: fixed; z-index: 2200; top: calc(env(safe-area-inset-top) + 8px); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));
  box-sizing: border-box; width: auto; max-width: min(40rem, calc(100vw - 16px)); margin: 0 auto; font-size: 15px; line-height: 1.4; background: var(--card); border: 1px solid var(--bandrule); border-radius: 14px;
  padding: .7rem .75rem .6rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); cursor: auto; }
.composer.sheet .tsel, .composer.sheet textarea { font-size: 16px; }
.composer.sheet .mdkeys button { height: 2.3rem; font-size: .9rem; }
.composer.sheet .cbar button { padding: .45rem .9rem; font-size: 15px; }
.composer.sheet .rng button { width: 2rem; height: 2rem; }
body.sheet-open { overflow: hidden; }
.composer .mdkeys { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.15rem, 1fr)); }
.composer .mdkeys button { min-width: 0; }
.composer .mdkeys button[data-k="11"] { font-size: 1.15rem; font-weight: 400; }
.composer .mdkeys button[data-k="11"] { font-size: 1.05rem; }
.composer .mdkeys button[data-k="12"] { grid-column: span 3; font-size: .82rem; font-weight: 600; }
.annot-panel .pgo { border: 0; background: none; padding: 0; margin: 0; color: var(--sideq); font: 700 .9rem -apple-system, system-ui, sans-serif; cursor: pointer; }
.annot-panel .pn.snote { display: block; width: 100%; text-align: left; border: 1px solid var(--bandline); background: var(--band); border-radius: 10px; padding: .5rem .7rem; margin: .35rem 0 0; font-size: .9rem; cursor: pointer; }
.annot-panel .stag { font: 600 .7rem -apple-system, system-ui, sans-serif; color: var(--bandmuted); border: 1px solid var(--bandrule); border-radius: 4px; padding: 0 .3em; }
@media (max-width: 760px) { .annot-panel { width: 100vw; box-sizing: border-box; border-left: 0; } }

/* ---- study column: translators' notes beside their verse; plain, quiet markers */
sup.m, sup.m.lds, sup.m.tn { color: #857c70; font-style: normal; font-family: -apple-system, system-ui, sans-serif; font-size: .55em; font-weight: 500; }
:root[data-theme="dark"] sup.m { color: #9a9286; }
sup.m.msel { color: var(--sideq); font-weight: 700; background: color-mix(in srgb, var(--sideq) 16%, transparent); border-radius: 3px; }
sup.m.kind-off { opacity: .35; }
body.no-markers sup.m, body.no-markers sup.msep { display: none; }
.row .notes, .nrow .notes { display: none; }
body.endlists .nrow .notes { display: block; }
body:not(.endlists) .nrow { display: none; }
#b-mk { font: 600 1.05rem Georgia, serif; color: var(--accent); }
#b-mk sup { font: 600 .6rem -apple-system, system-ui, sans-serif; margin-left: 1px; }
#b-mk:not(.on) { opacity: .45; }
#b-mk.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tnote .tk { font: 500 .66rem/1.2 -apple-system, system-ui, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--bandmuted); margin-bottom: .1rem; }
.tnote .tk .tag { display: inline-block; font-weight: 600; letter-spacing: .03em; border: 1px solid var(--bandrule); border-radius: 3px; padding: 0 .3em; margin-right: .45em; }
.tnote .tx { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tnote.open .tx { display: block; }
.tnote .tw { color: var(--bandink); }
.tnote.sel { background: var(--card); border: 1px solid color-mix(in srgb, var(--sideq) 55%, transparent); border-radius: 10px; padding: .45rem .6rem; left: .5rem; right: .5rem; z-index: 2;
  box-shadow: 0 4px 14px rgba(31,63,99,.14); }
.colheads .ch-side .sh { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .8rem; }
.colheads .ch-side .st { font-weight: 600; }
.seg3 { display: inline-flex; background: color-mix(in srgb, var(--sidehead) 14%, transparent); border-radius: 8px; padding: 2px; text-transform: none; letter-spacing: 0; }
.seg3 button { border: 0; background: none; font: 500 .74rem -apple-system, system-ui, sans-serif; color: var(--bandink); padding: .3rem .6rem; border-radius: 6px; cursor: pointer; min-height: 30px; }
.seg3 button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; }
.kchips { display: flex; flex-wrap: wrap; gap: .3rem; padding: .45rem .8rem 0; justify-content: flex-start; text-transform: none; letter-spacing: 0; }
.kchips button { border: 1px solid var(--bandrule); background: var(--card); color: var(--bandink); font: 500 .7rem -apple-system, system-ui, sans-serif; border-radius: 12px; padding: .2rem .55rem; cursor: pointer; min-height: 26px; }
.kchips button.off { background: none; border-style: dashed; color: var(--bandmuted); }
.tnote .tx { -webkit-line-clamp: 3; }
.side .snote.tnote { padding-bottom: .3rem; }
.side .tmore { text-align: left; border: 0; border-bottom: 1px solid var(--bandline); background: none; color: var(--sideq); font: 600 .72rem -apple-system, system-ui, sans-serif; cursor: pointer; padding: .1rem 0 .35rem; }

/* ---- column titles pinned under the toolbar while scrolling */
#colbar { position: fixed; left: 0; right: 0; height: 1.9rem; z-index: 880; display: none; pointer-events: none;
  background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--rule);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#colbar.on { display: block; }
#colbar span { position: absolute; top: 0; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 500 .68rem -apple-system, system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#colbar .cb-side { background: var(--band); color: var(--sidehead); font-weight: 600; }
