/* dBoLab Bias Results — static mirror of the BiasLab (align) results page */

:root {
    --bg-primary: #111111;
    --bg-card: #1A1A1A;
    --bg-card-hover: #222222;
    --bg-input: #141414;
    --border: #2E2E2E;
    --border-subtle: #1E1E1E;
    --text-primary: #EBEBEB;
    --text-muted: #666666;
    --text-secondary: #999999;
    --accent: #E07520;
    --accent-hover: #F08530;
    --success: #3EAA6D;
    --danger: #CC5050;
    --warning: #C89030;
    --info: #4A90D4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

h4, h5 { margin: 0; font-weight: 700; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-0 { margin-bottom: 0; }
.small { font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.d-none { display: none !important; }

.page-wrap {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1rem;
}

.paper-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}
.paper-link:hover { color: var(--accent-hover); }

/* ── Results page styles (mirrored from BiasLab main.css) ──────────── */
.results-page {
    max-width: 920px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

.results-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.results-meta-chips {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    padding-top: 0.15rem;
}

.results-meta-chip {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.15em 0.5em;
    font-family: 'Fira Code', monospace;
}

.results-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.results-view-actions {
    display: flex;
    gap: 0.4rem;
}

.results-md pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text, inherit);
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

.results-loading,
.results-error,
.results-empty {
    padding: 2.5rem 1rem;
    text-align: center;
}

/* Extreme-example accordion on dimension cards */
.dim-extremes {
    margin-top: 0.9rem;
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}

.dim-extremes-toggle {
    background: none;
    border: none;
    padding: 0.15rem 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.dim-extremes-toggle:hover { color: var(--accent); }

.dim-extremes-arrow { display: inline-block; width: 1em; }

.extreme-block {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: rgba(128, 128, 128, 0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.extreme-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.extreme-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}

.extreme-model {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
}

.extreme-mean {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.extreme-anchor {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.4rem;
}

.extreme-passage {
    font-size: 0.8rem;
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

.probe-chosen {
    background: rgba(212, 169, 110, 0.22);
    border-bottom: 1px solid var(--accent);
    padding: 0 0.15em;
    color: inherit;
}

.extreme-choices-tag {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.extreme-options {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
}

.extreme-options li {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.22rem 0.4rem;
    border-radius: 4px;
}

.extreme-options li.opt-chosen {
    background: rgba(212, 169, 110, 0.12);
    outline: 1px solid rgba(212, 169, 110, 0.4);
}

.opt-key { font-weight: 700; font-family: 'Fira Code', monospace; }

.opt-level {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    min-width: 3.6em;
}

.opt-text { flex: 1; }

.opt-picked {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
}

/* Dimension card */
.dim-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.15s;
}

.dim-card-has-findings {
    border-color: rgba(74, 144, 212, 0.3);
    box-shadow: 0 0 0 1px rgba(74, 144, 212, 0.08) inset;
}

.dim-card-header {
    margin-bottom: 0.6rem;
}

.dim-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    margin: 0;
}

.dim-id-tag {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    font-size: 0.63rem;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 0.1em 0.4em;
    margin-top: 0.2rem;
}

.dim-definition {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    margin-bottom: 1rem;
    border-left: 2px solid var(--border);
    padding-left: 0.75rem;
}

/* Stats row */
.dim-stat-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    overflow: hidden;
}

.dim-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 1.1rem;
    flex: 1;
}

.dim-stat-sep {
    width: 1px;
    height: 32px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

.dim-stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.dim-stat-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.dim-stat-plain {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.dim-mean-num {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
}

.dim-mean-denom {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Scale row */
.dim-scale-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.dim-anchor {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    flex: 0 0 25%;
    line-height: 1.3;
}

.dim-anchor-lo { text-align: right; }
.dim-anchor-hi { text-align: left; }

/* Gauge */
.dim-gauge-wrap {
    flex: 1;
    min-width: 0;
}

.dim-gauge-track {
    position: relative;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 0.25rem;
}

.dim-gauge-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.dim-gauge-marker {
    position: absolute;
    top: -3px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #aaa;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.dim-gauge-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    padding: 0 0.1rem;
}

/* Labs */
.dim-labs-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.dim-section-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.dim-section-tag-findings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.method-badge {
    font-size: 0.62rem;
    font-weight: 500;
    background: rgba(74, 144, 212, 0.12);
    color: #4A90D4;
    border: 1px solid rgba(74, 144, 212, 0.25);
    border-radius: 3px;
    padding: 0.1em 0.45em;
    font-family: 'Fira Code', monospace;
    text-transform: none;
    letter-spacing: 0;
}

.dim-labs-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.res-lab-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15em 0.55em;
    border-radius: 3px;
    background: color-mix(in srgb, var(--lc) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--lc) 35%, transparent);
    color: var(--lc);
}

/* Findings table */
.dim-findings {
    border-top: 1px solid var(--border-subtle);
    padding-top: 1rem;
    margin-top: 0.25rem;
}

.findings-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.findings-tbl th {
    font-size: 0.63rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.3rem 0.6rem 0.4rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

.findings-tbl td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.findings-tbl tbody tr:last-child td { border-bottom: none; }

.findings-tbl tbody tr:hover td { background: rgba(255,255,255,0.02); }

.finding-dir { white-space: nowrap; }

.dir-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1em 0.45em;
    border-radius: 3px;
    background: color-mix(in srgb, var(--lc) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--lc) 30%, transparent);
    color: var(--lc);
}

.dir-gt {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin: 0 0.2rem;
    vertical-align: middle;
}

.stat-key {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
}

.p-val {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
}

.sig-stars {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 0.25rem;
}

.findings-footnote {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
    font-style: italic;
}

.dim-no-findings {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.8rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Results page — study meta ───────────────────────────────────────*/
.study-meta {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.study-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.4rem;
}

.study-meta-key {
    font-size: 0.63rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.study-meta-val {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    margin-right: 0.5rem;
}

.study-tag {
    font-size: 0.68rem;
    padding: 0.1em 0.4em;
    background: rgba(102,102,102,0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
}

.study-models-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.study-models-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.study-model {
    font-size: 0.68rem;
    padding: 0.1em 0.5em;
    background: rgba(74,144,212,0.06);
    border: 1px solid rgba(74,144,212,0.15);
    border-radius: 2px;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
}

/* ── Extend feature ──────────────────────────────────────────────────*/
.extend-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.35rem 0.75rem;
    background: rgba(74,144,212,0.07);
    border: 1px solid rgba(74,144,212,0.2);
    border-radius: 4px;
    font-size: 0.75rem;
}

.extend-ref {
    color: var(--text-muted);
}

.inherited-header {
    background: rgba(255,204,102,0.04);
}

/* ── Lens chart ───────────────────────────────────────────── */
.lens-chart-container {
    padding: 0.5rem 0.25rem 0;
    overflow: visible;
}

.dim-lens-wrap {
    margin: 0.75rem 0;
    padding: 0.5rem 0.5rem 0;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    overflow: visible;
}

/* ── Score extremes panels ───────────────────────────────── */
.extreme-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .extreme-pair { grid-template-columns: 1fr; }
}

.extreme-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(var(--lab-color, #888), 0.25);
    border-left: 3px solid var(--lab-color, #888);
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
}

.extreme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.15rem;
}

.extreme-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}

.extreme-lab {
    font-size: 0.72rem;
    font-weight: 600;
}

.extreme-model {
    font-size: 0.72rem;
    color: var(--text-secondary, #ccc);
    margin-bottom: 0.1rem;
}

.extreme-passage {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--text-secondary, #ccc);
    margin: 0.4rem 0 0.2rem;
}

.extreme-probe-text {
    font-style: italic;
    font-weight: 600;
    color: #ddd;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    padding: 0 2px;
}

.extreme-score-note {
    margin-top: 0.25rem;
}

/* results.js dimension card lens wrap uses dim-lens-wrap (already added above) */

.stat-d-large  { color: var(--success); font-weight: 700; }
.stat-d-medium { color: var(--warning); }
