/* Voynich Viewer: reader, 3D book and collation for Beinecke MS 408. Plain CSS, no build step. */
:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #646b73;
  --line: #d9d5cc;
  --accent: #2b5fd9;
  --ok: #138a4c;
  --warn: #b5590c;
  --table: #2d2925;          /* the reading-room table the parchment sits on */
  --table-ink: #e9e3d8;
  --table-muted: #a69d8f;
  --table-line: #4a443d;
  --ghost: rgba(233, 227, 216, .35);
  /* Davis's five scribes (Davis 2020): categorical, distinct in hue and lightness */
  --h1: #2f7fd1; --h2: #d1495b; --h3: #e0a526; --h4: #2a9d8f; --h5: #8e5bd1;
  --radius: 6px;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--accent); }
button, select, input { font: inherit; }
button {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius); color: var(--ink);
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: #aaa; }
button:disabled { opacity: .45; cursor: default; }
button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
select { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 6px; background: #fff; }
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 4px; background: #fff; color: var(--ink); }

/* ---------- header ---------- */
#cx-top {
  display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
#cx-tabs { display: flex; gap: 4px; }
#cx-tabs button { border-color: transparent; background: transparent; }
#cx-tabs button[aria-selected=true] { background: var(--ink); color: #fff; }
.order-pick { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.order-pick select { color: var(--ink); max-width: 260px; }
#cx-main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none !important; }

#cx-toast {
  position: fixed; z-index: 1000; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: min(640px, 90vw);
}
#cx-toast.show { opacity: 1; }
dialog { border: 1px solid var(--line); border-radius: 10px; max-width: 620px; }
dialog h4 { margin: 12px 0 4px; }
dialog p { margin: 4px 0; }

/* ---------- shared parchment ---------- */
.seg { position: relative; background: #e8dcc2; overflow: hidden; flex: none; }
.seg img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.seg.ghost { background: transparent; border: 1.5px dashed var(--ghost); color: var(--table-muted);
  display: grid; place-items: center; text-align: center; font-size: 12px; padding: 6px; }
.seg.blank { background: #e6dcc6; }
.seg .lbl {
  position: absolute; left: 4px; bottom: 4px; font: 600 11px/1 ui-monospace, Menlo, monospace;
  background: rgba(31, 35, 40, .72); color: #fff; padding: 2px 4px; border-radius: 3px; pointer-events: none;
}
.seg .scribe { position: absolute; left: 0; right: 0; top: 0; height: 5px; pointer-events: none; }
.h1 { background: var(--h1); } .h2 { background: var(--h2); } .h3 { background: var(--h3); }
.h4 { background: var(--h4); } .h5 { background: var(--h5); }

/* ---------- Read ---------- */
#v-read { display: flex; flex-direction: column; background: var(--table); color: var(--table-ink); }
.rd-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--table-line); }
.rd-bar button { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.rd-bar button:hover { border-color: var(--table-muted); }
.rd-bar button.on { background: var(--table-ink); color: var(--table); }
.rd-where { font-weight: 600; }
.rd-meta { color: var(--table-muted); font-size: 13px; }
.rd-flags { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.flag { font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--table-line); color: var(--table-muted); }
.flag.new { border-color: #e0a526; color: #f3c35c; }
.flag.lost { border-style: dashed; }
.rd-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; perspective: 2400px; }
.spread { position: absolute; left: 50%; top: 50%; display: flex; align-items: flex-start;
  transform-origin: 0 0; }
.rd-zoomer { position: absolute; inset: 0; transform-origin: 0 0; }
.rd-stage.zoomed { cursor: grab; }
.rd-stage.zoomed.panning { cursor: grabbing; }
.rd-stage.zoomed .rd-zoomer { will-change: transform; }
.rd-zoombar { position: absolute; left: 12px; bottom: 10px; z-index: 6; display: flex; gap: 4px; align-items: center; }
.rd-zoombar button { background: rgba(45, 41, 37, .85); color: var(--table-ink); border-color: var(--table-line); min-width: 34px; }
.rd-zoombar #rd-zoomlvl { min-width: 58px; font-variant-numeric: tabular-nums; }
.rd-zoomhint { color: var(--table-ink); font-size: 11px; margin-left: 6px; background: rgba(45, 41, 37, .85);
  padding: 3px 8px; border-radius: 99px; }
.rd-stage.zoomed .rd-zoomhint { display: none; }
@media (max-width: 760px) { .rd-zoomhint { display: none; } }
.rd-page { display: flex; align-items: flex-start; position: relative; }
.rd-page.left { justify-content: flex-end; }
.rd-page .gridface { display: grid; gap: 0; }
.rd-page.empty { visibility: hidden; }
.rd-gutter { width: 2px; align-self: stretch; background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(0,0,0,.05)); }
.rd-page .seg { box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.rd-page .seg.ext { transform-origin: var(--hinge, left) center; animation: unfold .45s ease-out both; }
.rd-page.left .seg.ext { --hinge: right; }
@keyframes unfold { from { transform: perspective(1600px) rotateY(var(--from, -100deg)); opacity: .2; } to { transform: none; opacity: 1; } }
.rd-page.left .seg.ext { --from: 100deg; }
.foldtab {
  position: absolute; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; font-size: 12px;
  background: #c9b48c; color: #2d2925; border: none; border-radius: 0 6px 6px 0; padding: 10px 3px; cursor: pointer;
  box-shadow: 2px 1px 4px rgba(0,0,0,.4);
}
.rd-page.right .foldtab { left: 100%; }
.rd-page.left .foldtab { right: 100%; border-radius: 6px 0 0 6px; transform: translateY(-50%) rotate(180deg); }
.foldtab:hover { background: #e2cfa6; }
.turn { position: absolute; top: 0; transform-style: preserve-3d; transition: transform .5s ease-in-out; z-index: 3; }
.turn > .side { position: absolute; inset: 0; backface-visibility: hidden; }
.turn > .side.back { transform: rotateY(180deg); }
.rd-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 44px; height: 88px;
  background: rgba(45, 41, 37, .6); color: var(--table-ink); border: 1px solid var(--table-line); font-size: 22px; }
.rd-nav.prev { left: 10px; } .rd-nav.next { right: 10px; }
.rd-note { padding: 3px 70px 0; height: 38px; overflow: hidden; color: var(--table-muted); font-size: 12px;
  line-height: 1.45; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* quire strip */
.strip { display: flex; gap: 3px; padding: 8px 16px 10px; overflow-x: auto; border-top: 1px solid var(--table-line);
  align-items: flex-end; }
.strip .g { display: flex; flex-direction: column; gap: 3px; flex: none; }
.strip .g .gl { font-size: 10px; color: var(--table-muted); white-space: nowrap; }
.strip .g .ticks { display: flex; gap: 1px; }
.strip .t { width: 5px; height: 18px; background: #8a7d6a; cursor: pointer; border: none; padding: 0; border-radius: 1px; }
.strip .t.lost { background: transparent; outline: 1px dashed #8a7d6a; outline-offset: -1px; }
.strip .t.cur { background: #f3c35c; }
.strip .t.moved { background: #c9b48c; }
.strip .g.sing .ticks { gap: 3px; }
.strip .g.sing .ticks .t:nth-child(4n+1) { margin-left: 2px; }

/* ---------- Collation ---------- */
#v-collation { display: flex; }
.co-main { flex: 1; overflow: auto; padding: 18px 22px 40px; }
.co-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.co-grid { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 0 18px; align-items: start; }
.co-grid > .h { font-weight: 600; padding: 6px 0; border-bottom: 1px solid var(--line); position: sticky; top: -18px;
  background: var(--bg); z-index: 1; }
.co-q { padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.co-q small { display: block; font-weight: 400; color: var(--muted); }
.co-cell { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
@keyframes co-flash { from { background: #f3c35c; } to { background: transparent; } }
table.ft tr.flash td { animation: co-flash 2.4s ease-out; }
.co-cell svg { display: block; max-width: 100%; height: auto; }
.co-cell .seq { margin-top: 4px; color: var(--muted); }
.co-cell.diff { background: linear-gradient(90deg, rgba(224,165,38,.10), transparent 70%); }
.co-cell .note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.co-diffonly { color: var(--muted); }

/* ---------- Sources ---------- */
#v-sources { overflow: auto; }
.src-wrap { max-width: 860px; margin: 0 auto; padding: 22px 22px 60px; }
.src-wrap h2 { margin-top: 26px; }
.src-wrap li { margin: 6px 0; }
.src-wrap table { border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.src-wrap td, .src-wrap th { border-bottom: 1px solid var(--line); padding: 4px 10px 4px 0; text-align: left; vertical-align: top; }
.callout { border-left: 3px solid var(--accent); background: #eef3fd; padding: 8px 12px; margin: 10px 0; }

@media (max-width: 760px) {
  .order-pick { margin-left: 0; }
  #cx-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  #cx-tabs button { flex: none; }
  .co-grid { grid-template-columns: 50px 1fr; }
  .co-grid .co-cell.cur, .co-grid .h.cur { display: none; }
}

/* ---------- toast with an action ---------- */
#cx-toast { display: flex; gap: 12px; align-items: center; pointer-events: none; }
#cx-toast.show { pointer-events: auto; }
#cx-toast button { background: transparent; color: #f3c35c; border-color: rgba(243,195,92,.6); padding: 2px 10px; }

/* in-page dialog (prompt replacement) */
dialog.ask { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; width: min(440px, 92vw); }
dialog.ask h3 { margin: 0 0 8px; font-size: 16px; }
dialog.ask p { margin: 0 0 12px; color: var(--muted); }
dialog.ask label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
dialog.ask input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }
dialog.ask .ask-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- Folio order (Davis-style quire tables) ---------- */
.co-grid { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr); }
.co-src, .co-summary { max-width: 1000px; margin: 0 0 10px; }
.co-src { color: var(--muted); font-size: 13px; }
.co-cell { overflow-x: auto; }
table.ft { border-collapse: collapse; font-size: 12.5px; background: #fff; border: 1px solid #cfcabe; }
table.ft col.c-sec { width: 130px; } table.ft col.c-q { width: 46px; } table.ft col.c-fol { width: 70px; }
table.ft col.c-scr { width: 96px; }
table.ft th { text-align: left; font-weight: 600; border-bottom: 1px solid #a9a395; padding: 3px 6px; background: #f1eee7; }
table.ft td { height: 22px; padding: 0 6px; border-bottom: 1px solid #ebe7de; border-right: 1px solid #ebe7de; white-space: nowrap; }
table.ft td.q { text-align: center; vertical-align: middle; font-weight: 600; }
table.ft td.arc { padding: 0 6px 0 2px; border-bottom: 0; vertical-align: top; border-right: 0; }
table.ft td.arc svg { display: block; }
table.ft td.fol small { color: var(--muted); font-size: 11px; }
table.ft tr.lost td.fol, table.ft tr.lost td.scr, table.ft tr.lost td.sec { color: var(--muted); font-style: italic; }
table.ft tr.moved td.sec, table.ft tr.moved td.fol, table.ft tr.moved td.scr { background: #fdf0c7; }
.co-cell .seq-h { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }

dialog #cx-toast { bottom: 22px; }

/* full-sheet viewer zoom */
.sv-stage { position: relative; overflow: hidden; margin: 0 auto; touch-action: none; }
.sv-stage.zoomed { cursor: grab; }
.sv-stage.panning { cursor: grabbing; }
.sv-zoom { display: inline-flex; gap: 4px; }
.sv-zoom button { min-width: 34px; }

/* ---------- 3D view (view3d.js) ---------- */
#v-three { display: flex; flex-direction: column; color: var(--table-ink); background: #221e1a; }
.v3-bar { display: flex; align-items: center; gap: 8px 14px; padding: 7px 14px; border-bottom: 1px solid var(--table-line); flex-wrap: wrap; }
.v3-title { font-weight: 600; margin-right: 4px; }
.v3-bar button, .v3-bar select { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.v3-bar button:hover { border-color: var(--table-muted); }
.v3-bar button.on { background: #f3c35c; color: #2d2925; border-color: #f3c35c; }
.v3-bar label { display: inline-flex; align-items: center; gap: 6px; color: var(--table-muted); font-size: 13px; }
.v3-bar select option { color: var(--ink); }
.v3-seg { display: inline-flex; }
.v3-seg button { border-radius: 0; margin-left: -1px; }
.v3-seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.v3-seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.v3-spread input { width: 150px; accent-color: #f3c35c; }
.v3-spread.dim { opacity: .55; }
.v3-sn { color: var(--table-ink); min-width: 86px; font-size: 12px; }
.v3-opening { display: inline-flex; align-items: center; gap: 6px; font: 600 13px ui-monospace, Menlo, monospace; }
.v3-opening[hidden] { display: none; }
.v3-views { display: inline-flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.v3-views button { font-size: 12px; padding: 3px 8px; }
.v3-views kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .7; font-size: 10px; padding: 0 3px; }
.v3-morph { display: inline-flex; gap: 4px; }
.v3-morph button { font-size: 12px; padding: 3px 8px; }
.v3-body { flex: 1; min-height: 0; display: flex; }
.v3-stage { flex: 1; min-width: 0; min-height: 0; position: relative; overflow: hidden; touch-action: none; user-select: none; cursor: grab; }
/* the inspector, docked beside the book */
.v3-insp { width: 330px; flex: none; background: var(--panel); color: var(--ink); padding: 12px 14px; overflow: auto; border-left: 1px solid var(--table-line); }
.v3-insp[hidden] { display: none; }
.v3-insp h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.v3-insp .muted { color: var(--muted); }
.v3-insp .small { font-size: 13px; margin: 4px 0; }
.v3-insp .fx-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.v3-insp .fx-nav b { flex: 1; font-size: 16px; }
.v3-insp .fx-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.v3-insp .fx-acts kbd { margin-left: 2px; opacity: .7; font-size: 10px; }
.v3-insp .fx-acts .primary kbd { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.v3-insp .where { margin-top: 8px; padding: 6px 9px; border-radius: 6px; background: #fbf3dc; border: 1px solid #ecd9a4; font-size: 13px; }
.v3-insp .links { margin-top: 10px; font-size: 13px; color: var(--muted); }
.v3-insp .linkish { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.v3-insp .faces { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13px; }
.v3-insp .faces > span:nth-child(odd) { color: var(--muted); }
.v3-insp .faces .linkish { text-align: left; font: 13px ui-monospace, Menlo, monospace; }
.v3-insp .hands { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.v3-insp .chip { display: inline-flex; align-items: center; gap: 5px; }
.v3-insp .chip::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.v3-insp .inferred { font: 600 10px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: #8a5a00;
  border: 1px dashed #c99a3a; border-radius: 3px; padding: 2px 4px; margin-left: 4px; vertical-align: 1px; }
.v3-insp .ev { border-left: 3px solid #e0a526; padding: 4px 10px; margin: 8px 0; background: #fbf6ea; font-size: 13px; }
.v3-insp .ev .src { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
.v3-stage.dragging { cursor: grabbing; }
.v3-stage canvas { display: block; width: 100%; height: 100%; }
.v3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.v3-lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 12px/1.25 ui-monospace, Menlo, monospace;
  color: var(--table-ink); text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.7); text-align: center; will-change: transform; }
.v3-lbl small { display: block; font: 400 11px/1.2 -apple-system, system-ui, sans-serif; color: var(--table-muted); }
.v3-lbl.q { color: #f3c35c; font: 700 13px/1.2 -apple-system, system-ui, sans-serif; }
.v3-lbl.moved { color: #f3c35c; }
.v3-lbl.lost { color: var(--table-muted); font-weight: 400; }
.v3-lbl.cur { background: #f3c35c; color: #2d2925; padding: 2px 7px; border-radius: 4px; text-shadow: none; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.v3-lbl.cur small { color: #5a4a2a; display: inline; }
.v3-tip { position: absolute; z-index: 5; max-width: 270px; background: rgba(29, 26, 23, .95); border: 1px solid var(--table-line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.v3-tip .pages { font: 12px/1.5 ui-monospace, Menlo, monospace; margin-top: 4px; }
.v3-tip .muted { color: var(--table-muted); font-size: 12px; margin-top: 2px; }
.v3-tip .moved { color: #f3c35c; font-size: 12px; margin-top: 2px; }
.v3-lbl.cur.behind { opacity: .55; }
.v3-note { position: absolute; right: 12px; bottom: 12px; max-width: min(430px, calc(100% - 24px)); z-index: 4;
  background: rgba(29, 26, 23, .9); border: 1px solid var(--table-line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.v3-note button { background: transparent; color: #f3c35c; border-color: #6b5a37; font-size: 12px; padding: 1px 8px; margin-left: 4px; }
.v3-legend { position: absolute; left: 12px; top: 12px; z-index: 4; max-width: 300px; background: rgba(29, 26, 23, .92);
  border: 1px solid var(--table-line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.v3-legend[hidden], .v3-contact[hidden] { display: none; }
.v3-legend b { display: block; font-size: 13px; }
.v3-legend .src { color: var(--table-muted); font-size: 11.5px; margin-top: 2px; }
.v3-legend .rows { display: flex; flex-wrap: wrap; gap: 3px 10px; margin: 6px 0 4px; }
.v3-legend .row { display: inline-flex; align-items: center; gap: 5px; }
.v3-legend .row i { width: 12px; height: 12px; border-radius: 2px; }
.v3-legend .row small { color: var(--table-muted); }
.v3-legend .cont { margin-top: 4px; font-weight: 600; }
.v3-legend .cont span { color: var(--table-muted); font-weight: 400; }
.v3-contact { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px); background: rgba(29, 26, 23, .95); border: 1px solid #6b5a37;
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.v3-contact button { background: transparent; color: var(--table-ink); border-color: var(--table-line); padding: 1px 8px; }
.v3-contact .pair { font: 600 13px ui-monospace, Menlo, monospace; color: #f3c35c; }
.v3-contact .n, .v3-contact .kind { color: var(--table-muted); }
.v3-contact .only { display: inline-flex; align-items: center; gap: 4px; color: var(--table-muted); }
.v3-contact .x { border: 0; }
.v3-contact .inferred, .v3-insp .touch .inferred { font: 600 10px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em;
  color: #e0b25a; border: 1px dashed #b58a3a; border-radius: 3px; padding: 2px 4px; }
.v3-insp .touch .inferred { color: #8a5a00; border-color: #c99a3a; margin-left: 6px; }
.v3-contact .new, .v3-insp .touch .new { font: 700 10px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: #2d2925;
  background: #f3c35c; border-radius: 3px; padding: 2px 5px; margin-left: 6px; }
.v3-insp .touch { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.v3-insp .touch .linkish { font: 13px ui-monospace, Menlo, monospace; text-align: left; white-space: normal; }
.v3-hint { position: absolute; left: 12px; bottom: 12px; z-index: 4; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 24px);
  background: rgba(29, 26, 23, .92); border: 1px solid var(--table-line); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; }
.v3-hint kbd { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.v3-hint button { background: #f3c35c; border-color: #f3c35c; color: #2d2925; font-size: 12px; padding: 2px 10px; }
.v3-nogl { padding: 30px; color: var(--table-ink); }
.v3-nogl button { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.v3-strip { display: flex; gap: 10px; padding: 7px 14px 9px; overflow-x: auto; border-top: 1px solid var(--table-line); align-items: flex-end; }
.v3-sq { display: flex; align-items: flex-end; gap: 2px; flex: none; }
.v3-qb { background: transparent; color: var(--table-muted); border: 0; padding: 0 4px 0 0; font-size: 11px; align-self: center; }
.v3-qb:hover { color: var(--table-ink); }
.v3-tick { width: 7px; height: 18px; padding: 0; border: 0; border-radius: 1px; background: #8f8471; position: relative; }
.v3-tick:hover { background: #d9ccae; }
.v3-tick.lost { background: transparent; box-shadow: inset 0 0 0 1px #6e665a; }
.v3-tick.moved::after, .v3-tick.resewn::after { content: ""; position: absolute; left: 1px; top: -6px; width: 5px; height: 5px; border-radius: 50%; background: #f3c35c; }
.v3-tick.resewn::after { background: transparent; box-shadow: inset 0 0 0 1.2px #f3c35c; }
.v3-tick.cur { background: #f3c35c; height: 24px; }
@media (max-width: 760px) {
  .v3-body { flex-direction: column; }
  .v3-insp { width: auto; max-height: 46%; border-left: 0; border-top: 1px solid var(--table-line); }
  .v3-morph { display: none; }
  .v3-legend { max-width: calc(100% - 24px); top: auto; bottom: 64px; }
  .v3-contact { top: 8px; }
  .v3-bar { gap: 6px 8px; padding: 6px 10px; }
  .v3-title { display: none; }
  .v3-spread input { width: 110px; }
  .v3-views { margin-left: 0; }
  .v3-views button { padding: 2px 6px; }
  .v3-views .vn { display: none; }
  .v3-hint { font-size: 12px; }
}

/* ---------- Info ---------- */
#v-info { overflow: auto; }
.info-wrap { max-width: 820px; margin: 0 auto; padding: 22px 22px 80px; font-size: 15px; line-height: 1.55; }
.info-wrap h1 { font-size: 26px; margin: 4px 0 8px; }
.info-wrap .lead { font-size: 16px; color: #3a3f45; }
.info-wrap .small { font-size: 13px; }
.info-wrap .muted { color: var(--muted); }
.info-toc { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 6px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.info-toc .linkish { border: 0; background: none; padding: 0; color: var(--accent); font-size: 14px; }
.info-sec { scroll-margin-top: 12px; margin-top: 30px; }
.info-sec h2 { font-size: 20px; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.info-sec li { margin: 6px 0; }
.info-fig { margin: 10px 0; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.info-fig svg { width: 100%; height: auto; display: block; }
.info-fig .fig-pair { display: flex; gap: 12px; }
.info-fig .fig-pair svg { flex: 1 1 0; min-width: 0; }
@media (max-width: 600px) { .info-fig .fig-pair { flex-direction: column; } .info-fig .fig-pair svg { flex: none; width: 100%; } }
.info-fig figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.info-wrap .chip { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; white-space: nowrap; }
.info-wrap .chip::before { content: ""; width: 11px; height: 11px; border-radius: 2px; background: var(--c); }
.info-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.info-card .card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.info-card .card-h b { font-size: 16px; }
.info-card p { margin: 6px 0; }
.info-card .flow { font-weight: 600; background: #f6f1e4; padding: 6px 10px; border-radius: 6px; }
.info-wrap a.try { display: inline-block; margin: 4px 0; font-weight: 600; }
.info-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.info-dl dt { font-weight: 600; }
.info-dl dd { margin: 0; }
.try-list li { margin: 8px 0; }
@media (max-width: 600px) { .info-dl { grid-template-columns: 1fr; } .info-dl dd { margin-bottom: 6px; } }

/* ---------- crop buttons on pages ---------- */
.seg .seg-crop {
  position: absolute; right: 6px; top: 8px; font-size: 12px; padding: 3px 8px; border-radius: 99px;
  background: rgba(31, 35, 40, .78); color: #fff; border: 1px solid rgba(255,255,255,.25); opacity: 0;
  transition: opacity .12s; z-index: 2;
}
.seg:hover .seg-crop, .seg .seg-crop:focus-visible { opacity: 1; }
@media (hover: none) { .seg .seg-crop { opacity: .85; } }

/* ---------- crop editor ---------- */
dialog.crop-dlg { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  border-radius: 0; background: #1d1a17; color: var(--table-ink); }
dialog.crop-dlg[open] { display: flex; flex-direction: column; }
.ce-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--table-line); }
.ce-top button { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.ce-top .ghost { font-size: 20px; line-height: 1; padding: 2px 10px; }
.ce-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.ce-title .muted { color: var(--table-muted); }
.ce-hint { flex: 1; min-width: 0; color: var(--table-muted); font-size: 12px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ce-body { flex: 1; min-height: 0; display: flex; }
.ce-stage { flex: 1; min-width: 0; position: relative; overflow: hidden; cursor: grab; touch-action: none; background: #111; }
.ce-stage.panning { cursor: grabbing; }
.ce-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ce-world img { position: absolute; left: 0; top: 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ce-world svg { position: absolute; left: 0; top: 0; overflow: visible; }
.ce-loupe { position: absolute; top: 12px; display: none; width: 200px; height: 200px; border-radius: 50%;
  border: 3px solid #f3c35c; box-shadow: 0 6px 24px rgba(0,0,0,.6); pointer-events: none; }
.ce-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; }
.ce-zoom button { background: rgba(29,26,23,.85); color: var(--table-ink); border-color: var(--table-line); }
.ce-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--table-muted); pointer-events: none; }
.ce-loading[hidden] { display: none; }
.ce-side { width: 300px; flex: none; border-left: 1px solid var(--table-line); padding: 12px 14px; overflow: auto; }
.ce-side h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--table-muted); }
.ce-prev { background: #111; border: 1px solid var(--table-line); height: 42vh; display: flex; align-items: center;
  justify-content: center; overflow: hidden; margin-bottom: 6px; }
.ce-prev img { max-width: 100%; max-height: 42vh; object-fit: contain; display: block; }
.ce-side .muted { color: var(--table-muted); }
.ce-side .small { font-size: 12px; }
.ce-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ce-acts button { background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.ce-acts button.primary { background: #f3c35c; color: #2d2925; border-color: #f3c35c; font-weight: 600; }
.ce-acts.big button { padding: 7px 14px; }
@media (max-width: 760px) {
  .ce-body { flex-direction: column; }
  .ce-side { width: auto; border-left: 0; border-top: 1px solid var(--table-line); max-height: 40%; }
  .ce-prev, .ce-prev img { height: 22vh; max-height: 22vh; }
  .ce-hint { display: none; }
}
.ce-prev canvas { max-width: 100%; max-height: 42vh; object-fit: contain; display: block; }
@media (max-width: 760px) { .ce-prev canvas { max-height: 22vh; } }
.ce-side .linkish { border: 0; background: none; padding: 0; color: #f3c35c; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
button.danger-solid { background: #b42318; color: #fff; border-color: #b42318; }

/* ---------- Your work ---------- */
#cx-work { margin-left: 4px; }
dialog.work-dlg { width: min(620px, 94vw); max-height: 86vh; overflow: auto; padding: 16px 20px 18px; }
.work-head { display: flex; align-items: center; justify-content: space-between; }
.work-head h3 { margin: 0; font-size: 18px; }
.work-dlg h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.work-dlg .warn { background: #fdf0c7; border: 1px solid #ecd9a4; border-radius: 6px; padding: 6px 10px; }
.work-dlg .muted { color: var(--muted); }
.work-dlg .small { font-size: 12.5px; }
.work-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.work-list { list-style: none; padding: 0; margin: 0; }
.work-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.work-list .linkish { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.work-row-acts { margin-left: auto; display: flex; gap: 4px; }
.work-row-acts button { font-size: 12.5px; padding: 2px 8px; }
.work-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.work-chips button { font: 12px ui-monospace, Menlo, monospace; padding: 2px 7px; }
.work-chips button.busy { opacity: .55; cursor: progress; }

/* ---------- Rearrange (3D) ---------- */
.v3-arrange { width: 320px; flex: none; background: var(--panel); color: var(--ink); padding: 12px 12px 24px; overflow: auto;
  border-right: 1px solid var(--table-line); font-size: 13px; }
.v3-arrange[hidden] { display: none; }
.v3-arrange .fx-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.v3-arrange .fx-nav b { flex: 1; font-size: 16px; }
.v3-arrange .linkish { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.v3-arrange .muted { color: var(--muted); }
.ar-name { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.ar-title { font-weight: 700; font-size: 15px; text-decoration: none !important; color: var(--ink) !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ar-tools { margin-left: auto; display: flex; gap: 4px; }
.ar-tools button { padding: 2px 9px; font-size: 15px; }
.ar-intro { background: #f6f1e4; border: 1px solid #e6dcc4; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.ar-intro p { margin: 0 0 8px; }
.ar-hint { color: var(--muted); margin: 4px 0 10px; font-size: 12.5px; }
.ar-grip-demo { font-weight: 700; color: var(--ink); }
.ar-g { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 10px; background: #fbfaf7; }
.ar-g.sing { background: #f7f9fc; }
.ar-gh { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ar-gname { font-weight: 700; color: var(--ink) !important; text-decoration: none !important; margin-right: auto; }
.ar-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ar-seg button { border: 0; border-radius: 0; padding: 2px 8px; font-size: 12px; background: #fff; }
.ar-seg button.on { background: var(--ink); color: #fff; }
.ar-mini { padding: 0 6px; font-size: 12px; line-height: 20px; min-width: 24px; }
.ar-rows { padding: 4px; min-height: 30px; }
.ar-note { color: var(--muted); font-size: 11.5px; padding: 0 8px 6px; }
.ar-row { display: flex; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 2px 2px 0; }
.ar-row:hover { background: #f1ede4; }
.ar-row.cur { background: #fbf0cf; box-shadow: inset 3px 0 0 #e0a526; }
.ar-row.open { background: #fbf0cf; }
.ar-row.dragging { opacity: .35; }
.ar-row.lost .ar-id { color: var(--muted); font-style: italic; }
.ar-grip { cursor: grab; padding: 6px 4px 6px 6px; color: #8a8378; font-size: 16px; line-height: 1; touch-action: none; user-select: none; }
.ar-grip:hover { color: var(--ink); }
.ar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 0; text-align: left; }
.ar-thumb { width: 24px; height: 34px; object-fit: cover; border-radius: 2px; background: #e8dcc2; flex: none; }
.ar-thumb.ghost { background: transparent; border: 1px dashed #b9b1a3; }
.ar-id { font: 600 12.5px ui-monospace, Menlo, monospace; min-width: 52px; }
.ar-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-tag { margin-left: 6px; color: #8a5a00; background: #fbe9c6; border-radius: 3px; padding: 0 4px; font-size: 11px; }
.ar-btns { display: flex; gap: 2px; }
.ar-wrap { border-radius: 6px; background: #fdf8ea; margin: 2px 0; }
.ar-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 4px 8px 8px 30px; }
.ar-opts select { max-width: 100%; font-size: 12.5px; }
.ar-opt { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.ar-crop { width: 100%; font-size: 12.5px; color: var(--muted); }
.ar-crop .linkish { font: 12px ui-monospace, Menlo, monospace; margin-right: 6px; }
.ar-empty { color: var(--muted); font-size: 12px; padding: 6px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; }
.ar-aside { background: #f3f1ec; }
.ar-drop { height: 3px; background: var(--accent); border-radius: 2px; margin: 1px 4px; }
.ar-ghost { position: fixed; z-index: 2000; pointer-events: none; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: .95; }
.ar-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ar-foot button { font-size: 12.5px; }
.v3-insp .fx-arr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; }
.v3-insp .fx-arr button { padding: 2px 9px; }
@media (max-width: 760px) {
  .v3-arrange { width: auto; max-height: 48%; border-right: 0; border-bottom: 1px solid var(--table-line); }
}

/* ---------- Info: credits, contents, Davis's research ---------- */
.info-wrap { max-width: 1120px; }
.info-credits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.info-credits .credit { display: flex; gap: 10px; align-items: flex-start; background: #fbf6ea; border: 1px solid #e6d6a8;
  border-left: 4px solid #d99a00; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.info-credits .credit b { display: block; font-size: 15px; margin-bottom: 2px; }
.info-credits .ci { font-size: 20px; line-height: 1; color: #a06f00; flex: none; margin-top: 2px; }
.info-cols { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.info-cols .info-toc { position: sticky; top: 0; display: block; margin: 0; padding: 10px 12px; max-height: calc(100vh - 140px); overflow: auto; }
.info-toc .toc-part { margin-bottom: 10px; }
.info-toc .toc-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0; font-weight: 600; }
.info-toc .linkish { display: block; text-align: left; white-space: normal; padding: 3px 0; font-size: 13.5px; line-height: 1.3; }
.info-toc .linkish.cur { font-weight: 700; }
.info-body { min-width: 0; }
.info-body > h1 { margin-top: 0; }
.info-part { margin: 40px 0 0; padding: 6px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #a06f00; font-weight: 700;
  border-top: 3px solid #e6d6a8; }
.info-sec h3 { font-size: 16px; margin: 18px 0 4px; }
.info-formula { font: 14px/1.6 ui-monospace, Menlo, monospace; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; overflow-x: auto; }
.info-quires { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 14px 18px; margin-top: 12px; }
.info-quires > *, .info-folio .co-grid > * { min-width: 0; }
.info-q .co-cell { overflow-x: auto; }
.info-q h4 { margin: 0 0 4px; font-size: 14px; }
.info-q .co-cell { border-bottom: 0; padding: 0; }
.info-timeline { padding-left: 0; list-style: none; border-left: 3px solid #e6d6a8; margin: 10px 0; }
.info-timeline li { position: relative; padding: 6px 0 8px 16px; }
.info-timeline li::before { content: ""; position: absolute; left: -8px; top: 12px; width: 13px; height: 13px; border-radius: 50%; background: #d99a00; border: 2px solid var(--bg); }
.info-timeline b { display: block; }
.info-table { border-collapse: collapse; font-size: 13px; margin: 10px 0; width: 100%; }
.info-table th, .info-table td { border-bottom: 1px solid var(--line); padding: 5px 10px 5px 0; text-align: left; vertical-align: top; }
.info-notes { display: grid; gap: 10px; }
.info-note { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.info-note .nh { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.info-note .nh .try { margin: 0 0 0 auto; font-size: 13px; }
.info-note p { margin: 6px 0; font-size: 14px; }
.info-note .src { color: var(--muted); font-size: 12.5px; }
.info-src li { margin: 5px 0; }
.info-wrap h3 { scroll-margin-top: 12px; }
@media (max-width: 900px) {
  .info-cols { grid-template-columns: 1fr; }
  .info-cols .info-toc { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
}
@media (max-width: 640px) {
  .info-credits { grid-template-columns: 1fr; }
  .info-quires { grid-template-columns: 1fr; }
  .info-table { display: block; overflow-x: auto; }
}
@media (max-width: 760px) {
  #cx-top { gap: 6px 8px; padding: 8px 12px; }
  #cx-top .op-l { display: none; }
  .order-pick select { max-width: 118px; }
    .ar-hint { font-size: 11.5px; margin: 2px 0 6px; }
}
.info-folio .co-main { padding: 0; overflow: visible; }
.info-folio .co-head { margin: 10px 0; }
.info-folio .co-grid > .h { top: 0; }
.ar-save { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 8px; background: #eef6ee; border: 1px solid #cfe3cf; border-radius: 8px; }
.ar-saved { flex: 1; color: #2f5420; font-size: 12.5px; }
.ar-save button { padding: 2px 9px; font-size: 12.5px; }

/* ---------- cookie strip (privacy.js): a thin bar under the page, not over it ---------- */
#pv-strip { flex: none; display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 16px; background: var(--panel);
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
#pv-strip p { margin: 0; flex: 1; min-width: 0; line-height: 1.35; }
#pv-strip b { color: var(--ink); font-weight: 600; }
#pv-strip .pv-link { margin-left: 4px; white-space: nowrap; }
#pv-strip .pv-acts { display: flex; gap: 6px; flex: none; }
#pv-strip .pv-acts button { min-height: 26px; }
#pv-strip button:focus-visible, #pv-strip a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#pv-strip .pv-acts button { padding: 2px 12px; font-size: 12.5px; min-width: 74px; }   /* Accept and Reject look the same */
#pv-strip .pv-x { border: 0; background: none; font-size: 18px; line-height: 1; padding: 2px 6px; color: var(--muted); min-width: 28px; min-height: 28px; }
#pv-strip .pv-x:hover { color: var(--ink); }
@media (max-width: 600px) {
  #pv-strip { flex-wrap: wrap; gap: 4px 8px; padding: 6px 8px 6px 12px; font-size: 12px; }
  #pv-strip p { flex-basis: calc(100% - 48px); }
  #pv-strip .pv-detail { display: none; }
  #pv-strip .pv-x { order: 2; }
  #pv-strip .pv-more { display: none; }
  #pv-strip .pv-acts { order: 3; }
  #pv-strip .pv-acts button { padding: 1px 12px; min-width: 84px; min-height: 30px; }
}
.pv-status { background: #f6f1e4; border-radius: 6px; padding: 6px 10px; }
.pv-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- bug report ---------- */
#cx-bug { display: inline-flex; align-items: center; justify-content: center; padding: 4px 7px;
  color: #5b4127; background: #f1e7d3; border-color: #dccba8; }   /* dark brown on parchment beige */
#cx-bug:hover { background: #e9dbbf; border-color: #c9b48a; color: #432e18; }
dialog.bug-dlg { width: min(440px, 92vw); padding: 18px 20px 16px; }
dialog.bug-dlg h3 { margin: 0 0 8px; font-size: 16px; }
dialog.bug-dlg p { margin: 0 0 14px; line-height: 1.5; color: var(--ink); }
.bug-acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- version, bookmarks ---------- */
.ver { font: 600 10.5px/1 ui-monospace, Menlo, monospace; color: var(--muted); background: #f1ece2; border: 1px solid var(--line);
  border-radius: 99px; padding: 2px 6px; margin-left: -6px; align-self: center; }
#cx-bm { font-size: 16px; line-height: 1; padding: 4px 8px; color: var(--muted); }
#cx-bm.has { color: #b07d00; }
#cx-bm[aria-expanded="true"] { background: #f1ece2; }
.bm-pop { position: fixed; z-index: 900; top: 52px; right: 12px; width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 10px 12px 8px; }
.bm-pop[hidden] { display: none; }
.bm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bm-head b { font-size: 15px; }
.bm-pop > button.primary, .bm-pop > button:not(.ghost) { width: 100%; margin-bottom: 8px; }
.bm-list { list-style: none; margin: 0; padding: 0; }
.bm-list li { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.bm-list li.cur { background: #fbf0cf; }
.bm-go { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; text-align: left; border: 0; background: none; padding: 6px 6px; }
.bm-go:hover { background: #f4efe5; }
.bm-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-name::before { content: "★ "; color: #d99a00; }
.bm-page { color: var(--muted); font: 12px ui-monospace, Menlo, monospace; flex: none; }
.bm-mini { padding: 2px 7px; font-size: 13px; color: var(--muted); }
.bm-pop .small { font-size: 12px; margin: 8px 2px 2px; }
#rd-bm.on { background: #f3c35c; color: #2d2925; border-color: #f3c35c; }
.strip .t.bm { box-shadow: 0 -5px 0 -1px #f3c35c; }
.v3-tick.bm { box-shadow: 0 -6px 0 -2px #f3c35c; }
.v3-tick.hid, .v3-qb.hid { opacity: .3; }
.v3-insp .pg { display: inline-flex; align-items: center; gap: 4px; }
.bm-star { border: 0; background: none; padding: 0 2px; font-size: 14px; line-height: 1; color: #b9ad97; }
.bm-star.on, .bm-star:hover { color: #d99a00; }

/* ---------- Reader grid ---------- */
.rd-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rd-grid[hidden] { display: none; }
.rg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--table-line); }
.rg-t { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--table-muted); margin: 0 2px 0 6px; }
.rg-t:first-child { margin-left: 0; }
.rg-chip { background: transparent; color: var(--table-ink); border-color: var(--table-line); font-size: 12.5px; padding: 2px 10px; border-radius: 99px; }
.rg-chip:hover { border-color: #f3c35c; }
.rg-chip.bm { color: #f3c35c; }
.rg-close { margin-left: auto; background: transparent; color: var(--table-ink); border-color: var(--table-line); }
.rg-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 30px; }
.rg-q h4 { margin: 16px 0 8px; font-size: 13px; color: var(--table-ink); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.rg-q h4 span { font-weight: 400; color: var(--table-muted); font-size: 12px; }
.rg-cells { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.rg-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--table-ink); }
.rg-cell:hover { border-color: var(--table-line); background: rgba(255,255,255,.04); }
.rg-cell img { display: block; object-fit: cover; background: #e8dcc2; border-radius: 2px; }
.rg-cell .rg-ghost { display: grid; place-items: center; border: 1.5px dashed var(--ghost); color: var(--table-muted); font-size: 11px; border-radius: 2px; }
.rg-cell .rg-lbl { font: 600 11px ui-monospace, Menlo, monospace; color: var(--table-muted); }
.rg-cell.cur { border-color: #f3c35c; background: rgba(243,195,92,.12); }
.rg-cell.cur .rg-lbl { color: #f3c35c; }
.rg-star { position: absolute; top: 6px; right: 8px; color: #f3c35c; text-shadow: 0 1px 3px rgba(0,0,0,.6); font-size: 15px; }
@keyframes rg-flash { 0%, 40% { box-shadow: 0 0 0 3px #f3c35c; } 100% { box-shadow: 0 0 0 0 rgba(243,195,92,0); } }
.rg-cell.flash { animation: rg-flash 1.8s ease-out; }
@media (max-width: 600px) { .rg-body { padding: 4px 10px 24px; } .rg-cell img, .rg-cell .rg-ghost { max-height: 96px; width: auto !important; } }

/* ---------- Rearrange: whole gatherings, layers ---------- */
.ar-gh .ar-grip { padding: 2px 2px 2px 0; }
.ar-eye { border: 0; background: none; padding: 2px 3px; color: var(--muted); display: inline-flex; }
.ar-eye:hover { color: var(--ink); }
.ar-eye.off { color: #b42318; }
.ar-g.hid > .ar-rows, .ar-g.hid > .ar-note { opacity: .4; }
.ar-g.hid .ar-gname { text-decoration: line-through !important; color: var(--muted) !important; }
.ar-g.dragging { opacity: .4; }
.ar-gdrop { height: 4px; margin: 0 0 8px; }
.ar-gghost { border-radius: 8px; border: 1px solid var(--line); }
.ar-hidden { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; padding: 4px 8px; font-size: 12.5px;
  background: #fbe9e7; border: 1px solid #f0c8c2; border-radius: 6px; color: #8a2a1e; }
.ar-hidden button { padding: 1px 9px; font-size: 12px; }
.rd-page { position: relative; }
.rd-star { position: absolute; left: 6px; top: 8px; z-index: 2; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; line-height: 1; background: rgba(31, 35, 40, .62); color: #f6efe0;
  border: 1px solid rgba(255,255,255,.25); opacity: .55; transition: opacity .12s; }
.rd-page:hover .rd-star, .rd-star:focus-visible { opacity: 1; }
.rd-star.on { opacity: 1; color: #f3c35c; border-color: rgba(243,195,92,.7); }
@media (hover: none) { .rd-star { opacity: .85; } }
.bm-here { margin-bottom: 10px; font-size: 12.5px; color: var(--muted); }
.bm-pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bm-pages button { font: 600 12.5px ui-monospace, Menlo, monospace; padding: 4px 10px; }
.bm-pages button.on { background: #f3c35c; border-color: #f3c35c; color: #2d2925; }
#v-read [hidden] { display: none !important; }   /* the grid hides the open book, its note and its strip */
