/* pyBibleLibraryMP. Plain CSS, no build step.
   Colours are named variables set from the theme (lib/theme_data.py via
   app.themes); the renderer marks text by class, never by colour, so a
   theme or text-size change redraws nothing (plan 15, 16.8). */
:root {
  /* Before the theme is read: the light theme a new user starts with
     (lib/theme_data.py 'light'; index.html has class="light"). */
  --base: #eff1f5; --mantle: #e6e9ef; --surface0: #dce0e8; --surface1: #ccd0da; --surface2: #bcc0cc;
  --text: #4c4f69; --subtext: #6c6f85; --accent: #1e66f5; --accent2: #179299; --red: #d20f39;
  --green: #40a02b; --yellow: #df8e1d; --orange: #fe640b; --lang: #8839ef; --translit: #c2410c;
  --text-bg: #ffffff; --verse-num: var(--accent); --heading: var(--accent2); --woc: var(--red);
  --footnote: var(--subtext); --strongs: var(--green); --link: var(--accent);
  --bookmark: var(--yellow); --note: var(--green);
  --font-size: 18px; --line-height: 1.5; --reading-font: Georgia, 'Times New Roman', serif;
  --ui-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bar-h: 52px; --side-w: 320px; --poetry: 30px;
  color-scheme: dark;
}
:root.light { color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--mantle); color: var(--text); font-family: var(--ui-font); }
body { overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; border-radius: 8px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
.grow { flex: 1; }

#app { display: flex; flex-direction: column; height: 100dvh; height: 100vh; }
@supports (height: 100dvh) { #app { height: 100dvh; } }

/* Top bar */
#topbar { display: flex; align-items: center; gap: 2px; padding: calc(4px + env(safe-area-inset-top)) calc(6px + env(safe-area-inset-right)) 4px calc(6px + env(safe-area-inset-left));
  background: var(--mantle); border-bottom: 1px solid var(--surface0); min-height: var(--bar-h); transition: margin-top .2s; z-index: 2; }
#topbar.hidden { margin-top: calc(-1 * (var(--bar-h) + env(safe-area-inset-top))); }
#topbar button { min-width: 44px; min-height: 44px; padding: 0 8px; }
/* The icons stand close together at the right end, each in its own place
   whatever the book's name is; the place takes the room that is left. */
#topbar button.icon { font-size: 1.25rem; min-width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
/* ◀ ▶ the panes, ▲ ▼ the books of this pane: four arrows in the room of three icons */
#topbar button.dir { color: var(--accent); min-width: 33px; }
#topbar #right { margin-right: 3px; }
#topbar button[aria-pressed=true] { color: var(--accent); background: var(--surface0); }
#topbar svg { display: block; }
/* Where the reader is, "KJV | Jn 4": the book (a tap: the map of panes and
   books) and the place in it (a tap: Go to Reference). The place is kept
   whole while there is room for it; the book's name takes what is left and
   is cut first. Under them, very small, the panes shown with this one lit;
   the text is lifted a little so the bar is no taller for them. */
#place { flex: 1 1 0; min-width: 0; display: flex; align-items: stretch; position: relative; font-size: 1.05rem; white-space: nowrap; }
#topbar #place button { min-width: 0; padding: 0 0 9px; text-align: left; overflow: hidden; text-overflow: ellipsis; border-radius: 8px; }
#topbar #placebook { flex: 0 1 auto; padding-left: 8px; color: var(--subtext); font-weight: 500; }
#placesep { flex: none; align-self: center; padding: 0 6px 9px; color: var(--surface2); }
#topbar #placetext { flex: 1 0 auto; max-width: calc(100% - 4.7em); padding-right: 6px; font-weight: 600; }   /* room for a book's name of six letters ("StrHeb") beside a long place */
#topbar #placebook[hidden] ~ #placetext { max-width: 100%; padding-left: 8px; }
#dots { position: absolute; left: 8px; bottom: 6px; display: flex; gap: 4px; pointer-events: none; }
#dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--surface2); }
#dots i.on { background: var(--accent); }
#topbar button:hover { background: var(--surface0); }
#topbar button:disabled { opacity: .35; }

/* Reading area */
#main { flex: 1; display: flex; min-height: 0; position: relative; }
#stage { flex: 1; position: relative; overflow: hidden; touch-action: pan-y pinch-zoom; background: var(--text-bg); }
#track { position: absolute; inset: 0; }
.cell { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; touch-action: pan-y pinch-zoom; background: var(--text-bg); }
.cell.anim-in-right { animation: inR .2s ease-out; } .cell.anim-in-left { animation: inL .2s ease-out; }
.cell.anim-in-down { animation: inD .2s ease-out; } .cell.anim-in-up { animation: inU .2s ease-out; }
@keyframes inR { from { transform: translateX(100%); } } @keyframes inL { from { transform: translateX(-100%); } }
@keyframes inD { from { transform: translateY(100%); } } @keyframes inU { from { transform: translateY(-100%); } }
@media (prefers-reduced-motion: reduce) { .cell { animation: none !important; } }

.text { font-family: var(--reading-font); font-size: var(--font-size); line-height: var(--line-height); color: var(--text);
  padding: 14px max(16px, env(safe-area-inset-right)) 40vh max(16px, env(safe-area-inset-left)); max-width: 46em; margin: 0 auto;
  overflow-wrap: break-word; -webkit-user-select: text; user-select: text; }
.text[dir=rtl] { text-align: right; }
.text.justify .b, .text.justify .bp { text-align: justify; }
.text .b, .text .bp { text-indent: var(--para-indent, 0); }
.cell.ownlook { color: var(--text); }
.text .b { margin: 0; }
.text .bp { margin-top: .5em; }
.text .bq, .text .bq2 { margin: .25em var(--poetry) 0 var(--poetry); }
.text .bq2 { margin-left: calc(2 * var(--poetry)); }
.text .li { padding-left: 1.5em; text-indent: -1.5em; margin-top: .15em; }
.text .li1 { margin-left: var(--poetry); } .text .li2 { margin-left: calc(2 * var(--poetry)); }
.text .li3 { margin-left: calc(3 * var(--poetry)); } .text .li4 { margin-left: calc(4 * var(--poetry)); }
.text .hb, .text .hh, .text .hs { color: var(--heading); font-weight: var(--h-weight, 700); font-style: var(--h-style, normal);
  font-family: var(--h-font, inherit); line-height: 1.3; }
.text .hb { font-size: var(--hb-size, 1.3em); margin: 16px 0 8px; }
.text .hh { font-size: var(--hh-size, 1.12em); margin: 12px 0 6px; }
.text .hs { font-size: var(--hs-size, 1em); margin: 12px 0 6px; }
.text span.hb, .text span.hh, .text span.hs { margin: 0; display: inline; }
.text { font-weight: var(--body-weight, 400); }
/* Row 21: the shell's displayInto sets these from the display settings. */
.text .vn { color: var(--verse-num); font-weight: var(--vn-weight, 700); font-size: var(--vn-size, .78em); vertical-align: var(--vn-align, .15em);
  font-family: var(--vn-font, var(--ui-font)); cursor: pointer; }
.text .vs.target { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; }
/* a page of topics (a topical book following the Bible): its verse numbers do nothing when clicked */
.text.topics .vn { cursor: default; }
/* the reference a verse's topic led to, in its article (a topical book following the Bible) */
.text a.target { background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 3px; }
.text .woc { color: var(--woc); font-weight: var(--woc-weight, inherit); }
.text .woc-bold .woc { font-weight: 700; }
.text a { color: var(--link); text-decoration: none; cursor: pointer; }
/* A book's own <a> links are always underlined; cross-references (pb_link,
   class ref) take the link settings; section links only their underline
   (gui/text_view.py: pb_link and nav_link formats). */
.text a.a { text-decoration: underline; text-decoration-thickness: 1px; }
.text a.nav, .text a.ref { text-decoration: var(--link-deco, none); text-decoration-thickness: 1px; }
.text a.ref { font-family: var(--link-font, inherit); font-size: var(--link-size, inherit); }
.text .sn, .text .morph { color: var(--strongs); font-size: var(--sn-size, .7em); vertical-align: .3em; font-family: var(--sn-font, var(--ui-font)); margin: 0 1px; }
.text .morph { font-style: italic; }
.text .fn { color: var(--footnote); font-weight: 700; vertical-align: .3em; font-size: .8em; padding: 0 2px; }
.text .fnc { color: var(--footnote); font-size: .88em; }
.text .bm { color: var(--bookmark); }
.text .note { color: var(--note); }
.text .lim { color: var(--subtext); }
.text .tc1 { color: var(--red); } .text .tc2 { color: var(--green); } .text .tc3 { color: var(--accent); }
.text .tc4 { color: var(--lang); } .text .tc5 { color: var(--subtext); }
.text .dhw { color: var(--heading); } .text .dlem, .text .orig { color: var(--lang); }
.text .orig { font-size: 1.15em; } .text .dtr { color: var(--translit); font-style: italic; }
.text .dpr, .text .dus { color: var(--subtext); }
.text .tw { overflow-x: auto; margin: .4em 0; }
.text .tw table { border-collapse: collapse; font-size: .92em; }
.text .tw td, .text .tw th { border: 1px solid var(--surface1); padding: 3px 6px; vertical-align: top; }
.text .img { text-align: center; margin: 8px 0; }
.text .img img { max-width: 100%; height: auto; background: #fff; border-radius: 4px; }
.text .img img:not([src]) { min-height: 40px; min-width: 60px; background: var(--surface0); }
.text .cap { text-align: center; color: var(--subtext); font-style: italic; font-size: .85em; margin-bottom: 4px; }
.text .hl { border-radius: 2px; }
.text .hl-underline { text-decoration: underline; text-decoration-color: var(--accent); }
.text .hl-dottedunderline { text-decoration: underline dotted; text-decoration-color: var(--accent); }
.text .hl-dashedunderline { text-decoration: underline dashed; text-decoration-color: var(--accent); }
.text .iws-row { display: block; }
.text .iw { display: inline-flex; flex-direction: column; align-items: center; margin: 0 3px 8px; vertical-align: top; line-height: 1.25; }
.text .iw > span { display: block; white-space: nowrap; }
.text .iwt { font-size: 1em; } .text .iwl { font-size: .72em; color: var(--strongs); }
.text .iws { font-size: .9em; } .text .iwm { font-size: .72em; color: var(--subtext); }
.text .iw a + a, .text .iw span > span + span { margin-left: .3em; }
.text.loading { opacity: .55; }
.text.stale::before { content: 'Saved copy — loading…'; display: block; font: 12px var(--ui-font); color: var(--subtext); margin-bottom: 6px; }

.empty { padding: 40px 24px; text-align: center; color: var(--subtext); font-family: var(--ui-font); }
.empty h2 { color: var(--text); font-size: 1.2rem; }
.empty button, .btn { display: inline-block; margin: 6px; padding: 12px 18px; background: var(--surface0); border-radius: 10px; min-height: 44px; }
.btn.primary, .empty button.primary { background: var(--accent); color: var(--base); font-weight: 600; }
/* The previous and next page of a book, or chapter of a Bible, after the text. */
.pagenav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 0 0; font-family: var(--ui-font); font-size: 1rem; }
.pagenav .btn { margin: 0; white-space: nowrap; }
.pagenav .btn:disabled { visibility: hidden; }

/* The side panel (plan 33, sidepanel.js): docked beside the panes (the
   desktop window, a tablet) or a popup from the bottom (a phone). */
#side { width: var(--side-w, 320px); min-width: 200px; max-width: 60vw; flex: none; background: var(--base);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#app.side-left #main { flex-direction: row-reverse; }
#divider { width: 6px; cursor: col-resize; background: var(--mantle); touch-action: none; flex: none; }
#divider:hover { background: var(--surface1); }
/* A phone: the panel fills the reading area, under the top bar, whose
   side-panel button closes it again (as does its own ✕). */
#side.popup { position: absolute; inset: 0; width: auto; min-width: 0; max-width: none; z-index: 8;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.spbar { flex: none; display: flex; align-items: center; gap: 2px; padding: 2px 2px 2px 4px; height: 27px; background: var(--mantle); }
.spbtn { min-width: 24px; height: 24px; padding: 0 4px; border-radius: 3px; color: var(--text); }
.spbtn:hover { background: var(--surface0); }
.sphead { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 4px 0; }
.spsel { flex: 1; height: 31px; text-align: left; padding: 4px 24px 4px 8px; background: var(--surface0); color: var(--text);
  border: 1px solid var(--surface1); border-radius: 4px; position: relative; }
.spsel::after { content: '▾'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--subtext); }
.spsel:hover { background: var(--surface1); }
.sptabs { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
.sptab { padding: 4px 2px; background: var(--surface0); border-radius: 0; font-size: 12px; white-space: nowrap; overflow: hidden; }
.sptab.on { background: var(--surface2); }
.sphide { min-width: 36px; height: 36px; font-size: 1.05rem; border-radius: 50%; background: var(--surface0); margin-left: 4px; }
/* A phone or tablet: the six sections as icon tabs in a row, no menu. */
.sphead.spicons { align-items: stretch; gap: 2px; padding: 0 4px; border-bottom: 1px solid var(--surface0); }
.sphead.spicons .sphide, .sphead.spicons .spcgear { align-self: center; }
.spitabs { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.spitabs .sptab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; padding: 4px 0 2px;
  background: none; color: var(--subtext); font-size: 9.5px; border-bottom: 2px solid transparent; }
.spitabs .sptab.on { background: var(--surface0); color: var(--text); border-bottom-color: currentColor; font-weight: 700; border-radius: 8px 8px 0 0; }
/* The icons of the side panel's tabs and of the ⚙ sheet's: each in a colour
   of the theme's own, so they stand out from the words in any theme. */
.sptab[data-sec=search] .spico, .mnutab[data-tab=display] .ico { color: var(--accent); }
.sptab[data-sec=notes] .spico, .mnutab[data-tab=book] .ico { color: var(--green); }
.sptab[data-sec=highlights] .spico, .mnutab[data-tab=tools] .ico { color: var(--orange); }
.sptab[data-sec=bookmarks] .spico { color: var(--red); }
.sptab[data-sec=contents] .spico, .mnutab[data-tab=library] .ico { color: var(--accent2); }
.sptab[data-sec=navigator] .spico, .mnutab[data-tab=more] .ico { color: var(--lang); }
.spitabs .sptab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.spico svg { display: block; }
#side { container-type: inline-size; }
@container (max-width: 340px) { .spitabs .sptab > span:last-child { display: none; } .spitabs .sptab { min-height: 40px; } }
.spbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.spsec { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.spsec[hidden] { display: none; }
.sprow { display: flex; align-items: center; gap: 4px; flex: none; flex-wrap: wrap; }
.sprow.end { justify-content: flex-end; }
.sprow.nowrap { flex-wrap: nowrap; } .sprow.nowrap select { min-width: 0; flex: 0 1 auto; }
.sprow input[type=search] { flex: 1; min-width: 80px; }
.spsec input[type=search], .spsec select { width: auto; min-height: 0; padding: 4px 8px; border-radius: 4px; }
.spsec > input[type=search] { width: 100%; }
.spscopes { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; font-size: 11px; flex: none; }
.spscopes label { display: flex; align-items: center; gap: 4px; }
.spscope { flex: 1; font-size: 11px; }
.spstatus { font-size: 10px; color: var(--subtext); min-height: 13px; flex: none; }
.spnavstatus { font-size: 9px; }
.sptree { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--surface1); background: var(--base); }
.sphint { padding: 10px; color: var(--subtext); white-space: pre-wrap; font-size: .92em; }
.sprowhead { display: block; width: 100%; text-align: left; padding: 3px 6px 3px 18px; font-weight: 600; border-radius: 0; position: relative; cursor: pointer; }
.sprowhead::before { content: '▸'; position: absolute; left: 5px; color: var(--subtext); }
.sprowhead.open::before { content: '▾'; }
.sprowhead.plain { font-weight: normal; }
.sprowhead.navhead { padding-left: 6px; } .sprowhead.navhead::before { content: none; }
.spswatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.spkids { padding-left: 14px; }
.spitem { display: block; width: 100%; text-align: left; padding: 3px 6px; border-radius: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spitem:nth-child(even) { background: var(--mantle); }
.spitem:hover, .sprowhead:hover, .spnode:hover { background: var(--surface0); }
.spitem.dim { color: var(--subtext); }
.spitem.more { color: var(--link); }
.spresults .spitem { white-space: normal; }
.spgroup { padding: 6px 6px 2px; color: var(--heading); font-weight: 700; font-size: 12px; }
.spnote { padding: 6px 8px; border-top: 1px solid var(--surface0); cursor: pointer; }
.spnote.sel { background: var(--surface1); }
.spnote .splink { color: var(--link); text-decoration: none; font-weight: 700; }
.spnote.dim .splink { color: var(--subtext); }
.sppreview { color: var(--subtext); font-size: 85%; overflow-wrap: anywhere; }
.spref { text-align: left; font-weight: 700; color: var(--link); padding: 2px 0; flex: none; }
.sptabsrow { display: flex; flex: none; border-bottom: 1px solid var(--surface1); }
.sptab2 { padding: 2px 10px; background: var(--surface0); color: var(--subtext); border-radius: 3px 3px 0 0; margin-right: 1px; }
.sptab2.on { background: var(--surface1); color: var(--text); }
.spview { flex: 1; min-height: 0; overflow: auto; padding: 6px 8px; border: 1px solid var(--surface1); font-size: 13px; max-width: none;
  margin: 0; font-family: var(--ui-font); white-space: normal; }
.spview:empty::before { content: attr(data-placeholder); color: var(--subtext); }
.spview a { color: var(--link); }
.speditbox { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.speditbox[hidden], .spview[hidden], .spnotelist[hidden] { display: none; }
.spedit { flex: 1; min-height: 120px; resize: none; font: inherit; color: var(--text); background: var(--base); border: 1px solid var(--surface1);
  border-radius: 0; padding: 6px; width: 100%; }
.spcontents { flex: 1; min-height: 0; overflow: auto; }
.spcontents .sptree { border: 0; }
.spnode { display: flex; align-items: baseline; gap: 2px; padding: 2px 4px; cursor: pointer; }
.spnode.sel { background: var(--surface1); }
.sptwisty { width: 12px; flex: none; color: var(--subtext); }
.spnodet { overflow: hidden; text-overflow: ellipsis; }
.spmap { padding: 4px; font-size: 11px; }
.spmaphead { font-weight: 700; padding: 6px 0 2px; }
.spmaphead.matter { cursor: pointer; color: var(--link); font-weight: normal; }
.spmapsep { height: 1px; background: var(--surface1); margin: 3px 0; }
.spmaprow { display: flex; align-items: flex-start; gap: 4px; padding: 2px; border: 1px solid transparent; border-radius: 4px; }
.spmaprow.cur { border-color: var(--accent); }
.spmaprow.gone { opacity: .45; }
.spmaplab { width: 40px; flex: none; color: var(--subtext); }
.spmapcells { flex: 1; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.spsq { width: 10px; height: 10px; padding: 0; border-radius: 2px; opacity: .8; }
.spsq:hover { opacity: 1; outline: 1px solid var(--text); }
.spsq.none { opacity: .25; cursor: default; }
.spsq.on { outline: 2px solid var(--text); opacity: 1; border-radius: 50%; }
.spmapch { flex-basis: 100%; color: var(--subtext); font-size: 10px; }
/* the map's verse row, the Book Grid, the Book List (2026-11-18) */
.spmaplab.go { cursor: pointer; }
.spmaplab.go:hover { color: var(--text); text-decoration: underline; }
.spvsq { background: var(--surface1); opacity: .75; }
.spvsq.on { background: var(--accent); opacity: 1; border-radius: 2px; outline: none; }
.spgrid { padding: 4px; }
.spcrumbs { display: flex; align-items: center; gap: 4px; padding: 2px 0 6px; flex-wrap: wrap; }
.spcrumb { padding: 2px 4px; border-radius: 3px; }
button.spcrumb:hover { background: var(--surface0); }
.spcrumb.on { font-weight: 700; }
.sptiles { display: flex; flex-wrap: wrap; gap: 2px; }
.sptile { min-width: 34px; height: 24px; padding: 0 4px; border-radius: 3px; color: var(--text); font-size: 12px;
  background: color-mix(in srgb, var(--tile, var(--surface1)) 62%, transparent); }
.sptile.wide { min-width: 52px; }
.sptile:hover:not(:disabled) { background: var(--tile, var(--surface2)); }
.sptile.on { background: var(--tile, var(--accent)); color: var(--base); font-weight: 700; }
.sptile:disabled { opacity: .35; cursor: default; }
.sptilehead { flex-basis: 100%; text-align: center; font-weight: 700; padding: 6px 0 2px; }
:root:not([data-layout=desktop]) .sptile { min-width: 42px; height: 34px; font-size: 15px; }
/* a finger needs bigger squares than a mouse (the desktop map's are 7–16 px) */
:root:not([data-layout=desktop]) .spsq { width: 18px; height: 18px; border-radius: 3px; }
:root:not([data-layout=desktop]) .spmapcells { gap: 3px; }
:root:not([data-layout=desktop]) .spmaprow { padding: 3px 2px; }
.spcgear { min-width: 31px; height: 31px; font-size: 1.05em; }
:root:not([data-layout=desktop]) .sptile.wide { min-width: 58px; }
.splisthead { font-weight: 700; color: var(--subtext); padding: 4px 6px 2px; }
.spswatch { width: 10px; height: 10px; flex: none; margin-right: 4px; align-self: center; }
.spnode.off { opacity: .45; cursor: default; }
.stgrid { max-height: 50vh; overflow: auto; margin-top: 6px; }
.spverse { text-align: center; font-weight: 700; padding: 2px; flex: none; }
.spsync { flex: 1; }
.spnavbooks { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.spnavbook[hidden] { display: none; }
.spcheck { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.dlgbody fieldset { border: 1px solid var(--surface1); border-radius: 4px; margin: 6px 0; padding: 4px 8px 8px; }
.sphelptable { border-collapse: collapse; width: 100%; margin: 4px 0 8px; }
.sphelptable td { padding: 3px 6px; vertical-align: top; } .sphelptable td:first-child { font-family: ui-monospace, monospace; white-space: nowrap; font-weight: bold; }
.sphelptable tr:nth-child(even) { background: var(--mantle); }
html:not([data-layout=desktop]) .spsec { font-size: 1rem; }
html:not([data-layout=desktop]) .spitem, html:not([data-layout=desktop]) .sprowhead { padding-top: 8px; padding-bottom: 8px; }
html:not([data-layout=desktop]) .spsec .btn { min-height: 36px; padding: 6px 10px; margin: 0; }
/* Under a finger: Search's four scopes and the List / View / Edit of Notes
   were a mouse's size (11 px words, rows 16 px apart), and what Search says
   (its scope, how many results, an error) was 10 px. */
html:not([data-layout=desktop]) .spscopes { font-size: .95rem; gap: 0 8px; }
html:not([data-layout=desktop]) .spscopes label { min-height: 36px; gap: 8px; }
html:not([data-layout=desktop]) .spscopes input { width: 18px; height: 18px; margin: 0; flex: none; }
html:not([data-layout=desktop]) .spscope, html:not([data-layout=desktop]) .spstatus { font-size: .8rem; }
html:not([data-layout=desktop]) .sptab2 { padding: 7px 16px; }
/* A phone or tablet: a row of a list ends in ⋯, which opens what a right
   click opens in the desktop window (sidepanel.js rowMenu). */
.spline { display: flex; align-items: stretch; }
.spline:nth-child(even) { background: var(--mantle); }
.spline .spitem { flex: 1; min-width: 0; width: auto; }
.spmore { flex: none; min-width: 44px; padding: 0 8px; color: var(--subtext); font-size: 1.3rem; line-height: 1; border-radius: 0; }
.spnote.hasmore, .sprowhead.hasmore { position: relative; padding-right: 48px; }
.hasmore > .spmore { position: absolute; right: 0; top: 0; height: 100%; max-height: 44px; }

/* Dialogs (plan 32.4, dialogs.js): one content, two frames. #sheet is the
   layer; each dialog is a .dlg, its body .dlgbody (the top one is #sheetbox).
   On phones and tablets a dialog is a sheet from the bottom (full screen
   when .full); in the desktop window, a window inside the program. */
#sheet { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.dlgback { position: fixed; inset: 0; background: rgba(0,0,0,.5); pointer-events: auto; }
.dlg { position: fixed; display: flex; flex-direction: column; background: var(--base); color: var(--text); pointer-events: auto;
  box-shadow: 0 -4px 24px rgba(0,0,0,.4); max-width: 100vw; }
.dlghead { display: flex; align-items: center; gap: 8px; flex: none; padding: 12px 14px 4px; }
.dlgtitle { flex: 1; font-weight: 600; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlgx { min-width: 44px; min-height: 44px; font-size: 1.1rem; }
.dlgbody { flex: 1; overflow-y: auto; padding: 4px 14px calc(16px + env(safe-area-inset-bottom)); min-height: 0; }
html:not([data-layout=desktop]) .dlg { left: 0 !important; top: auto !important; bottom: 0; width: 100vw !important; height: auto !important;
  max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; }
/* dvh, the height showing now, after vh for browsers without it: on an
   iPhone 100vh is the page at its tallest (the browser's bars hidden), so
   a sheet measured in vh has its title and ✕ above the top of the screen. */
html:not([data-layout=desktop]) .dlg.full { top: 0 !important; height: 100vh !important; height: 100dvh !important; max-height: none; border-radius: 0; }
html:not([data-layout=desktop]) .dlg.full .dlghead { padding-top: calc(10px + env(safe-area-inset-top)); }
/* The ✕ of a sheet: a round button, easy to see and to hit. */
html:not([data-layout=desktop]) .dlgx { min-width: 40px; min-height: 40px; border-radius: 50%; background: var(--surface0); flex: none; }
/* A sheet with no title row (Go to Reference): its ✕ is on the field's line. */
html:not([data-layout=desktop]) .dlg.bare .dlghead { display: none; }
html:not([data-layout=desktop]) .dlg.bare .dlgbody { padding-top: 14px; }
html:not([data-layout=desktop]) .dlg.bare.full .dlgbody { padding-top: calc(12px + env(safe-area-inset-top)); }
@media (min-width: 700px) {
  html:not([data-layout=desktop]) .dlg { left: 50% !important; top: 50% !important; bottom: auto; transform: translate(-50%, -50%);
    width: min(640px, 100vw) !important; border-radius: 16px; }
  /* top again: the full sheet's own "top: 0" (above) is the stronger rule, and with it half the window stood above the screen */
  html:not([data-layout=desktop]) .dlg.full { top: 50% !important; width: min(760px, 96vw) !important; height: 90vh !important; height: 90dvh !important; border-radius: 16px; }
  html:not([data-layout=desktop]) .dlg.full .dlghead { padding-top: 12px; }
}
html[data-layout=desktop] .dlgback { background: rgba(0,0,0,.25); }
html[data-layout=desktop] .dlg { border: 1px solid var(--surface1); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.45);
  min-width: 260px; min-height: 90px; max-height: 100vh; resize: both; overflow: hidden; }
html[data-layout=desktop] .dlghead { background: var(--mantle); cursor: move; user-select: none; padding: 4px 4px 4px 10px; }
html[data-layout=desktop] .dlgtitle { font-size: inherit; }
html[data-layout=desktop] .dlgx { min-width: 26px; min-height: 22px; font-size: .9em; border-radius: 3px; }
html[data-layout=desktop] .dlgx:hover { background: var(--red); color: var(--base); }
html[data-layout=desktop] .dlgbody { padding: 10px 12px; }
.asktext { white-space: pre-wrap; margin: 4px 0 8px; } .askdetail { white-space: pre-wrap; }
.asklabel { display: block; margin: 4px 0 6px; }
.askbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn.danger { background: var(--red); color: var(--base); }
.synclog { white-space: pre-wrap; font-size: .85em; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--surface0); min-height: 48px; }
.row .label { flex: 1; }
.row small, .mut { color: var(--subtext); }
.switch { width: 52px; height: 30px; border-radius: 15px; background: var(--surface1); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); transition: left .15s; }
.switch[aria-checked=true] { background: var(--accent); } .switch[aria-checked=true]::after { left: 25px; background: var(--base); }
.sizebtn { min-width: 48px; min-height: 40px; background: var(--surface0); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.swatch { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--surface1); position: relative; overflow: hidden; }
.swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch span { position: absolute; }
.swatch .t { left: 7px; top: 9px; width: 22px; height: 4px; border-radius: 2px; }
.swatch .a { left: 7px; top: 19px; width: 14px; height: 4px; border-radius: 2px; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; padding: 8px 0; }
.links button { background: var(--surface0); padding: 12px 10px; text-align: left; min-height: 48px; }
.linkshead { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--subtext); padding: 10px 2px 0; }
.linkshead + .links { padding-top: 6px; }
/* The ⚙ sheet (shell.js openMenu): five icon tabs, then the tab's page. */
.mnutabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; position: sticky; top: -4px; z-index: 1; background: var(--base); padding: 4px 0 8px; }
.mnutab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; padding: 6px 0 4px; border-radius: 10px;
  color: var(--subtext); font-size: .74rem; border-bottom: 2px solid transparent; }
.mnutab.on { background: var(--surface0); color: var(--text); font-weight: 700; border-bottom-color: currentColor; }
.mnutab .ico svg, .ico svg { display: block; }
/* The ⚙ sheet is the whole screen of a phone and a large window on a
   tablet (dialogs.js full), so its tabs stay where they are. */
.mnubook { margin: 4px 2px 2px; font-weight: 600; }
input[type=search], input[type=text], select { font: inherit; color: var(--text); background: var(--surface0); border: 1px solid var(--surface1); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.chip { background: var(--surface0); padding: 8px 12px; border-radius: 18px; min-height: 40px; }
.chip.on { background: var(--accent); color: var(--base); }
.booklist .book { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--surface0); min-height: 52px; }
.booklist .book b { font-weight: 600; } .booklist .book small { color: var(--subtext); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.grid button { background: var(--surface0); min-height: 44px; padding: 6px 4px; font-size: .9rem; }
.grid button.on { background: var(--accent); color: var(--base); }
/* The map of panes and books: a column for each pane shown, four at most
   in a row (--cols, set with the map; more panes wrap into rows). Above
   them − pane and + pane, each in its own half, so that one keeps its
   place when the other is not there. */
.mapcount { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.mapcount button { background: var(--surface0); min-height: 44px; color: var(--accent); font-weight: 600; }
.mapcount .less { grid-column: 1; }
.mapcount .more { grid-column: 2; }
.map { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 14px 6px; }
.map .col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.map .col b { text-align: center; font-size: .8rem; color: var(--subtext); padding: 4px 0; }
.map .col.on b { color: var(--accent); }
/* A phone's columns have no room for "4 Commentaries" in a line: the number
   stands over the word, in every column so that they stay level, and with
   four in a row the word is as small as the screen is narrow, so that it
   is whole at 360 px too. */
@media (max-width: 479px) {
  .map .col b span { display: block; }
  .map .col b .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .map.four .col b .what { font-size: clamp(.62rem, 2.9vw, .8rem); }
}
.map button { background: var(--surface0); min-height: 48px; padding: 6px 4px; font-size: .85rem; overflow-wrap: anywhere; }
.map button.on { outline: 2px solid var(--accent); }
.map button.add { color: var(--accent); }
.map .close { font-size: .75rem; min-height: 32px; color: var(--subtext); }
progress { width: 100%; height: 10px; }
.popup .text { padding: 4px 0 8px; font-size: calc(var(--font-size) * .92); }

.hlrow .swatch { width: 36px; height: 36px; font-weight: 700; color: var(--text); }
.hl-sw.hl-underline, .hl-sw.hl-dottedunderline, .hl-sw.hl-dashedunderline { background: var(--surface0); }
.noteblock { margin: 10px 0; }
.notetext { background: var(--surface0); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-family: var(--reading-font); line-height: 1.45; overflow-wrap: anywhere; }
.notetext p { margin: 0 0 .4em; }
textarea.noteedit { font: inherit; font-family: var(--reading-font); color: var(--text); background: var(--surface0); border: 1px solid var(--surface1); border-radius: 10px; padding: 10px; width: 100%; resize: vertical; }
button.linkish { color: var(--link); padding: 4px 0; text-align: left; font-weight: 600; }
button.linkish:disabled { color: var(--subtext); }
.listrow { gap: 4px; }
.rowtools { display: flex; gap: 6px; flex-wrap: wrap; }
.rowtools button { background: var(--surface0); padding: 6px 10px; font-size: .85rem; min-height: 36px; }
.rowtools select { width: auto; min-height: 36px; padding: 4px 8px; font-size: .85rem; }
.selbtn { position: fixed; z-index: 15; }
.links button.primary { background: var(--accent); color: var(--base); font-weight: 600; }
.bookrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--surface0); }
.bookrow .book { border-bottom: 0; flex: 1; }
.bookrow .info { min-width: 48px; font-size: 1.2rem; color: var(--accent); }
.stars { display: flex; gap: 2px; } .star { font-size: 1.4rem; min-width: 36px; min-height: 40px; color: var(--yellow); }
/* A book's details in "About this book" (study.js): what, then which, in two columns. */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 6px 2px; }
.factnote { margin: 4px 2px 8px; font-style: italic; }
.selbtn { display: flex; gap: 6px; }
.selbtn .btn { margin: 0; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.selbtn .btn:not(.primary) { background: var(--surface1); }
/* Dictionary for the words selected (mydata.js lookupSelection) */
.dictentry { border-bottom: 1px solid var(--surface0); padding: 4px 0 8px; }
.dicthead { display: flex; align-items: center; gap: 8px; }
.dicthead b { flex: 1; color: var(--heading); }
.dicthead .btn { margin: 0; min-height: 40px; padding: 8px 16px; }
.text mark { background: var(--yellow); color: var(--base); border-radius: 2px; } .text mark.cur { background: var(--orange); }
.text .speaking { background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 4px; }
kbd { font: 12px ui-monospace, monospace; background: var(--surface0); border: 1px solid var(--surface1); border-radius: 5px; padding: 3px 6px; white-space: nowrap; }
.helptext h1, .helptext h2, .helptext h3 { color: var(--heading); }
/* The desktop layout (16.9) */
html[data-layout=desktop] #stage { touch-action: auto; }
#track .droot { position: absolute; inset: 0; display: flex; }
.split { display: flex; min-width: 0; min-height: 0; }
.split.h { flex-direction: row; } .split.v { flex-direction: column; }
.droot > .dpane, .split > .dpane { flex: 1 1 0; }
/* The pane's frame (QFrame[paneActive]: 2 px, the accent when active) is
   drawn inside it, so that it does not count when the splits share out the
   room (a border on a flex item with no basis is added on top of its share). */
.dpane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; }
.dpane::after { content: ''; position: absolute; inset: 0; border: 2px solid transparent; pointer-events: none; z-index: 3; }
.dpane.on::after { border-color: var(--accent); }
.dpane.drop::after { border-color: var(--green); }
.dpane > .dloc { margin: 2px 2px 0; } .dpane > .dtabs { margin: 0 2px; } .dpane > .dbody { margin: 0 2px 2px; }
#track.maxed .dpane:not(.max) { display: none; } #track.maxed .ddiv { display: none; }
#track.maxed .split:not(:has(.max)) { display: none; } #track.maxed .split { flex: 1 1 0 !important; }
.dbody { position: relative; flex: 1; min-height: 0; }
.ddiv { flex: 0 0 3px; background: var(--surface1); }
.split.h > .ddiv { cursor: col-resize; } .split.v > .ddiv { cursor: row-resize; }
.ddiv:hover { background: var(--accent); }
.hoverpop { position: fixed; z-index: 35; max-width: min(460px, 90vw); max-height: 50vh; overflow: auto; background: var(--surface0); border: 1px solid var(--surface1); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.hoverpop .text { padding: 4px 0; font-size: .95em; max-width: none; }
.covergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 8px 0; }
.cover { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: .8rem; color: var(--subtext); }
.cover .art { aspect-ratio: 2 / 3; border-radius: 6px; background: linear-gradient(160deg, var(--surface1), var(--surface0)); display: flex; align-items: center; justify-content: center; font: 700 1.1rem var(--ui-font); color: var(--accent); overflow: hidden; }
.cover .art img { width: 100%; height: 100%; object-fit: cover; }
.cover span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kbtn { min-width: 120px; min-height: 36px; background: var(--surface0); font: 13px ui-monospace, monospace; }
#toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--surface1); color: var(--text);
  padding: 10px 16px; border-radius: 10px; max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#toast.on { opacity: 1; }
