/* =========================================================================
   VeriTaS Gold Evidence Viewer - design system
   One accent, one neutral ramp, four semantic colours. Everything else is
   spacing and motion.
   ========================================================================= */

:root {
    color-scheme: light;

    /* Neutrals */
    --bg: #f6f7fb;
    --bg-grad: radial-gradient(1200px 600px at 15% -10%, #eef1ff 0%, transparent 60%),
               radial-gradient(1000px 500px at 100% 0%, #f2fbff 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #f2f4f9;
    --surface-3: #e8ebf3;
    --border: #e2e6ef;
    --border-strong: #cdd3e1;
    --text: #171a21;
    --text-soft: #4a5165;
    --muted: #7b829a;

    /* Accent + semantics */
    --accent: #5b5bd6;
    --accent-hover: #4a4ac4;
    --accent-soft: #ecebff;
    /* Value colours. These are the VeriTaS plotting palette from
       `scripts/stats/common.py`, so a chart in the UI and a figure in the paper
       speak the same language. The `*-ink` variants are the same hues darkened
       (or lightened, in dark mode) to stay legible as text; the base values are
       used for fills - bars, dots, swatches, chart marks. */
    --ok: #09C479;            /* common.py: positive */
    --ok-ink: #05784a;
    --ok-soft: color-mix(in srgb, var(--ok) 14%, var(--surface));
    --bad: #E03440;           /* common.py: negative */
    --bad-ink: #b21f29;
    --bad-soft: color-mix(in srgb, var(--bad) 13%, var(--surface));
    --neutral: #a1a1a1;       /* common.py: neutral */
    --neutral-ink: #6a6a6a;
    --neutral-soft: color-mix(in srgb, var(--neutral) 16%, var(--surface));
    --warn: #F5A300;          /* common.py: light_orange (TUDa secondary) */
    --warn-ink: #8f6000;
    --warn-soft: color-mix(in srgb, var(--warn) 16%, var(--surface));
    --info: #0083CC;          /* common.py: blue (TUDa quaternary) */
    --info-ink: #00628f;
    --info-soft: color-mix(in srgb, var(--info) 12%, var(--surface));
    --tuda-orange: #EC6500;   /* common.py: orange (TUDa primary) */
    --tuda-darkblue: #004E73; /* common.py: darkblue (TUDa tertiary) */
    --violet: #8b5cf6;
    --violet-ink: #6d3fe0;
    --violet-soft: #f2ecff;

    /* Shape + motion */
    --radius: 14px;
    --radius-sm: 9px;
    --radius-lg: 20px;
    --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 8px 24px -12px rgba(20, 24, 40, .16);
    --shadow-lg: 0 2px 6px rgba(20, 24, 40, .06), 0 24px 48px -20px rgba(20, 24, 40, .28);
    --ease: cubic-bezier(.22, .61, .36, 1);
    --fast: 140ms var(--ease);
    --base: 260ms var(--ease);
    --slow: 620ms var(--ease);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0d0f16;
    --bg-grad: radial-gradient(1200px 600px at 15% -10%, #191c33 0%, transparent 60%),
               radial-gradient(1000px 500px at 100% 0%, #0f2130 0%, transparent 55%);
    --surface: #14171f;
    --surface-2: #1a1e28;
    --surface-3: #232833;
    --border: #262b37;
    --border-strong: #363d4d;
    --text: #eef0f6;
    --text-soft: #b6bccc;
    --muted: #838b9f;

    --accent: #8b8bf0;
    --accent-hover: #a0a0f7;
    --accent-soft: #21213f;
    /* The same palette hues; only the text variants are re-tuned for contrast
       on a dark ground, and the soft tints are mixed into the dark surface. */
    --ok: #09C479;
    --ok-ink: #3ce5a2;
    --ok-soft: color-mix(in srgb, var(--ok) 20%, var(--surface));
    --bad: #E03440;
    --bad-ink: #ff7b84;
    --bad-soft: color-mix(in srgb, var(--bad) 22%, var(--surface));
    --neutral: #a1a1a1;
    --neutral-ink: #b5b5b5;
    --neutral-soft: color-mix(in srgb, var(--neutral) 18%, var(--surface));
    --warn: #F5A300;
    --warn-ink: #ffc248;
    --warn-soft: color-mix(in srgb, var(--warn) 20%, var(--surface));
    --info: #0083CC;
    --info-ink: #57c4f5;
    --info-soft: color-mix(in srgb, var(--info) 24%, var(--surface));
    --tuda-orange: #EC6500;
    --tuda-darkblue: #4a9ec2;
    --violet: #b18cff;
    --violet-ink: #c4a6ff;
    --violet-soft: #251a3d;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 30px 60px -24px rgba(0, 0, 0, .8);
}

/* ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

/* Several bodies below set `display: grid`, which outranks the user agent's
   `[hidden] { display: none }`. Collapsing relies on the attribute, so make it
   win everywhere. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--base), color var(--base);
}

a { color: var(--accent); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .7em; }

code, pre, .mono { font-family: var(--mono); font-size: .84em; }

::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong); border-radius: 99px;
    border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   Layout
   ========================================================================= */

.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 18px;
    padding: 12px clamp(16px, 4vw, 40px);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 660; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand .mark {
    width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--accent), var(--violet));
    color: #fff; font-size: .95rem;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: transform var(--base);
}
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
.brand .name { color: var(--text); font-size: 1rem; }
.brand .sub { color: var(--muted); font-size: .72rem; font-weight: 500; display: block; margin-top: -3px; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 99px;
    color: var(--text-soft); font-weight: 540; font-size: .9rem;
    transition: background var(--fast), color var(--fast);
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.topbar-spacer { flex: 1; }

.icon-btn {
    width: 36px; height: 36px; display: grid; place-items: center;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text-soft); cursor: pointer;
    transition: transform var(--fast), background var(--fast), color var(--fast), border-color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(.96); }

.health {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .78rem; color: var(--muted);
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
    background: var(--surface);
}
.health .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--muted); }
.health.ok .dot { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2.4s infinite; }
.health.down .dot { background: var(--bad); }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
    70%  { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 72px; }

.page-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { color: var(--accent); font-size: .75rem; font-weight: 640; letter-spacing: .09em; text-transform: uppercase; }
.page-head .lede { color: var(--muted); max-width: 62ch; margin: 4px 0 0; }
.page-head .spacer { flex: 1; }

footer {
    border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem;
    padding: 18px clamp(16px, 4vw, 40px); display: flex; gap: 14px; flex-wrap: wrap;
}

