/* מחולל השאילתות המחקריות — the research query builder, under the search screen.
   Everything here is scoped to #qbRoot, .qb-modal and the one opening button, so
   that nothing else in the app changes its look. Colours are the app's own. */

.adv-btn.qb-open{ background:linear-gradient(135deg,#1a3873,#2e61b8); display:flex; align-items:center;
  justify-content:center; gap:8px; }
.adv-btn.qb-open svg{ width:18px; height:18px; flex:0 0 auto; }

/* while the builder is open the plain search steps aside; the foot stays */
#searchScreen.qb-on > .search-bar,
#searchScreen.qb-on > .search-btn-row,
#searchScreen.qb-on > #qbOpenBtn,
#searchScreen.qb-on > #advPanel,
#searchScreen.qb-on > #searchStatus,
#searchScreen.qb-on > #searchResults{ display:none !important; }

#qbRoot{ flex:1 1 auto; overflow-y:auto; overflow-x:hidden; padding:2px 2px 14px; color:#1c2233;
  font-size:15px; line-height:1.5; -webkit-overflow-scrolling:touch; }
#qbRoot.hidden{ display:none; }
#qbRoot *{ box-sizing:border-box; }
#qbRoot button, #qbRoot select, #qbRoot input, #qbRoot textarea,
.qb-modal button, .qb-modal input, .qb-modal select{ font-family:inherit; }