#boot { position: fixed; inset: 0; background: var(--base); display: flex; align-items: center; justify-content: center; z-index: 30; transition: opacity .25s; }
#boot.gone { opacity: 0; pointer-events: none; }
.bootbox { text-align: center; width: min(320px, 80vw); color: var(--subtext); }
.bootbox img { border-radius: 20px; }
#app.ready + #sheet + #toast + #boot, #boot.hide { display: none; }
@media print { #topbar, #side, #divider, #sheet, #toast, #boot, #menubar, #findbar, #statusbar { display: none !important; }
  html, body, #app, #main, #stage, .cell { position: static !important; height: auto !important; overflow: visible !important; background: #fff !important; color: #000 !important; }
  .text { padding: 0; max-width: none; } }

/* A window of its own (gui/detached_window.py): its bar. */
#winbar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; flex: none; background: var(--mantle); }
#winbar[hidden] { display: none; }
#winloc { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#winbar .btn { min-height: 0; margin: 0; padding: 4px 8px; }

/* ── The desktop window (plan 32.2): pyBibleLibrary's regions, drawn as
   gui/theme.py draws them. ── */
html[data-layout=desktop] body, html[data-layout=desktop] #app, html[data-layout=desktop] .menu {
  font-family: var(--ui-font); font-size: var(--ui-size, 13px); }
