/*
 * bench.css - the styles every bench shares: the frame (top bar, tabs, views, dialogs, menus,
 * the side panel) and the kit's views (Read, Compare, Genealogy, notes, findings, the tour,
 * the Functional overview, Settings, About). Loaded before the bench's own css/research.css,
 * which sets the colours (the custom properties on :root and the themes) and anything of its own,
 * and may override any rule here.
 * Part of bench-kit (github.com/critical-code-studies/bench-kit).
 */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-template-columns: 1fr;
  overflow: hidden;
}
a { color: var(--beam); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: 0.2px; }
code, .mono { font-family: var(--mono); }

/* ---------- top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--bar-1), var(--bar-2));
  border-bottom: 1px solid var(--bar-line);
  color: var(--bar-fg);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; flex: none; }
.brand-name { font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.brand-name b { font-weight: 400; opacity: 0.8; margin-left: 6px; letter-spacing: 2px; text-transform: uppercase; font-size: 11px; }
/* one line by default, whatever a bench's own stylesheet stacks */
.bar .brand-name { display: inline-flex; flex-direction: row; align-items: baseline; gap: 0.6em; white-space: nowrap; }
.bar .brand-name b { margin-left: 0; }
.bar .brand-name .brand-mark { align-self: center; }
.bench-ver { font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); align-self: flex-end; margin-bottom: 2px; }
/* the top bar's small print (the bench's version, the reference and language of the version open)
   in the bar's own ink, dimmed: the page's faint grey is drawn for the page, and on a coloured bar
   (paper's blue) it all but vanished */
header.bar .bench-ver, header.bar .vlang, header.bar #vref { color: color-mix(in srgb, var(--bar-fg) 90%, var(--bar-2)); }
.bar:not(.with-pick) .pick { display: none; }
.bar.with-pick .pick { display: flex; }
.pick { align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; flex: 0 1 auto; min-width: 0; }
.pick select { min-width: 12em; }
.pick { flex-shrink: 0; }
.pick select {
  background: var(--pick-bg); border: 1px solid var(--pick-line); border-radius: 4px;
  padding: 4px 6px; font-size: 14px; text-transform: none; letter-spacing: 0; max-width: 300px; color: var(--pick-fg);
}
.pick select option { color: var(--text); background: var(--surface); }
.bar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.status { font-family: var(--mono); font-size: 12px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; cursor: help; }
.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer;
  width: 30px; height: 30px; display: inline-grid; place-items: center; color: inherit; font-size: 16px;
}
.icon-btn:hover { border-color: color-mix(in srgb, var(--bar-fg) 35%, transparent); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--bg-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 13px 8px; cursor: pointer;
  color: var(--text-dim); font-size: 14px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom: 3px solid var(--beam); padding-bottom: 7px; background: color-mix(in srgb, var(--beam) 9%, transparent); text-shadow: 0.35px 0 0 currentColor, -0.35px 0 0 currentColor; }
/* a view's own heading repeats the menu item it opened from: kept for screen readers, not drawn */
.view-title { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- main + views ---------- */
main { position: relative; overflow: hidden; min-height: 0; }
.view { display: none; height: 100%; overflow: auto; }
.view.on { display: block; }
.view.split.on { display: grid; }
.pad { padding: 16px 20px 40px; max-width: 1200px; }
.hint { color: var(--text-dim); font-size: 13px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--line-soft);
}
.toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.toolbar input[type="search"], .toolbar select, .toolbar input[type="number"] {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; font-size: 13px;
}
.toolbar input[type="search"] { width: 200px; }
#rd-find { width: 150px; }
.toolbar .menu { position: relative; }
.toolbar .menu > summary { list-style: none; display: inline-block; }
.toolbar .menu > summary::-webkit-details-marker { display: none; }
.toolbar .menu[open] > summary { border-color: var(--beam); }
.toolbar .menu-body {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; display: grid; gap: 6px; min-width: 190px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.btn {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 4px;
  padding: 5px 10px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--beam); }
