:root {
  --bg: #06080e;
  --panel: rgba(12, 16, 26, 0.78);
  --panel-solid: #0c101a;
  --line: rgba(217, 180, 90, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #e9e4d8;
  --muted: #98a1b0;
  --faint: #626b7a;
  --gold: #d9b45a;
  --gold-hi: #f3d98e;
  --emerald: #3ccf9a;
  --amber: #e7a33d;
  --crimson: #ec5b62;
  --teal: #4fc3d4;
  --radius: 14px;
  --ui: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --ar: "Amiri", "Noto Naskh Arabic", serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.5 var(--ui); }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; color: var(--gold-hi); }
em { color: var(--gold-hi); font-style: normal; }
.ar { font-family: var(--ar); direction: rtl; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; }

/* brand ------------------------------------------------------------ */
.brand { position: fixed; top: 20px; left: 24px; display: flex; gap: 14px; align-items: center; z-index: 5; pointer-events: none; }
.brand .mark { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(217,180,90,.18), transparent 70%); }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .32em; font-weight: 600; }
.brand h1 .ar { letter-spacing: 0; color: var(--gold); font-size: 24px; margin-left: 8px; font-weight: 400; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .04em; }

/* mode switch -------------------------------------------------------- */
.modes { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line-soft); backdrop-filter: blur(14px); z-index: 5; }
.modes button { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px; font: 500 13px var(--ui); cursor: pointer; }
.modes button.on { background: rgba(217,180,90,.16); color: var(--gold-hi); }