/* Qt's proportional line height is of the font's own line spacing, CSS's of
   its size: measured on DejaVu Sans Mono (pyBibleLibrary's Consolas here) the
   desktop's lines are 8% further apart. */
html[data-layout=desktop] .text { padding: 16px; max-width: none; margin: 0; line-height: calc(var(--line-height) * 1.08); }
html[data-layout=desktop] .text .b { padding: var(--vgap, 2px) 0; }
html[data-layout=desktop] .text > :first-child { margin-top: 0; }
html[data-layout=desktop] .text .bp { margin-top: var(--pgap, 5px); padding: 0 0 var(--vgap, 2px); }
/* Verse numbers: bold superscript at 0.75 of the text, which Qt draws
   smaller still (plan 34, rows 28 and 29). */
html[data-layout=desktop] .text .vn { font-family: var(--vn-font, inherit); font-size: var(--vn-size, .52em); vertical-align: var(--vn-align, super); line-height: 0; }
/* 1 · menu bar (QMenuBar) and menus (QMenu) */
#menubar { display: flex; flex: none; background: var(--mantle); color: var(--text); user-select: none; }
#menubar[hidden] { display: none; }
#menubar .mbtitle { padding: 4px 8px; border-radius: 0; line-height: 21px; }
#menubar .mbtitle:hover, #menubar .mbtitle.on { background: var(--surface0); }
#menubar .mbtitle u { text-decoration-thickness: 1px; }
.menu { position: fixed; z-index: 60; background: var(--surface0); color: var(--text); border: 1px solid var(--surface1);
  min-width: 140px; max-height: calc(100vh - 4px); overflow-y: auto; padding: 2px 0; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.menu .mitem { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; column-gap: 4px; width: 100%;
  padding: 4px 24px 4px 8px; border-radius: 0; text-align: left; white-space: nowrap; line-height: 1.35; }
.menu .mitem .mkey { padding-left: 28px; color: var(--subtext); }
.menu .mitem:hover:not(:disabled), .menu .mitem:focus { background: var(--surface1); outline: none; }
.menu .mitem:disabled { color: var(--subtext); cursor: default; }
.menu .mitem .mcheck { color: var(--accent); font-weight: 700; }
.menu .msep { height: 1px; background: var(--surface1); margin: 4px 0; }
.menu .mhead { color: var(--accent); font-weight: 600; padding: 5px 14px 2px 12px; white-space: nowrap; }
.menu .mhead.where { color: color-mix(in srgb, var(--text) 60%, transparent); font-weight: normal; }
/* 2 · find bar (gui/search_bar.py) */
#findbar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; flex: none; background: var(--base); }
#findbar[hidden] { display: none; }
#findbar input[type=search] { flex: 1; min-height: 0; padding: 4px 8px; border-radius: 4px; }
#findbar .fcount { padding: 0 6px; white-space: nowrap; }
#findbar .fcasel { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
#findbar .fclose { width: 24px; min-height: 24px; border-radius: 3px; }
#findbar .fclose:hover { background: var(--surface0); }
html:not([data-layout=desktop]) #findbar { order: 3; padding: 6px 8px; }
html:not([data-layout=desktop]) #findbar .btn { min-height: 40px; padding: 6px 12px; margin: 0; }
html:not([data-layout=desktop]) #findbar .fclose { width: 40px; min-height: 40px; border-radius: 50%; background: var(--surface0); font-size: 0; flex: none; }
html:not([data-layout=desktop]) #findbar .fclose::before { content: '✕'; font-size: 1.1rem; }
/* Read aloud on a phone or tablet: the status bar shows while something is
   read, with what is read and the pause and stop buttons. */
html:not([data-layout=desktop]) #statusbar { height: auto; min-height: 48px; font-size: .9rem; padding: 2px calc(6px + env(safe-area-inset-right)) calc(2px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left)); border-top: 1px solid var(--surface0); }
html:not([data-layout=desktop]) #statusbar .smsg, html:not([data-layout=desktop]) #statusbar .ssep, html:not([data-layout=desktop]) #statusbar .sread { display: none; }
html:not([data-layout=desktop]) #statusbar .snow { flex: 1; min-width: 0; height: 44px; text-align: left; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
html:not([data-layout=desktop]) #statusbar .splay, html:not([data-layout=desktop]) #statusbar .spause, html:not([data-layout=desktop]) #statusbar .sstop { width: 48px; height: 44px; font-size: 1.2rem; background: var(--surface0); border-radius: 10px; margin-left: 6px; flex: none; }
/* 3 · location bars (LocationBar) and 4 · tab strips (TabStrip, TabButton) */
.dloc { display: flex; align-items: center; gap: 6px; padding: 1px 6px; height: 23px; flex: none; white-space: nowrap; overflow: hidden; }
.dloc .abbr { min-width: 56px; text-align: right; }
.dloc .ref { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dloc .ref.nav { color: var(--accent); }
.dloc .ref.bad { color: var(--red); }
.dtabs { position: relative; flex: none; border-bottom: 1px solid var(--surface1); height: 16px; }
.dtab { position: absolute; padding: 0; margin: 0; border: 1px solid var(--surface1); border-bottom: none; border-radius: 4px 4px 0 0;
  background: transparent; color: var(--text); font-size: 7pt; line-height: 13px; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; cursor: pointer; user-select: none; }
.dtab.synced { font-style: italic; }
.dtab.on { font-weight: 700; border-top: 2px solid var(--accent); line-height: 12px; background: var(--text-bg); z-index: 1; }
.dplus { position: absolute; padding: 0; margin: 0; border-radius: 3px; font-size: 10pt; font-weight: 700; line-height: 15px; color: var(--text); }
.dplus:hover { background: var(--surface0); }
.dsig { position: absolute; padding: 0; margin: 0; border-radius: 3px; font-size: 10pt; font-weight: 700; line-height: 15px; color: var(--text); }
.dsig:hover { background: var(--surface0); }
.dsig.on { background: var(--accent); color: var(--base); }
.dloc .dpg { width: 20px; height: 18px; flex: none; padding: 0; border-radius: 3px; color: var(--text); line-height: 16px; }
.dloc .dpg:hover { background: var(--surface0); }
/* 7 · status bar (QStatusBar) */
#statusbar { display: flex; align-items: center; flex: none; background: var(--mantle); color: var(--subtext); font-size: 11px; height: 34px; }
#statusbar[hidden] { display: none; }
#statusbar .smsg { flex: 1; padding: 2px 8px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
#statusbar .ssep { width: 1px; align-self: stretch; margin: 3px 4px; background: var(--surface1); }
#statusbar button { height: 28px; padding: 0 8px; border-radius: 3px; color: var(--text); white-space: nowrap; font-size: var(--ui-size, 13px); }
#statusbar button:hover { background: var(--surface0); }
#statusbar .sread b { color: var(--green); font-weight: normal; }
/* Controls in the desktop window, as QPushButton, QLineEdit, QComboBox */
html[data-layout=desktop] .btn, html[data-layout=desktop] .dlgbody .links button, html[data-layout=desktop] .tog {
  min-height: 0; margin: 0; padding: 4px 8px; background: var(--surface0); color: var(--text); border: 1px solid var(--surface1); border-radius: 4px; }
html[data-layout=desktop] .btn:hover, html[data-layout=desktop] .tog:hover { background: var(--surface1); }
html[data-layout=desktop] .btn.primary { background: var(--surface0); color: var(--text); font-weight: 600; border-color: var(--accent); }
html[data-layout=desktop] .tog.on { background: var(--surface2); }
html[data-layout=desktop] .btn:disabled { color: var(--surface2); background: var(--base); }
html[data-layout=desktop] .askbtns .btn, html[data-layout=desktop] .libbuttons .btn { padding: 6px 16px; min-width: 80px; }
html[data-layout=desktop] input[type=search], html[data-layout=desktop] input[type=text], html[data-layout=desktop] input[type=number],
html[data-layout=desktop] select, html[data-layout=desktop] textarea {
  min-height: 0; padding: 4px 8px; border-radius: 4px; font: inherit; color: var(--text); background: var(--surface0); border: 1px solid var(--surface1); }
html[data-layout=desktop] select { width: auto; }
html[data-layout=desktop] input:focus, html[data-layout=desktop] select:focus, html[data-layout=desktop] textarea:focus { border-color: var(--accent); outline: none; }
html[data-layout=desktop] .dlgbody .row { min-height: 0; padding: 5px 2px; }
html[data-layout=desktop] .dlgbody .links { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
html[data-layout=desktop] .dlgbody .chip { min-height: 0; padding: 3px 10px; }
html[data-layout=desktop] .dlgbody .booklist .book { min-height: 0; padding: 6px 4px; }
html[data-layout=desktop] .switch { width: 40px; height: 22px; }
html[data-layout=desktop] .switch::after { width: 16px; height: 16px; }
html[data-layout=desktop] .switch[aria-checked=true]::after { left: 21px; }
/* The Library window (gui/book_selector.py LibraryDialog) */
.dlg.libwin { border-radius: 0; resize: none; }
.library { display: flex; flex-direction: column; gap: 8px; }
html[data-layout=desktop] .dlgbody.library { padding: 8px 12px; overflow: hidden; }
.librow { display: flex; align-items: center; gap: 6px; flex: none; }
.librow .libsearch { flex: 1; }
.librow .gap { width: 24px; }
.libsplit { flex: 1; display: flex; gap: 6px; min-height: 0; }
.libside { width: 160px; max-width: 200px; display: flex; flex-direction: column; gap: 4px; flex: none; }
.libcolls { flex: 1; overflow: auto; border: 1px solid var(--surface1); background: var(--base); }
.libcoll { display: block; width: 100%; text-align: left; padding: 2px 6px; border-radius: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.libcoll.on { background: var(--surface1); }
.libmain { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.liblist { flex: 1; overflow: auto; border: 1px solid var(--surface1); background: var(--base); outline: none; }
.libtable { border-collapse: collapse; table-layout: fixed; width: max-content; }
.libtable th { position: sticky; top: 0; z-index: 1; background: var(--surface0); color: var(--subtext); font-weight: normal; text-align: left;
  padding: 4px 8px; border-right: 1px solid var(--surface1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.libtable th .grip { position: absolute; top: 0; right: 0; bottom: 0; width: 5px; cursor: col-resize; }
.libtable td { padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.libtable tbody tr:nth-child(even) { background: var(--mantle); }
.libtable tbody tr.sel { background: var(--surface1); }
.libtable .cfav { text-align: center; color: #AAAAAA; cursor: pointer; }
.libtable .cfav.on, .libtable .crate span.on { color: #FFB400; }
.libtable .crate span { color: #AAAAAA; cursor: pointer; }
.libtable .cstatus { cursor: pointer; }
.libdetail { height: 100px; flex: none; overflow: auto; border: 1px solid var(--surface1); background: var(--base); padding: 4px 6px; }
.libdetail .libabout { color: var(--subtext); }
.libgrid { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
.tile { position: relative; width: 150px; height: 220px; flex: none; background: #FFFFFF; border: 1px solid #CCCCCC; border-radius: 6px;
  overflow: hidden; cursor: pointer; color: #333333; font-family: var(--ui-font); }
.tile.sel { background: #D0E0F0; }
.tile .edge { position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.tile .art { position: absolute; left: 6px; right: 6px; top: 8px; height: 130px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; overflow: hidden; }
.tile .art img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 2px 2px 0 rgba(0,0,0,.12); }
.tile .ttitle { position: absolute; left: 6px; right: 24px; top: 140px; font-size: 11px; font-weight: 700; line-height: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tfav { position: absolute; right: 6px; top: 140px; color: #FFB400; font-size: 14px; line-height: 14px; }
.tile .tfoot { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 14px; display: flex; align-items: center; justify-content: space-between; }
.tile .trate span { color: #AAAAAA; font-size: 11px; } .tile .trate span.on { color: #FFB400; }
.tile .ttype { font-size: 9px; }
.library.touch .filters select { width: auto; flex: 1 1 140px; }
/* Book Properties (BookPropertiesDialog) */
.props .form { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.props .form label { text-align: right; }
.props .form textarea { width: 100%; resize: vertical; }
/* On a phone or tablet the note is written in a field like the others (the desktop window has its own, above). */
html:not([data-layout=desktop]) .props .form textarea { font: inherit; color: var(--text); background: var(--surface0); border: 1px solid var(--surface1); border-radius: 10px; padding: 10px 12px; }