.qb-head{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.qb-title{ font-size:19px; font-weight:800; color:var(--navy); margin:0; flex:1 1 220px; }
.qb-title small{ display:block; font-size:12.5px; font-weight:400; color:var(--muted); }
.qb-tools{ display:flex; gap:6px; flex-wrap:wrap; }
.qb-chip{ border:1px solid var(--line); background:#fff; color:var(--navy); border-radius:999px;
  padding:7px 12px; font-size:14px; cursor:pointer; white-space:nowrap; }
.qb-chip:hover{ background:#eef2fb; }
.qb-chip.on{ background:var(--navy); color:#fff; border-color:var(--navy); }
.qb-chip[disabled]{ opacity:.45; cursor:default; }
.qb-chip b{ font-weight:800; }

.qb-card{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:10px 12px; margin-bottom:10px; }
.qb-card > h3{ margin:0 0 8px; font-size:15px; font-weight:800; color:var(--navy); display:flex;
  align-items:center; gap:8px; flex-wrap:wrap; }
.qb-card > h3 small{ font-weight:400; color:var(--muted); font-size:12.5px; }
.qb-sub{ color:var(--muted); font-size:13px; }

/* natural language */
.qb-nl{ background:#f4f7fd; border-color:#c6d3ee; }
.qb-nl textarea{ width:100%; min-height:58px; resize:vertical; border:1px solid var(--line); border-radius:8px;
  padding:9px 10px; font-size:16px; background:#fff; }
.qb-nl-row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:8px; }
.qb-nl-row .qb-sub{ flex:1 1 200px; }
.qb-msg{ margin-top:8px; padding:8px 10px; border-radius:8px; font-size:14px; }
.qb-msg.ok{ background:#e9f6ee; color:#17603a; border:1px solid #bfe2cd; }
.qb-msg.warn{ background:#fff6e0; color:#7a5200; border:1px solid #f0d99a; }
.qb-msg.err{ background:#fdecec; color:#8a1f1f; border:1px solid #f1c0c0; }
.qb-msg ul{ margin:4px 0 0; padding-inline-start:18px; }

.qb-btn{ border:0; border-radius:8px; padding:11px 16px; font-size:15.5px; cursor:pointer; color:#fff;
  background:var(--accent); }
.qb-btn.run{ background:var(--navy); font-weight:700; padding:13px 22px; font-size:17px; }
.qb-btn.green{ background:var(--share); }
.qb-btn.ghost{ background:#fff; color:var(--navy); border:1px solid var(--line); }
.qb-btn.small{ padding:7px 11px; font-size:14px; }
.qb-btn[disabled]{ opacity:.5; cursor:default; }

/* scope */
.qb-scope-row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.qb-scope-row > label{ color:var(--muted); font-size:13.5px; min-width:64px; }
#qbRoot select, #qbRoot input[type=text], #qbRoot input[type=number], #qbRoot input[type=search],
.qb-modal input[type=text]{
  border:1px solid var(--line); border-radius:7px; padding:8px 8px; font-size:15.5px; background:#fff;
  color:#1c2233; min-height:38px; max-width:100%; }
#qbRoot input[type=number]{ width:74px; }

/* a word */
.qb-word{ border:1px solid var(--line); border-inline-start:6px solid var(--qbc,#888); border-radius:10px;
  padding:9px 10px; margin-bottom:9px; background:#fcfcfa; }
.qb-word-head{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.qb-badge{ display:inline-flex; align-items:center; justify-content:center; min-width:28px; height:28px;
  border-radius:8px; background:var(--qbc,#888); color:#fff; font-weight:800; font-size:15px; padding:0 6px; }
.qb-word-head .grow{ flex:1; }
.qb-x{ border:0; background:none; color:#a03030; font-size:20px; line-height:1; cursor:pointer; padding:4px 8px;
  border-radius:6px; }
.qb-x:hover{ background:#fbeaea; }
.qb-any{ color:var(--muted); font-size:13.5px; padding:2px 0 4px; }

.qb-grp{ border-radius:8px; }
.qb-grp.d1, .qb-grp.d2, .qb-grp.d3, .qb-grp.d4, .qb-grp.d5, .qb-grp.d6{ border:1px dashed #b9c3da;
  padding:7px 8px; margin:6px 0; background:#f6f8fc; }
.qb-grp.neg{ background:#fdf3f3; border-color:#e0b4b4; }
.qb-grp-bar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:5px; }
.qb-seg{ display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.qb-seg button{ border:0; background:#fff; color:var(--navy); padding:6px 12px; font-size:14px; cursor:pointer; }
.qb-seg button.on{ background:var(--navy); color:#fff; }
.qb-not{ display:inline-flex; align-items:center; gap:4px; border:1px solid var(--line); border-radius:8px;
  padding:5px 9px; font-size:14px; background:#fff; color:#8a1f1f; cursor:pointer; user-select:none; }
.qb-not.on{ background:#8a1f1f; color:#fff; border-color:#8a1f1f; }
.qb-leaf{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:4px 0; border-top:1px solid #edf0f6; }
.qb-leaf:first-of-type{ border-top:0; }
.qb-leaf .qb-val{ flex:1 1 130px; min-width:110px; }
.qb-leaf select.qb-field{ flex:0 1 170px; font-weight:600; color:var(--navy); }
.qb-hint{ flex:1 1 100%; color:var(--muted); font-size:12.5px; margin-top:-1px; }
.qb-hint.warn{ color:#8a5a00; }
.qb-join{ color:var(--muted); font-size:12.5px; font-weight:700; padding:0 2px; }
.qb-add{ display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.qb-link{ border:1px dashed #9fb0d3; background:#fff; color:var(--accent); border-radius:8px; padding:6px 11px;
  font-size:14px; cursor:pointer; }
.qb-link:hover{ background:#eef2fb; }

/* relations */
.qb-rel{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:6px 0; border-top:1px solid #edf0f6; }
.qb-rel:first-of-type{ border-top:0; }
.qb-rel .qb-rel-txt{ color:var(--muted); font-size:14px; }

/* the query in words */
.qb-desc{ background:#f7f7f2; border:1px solid #e3e1d3; border-radius:10px; padding:9px 12px; margin-bottom:10px; }
.qb-desc h3{ margin:0 0 4px; font-size:14px; color:var(--navy); }
.qb-desc ol{ margin:0; padding-inline-start:20px; }
.qb-desc li{ margin:1px 0; }
.qb-actions{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.qb-actions .grow{ flex:1; }

/* results */
.qb-res-head{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin:6px 0; }
.qb-count{ font-size:17px; color:var(--navy); }
.qb-count b{ font-size:21px; font-weight:800; }
.qb-flag{ display:inline-block; border-radius:999px; padding:3px 10px; font-size:13px; font-weight:700; }
.qb-flag.full{ background:#e3f4ea; color:#17603a; }
.qb-flag.part{ background:#fff0cc; color:#7a5200; }
.qb-notes{ margin:4px 0 8px; font-size:13.5px; color:#5a4a1a; background:#fffaf0; border:1px solid #f0e2bb;
  border-radius:8px; padding:6px 10px; }
.qb-notes summary{ cursor:pointer; font-weight:700; }
.qb-notes ul{ margin:4px 0 0; padding-inline-start:18px; }
.qb-ctl{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:6px 0; }
.qb-ctl label{ color:var(--muted); font-size:13px; }
.qb-ctl input[type=search]{ flex:1 1 150px; }
.qb-pair{ display:inline-flex; align-items:center; gap:6px; min-width:0; }
.qb-books{ display:flex; gap:5px; flex-wrap:wrap; margin:4px 0; }
.qb-table-wrap{ border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; }
table.qb-table{ width:100%; border-collapse:collapse; }
.qb-table th{ background:var(--navy); color:#fff; font-size:13.5px; font-weight:700; padding:7px 8px; text-align:start;
  white-space:nowrap; }
.qb-table td{ padding:8px 8px; vertical-align:top; border-top:1px solid #e6e9f2; }
.qb-table tr:nth-child(even) td{ background:#fafbfe; }
.qb-loc{ white-space:nowrap; }
.qb-loc button{ border:0; background:none; padding:0; color:var(--accent); font-weight:700; font-size:15px;
  cursor:pointer; text-align:start; font-family:inherit; text-decoration:underline; text-underline-offset:3px; }
.qb-loc small{ display:block; color:var(--muted); font-size:12px; }
.qb-text{ font-size:calc(18px + var(--qbz,0px)); line-height:1.65; }
.qb-par{ margin-top:5px; padding-top:5px; border-top:1px dotted #cfd6e6; font-size:calc(16px + var(--qbz,0px)); color:#2b3350; }
.qb-par > span.qb-par-name{ display:inline-block; font-size:11.5px; font-weight:700; color:#fff; background:#7c88a8;
  border-radius:4px; padding:0 6px; margin-inline-end:6px; vertical-align:middle; }
.qb-text[dir=ltr], .qb-par[dir=ltr]{ text-align:left; }
mark.qb-hl{ background:color-mix(in srgb, var(--qbc) 16%, #fff); color:var(--qbc); font-weight:700;
  border-radius:4px; padding:0 2px; box-shadow:inset 0 -2px 0 var(--qbc); }
.c0{ --qbc:#c62828; } .c1{ --qbc:#1565c0; } .c2{ --qbc:#2e7d32; } .c3{ --qbc:#d35400; }
.c4{ --qbc:#6a1b9a; } .c5{ --qbc:#00838f; } .c6{ --qbc:#ad1457; } .c7{ --qbc:#5d4037; }
.qb-an{ font-size:13.5px; line-height:1.45; }
.qb-an-w{ margin-bottom:5px; }
.qb-an-w .qb-badge{ min-width:20px; height:20px; font-size:12px; border-radius:5px; margin-inline-end:4px; }
.qb-an-w b{ font-size:15px; }
.qb-an-w span.k{ color:var(--muted); }
.qb-an-w .pr{ direction:ltr; unicode-bidi:isolate; font-style:italic; color:#444; }
.qb-tag{ display:inline-block; border-radius:5px; padding:0 6px; font-size:12px; background:#eef0f6; color:#39425f;
  margin-inline-end:3px; }
.qb-tag.warn{ background:#fff0cc; color:#7a5200; }
.qb-cert{ font-size:12.5px; white-space:nowrap; }
.qb-cert i{ display:inline-block; width:9px; height:9px; border-radius:50%; margin-inline-end:5px; background:#9aa; }
.qb-cert.k3 i{ background:#1e8a4c; } .qb-cert.k2 i{ background:#2e61b8; } .qb-cert.k1 i{ background:#d99a00; }
.qb-cert.kt i{ background:#1e8a4c; }
.qb-src{ color:var(--muted); font-size:12px; margin-top:2px; }
.qb-pager{ display:flex; align-items:center; justify-content:center; gap:10px; margin:10px 0; }
.qb-empty{ text-align:center; color:var(--muted); padding:22px 8px; }
.qb-busy{ text-align:center; color:var(--accent); padding:16px 8px; font-weight:700; }
.qb-busy::after{ content:'…'; animation:qbblink 1s steps(3) infinite; }
@keyframes qbblink{ 50%{ opacity:.2; } }
@media (prefers-reduced-motion:reduce){ .qb-busy::after{ animation:none; } }

/* narrow screens: each verse becomes a card */
@media (max-width:720px){
  .qb-table thead{ display:none; }
  .qb-table, .qb-table tbody, .qb-table tr, .qb-table td{ display:block; width:100%; }
  .qb-table tr{ border-top:6px solid #eef0f6; padding:4px 0; }
  .qb-table tr:first-child{ border-top:0; }
  .qb-table td{ border-top:0; padding:4px 10px; }
  .qb-table tr:nth-child(even) td{ background:#fff; }
  .qb-loc{ display:flex !important; align-items:baseline; gap:8px; }
  .qb-loc small{ display:inline; }
  .qb-num{ display:none !important; }
}

.qb-chip.qb-help{ background:#fff8e1; border-color:#e6cf8a; }
.qb-chip.qb-help:hover{ background:#fff1c4; }

/* a finger, not a mouse: every control tall enough to touch, and 16px type in
   every field, so that an iPhone does not zoom the page when one is touched */
@media (pointer:coarse), (max-width:720px){
  .qb-chip, .qb-link, .qb-not, .qb-seg button, .qb-btn.small{ min-height:40px; }
  .qb-x{ min-width:40px; min-height:40px; font-size:22px; }
  #qbRoot select, #qbRoot input[type=text], #qbRoot input[type=number], #qbRoot input[type=search],
  .qb-modal input[type=text]{ font-size:16px; min-height:44px; }
  .qb-rel label.qb-rel-txt{ display:inline-flex; align-items:center; gap:7px; min-height:40px; }
  .qb-rel input[type=checkbox]{ width:20px; height:20px; }
  .qb-loc button{ min-height:36px; }
  .qb-notes summary{ padding:6px 0; }
}

/* a phone: one thing to a line, and "run" always under the thumb */
@media (max-width:720px){
  .qb-title{ flex-basis:100%; font-size:18px; }
  .qb-tools{ width:100%; }
  .qb-tools .qb-chip{ flex:1 1 auto; text-align:center; padding:7px 9px; }
  .qb-card{ padding:10px; }
  .qb-nl-row .qb-btn{ flex:1 1 100%; }
  .qb-scope-row > label{ flex:1 1 100%; min-width:0; }
  .qb-scope-row select{ flex:1 1 auto; min-width:0; }

  /* a word's head: its letter, its version and its ×; "must / must not" beneath */
  .qb-word{ padding:9px 8px; }
  .qb-word-head > select{ order:1; flex:1 1 0; min-width:0; }
  .qb-word-head > .qb-x{ order:2; }
  .qb-word-head > .qb-seg{ order:3; flex:1 1 100%; }
  .qb-word-head > .qb-seg button{ flex:1 1 0; }
  .qb-word-head > .grow{ display:none; }

  /* a condition: what it asks on one line, its value on the next */
  .qb-leaf{ padding:8px 0; }
  .qb-leaf > *{ order:3; }
  .qb-leaf > .qb-not{ order:0; }
  .qb-leaf > select.qb-field{ order:1; flex:1 1 0; min-width:0; }
  .qb-leaf > .qb-x{ order:2; }
  .qb-leaf > select:not(.qb-field){ flex:1 1 40%; min-width:0; }
  .qb-leaf > .qb-val, .qb-leaf > select.qb-val{ flex:1 1 100%; min-width:0; }
  .qb-leaf > .qb-hint{ order:4; }
  .qb-grp.d1, .qb-grp.d2, .qb-grp.d3, .qb-grp.d4, .qb-grp.d5, .qb-grp.d6{ padding:7px 6px; }
  .qb-grp-bar .qb-seg{ flex:1 1 auto; }
  .qb-grp-bar .qb-seg button{ flex:1 1 0; }
  .qb-add .qb-link{ flex:1 1 auto; }
  .qb-card > .qb-seg{ display:flex; }
  .qb-card > .qb-seg button{ flex:1 1 0; padding:6px 6px; }

  /* a relation between two words is a small card of its own */
  .qb-rel, .qb-rel:first-of-type{ border:1px solid #e1e6f1; border-radius:10px; padding:8px; margin-bottom:8px;
    background:#fafbfe; }
  .qb-rel > select{ flex:1 1 28%; min-width:0; }
  .qb-rel > input[type=number]{ width:66px; }
  .qb-rel > .qb-x{ margin-inline-start:auto; }

  /* "run" stays at the foot of the screen for as long as the query is being
     built; once the reader is down in the results it goes up with the page */
  .qb-actions{ position:sticky; bottom:0; z-index:4; flex-wrap:nowrap; gap:6px; margin:0 -2px 12px;
    padding:8px 6px; background:rgba(255,255,255,.97); border-top:1px solid var(--line);
    box-shadow:0 -6px 14px rgba(20,30,60,.08); }
  .qb-actions .grow{ display:none; }
  .qb-actions .qb-btn{ flex:0 1 auto; min-width:0; padding:11px 9px; font-size:14.5px; white-space:nowrap; }
  .qb-actions .qb-btn.run{ flex:1 1 auto; padding:12px 8px; font-size:16.5px; }

  .qb-pair{ flex:1 1 100%; }
  .qb-pair label{ flex:0 0 auto; }
  .qb-pair select{ flex:1 1 auto; min-width:0; }
  .qb-ctl input[type=search]{ flex:1 1 100%; }
  .qb-pager{ gap:8px; }
  .qb-item .qb-add .qb-btn{ flex:1 1 auto; }
}

/* the builder's own little windows — a .modal, so the phone's Back closes them */
.qb-modal .modal-box{ width:94%; max-width:620px; max-height:86vh; overflow:hidden; text-align:start; }
.qb-modal .qb-mbody{ overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding:2px; }
.qb-item{ border:1px solid var(--line); border-radius:10px; padding:9px 11px; background:#fff; }
.qb-item h4{ margin:0 0 2px; font-size:15.5px; color:var(--navy); }
.qb-item p{ margin:0 0 6px; color:#4a5068; font-size:13.5px; }
.qb-item .qb-add{ margin-top:4px; }
.qb-item time{ color:var(--muted); font-size:12px; }
.qb-cov{ width:100%; border-collapse:collapse; font-size:13.5px; }
.qb-cov th, .qb-cov td{ border:1px solid #e1e5ef; padding:5px 7px; text-align:start; vertical-align:top; }
.qb-cov th{ background:#eef2fb; color:var(--navy); }
.qb-cov td.no{ color:#8a1f1f; font-weight:700; }
.qb-bar{ display:inline-block; width:54px; height:7px; border-radius:4px; background:#e3e7f1; overflow:hidden;
  vertical-align:middle; margin-inline-end:6px; }
.qb-bar i{ display:block; height:100%; background:#2e61b8; }

/* the builder's little windows on a phone (after their own rules above) */
@media (max-width:720px){
  .qb-modal .modal-box{ width:96%; max-height:90vh; max-height:90dvh; }
  .qb-modal .qb-mbody{ -webkit-overflow-scrolling:touch; }
  .qb-cov{ font-size:12.5px; }
  .qb-cov th, .qb-cov td{ padding:5px 5px; }
  .qb-bar{ width:34px; }
}

/* where a result stands: the portion, and the words its Samaritan chapter opens with */
.qb-loc small.qb-place{ white-space:normal; line-height:1.45; margin-top:1px; }
.qb-loc small.qb-place .k{ color:#7b8298; }
.qb-loc{ min-width:150px; }

/* the word in Samaritan script, with the printed book's marks above it */
.qb-sam{ unicode-bidi:isolate; font-size:1.3em; margin-inline-start:8px; color:#3a2a12; white-space:nowrap; }
.qb-sam.nik{ line-height:2.1; }
.qb-sam .samchar{ font-family:'Samaritan'; }
.qb-sam .samchar.nik{ font-family:'SamNikud','Samaritan',serif; }

/* two faces of one answer: the list of verses, and the report */
.qb-tabs{ display:flex; gap:4px; border-bottom:2px solid var(--navy); margin:10px 0 8px; }
.qb-tab{ border:1px solid var(--line); border-bottom:0; background:#f3f5fa; color:var(--navy); font:inherit; font-size:15px;
  font-weight:700; padding:8px 16px; border-radius:10px 10px 0 0; cursor:pointer; }
.qb-tab.on{ background:var(--navy); color:#fff; border-color:var(--navy); }

/* ── the report ───────────────────────────────────────────────────────────── */
.qb-report{ --bar:#2e61b8; --bar-muted:#c3c9d6; --grid:#e3e7f1; }
.qb-tiles{ display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:8px; margin:6px 0 10px; }
.qb-tile{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:10px 12px; display:flex; flex-direction:column; gap:2px; }
.qb-tile b{ font-size:24px; font-weight:800; color:var(--navy); line-height:1.2; overflow-wrap:anywhere; }
.qb-tile span{ color:var(--muted); font-size:13px; }
.qb-rsec h3{ display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.qb-rsec h3 small{ color:var(--muted); font-weight:400; font-size:13px; }
.qb-rsec h4{ margin:12px 0 2px; font-size:14.5px; color:var(--navy); }
.qb-rsec > .qb-sub{ margin:0 0 6px; }
.qb-rsec > .qb-seg{ margin:2px 0 8px; }
.qb-seg-wrap{ flex-wrap:wrap; }

/* a list of bars: the name, the bar from one baseline, the number at its tip */
.qb-bars{ display:grid; grid-template-columns:minmax(64px, max-content) 1fr; column-gap:10px; row-gap:5px; align-items:center; }
.qb-bars.narrow{ grid-template-columns:minmax(28px, max-content) 1fr; }
.qb-bar-row{ display:contents; }
.qb-bar-lab{ font-size:14.5px; color:#1f2640; overflow-wrap:anywhere; }
.qb-bar-lab b{ font-weight:700; }
.qb-bar-track{ display:flex; align-items:center; gap:6px; min-width:90px; }
.qb-bar-track i{ display:block; flex:0 0 auto; height:14px; background:var(--bar); border-start-end-radius:4px; border-end-end-radius:4px; }
.qb-bar-row.muted .qb-bar-track i{ background:var(--bar-muted); }
.qb-bar-row.muted .qb-bar-lab{ color:var(--muted); }
.qb-bar-val{ font-size:13.5px; color:#39425f; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* columns along the Torah: a group to a book, a column to a portion */
.qb-cols-wrap{ display:flex; gap:6px; align-items:flex-start; margin-top:4px; }
.qb-cols-axis{ display:flex; flex-direction:column; justify-content:space-between; height:150px; font-size:11.5px;
  color:var(--muted); font-variant-numeric:tabular-nums; text-align:end; min-width:22px; }
.qb-cols-axis span{ line-height:1; }
.qb-cols{ flex:1 1 auto; min-width:0; display:flex; gap:8px; }
.qb-cols-grp{ flex:1 1 0; min-width:0; }
.qb-cols-bars{ display:flex; gap:2px; align-items:stretch; height:150px; border-bottom:1px solid #b9c0d0;
  background:linear-gradient(var(--grid), var(--grid)) top/100% 1px no-repeat,
             linear-gradient(var(--grid), var(--grid)) center/100% 1px no-repeat; }
.qb-col{ flex:1 1 0; min-width:0; max-width:24px; border:0; padding:0; background:none; cursor:pointer; display:flex; align-items:flex-end; }
.qb-col i{ display:block; width:100%; background:var(--bar); border-radius:4px 4px 0 0; }
.qb-col:hover, .qb-col.on, .qb-col:focus-visible{ background:#eef2fb; outline:0; }
.qb-col.on i, .qb-col:hover i{ background:var(--navy); }
.qb-cols-name{ font-size:12px; color:#39425f; text-align:center; padding-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.qb-cols-line{ min-height:22px; margin:6px 0 2px; font-size:14px; color:#1f2640; }
.qb-rdetails{ margin-top:6px; }
.qb-rdetails summary{ cursor:pointer; color:var(--accent); font-size:13.5px; padding:4px 0; }

/* how sure the root is: one bar, cut by a gap, darkest for the surest */
.qb-stack{ display:flex; gap:2px; height:16px; border-radius:4px; overflow:hidden; }
.qb-stack i, .qb-legend i{ display:block; background:#cfd3dc; }
.qb-stack i{ min-width:3px; }
.qb-stack i.k3, .qb-legend i.k3{ background:#1a3873; }
.qb-stack i.k2, .qb-legend i.k2{ background:#5b84cf; }
.qb-stack i.k1, .qb-legend i.k1{ background:#b3c6ec; }
.qb-legend{ display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:6px; font-size:13px; color:#39425f; }
.qb-legend span{ display:inline-flex; align-items:center; gap:6px; }
.qb-legend i{ width:11px; height:11px; border-radius:3px; }

@media (max-width:720px){
  .qb-tab{ flex:1 1 0; padding:9px 6px; min-height:42px; }
  .qb-loc{ flex-wrap:wrap; min-width:0; }
  .qb-loc small.qb-place{ flex:1 1 100%; }
  .qb-tile b{ font-size:21px; }
  .qb-cols{ gap:5px; }
  .qb-cols-bars{ gap:1px; height:130px; }
  .qb-cols-axis{ height:130px; }
  .qb-cols-name{ font-size:10.5px; white-space:normal; line-height:1.2; }
  .qb-bar-lab .qb-sam{ display:block; margin:0; }
  .qb-rsec > .qb-seg{ display:flex; }
  .qb-rsec > .qb-seg button{ flex:1 1 auto; padding:6px 6px; }
}

/* the report on paper: only the copy made for the sheet is printed */
#qbPrint{ display:none; }
@media print{
  body.qb-printing > *:not(#qbPrint){ display:none !important; }
  body.qb-printing{ background:#fff !important; }
  body.qb-printing #qbPrint{ display:block; padding:0 4mm; color:#000; font-family:inherit; }
  #qbPrint h1{ font-size:20pt; margin:0 0 2mm; color:#1a3873; }
  #qbPrint h2{ font-size:12pt; margin:3mm 0 1mm; color:#1a3873; }
  #qbPrint ul{ margin:0 0 4mm; padding-inline-start:6mm; font-size:11pt; }
  #qbPrint .qb-print-meta{ margin:0; color:#555; font-size:10pt; }
  #qbPrint .qb-noprint, #qbPrint .qb-rdetails summary{ display:none !important; }
  #qbPrint .qb-card, #qbPrint .qb-tile{ break-inside:avoid; box-shadow:none; }
  #qbPrint .qb-cols-line{ display:none; }
  #qbPrint *{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}

/* the morphological layer: a found word opens its card; the status of its analysis */
.qb-an-w b.qb-mw{ cursor:pointer; border-bottom:1px dotted currentColor; }
.qb-an-w b.qb-mw:hover, .qb-an-w b.qb-mw:focus-visible{ color:#2e61b8; }
.qb-tag.vs-a{ background:#f1f1f1; color:#555; }
.qb-tag.vs-v, .qb-tag.vs-c{ background:#dff3e6; color:#17623a; }
.qb-tag.vs-d, .qb-tag.vs-k{ background:#fde2e2; color:#8a1f1f; }

/* ── the basic search, and the choice between it and the builder ── */
.qb-mode{ display:flex; justify-content:center; margin:2px 0 10px; }
.qb-mode .qb-seg{ max-width:100%; }
.qb-mode .qb-seg button{ padding:9px 18px; font-size:15px; font-weight:700; }
.qb-basic-row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.qb-basic-row select.qb-field{ flex:0 1 170px; font-weight:600; color:var(--navy); }
#qbRoot .qb-basic-row input.qb-bq{ flex:1 1 220px; min-width:0; font-size:19px; padding:10px 12px; min-height:46px; }
.qb-basic-row .qb-btn.run{ padding:11px 22px; }
.qb-basic > .qb-hint{ margin:5px 0 2px; }
.qb-basic-in{ margin:10px 0 0; }
.qb-basic-in .qb-books{ margin:0; flex:1 1 200px; }
/* the box has its own button; the bar keeps saving, sharing and clearing */
.qb-actions.basic .qb-btn.run{ display:none; }
.qb-basic-more{ color:var(--muted); font-size:13.5px; margin:0 2px 12px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
/* "by the points", "full and defective spelling" */
.qb-flags{ flex:1 1 100%; display:flex; gap:6px 16px; flex-wrap:wrap; align-items:center; font-size:13.5px; color:#39425f; margin-top:4px; }
.qb-flags label{ display:inline-flex; align-items:center; gap:5px; cursor:pointer; min-height:28px; }
.qb-flags input[type=checkbox]{ width:17px; height:17px; accent-color:var(--navy); }
.qb-flags .qb-hint{ margin-top:0; }
.qb-vr-hint{ flex:1 1 180px; }

/* ── the answer word by word ── */
.qb-wwrap{ overflow-x:auto; }
.qb-wtable th{ padding:0; }
.qb-wtable th:not(:has(button)){ padding:7px 8px; }
.qb-sortbtn{ border:0; background:none; color:inherit; font:inherit; font-weight:700; cursor:pointer; padding:7px 8px; width:100%;
  text-align:start; white-space:nowrap; }
.qb-sortbtn:hover, .qb-sortbtn.on{ background:rgba(255,255,255,.14); }
.qb-sortbtn:focus-visible{ outline:2px solid #fff; outline-offset:-3px; }
.qb-wtable td{ font-size:calc(14.5px + var(--qbz,0px)); }
.qb-wword b{ font-size:calc(17px + var(--qbz,0px)); color:var(--qbc); }
.qb-wword small{ display:block; color:var(--muted); font-size:12.5px; }
.qb-wword .pr{ direction:ltr; unicode-bidi:isolate; font-style:italic; color:#444; font-size:13px; }
.qb-kwic{ font-size:calc(16px + var(--qbz,0px)) !important; line-height:1.7; min-width:230px; color:#2b3350; }
.qb-kwic[dir=ltr]{ text-align:left; }
.qb-wver{ white-space:nowrap; color:#39425f; font-size:13px !important; }
.qb-wnote{ color:var(--muted); font-size:13px; margin:4px 2px 6px; }
.qb-wsort{ display:none; }
@media (max-width:720px){
  .qb-mode .qb-seg{ display:flex; width:100%; }
  .qb-mode .qb-seg button{ flex:1 1 0; padding:9px 6px; font-size:14px; }
  .qb-basic-row > label{ flex:0 0 auto; }
  .qb-basic-row select.qb-field{ flex:1 1 0; min-width:0; }
  #qbRoot .qb-basic-row input.qb-bq{ flex:1 1 100%; }
  .qb-basic-row .qb-btn.run{ flex:1 1 100%; }
  .qb-wwrap{ overflow-x:visible; }
  .qb-actions.basic{ position:static; box-shadow:none; border-top:0; background:none; padding:0 2px; }
  .qb-wsort{ display:inline-flex; }
  .qb-wsort-hint{ display:none; }
  .qb-wsort select{ flex:1 1 auto; min-width:0; }
  .qb-wtable td[data-l]::before{ content:attr(data-l) ': '; color:var(--muted); font-size:12.5px; font-weight:400; }
  .qb-wtable td:empty{ display:none; }
  .qb-wtable td.qb-num{ display:none; }
  .qb-kwic{ min-width:0; }
}

/* gematria: the typed word by its value, beside the basic box and inside a condition */
.qb-gemline{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:6px 0 2px; padding:6px 10px; background:#f6f8fc; border:1px solid #e3e8f2; border-radius:10px; font-size:13.5px; }
.qb-gemline[hidden]{ display:none; }
.qb-gem-n b{ font-size:15.5px; color:#1a3873; font-variant-numeric:tabular-nums; }
.qb-gem-live{ color:#1a3873; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