/* =========================================================================
   Motion
   ========================================================================= */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shimmer { 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.rise { animation: rise 460ms var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.fade { animation: fade 320ms var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =========================================================================
   Cards & surfaces
   ========================================================================= */

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: box-shadow var(--base), border-color var(--base), transform var(--base);
}
.card.pad { padding: 18px 20px; }
.card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { flex: 1; }
.card-head .hint { color: var(--muted); font-size: .78rem; font-weight: 500; }
.card-body { padding: 16px 18px; }

.grid { display: grid; gap: 16px; align-items: start; }
.grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.section { margin-top: 30px; }
.section > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section > h2 i { color: var(--accent); font-size: .95em; }
.section > h2 .hint { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 500; }

/* Stat tiles */
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
    transition: transform var(--base), box-shadow var(--base);
}
.stat::after {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
    background: var(--tone, var(--accent)); opacity: .85;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat .label { color: var(--muted); font-size: .78rem; font-weight: 560; letter-spacing: .02em; display: flex; align-items: center; gap: 7px; }
.stat .label i { color: var(--tone, var(--accent)); }
.stat .value { font-size: 1.85rem; font-weight: 680; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .5em; font-weight: 560; color: var(--muted); margin-left: 4px; }
.stat .foot { color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* =========================================================================
   Chips, badges, pills
   ========================================================================= */

.badge {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 3px 10px; border-radius: 99px;
    font-size: .74rem; font-weight: 600; letter-spacing: .01em;
    background: var(--surface-2); color: var(--text-soft);
    border: 1px solid transparent;
}
.badge i { font-size: .85em; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok     { background: var(--ok-soft);     color: var(--ok-ink); }
.badge.warn   { background: var(--warn-soft);   color: var(--warn-ink); }
.badge.bad    { background: var(--bad-soft);    color: var(--bad-ink); }
.badge.info   { background: var(--info-soft);   color: var(--info-ink); }
.badge.violet { background: var(--violet-soft); color: var(--violet-ink); }
.badge.plain  { background: transparent; border-color: var(--border); color: var(--neutral-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.pill-group { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 3px; gap: 2px; }
.pill-group button {
    border: 0; background: transparent; color: var(--text-soft); cursor: pointer;
    padding: 6px 14px; border-radius: 99px; font: inherit; font-size: .85rem; font-weight: 560;
    transition: background var(--fast), color var(--fast);
}
.pill-group button:hover { color: var(--text); }
.pill-group button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* =========================================================================
   Forms
   ========================================================================= */

input[type="text"], input[type="search"], input[type="date"], select {
    font: inherit; font-size: .9rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
    transition: border-color var(--fast), box-shadow var(--fast);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
select { cursor: pointer; }

.search {
    position: relative; flex: 1 1 260px; min-width: 200px;
}
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.search input { width: 100%; padding-left: 34px; }

.toolbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-size: .88rem; font-weight: 560; cursor: pointer;
    padding: 8px 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
    transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast);
}
.btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* =========================================================================
   Claim list
   ========================================================================= */

.claim-list { display: grid; gap: 12px; }

.claim-card {
    display: block; padding: 16px 18px; color: inherit;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform var(--base), box-shadow var(--base), border-color var(--base);
}
.claim-card:hover {
    text-decoration: none; transform: translateY(-2px);
    border-color: var(--border-strong); box-shadow: var(--shadow-lg);
}
.claim-card .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.claim-card .id { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.claim-card .text {
    margin: 9px 0 11px; color: var(--text); line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.claim-card .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.claim-card .meta span { display: inline-flex; align-items: center; gap: 6px; }

.evidence-bar { display: flex; height: 5px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
.evidence-bar > span { display: block; transform-origin: left; animation: grow-x 700ms var(--ease) both; }
.evidence-bar .adm { background: var(--ok); }
.evidence-bar .inadm { background: var(--bad); opacity: .55; }
.evidence-bar .pend { background: var(--warn); opacity: .5; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; color: var(--muted); font-size: .85rem; }

/* =========================================================================
   Claim detail
   ========================================================================= */

.detail-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.detail-head .titles { flex: 1 1 380px; }

.claim-quote {
    position: relative; padding: 20px 22px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    font-size: 1.02rem; line-height: 1.68;
}
.claim-quote::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
    border-radius: 99px; background: linear-gradient(var(--accent), var(--violet));
}

.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 18px; align-items: baseline; }
.kv dt { color: var(--muted); font-size: .8rem; font-weight: 560; }
.kv dd { margin: 0; font-size: .9rem; word-break: break-word; }

/* Timeline */
.timeline { padding: 26px 22px 16px; }
.timeline-track { position: relative; height: 74px; }
.timeline-line {
    position: absolute; left: 0; right: 0; top: 38px; height: 3px;
    border-radius: 99px; background: var(--surface-3);
}
.timeline-window {
    position: absolute; top: 30px; height: 19px; border-radius: 6px;
    background: color-mix(in srgb, var(--warn) 20%, transparent);
    border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent);
    animation: fade var(--slow) both;
}
.timeline-marker { position: absolute; top: 22px; width: 2px; height: 35px; background: var(--accent); }
.timeline-marker::after {
    content: attr(data-label); position: absolute; top: -19px; left: 50%; transform: translateX(-50%);
    font-size: .68rem; font-weight: 700; color: var(--accent); white-space: nowrap;
    font-family: var(--mono);
}
.timeline-marker.tf { background: var(--violet); }
.timeline-marker.tf::after { color: var(--violet-ink); }
.timeline-dot {
    position: absolute; top: 33px; width: 13px; height: 13px; margin-left: -6.5px;
    border-radius: 99px; border: 2px solid var(--surface); cursor: pointer;
    background: var(--muted); transition: transform var(--fast), box-shadow var(--fast);
    animation: rise 420ms var(--ease) both;
}
.timeline-dot:hover, .timeline-dot.hot { transform: scale(1.55); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); z-index: 3; }
.timeline-dot.before_claim { background: var(--ok); }
.timeline-dot.in_window { background: var(--warn); }
.timeline-dot.after_fact_check { background: var(--bad); }
.timeline-dot.inadmissible { opacity: .42; }
.timeline-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .78rem; margin-top: 6px; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 7px; }
.timeline-legend i { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }

/* =========================================================================
   Evidence cards
   ========================================================================= */

.evidence-list { display: grid; gap: 14px; }

.evidence {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    transition: border-color var(--base), box-shadow var(--base);
    scroll-margin-top: 90px;
}
.evidence.hot { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-lg); }
.evidence[data-admissible="false"] { border-left: 3px solid var(--bad); }
.evidence[data-admissible="true"] { border-left: 3px solid var(--ok); }
.evidence[data-admissible="null"] { border-left: 3px solid var(--warn); }

.evidence-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 16px 0; }
.evidence-head .eid { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.evidence-head .spacer { flex: 1; }

.proposition {
    padding: 12px 16px 4px; font-size: 1rem; line-height: 1.7;
}
.proposition .seg-text { white-space: pre-wrap; }

.evidence-source {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 10px 16px 0; padding: 10px 12px;
    background: var(--surface-2); border-radius: var(--radius-sm); font-size: .84rem;
}
.evidence-source .name { font-weight: 600; }
.evidence-source .locator { color: var(--muted); word-break: break-all; }
.evidence-source .spacer { flex: 1; }

.evidence-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px; color: var(--text-soft); font-size: .82rem; }
.evidence-facts span { display: inline-flex; align-items: center; gap: 7px; }
.evidence-facts i { color: var(--muted); }

.evidence-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 14px; }