/* side panel ------------------------------------------------------------ */
.panel { position: fixed; top: 90px; right: 20px; bottom: 54px; width: 410px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); backdrop-filter: blur(18px) saturate(1.2); z-index: 6; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.tabs { display: flex; border-bottom: 1px solid var(--line-soft); }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 13px 0 11px; font: 500 13px var(--ui); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--gold-hi); border-bottom-color: var(--gold); }
.tab { display: none; padding: 18px 20px 24px; overflow-y: auto; flex: 1; }
.tab.on { display: block; }
.tab h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.tab h3 { margin: 22px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 600; }
.lede { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
textarea, input, select { width: 100%; background: rgba(255,255,255,.035); color: var(--text); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font: 13.5px/1.5 var(--ui); outline: none; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: rgba(217,180,90,.5); }
#q-text, #q-params { font: 12px/1.55 var(--mono); }
#q-params { margin-top: 8px; }
select { margin-bottom: 8px; }
button.primary { margin-top: 10px; width: 100%; border: 0; border-radius: 10px; padding: 11px; font: 600 13.5px var(--ui); background: linear-gradient(180deg, #e8c574, #c79c3e); color: #1a1405; cursor: pointer; }
button.primary:disabled { opacity: .45; cursor: wait; }
.search { display: flex; gap: 8px; }
.search button { border: 1px solid var(--line); background: rgba(217,180,90,.12); color: var(--gold-hi); border-radius: 10px; padding: 0 16px; font: 600 13px var(--ui); cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.coverage-note { margin-top: 6px; font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.how { margin-top: 22px; padding: 14px 14px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.018); }
.how-step { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 12.5px; color: var(--muted); margin: 0 0 9px; }
.how-step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--ui); color: var(--gold-hi); border: 1px solid var(--line); background: rgba(217,180,90,.08); }
.how-step strong { color: var(--text); font-weight: 600; }
.how-note { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--faint); }
#verdict:not(:empty) ~ .how { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.chip { border: 1px solid var(--line-soft); background: rgba(255,255,255,.03); color: var(--muted); border-radius: 999px; padding: 5px 11px; font: 12px var(--ui); cursor: pointer; }
.chip:hover { color: var(--gold-hi); border-color: var(--line); }

/* verdict ----------------------------------------------------------------- */
.verdict { margin-top: 18px; border-radius: 12px; border: 1px solid var(--line-soft); overflow: hidden; animation: rise .35s ease both; }
.verdict .head { padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.verdict .badge { font: 700 11px var(--ui); letter-spacing: .14em; padding: 4px 9px; border-radius: 6px; }
.verdict.ok .head { background: rgba(60,207,154,.1); } .verdict.ok .badge { background: var(--emerald); color: #04140d; }
.verdict.alt .head { background: rgba(231,163,61,.1); } .verdict.alt .badge { background: var(--amber); color: #1d1203; }
.verdict.no .head { background: rgba(236,91,98,.1); } .verdict.no .badge { background: var(--crimson); color: #1d0405; }
.verdict .head .title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.verdict .reason { padding: 10px 14px 0; color: var(--muted); font-size: 13px; }
.verdict .src { padding: 12px 14px; }
.verdict .src .label { font-weight: 600; color: var(--gold-hi); font-size: 15px; }
.verdict .ref { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; font-size: 12px; color: var(--faint); }
.verdict .facts { margin-top: 10px; display: grid; gap: 6px; }
.verdict .fact { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 12.5px; }
.verdict .k { color: var(--faint); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding-top: 2px; }
.verdict .v { color: var(--text); }
/* a named scholar's grade of a report (the four Sunan, as sunnah.com prints it) */
.hgrade { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.hgrade + .hgrade { margin-top: 4px; }
.hg { font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid; }
.hg.sahih { color: var(--emerald); border-color: rgba(60,207,154,.45); background: rgba(60,207,154,.1); }
.hg.hasan { color: var(--teal); border-color: rgba(79,195,212,.45); background: rgba(79,195,212,.1); }
.hg.daif { color: var(--amber); border-color: rgba(231,163,61,.45); background: rgba(231,163,61,.1); }
.hg.mawdu { color: var(--crimson); border-color: rgba(236,91,98,.45); background: rgba(236,91,98,.1); }
.hg.mixed, .hg.other { color: var(--text); border-color: var(--line-soft); background: rgba(255,255,255,.04); }
.hg-by { font-size: 12px; color: var(--muted); }
.hg-note { display: block; margin-top: 4px; font-size: 11.5px; color: var(--faint); }
.fam-grade { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.verdict .chainline { margin-top: 10px; }
.verdict .chainline .links { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px; }
.verdict .chainline .links span { padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.04); border: 1px solid var(--line-soft); }
.verdict .chainline .links span.prophet { color: var(--gold-hi); border-color: var(--line); background: rgba(217,180,90,.1); }
.verdict .chainline .links i { font-style: normal; color: var(--faint); }
.verdict .stored { margin-top: 6px; padding: 10px 12px; background: rgba(255,255,255,.03); border-left: 2px solid var(--gold); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.verdict .stored.ar { font-size: 19px; line-height: 1.9; text-align: right; border-left: 0; border-right: 2px solid var(--gold); border-radius: 8px 0 0 8px; }
.verdict .chain { margin-top: 8px; color: var(--muted); font-size: 12px; }
.verdict .actions { padding: 0 14px 14px; }
.verdict .actions button { border: 1px solid var(--line); background: rgba(217,180,90,.1); color: var(--gold-hi); border-radius: 8px; padding: 7px 12px; font: 600 12px var(--ui); cursor: pointer; }
.diff { margin: 0 14px 12px; padding: 10px 12px; background: rgba(0,0,0,.25); border-radius: 8px; font-size: 13.5px; line-height: 1.9; }
.diff.ar { direction: rtl; font-family: var(--ar); font-size: 18px; }
.diff .add, .diff-legend .add { background: rgba(236,91,98,.22); color: #ffc2c5; border-radius: 4px; padding: 1px 4px; text-decoration: underline wavy rgba(236,91,98,.7); }
.diff .drop, .diff-legend .drop { color: var(--amber); text-decoration: line-through; opacity: .8; }
.diff .chg { background: rgba(231,163,61,.18); border-radius: 4px; padding: 1px 4px; }
.diff-legend { margin: -4px 14px 12px; font-size: 11px; color: var(--faint); }

/* family / breadth ------------------------------------------------------- */
.fam-head { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.02); }
.fam-head .title { font-weight: 600; color: var(--gold-hi); }
.fam-head .sub { color: var(--muted); font-size: 12px; }
.colls { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.coll { font: 600 10.5px var(--ui); letter-spacing: .06em; padding: 3px 7px; border-radius: 5px; background: rgba(217,180,90,.12); color: var(--gold-hi); }
.breadth { margin-top: 12px; }
.brow { display: grid; grid-template-columns: 46px 1fr 26px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); padding: 2px 0; cursor: default; }
.brow .bar { height: 10px; border-radius: 3px; background: linear-gradient(90deg, rgba(217,180,90,.85), rgba(217,180,90,.35)); }
.brow.single .bar { background: linear-gradient(90deg, #f3d98e, #d9b45a); box-shadow: 0 0 12px rgba(243,217,142,.5); }
.brow.partial { opacity: .5; }
.note { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.note b { color: var(--gold-hi); font-weight: 600; }
.pivots { margin-top: 8px; font-size: 12.5px; }
.pivots span { color: var(--gold-hi); }

.hits { list-style: none; padding: 0; margin: 8px 0 0; }
.hits li { padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.hits li:hover { background: rgba(255,255,255,.04); }
.hits .ar { color: var(--faint); font-size: 15px; }

/* cypher tab ----------------------------------------------------------- */
#q-result { margin-top: 12px; max-height: 300px; overflow: auto; border-radius: 8px; }
table.rows { width: 100%; border-collapse: collapse; font: 11.5px/1.45 var(--mono); }
table.rows th { text-align: left; color: var(--gold); position: sticky; top: 0; background: var(--panel-solid); padding: 6px; border-bottom: 1px solid var(--line); }
table.rows td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); color: var(--text); vertical-align: top; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.timing { font: 11px var(--mono); color: var(--emerald); margin: 6px 0; }
.log { padding-left: 18px; margin: 0; font: 11.5px var(--mono); color: var(--muted); }
.log li { margin: 3px 0; cursor: pointer; }
.log li b { color: var(--gold-hi); font-weight: 500; }
.err { color: var(--crimson); font: 12px var(--mono); margin-top: 8px; white-space: pre-wrap; }

/* narrator card ---------------------------------------------------------- */
.card { position: fixed; left: 24px; bottom: 54px; width: 340px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); backdrop-filter: blur(18px); padding: 16px 18px; z-index: 6; animation: rise .3s ease both; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.card .name { font-weight: 600; font-size: 15px; }
.card .name-ar { font-family: var(--ar); font-size: 20px; color: var(--gold); direction: rtl; text-align: left; }
.card .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.card .grade { margin-top: 10px; font-size: 12.5px; }
.card .grade .who { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.card .grade .ar { font-size: 16px; color: var(--text); display: block; text-align: right; }
.card .approx { font: 500 10px var(--ui); letter-spacing: .06em; color: var(--faint); border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
.card .spread { color: var(--faint); }
.card .link-conf { margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.card .link-conf.medium { color: #e9c27a; }
.card .dep { margin-top: 10px; padding: 9px 11px; border-radius: 8px; background: rgba(255,255,255,.03); font-size: 12.5px; color: var(--muted); }
.card .dep b { color: var(--gold-hi); }
.card .row { display: flex; gap: 8px; margin-top: 12px; }
.card button { flex: 1; border: 1px solid var(--line); background: rgba(217,180,90,.1); color: var(--gold-hi); border-radius: 8px; padding: 8px; font: 600 12px var(--ui); cursor: pointer; }
.card button.danger { border-color: rgba(236,91,98,.4); background: rgba(236,91,98,.12); color: #ffb3b7; }
.card .x { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: var(--faint); font-size: 18px; cursor: pointer; flex: none; padding: 0; }

/* surgery HUD ------------------------------------------------------------ */
.hud { position: fixed; right: 460px; bottom: 56px; text-align: right; z-index: 5; pointer-events: none; max-width: 260px; }
.hud .big { font-size: 52px; font-weight: 700; letter-spacing: -.02em; }
.hud .big .of { color: var(--faint); font-weight: 400; font-size: 26px; }
.hud .sub { color: var(--muted); font-size: 13px; }
.hud.dead .big { color: var(--crimson); }
.hud.alive .big { color: var(--emerald); }

.legend { position: fixed; left: 20px; top: 88px; z-index: 5; font-size: 11.5px; color: var(--muted); width: 248px; max-height: calc(100vh - 160px); overflow: auto;
  background: rgba(10, 13, 21, .62); border: 1px solid var(--line-soft); border-radius: 12px; backdrop-filter: blur(12px); padding: 4px 12px 10px; }
.legend.collapsed { width: auto; padding: 4px 12px; }
.legend.collapsed .legend-body { display: none; }
.legend-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 14px; border: 0; background: none; color: var(--faint); font: 600 10.5px var(--ui); letter-spacing: .14em; text-transform: uppercase; padding: 6px 0; cursor: pointer; }
.legend-toggle:hover { color: var(--gold-hi); }
.legend-toggle i { font-style: normal; font-size: 14px; letter-spacing: 0; }
.legend .item { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.legend i.line { width: 18px; height: 2px; border-radius: 1px; }
.legend .title { text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 10px 0 4px; font-size: 10.5px; }

.tooltip { position: fixed; z-index: 8; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: rgba(6,8,14,.92); border: 1px solid var(--line); font-size: 12px; max-width: 260px; }
.tooltip .ar { color: var(--gold); font-size: 15px; display: block; }

.node-label { color: var(--text); font: 500 11px var(--ui); text-shadow: 0 0 6px #000, 0 0 2px #000; white-space: nowrap; }
.node-label.pivot { color: var(--gold-hi); font-weight: 600; padding-left: 16px; }
.node-label.pivot:hover { color: #fff; }
.node-label.prophet { color: #fff1c4; font: 600 12.5px var(--ui); letter-spacing: .04em; }
.node-label.compiler { color: var(--gold); font: 600 12px var(--ui); letter-spacing: .04em; }
.node-label.ring { color: #8b93a3; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; background: rgba(5,7,12,.62); padding: 1px 6px; border-radius: 4px; }

/* status + loader --------------------------------------------------------- */
.status { position: fixed; left: 0; right: 0; bottom: 0; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 20px; font: 11.5px var(--mono); color: var(--muted); background: linear-gradient(0deg, rgba(6,8,14,.95), rgba(6,8,14,.4)); z-index: 6; white-space: nowrap; overflow: hidden; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.status.ready .dot { background: var(--emerald); box-shadow: 0 0 10px var(--emerald); }
.status .sep { color: var(--faint); }
#last-query { color: var(--gold); overflow: hidden; text-overflow: ellipsis; }

.loader { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; background: radial-gradient(circle at 50% 45%, rgba(6,8,14,.55), rgba(6,8,14,.92)); transition: opacity .8s ease; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; width: 340px; }
.loader .big { font-size: 64px; color: var(--gold); line-height: 1.2; text-shadow: 0 0 40px rgba(217,180,90,.45); }
.loader .bar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin: 18px 0 12px; }
.loader .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); transition: width .4s ease; box-shadow: 0 0 12px var(--gold); }
#load-text { color: var(--text); font-size: 13px; }
.loader .small { color: var(--faint); font-size: 11.5px; margin-top: 6px; }

.hidden { display: none !important; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes riseHud { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hud { animation: riseHud .35s ease both; }

@media (max-width: 900px) {
  .panel { top: auto; bottom: 40px; left: 10px; right: 10px; width: auto; height: 52vh; }
  .modes { top: 72px; }
  .modes button { padding: 6px 13px; font-size: 12.5px; white-space: nowrap; }
  .brand { top: 14px; left: 14px; }
  .hud { right: 16px; top: 120px; }
  .hud .big { font-size: 40px; }
  .legend { display: none; }
  .card { left: 10px; right: 10px; width: auto; bottom: 56vh; }
  .brand p { display: none; }
}

/* ---- decluttered panels ---------------------------------------------- */
.examples { margin-top: 8px; }
.examples > summary, .fold > summary { cursor: pointer; list-style: none; font: 600 10.5px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 4px 0; }
.examples > summary::-webkit-details-marker, .fold > summary::-webkit-details-marker { display: none; }
.examples > summary::before, .fold > summary::before { content: "▸"; display: inline-block; width: 14px; transition: transform .15s; }
.examples[open] > summary::before, .fold[open] > summary::before { transform: rotate(90deg); }
.examples > summary:hover, .fold > summary:hover { color: var(--gold-hi); }
.fold { margin-top: 10px; }
.fold .breadth { margin-top: 6px; }
.gen-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 4px 0 6px; }
.gen-note b { color: var(--gold-hi); font-weight: 600; }
.shape { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.shape b { color: var(--gold-hi); font-weight: 600; }
.hint { font-size: 12px; color: var(--faint); margin-top: -4px; }
.chip.ghost { border-style: dashed; color: var(--faint); }
.flag { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(236,91,98,.08); border: 1px solid rgba(236,91,98,.25); font-size: 12px; color: #ffc9cc; }
.flag b { color: #ff7b83; }
.ok-note { color: var(--emerald); }
.warn-note { color: #e9c27a; }
.warn-note b { color: var(--gold-hi); }
.card .grade-line { margin-top: 8px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.card .grade-line .who { color: var(--faint); font-size: 12px; }
.card .grade-line .ar { font-family: var(--ar); font-size: 16px; color: var(--text); }
.card .unsure { font-size: 10.5px; color: #e9c27a; border: 1px solid rgba(233,194,122,.4); border-radius: 4px; padding: 0 5px; cursor: help; }
.card .fold .grade { margin-top: 8px; }
.card .row:empty { display: none; }
.legend .ring-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--gold-hi); background: transparent; box-shadow: 0 0 6px rgba(243,217,142,.6); }
/* topic search: reports that share the reader's words */
.related { margin: 4px 14px 14px; }
.related > summary { cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--gold-hi); padding: 6px 0; }
.related > summary::-webkit-details-marker { display: none; }
.related > summary::before { content: "▸ "; color: var(--faint); }
.related[open] > summary::before { content: "▾ "; }
.related .note { margin-top: 0; }
.rel { display: block; width: 100%; text-align: left; margin-top: 8px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line-soft); background: rgba(255,255,255,.025); color: var(--text); font: 12.5px var(--ui); cursor: pointer; }
.rel:hover { border-color: var(--line); background: rgba(217,180,90,.06); }
.rel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rel-label { font-weight: 600; color: var(--gold-hi); }
.rel .hg { font-size: 10.5px; padding: 0 6px; }
.rel-text { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.rel-text.ar { font-family: var(--ar); font-size: 16px; text-align: right; line-height: 1.8; }

/* the honorific in one web font, so no system font draws it oversized */
.saw { font-family: "Amiri", "Noto Naskh Arabic", serif; font-weight: 400; font-size: 1.05em; line-height: 1; display: inline-block; vertical-align: -0.12em; }
/* the compiler's own note under a report */
.cnote { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.03); border-right: 2px solid var(--gold); }
.cnote .who { display: block; font-size: 11px; color: var(--faint); }
.cnote .ar { display: block; font-family: var(--ar); font-size: 16px; line-height: 1.8; color: var(--text); text-align: right; max-height: 5.4em; overflow: auto; }
.cnote .gloss { display: block; margin-top: 2px; font-size: 11.5px; color: #e9c27a; }

/* phones: smaller tower labels so the six books at the foot do not collide */
@media (max-width: 900px) {
  .node-label.compiler { font-size: 9.5px; letter-spacing: .02em; }
  .node-label.ring { font-size: 9px; letter-spacing: .08em; padding: 0 4px; }
  .node-label.pivot { font-size: 10px; }
}

/* several named graders on one report */
.hgrade { align-items: center; }
.hgrade .hg-by { min-width: 104px; color: var(--muted); }
.hg .ar { font-family: var(--ar); font-size: 14px; line-height: 1.2; }
.differ { display: inline-block; margin-bottom: 6px; font: 600 11px var(--ui); letter-spacing: .06em; text-transform: uppercase; color: #e9c27a; border: 1px solid rgba(233,194,122,.45); border-radius: 999px; padding: 2px 9px; }
.why { flex-basis: 100%; margin: 2px 0 2px 112px; }
.why > summary { cursor: pointer; font-size: 11px; color: var(--faint); list-style: none; }
.why > summary::-webkit-details-marker { display: none; }
.why > summary::before { content: "▸ "; }
.why[open] > summary::before { content: "▾ "; }
.why .ar { display: block; font-family: var(--ar); font-size: 15px; line-height: 1.8; color: var(--muted); text-align: right; }
@media (max-width: 900px) { .hgrade .hg-by { min-width: 0; } .why { margin-left: 0; } }

/* ---- one grade card for every scholar ------------------------------- */
.gcard { margin-top: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.02); overflow: hidden; }
.gcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft);
  font: 600 10.5px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.gdiffer { font: 600 10.5px var(--ui); letter-spacing: .04em; text-transform: none; color: #e9c27a; border: 1px solid rgba(233,194,122,.45); border-radius: 999px; padding: 1px 8px; }
.grow { display: grid; grid-template-columns: 10px minmax(92px, 34%) 1fr 18px; align-items: center; gap: 4px 10px; padding: 9px 12px; }
.grow + .grow { border-top: 1px solid rgba(255,255,255,.04); }
.gdot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 8px currentColor; color: var(--faint); }
.gdot.sahih { background: var(--emerald); color: var(--emerald); }
.gdot.hasan { background: var(--teal); color: var(--teal); }
.gdot.daif { background: var(--amber); color: var(--amber); }
.gdot.mawdu { background: var(--crimson); color: var(--crimson); }
.gdot.note { background: var(--gold); color: var(--gold); }
.gwho { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.25; }
.gwho small { display: block; font-weight: 400; font-size: 10.5px; color: var(--faint); }
.gval { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 2px 8px; text-align: right; min-width: 0; }
.gval b { font-weight: 600; font-size: 13px; }
.gval .ar { font-family: var(--ar); font-size: 17px; line-height: 1.5; }
.gval em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.gval.sahih b, .gval.sahih .ar { color: var(--emerald); }
.gval.hasan b, .gval.hasan .ar { color: var(--teal); }
.gval.daif b, .gval.daif .ar { color: var(--amber); }
.gval.mawdu b, .gval.mawdu .ar { color: var(--crimson); }
.gval.note .ar { color: var(--text); font-size: 15.5px; }
.gval.other b, .gval.other .ar { color: var(--text); }
.glink { color: var(--faint); font-size: 13px; text-align: right; text-decoration: none; }
.glink:hover { color: var(--gold-hi); text-decoration: none; }
.gwhy { grid-column: 2 / -1; }
.gwhy > summary { cursor: pointer; list-style: none; font-size: 11px; color: var(--faint); }
.gwhy > summary::-webkit-details-marker { display: none; }
.gwhy > summary::before { content: "▸ "; }
.gwhy[open] > summary::before { content: "▾ "; }
.gwhy .ar { display: block; margin-top: 4px; font-family: var(--ar); font-size: 15px; line-height: 1.8; color: var(--muted); text-align: right; }
.gnone { padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.gcard-foot { padding: 7px 12px 9px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--faint); }
.card .gcard { margin-top: 10px; }
@media (max-width: 900px) { .grow { grid-template-columns: 10px 1fr 18px; } .gval { grid-column: 2 / -1; justify-content: flex-start; text-align: left; } }

.gblock { grid-column: 2 / -1; font-family: var(--ar); font-size: 15.5px; line-height: 1.8; color: var(--text); text-align: right; cursor: pointer; }
.gclamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gclamp.open { display: block; }
.gclamp:not(.open) { mask-image: linear-gradient(#000 60%, transparent); -webkit-mask-image: linear-gradient(#000 60%, transparent); }

/* ---- pick one scholar ------------------------------------------------- */
.gcard [hidden] { display: none !important; }
.gpick-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.gpick-bar > span { font: 600 10.5px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.gpick { flex: 1; min-width: 0; appearance: none; -webkit-appearance: none; padding: 6px 30px 6px 10px; border-radius: 8px;
  border: 1px solid var(--line-soft); color: var(--text); font: 500 12.5px var(--ui); cursor: pointer;
  background: rgba(255,255,255,.03) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23c9a24a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.gpick:hover, .gpick:focus { border-color: var(--gold); outline: none; }
.gpick option { background: #14161c; color: var(--text); }
.gwhy .en { display: block; margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.gcard > .gnone[data-by] { border-top: 1px solid rgba(255,255,255,.04); }