.btn.ghost { background: transparent; }
.btn.on { border-color: var(--beam); color: var(--beam); }
.btn[disabled] { opacity: 0.45; cursor: default; }
abbr.term, a.term { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
a.term { color: inherit; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 9px; border: 1px solid var(--line); color: var(--text-dim); font-family: var(--mono); }
.badge.ok { color: var(--green); border-color: currentColor; }
.badge.warn { color: var(--amber); border-color: currentColor; }
.badge.err { color: var(--red); border-color: currentColor; }
.badge.lost { color: var(--text-faint); }

/* ---------- listing ---------- */
.listing { font-family: var(--code-font); font-size: var(--code-size); line-height: 1.5; padding: 4px 0 60px; tab-size: 8; -moz-tab-size: 8; background: var(--code-bg); }
/* One line per tape: number and name, then the file details (cut short with … if too long). */
.part-head {
  position: sticky; top: 45px; z-index: 3; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px;
  padding: 5px 14px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: 12.5px;
}
.part-head .ph-main { display: flex; gap: 10px; align-items: baseline; flex: none; max-width: 60%; min-width: 0; }
.part-head .ph-sub { flex: 1 1 0; min-width: 0; }
.part-head .ph-sub::before { content: '·'; margin-right: 8px; color: var(--text-faint); }
.part-head .lncols { flex: 0 0 calc(100% + 28px); }
.part-head .ph-num { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
.part-head .ph-title { color: var(--amber); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-head .ph-sub { color: var(--text-dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-head .ph-sub a { color: var(--text-dim); }
/* Small print: explanations that should be there but out of the way. */
.fine { font-size: 11px; line-height: 1.45; max-width: 60em; }
/* The Tape menu; hovering it (or its ?) explains why a version has several files. */
.tape-pick { cursor: help; }
.tape-pick .help-dot { display: inline-block; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 50%; border: 1px solid var(--line); font-size: 10px; color: var(--text-dim); }
/* Column titles, on the same grid as .ln (em widths at the code size, so they line up). */
.lncols {
  display: grid; grid-template-columns: 4.8em 3.6em 5.2em 1fr minmax(2.2em, max-content); column-gap: 10px;
  margin: 4px -14px -2px; padding: 3px 14px 0 6px; border-top: 1px solid var(--line-soft);
  font-size: var(--code-size); color: var(--text-faint); cursor: default;
}
.lncols > span { font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.lncols .n { text-align: right; padding-right: 9px; }
.lncols .mk { padding-left: 4px; }
.hide-words .lncols { grid-template-columns: 4.8em 1fr minmax(2.2em, max-content); }
.hide-words .lncols .a, .hide-words .lncols .w { display: none; }
.ln { display: grid; grid-template-columns: 4.8em 3.6em 5.2em 1fr minmax(2.2em, max-content); column-gap: 10px; padding: 0 14px 0 6px; white-space: pre; min-height: 1.5em; }
.ln:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.ln .n { color: var(--text-faint); text-align: right; cursor: pointer; user-select: none; padding-right: 9px; }
/* +A: a quick annotation, shown by the line number on hover */
.ln .n { position: relative; }
.ln .n .qa { position: absolute; right: calc(9px + var(--d, 3) * 1ch + 3px); top: 50%; transform: translateY(-50%); visibility: hidden; padding: 0 3px; font: 600 10px/1.5 var(--sans); color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.ln:hover .n .qa { visibility: visible; }
.ln .n .qa:hover { color: var(--amber); border-color: var(--amber); }
@media (hover: none) { .ln.sel .n .qa { visibility: visible; } }
.ln .a { color: var(--amber); opacity: 0.85; }
.ln .w { color: var(--text-dim); }
.ln .t { overflow: hidden; text-overflow: ellipsis; }
.ln .mk { text-align: center; user-select: none; }
.ln.sel { background: var(--sel); }
.ln.cur { background: var(--hl); box-shadow: inset 3px 0 0 var(--amber); }
.ln.skip .t { color: var(--text-faint); font-style: italic; }
.ln.err .t { text-decoration: underline wavy var(--red); text-underline-offset: 3px; }
.ln.norm .n { box-shadow: inset -3px 0 0 var(--violet); }
.ln .heat { display: inline-block; height: 0.7em; background: var(--amber); opacity: 0.7; vertical-align: middle; border-radius: 1px; }
.t .lab { color: var(--beam); }
.t .op { color: var(--text); font-weight: 600; }
.t .mac { color: var(--violet); font-weight: 600; }
.t .ps { color: var(--green); }
.t .num { color: var(--amber); }
.t .sym { color: var(--text); cursor: pointer; }
.t .sym:hover { text-decoration: underline; }
.t .var { font-style: italic; }
.t .cm { color: var(--text-dim); font-style: italic; }
.hide-words .ln { grid-template-columns: 4.8em 1fr minmax(2.2em, max-content); }
.hide-words .ln .a, .hide-words .ln .w { display: none; }
.note-dot { display: inline-block; min-width: 1.6em; padding: 0 4px; border-radius: 8px; background: var(--amber); color: var(--on-amber); font-size: 11px; text-align: center; cursor: pointer; font-family: var(--sans); font-weight: 600; }
.note-dot.draft { background: transparent; color: var(--amber); border: 1px dashed var(--amber); }
.expansion { color: var(--text-dim); padding: 2px 0 6px 0; border-left: 2px solid var(--line); margin-left: 4px; padding-left: 10px; font-size: calc(var(--code-size) - 1px); font-family: var(--code-font); }
.selbar {
  position: sticky; bottom: 0; z-index: 6; display: none; gap: 4px; align-items: center; flex-wrap: wrap;
  padding: 4px 14px; background: var(--surface-2); border-top: 1px solid var(--line);
}
.selbar .btn { font-size: 11.5px; padding: 2px 7px; }
.selbar.on { display: flex; }

/* ---------- popover ---------- */
.pop {
  position: fixed; z-index: 50; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); font-size: 13px;
}
.pop h4 { margin: 0 0 4px; font-family: var(--mono); font-size: 14px; }
.pop .refs { max-height: 180px; overflow: auto; margin-top: 6px; font-family: var(--code-font); font-size: calc(var(--code-size) - 1px); }
.pop .refs a { display: block; text-decoration: none; }

/* ---------- drawer ---------- */
body.drawer-open main { margin-right: 380px; }
body.drawer-open.drawer-wide main { margin-right: min(760px, 60vw); }
body.drawer-wide .drawer { width: min(760px, 60vw); }
.drawer .diff .row { grid-template-columns: 3em 1fr 3em 1fr; }
.svgbox.flow [data-col], .svgbox.flow [data-step] { cursor: pointer; }
/* Version names pinned above the flow as it scrolls (compare.js pinLabels). */
.svgbox.flow .flow-head { position: sticky; top: -8px; z-index: 2; background: inherit; margin-top: -8px; padding-top: 8px; width: max-content; }
.svgbox.flow .flow-head svg { display: block; }
.svgbox.flow [data-step]:hover { fill-opacity: 0.95; }
.svgbox.flow [data-col]:hover { stroke: var(--pick-stroke); stroke-width: 1.2; }
.svgbox.flow .picked { stroke: var(--pick-stroke); stroke-width: 1.6; fill-opacity: 1; }
.drawer {
  position: fixed; right: 0; top: var(--bar-h, 0px); bottom: 0; width: 380px; z-index: 20; background: var(--surface);
  border-left: 1px solid var(--line); transform: translateX(100%); transition: transform 0.18s ease;
  display: flex; flex-direction: column;
}
body.drawer-open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-body { overflow: auto; padding: 12px 14px 40px; }

/* ---------- notes / threads ---------- */
.thread { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; background: var(--bg-2); }
.thread .anchor { font-family: var(--mono); font-size: 12px; color: var(--amber); cursor: pointer; }
.note { margin: 6px 0; }
.note .by { font-size: 12px; color: var(--text-dim); }
.note .by b { font-family: var(--mono); color: var(--beam); letter-spacing: 1px; }
.note .body { white-space: pre-wrap; font-family: var(--serif); font-size: 15px; line-height: 1.5; }
.note.reply { margin-left: 16px; padding-left: 10px; border-left: 2px solid var(--line); }
.note .acts { font-size: 12px; }
.note .acts button { background: none; border: 0; color: var(--beam); cursor: pointer; padding: 0 6px 0 0; }
.note.buildlog .by b { color: var(--violet); }
.tagl { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }

/* ---------- run view ---------- */
.run { display: grid; grid-template-columns: minmax(360px, 560px) 6px minmax(0, 1fr); height: 100%; }
.split-v { cursor: col-resize; background: var(--line); opacity: 0.5; touch-action: none; align-self: stretch; }
.split-v:hover, .split-v.on { opacity: 1; background: #6a9ac0; }
.switches { display: flex; gap: 3px; flex-wrap: wrap; }
.switches label { display: grid; justify-items: center; gap: 1px; cursor: pointer; font-size: 9px; }
.switches input { appearance: none; width: 12px; height: 20px; border-radius: 2px; background: #e7e1d0; border: 1px solid #6a5f48; position: relative; cursor: pointer; margin: 0; }
.switches input::after { content: ""; position: absolute; left: 1px; right: 1px; height: 8px; top: 9px; background: #8a7c5c; border-radius: 1px; }
.switches input:checked::after { top: 1px; background: #3b3222; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.keys { font-size: 12px; color: var(--text-dim); }
.keys kbd { font-family: var(--mono); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 11px; }
table.data { border-collapse: collapse; font-size: 13px; width: 100%; }
table.data th, table.data td { border-bottom: 1px solid var(--line-soft); padding: 3px 8px; text-align: left; vertical-align: top; }
table.data th { color: var(--text-dim); font-weight: 600; position: sticky; top: 0; background: var(--bg); cursor: pointer; }
table.data td.mono, table.data td.num { font-family: var(--code-font); font-size: calc(var(--code-size) - 1px); }
table.data td.num { text-align: right; }
table.data tr:hover td { background: var(--surface); }
.trace { font-family: var(--code-font); font-size: calc(var(--code-size) - 1px); }

/* ---------- analysis ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .lede { color: var(--text-dim); font-size: 13px; margin: 0 0 8px; font-family: var(--serif); }
.card .scroll { max-height: 340px; overflow: auto; }
.bars .b { display: grid; grid-template-columns: 8em 1fr 4em; gap: 8px; align-items: center; font-size: 12px; margin: 2px 0; }
.bars .b span:first-child { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b i { display: block; height: 10px; background: var(--beam); opacity: 0.75; border-radius: 1px; }
.bars .b em { font-style: normal; font-family: var(--mono); color: var(--text-dim); text-align: right; }
svg text { font-family: var(--mono); }

/* ---------- compare ---------- */
.diff { font-family: var(--code-font); font-size: calc(var(--code-size) - 0.5px); line-height: 1.45; background: var(--code-bg); }
.diff .row { display: grid; grid-template-columns: 3.8em 1fr 3.8em 1fr; column-gap: 8px; white-space: pre; }
.diff .row > span { overflow: hidden; text-overflow: ellipsis; }
.diff .n { color: var(--text-faint); text-align: right; cursor: pointer; }
.diff .add { background: var(--add-bg); }
.diff .del { background: var(--del-bg); }
.diff .chg { background: var(--hl); }
.diff .fold { grid-column: 1 / -1; color: var(--text-faint); text-align: center; padding: 2px; background: var(--bg-2); cursor: pointer; font-family: var(--sans); font-size: 12px; }
.diff .ins { background: color-mix(in srgb, var(--green) 30%, transparent); border-radius: 2px; }
.diff .rem { background: color-mix(in srgb, var(--red) 30%, transparent); border-radius: 2px; text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-dim); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.svgbox { overflow: auto; border: 1px solid var(--plate-line); border-radius: 6px; background: var(--plate); padding: 8px; }
/* On listing paper, figures are drawn in dark ink on white. */
.legend i { box-shadow: 0 0 0 1px var(--plate-line); }

/* ---------- about ---------- */
.meta { display: grid; grid-template-columns: 11em 1fr; gap: 4px 14px; font-size: 14px; }
.meta dt { color: var(--text-dim); }
.meta dd { margin: 0; }
.prose { font-family: var(--serif); font-size: 16px; line-height: 1.6; max-width: 46em; }
.timeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; }
.timeline .v { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 12px; background: var(--surface); height: 64px; overflow: hidden; min-width: 0; }
.timeline .v > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .v.on { border-color: var(--beam); }
.timeline .v.lost { opacity: 0.55; border-style: dashed; cursor: default; }
.timeline .v b { display: block; font-family: var(--mono); font-size: 13px; }

/* ---------- dialogs, toast ---------- */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.settings { padding: 16px 18px; display: grid; gap: 8px; }
.settings h2 { margin: 6px 0 0; font-size: 16px; }
.settings label { display: grid; gap: 3px; font-size: 13px; color: var(--text-dim); }
.settings input, .settings textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; color: var(--text); }
.settings textarea { font-family: var(--serif); font-size: 15px; resize: vertical; }
.settings .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.settings .token-row { display: flex; gap: 6px; margin-top: -5px; }
.settings .token-row input { flex: 1; min-width: 0; font-family: var(--mono); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 6px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 60; }
.toast.on { opacity: 1; }

/* ---------- small screens ---------- */
/* Code shown elsewhere (decoded tapes, macro bodies) follows the code settings too. */
pre.mono, .pop pre { font-family: var(--code-font); font-size: calc(var(--code-size) - 1px); }
/* Shading samples used in explanatory text. */
.hint .chg, .hint .add, .hint .del { border-radius: 2px; }
.hint .chg { background: var(--hl); }
.hint .add { background: var(--add-bg); }
.hint .del { background: var(--del-bg); }
.size-btns { display: inline-flex; gap: 2px; }
.size-btns .icon-btn { width: auto; padding: 0 6px; font-size: 13px; font-family: var(--sans); }
/* Notes in the margin: initials in small type; a thin amber rule on the lines a note covers. */
.note-dot { min-width: 0; padding: 0 5px; border-radius: 7px; font-size: 10px; letter-spacing: 0.5px; line-height: 1.5; white-space: nowrap; }
.note-dot b { font-weight: 700; opacity: 0.8; }
/* Inline notes show the note itself, so the line-end initials go (as with the cards) */
.rd-body.with-inline .ln .mk, .rd-body.notes-hidden .ln .mk { visibility: hidden; }
/* the Read toolbar's notes button, at its right end: cycles inline, cards, initials, hidden */
.toolbar .notes-mode { margin-left: auto; min-width: 2.6em; font-size: 15px; }
.toolbar .notes-mode:not(.on) { opacity: 0.55; }
.ln .mk { text-align: left; padding-left: 4px; }
/* The minimised side panel. */
.drawer-dock { position: fixed; right: 16px; bottom: 0; z-index: 19; display: none; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.drawer-dock.on { display: block; }
/* The Notes tab: always there while the side panel is closed; other panels' tab sits to its left. */
.notes-tab { position: fixed; right: 16px; bottom: 0; z-index: 19; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.notes-tab:hover { border-color: var(--beam); }
body.drawer-open .notes-tab { display: none; }
.drawer-dock { right: 104px; }
.anchor-none { font-size: 11px; color: var(--text-faint); margin-top: 10px; }
.drawer-dock:hover { border-color: var(--beam); }
.kx { display: inline-block; width: 22px; height: 14px; border-radius: 2px; flex: none; }
/* Replying in place, under the note. */
.reply-box { margin: 6px 0 8px 16px; padding-left: 10px; border-left: 2px solid var(--beam); }
.reply-box textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-family: var(--serif); font-size: 15px; resize: vertical; }
.reply-box textarea:focus { outline: none; border-color: var(--beam); }
.reply-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.note .acts button.del-note { color: var(--red); }
/* Reactions: emoji with the initials of those who left them, in tiny type. */
.reacts { display: inline-flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.react { display: inline-flex; align-items: center; gap: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; font-size: 13px; line-height: 1.6; cursor: pointer; color: var(--text); }
.react small { font-size: 9px; letter-spacing: 0.5px; color: var(--text-dim); font-family: var(--mono); }
.react.mine { border-color: var(--beam); background: color-mix(in srgb, var(--beam) 12%, transparent); }
.react:hover { border-color: var(--beam); }
.react.add { color: var(--text-dim); }
.react-pick { display: inline-flex; gap: 2px; }
.react-pick[hidden] { display: none; }
.react-pick .react { border-color: transparent; background: none; }
/* in a rating bar the reactions are the annotations' pills, not the bar's round buttons */
.fd-rxbar .react { padding: 0 6px; border-radius: 10px; font-size: 13px; line-height: 1.6; color: var(--text); background: var(--bg); }
.fd-rxbar .react.add { color: var(--text-dim); }
.fd-rxbar .react-pick .react { border-color: transparent; background: none; }
.fd-rxbar .react.mine { border-color: var(--beam); background: color-mix(in srgb, var(--beam) 12%, transparent); }
.note .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.note .acts button.ico { font-size: 14px; color: var(--text-dim); padding: 0 5px; }
.note .acts button.ico:hover { color: var(--beam); }
.edit-box .edit-tags { width: 100%; margin-top: 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; font-size: 13px; }

/* ---------- Read: notes filter ---------- */
.listing .ln.nf-hide, .listing .part.nf-empty { display: none; }
.listing .ln.nf-jump { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 2px; }
#rd-nf:empty { display: none; }

/* ---------- findings ---------- */
.findings .fd-list { list-style: none; padding: 0; margin: 12px 0 20px; max-width: 980px; }
.findings .fd { border: 1px solid var(--line-soft); border-radius: 6px; padding: 10px 12px; margin: 0 0 10px; }
.findings .fd p { margin: 6px 0; line-height: 1.5; }
.findings .fd-no { color: var(--text-dim); margin-right: 4px; }
.findings .fd-ev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; }
.findings .fd-ev .btn { font-size: 12px; padding: 2px 8px; }
.findings .fd-gh a { text-decoration: none; }
.findings h3 { margin-top: 22px; }
/* Genealogy flow: clicking a box lights its line of descent */
.svgbox.flow rect.hl { filter: var(--hl-filter); stroke: var(--amber); stroke-width: 1.2; }
.svgbox.flow path.hl { fill-opacity: 0.9; }
/* What's new */
.news-btn { position: relative; }
.news-btn .news-n:empty { display: none; }
.news-btn .news-n { position: absolute; top: -3px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--amber); color: var(--on-amber); font: 600 10px/15px var(--mono); text-align: center; }
.news-list .news-item { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.news-list .news-item:hover { background: var(--surface); }
.news-list .news-meta { font-size: 12px; }
.news-list .news-text { margin-top: 3px; font-size: 13px; white-space: pre-wrap; }
/* Genealogy: chart only, and full screen */
.gen-big .gen-extra { display: none; }
.gen-big .flow-stage .svgbox.flow { max-height: calc(100vh - var(--bar-h, 50px) - 150px) !important; }
.flow-stage:fullscreen { background: var(--bg); padding: 10px 14px; overflow: hidden; }
.flow-stage:fullscreen .svgbox.flow { max-height: calc(100vh - 70px) !important; }
.flow-grip { height: 10px; margin: 2px 0 6px; cursor: ns-resize; border-radius: 4px; background:
  linear-gradient(var(--line), var(--line)) center / 48px 2px no-repeat, var(--surface); border: 1px solid var(--line-soft); }
.flow-grip:hover { background-color: var(--bg-2); }
.flow-stage:fullscreen .flow-grip { display: none; }
/* Genealogy: compact controls */
.toolbar .tb-right { margin-left: auto; }
.toolbar .help-dot { display: inline-block; width: 18px; height: 18px; line-height: 17px; text-align: center; border-radius: 50%;
  border: 1px solid var(--line); font-size: 11px; color: var(--text-dim); cursor: help; }
.gen-versions { max-height: 60vh; overflow: auto; min-width: 300px; gap: 4px !important; }
.gen-versions .row-btns { display: flex; gap: 6px; margin-bottom: 4px; }
.gen-versions .check { white-space: nowrap; }
.flow-bar { padding-top: 6px; padding-bottom: 4px; }
.flow-bar .legend { font-size: 11px; gap: 8px; }
.pal-pick select { max-width: 11.5em; }
/* Wire up your own line of descent (compare.js wireDialog): a list built by adding and dragging. */
dialog.wire-dlg { width: min(560px, 94vw); }
.wire-dlg .wire-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wire-dlg .wire-add select { flex: 1; min-width: 12em; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 6px; color: var(--text); }
.wire-dlg .wire-chain { list-style: none; counter-reset: wire; margin: 4px 0 0; padding: 0; max-height: 46vh; overflow: auto; display: grid; gap: 4px; }
.wire-dlg .wire-chain li { counter-increment: wire; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); cursor: grab; font-size: 13px; }
.wire-dlg .wire-chain li::before { content: counter(wire); min-width: 1.4em; color: var(--text-faint); font-size: 11px; text-align: right; }
.wire-dlg .wire-chain li.wire-empty { counter-increment: none; cursor: default; border-style: dashed; background: none; justify-content: center; }
.wire-dlg .wire-chain li.wire-empty::before { content: none; }
.wire-dlg .wire-chain li.dragging { opacity: 0.4; }
.wire-dlg .wire-chain li.drop { border-color: var(--beam); box-shadow: 0 -2px 0 var(--beam); }
.wire-dlg .wire-grip { color: var(--text-faint); letter-spacing: -2px; }
.wire-dlg .wire-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wire-dlg .wire-acts { display: flex; gap: 2px; }
.wire-dlg .wire-acts .icon-btn { padding: 0 6px; }
.wire-dlg .wire-preview { margin: 4px 0 0; font-size: 12px; color: var(--beam); }
.wire-dlg .wire-preview.bad { color: var(--text-dim); }
/* Genealogy flow: click a pinned version name to hide that version; chips bring it back. */
.svgbox.flow .flow-head text.g-pin { cursor: pointer; }
.svgbox.flow .flow-head text.g-pin:hover { text-decoration: line-through; fill: var(--amber); }
.gen-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 6px; font-size: 12px; }
.gen-hidden .chip { padding: 1px 8px; font-size: 12px; }
/* Genealogy toolbar on one line: short menus, exports in one drop-down (opens leftwards). */
#gn-pal select { max-width: 11em; }
.toolbar .exp-menu > .menu-body { left: auto; right: 0; min-width: 0; justify-items: end; }
/* Stemma */
.svgbox.stemma .st-node:hover rect { stroke-width: 2; }
.svgbox.stemma path.lit { stroke: var(--amber) !important; stroke-width: 2.6 !important; }
.stemma-info { margin: 8px 2px; line-height: 1.6; }
/* Tray */
.tray-head label { display: grid; gap: 4px; font-size: 13px; }
.tray-head input { padding: 6px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.tray-list { list-style: none; padding: 0; margin: 8px 0; }
.tray-item { border: 1px solid var(--line); border-left: 4px solid var(--kind, var(--text-faint)); border-radius: 7px; padding: 0 12px 10px; margin-bottom: 18px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.tray-item[data-kind="figure"], .tray-shlist li[data-kind="figure"] { --kind: var(--beam); }
.tray-item[data-kind="doc"], .tray-shlist li[data-kind="doc"] { --kind: var(--violet); }
.tray-item[data-kind="text"], .tray-shlist li[data-kind="text"] { --kind: var(--green); }
.tray-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 -12px 8px; padding: 7px 12px; background: var(--bg); border-bottom: 1px solid var(--line-soft); border-radius: 0 6px 0 0; }
.tray-row > b { color: var(--kind, var(--text)); }
.tray-ref { font-weight: 700; color: var(--text); background: var(--surface-2, var(--surface)); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.tray-shlist { list-style: none; padding: 0; margin: 8px 0; }
.tray-shlist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-left: 4px solid var(--kind, var(--text-faint)); border-radius: 6px; background: var(--surface); font-size: 13px; }
.tray-acts { margin-left: auto; display: flex; gap: 2px; }
.tray-cap, .tray-text { width: 100%; margin: 6px 0; padding: 5px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.tray-fig { overflow: hidden; background: var(--plate); border-radius: 4px; padding: 4px; }
.tray-fig svg { display: block; max-width: 100%; height: auto; max-height: 220px; }
.tray-item > .tray-fig { cursor: zoom-in; }
.tray-big { width: min(96vw, 1400px); max-height: 92vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 12px 16px; }
.tray-big::backdrop { background: rgba(0,0,0,.6); }
.tray-bighead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tray-bighead .icon-btn { margin-left: auto; }
.tray-big .tray-fig svg { max-height: none; width: 100%; }
.tray-big .tray-tblwrap, .tray-big .tray-code.tray-full { max-height: none; }
.tray-code { font-size: 11px; max-height: 150px; overflow: hidden; margin: 4px 0; }
.seg-btns { display: inline-flex; gap: 2px; }
/* Narrower windows: the top bar gives way (label words, then the tape strip) so its buttons stay on screen */
@media (max-width: 1240px) {
  /* the bench's name and version give way to the version picker; a bar without one keeps them */
  .bar.with-pick .brand-name b, .bar.with-pick .bench-ver, .pick > span { display: none; }
  .bar { gap: 10px; }
  .bar-right { gap: 2px; }
}
/* a bar without the picker gives up the name only where its buttons fill it */
@media (max-width: 380px) { .bar:not(.with-pick) .brand-name b, .bar:not(.with-pick) .bench-ver { display: none; } }
/* the tab row stops where the side panel begins, as the page does */
@media (min-width: 861px) {
  body.drawer-open .tabs { margin-right: 380px; }
  body.drawer-open.drawer-wide .tabs { margin-right: min(760px, 60vw); }
}
/* The note dialog refuses an outside click while it holds text: a shake and a line saying why */
.keep-hint { margin: -4px 0 8px; font-size: 12.5px; color: var(--amber); }
dialog.nudge { animation: nudge 0.35s; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) { dialog.nudge { animation: none; outline: 2px solid var(--amber); } }

/* ---------- Read: notes in the margin ---------- */
.rd-body { position: relative; }
.rd-body .note-margin { display: none; }
@media (min-width: 900px) {
  .rd-body.with-margin { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 26vw, 340px); }
  .rd-body.with-margin .listing { min-width: 0; overflow-x: auto; }
  .rd-body.with-margin .note-margin { display: block; position: relative; border-left: 1px solid var(--line-soft); background: var(--bg-2); }
  .rd-body.with-margin .ln .mk, .rd-body.with-margin .lncols .mk { visibility: hidden; }   /* the cards say who; the column stays for alignment */
}
.mcard { position: absolute; left: 8px; right: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 5px; padding: 6px 8px; font-size: 12.5px; box-shadow: 0 1px 4px rgba(0,0,0,0.25); transition: top 0.15s ease; }
.mcard.draft { border-left-color: var(--text-faint); }
.mcard.pushed::before { content: ''; position: absolute; left: -9px; top: 10px; width: 8px; border-top: 1px dashed var(--line); }
.mcard.flash { box-shadow: 0 0 0 2px var(--amber); }
.mcard .mc-where, .ithread .mc-where { font: 10.5px var(--mono); color: var(--text-faint); cursor: pointer; float: right; }
.mcard .mc-where:hover, .ithread .mc-where:hover { color: var(--beam); }
.mcard .note { margin: 0; padding: 0; border: 0; background: none; }
.mcard .note .body { white-space: pre-wrap; line-height: 1.45; }
.mcard .note .acts { opacity: 0.55; }
.mcard:hover .note .acts { opacity: 1; }
.mcard .mc-more, .ithread .mc-more { margin-top: 4px; background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--beam); font-size: 11px; padding: 1px 8px; cursor: pointer; }
.mcard .mc-replies, .ithread .mc-replies { margin-top: 6px; padding-left: 8px; border-left: 1px solid var(--line-soft); }
.mcard .mc-replies .note, .ithread .mc-replies .note { margin-top: 6px; }
.ln.mlit { background: var(--hl); }

/* ---------- Read: notes inline (the default), under the last line each covers, on the right,
   in type a little smaller than the code ---------- */
.inote { display: flex; flex-direction: column; align-items: flex-end; margin: 2px 14px 6px 0; white-space: normal;
  font: max(10px, calc(var(--code-size) - 2px))/1.4 var(--sans); }
.ithread { width: clamp(260px, 40%, 520px); background: var(--bg-2); border-left: 3px solid var(--amber); border-radius: 0 5px 5px 0; padding: 3px 9px 4px; margin: 0 0 3px; }
@media (max-width: 860px) { .ithread { width: auto; margin-left: calc(6px + 3.2em + 10px); } }
.ithread.draft { border-left-color: var(--text-faint); }
.ithread.flash { box-shadow: 0 0 0 2px var(--amber); }
.ithread .note { margin: 0; }
.ithread .note .body { font: inherit; }
.ithread .note .by, .ithread .note .acts, .ithread .mc-more { font-size: 0.85em; }
.ithread .note .acts { opacity: 0.55; }
.ithread:hover .note .acts { opacity: 1; }
.notes-menu { display: grid; gap: 2px; min-width: 15em; }
.notes-menu button { background: none; border: 0; text-align: left; padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.notes-menu button:hover { background: color-mix(in srgb, var(--beam) 22%, transparent); }
.notes-menu button.on { color: var(--beam); }
.notes-menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; width: 100%; }
/* A note's actions on one row: Reply | reactions | the rest; reactions in the row's own small type */
.note .acts { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; }
.note .acts .acts-sep { width: 1px; align-self: stretch; margin: 2px 8px 2px 2px; background: var(--line); }
.note .acts .react { font-size: inherit; color: var(--text); padding: 0 4px; border-radius: 8px; line-height: 1.5; gap: 2px; }
.note .acts .react small { font-size: 0.8em; }
.note .acts .react.mine { background: color-mix(in srgb, var(--beam) 16%, transparent); }
.note .acts .react:hover { background: var(--surface-2); }
.note .acts .react.add { color: var(--text-dim); }
/* Settings: theme swatches */
.theme-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 0 8px; }
.theme-swatches .hint { flex-basis: 100%; }
.theme-swatches i { width: 22px; height: 16px; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }
.lens-list { width: min(560px, 92vw); max-height: 72vh; overflow: auto; display: grid; gap: 2px; padding: 6px; }
.lens-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 4px; color: var(--text); cursor: pointer; font: inherit; }
.lens-list button:hover { background: color-mix(in srgb, var(--beam) 22%, transparent); }
/* in a menu, three marks that must not be taken for one another: the item under the pointer is
   filled; the item whose submenu is open is filled more lightly, its ▸ lit; the place you are now
   (on) has a bar at its left and its name lit, and no fill */
.lens-list button.on { background: none; box-shadow: inset 3px 0 0 var(--beam); }
.lens-list button.on:hover { background: color-mix(in srgb, var(--beam) 22%, transparent); }
.lens-list button.on b { color: var(--beam); }
.lens-list button b { font-weight: 600; font-size: 13.5px; }
.lens-list button span { display: block; font-size: 12px; color: var(--text-dim); line-height: 1.35; }
/* Tab-row drop-downs (Analyse ▾, Graphics ▾), after the main site's menus */
.tabs button .caret { font-size: 0.9em; opacity: 1; color: var(--text); display: inline-block; transition: transform 0.15s ease; margin-left: 3px; }
.tabs button[aria-expanded="true"] .caret { transform: rotate(180deg); }
.tabs button[aria-expanded="true"] { color: var(--text); }
.tab-menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
.tab-menu .help-ver { padding: 6px 10px 4px; border-top: 1px solid var(--line-soft); margin-top: 4px; font-size: 11.5px; }
.tab-menu[data-w="help"] { width: min(380px, 92vw); }
/* Findings: who added each (colour), the shared/private switch */
.findings .fd { border-left: 4px solid var(--beam); padding-left: 12px; }
.fd-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 4px 0 8px; font-size: 12.5px; }
.fd-who i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.fd-mine { margin-top: 4px; font-size: 12px; padding: 2px 8px; }
.tray-para { font-size: 13px; line-height: 1.45; color: var(--text-dim); margin: 4px 0; }
/* My notes: filters, signature, version, chapter and tags */
.tray-filters { display: flex; flex-wrap: wrap; gap: 12px; }
.tray-filters label { display: flex; align-items: center; gap: 6px; }
.tray-filters select { padding: 4px 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.tray-v { font-size: 12px; color: var(--text-dim); }
.tray-by { font-size: 11px; }
.tray-note { width: 100%; margin: 4px 0; padding: 5px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 13px; resize: vertical; }
.tray-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12.5px; margin-top: 4px; }
.tray-meta label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.tray-meta input { padding: 3px 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; width: 14em; }
.tray-meta .btn, .tray-shared { margin-left: auto; }
.fd-tag { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-dim); margin: 2px 2px 4px 0; }
.toolbar .more-menu > .menu-body { justify-items: stretch; min-width: 190px; }
.toolbar .more-menu .menu-body .btn { text-align: left; }
.fd-own { display: inline-flex; gap: 4px; margin-right: 6px; }
.fd-own .btn, .fd-mine { font-size: 12px; padding: 3px 8px; }
.fd-edit { display: grid; gap: 6px; margin-top: 8px; }
.fd-edit textarea, .fd-edit input { padding: 5px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 13px; }
.toast.act { pointer-events: auto; display: flex; align-items: center; gap: 10px; }
.toast-act { padding: 2px 10px; font-size: 12.5px; }
.tray-bin, .fd-bin { border: 1px dashed var(--line); border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.tray-bin h3 { margin: 0 0 6px; font-size: 14px; }
.tray-binned { font-size: 13px; padding: 3px 0; }
.tray-binned .btn { font-size: 12px; padding: 2px 8px; }
/* functional overview */
.ov { display: grid; gap: 12px; max-width: none; }
.ov-sub { border-collapse: collapse; width: 100%; font-size: 13px; }
.ov-sub th, .ov-sub td { text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ov-sub td.num { text-align: right; white-space: nowrap; }
.selpop { position: fixed; z-index: 80; display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.selpop .btn { padding: 2px 8px; font-size: 12.5px; }
.selpop .hint { font-size: 11.5px; margin: 0 4px; }
.tray-doc { margin: 6px 0; }
.tray-doc > summary { cursor: pointer; font-size: 13px; color: var(--text-dim); }
.tray-doc > summary:hover { color: var(--text); }
.tray-body { margin-top: 6px; display: grid; gap: 6px; }
.tray-body .hint { margin: 4px 0 0; }
.tray-tblwrap { max-height: 320px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 4px; }
.tray-tbl { border-collapse: collapse; width: 100%; font: 12px/1.45 var(--mono); }
.tray-tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; padding: 3px 8px; color: var(--text-dim); }
.tray-tbl td { padding: 2px 8px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.tray-code.tray-full { max-height: 360px; overflow: auto; }
.tray-h { margin: 6px 0 0; }
.fd-filters input[type=search] { min-width: 12em; }
.fd-cgroup { margin: 10px 0 4px; }
.fd-chead { margin: 12px 0 4px; font-size: 14px; border-bottom: 1px solid var(--line-soft); padding-bottom: 3px; }
.fd-cat { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; background: color-mix(in srgb, var(--beam) 16%, transparent); color: var(--text-dim); }
.fd-lvl { font-size: 11px; letter-spacing: -1px; color: var(--amber); }
.fd-minor > summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); margin: 2px 0 6px; }
.ov-binbtn { padding: 2px 8px; font-size: 14px; line-height: 1; }
.ov-binbtn sup { font-size: 10px; margin-left: 1px; color: var(--text-dim); }
.ov-binbtn.on { border-color: var(--beam); background: color-mix(in srgb, var(--beam) 16%, transparent); }
.fd-fig { position: relative; display: inline-block; margin: 6px 0; cursor: zoom-in; background: var(--plate); border-radius: 4px; padding: 4px; }
.fd-thumb { display: block; max-width: min(100%, 520px); max-height: 200px; }
.fd-expand { position: absolute; top: 4px; right: 4px; background: var(--surface); }
.fig-full { display: block; width: 100%; height: auto; }
.fd-side { margin: 4px 0 8px; }
.fd-side .btn { font-size: 14px; padding: 5px 18px; letter-spacing: 0.06em; text-transform: uppercase; }
.fd-members .btn { padding: 2px 10px; font-size: 12.5px; }
.fd-members .btn.on { border-color: var(--beam); background: color-mix(in srgb, var(--beam) 16%, transparent); }
.fd-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.fd-open { margin-right: 4px; }
.fd-title { cursor: pointer; }
.fd-title:hover { text-decoration: underline; }
.fd-replies { margin-left: 8px; font-size: 12.5px; }
.fd-big .tray-bighead { flex-wrap: wrap; }
.fd-rtext { white-space: pre-wrap; line-height: 1.5; margin: 6px 0; }
.fd-rh { margin: 14px 0 6px; font-size: 14px; border-bottom: 1px solid var(--line-soft); padding-bottom: 3px; }
.fd-reply { border-left: 3px solid var(--line); padding: 4px 10px; margin: 6px 0; }
.fd-rhead { font-size: 12px; }
.fd-rx { display: inline-block; font-size: 12px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; margin-right: 4px; }
.fd-replybox { display: grid; gap: 6px; margin-top: 12px; }
.fd-replybox textarea { padding: 6px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.fd-replybox .btn { justify-self: start; }
.fd-rxbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0; }
.fd-rxbar button { background: none; border: 1px solid var(--line); border-radius: 12px; padding: 1px 7px; cursor: pointer; font-size: 14px; color: var(--text-dim); }
.fd-rxbar button.on { border-color: var(--beam); background: color-mix(in srgb, var(--beam) 16%, transparent); }
.fd-rxbar sup { font-size: 10px; margin-left: 2px; }
.fd-rate { display: inline-flex; align-items: center; gap: 1px; margin-right: 10px; }
.fd-rate button { border: none; padding: 0 2px; font-size: 18px; color: transparent; -webkit-text-stroke: 1px var(--text-faint); opacity: .45; }
/* a star given is filled in gold, a star not given is an outline: on the light themes a pale
   fill beside the gold could not be told apart */
.fd-rate button.on { color: var(--star, var(--kin)); -webkit-text-stroke: 0; background: none; opacity: 1; }
/* under the pointer, the rating a click would give: every star up to the one pointed at filled,
   the rest empty */
.fd-rate:has(button:hover) button { color: var(--star, var(--kin)); -webkit-text-stroke: 0; opacity: .8; }
.fd-rate:has(button:hover) button:hover ~ button { color: transparent; -webkit-text-stroke: 1px var(--text-faint); opacity: .45; }
.tray-code.tray-full { white-space: pre; }
.tray-code .tl { white-space: pre; }
.tray-anno { white-space: normal; font-family: var(--sans, inherit); font-size: 12.5px; text-align: right; margin: 3px 0 6px auto; max-width: 80%; padding: 3px 10px 4px; border-right: 3px solid var(--line); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 4px 0 0 4px; }
.tray-anno > div { color: #3f9a62; }
.tray-anno-r { color: var(--text-dim); margin-top: 2px; }
.more-menu .menu-body .hint { margin: 4px 0 0; font-size: 11.5px; }
.tray-ref, .fd-ref { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.02em; margin-right: 6px; }
.fd-noteref { font-size: 10.5px; }
.swref { font: 400 10.5px var(--mono); color: var(--text-faint); letter-spacing: 0.01em; white-space: nowrap; }
.pick .swref { margin-left: 6px; }
.selref { margin-right: 6px; align-self: center; }
.swhid { font-size: 10.5px; padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; background: none; color: var(--text-dim); cursor: pointer; }
.swhid:hover { color: var(--text); border-color: var(--beam); }
.swhid-row { white-space: nowrap; font-size: 11.5px; }
.tray-sync { display: inline-block; font-size: 12px; margin-left: 4px; }
.tray-local { font-size: 11px; color: var(--amber); }

/* ---------- the welcome tour ---------- */
.tour-card { position: fixed; left: 16px; bottom: 16px; z-index: 60; width: min(380px, calc(100vw - 32px)); background: var(--surface);
  color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--beam); border-radius: 8px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); font-size: 13.5px; line-height: 1.5; }
.tour-card h3 { margin: 4px 0 6px; font-size: 15px; }
.tour-card p { margin: 0 0 10px; }
.tour-top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); }
.tour-top .tour-name { flex: 1; }
.tour-top .tour-x { width: 24px; height: 24px; font-size: 13px; color: var(--text-dim); }
.tour-dots { display: flex; gap: 5px; margin: 0 0 10px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); cursor: pointer; }
.tour-dots i.done { background: var(--text-faint); }
.tour-dots i.on { background: var(--beam); }
.tour-nav { display: flex; justify-content: flex-end; gap: 8px; }
.tour-focus { outline: 2px solid var(--amber) !important; outline-offset: 3px; border-radius: 4px; animation: tour-pulse 1.6s ease-in-out 3; }
@keyframes tour-pulse { 50% { outline-color: transparent; } }
/* the tour card sits above Read's selection bar when it shows */
body:has(#view-read.on #rd-selbar.on) .tour-card { bottom: 64px; }
/* Help menu: groups under small headings, divided by a rule */
.tab-menu .menu-group { font-size: 10.5px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-faint); padding: 6px 8px 2px; }
.tab-menu .menu-rule { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 2px; width: auto; }
.refhelp-acts { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.noscript { margin: 16px; padding: 12px 14px; border: 1px solid var(--line, #888); border-radius: 6px; background: var(--surface, #fff); color: var(--text, #111); font-size: 14px; }
.plate h5 { font-size: 13px; margin: 0 0 3px; }
.plate > .hint { font-size: 11.5px; margin: 0 0 8px; min-height: 2.6em; }
.fd-fold { background: none; border: 0; color: var(--text-dim); font-size: 15px; line-height: 1; width: 22px; height: 22px; padding: 0; margin-right: 4px; cursor: pointer; border-radius: 4px; vertical-align: -1px; }
.fd-fold:hover { color: var(--text); background: var(--surface-2); }
.fd-cgroup.folded > :not(.fd-chead) { display: none; }
li.fd.folded > :not(.fd-head) { display: none; }
li.fd.folded { padding-bottom: 2px; }
.tab-menu .menu-group, .tab-menu .menu-rule { grid-column: 1 / -1; }
/* the Graphics menu: its groups in two columns */
.tab-menu[data-w="graphics"] { width: min(420px, 92vw); display: grid; grid-template-columns: 1fr; gap: 2px; }   /* a submenu for each group */
/* assembly errors, explained */
button.badge.err { cursor: pointer; font: 11px/1.4 var(--mono); background: none; vertical-align: middle; white-space: nowrap; }
button.badge.err:hover { filter: brightness(1.2); }
/* rich text in annotations (Markdown, as Hypothesis stores it) */
.note-md, .note .body.note-md, .mcard .note .body.note-md { white-space: normal; overflow-wrap: anywhere; }
.note-md p { margin: 0 0 .5em; }
.note-md p:last-child, .note-md ul:last-child, .note-md ol:last-child, .note-md blockquote:last-child, .note-md pre:last-child { margin-bottom: 0; }
.note-md ul, .note-md ol { margin: 0 0 .5em; padding-left: 1.3em; }
.note-md li { margin: .1em 0; }
.note-md blockquote { margin: 0 0 .5em; padding: 0 0 0 .7em; border-left: 3px solid var(--line); color: var(--text-dim); }
.note-md code { font-family: var(--mono, ui-monospace, monospace); font-size: .88em; background: var(--code-bg); border: 1px solid var(--line-soft); border-radius: 3px; padding: 0 .25em; }
.note-md pre.md-pre { margin: 0 0 .5em; padding: 6px 8px; background: var(--code-bg); border: 1px solid var(--line-soft); border-radius: 4px; overflow-x: auto; white-space: pre; }
.note-md pre.md-pre code { background: none; border: 0; padding: 0; font-size: 12px; }
.note-md a { color: var(--beam); text-decoration: underline; text-underline-offset: 2px; }
.note-md .md-h { display: inline-block; margin-top: .2em; }
.md-tools { display: flex; align-items: center; gap: 2px; margin: 0 0 3px; flex-wrap: wrap; }
.md-tools button { font: 12px/1 var(--sans, inherit); min-width: 26px; height: 24px; padding: 0 6px; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.md-tools button:hover { color: var(--text); border-color: var(--text-faint); }
.md-tools button.on { color: var(--beam); border-color: var(--beam); }
.md-tools code { background: none; border: 0; font-size: 12px; }
.md-tools .md-sep { width: 8px; }
.md-preview { min-height: 5.5em; padding: 6px 8px; border: 1px dashed var(--line); border-radius: 4px; font-family: var(--serif); font-size: 15px; line-height: 1.5; }
.md-rich { padding: 6px 8px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font-family: var(--serif); font-size: 15px; line-height: 1.5; overflow-y: auto; max-height: 50vh; outline: none; }
.md-rich:focus { border-color: var(--text-faint); }
.md-rich:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.md-rich[hidden] { display: none; }
.md-tools .md-mode { margin-left: auto; display: inline-flex; }
.md-tools .md-mode button { border-radius: 0; }
.md-tools .md-mode button:first-child { border-radius: 3px 0 0 3px; }
.md-tools .md-mode button:last-child { border-radius: 0 3px 3px 0; border-left: 0; }
.md-tools .md-link { display: inline-flex; gap: 2px; margin-left: 4px; }
.md-tools .md-link[hidden] { display: none; }
.md-tools .md-link input { width: 220px; height: 24px; font: 12px var(--mono); padding: 0 6px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 3px; }
/* links between annotations */
a.swlink { color: var(--text-dim); text-decoration: underline dotted var(--text-faint); text-underline-offset: 2px; cursor: pointer; font: 11px/1.3 var(--sans); letter-spacing: .01em; }
a.swlink:hover, a.swlink:focus-visible { color: var(--amber); text-decoration-color: var(--amber); }
a.swlink::before { content: '↪\00a0'; text-decoration: none; display: inline-block; }
.note .backl { margin-top: 3px; font-size: 11px; line-height: 1.4; }
.note.note-flash { animation: note-flash 1.6s ease-out; }
@keyframes note-flash { 0%, 30% { box-shadow: 0 0 0 2px var(--amber); background: var(--hl); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .note.note-flash { animation: none; box-shadow: 0 0 0 2px var(--amber); } }
.link-pick { width: min(720px, 94vw); }
.link-pick .lp-bar { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.link-pick .lp-bar input { flex: 1 1 240px; padding: 5px 8px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.link-pick .lp-bar select { max-width: 100%; }
.link-pick .lp-list { max-height: 60vh; overflow-y: auto; display: grid; gap: 2px; }
.link-pick .lp-item { display: grid; gap: 2px; text-align: left; padding: 6px 8px; background: none; color: var(--text); border: 1px solid transparent; border-radius: 4px; cursor: pointer; font: inherit; }
.link-pick .lp-item:hover, .link-pick .lp-item:focus { background: var(--sel); border-color: var(--line); }
.link-pick .lp-where { font-size: 12px; color: var(--amber); }
.link-pick .lp-text { font-size: 13px; color: var(--text-dim); }
/* Help ▸ Advanced annotation */
.annohelp { width: min(820px, 96vw); }
.annohelp .ah { max-height: 78vh; overflow-y: auto; padding-right: 6px; font-size: 14px; line-height: 1.55; }
.annohelp h3 { margin: 18px 0 6px; font-size: 15px; }
.annohelp .ah-fig { margin: 10px 0 14px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); }
.annohelp .ah-fig figcaption { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.annohelp .ah-try { width: 100%; box-sizing: border-box; }
.annohelp .ah-store { margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
.annohelp .ah-store code { font-family: var(--mono); background: none; }
.annohelp .ah-static { user-select: none; }
.annohelp .ah-static * { cursor: default; }
.annohelp .ah-card { max-width: 460px; margin: 0; }
.annohelp .ah-card .acts button { pointer-events: none; }
.annohelp .ah-hot { box-shadow: 0 0 0 2px var(--amber); border-radius: 3px; }
.annohelp .ah-pick { max-width: 520px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.annohelp .ah-pick .lp-item { display: grid; gap: 2px; padding: 6px 8px; border-radius: 4px; }
.annohelp .ah-pick .lp-item.on { background: var(--sel); border: 1px solid var(--line); }
.annohelp .ah-pick .lp-list { display: grid; gap: 2px; }
.annohelp .ah-pick .lp-where { font-size: 12px; color: var(--amber); }
.annohelp .ah-pick .lp-text { font-size: 13px; color: var(--text-dim); }
.annohelp .ah-pick .lp-bar { display: flex; gap: 6px; margin: 8px 0; }
.annohelp .ah-pick .lp-bar input { flex: 1; padding: 4px 8px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.ah-call { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--amber); color: #000; font: 600 11px/1 var(--sans); margin: 0 4px; vertical-align: middle; text-decoration: none; }
.annohelp .ah-steps { margin: 6px 0 10px; padding-left: 1.4em; }
.annohelp .ah-steps li { margin: 3px 0; }
.annohelp .ah-marks td:nth-child(2), .annohelp .ah-marks td:nth-child(3) { white-space: nowrap; }
.annohelp kbd { font: 11px var(--mono); padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2); }
.ah-svg { width: 100%; max-width: 560px; height: auto; display: block; }
.ah-svg .ah-box { fill: var(--surface); stroke: var(--line); }
.ah-svg .ah-t { fill: var(--text); font: 12px var(--sans); }
.ah-svg .ah-b { font-weight: 600; }
.ah-svg .ah-l { fill: var(--text-dim); }
.ah-svg .ah-f, .ah-svg .ah-s { fill: var(--text-dim); font-size: 11px; }
.ah-svg .ah-line { fill: none; stroke: var(--amber); stroke-width: 1.5; }
.ah-svg .ah-dash { stroke-dasharray: 4 3; stroke: var(--text-dim); }
.ah-svg .ah-arrhead { fill: var(--amber); }
.md-tools .md-help { margin-left: 4px; }
/* two shades: a line, a block */
.ln.blk { --blk: color-mix(in srgb, var(--anno-line) 32%, transparent); }
.ln.blk.mlit { --blk: color-mix(in srgb, var(--anno-line) 85%, transparent); }
.ln.blk.blk-b { --blk: color-mix(in srgb, var(--anno-block) 38%, transparent); }
.ln.blk.blk-b.mlit { --blk: color-mix(in srgb, var(--anno-block) 90%, transparent); }
.mcard.blockn, .ithread.blockn { border-left-color: var(--anno-block); }
.mcard.blockn.draft, .ithread.blockn.draft { border-left-color: var(--text-faint); }
.ln.blk .w { background: linear-gradient(var(--blk), var(--blk)) right 7px top / 2px 100% no-repeat; }
.ln.blk-top .w { background: linear-gradient(var(--blk), var(--blk)) right 7px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 9px 1px no-repeat; }
.ln.blk-end .w { background: linear-gradient(var(--blk), var(--blk)) right 7px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 9px 1px no-repeat; }
.ln.blk-top.blk-end .w { background: linear-gradient(var(--blk), var(--blk)) right 7px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 9px 1px no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 9px 1px no-repeat; }
.rd-body.notes-hidden .ln.blk .w { background: none; }
mark.frag { background: none; color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--anno-block) 60%, transparent); text-underline-offset: 3px; }
mark.frag.lit { background: color-mix(in srgb, var(--anno-block) 20%, transparent); text-decoration-color: var(--anno-block); }
.note .frag-q { margin: 2px 0 4px; }
.note .frag-q.folded { margin: 0 0 2px; }
.note .frag-q.folded pre { display: none; }
.note .frag-q .cf-own { display: inline-block; cursor: pointer; font: 10.5px/1.4 var(--sans); color: var(--text-faint); user-select: none; }
.note .frag-q .cf-own:hover { color: var(--text-dim); }
.mcard .frag-q .cf-own, .ithread .frag-q .cf-own { display: none; }
/* in Read, the card's corner does it */
.mcard .note .frag-q.folded, .ithread .note .frag-q.folded { margin: 0; }
.mc-where .cf-tog { cursor: pointer; }
.mc-where .cf-tog:hover { color: var(--text); }
.note .frag-q pre { margin: 1px 0 3px; padding: 0 0 0 7px; font: 11px/1.35 var(--code-font); color: var(--text-faint); background: none; border-left: 1px solid color-mix(in srgb, var(--anno-block) 40%, transparent); white-space: pre-wrap; max-height: 6.8em; overflow: auto; }
/* Developer mode */
.dev-only { display: none !important; }
body.dev-on .dev-only { display: revert !important; }
.dev-badge { font: 600 10px/1 var(--sans); padding: 1px 4px; border-radius: 3px; color: #000; background: var(--violet); letter-spacing: .03em; }
.note .dev-check { font-size: 12px; margin: 4px 0; }
#note-dev[hidden] { display: none; }
/* the word column hidden (by choice, or on a narrow screen): the bracket by the line number */
.hide-words .ln.blk .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat; }
.hide-words .ln.blk-top .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 5px 1px no-repeat; }
.hide-words .ln.blk-end .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 5px 1px no-repeat; }
.hide-words .ln.blk-top.blk-end .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 5px 1px no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 5px 1px no-repeat; }
@media (max-width: 860px) {
  .ln.blk .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat; }
  .ln.blk-top .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 5px 1px no-repeat; }
  .ln.blk-end .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 5px 1px no-repeat; }
  .ln.blk-top.blk-end .n { background: linear-gradient(var(--blk), var(--blk)) right 3px top / 2px 100% no-repeat, linear-gradient(var(--blk), var(--blk)) right top / 5px 1px no-repeat, linear-gradient(var(--blk), var(--blk)) right bottom / 5px 1px no-repeat; }
}
.rd-body.notes-hidden .ln.blk .n { background: none; }
/* folding Address and Word from the column headings */
.lncols .w, .lncols .t { position: relative; }
.toolbar .undo-pair { display: inline-flex; gap: 2px; margin-left: 4px; }
.toolbar .undo-pair .btn { min-width: 30px; padding-left: 6px; padding-right: 6px; }
/* room in an annotation: a rule under its header and above its buttons (replies stay compact) */
.note:not(.reply) > .by { padding-bottom: 4px; margin-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.note:not(.reply) > .acts { padding-top: 4px; margin-top: 7px; border-top: 1px solid var(--line-soft); }
.mcard > .mc-where, .ithread > .mc-where { line-height: 1.6; }
/* between the header rule and the buttons: the annotation's content, on the page's own ground */
.note:not(.reply) > .nbody { background: var(--bg); border-radius: 3px; padding: 5px 8px; margin: 0 -3px; }
/* in dark themes, lighter than the card, not darker, so it reads as content (each theme sets color-scheme) */
.note:not(.reply) > .nbody { background: light-dark(var(--bg), color-mix(in srgb, var(--text) 6%, var(--surface-2))); }
.note.reply > .nbody { padding: 0; }
/* an annotation's buttons: reply, reactions, copy, download on the left; link, My notes, edit, delete on the right */
.note .acts { display: flex; flex-wrap: wrap; align-items: center; }
.note .acts .acts-right { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; }
/* folding a card away, and moving it */
.ithread { position: relative; }
/* .mcard is placed absolutely already */
.mcard, .ithread { padding-left: 22px !important; }
.card-fold { position: absolute; left: 4px; top: 4px; width: 14px; height: 16px; padding: 0; font: 11px/1 var(--sans); color: var(--text-faint); background: none; border: 0; cursor: pointer; }
.card-fold:hover { color: var(--text); }
.nfold > .note > .nbody, .nfold > .note > .acts, .nfold > .mc-replies, .nfold > .mc-more { display: none !important; }
.nfold > .note > .by { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.nfold { opacity: .75; }
.mcard > .mc-grip, .ithread > .mc-grip { position: absolute; left: 4px; bottom: 5px; width: 14px; text-align: center; cursor: grab; color: var(--text-faint); font-size: 12px; line-height: 1; user-select: none; }
.mcard > .mc-grip:hover, .ithread > .mc-grip:hover { color: var(--text); }
.mcard > .mc-grip:active, .ithread > .mc-grip:active { cursor: grabbing; }
.ln.drop-at { background: color-mix(in srgb, var(--anno-block) 22%, transparent) !important; box-shadow: inset 3px 0 0 var(--anno-block); }
.edit-lines { display: flex; align-items: center; gap: 4px; margin: 4px 0; font-size: 12px; flex-wrap: wrap; }
.edit-lines input { width: 5em; }
/* Annotations heading: All / Mine / None */
.lncols .mk { position: relative; }
.lncols .ann-cyc { display: inline-block; margin-left: 6px; padding: 0 4px; font: 10px/12px var(--sans); letter-spacing: 0; text-transform: none; color: var(--text-faint); background: none; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; vertical-align: top; }
.lncols .ann-cyc:hover { color: var(--text); border-color: var(--text-faint); }
/* ghosts: annotations from other versions */
.ithread.ghost, .mcard.ghost { opacity: .72; border-left-style: dashed; border-left-color: var(--text-faint) !important; background: transparent; outline: 1px dashed var(--line); outline-offset: -1px; }
.ithread.ghost:hover, .mcard.ghost:hover { opacity: 1; }
.ghost .ghost-tag { font: 600 9.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 1px 4px; border: 1px solid var(--text-faint); border-radius: 3px; color: var(--text-dim); }
.ghost .note:not(.reply) > .nbody { background: transparent; }
.ghost .acts a.swlink { font-size: 12px; }
.lncols .ghost-sw.on { color: var(--text); border-color: var(--text-dim); background: color-mix(in srgb, var(--text) 8%, transparent); }
/* the corner's toggles are buttons (keyboard, screen readers), drawn as text */
.mc-where button.cf-tog, .mc-where button.cf-lines, .frag-q button.cf-own { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mc-where button.cf-lines:hover, .mc-where button.cf-tog:hover { color: var(--beam); }
.mc-where button:focus-visible, .frag-q button:focus-visible, .card-fold:focus-visible, .lncols .ann-cyc:focus-visible { outline: 2px solid var(--beam); outline-offset: 1px; border-radius: 2px; }
/* the corner's toggles are buttons (keyboard, screen readers), drawn as text */
.mc-where button.cf-tog, .mc-where button.cf-lines, .frag-q button.cf-own { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.frag-q button.cf-own { font: 10.5px/1.4 var(--sans); color: var(--text-faint); }
.mc-where button.cf-lines:hover, .mc-where button.cf-tog:hover { color: var(--beam); }
/* open / resolved */
.note .st, .ann-results .st { font: 700 8.5px/1 var(--sans); padding: 2px 4px; letter-spacing: .06em; border-radius: 3px; vertical-align: 1px; }
.note .st-open, .ann-results .st-open { color: #000; background: var(--amber); }
.note .st-res { color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 50%, transparent); }
/* earlier wordings */
.note .by button.hist { font: inherit; font-style: italic; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.note .by button.hist:hover { color: var(--beam); }
.hist-list { max-height: 50vh; overflow: auto; display: grid; gap: 8px; max-width: 420px; }
.hist-item { border-left: 2px solid var(--line); padding-left: 8px; }
/* search every annotation */
.ann-search { display: grid; gap: 4px; margin: 0 0 10px; }
.ann-search input[type="search"] { width: 100%; box-sizing: border-box; padding: 6px 8px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.ann-search .check { font-size: 12px; }
.ann-results { display: grid; gap: 2px; }
.ann-results .as-hit { display: grid; gap: 2px; text-align: left; padding: 6px 8px; background: none; color: var(--text); border: 1px solid transparent; border-radius: 4px; cursor: pointer; font: inherit; }
.ann-results .as-hit:hover, .ann-results .as-hit:focus { background: var(--sel); border-color: var(--line); }
.ann-results .as-where { font: 11.5px var(--mono); color: var(--text-dim); }
.ann-results .as-text { font-size: 13px; color: var(--text); }
.ann-results mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; border-radius: 2px; }
/* @mentions */
.mention { font-weight: 600; color: var(--beam); background: color-mix(in srgb, var(--beam) 10%, transparent); border-radius: 3px; padding: 0 2px; }
.md-mention { display: grid; gap: 1px; margin: 2px 0; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.md-mention[hidden] { display: none; }
.md-mention button { text-align: left; font: 12px var(--sans); color: var(--text); background: none; border: 0; padding: 3px 6px; border-radius: 3px; cursor: pointer; }
.md-mention button:hover, .md-mention button:first-child { background: var(--sel); }
.mention-you { color: var(--amber); }
.note .st-help, .ann-results .st-help { color: var(--bg); background: var(--red); }
.annohelp .mono, .joinhelp .mono { font-family: var(--mono); font-size: .88em; }
.linkbtn { font: inherit; color: var(--beam); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--text); }
.join-hint { margin-top: 4px; }
/* the join guide: a box for each step, with a big number */
.joinhelp .js-steps { display: grid; gap: 12px; margin-top: 14px; }
.joinhelp .js-step { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.joinhelp .js-num { font: 800 48px/1 var(--sans); color: var(--beam); text-align: center; padding-top: 2px; text-shadow: 0 0 14px color-mix(in srgb, var(--beam) 35%, transparent); }
.joinhelp .js-then .js-num { color: var(--green); text-shadow: none; font-size: 40px; }
.joinhelp .js-body h3 { margin: 0 0 6px; }
.joinhelp .js-body .ah-steps { margin-bottom: 4px; }
.joinhelp .js-body p:last-child { margin-bottom: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 520px) { .joinhelp .js-step { grid-template-columns: 40px 1fr; gap: 10px; padding: 12px; } .joinhelp .js-num { font-size: 34px; } }

/* ---------- Run: the teletype ---------- */
.fd.fd-click { cursor: pointer; }
.fd.fd-click:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.fd.fd-click .fd-title:hover { text-decoration: underline; }
.note .by .ncode { font-size: 10px; color: var(--text-faint); border: 1px solid var(--line-soft); border-radius: 3px; padding: 0 4px; cursor: copy; }
.note .by .ncode:hover { color: var(--text); border-color: var(--line); }
.fd.note-flash, .tray-item.note-flash { animation: note-flash 1.6s ease-out; }
.news-btn.has-mine { color: var(--amber); }
.news-btn.has-due { color: #b0302a; }
.news-item.news-mine { border-left: 3px solid var(--amber); padding-left: 8px; }
.pop .code-in { width: 100%; font-size: 14px; padding: 5px 8px; margin: 4px 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.fd .st, .fd-big .st { font: 700 9.5px/1 var(--sans); letter-spacing: .05em; padding: 2px 5px; border-radius: 3px; vertical-align: 2px; }
.fd .st-open, .fd-big .st-open { color: #000; background: var(--amber); }
.fd .st-help, .fd-big .st-help { color: var(--bg); background: var(--red); }
.fd .st-res, .fd-big .st-res { color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 50%, transparent); }

/* ---------- codes in text, and the joining guide as a form (paratexts and guides are in kit/paratexts.css) ---------- */
a.swcode { font-size: .92em; }
.joinhelp .js-form { display: grid; gap: 6px; max-width: 34em; margin: 6px 0; }
.joinhelp .js-form label { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--text-dim); }
.joinhelp .js-form input { font: 13px var(--sans); padding: 4px 7px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; min-width: 0; }
.joinhelp .js-pw { display: flex; gap: 6px; }
.joinhelp .js-pw input { flex: 1; }
.joinhelp .js-ok { margin: 4px 0; font-size: 13px; min-height: 1em; }
.joinhelp .js-ok.good { color: var(--green); }
.joinhelp .js-ok.warn { color: var(--amber); }
.joinhelp .js-ok.err { color: var(--red); }
@media (max-width: 520px) { .joinhelp .js-form label { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Help pages (helppages.js): Referencing and versions, What you should read, Reconstruction cards ---------- */
.refhelp { max-width: 1180px; }
.refhelp .tray-bighead { display: flex; align-items: center; gap: 8px; }
.refhelp .tray-bighead > b { flex: 1; white-space: nowrap; }
.refhelp-ex { font-size: 18px; margin: 6px 0 10px; color: var(--beam); }
.refhelp h4 { margin: 14px 0 6px; }
.refhelp-t td { vertical-align: top; }
.refhelp-t a.ref-more { font-size: 10.5px; white-space: nowrap; }
.refhelp-t .swhid-row.tiny { font-size: 10px; white-space: nowrap; }
.refhelp-t .swhid-row.tiny .swhid { font-size: 10px; padding: 0 3px; }
.swref, .swref-c { cursor: pointer; }
.swref:hover, .swref-c:hover { color: var(--beam); text-decoration: underline dotted; text-underline-offset: 2px; }
.refhelp-ports > summary { list-style: none; cursor: pointer; }
.refhelp-ports > summary::-webkit-details-marker { display: none; }
.refhelp-ports > summary h4 { display: inline-block; margin: 14px 0 6px; }
.refhelp-ports > summary h4::before { content: '▸'; display: inline-block; margin-right: 6px; color: var(--text-dim); transition: transform .15s; }
.refhelp-ports[open] > summary h4::before { transform: rotate(90deg); }
/* the Copy and Export ▾ buttons beside a page's title */
.refhelp-acts .card-acts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.refhelp-acts details { position: relative; }
.refhelp-acts details > summary { list-style: none; }
.refhelp-acts details > summary::-webkit-details-marker { display: none; }
.refhelp-acts .menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.refhelp-acts .menu-body .btn { display: block; width: 100%; text-align: left; }
ul.reading { padding-left: 1.2em; }
ul.reading li { margin: 0 0 6px; text-indent: -0.4em; padding-left: 0.4em; }
ul.reading a { overflow-wrap: anywhere; }
/* a reconstruction card, in its bench's gold (--kin) */
.kin-card { border: 1px solid var(--kin); border-left-width: 3px; border-radius: 4px; padding: 10px 14px; margin: 16px 0; background: color-mix(in srgb, var(--kin) 10%, transparent); }
.kin-card h3 { color: var(--kin); margin: 0 0 6px; }
.kin-card h3 .swref-sm { font-size: 11px; font-weight: 400; color: var(--text-faint); margin-left: 6px; }
.kin-card .hint { margin: 0 0 8px; }
.kin-card .kin-t td { font-size: 12.5px; }
.kin-card .kin-t td:first-child { white-space: nowrap; }
.kin-card .rp-chip, .kin-key .rp-chip { font: 600 9.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 2px 5px; border-radius: 3px; border: 1px solid var(--kin); color: var(--kin); margin-left: 0; white-space: nowrap; cursor: help; }
.kin-card .rp-chip.rp-m-yobitsugi, .kin-key .rp-chip.rp-m-yobitsugi { background: color-mix(in srgb, var(--kin) 14%, transparent); }
.kin-card .rp-chip.rp-m-kake, .kin-key .rp-chip.rp-m-kake { background: color-mix(in srgb, var(--kin) 22%, transparent); }
.kin-card .rp-chip.rp-m-mount, .kin-key .rp-chip.rp-m-mount { border-color: color-mix(in srgb, var(--kin) 50%, transparent); color: color-mix(in srgb, var(--kin) 70%, var(--text-faint)); }
.kin-card .rp-chip.rp-m-unc, .kin-key .rp-chip.rp-m-unc { border-color: var(--text-faint); color: var(--text-faint); }
.cardshelp .kin-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; font-size: 12.5px; margin: 6px 0 12px; }
.cardshelp .kin-key div { margin: 3px 0; display: flex; align-items: center; gap: 8px; }
.kin-pick { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; }
.kin-pick select { flex: 1; min-width: 0; max-width: 36em; font: 13px var(--mono); padding: 4px 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.kin-pick + .kin-one .kin-card { margin-top: 10px; }

/* ---------- the Analyse view (lenses.js): its heading and the lens menus ---------- */
.an-head { flex-wrap: nowrap; gap: 8px; }
.an-head .an-desc { font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lens-menu > summary { font-weight: 600; }
.lens-g h5 { margin: 8px 6px 2px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-faint); }
.an-title { font-size: 15px; margin-right: 6px; }
.lens-menu .menu-body .menu-group { font-size: 10.5px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-faint); padding: 6px 8px 2px; grid-column: 1 / -1; }
.lens-menu .menu-body .menu-rule { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 2px; width: auto; grid-column: 1 / -1; }
.tab-menu, .toolbar .menu-body, .lens-menu .menu-body { background: var(--menu-bg); border-color: var(--menu-line); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.25); }
.tab-menu .menu-group, .lens-menu .menu-body .menu-group, .lens-list .lens-g > h5 { background: none; color: var(--text-faint); font-weight: 400; padding: 6px 8px 2px; margin: 0; border-radius: 0; }
.tab-menu .menu-rule, .lens-menu .menu-body .menu-rule { border: 0; border-top: 1px solid var(--menu-line); margin: 5px 4px; }
.lens-list .lens-g + .lens-g { border-top: 1px solid var(--menu-line); margin-top: 5px; padding-top: 3px; }

/* ---------- Read (read.js): breakpoints, the Key, the columns folded away ---------- */
.ln.bp .n { color: var(--red); font-weight: 700; }
.ln.bp .n::before { content: "● "; }
.keylist div { margin: 3px 0; display: flex; align-items: center; gap: 8px; }
.keylist .lab { color: var(--beam); }
.keylist .ps { color: var(--green); }
.keylist .num { color: var(--amber); }
.keylist .cm { color: var(--text-dim); font-style: italic; }
.keylist .errs { text-decoration: underline wavy var(--red); text-underline-offset: 3px; font-family: var(--code-font); }
.keylist div.flow { display: block; }
.lncols .colfold { position: absolute; top: 50%; transform: translateY(-50%); font: 11px/1 var(--sans); letter-spacing: 0; text-transform: none; padding: 1px 4px; color: var(--text-faint); background: none; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.lncols .w .colfold { right: 0; }
.lncols .colfold:hover { color: var(--text); border-color: var(--text-faint); }
.lncols .cf-show { display: none; left: -21px; }
.hide-words .lncols .cf-show { display: block; }
@media (max-width: 860px) { .lncols .colfold { display: none !important; } }
.mc-where button:focus-visible, .frag-q button:focus-visible, .card-fold:focus-visible, .lncols .ann-cyc:focus-visible, .lncols .colfold:focus-visible { outline: 2px solid var(--beam); outline-offset: 1px; border-radius: 2px; }

/* ---------- Graphics (graphics.js): its menus in groups, two columns, a line between the columns and between the rows ---------- */
.lens-menu .menu-body:has(.gfx-grp) { width: min(760px, 94vw); display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; }
.gfx-grp { display: flex; flex-direction: column; min-width: 0; }
.gfx-grp button { text-align: left; }
@media (max-width: 640px) { .tab-menu[data-w="graphics"], .lens-menu .menu-body:has(.gfx-grp) { grid-template-columns: 1fr; } }
.gfx-grp:nth-child(even) { border-left: 1px solid var(--menu-line); padding-left: 6px; }
.gfx-grp:nth-child(n+3) { border-top: 1px solid var(--menu-line); margin-top: 5px; padding-top: 3px; }
@media (max-width: 640px) { .gfx-grp:nth-child(even) { border-left: 0; padding-left: 0; } .gfx-grp:nth-child(n+2) { border-top: 1px solid var(--menu-line); margin-top: 5px; padding-top: 3px; } }

/* ---------- the repairs in Read (kintsugi.js): the stepper, the bar, the list, the squiggle ---------- */
.rp-line { cursor: help; }
.ln.rp-sq { position: relative; }
.listing.no-repairs .ln.rp-sq::after { display: none; }
.toolbar .kin-nav { display: inline-flex; gap: 2px; margin-left: 4px; }
.toolbar .kin-nav[hidden] { display: none; }
.toolbar .kin-nav .btn { padding-left: 7px; padding-right: 7px; }
.ln.kin-flash { animation: kin-flash 1.8s ease-out; }
.kin-list { display: grid; gap: 2px; max-height: 50vh; overflow: auto; max-width: 460px; }
.kin-list a { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; padding: 4px 6px; border-radius: 4px; color: var(--text); text-decoration: none; }
.kin-list a:hover { background: var(--sel); }
.kin-list .kin-w { grid-column: 1 / -1; font-size: 12px; color: var(--text-dim); }
.toolbar .kin-chev { display: inline-block; font-size: 15px; line-height: 0.6; vertical-align: 3px; margin-left: 2px; transition: transform .15s; }
.toolbar .kin-tog.open .kin-chev { transform: rotate(180deg) translateY(-3px); }
.toolbar .kin-bar { flex-basis: 100%; display: flex; align-items: center; gap: 2px; margin: -2px -14px -8px; padding: 3px 14px; border-top: 1px solid var(--line-soft); background: var(--bg); font-size: 12px; min-width: 0; }
.toolbar .kin-bar[hidden] { display: none; }
.kin-bar .kb[disabled] { opacity: .4; cursor: default; }
.kin-bar .kb .ki { display: block; }
.kin-bar .kbs { width: 1px; height: 16px; background: var(--line); margin: 0 5px; flex: none; }
.kin-bar .kin-cur { flex: 1 1 auto; min-width: 0; max-width: 40em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font: inherit; color: var(--text-dim); background: none; border: 0; padding: 0 6px; cursor: pointer; }
.kin-bar .kin-cur:hover { color: var(--text); }

/* ---------- the kit's own, named as they are drawn: Read's kinds of line and their Key, My notes' sync, Findings' levels, the site-map link in the tab row ---------- */
.kx.kdef { background: linear-gradient(to right, var(--violet) 0, var(--violet) 2px, transparent 2px); border: 1px solid var(--line); }
.kx.keq { background: linear-gradient(to right, var(--green) 0, var(--green) 2px, transparent 2px); border: 1px solid var(--line); }
.kx.knoted { background: linear-gradient(to right, var(--amber) 0, var(--amber) 2px, transparent 2px); border: 1px solid var(--line); }
.ln.kdef .n { background: linear-gradient(to right, color-mix(in srgb, var(--violet) 70%, transparent) 0 2px, transparent 2px) no-repeat; }
.ln.keq .n { background: linear-gradient(to right, color-mix(in srgb, var(--green) 70%, transparent) 0 2px, transparent 2px) no-repeat; }
.ln.kcom .n { background: linear-gradient(to right, color-mix(in srgb, var(--text-faint) 80%, transparent) 0 2px, transparent 2px) no-repeat; }
.kx.kcom { background: linear-gradient(to right, var(--text-faint) 0, var(--text-faint) 2px, transparent 2px); border: 1px solid var(--line); }
.fd-lvl.fd-minor, .fd-lvl.fd-notable { opacity: 0.8; }
.tray-sync.sync-ok { color: #3f9a62; }
.tray-sync.sync-err { color: var(--amber); }
.tray-sync.sync-off, .tray-sync.sync-busy { color: var(--text-faint); }
.tabs .tabs-map { margin-left: auto; align-self: center; font-size: 12px; color: var(--text-faint); text-decoration: none; padding: 0 6px; white-space: nowrap; }
.tabs .tabs-map:hover { color: var(--text); text-decoration: underline; }

/* ---------- from the benches: the KWIC lens, the Key's colours, page breaks, small bars, the
   repairs bar and chips, annotated lines, small screens ---------- */
.kwic { font-family: var(--code-font); font-size: calc(var(--code-size) - 1px); }
.kwic .kw { display: grid; grid-template-columns: minmax(3.5em, max-content) minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 6px; padding: 1px 4px; white-space: pre; }
.kwic .kn { color: var(--text-faint); text-align: right; padding-right: 8px; }
.kwic .kl { text-align: right; overflow: hidden; text-overflow: ellipsis; direction: rtl; unicode-bidi: plaintext; }
.kwic .kr { overflow: hidden; text-overflow: ellipsis; }
.kwic .k { color: var(--amber); font-weight: 700; }
.kwic div { cursor: pointer; }
.kwic div:hover { background: var(--surface-2); }
:root:not(.no-note-shade) .rd-body:not(.notes-hidden) .ln.noted:not(.sel):not(.cur):not(.mlit):not(:hover) { background: var(--noted-bg); }
.keylist .lab { color: var(--beam); }
.keylist .mac { color: var(--violet); font-weight: 600; }
.keylist .num { color: var(--amber); }
.pgbrk { color: var(--text-faint); font-size: 0.85em; margin-right: 2px; }
.ov-bar { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ov-bar i { display: block; height: 100%; }
.ln.rp-sq::after { content: ''; position: absolute; z-index: 1; pointer-events: none; left: var(--k0, 6px); width: var(--kw, calc(100% - 20px)); bottom: -1px; height: 4px; background: var(--kin);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpath d='M0 2 Q1.5 -0.4 3 2 T6 2' fill='none' stroke='black' stroke-width='1.3'/%3E%3C/svg%3E") repeat-x 0 0 / 6px 4px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpath d='M0 2 Q1.5 -0.4 3 2 T6 2' fill='none' stroke='black' stroke-width='1.3'/%3E%3C/svg%3E") repeat-x 0 0 / 6px 4px; }
.rp-chip.rp-m-mount { border-color: color-mix(in srgb, var(--kin) 50%, transparent); color: color-mix(in srgb, var(--kin) 70%, var(--text-faint)); }
@keyframes kin-flash { 0%, 35% { background: color-mix(in srgb, var(--kin) 26%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .ln.kin-flash { animation: none; background: color-mix(in srgb, var(--kin) 18%, transparent); } }
.kin-k { font: 600 9.5px/1.6 var(--sans); text-transform: uppercase; letter-spacing: .05em; padding: 0 5px; border-radius: 3px; border: 1px solid var(--kin); color: var(--kin); }
.kin-bar .kb { display: inline-flex; align-items: center; gap: 3px; height: 24px; min-width: 24px; justify-content: center; padding: 0 5px; font: 12px var(--sans); color: var(--kin); background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; flex: none; }
.kin-bar .kb:hover:not([disabled]) { border-color: color-mix(in srgb, var(--kin) 50%, var(--line)); }
.kin-bar .kb[aria-pressed="true"] { background: color-mix(in srgb, var(--kin) 18%, transparent); border-color: color-mix(in srgb, var(--kin) 55%, transparent); }
.kin-bar .kb-x { margin-left: auto; color: var(--text-faint); }
.kin-bar .kin-cur .mono { color: var(--kin); }
@media (max-width: 860px) {
  body { overflow: auto; }
  .bar { flex-wrap: wrap; }
  .bar.with-pick .brand-name b { display: none; }
  .run { grid-template-columns: 1fr !important; height: auto; }
  body.drawer-open main { margin-right: 0; }
  .drawer { width: 100%; }
  .ln, .lncols { grid-template-columns: 3.2em 1fr 2em; }
  .ln .a, .ln .w, .lncols .a, .lncols .w { display: none; }
  .diff .row { grid-template-columns: 3em 1fr; }
  .diff .row > span:nth-child(3), .diff .row > span:nth-child(4) { display: none; }
  .meta { grid-template-columns: 1fr; }
}

/* code in layers (layers.js): ◀ ▶, the breadcrumb, a definition peeked at below; and the name pop-up as an IDE's hover card (.pop-what, .pop-sec, .pop-row, .pop-go) */
.lay-nav { display: inline-flex; gap: 2px; margin-right: 4px; }
.lay-crumb { flex: 1 0 100%; order: 99; margin: 0 -14px -8px; font: 12px var(--sans); color: var(--text-dim); padding: 4px 14px 5px; border-top: 1px solid var(--line-soft); background: var(--bg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-crumb b { color: var(--amber); font-weight: 600; }
.layer-def { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.layer-def a[data-xgo] { display: inline-block; margin-top: 4px; font-weight: 600; }
.layer-peek { margin: 6px 0 2px; padding: 6px 8px; background: var(--code-bg); border: 1px solid var(--line-soft); border-radius: 4px; font-size: 11.5px; line-height: 1.45; max-width: 560px; overflow-x: auto; white-space: pre; }
.pop .pop-what { color: var(--text-dim); font-size: 12.5px; margin: -2px 0 6px; }
.pop .pop-gloss { font-family: var(--serif); font-size: 14px; line-height: 1.4; margin: 4px 0 6px; }
.pop .pop-src { color: var(--text-faint); font-family: var(--sans); font-size: 11.5px; }
.pop .pop-sec { font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 10px 0 3px; }
.pop a.pop-row { display: grid; grid-template-columns: minmax(7.5em, max-content) 1fr auto; align-items: center; gap: 10px; padding: 2px 4px; margin: 0 -4px; border-radius: 3px; text-decoration: none; color: var(--text); }
.pop a.pop-row:hover { background: var(--surface-2); }
.pop .pop-go, .keylist .pop-go { display: inline-block; padding: 0 4px; border-radius: 3px; font: 600 12px/1.35 var(--sans); color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.pop a:hover .pop-go { background: var(--violet); color: var(--bg); }
.pop .pop-at { color: var(--amber); font: 11.5px var(--mono); white-space: nowrap; }
.pop a.pop-row code { font: 11.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop .pop-more { color: var(--text-faint); font-size: 11.5px; padding: 2px 0; }
.pop a.pop-jump { display: inline-block; margin-top: 6px; font-weight: 600; }

/* a catalogue of what is known to have existed, held here or not (catalogue.js) */
.catalogue h2 { margin: 0 0 6px; }
.catalogue .cat-subset { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 12px; }
.catalogue .cat-subset .hint { flex: 1 1 360px; }
.catalogue .cat-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 10px; }
.catalogue #cat-q { min-width: 220px; flex: 0 1 300px; }
.catalogue .cat-count { margin-left: auto; }
.catalogue .cat-wrap { overflow-x: auto; }
.catalogue .cat-table { min-width: 820px; }
.catalogue .cat-table th:not([data-cat-sort]) { cursor: default; }
.catalogue .cat-file { min-width: 8em; max-width: 13em; font-weight: 600; }
.catalogue .cat-table th { white-space: nowrap; }
.catalogue .cat-desc { max-width: 42em; }
.catalogue .cat-ref { max-width: 16em; }
.catalogue .cat-year, .catalogue .cat-go { white-space: nowrap; }
.catalogue .cat-go a { display: block; font-size: 12px; margin-top: 2px; }
.catalogue .cat-go .cat-read { display: block; margin: 0 0 3px; font-size: 12px; }
.catalogue tr.cat-held td { background: color-mix(in srgb, var(--amber) 7%, transparent); }
.catalogue .cat-foot { margin-top: 14px; }
.catalogue .badge.cat-in { color: var(--green); border-color: currentColor; }
.catalogue .badge.cat-out { color: var(--amber); border-color: currentColor; }

/* a newer release live (shell.js): a bar at the foot offering to reload */
.fresh-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: 13px var(--sans); box-shadow: 0 4px 18px rgba(0,0,0,.35); }

/* Marks and conventions (helppages.js): the marks as the benches draw them, gold for a repair (kintsugi) */
.marks-help p { max-width: 70em; }
.marks-table td { vertical-align: top; }
.marks-table td.mk-cell { white-space: nowrap; font-family: var(--code-font, var(--mono)); }
.mk-lost { display: inline-block; padding: 1px 8px; border: 1px dashed var(--kin); border-radius: 3px; color: var(--kin); font: 12px var(--sans); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--kin) 10%, transparent) 6px 12px); }
.mk-fill { color: var(--kin); border-bottom: 2px solid var(--kin); }
.mk-supplied { color: var(--kin); outline: 1px dashed var(--kin); outline-offset: 1px; }
.mk-corr b { font-weight: inherit; background: color-mix(in srgb, var(--kin) 25%, transparent); }
.mk-corr::before { content: "\25CF  "; color: var(--kin); }
.mk-unc { text-decoration: underline wavy var(--text-faint); text-underline-offset: 4px; }
.mk-ill { color: var(--text-faint); }
.mk-erased { text-decoration: line-through; color: var(--text-dim); }
.mk-added { vertical-align: super; font-size: .8em; color: var(--text-dim); }
.mk-omit { color: var(--kin); }
.mk-omit::before { content: "\27E8"; color: var(--text-faint); } .mk-omit::after { content: "\27E9"; color: var(--text-faint); }
.mk-sup { text-decoration: line-through dotted; color: var(--text-faint); }
.mk-sic::after { content: " (!)"; color: var(--text-faint); }
.mk-exp { }
.mk-vac { font-style: italic; color: var(--text-faint); }
.mk-norm { padding: 0 4px; border-radius: 3px; border: 1px solid var(--line); color: var(--text-dim); font-size: .9em; }
.mk-note { color: var(--text-faint); }

/* the card lens (read.js, SW.BENCH.columns): the sequence numbers in a gutter, a column ruler,
   continuation cards joined, contractions written out (marked, after Leiden's (abc)) */
.with-seq .ln, .with-seq .lncols { grid-template-columns: 4.8em 3.6em 5.2em 1fr 6.5ch minmax(2.2em, max-content); }
.hide-words.with-seq .ln, .hide-words.with-seq .lncols { grid-template-columns: 4.8em 1fr 6.5ch minmax(2.2em, max-content); }
.ln .sq, .lncols .sq { color: var(--text-faint); font-style: italic; text-align: right; }
.card-ruler { position: sticky; top: 0; z-index: 2; background: var(--bg); color: var(--text-faint); font-size: .85em; }
.card-ruler .t span { display: inline; }
.card-ruler .cr-label { background: color-mix(in srgb, var(--amber) 12%, transparent); }
.card-ruler .cr-flag { background: color-mix(in srgb, var(--violet) 30%, transparent); color: var(--text); }
.card-ruler .cr-text { background: color-mix(in srgb, var(--text) 5%, transparent); }
.card-ruler .cr-seq { background: color-mix(in srgb, var(--kin) 12%, transparent); }
.ln.card-folded { display: none; }
.card-joined { border-left: 2px solid var(--line); margin-left: 1ch; padding-left: 1ch; }
.card-x { text-decoration: underline dotted var(--kin); text-underline-offset: 3px; cursor: help; }
.card-x-open::after { content: "?"; font-size: .75em; vertical-align: super; color: var(--kin); }
.card-note { max-width: 32em; white-space: normal; margin-top: 4px; }
@media (max-width: 720px) { .with-seq .ln .sq, .with-seq .lncols .sq { display: none; } .with-seq .ln, .with-seq .lncols, .hide-words.with-seq .ln, .hide-words.with-seq .lncols { grid-template-columns: 3.2em 1fr 2em; } }

/* a two-state switch on a toolbar (base.js SW.flip): the state you are in, the dot lit in the second */
.btn.flip { display: inline-flex; align-items: center; gap: 5px; }
.btn.flip .flip-dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid currentColor; }
.btn.flip[aria-pressed="true"] { border-color: var(--kin); color: var(--kin); }
.btn.flip[aria-pressed="true"] .flip-dot { background: var(--kin); border-color: var(--kin); }

/* submenus (menus.js SW.menuSub): an item that opens a list beside it, placed against the window */
.menu-sub { position: relative; }
.lens-list .menu-subopen { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: center; }
.lens-list .menu-subopen span { grid-column: 1; }
.menu-subcaret { grid-column: 2; grid-row: 1 / span 2; font-style: normal; color: var(--text-faint); }
.menu-sub.open > .menu-subopen { background: color-mix(in srgb, var(--beam) 12%, transparent); }
.menu-sub.open > .menu-subopen .menu-subcaret { color: var(--beam); }
.menu-subbody { position: fixed; z-index: 61; width: min(420px, 90vw); max-height: 70vh; overflow: auto; display: grid; gap: 2px; padding: 6px;
  background: var(--menu-bg, var(--surface)); border: 1px solid var(--menu-line, var(--line)); border-radius: 6px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5); }
.menu-subbody.inline { position: static; width: auto; max-height: none; box-shadow: none; border: 0; border-left: 2px solid var(--line); border-radius: 0; margin: 2px 0 4px 10px; padding: 0 0 0 4px; }
.menu-subbody[hidden] { display: none; }
/* Read ▾: the ▾ opens the menu from another view, the name goes back to Read (kit/menus.js) */
#tabs [data-menu="read"] .caret { padding: 4px 2px 4px 6px; margin: -4px -2px -4px 0; }
/* Getting set up (kit/notes.js): where the reader stands, two steps for each service */
.joinhelp .js-checkwrap { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); margin: 6px 0 12px; }
.joinhelp .js-checkwrap h3 { margin: 0 0 4px; }
.js-checks { list-style: none; margin: 4px 0; padding: 0; }
.js-ck { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.js-ck:last-child { border-bottom: 0; }
.js-ck .js-mark { display: inline-block; width: 1.2em; font-weight: 700; text-align: center; }
.js-ck.good .js-mark { color: var(--green); }
.js-ck.err .js-mark { color: var(--red); }
.js-ck.todo .js-mark { color: var(--text-dim); }
.js-ck .btn { padding: 1px 8px; font-size: 12px; }
.joinhelp .js-svc { margin: 18px 0 2px; font-size: 16px; }
.joinhelp .js-step[data-closed] { opacity: .7; }
.joinhelp .js-ok ol { margin: 4px 0 0; }
.set-setup { margin: 0 0 10px; }

/* kit/folder.js: the folder read in place of the published files */
.folder-chip { margin-left: auto; font: 12px var(--sans, system-ui); padding: 2px 8px; border: 1px solid var(--amber, #c90); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap; }
.folder-chip:hover { background: var(--surface); }

/* kit/library.js: the Library, and an entry in a box over the bench */
#view-library .lib { padding: 16px clamp(12px, 3vw, 32px) 80px; }
#view-library .lib h2 { margin: 0 0 6px; }
.lib-intro { color: var(--text-dim); margin: 0 0 10px; max-width: 48em; font-size: 12px; line-height: 1.4; }
.lib-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
/* the tabs and the toolbar, pinned together at the top of the view */
.lib-top { position: sticky; top: 0; z-index: 5; margin-bottom: 10px; padding-top: 6px; background: var(--bg); }
.lib-top .lib-bar { position: static; margin-bottom: 0; }
/* on one line where there is room: the tabs on the left, the toolbar beside them. Where it does not fit, the
   toolbar goes whole onto the line below and the tabs' rule runs the width, as before */
.lib-top { display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 14px; }
.lib-top .lib-tabs { flex: 1 0 auto; margin: 0; }
.lib-top .lib-bar { flex: 1000 1 auto; min-width: 0; padding: 6px 0 8px; }
.lib-tabs { display: flex; gap: 6px; margin: 0 0 12px; padding-left: 2px; border-bottom: 2px solid var(--line); }
/* tabs that look like tabs: a raised card each, the open one joined to the page below, with a coloured top */
.lib-tab { position: relative; margin-bottom: -2px; padding: 8px 20px; border: 1px solid var(--line); border-bottom: 2px solid var(--line); border-radius: 8px 8px 0 0; background: var(--surface-2); color: var(--text-dim); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background 0.12s, color 0.12s; }
.lib-tab:hover { background: var(--surface); color: var(--text); }
.lib-tab:focus-visible { outline: 2px solid var(--beam, var(--accent, #3d63ad)); outline-offset: 2px; }
.lib-tab.on { border-color: var(--line); border-top: 3px solid var(--beam, var(--accent, #3d63ad)); border-bottom-color: var(--bg, var(--surface)); background: var(--bg, var(--surface)); color: var(--text); font-weight: 650; cursor: default; }
.lib-show[hidden] { display: none; }
.lib-q { flex: 1 1 16em; min-width: 10em; }
.lib-n { margin-left: auto; font-size: 12px; }
.lib-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.lib-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 2px 12px; text-align: left; padding: 9px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); cursor: pointer; font: inherit; }
.lib-row:hover { background: var(--surface-2); }
.lib-t { font-weight: 600; }
/* the line under a title; not the medium cover size, which shares the name */
.lib-m:not(.lib-list) { grid-column: 2; color: var(--text-dim); font-size: 13px; }
.lib-h { grid-column: 3; grid-row: 1 / span 2; align-self: center; font: 11px var(--mono); color: var(--text-faint); white-space: nowrap; }
.lib-h.held { color: var(--text-dim); }
.lib-acts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 10px; }
.lib-ib { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; padding: 5px 7px; line-height: 1; }
.lib-ib svg { width: 16px; height: 16px; }
.lib-ib.on { color: var(--accent, #0f5e63); }
.lib-ib-open { display: inline-flex; align-items: center; gap: 6px; }
.lib-ib-open svg { width: 15px; height: 15px; }
.lib-loanbox { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.lib-loandue { color: #b0302a; font: 700 10px/1 var(--mono); letter-spacing: 0.5px; }
.lib-loanmenu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; width: max-content; max-width: min(320px, 80vw); padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.lib-loanmenu[hidden] { display: none; }
.lib-refbox { position: relative; display: inline-flex; }
.lib-refmenu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 6; display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: max-content; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.lib-refmenu[hidden] { display: none; }
.lib-refmenu .btn { text-align: left; }
.lib-loan-oth { flex-basis: 100%; }
.lib-copies { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.lib-rec { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0 0 12px; font-size: 14px; }
.lib-rec dt { color: color-mix(in srgb, var(--beam, #3d63ad) 45%, var(--text-faint)); }
/* a work's box: the title in a lighter band, and the notes on a ground of their own */
.lib-dlg .tray-bighead { margin: -12px -16px 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; background: light-dark(color-mix(in srgb, var(--surface) 45%, #fff), color-mix(in srgb, var(--text) 9%, var(--surface))); }
.lib-pane.lib-dlg .tray-bighead { margin: -10px -14px 12px; padding: 10px 14px; }
.lib-dlg .lib-side { padding: 10px 12px; border-radius: 8px; background: light-dark(color-mix(in srgb, var(--surface-2) 60%, var(--surface)), color-mix(in srgb, var(--text) 4%, var(--surface))); align-self: start; }
.lib-rec dd { margin: 0; }
.lib-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.lib-img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.lib-audio { width: 100%; display: block; }
.lib-form { width: min(96vw, 760px); }
.lib-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 10px 0 14px; }
.lib-fields label { display: grid; gap: 3px; font-size: 13px; }
.lib-fields span { color: var(--text-faint); }
.lib-fields input, .lib-fields textarea { width: 100%; box-sizing: border-box; font: inherit; }
.lib-wide { grid-column: 1 / -1; }
.lib-add { margin-left: auto; }
@media (max-width: 760px) { .lib-fields { grid-template-columns: minmax(0, 1fr); } }
.lib-video { width: 100%; max-height: 72vh; display: block; background: #000; }
.lib-text { white-space: pre-wrap; font: 15px/1.6 var(--serif, Georgia, serif); max-height: 72vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
.lib-md { max-height: 72vh; overflow: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 4px; }
@media (max-width: 760px) { .lib-row { grid-template-columns: 30px minmax(0, 1fr); } .lib-row .lib-h { grid-column: 2; grid-row: auto; } .lib-frame { height: 64vh; } }
.lib-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.lib-fbody { display: none; margin-top: 6px; }
.lib-facets.open .lib-fbody { display: block; }
.lib-facets[hidden] { display: none; }
/* a wide window always shows them, whatever its width when the page was drawn */
@media (min-width: 860px) { .lib-body { grid-template-columns: 190px minmax(0, 1fr); } .lib-body > .lib-facets[hidden] + .lib-list { grid-column: 1 / -1; } .lib-ftoggle { display: none; } .lib-fbody { display: block; margin-top: 0; } }
.lib-facets { font-size: 13px; min-width: 0; }
/* the gallery: the works on the left, the one chosen in its box on the right, each scrolling on its own */
.lib-gal { display: grid; grid-template-columns: minmax(220px, 32%) minmax(0, 1fr); gap: 12px; height: calc(var(--lib-vh, 100vh) - var(--lib-top, 0px) - 24px); min-height: 360px; }
.lib-gal-list { overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; }
.lib-gal-list:focus-visible { outline: 2px solid var(--beam, var(--accent, #3d63ad)); outline-offset: 1px; }
.lib-gal-r { display: flex; gap: 9px; align-items: flex-start; padding: 7px 10px; border-bottom: 1px solid var(--line-soft, var(--line)); cursor: pointer; content-visibility: auto; contain-intrinsic-size: auto 56px; }
/* where the next part of a long library is drawn: a line's height, across the whole shelf */
.lib-more { grid-column: 1 / -1; height: 1px; }
.lib-gal-r:hover { background: var(--surface-2); }
.lib-gal-r.on { background: color-mix(in srgb, var(--beam, #3d63ad) 18%, var(--surface)); box-shadow: inset 3px 0 0 var(--beam, #3d63ad); }
.lib-gal-g { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--text-dim); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lib-gal-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lib-gal-t b { font-weight: 600; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lib-gal-t span.lib-gal-m { display: flex; align-items: baseline; min-width: 0; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
/* the author shortens; the level and stars always show */
.lib-gal-w { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lib-gal-m .lib-lvl, .lib-gal-m .lib-rt { flex: none; }
.lib-gal-t .lib-key { margin-right: 5px; vertical-align: 1px; }
.lib-gal-m .lib-rt { margin-left: 6px; }
/* a work's level in the lists: Essential stands out, Minimal recedes */
.lib-lvl { display: inline-block; margin-left: 6px; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; font: 600 9.5px/1.45 var(--sans, Helvetica, Arial, sans-serif); letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px; }
.lib-lvl-essential { color: #b0302a; background: color-mix(in srgb, #b0302a 10%, transparent); }
.lib-lvl-high { color: var(--beam, #3d63ad); }
.lib-lvl-medium { color: color-mix(in srgb, var(--beam, #3d63ad) 50%, var(--text-faint)); }
.lib-lvl-low, .lib-lvl-minimal { color: var(--text-faint); border-color: color-mix(in srgb, var(--text-faint) 50%, transparent); }
.lib-gal-pane { overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 10px 14px; }
.lib-pane [data-x] { display: none; }
/* in the pane, the box's columns follow the pane's width, not the window's: notes go under the record until there is room */
.lib-gal-pane { container: libpane / inline-size; }
.lib-pane .lib-cols { grid-template-columns: minmax(0, 1fr); }
@container libpane (min-width: 820px) { .lib-pane .lib-cols { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); } }
@container libpane (max-width: 480px) { .lib-pane .lib-head { flex-direction: column; } .lib-pane .lib-head-t { width: 100%; } .lib-pane .lib-boxcover { width: 110px; max-height: 170px; } }
@media (max-width: 700px) { .lib-gal { grid-template-columns: minmax(0, 1fr); grid-template-rows: 38% 62%; } }
/* the funnel on the bar shows and hides the filters, so the column's own button is not needed */
.lib-ftoggle { display: none; }
.lib-fbtn[hidden] { display: none; }
/* beside the list, the filters stay in view under the pinned head and scroll on their own */
@media (min-width: 860px) { .lib-facets { position: sticky; top: calc(var(--lib-top, 0px) + 4px); max-height: calc(var(--lib-vh, 100vh) - var(--lib-top, 0px) - 16px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; } }
.lib-facet { margin: 0 0 10px; }
.lib-facet > summary { cursor: pointer; font-weight: 600; color: var(--text-dim); font-size: 12px; margin-bottom: 3px; }
.lib-f { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 2px 6px; border: 0; border-radius: 3px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lib-f span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-f i { font: 11px var(--mono); color: var(--text-faint); }
.lib-f:hover { background: var(--surface-2); }
.lib-f.on { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--beam); font-weight: 600; }
.lib-fmore { border: 0; background: none; padding: 2px 6px; color: var(--text-dim); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.lib-fclear { width: 100%; margin-bottom: 10px; }
.lib-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .lib-cols { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); } }
.lib-side { min-width: 0; }
.in-rate { margin: 0 0 8px; }
.lib-rt, .lib-stars { white-space: nowrap; color: #c8960c; letter-spacing: 1px; }
.lib-m .lib-rt { margin-left: 6px; }
/* on a cover: a small dark box in its lower right corner */
.lib-rt-c { position: absolute; z-index: 1; bottom: 5px; right: calc(50% - var(--cw) / 2 + 5px); padding: 1px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.72); color: #ffd23f; font-size: 9px; line-height: 1.3; }
.lib-s .lib-rt-c { bottom: 3px; right: calc(50% - var(--cw) / 2 + 3px); padding: 0 3px; font-size: 7.5px; }
.lib-sizes[hidden] { display: none; }
.lib-adderr { font-size: 12px; }
.lib-adderr .btn { padding: 0 7px; font-size: 11px; }
.news-extra { margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.news-alert { position: sticky; top: 0; z-index: 1; padding: 6px 10px; border: 1px solid rgba(176, 48, 42, 0.45); border-left: 3px solid #b0302a; border-radius: 4px; background: var(--surface); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
.news-due .news-meta b { color: #b0302a; font: 700 11px var(--mono); letter-spacing: 0.4px; }
.news-due-w { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.news-due-w:hover { text-decoration: underline; }
/* a card turns over: the group's notes scribbled on its back */
.lib-card, .lib-ccard { transform-style: preserve-3d; transition: transform 0.5s; }
.lib-card.flipped, .lib-ccard.flipped { transform: rotateY(180deg); }
.lib-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lib-back { position: absolute; inset: 0; overflow-y: auto; padding: 30px 16px 14px; border-radius: 3px; background-color: inherit; background-image: repeating-linear-gradient(transparent 0, transparent 23px, rgba(61, 99, 173, 0.18) 23px, rgba(61, 99, 173, 0.18) 24px); box-shadow: var(--lib-edge, none); transform: rotateY(180deg); }
/* the back is the same card: its paper, its yellowing and its worn edges, from the front */
/* the side turned away is hidden halfway through the turn, so its controls cannot show through */
.lib-card > .lib-front, .lib-ccard > .lib-front { transition: visibility 0s 0.25s; }
.lib-card.flipped > .lib-front, .lib-ccard.flipped > .lib-front { visibility: hidden; }
.lib-card:not(.flipped) > .lib-back, .lib-ccard:not(.flipped) > .lib-back { visibility: hidden; }
.lib-back { transition: visibility 0s 0.25s; padding-bottom: 34px; }
.lib-addnote { position: absolute; right: 10px; bottom: 8px; padding: 1px 6px; border: 1px solid rgba(61, 99, 173, 0.45); border-radius: 3px; background: rgba(255, 255, 255, 0.6); color: #3d63ad; font: 10px/1.5 Helvetica, Arial, sans-serif; cursor: pointer; }
.lib-addnote:hover { background: #fff; }
.lib-turn { position: absolute; z-index: 2; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 50%; background: rgba(255, 255, 255, 0.7); color: #444; font-size: 13px; line-height: 1; cursor: pointer; }
.lib-turn:hover { background: #fff; }
.lib-ccard .lib-front .lib-turn { position: static; flex: none; width: 20px; height: 20px; font-size: 11px; }
.lib-scrawl { margin: 0 0 10px; color: #1f2c6b; font: 15px/1.35 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive; transform: rotate(var(--r, 0deg)); }
.lib-scrawl p { margin: 0; display: inline; }
.lib-scrawl-by { color: #5a3a7a; font-size: 12px; white-space: nowrap; }
.lib-scrawl.faint { color: #777; }
@media (prefers-reduced-motion: reduce) { .lib-card, .lib-ccard { transition: none; } }
/* the card catalogue */
.lib-cat { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 560px); gap: 24px; align-items: start; padding: 4px; }
@media (max-width: 1000px) { .lib-cat { grid-template-columns: minmax(0, 1fr); } }
.lib-cat-by { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 10px; font-size: 13px; color: var(--text-dim); }
.lib-cat-by .btn { padding: 2px 9px; border-radius: 12px; font-size: 12px; }
.lib-cab { padding: 14px; border-radius: 6px; background: linear-gradient(180deg, #8a5a34, #6e4526); box-shadow: inset 0 0 0 3px #5a3820, 0 8px 20px rgba(60, 35, 15, 0.3); }
.lib-cab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.lib-drawer { position: relative; height: 66px; padding: 0; border: 0; border-radius: 3px; background: linear-gradient(180deg, #a87447, #8d5e37); box-shadow: inset 0 0 0 2px #6a4223, inset 0 -6px 10px rgba(0, 0, 0, 0.18); cursor: pointer; }
.lib-drawer:hover { filter: brightness(1.06); }
.lib-drawer.open { outline: 3px solid #e8c26a; outline-offset: 1px; }
.lib-plate { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 92px; max-width: calc(100% - 16px); height: 24px; border-radius: 2px; background: linear-gradient(180deg, #d9b46a, #b88f45); box-shadow: inset 0 0 0 1px #8a6a2c; display: flex; align-items: center; justify-content: center; }
.lib-plate span { display: block; width: calc(100% - 10px); padding: 1px 0; overflow: hidden; background: #fbf6e7; color: #333; font: 600 11px Georgia, serif; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.lib-pull { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); width: 36px; height: 9px; border-radius: 0 0 12px 12px; background: linear-gradient(180deg, #d6b067, #9e7a37); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.lib-dcount { position: absolute; right: 6px; bottom: 3px; color: #f3e3c4; font-size: 9px; opacity: 0.85; }
.lib-cat-hint { margin-top: 40px; }
.lib-tray { position: relative; padding: 18px 22px 12px; border-radius: 4px; background: linear-gradient(180deg, #9b6a3e, #7c5130); box-shadow: inset 0 0 0 3px #5a3820; outline: none; }
.lib-tray:focus-visible { box-shadow: inset 0 0 0 3px #5a3820, 0 0 0 3px #e8c26a; }
.lib-tray-in { position: relative; height: 330px; overflow: hidden; border-radius: 3px 3px 0 0; background: #4a2f19; }
.lib-cback { position: absolute; left: calc(14px + var(--k) * 4px); right: calc(14px + (var(--n) - var(--k)) * 4px); top: calc(12px + var(--k) * 13px); height: 200px; padding: 0; border: 0; border-radius: 3px; background: #f6f0dd; box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.15); cursor: pointer; }
.lib-cback span { position: absolute; top: 1px; left: calc(10px + var(--k) * 12%); max-width: 36%; overflow: hidden; padding: 0 6px; border-radius: 2px 2px 0 0; background: #efe5c8; color: #555; font: 10px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.lib-ccard { position: absolute; left: 10px; right: 10px; bottom: 0; height: 236px; padding: 10px 18px; background: #fdf9ec linear-gradient(#fdf9ec 30px, #c9302c 30px, #c9302c 31px, #fdf9ec 31px); border-radius: 3px; box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.25); color: #222; font: 13px/1.45 'Courier New', monospace; }
.lib-cc-top { display: flex; align-items: center; gap: 6px; height: 18px; }
.lib-cc-top .lib-pp, .lib-cc-top .lib-key { margin: 0; }
.lib-cc-code { margin-left: auto; padding: 0; border: 0; background: none; color: #777; font: 11px var(--mono); cursor: pointer; }
.lib-cc-cn { position: absolute; left: 18px; top: 44px; width: 78px; font-weight: 700; }
.lib-cc-body { margin: 14px 0 0 96px; }
.lib-cc-ti { display: block; margin-left: 16px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lib-cc-ti:hover, .lib-cc-code:hover { text-decoration: underline; }
.lib-cc-k { margin-top: 6px; color: #444; }
.lib-cc-tr { position: absolute; left: 112px; right: 18px; bottom: 38px; color: #444; font-size: 11.5px; }
.lib-cc-hole { position: absolute; left: 50%; bottom: 12px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #4a2f19; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); }
.lib-tray-nav { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: #f3e3c4; font-size: 12px; }
.lib-tray-nav .btn { padding: 2px 9px; color: #2a2a2a; background: #f6f0dd; }
.lib-tray-nav [data-catclose] { margin-left: auto; }
@media (max-width: 520px) { .lib-cc-cn { position: static; width: auto; } .lib-cc-body { margin: 6px 0 0; } .lib-cc-tr { left: 18px; } .lib-tray-in { height: 360px; } .lib-ccard { height: 300px; } }
/* To read: a due stamp, and the card in the book's pocket */
.lib-due { display: inline-block; padding: 0 3px; border: 1px solid #b0302a; border-radius: 2px; color: #b0302a; background: rgba(255, 252, 240, 0.9); font: 700 8px/1.4 var(--mono); letter-spacing: 0.5px; white-space: nowrap; transform: rotate(-4deg); }
.lib-stand .lib-due { position: absolute; z-index: 2; top: 15px; right: calc(50% - var(--cw) / 2 - 4px); }
.lib-s .lib-stand .lib-due { font-size: 6.5px; top: 13px; }
.lib-t .lib-due { margin-left: 8px; vertical-align: 1px; }
.lib-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; gap: 22px; padding: 6px 4px 20px; }
.lib-card { position: relative; padding: 14px 14px 10px; background: #f4ecd4; color: #2a2a2a; border-radius: 3px; box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.18), 4px 6px 14px rgba(0, 0, 0, 0.12); font-family: Helvetica, Arial, sans-serif; }
.lib-card-lib { margin: 0 0 10px 6px; font-weight: 700; font-size: 15px; line-height: 1.1; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 26px; }
.lib-card-lib span { font-weight: 400; }
.lib-card-lib .lib-card-bar { margin: 0 3px; color: #8a8270; }
.lib-card-call { font-weight: 700; }
.lib-card-code, .lib-card-title { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
/* the typed label keeps one size: the call number and code, one line of author, two of title */
.lib-card-label { box-sizing: border-box; height: calc(4 * 1.35em + 16px); overflow: hidden; }
.lib-card-label .lib-card-code { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.lib-cl-a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card-label .lib-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lib-card-code:hover, .lib-card-title:hover { text-decoration: underline; }
.lib-cards-s { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.lib-cards-s .lib-card { zoom: 0.62; }
.lib-cards-s .lib-card-acts > span { display: none; }
.lib-cards-l { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.lib-cards-l .lib-card { zoom: 1.2; }
.lib-loanlist { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; }
.lib-loanlist th { padding: 4px 8px; border-bottom: 1px solid var(--line); color: var(--text-faint); font-weight: 600; text-align: left; }
.lib-loanlist td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.lib-loanlist td.mono { font-size: 11.5px; white-space: nowrap; }
.lib-loanlist-acts { white-space: nowrap; text-align: right; }
.lib-loanlist-acts .btn { padding: 1px 6px; font-size: 12px; }
/* a call number up the spine of a drawn book */
.lib-spine { position: absolute; z-index: 1; bottom: 26px; left: calc(50% - var(--cw) / 2 + 2px); max-height: calc(var(--ch) - 60px); overflow: hidden; writing-mode: vertical-rl; transform: rotate(180deg); color: rgba(255, 255, 255, 0.85); font: 700 7px/1 var(--mono); letter-spacing: 0.6px; white-space: nowrap; pointer-events: none; }
.lib-s .lib-spine { display: none; }
.lib-l .lib-spine { left: calc(50% - var(--cw) / 2 + 5px); font-size: 9px; }
.lib-card-label { margin: 0 0 10px; padding: 8px 10px; background: #fffdf6; border-radius: 3px; font: 13px/1.35 var(--mono); overflow-wrap: anywhere; }
.lib-card-t { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lib-card-t th { padding: 2px 3px; border-top: 2px solid #3d63ad; border-bottom: 1px solid #3d63ad; color: #3d63ad; font: 700 8.5px/1.15 Helvetica, Arial, sans-serif; letter-spacing: 0.6px; text-transform: uppercase; }
.lib-card-t th:nth-child(1), .lib-card-t th:nth-child(3) { width: 74px; }
.lib-card-t td { height: 26px; padding: 0 4px; border-bottom: 1px solid #6f8fd0; vertical-align: bottom; }
.lib-card-t td + td { border-left: 1px solid #3d63ad; }
.lib-card-d { font: 700 11px/1.4 var(--mono); color: #3a3a5a; white-space: nowrap; }
.lib-card-who span { font: 17px/1.1 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive; color: #1f2c6b; }
.lib-card-done .lib-card-who span, .lib-card-done .lib-card-d { text-decoration: line-through; text-decoration-color: currentColor; }
/* lines crossed out fade, as old ink does */
.lib-card.menu-open { z-index: 6; }
/* a full card: a white sticker over the old lines, which show faintly through it */
.lib-card-sheet { position: relative; }
.lib-sticker { position: absolute; inset: -3px -4px -3px -2px; padding: 3px 4px 3px 2px; background: rgba(255, 255, 253, 0.76); border-radius: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transform: rotate(-0.5deg); cursor: pointer; }
.lib-sticker-more { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 2px 3px 0 -1px rgba(255, 255, 253, 0.9), 2px 3px 2px -1px rgba(0, 0, 0, 0.18); }
.lib-sticker .lib-card-t th { color: #4a4a4a; border-color: #6a6a6a; }
.lib-sticker .lib-card-t td { border-color: #a8a8a8; }
.lib-sticker .lib-card-t td + td { border-left-color: #8a8a8a; }
.lib-sticker:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lib-cardall-dlg { width: min(96vw, 520px); }
/* the reader's library card (Settings ▸ Library), after a 1960s plastic student card */
.set-libcard { display: flex; justify-content: center; margin: 2px 0 10px; }
.set-libwipe { margin: 14px 0 4px; }
.set-libwipe + .hint { margin-top: 0; }
/* the card turns over to its back */
.lib-idflip { width: min(100%, 320px); perspective: 1200px; cursor: pointer; border-radius: 4.5% / 7.1%; }
.lib-idflip:focus-visible { outline: 2px solid var(--beam, var(--accent, #3d63ad)); outline-offset: 4px; }
.lib-idflip-in { display: grid; transition: transform 0.6s; transform-style: preserve-3d; }
.lib-idflip.turned .lib-idflip-in { transform: rotateY(180deg); }
.lib-idflip-in > .lib-idcard { grid-area: 1 / 1; width: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lib-idflip-in > .lib-idcard-back { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .lib-idflip-in { transition: none; } }
.lib-idcard-back { background: #efe7d2; color: #3a3328; font-family: Helvetica, Arial, sans-serif; }
.lib-idb { position: absolute; inset: 5% 6%; display: flex; flex-direction: column; gap: 0.9cqw; font-size: 2.9cqw; line-height: 1.25; }
.lib-idb-h { margin-bottom: 1cqw; padding-bottom: 1cqw; border-bottom: 2px solid #b3363b; color: #b3363b; font: 700 3.4cqw/1.2 Georgia, 'Times New Roman', serif; letter-spacing: 0.04em; text-transform: uppercase; }
.lib-idb-r { display: flex; gap: 2cqw; white-space: nowrap; overflow: hidden; }
.lib-idb-r span { flex: 0 0 22%; color: #7a6f5c; text-transform: uppercase; font-size: 2.3cqw; letter-spacing: 0.05em; padding-top: 0.4cqw; }
.lib-idb-r b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; font-family: 'Courier New', Courier, monospace; }
.lib-idb-sig { margin-top: auto; height: 6.5cqw; border-bottom: 1px solid #7a6f5c; background: repeating-linear-gradient(90deg, rgba(179, 54, 59, 0.07) 0 6px, transparent 6px 12px); position: relative; }
.lib-idb-sig span { position: absolute; left: 0; bottom: -3.2cqw; font-size: 2cqw; color: #7a6f5c; text-transform: uppercase; letter-spacing: 0.06em; }
.lib-idb-f { margin-top: 3.4cqw; font-size: 2.1cqw; color: #7a6f5c; }
.lib-idcard { container-type: inline-size; position: relative; width: min(100%, 320px); aspect-ratio: 1.586; box-sizing: border-box; border-radius: 4.5% / 7.1%; background: #efe7d2; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.18); font-family: Georgia, 'Times New Roman', serif; overflow: hidden; }
.lib-idcard-red { position: absolute; inset: 2.6cqw; border-radius: 2.4cqw; background-color: #b3363b; background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 3px); color: #f2e9d4; }
.lib-idcard-t { position: absolute; left: 4%; right: 4%; top: 2.5%; height: 18%; display: flex; align-items: center; justify-content: center; text-align: center; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; line-height: 1.15; }
.lib-idcard-t2 { white-space: normal; text-wrap: balance; }
.lib-idcard-e { position: absolute; left: 22%; top: 21%; width: 17%; fill: none; stroke: #f2e9d4; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.lib-idcard-k { position: absolute; left: 50%; top: 28%; width: 34%; text-align: center; font-size: 5cqw; line-height: 1.12; letter-spacing: 0.04em; text-transform: uppercase; }
.lib-idcard-w { position: absolute; left: 6%; right: 6%; bottom: 6%; height: 41%; border-radius: 4cqw; background: #efe7d2; color: #ece3cc; font: 700 5.4cqw/1 'Courier New', Courier, monospace; letter-spacing: 0.08em; text-shadow: -1px -1px 0 rgba(255, 255, 255, 0.9), 1px 1px 1px rgba(0, 0, 0, 0.32), 2px 2px 3px rgba(0, 0, 0, 0.12); }
.lib-idcard-n { position: absolute; left: 6%; top: 13%; font-size: 7.4cqw; white-space: nowrap; }
.lib-idcard-s { font-size: 4.6cqw; vertical-align: 0.35em; }
.lib-idcard-i { margin-left: 1.4em; font-size: 4.8cqw; vertical-align: 0.3em; }
.lib-idcard-name { position: absolute; left: 6%; right: 4%; top: 52%; white-space: nowrap; overflow: hidden; }
.lib-idcard-y { position: absolute; right: 5%; bottom: 10%; font-size: 3.4cqw; }
.lib-card-all { padding: 12px 14px; border-radius: 3px; color: #2a2a2a; font-family: Helvetica, Arial, sans-serif; }
/* due within the week, or past it: a red stamp across the card's head */
.lib-card-soonstamp { position: absolute; top: 9px; right: 44px; z-index: 2; padding: 1px 6px; border: 2px solid #b0302a; border-radius: 3px; color: #b0302a; font: 700 11px/1.3 var(--mono); letter-spacing: 1px; transform: rotate(-6deg); opacity: 0.85; pointer-events: none; mix-blend-mode: multiply; }
.lib-card-acts .lib-loanbox .lib-loanmenu { top: auto; bottom: calc(100% + 4px); }
/* on a card the menu is a slip of the same light paper, whatever the theme, so its dark ink reads */
.lib-card-acts .lib-loanmenu { background: #fffdf6; border-color: rgba(42, 42, 42, 0.25); color: #2a2a2a; }
.lib-card-acts .lib-loanmenu .lib-loanst { color: #5a5348; }
.lib-card-acts .lib-loanmenu .btn { background: transparent; border-color: rgba(42, 42, 42, 0.3); color: #2a2a2a; }
.lib-card-acts .lib-loanmenu .btn:hover { background: rgba(42, 42, 42, 0.08); }
.lib-card-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; font-size: 12px; color: #555; }
.lib-card-acts .btn { padding: 1px 7px; font-size: 12px; color: #2a2a2a; }
.lib-loanst { color: var(--text-dim); font-size: 13px; }
.lib-card-other .lib-card-who span { color: #5a3a7a; }
.lib-log { margin: 8px 4px 24px; }
.lib-log-h { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; font-size: 16px; font-weight: 600; cursor: pointer; list-style: none; }
.lib-log-h::-webkit-details-marker { display: none; }
.lib-log-h::before { content: '▸'; display: inline-block; width: 12px; color: var(--text-dim); transition: transform 0.15s; }
.lib-log[open] > .lib-log-h::before { transform: rotate(90deg); }
.lib-log-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.lib-log-t th { padding: 4px 8px; border-bottom: 1px solid var(--line); color: var(--text-faint); font-weight: 600; text-align: left; }
.lib-log-t td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.lib-log-t td.mono { font-size: 11.5px; white-space: nowrap; }
.lib-log-w { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.lib-log-w:hover { text-decoration: underline; }
@media (max-width: 640px) { .lib-log-t th:nth-child(2), .lib-log-t td:nth-child(2), .lib-log-t th:nth-child(4), .lib-log-t td:nth-child(4) { display: none; } }
.lib-mynotes { padding: 4px 16px 16px; overflow-y: auto; }
.lib-mynote-w { margin: 0 0 14px; }
.lib-mynote { margin: 6px 0 0 10px; padding: 6px 10px; border-left: 3px solid var(--line); }
.note-draft { display: inline-block; padding: 0 5px; border: 1px dashed var(--amber); border-radius: 3px; color: var(--amber); font-size: 11px; }
.in-fail { margin: 0 0 8px; }
.in-fail-t { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.lib-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0 0 12px; font-size: 13px; }
.lib-tags[hidden] { display: none; }
.lib-rel { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; color: var(--text-faint); font-size: 14px; }
.lib-rel select { color: var(--text); font-size: 13px; }
.lib-tags-h { margin-right: 6px; color: var(--text-faint); font-size: 14px; }
.lib-tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.lib-tag button { padding: 0 2px; border: 0; background: none; color: var(--text-dim); cursor: pointer; font-size: 14px; line-height: 1; }
.lib-tag button:hover { color: var(--text); }
.lib-taginput { width: 11em; max-width: 100%; padding: 2px 7px; font-size: 13px; }
.lib-pp, .lib-key { display: inline-block; flex: none; margin-right: 7px; padding: 1px 6px; border-radius: 3px; background: #b45309; color: #fff; font: 700 10px/1.5 var(--sans, system-ui, sans-serif); letter-spacing: 0.5px; text-transform: uppercase; vertical-align: 1px; white-space: nowrap; }
.lib-key { background: #0f5e63; padding: 0 4px; font-size: 8.5px; letter-spacing: 0.3px; }
.lib-s .lib-marks .lib-key { font-size: 7px; }
.lib-marks { position: absolute; z-index: 1; top: 19px; left: calc(50% - var(--cw) / 2 + 7px); width: calc(var(--cw) - 14px); display: flex; flex-wrap: nowrap; gap: 3px; }
/* two on a cover share the row the kind label had, so the title stays clear */
.lib-marks .lib-pp + .lib-key .lib-kw { display: none; }
.lib-marks .lib-pp, .lib-marks .lib-key { margin: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.lib-s .lib-marks { top: 16px; left: calc(50% - var(--cw) / 2 + 4px); width: calc(var(--cw) - 8px); }
.lib-s .lib-marks .lib-pp, .lib-s .lib-marks .lib-key { padding: 0 4px; font-size: 8px; }
.lib-has-mark .lib-c-k { visibility: hidden; }
/* a cover with no kind label, as a book's: room above the title for the badge */
.lib-has-mark .lib-cover:not(:has(.lib-c-k)) { padding-top: 30px; }
.lib-s .lib-has-mark .lib-cover:not(:has(.lib-c-k)) { padding-top: 20px; }
.lib-l .lib-has-mark .lib-cover:not(:has(.lib-c-k)) { padding-top: 32px; }
.lib-nb { display: inline-block; font: 11px var(--mono); padding: 0 5px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim); }
.lib-stand .lib-nb { position: absolute; top: 4px; right: 18px; background: var(--surface); }
.lib-t .lib-nb { margin-left: 8px; font-weight: 400; }
.lib-nwork { margin: 0 0 18px; }
.lib-nhead { display: block; width: 100%; text-align: left; padding: 6px 0; margin-bottom: 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; cursor: pointer; }
.item-notes .in-fold > summary { cursor: pointer; }
.in-new { margin-top: 8px; }
.item-notes .in-add { display: block; margin-top: 8px; }
.item-notes .in-add[hidden], .item-notes .in-fold[hidden] { display: none; }
/* a work's box: the stars and Add note at the end of its row of actions; the notes' panel is put away while the
   work has none, and slides out when one is added */
.lib-notebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.lib-notebar .fd-rxbar { margin: 0; }
.lib-notebar .in-add { margin: 0; }
.lib-cols { transition: grid-template-columns 0.3s ease, column-gap 0.3s ease; }
.lib-side { transition: opacity 0.3s ease, transform 0.3s ease; }
.lib-dlg .lib-side.in-none { padding: 0; background: none; opacity: 0; transform: translateX(24px); overflow: hidden; }
.lib-cols:has(> .lib-side.in-none) { grid-template-columns: minmax(0, 3fr) minmax(0, 0fr); column-gap: 0; row-gap: 0; }
.lib-pane .lib-cols:has(> .lib-side.in-none) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 999px) { .lib-cols:has(> .lib-side.in-none) { grid-template-columns: minmax(0, 1fr); } }
.in-new textarea { width: 100%; box-sizing: border-box; font: inherit; }
.in-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.in-foot [data-in="save"] { margin-left: auto; }
.in-quote { display: flex; gap: 6px; align-items: flex-start; padding: 4px 8px; margin-bottom: 4px; border-left: 3px solid var(--line); font: italic 13px/1.4 var(--serif, Georgia, serif); }
.in-quote span { flex: 1; min-width: 0; }
.in-quote[hidden] { display: none; }
.note-at { display: inline-block; margin-bottom: 2px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: inherit; font: 11px var(--mono); cursor: pointer; }
.note-quote { margin: 2px 0 4px; padding: 2px 8px; border-left: 3px solid var(--line); color: var(--text-dim); font: italic 13.5px/1.4 var(--serif, Georgia, serif); cursor: pointer; }
.lib-head { display: flex; gap: 14px; align-items: flex-start; }
.lib-head-t { flex: 1; min-width: 0; }
.lib-boxcover { flex: none; width: 130px; height: auto; max-height: 200px; object-fit: contain; border-radius: 2px 3px 3px 2px; background: #fff; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.28), 3px 4px 9px rgba(0, 0, 0, 0.18); }
@media (max-width: 520px) { .lib-head { flex-direction: column; } .lib-head-t { width: 100%; } .lib-boxcover { width: 110px; max-height: 170px; } }
.lib-cite { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 8px 10px; border-left: 3px solid var(--line); background: var(--surface-2); font: 14px/1.45 var(--serif, Georgia, serif); }
.lib-cite-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lib-cite .btn { flex: none; font-family: inherit; }
.lib-embed { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 72vh; border: 0; border-radius: 4px; background: #000; }
.lib-embed-audio { aspect-ratio: auto; height: 200px; }
.lib-alts { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.lib-alt:not(:empty) { margin-top: 8px; }
.lib-order { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.lib-views .btn { padding-left: 9px; padding-right: 9px; }
.lib-mini { grid-row: 1 / span 2; align-self: center; width: 30px; height: 40px; border-radius: 2px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-dim); }
.lib-mini .lib-glyph { width: 20px; height: 20px; }
.lib-mini .lib-thumb { width: 100%; height: 100%; object-fit: cover; }
.lib-glyph { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* the shelf: covers standing on a line, what is known about each below it */
.lib-shelf { --cw: 130px; --ch: 196px; }
.lib-shelf.lib-s { --cw: 92px; --ch: 138px; }
.lib-shelf.lib-l { --cw: 184px; --ch: 276px; }
.lib-list.lib-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--cw) + 28px), 1fr)); gap: 22px 0; border-top: 0; padding-top: 6px; }
.lib-shelf > .hint { grid-column: 1 / -1; }
.lib-tile { display: flex; flex-direction: column; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lib-stand { position: relative; display: flex; align-items: flex-end; justify-content: center; height: calc(var(--ch) + 12px); padding: 0 14px; border-bottom: 3px solid color-mix(in srgb, var(--text) 26%, transparent); }
.lib-cover, .lib-thumb { box-sizing: border-box; width: var(--cw); height: var(--ch); border-radius: 2px 3px 3px 2px; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.28), 3px 4px 9px rgba(0, 0, 0, 0.18); transition: transform 0.12s ease; }
.lib-stand .lib-thumb { position: absolute; bottom: 0; left: 50%; margin-left: calc(var(--cw) / -2); object-fit: cover; background: #fff; }
/* a cover's image fades in when it has come; the drawn cover shows until then, and stays if it does not come */
.lib-thumb { opacity: 0; transition: opacity 0.25s ease; }
.lib-thumb.lib-in { opacity: 1; }
.lib-thumb.lib-gone, .lib-boxcover.lib-gone { display: none; }
.lib-boxcover { aspect-ratio: auto 2 / 3; background: var(--surface-2); opacity: 0.35; transition: opacity 0.25s ease; }
.lib-boxcover.lib-in { opacity: 1; background: #fff; }
.lib-tile:hover .lib-cover, .lib-tile:hover .lib-thumb, .lib-tile:focus-visible .lib-cover, .lib-tile:focus-visible .lib-thumb { transform: translateY(-5px); }
.lib-tile:focus-visible { outline: 2px solid var(--beam); outline-offset: 2px; }
.lib-cap { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 0; min-width: 0; }
.lib-cap .lib-t { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lib-cap .lib-m { font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lib-cap .lib-h { font-size: 10.5px; white-space: normal; line-height: 1.3; align-self: flex-start; }
.lib-cover { display: flex; flex-direction: column; gap: 6px; padding: 12px 11px; overflow: hidden; font-family: var(--serif, Georgia, serif); }
.lib-c-t { font-size: 13.5px; line-height: 1.25; font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; overflow-wrap: anywhere; }
.lib-c-a { margin-top: auto; font-size: 11px; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lib-c-k { display: flex; align-items: center; gap: 4px; font: 9.5px var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.lib-c-k .lib-glyph { width: 15px; height: 15px; }
/* cloth: books and theses */
.lib-c-book, .lib-c-thesis { --cloth: #1f3a5f; color: #f6efe0; padding-left: 19px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.32) 0, rgba(255, 255, 255, 0.1) 6px, rgba(0, 0, 0, 0.1) 9px, transparent 12px), var(--cloth); }
.lib-c-book::before, .lib-c-thesis::before, .lib-c-book::after, .lib-c-thesis::after { content: ''; flex: none; height: 1px; background: #d9b44a; }
.lib-c-book::after, .lib-c-thesis::after { order: 1; }
.lib-c-book .lib-c-a, .lib-c-thesis .lib-c-a { order: 2; }
.lib-c-book .lib-c-k, .lib-c-thesis .lib-c-k { color: #e8cf8a; }
/* paper: articles, chapters, letters */
.lib-c-article, .lib-c-chapter, .lib-c-letter { color: #23201a; background: #fbf8f0; font-size: 11px; }
.lib-c-article { background: linear-gradient(225deg, transparent 15px, #fbf8f0 15px), linear-gradient(225deg, #cfc8b6 21px, transparent 21px); }
.lib-c-article .lib-c-k { color: #5c5546; padding-bottom: 5px; border-bottom: 2px solid #23201a; margin-right: 12px; }
.lib-c-article .lib-c-a, .lib-c-letter .lib-c-a { font-style: italic; color: #4a4436; }
.lib-c-article::after { content: ''; flex: 1 1 0; min-height: 0; order: 1; background: repeating-linear-gradient(180deg, #d8d2c2 0 1px, transparent 1px 6px); }
.lib-c-article .lib-c-a { order: 2; margin-top: 0; }
.lib-c-chapter { padding-left: 21px; background: linear-gradient(90deg, #5c5546 0 9px, #fbf8f0 9px); }
.lib-c-chapter .lib-c-k { color: #6b1e2b; }
.lib-c-chapter .lib-c-a { color: #4a4436; }
.lib-c-letter { background: linear-gradient(180deg, #efe7d3, #fbf8f0 60px); }
.lib-c-letter .lib-c-k { color: #5c5546; }
/* newsprint */
.lib-c-news { color: #1c1b18; background: #e7e2d4; }
.lib-c-news .lib-c-k { color: #1c1b18; padding-bottom: 4px; border-top: 3px solid #1c1b18; border-bottom: 1px solid #1c1b18; padding-top: 4px; }
.lib-c-news .lib-c-t { font-weight: 700; }
.lib-c-news::after { content: ''; flex: 1 1 0; min-height: 0; order: 1; background: repeating-linear-gradient(180deg, #bdb7a5 0 1px, transparent 1px 5px); -webkit-mask: linear-gradient(90deg, #000 47%, transparent 47% 53%, #000 53%); mask: linear-gradient(90deg, #000 47%, transparent 47% 53%, #000 53%); }
.lib-c-news .lib-c-a { order: 2; margin-top: 0; color: #3e3b32; }
/* sound and film */
.lib-c-audio, .lib-c-talk { color: #f2f0fa; background: linear-gradient(160deg, #3b2f63, #1c1830); }
.lib-c-talk { background: linear-gradient(160deg, #6b3a1e, #2b1a10); color: #fbf1e4; }
.lib-c-audio .lib-c-k, .lib-c-talk .lib-c-k { font-size: 10px; }
.lib-c-audio .lib-c-k .lib-glyph, .lib-c-talk .lib-c-k .lib-glyph { width: 26px; height: 26px; }
.lib-c-film { color: #f4f4f4; padding-left: 21px; padding-right: 21px; background: repeating-linear-gradient(180deg, #f4f4f4 0 7px, transparent 7px 16px) 4px 0 / 6px 100% no-repeat, repeating-linear-gradient(180deg, #f4f4f4 0 7px, transparent 7px 16px) calc(100% - 4px) 0 / 6px 100% no-repeat, #16181c; }
.lib-c-film .lib-c-k { font-size: 8.5px; letter-spacing: 0.5px; }
.lib-c-film .lib-c-k .lib-glyph { width: 22px; height: 22px; }
/* a window on the web */
.lib-c-web { color: #1d2430; background: #fff; padding-top: 26px; position: relative; }
.lib-c-chrome { position: absolute; top: 0; left: 0; right: 0; height: 18px; display: flex; align-items: center; gap: 4px; padding-left: 7px; background: #dfe3e8; }
.lib-c-chrome i { width: 6px; height: 6px; border-radius: 50%; background: #8d96a3; }
.lib-c-web .lib-c-k { color: #3b6ea5; }
.lib-c-web .lib-c-a { color: #51606f; }
.lib-c-other { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.lib-c-other .lib-c-k { color: var(--text-dim); }
/* small: the title and little else; large: room to read */
.lib-s .lib-cover { padding: 7px 6px; gap: 3px; }
.lib-s .lib-c-t { font-size: 10.5px; -webkit-line-clamp: 5; }
.lib-s .lib-c-a { font-size: 8.5px; -webkit-line-clamp: 1; }
.lib-s .lib-c-k { font-size: 7.5px; letter-spacing: 0.5px; }
.lib-s .lib-c-k .lib-glyph { width: 11px; height: 11px; }
.lib-s .lib-cover.lib-c-book, .lib-s .lib-cover.lib-c-thesis, .lib-s .lib-cover.lib-c-chapter, .lib-s .lib-cover.lib-c-film { padding-left: 13px; }
.lib-s .lib-cover.lib-c-film { padding-right: 13px; }
.lib-s .lib-cap { padding: 5px 6px 0; }
.lib-s .lib-cap .lib-m { font-size: 11px; }
.lib-s .lib-cap .lib-h { display: none; }
.lib-s .lib-stand { padding: 0 6px; }
.lib-l .lib-cover { padding: 16px 15px; gap: 9px; }
.lib-l .lib-c-t { font-size: 18px; -webkit-line-clamp: 7; }
.lib-l .lib-c-a { font-size: 13px; }
.lib-l .lib-c-k { font-size: 11px; }
.lib-l .lib-cover.lib-c-book, .lib-l .lib-cover.lib-c-thesis { padding-left: 24px; }
@media (max-width: 460px) { .lib-shelf { --cw: 118px; --ch: 178px; } .lib-shelf.lib-s { --cw: 84px; --ch: 126px; } .lib-shelf.lib-l { --cw: 150px; --ch: 226px; } .lib-stand { padding: 0 6px; } .lib-list.lib-shelf { grid-template-columns: repeat(auto-fill, minmax(calc(var(--cw) + 14px), 1fr)); } }

/* kit/images.js: the Images tab, the zooming box, a figure and its labels */
#view-images .im { padding: 12px clamp(12px, 3vw, 28px) 80px; }
.im-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.im-credit { font-size: 12px; margin-left: auto; }
.im-intro { color: var(--text-dim); margin: 0 0 10px; max-width: 52em; }
.im-setintro { margin: 0 0 12px; }
.im-setintro .im-intro { margin-bottom: 4px; }
.im-setcredit { margin: 0; }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.im-card { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--text); cursor: zoom-in; font: 12px var(--sans, system-ui); text-align: left; }
.im-card:hover { border-color: var(--amber); }
.im-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.im-card.im-fail img { visibility: hidden; }
.im-zmsg { position: absolute; left: 8px; bottom: 8px; margin: 0; padding: 4px 8px; background: var(--surface); border-radius: 4px; }
.im-figs .im-card img { aspect-ratio: 1; }
.im-zoombox { position: relative; height: min(78vh, 900px); }
.im-zoom { position: relative; overflow: hidden; background: #222; border-radius: 4px; cursor: grab; touch-action: none; outline: none; }
.im-zoom.im-grab { cursor: grabbing; }
.im-plane { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.im-base { position: absolute; left: 0; top: 0; max-width: none; user-select: none; pointer-events: none; }
.im-tiles { position: absolute; left: 0; top: 0; }
.im-tiles img { position: absolute; max-width: none; user-select: none; pointer-events: none; }
.im-roi { position: absolute; outline: 3px solid var(--amber, #e3a017); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.im-zbtns { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.im-zbtns .btn { background: var(--surface); }
.im-seg { display: inline-flex; }
.im-seg .btn { border-radius: 0; }
.im-seg .btn:first-child { border-radius: 4px 0 0 4px; }
.im-seg .btn:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }
/* the chosen one's border over its neighbours', so it shows on all four sides */
.im-seg .btn.on { position: relative; z-index: 1; }
.im-seg .btn[hidden] { display: none; }
.im-seg .btn:not([hidden]):has(+ .btn[hidden]) { border-radius: 0 4px 4px 0; }
.im-exp { position: relative; display: inline-block; }
.im-exp > div { position: absolute; right: 0; top: 100%; z-index: 2; display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.im-exp summary { list-style: none; }
.im-figwrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14em, 22em); gap: 16px; align-items: start; }
.im-stage { position: relative; background: #fff; }
.im-figimg { display: block; width: 100%; height: auto; }
.im-labels { position: absolute; inset: 0; pointer-events: none; font: clamp(9px, 1.25vw, 15px)/1.15 "Helvetica Neue", Arial, sans-serif; color: #7a5c00; }   /* kintsugi gold that reads on the figure's white, in every theme */
.im-lab { position: absolute; max-width: 45%; white-space: pre-line; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; pointer-events: auto; }
.im-lab-r { text-align: right; }
.im-lab-c { text-align: center; white-space: nowrap; max-width: none; }
.im-cap { margin: 0 0 8px; }
.im-key { margin: 0; color: var(--text-dim); font-size: 14px; }
.im-key-on { color: var(--text); }
@media (max-width: 760px) { .im-figwrap { grid-template-columns: minmax(0, 1fr); } .im-zoombox { height: 64vh; } }
.lib-h.group { color: var(--amber, #c90); }
.im-about { margin-top: 10px; font-size: 14px; color: var(--text-dim); }
.im-about summary { cursor: pointer; color: var(--text); }
.im-about p { margin: 6px 0 0; }