/* Media reference chips */
.ref {
    display: inline-flex; align-items: center; gap: 5px; vertical-align: baseline;
    padding: 1px 8px; margin: 0 1px; border-radius: 7px; cursor: pointer;
    font-family: var(--mono); font-size: .78em; font-weight: 600;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    transition: background var(--fast), transform var(--fast), box-shadow var(--fast);
}
.ref:hover, .ref.hot {
    background: var(--accent); color: #fff; transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent);
}
.ref.missing { background: var(--bad-soft); color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.ref.missing:hover, .ref.missing.hot { background: var(--bad); color: #fff; }

/* Media gallery */
.media-gallery {
    display: flex; flex-wrap: wrap; gap: 12px;
    padding: 8px 16px 4px;
}
.media-figure {
    margin: 0; width: 190px; border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border); background: var(--surface-2);
    transition: transform var(--base), box-shadow var(--base), border-color var(--base);
    animation: rise 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.media-figure:hover, .media-figure.hot {
    transform: translateY(-3px) scale(1.015);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow-lg);
}
.media-figure .frame {
    position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
    background: var(--surface-3); overflow: hidden;
}
.media-figure img, .media-figure video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-figure video { background: #000; }
.media-figure .missing-note {
    position: absolute; inset: 0; display: grid; place-items: center; gap: 6px;
    color: var(--muted); font-size: .78rem; text-align: center; padding: 10px;
}
/* Reference, size and source link: over the top of the frame, on hover only. */
.media-figure .media-info {
    position: absolute; inset: 0 0 auto 0; z-index: 2;
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px 14px; font-family: var(--mono); font-size: .7rem; color: #fff;
    background: linear-gradient(rgba(5, 7, 13, .72), transparent);
    opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity var(--fast), transform var(--fast);
}
.media-figure:hover .media-info, .media-figure:focus-within .media-info {
    opacity: 1; transform: none; pointer-events: auto;
}
.media-figure .media-info .size { opacity: .75; white-space: nowrap; }
.media-figure .media-info .ref-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.media-figure .media-action {
    display: grid; place-items: center; width: 24px; height: 24px; flex: none;
    border: 0; border-radius: 6px; cursor: pointer;
    background: rgba(255, 255, 255, .18); color: #fff; font-size: .7rem;
    transition: background var(--fast);
}
.media-figure .media-action:hover { background: var(--accent); color: #fff; text-decoration: none; }
.media-figure.wide { width: 100%; max-width: 460px; }
.media-figure.wide .frame { aspect-ratio: 16 / 9; }
.media-figure.wide video, .media-figure.wide img { object-fit: contain; }

/* =========================================================================
   Evidence browser
   ========================================================================= */

/* The second toolbar row holds the narrower facets; it reads as a continuation
   of the first, so it sits closer and its controls are a touch smaller. */
.toolbar.filters { margin-top: -8px; font-size: .86rem; }
.toolbar.filters select { font-size: .86rem; }

.evidence-card { transition: transform var(--base), box-shadow var(--base), border-color var(--base); }
.evidence-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

/* The claim an item was reconstructed for: context, not the subject of the
   card, so it is set apart at the foot rather than competing with the
   proposition. */
.evidence-claim {
    display: block; margin: 4px 16px 14px; padding: 10px 12px;
    background: var(--surface-2); border-radius: var(--radius-sm);
    color: var(--muted); font-size: .82rem;
}
.evidence-claim:hover { text-decoration: none; background: var(--surface-3); color: var(--text-soft); }
.evidence-claim .label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-soft); }
.evidence-claim .label .when { margin-left: auto; font-weight: 500; color: var(--muted); }
.evidence-claim .text {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin-top: 5px; line-height: 1.5;
}

/* =========================================================================
   Disclosure sections
   ========================================================================= */

details.disclose { border-top: 1px solid var(--border); }
details.disclose > summary {
    display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
    padding: 11px 16px; color: var(--text-soft); font-size: .85rem; font-weight: 560;
    transition: background var(--fast), color var(--fast);
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary:hover { background: var(--surface-2); color: var(--text); }
details.disclose > summary .chev { margin-left: auto; color: var(--muted); transition: transform var(--base); }
details.disclose[open] > summary .chev { transform: rotate(90deg); }
details.disclose > summary i.lead { color: var(--accent); width: 15px; text-align: center; }
details.disclose > .content { padding: 4px 16px 16px; animation: rise 320ms var(--ease) both; }

.prose { color: var(--text-soft); font-size: .9rem; line-height: 1.72; white-space: pre-wrap; }
.prose.reasoning {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: 12px 14px; border-left: 2px solid var(--border-strong);
    max-height: 340px; overflow: auto;
}

.raw-json {
    font-family: var(--mono); font-size: .78rem; line-height: 1.6;
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: 12px 14px; max-height: 460px; overflow: auto; white-space: pre;
}
.raw-json .k { color: var(--violet-ink); }
.raw-json .s { color: var(--ok-ink); }
.raw-json .n { color: var(--info-ink); }
.raw-json .b { color: var(--warn-ink); }
.raw-json .z { color: var(--muted); }

/* Field table for the "all stored fields" inspector */
.fields { width: 100%; border-collapse: collapse; font-size: .84rem; }
.fields td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.fields tr:last-child td { border-bottom: 0; }
.fields td.key { color: var(--muted); font-family: var(--mono); font-size: .78rem; width: 34%; white-space: nowrap; }
.fields td.val { word-break: break-word; }
.fields tr:hover td { background: var(--surface-2); }

/* =========================================================================
   Charts
   ========================================================================= */

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr max-content; gap: 12px; align-items: center; }
.bar-row .lbl { color: var(--text-soft); font-size: .83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-row .fill {
    display: block; height: 100%; border-radius: 99px; background: var(--tone, var(--accent));
    transform-origin: left; animation: grow-x 720ms var(--ease) both;
    animation-delay: calc(var(--i, 0) * 55ms);
}
.bar-row .num { font-family: var(--mono); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-row:hover .lbl { color: var(--text); }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut circle { fill: none; stroke-width: 15; transition: stroke-width var(--fast); }
.donut circle:hover { stroke-width: 18; }
.donut-legend { display: grid; gap: 7px; flex: 1; min-width: 160px; }
.donut-legend .item { display: flex; align-items: center; gap: 9px; font-size: .84rem; }
.donut-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .name { color: var(--text-soft); flex: 1; }
.donut-legend .val { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

.spark { width: 100%; height: 120px; overflow: visible; }
.spark .axis { stroke: var(--border); stroke-width: 1; }
.spark .col { fill: var(--tone, var(--accent)); opacity: .85; transition: opacity var(--fast); }
.spark .col:hover { opacity: 1; }
.spark .zero { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 3 3; }
.spark .tick { fill: var(--muted); font-size: 9px; font-family: var(--mono); }

.matrix { display: grid; grid-template-columns: max-content 1fr 1fr; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.matrix > div { background: var(--surface); padding: 11px 13px; font-size: .85rem; }
.matrix .h { background: var(--surface-2); color: var(--muted); font-size: .76rem; font-weight: 600; }
.matrix .cell { font-family: var(--mono); font-size: 1.05rem; font-weight: 600; }
.matrix .cell.hi { color: var(--ok-ink); }
.matrix .cell.lo { color: var(--muted); }

/* =========================================================================
   Feedback states
   ========================================================================= */

.skeleton {
    border-radius: var(--radius); min-height: 90px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 200% 100%; animation: shimmer 1.35s infinite linear;
}
.skeleton-grid { display: grid; gap: 14px; }

.empty, .error {
    display: grid; place-items: center; gap: 10px; text-align: center;
    padding: 56px 24px; color: var(--muted);
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty i, .error i { font-size: 1.9rem; opacity: .6; }
.error { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.error code { color: inherit; }

.spinner { display: inline-block; width: 15px; height: 15px; border-radius: 99px;
    border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }

.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 99px;
    font-size: .85rem; box-shadow: var(--shadow-lg); z-index: 90; animation: rise 260ms var(--ease) both;
}

/* Lightbox for full-size media */
.lightbox {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
    background: color-mix(in srgb, #05070d 78%, transparent);
    backdrop-filter: blur(6px); animation: fade 200ms var(--ease) both; padding: 32px;
}
.lightbox .stage { display: grid; place-items: center; width: 100%; height: 100%; }
.lightbox img, .lightbox video { max-width: 84vw; max-height: 82vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: fade 200ms var(--ease) both; }
.lightbox .nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 99px; border: 0; cursor: pointer;
    display: grid; place-items: center; font-size: 1.05rem;
    background: rgba(255, 255, 255, .12); color: #e8ecf6;
    transition: background var(--fast), transform var(--fast);
}
.lightbox .nav-btn:hover { background: rgba(255, 255, 255, .26); transform: translateY(-50%) scale(1.06); }
.lightbox .nav-btn.prev { left: 22px; }
.lightbox .nav-btn.next { right: 22px; }
.lightbox .counter { position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
    color: #e8ecf6; font-family: var(--mono); font-size: .8rem; opacity: .8; }
.lightbox .caption { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap;
    color: #e8ecf6; font-family: var(--mono); font-size: .82rem; display: flex; gap: 14px; align-items: center; }
.lightbox .close { position: absolute; top: 20px; right: 24px; color: #e8ecf6; font-size: 1.4rem; cursor: pointer; }

@media (max-width: 720px) {
    .topbar { gap: 10px; }
    .brand .sub { display: none; }
    .brand .name { white-space: nowrap; }
    .nav a span { display: none; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 8px; }
    .bar-row { grid-template-columns: minmax(70px, 38%) 1fr max-content; }
}

/* =========================================================================
   Multimodal text
   ========================================================================= */

.multimodal { display: block; }
.rich-text { white-space: pre-wrap; line-height: 1.7; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* =========================================================================
   MathJax
   ========================================================================= */

/* Until MathJax renders it, a math span shows its plain-text fallback; give
   both forms the same rhythm so nothing jumps when typesetting completes. */
.math { white-space: nowrap; font-family: var(--mono); font-size: .94em; }
.math mjx-container { font-family: inherit; }
mjx-container[jax="CHTML"] { line-height: inherit; }
mjx-container[jax="CHTML"][display="true"] { margin: 0; }
.card-head .math, .stat .foot .math, .chart-note .math { font-size: .96em; }

/* =========================================================================
   Axes and chart frames
   ========================================================================= */

.chart { width: 100%; }
.histogram { width: 100%; height: auto; overflow: visible; }
.histogram .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.histogram .axis { stroke: var(--border-strong); stroke-width: 1; }
.histogram .zero { stroke: var(--text-soft); stroke-width: 1.5; stroke-dasharray: 4 3; }
.histogram .col { transition: opacity var(--fast); }
.histogram .col:hover { opacity: .75; }
.histogram .tick { fill: var(--muted); font-size: 9.5px; font-family: var(--mono); }
.histogram .axis-title { fill: var(--muted); font-size: 9.5px; letter-spacing: .04em; }

.chart-note {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    color: var(--muted); font-size: .78rem; margin-top: 4px;
}
.chart-note span { display: inline-flex; align-items: center; gap: 7px; }
.chart-note .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.hist-panel { display: grid; gap: 14px; }
.hist-summary { border-top: 1px solid var(--border); padding-top: 12px; }
.hist-summary .kv { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 20px; }

.sub-label { color: var(--muted); font-size: .78rem; font-weight: 560; margin-bottom: 6px; }

.note { color: var(--muted); font-size: .8rem; margin: 10px 0 0; line-height: 1.6; }
.note code { color: var(--text-soft); }
.warn-note { color: var(--warn-ink); display: flex; gap: 8px; align-items: flex-start; }

.scroll-y { max-height: 320px; overflow-y: auto; padding-right: 4px; }

/* =========================================================================
   Horizontal stacked bars
   ========================================================================= */

.stack-rows { display: grid; gap: 6px; }
.stack-row {
    display: grid; grid-template-columns: minmax(78px, max-content) 1fr max-content;
    gap: 12px; align-items: center;
    animation: rise 380ms var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms);
}
.stack-row .lbl { color: var(--text-soft); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }
.stack-row .num { font-family: var(--mono); font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stack-row:hover .lbl { color: var(--text); }
.stack-track {
    display: flex; height: 12px; border-radius: 99px; overflow: hidden;
    background: var(--surface-3);
}
.stack-seg {
    display: block; height: 100%; transform-origin: left;
    animation: grow-x 560ms var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms);
    transition: filter var(--fast);
}
.stack-seg:hover { filter: brightness(1.15); }

/* =========================================================================
   Reconstruction funnel
   ========================================================================= */

.funnel { display: grid; gap: 7px; }
.funnel-stage {
    display: grid; grid-template-columns: minmax(150px, 28%) 1fr max-content 52px;
    gap: 14px; align-items: center;
    animation: rise 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
}
.funnel-stage .lbl { color: var(--text-soft); font-size: .84rem; }
.funnel-stage.terminal .lbl { color: var(--text); font-weight: 600; }
.funnel-track {
    position: relative; display: flex; height: 22px;
    border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3);
}
.funnel-fill {
    display: block; height: 100%; transform-origin: left;
    animation: grow-x 640ms var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
    transition: filter var(--fast);
}
.funnel-fill:hover { filter: brightness(1.12); }
.funnel-loss {
    display: block; height: 100%;
    background: repeating-linear-gradient(
        135deg, color-mix(in srgb, var(--bad) 42%, transparent) 0 5px,
        transparent 5px 10px);
    border-left: 1px solid color-mix(in srgb, var(--bad) 55%, transparent);
}
.funnel-stage .num { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.funnel-stage .num strong { font-family: var(--mono); font-size: .92rem; font-variant-numeric: tabular-nums; }
.funnel-stage .num small { color: var(--muted); font-size: .7rem; }
.funnel-stage .drop {
    font-family: var(--mono); font-size: .76rem; color: var(--bad-ink); text-align: right;
}
.funnel-stage .drop.none { color: var(--muted); opacity: .45; }

@media (max-width: 720px) {
    .funnel-stage { grid-template-columns: 1fr max-content; gap: 6px 10px; }
    .funnel-stage .funnel-track { grid-column: 1 / -1; }
    .funnel-stage .drop { display: none; }
}

/* =========================================================================
   Media strip (list previews)
   ========================================================================= */

.media-strip { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 11px; }
.media-thumb {
    width: 58px; height: 44px; flex: none; border-radius: 7px; overflow: hidden;
    display: grid; place-items: center;
    background: var(--surface-3); border: 1px solid var(--border);
    color: var(--muted); font-size: .82rem;
    animation: rise 380ms var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
    transition: border-color var(--base), transform var(--base);
}
.claim-card:hover .media-thumb, .evidence-card:hover .media-thumb { border-color: var(--border-strong); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb.video { position: relative; }
.media-thumb video {
    width: 100%; height: 100%; object-fit: cover; display: block;
    pointer-events: none;  /* the card is the link; the preview is not a player */
}
.media-thumb.video i {
    position: absolute; font-size: .7rem; color: #fff;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, .75));
}
.media-thumb.missing { color: var(--bad-ink); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.media-thumb.more {
    font-family: var(--mono); font-size: .74rem; font-weight: 600;
    color: var(--text-soft); background: var(--surface-2);
}

/* One source inside its evidence item. The left rule carries the source's own
   admissibility, so a lost source is visible without hiding that the item it
   belongs to may well have survived through another one. */
.evidence-source-block {
    margin: 12px 16px 0;
    border-left: 3px solid var(--neutral);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.evidence-source-block[data-admissible="true"] { border-left-color: var(--ok); }
.evidence-source-block[data-admissible="false"] { border-left-color: var(--bad); }
.evidence-source-block .evidence-source { margin: 0; background: transparent; }
.evidence-source-block .evidence-facts { padding: 4px 12px 10px; }
.evidence-source-block .evidence-foot { padding: 0 12px 12px; }

/* =========================================================================
   Collapsible cards
   ========================================================================= */

.collapsible { overflow: hidden; transition: background var(--fast); }

/* Closed, the card *is* the button: the whole surface reacts and the cursor
   says so everywhere, including over its text. `cursor` inherits, so this
   reaches the proposition without having to enumerate what is inside it. */
.collapsible:not(.open) { cursor: pointer; }
.collapsible:not(.open):hover { background: var(--surface-2); }

/* Open, only the header folds it away again; the body is ordinary content, with
   the ordinary cursor and selectable text. */
.collapsible.open > .collapsible-head:hover { background: var(--surface-2); }

.collapsible-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 13px 16px; cursor: pointer; user-select: none;
    transition: background var(--fast);
}
.collapsible-head:focus-visible { outline: none; background: var(--surface-2); }
.collapsible-head .chev {
    margin-left: auto; color: var(--muted); font-size: .8rem; padding-left: 4px;
    transition: transform var(--base), color var(--fast);
}
.collapsible.open > .collapsible-head .chev { transform: rotate(90deg); color: var(--accent); }
.collapsible-head .preview {
    color: var(--muted); font-size: .82rem; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 46ch; min-width: 0;
}
.collapsible-head .name { font-weight: 600; font-size: .86rem; }
.collapsible-head .kind { color: var(--accent); }
/* A nested card has its own highlight, so the card around it must not light up
   at the same time. */
.collapsible:not(.open):has(.collapsible:hover) { background: transparent; }

/* The body animates from a zero-height grid row to its own height, so nothing
   has to be measured - which matters because bodies are filled in lazily. */
.collapsible-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--base);
}
.collapsible.open > .collapsible-body { grid-template-rows: 1fr; }
.collapsible-clip { overflow: hidden; min-height: 0; padding: 0; }
/* Once the row has settled, let tooltips and scroll areas out of the clip. */
.collapsible-body[data-settled] > .collapsible-clip { overflow: visible; }

.collapsible:not(.open) input,
.collapsible:not(.open) textarea,
.collapsible:not(.open) select { cursor: auto; }

.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.small i { font-size: .74rem; }

.loading-row {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px; color: var(--muted); font-size: .85rem;
}

/* --- evidence item ---------------------------------------------------- */

/* The proposition sits between header and body, so a collapsed card still says
   what it asserts. */
.evidence > .collapsible-head { padding-bottom: 6px; }
.evidence-tags { display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.evidence .proposition { padding: 2px 16px 14px; }
.evidence .media-gallery { padding: 0 16px 14px; }
.evidence-body { display: grid; gap: 2px; padding-bottom: 6px; }
.evidence-body > .evidence-facts {
    border-top: 1px solid var(--border); margin: 0 16px; padding: 11px 0;
}

.source-head {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px 8px; color: var(--muted);
    font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.source-head i { color: var(--accent); }

/* Two columns of sources inside one evidence item, one when there is no room. */
.source-grid {
    display: grid; gap: 12px; padding: 0 16px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}
@media (max-width: 1020px) {
    .source-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- source card ------------------------------------------------------- */

.evidence-source-card { background: var(--surface-2); min-width: 0; }
.evidence-source-card[data-admissible="true"]  { border-left: 3px solid var(--ok); }
.evidence-source-card[data-admissible="false"] { border-left: 3px solid var(--bad); }
.evidence-source-card[data-admissible="null"]  { border-left: 3px solid var(--warn); }
.evidence-source-card > .collapsible-head { padding: 11px 14px; }
.evidence-source-card .card-body { padding: 2px 14px 14px; display: grid; gap: 11px; }
.evidence-source-card .evidence-facts { padding: 0; gap: 7px 16px; }
.evidence-source-card details.disclose > summary { padding: 9px 0; }
.evidence-source-card details.disclose > .content { padding: 2px 0 12px; }
.evidence-source-card .locator { font-size: .8rem; }

/* The locator as a button: it is the one thing a reader acts on most. */
.btn.source-link {
    justify-content: flex-start; gap: 9px; width: 100%; min-width: 0;
    padding: 9px 12px; font-size: .84rem;
    background: var(--surface); border-color: var(--border-strong);
}
.btn.source-link:hover {
    border-color: var(--accent); color: var(--accent);
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.btn.source-link i { color: var(--accent); flex: none; }
.btn.source-link .host { font-weight: 600; flex: none; }
.btn.source-link .path {
    color: var(--muted); font-family: var(--mono); font-size: .74rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* The passage of a source that implies the proposition, verbatim. */
.source-quote {
    display: flex; gap: 10px; align-items: flex-start;
    margin: 10px 0 2px; padding: 10px 14px;
    border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--accent-soft); color: var(--text);
}
.source-quote > i { color: var(--accent); margin-top: 3px; flex: none; }
.source-quote .quote-text { font-size: .9rem; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.source-quote .quote-text p { margin: 0; }
.source-quote .quote-text p + p { margin-top: .5em; }

@media (max-width: 720px) {
    .collapsible-head .preview { display: none; }
}

/* Verdict rationale */
.rationale-reasoning { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 13px; }
.rationale-reasoning h4 {
    color: var(--muted); font-size: .78rem; font-weight: 600; margin-bottom: 7px;
}
.prose-text { line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

/* =========================================================================
   Rendered Markdown (retrieved source content)
   ========================================================================= */

.source-content {
    max-height: 460px; overflow: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 14px;
}
/* The gallery belongs inside the box with the text it illustrates. */
.source-content .media-gallery { padding: 10px 0 2px; }
.source-content .media-figure { width: 150px; }
.markdown { font-size: .87rem; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; }
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 .85em; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 {
    margin: 1.1em 0 .45em; line-height: 1.35; color: var(--text);
}
.markdown h3 { font-size: 1rem; }
.markdown h4 { font-size: .92rem; }
.markdown h5, .markdown h6 { font-size: .86rem; color: var(--text-soft); }
.markdown ul, .markdown ol { margin: 0 0 .85em; padding-left: 1.4em; }
.markdown li { margin: .2em 0; }
.markdown blockquote {
    margin: 0 0 .85em; padding: .1em 0 .1em .9em;
    border-left: 2px solid var(--border-strong); color: var(--text-soft);
}
.markdown pre {
    margin: 0 0 .85em; padding: 10px 12px; overflow-x: auto;
    background: var(--surface-2); border-radius: var(--radius-sm);
}
.markdown pre code { white-space: pre; }
.markdown code {
    background: var(--surface-2); padding: .1em .35em; border-radius: 4px;
    font-size: .88em; overflow-wrap: anywhere;
}
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 1.1em 0; }
.markdown a { overflow-wrap: anywhere; }
.markdown img { max-width: 100%; }
.markdown table { width: 100%; border-collapse: collapse; margin: 0 0 .85em; }

/* Media inside a card must never push it wider. */
.multimodal, .multimodal > * { min-width: 0; }
.multimodal .media-gallery { max-width: 100%; }

/* =========================================================================
   Hover tooltip
   ========================================================================= */

.tip { position: relative; cursor: help; border-bottom: 1px dotted currentColor; }

/* util.js `copyable`: an ID that copies itself on click. */
.copy-id {
    cursor: copy; border-radius: 5px; padding: 0 3px; margin: 0 -3px;
    transition: background var(--fast), color var(--fast);
}
.copy-id:hover, .copy-id:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }

/* The one floating tooltip (util.js `installTooltips`): a surface of the active
   theme, like a small card, rather than its inverse. */
.tooltip {
    position: fixed; z-index: 300; pointer-events: none;
    max-width: min(46ch, 86vw); width: max-content;
    padding: 8px 11px; border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-soft);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
    font-family: var(--font); font-size: .78rem; font-weight: 500;
    line-height: 1.5; text-align: left; white-space: pre-line; letter-spacing: 0;
    animation: fade 120ms var(--ease) both;
}

.toast.selectable {
    user-select: all; cursor: text; max-width: min(90vw, 70ch);
    font-family: var(--mono); font-size: .78rem; word-break: break-all; text-align: center;
}

/* Info icon beside a heading: the explanation is one hover away, and the
   heading stays a heading. */
.info-tip {
    color: var(--muted); font-size: .82rem; cursor: help;
    border: 0; margin-left: 2px; transition: color var(--fast);
}
.info-tip:hover, .info-tip:focus-visible { color: var(--accent); }
.section > h2 .info-tip, .card-head .info-tip { margin-left: 0; }
/* A hint slot holding only an icon should not stretch to the right edge. */
.section > h2 > .hint:has(> .info-tip:only-child),
.card-head > .hint:has(> .info-tip:only-child) { margin-left: 0; }

/* Source cards already sit on `--surface-2`, so the generic hover would be a
   no-op on them; they step one shade further instead. */
.evidence-source-card:not(.open):hover { background: var(--surface-3); }
.evidence-source-card.open > .collapsible-head:hover { background: var(--surface-3); }

/* =========================================================================
   Media deduplication
   ========================================================================= */

.dedup-notice {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    padding: 11px 15px; border-radius: var(--radius-sm); font-size: .88rem;
    border: 1px solid var(--border);
}
.dedup-notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.dedup-notice.bad  { background: var(--bad-soft);  color: var(--bad-ink); }

.dedup-card { display: grid; gap: 14px; }
.dedup-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dedup-fact .label { color: var(--muted); font-size: .75rem; font-weight: 560; }
.dedup-fact .value { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.dedup-fit {
    margin: 0; color: var(--text-soft); font-size: .86rem;
    min-height: 3em;  /* Two lines whether there is a fit or not: a redrawn card keeps its height */
}

.dedup-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dedup-manual { display: inline-flex; gap: 6px; margin-left: auto; }
.dedup-input {
    width: 7.5em; font: inherit; font-size: .88rem; font-variant-numeric: tabular-nums;
    padding: 7px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
}

.dedup-chart svg { width: 100%; height: auto; display: block; }
.dedup-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.dedup-chart .tick { fill: var(--muted); font-size: 9.5px; font-family: var(--mono); }
.dedup-chart .fit-curve { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .75; }
.dedup-chart .fit-line { stroke: var(--accent); stroke-width: 1.5; }
.dedup-chart .threshold-line { stroke: var(--ok); stroke-width: 2; stroke-dasharray: 5 4; }
.dedup-chart .dot { stroke: var(--surface); stroke-width: 1.2; }
.dedup-chart svg.picking { cursor: pointer; }
.dedup-chart .dot:focus { outline: none; }
.dedup-chart .hot-ring { fill: none; stroke: var(--text); stroke-width: 2; pointer-events: none; }
.dedup-chart .dot.hot { stroke: var(--surface); stroke-width: 1.5; pointer-events: none; }

/* The hover preview of a judged pair. */
.dedup-preview {
    position: fixed; z-index: 40; pointer-events: none;
    display: grid; gap: 6px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.dedup-preview[hidden] { display: none; }
.dedup-preview-media { display: grid; grid-template-columns: repeat(2, 150px); gap: 6px; }
.dedup-preview-media img, .dedup-preview-media video {
    width: 150px; height: 150px; object-fit: contain; background: #000; border-radius: 5px; display: block;
}
.dedup-preview-text { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--text-soft); }
.dedup-preview-ids { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.dedup-chart .dot.identical { fill: var(--accent); }
.dedup-chart .dot.different { fill: var(--muted); }
.dedup-chart .legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .76rem; margin-top: 4px; }
.dedup-chart .legend span { display: inline-flex; align-items: center; gap: 6px; }
.dedup-chart .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dedup-chart .swatch.identical { background: var(--accent); }
.dedup-chart .swatch.different { background: var(--muted); }
.dedup-chart .swatch.fit { height: 3px; border-radius: 2px; background: var(--accent); }
.dedup-chart .swatch.threshold { height: 0; border-radius: 0; border-top: 2px dashed var(--ok); }

.dedup-session .card-head { flex-wrap: wrap; }
.dedup-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dedup-question { margin: 0 0 14px; color: var(--text-soft); }
.dedup-stage {
    /* Fixed, so that a new pair - or a note in its place - never changes the page
       height: the scroll position stays put while the next media load. */
    --dedup-media-height: min(52vh, 560px);
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
    min-height: calc(var(--dedup-media-height) + 46px);
    transition: opacity var(--fast);
}
.dedup-stage.busy { opacity: .45; }
.dedup-stage > .empty { grid-column: 1 / -1; align-self: center; }
.dedup-medium {
    margin: 0; display: grid; gap: 6px; justify-items: center; align-content: start;
    padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.dedup-frame {
    width: 100%; height: var(--dedup-media-height);
    display: flex; align-items: center; justify-content: center;
    background: #000; border-radius: 6px; overflow: hidden;
}
.dedup-frame img, .dedup-frame video {
    width: 100%; height: 100%; object-fit: contain; display: block;
}
.dedup-medium figcaption { font-family: var(--mono); font-size: .78rem; }
.dedup-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dedup-buttons kbd {
    font-family: var(--mono); font-size: .72rem; padding: 1px 5px; margin-left: 2px;
    border: 1px solid currentColor; border-radius: 4px; opacity: .65;
}
.dedup-history { margin-top: 16px; }
.dedup-history h4 { margin: 0 0 8px; color: var(--muted); font-size: .78rem; font-weight: 600; }

/* A judged pair, opened from the chart. */
.dedup-review-overlay {
    position: fixed; inset: 0; z-index: 50; overflow: auto; overscroll-behavior: contain;
    display: grid; place-items: center; padding: 24px;
    background: rgba(10, 12, 20, .62);
}
.dedup-review { width: min(1100px, 100%); }
.dedup-review-meta { margin: 0 0 12px; color: var(--muted); font-size: .82rem; font-family: var(--mono); }
.dedup-review-message { margin: 10px 0 0; color: var(--bad-ink); font-size: .86rem; }
.dedup-review-message:empty { display: none; }

@media (max-width: 720px) {
    /* Stacked, so each slot gets less of the viewport. */
    .dedup-stage { grid-template-columns: minmax(0, 1fr); --dedup-media-height: 36vh; }
    .dedup-manual { margin-left: 0; }
}

/* =========================================================================
   Claim detail: panels
   ========================================================================= */

.stack { display: grid; gap: 16px; align-content: start; }

/* A panel's header reads like a card head, and folds the panel. */
.panel > .collapsible-head { padding: 13px 18px; }
.panel.open > .collapsible-head { border-bottom: 1px solid var(--border); }
.panel > .collapsible-head h2, .panel > .collapsible-head h3 { flex: 1; min-width: 0; }
.panel > .collapsible-head .hint {
    color: var(--muted); font-size: .78rem; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
}
.panel > .collapsible-head .panel-icon { color: var(--accent); }
.panel > .collapsible-head .chev { margin-left: 0; }

/* Reference times: t_c and t_f on a line, the period between them. */
.ref-times {
    display: grid; grid-template-columns: max-content minmax(60px, 1fr) max-content;
    align-items: center; gap: 0 4px; margin: 2px 0 16px;
}
.rt-end { display: grid; justify-items: center; gap: 3px; }
.rt-symbol { font-size: .86rem; font-weight: 650; color: var(--accent); }
.rt-end.tf .rt-symbol { color: var(--violet-ink); }
.rt-dot {
    width: 12px; height: 12px; border-radius: 99px; background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.rt-end.tf .rt-dot {
    background: var(--violet);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent);
}
.rt-date { font-size: .76rem; color: var(--text-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-span { position: relative; display: grid; place-items: center; align-self: stretch; }
.rt-line {
    position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px;
    border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--violet));
    opacity: .55; transform-origin: left; animation: grow-x 700ms var(--ease) both;
}
.rt-diff {
    position: relative; padding: 2px 10px; border-radius: 99px; white-space: nowrap;
    background: var(--surface); border: 1px solid var(--border-strong);
    font-size: .76rem; font-weight: 600; color: var(--text-soft);
}

/* Gold verdict gauges */
.gauges { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-around; }
.gauge { display: grid; justify-items: center; width: 110px; }
.gauge-svg { width: 104px; height: 59px; overflow: visible; }
.gauge-track { fill: none; stroke: var(--surface-3); stroke-width: 8; stroke-linecap: round; }
.gauge-fill {
    fill: none; stroke-width: 8; stroke-linecap: butt;
    stroke-dasharray: 200; stroke-dashoffset: 200; animation: gauge-draw 700ms var(--ease) forwards;
}
.gauge-zero { stroke: var(--border-strong); stroke-width: 1.5; }
.gauge-knob { stroke: var(--surface); stroke-width: 2; }
.gauge-value {
    margin-top: -18px; font-family: var(--mono); font-size: .92rem; font-weight: 650;
    font-variant-numeric: tabular-nums;
}
.gauge-label { color: var(--muted); font-size: .74rem; font-weight: 560; margin-top: 2px; }
@keyframes gauge-draw { to { stroke-dashoffset: 0; } }

/* =========================================================================
   Claim detail: evidence masonry and filter menu
   ========================================================================= */

/* util.js `masonry`: independent columns, each item placed in the shorter one. */
.masonry { display: flex; gap: 14px; align-items: flex-start; }
.masonry > .empty { flex: 1; }
.masonry-col { flex: 1 1 0; min-width: 0; display: grid; gap: 14px; align-content: start; }
/* A card is half the page wide; its sources stack instead of tiling. */
.evidence-masonry .source-grid { grid-template-columns: minmax(0, 1fr); }

/* The ID and the copy-link button only on hover (or keyboard focus). */
.on-hover {
    display: inline-flex; align-items: center; gap: 8px;
    opacity: 0; transition: opacity var(--fast);
}
.evidence:hover .on-hover, .evidence:focus-within .on-hover,
.claim-card:hover .on-hover, .claim-card:focus-visible .on-hover { opacity: 1; }
.evidence .eid { font-family: var(--mono); font-size: .76rem; color: var(--muted); }

.filter-wrap { position: relative; display: inline-block; }
.btn.filter-btn { padding: 6px 12px; font-size: .84rem; }
.btn.filter-btn .count, .filter-item .count { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.btn.filter-btn .caret { font-size: .66rem; color: var(--muted); transition: transform var(--fast); }
.btn.filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.filter-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.filter-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
    display: grid; padding: 5px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: rise 160ms var(--ease) both;
}
.filter-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 10px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--text-soft); font: inherit; font-size: .86rem; text-align: left;
}
.filter-item i { width: 15px; text-align: center; color: var(--muted); }
.filter-item .text { flex: 1; }
.filter-item:hover { background: var(--surface-2); color: var(--text); }
.filter-item.active { color: var(--accent); background: var(--accent-soft); }
.filter-item.active i { color: var(--accent); }

/* =========================================================================
   Claim detail: sufficiency validation
   ========================================================================= */

.suff-card.tone-ok > .collapsible-head .panel-icon { color: var(--ok); }
.suff-card.tone-bad > .collapsible-head .panel-icon { color: var(--bad); }
.suff-card.tone-warn > .collapsible-head .panel-icon { color: var(--warn); }
.suff-card > .collapsible-head h3 { flex: 0 1 auto; }
.suff-card > .collapsible-head { flex-wrap: nowrap; }
.suff-card > .collapsible-head .hint { margin-left: auto; }

.suff-body { display: grid; gap: 14px; }
.suff-card > .collapsible-head h3 { display: inline-flex; align-items: baseline; gap: 10px; }
.suff-count { font-size: .8rem; font-weight: 560; color: var(--text-soft); letter-spacing: 0; }
.suff-error {
    display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: var(--radius-sm);
    background: var(--bad-soft); color: var(--bad-ink); font-size: .84rem;
}
.suff-error i { margin-top: 4px; }

.suff-prop { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.suff-prop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.suff-prop-head .name { font-weight: 620; font-size: .88rem; }
.suff-prop-head .vals {
    display: inline-flex; align-items: center; gap: 12px;
    font-family: var(--mono); font-size: .8rem; font-variant-numeric: tabular-nums;
}
.suff-prop-head .vals > span { display: inline-flex; align-items: center; gap: 5px; }
.suff-prop-head .badge { font-family: var(--font); }

/* Markers, shared by the scale, the values and the legend. */
.mk { display: inline-block; flex: none; }
.mk.gold { width: 9px; height: 9px; background: var(--text); transform: rotate(45deg); border-radius: 1px; }
.mk.pred { width: 10px; height: 10px; border-radius: 99px; background: var(--ok); }
.mk.pred.bad { background: var(--bad); }
.mk.member { width: 8px; height: 8px; border-radius: 99px; border: 1.5px solid var(--muted); }
.mk.band {
    width: 16px; height: 9px; border-radius: 3px;
    background: color-mix(in srgb, var(--neutral) 16%, transparent);
    border: 1px dashed color-mix(in srgb, var(--neutral) 60%, transparent);
}

.suff-scale-wrap { display: grid; grid-template-columns: max-content 1fr max-content; gap: 10px; align-items: center; }
.suff-scale-wrap .tick { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.suff-scale { position: relative; height: 44px; }
.suff-scale > * { position: absolute; }
.suff-scale .axis { left: 0; right: 0; top: 14px; height: 2px; border-radius: 99px; background: var(--surface-3); }
.suff-scale .zero { left: 50%; top: 8px; width: 1px; height: 14px; background: var(--border-strong); }
.suff-scale .band {
    top: 7px; height: 16px; border-radius: 5px;
    background: color-mix(in srgb, var(--neutral) 14%, transparent);
    border: 1px dashed color-mix(in srgb, var(--neutral) 55%, transparent);
}
/* Members sit below the axis; agreeing members share a dot with a count. */
.suff-scale .member-dot .n {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    font-family: var(--mono); font-size: .62rem; line-height: 1; color: var(--muted); white-space: nowrap;
}
.suff-scale .member-dot {
    top: 25px; width: 8px; height: 8px; margin-left: -4px;
    border-radius: 99px; border: 1.5px solid var(--muted); background: var(--surface);
    transition: transform var(--fast), border-color var(--fast), background var(--fast);
}
.suff-scale .member-dot.hot { transform: scale(1.6); border-color: var(--accent); background: var(--accent); z-index: 4; }
.suff-scale .gold-mark {
    top: 10px; width: 10px; height: 10px; margin-left: -5px; z-index: 2;
    background: var(--text); transform: rotate(45deg); border-radius: 1px;
    box-shadow: 0 0 0 2px var(--surface);
}
.suff-scale .pred-mark {
    top: 9px; width: 12px; height: 12px; margin-left: -6px; z-index: 3; border-radius: 99px;
    background: var(--ok); box-shadow: 0 0 0 2px var(--surface);
}
.suff-scale .pred-mark.bad { background: var(--bad); }

.suff-legend {
    display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .74rem;
    padding-top: 10px; border-top: 1px solid var(--border);
}
.suff-legend span { display: inline-flex; align-items: center; gap: 6px; }

.suff-prop details.disclose { border-top: 0; }
.suff-prop details.disclose > summary { padding: 4px 0; font-size: .8rem; }
.suff-prop details.disclose > .content { padding: 2px 0 6px; }

/* Ensemble members */
.member-list { display: grid; gap: 6px; }
.member.card { box-shadow: none; background: var(--surface-2); border-radius: var(--radius-sm); }
.member > .collapsible-head { padding: 7px 10px; gap: 8px; flex-wrap: nowrap; }
.member > .collapsible-head .name { font-family: var(--mono); font-size: .76rem; font-weight: 600; flex: none; }
.member > .collapsible-head .preview { flex: 1; max-width: none; font-size: .78rem; }
.member:not(.open):hover, .member.open > .collapsible-head:hover { background: var(--surface-3); }
.member.open > .collapsible-head .preview { visibility: hidden; }
.member-score {
    flex: none; min-width: 44px; text-align: center; padding: 1px 7px; border-radius: 99px;
    font-family: var(--mono); font-size: .74rem; font-weight: 650; font-variant-numeric: tabular-nums;
    background: var(--surface-3); color: var(--text-soft);
}
.member-score.ok { background: var(--ok-soft); color: var(--ok-ink); }
.member-score.bad { background: var(--bad-soft); color: var(--bad-ink); }
.member-score.warn { background: var(--warn-soft); color: var(--warn-ink); }
.member-body { display: grid; gap: 8px; padding: 2px 12px 10px; }
.member-body .prose { font-size: .84rem; }
.member-body details.disclose { border-top: 1px solid var(--border); }
.member-body details.disclose > summary { padding: 7px 0; font-size: .8rem; }
.member-body details.disclose > .content { padding: 2px 0 4px; }

@media (max-width: 720px) {
    .member > .collapsible-head .preview { display: none; }
    .rt-date { white-space: normal; text-align: center; max-width: 11ch; }
    .rt-diff { padding: 2px 7px; }
}

/* Gold verdict: one row per medium, the medium beside its two gauges. */
.media-verdicts { display: grid; border-top: 1px solid var(--border); }
.media-verdict { border-bottom: 1px solid var(--border); }
.media-verdict:last-child { border-bottom: 0; }
.media-verdict-row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; }
.media-verdict-row .gauges { flex: 1; }
.media-verdict-medium .rich-text { display: none; }
.media-verdict-medium .media-gallery { padding: 0; }
.media-verdict-medium .media-figure { width: 112px; }

/* =========================================================================
   Browsers: search bar, filter drawer, active filters
   ========================================================================= */

/* Raised above the cards, which animate in with transforms and so would
   otherwise paint over the sort panel. */
.browse-controls { display: grid; gap: 10px; margin-bottom: 18px; position: relative; z-index: 20; }
.browse-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.browse-bar .search { flex: 1 1 260px; }
.browse-bar .btn.filter-btn, .browse-bar .btn.sort-btn { padding: 8px 14px; font-size: .88rem; }

/* util.js `sortControl`: a button like the Filters one, opening a small panel. */
.sort-wrap { position: relative; }
.btn.sort-btn .caret { font-size: .66rem; color: var(--muted); transition: transform var(--fast); }
.btn.sort-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.sort-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
    display: grid; gap: 2px; padding: 6px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: rise 160ms var(--ease) both;
}
.sort-label {
    padding: 6px 10px 3px; color: var(--muted);
    font-size: .7rem; font-weight: 640; letter-spacing: .06em; text-transform: uppercase;
}
.sort-panel .filter-item .fa-minus { opacity: 0; }
.sort-panel .sort-order { margin: 2px 4px 4px; display: flex; }
.sort-panel .sort-order button { flex: 1; padding: 6px 10px; font-size: .82rem; }

/* Endless scroll */
.scroll-sentinel { height: 1px; }
.scroll-status { display: flex; justify-content: center; padding: 18px 0 6px; color: var(--muted); font-size: .84rem; }
.scroll-status .loading-row { padding: 0; }
.count-pill {
    display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 99px; background: var(--accent); color: #fff;
    font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.filter-drawer {
    display: grid; gap: 14px 18px; padding: 16px 18px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.filter-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.filter-field.wide { grid-column: 1 / -1; }
.filter-field select { width: 100%; }
.filter-label { color: var(--muted); font-size: .72rem; font-weight: 640; letter-spacing: .06em; text-transform: uppercase; }
.pill-group.wrap { display: flex; flex-wrap: wrap; border-radius: var(--radius-sm); width: fit-content; max-width: 100%; }
.pill-group.wrap button { padding: 5px 12px; }
.pill-count { opacity: .55; margin-left: 5px; }

.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-height: 30px; }
.result-count { color: var(--muted); font-size: .84rem; margin-right: 6px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    padding: 4px 10px; border-radius: 99px; font: inherit; font-size: .8rem; font-weight: 560;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    transition: background var(--fast), color var(--fast);
}
.filter-chip i { font-size: .7rem; opacity: .7; }
.filter-chip:hover { background: var(--accent); color: #fff; }
.btn.small { padding: 4px 10px; font-size: .8rem; }

/* =========================================================================
   Claim browser: masonry of cards led by their media
   ========================================================================= */

.claim-masonry .claim-card { padding: 0; overflow: hidden; }
.claim-card-body { padding: 14px 16px 14px; }
.claim-masonry .claim-card .text { -webkit-line-clamp: 4; margin: 9px 0 10px; }
.claim-card .row .id { margin-left: auto; }

.media-hero {
    display: grid; gap: 2px; grid-template-columns: 1fr 1fr;
    background: var(--surface-3); border-bottom: 1px solid var(--border);
}
.hero-tile {
    position: relative; display: grid; place-items: center; overflow: hidden;
    aspect-ratio: 4 / 3; background: var(--surface-3); color: var(--muted);
}
.hero-tile img, .hero-tile video {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform var(--slow);
}
.hero-tile video { pointer-events: none; background: #000; }
/* A video tile: a still frame, and on hover a player over it that fades in once
   it plays, so the still stays visible while the video loads. */
.hero-tile.video { background: #000; }
.hero-tile .still:not([src]) { visibility: hidden; }
.hero-tile video.preview { position: absolute; inset: 0; opacity: 0; transition: opacity var(--base); }
.hero-tile.playing video.preview { opacity: 1; }
.hero-tile.playing .play { opacity: 0; }
.hero-tile .play { transition: opacity var(--fast); z-index: 1; }
.claim-card:hover .hero-tile img, .claim-card:hover .hero-tile video { transform: scale(1.03); }
/* One medium fills the width, uncropped; three put the first across the top. */
.media-hero.n1 { grid-template-columns: 1fr; }
.media-hero.n1 .hero-tile { aspect-ratio: 16 / 10; }
.media-hero.n1 .hero-tile img, .media-hero.n1 .hero-tile video { object-fit: contain; }
.media-hero.n3 .hero-tile:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.hero-tile .play {
    position: absolute; width: 38px; height: 38px; border-radius: 99px;
    display: grid; place-items: center; font-size: .85rem; color: #fff;
    background: rgba(5, 7, 13, .55); backdrop-filter: blur(4px);
}
.hero-tile .more {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(5, 7, 13, .55); color: #fff; font-size: 1.3rem; font-weight: 650;
}
.hero-tile.missing { color: var(--bad-ink); background: var(--bad-soft); }

/* =========================================================================
   Evidence browser cards
   ========================================================================= */

.evidence-browse .evidence-head { padding: 13px 16px 0; }
.evidence-browse .evidence-source { margin: 6px 16px 0; padding: 8px 11px; }
.evidence-browse .evidence-source .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.evidence-browse .evidence-source .proximity { font-size: .8rem; }
.evidence-source .proximity.ok { color: var(--ok-ink); }
.evidence-source .proximity.info { color: var(--info-ink); }
.evidence-source .proximity.plain { color: var(--muted); }
.evidence-browse .evidence-facts { padding: 10px 16px 6px; }
.evidence-browse .evidence-claim { margin: 4px 16px 14px; }
.evidence-browse .evidence-claim .text { -webkit-line-clamp: 1; }
.bad-ink { color: var(--bad-ink); }
.evidence-browse .evidence-facts .bad-ink i { color: var(--bad-ink); }

/* =========================================================================
   Dashboard links
   ========================================================================= */

a.stat { display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat .label .go {
    margin-left: auto; color: var(--muted); font-size: .72rem;
    opacity: 0; transform: translateX(-4px); transition: opacity var(--fast), transform var(--fast);
}
a.stat:hover .label .go, a.stat:focus-visible .label .go { opacity: 1; transform: none; color: var(--tone, var(--accent)); }

a.bar-row { color: inherit; border-radius: 6px; margin: -3px -6px; padding: 3px 6px; transition: background var(--fast); }
a.bar-row:hover { text-decoration: none; background: var(--surface-2); }
.donut circle.link { cursor: pointer; }
a.item.link { color: inherit; border-radius: 6px; margin: -2px -6px; padding: 2px 6px; transition: background var(--fast); }
a.item.link:hover { text-decoration: none; background: var(--surface-2); }

/* Dashboard: multimodal evidence */
.modality-panel { display: grid; gap: 12px; }
.modality-rates { display: grid; gap: 3px; font-size: .8rem; color: var(--text-soft); }
.modality-rate { color: inherit; border-radius: 6px; padding: 1px 6px; margin: 0 -6px; }
a.modality-rate:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.modality-rate strong { font-family: var(--mono); color: var(--text); margin-right: 2px; }
.modality-kinds td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.modality-kinds td.key { white-space: normal; width: auto; }
.modality-kinds td.val:first-child { white-space: nowrap; }
