/* ── reset & base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0d0d;
    --panel: #161616;
    --panel2: #1d1d1d;
    --border: #2a2a2a;
    --grid: #282828;
    --text: #d8d8d8;
    --muted: #666;
    --accent: #4ab8e0;
    --accent2: #4ec96a;

    --c-plurality: #e05555;
    --c-irv: #e09944;
    --c-borda: #d4c94a;
    --c-score: #b8e04a;
    --c-approval: #4ec96a;
    --c-star: #4ab8e0;
    --c-condorcet: #9b6be0;

    --radius: 10px;
    --gap: 1.5rem;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    padding-bottom: 6.5rem;
}

a {
    color: #8fd9f2;
    text-decoration-color: rgba(143, 217, 242, 0.7);
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
    transition: color 0.15s, text-decoration-color 0.15s;
}

a:visited {
    color: #9ecaf7;
    text-decoration-color: rgba(158, 202, 247, 0.65);
}

a:hover {
    color: #b6ebff;
    text-decoration-color: #b6ebff;
}

a:focus-visible {
    outline: 2px solid rgba(74, 184, 224, 0.55);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── header ── */
header {
    text-align: center;
    padding: 3.5rem 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: radial-gradient(ellipse at 50% 0%, #1a1f2e 0%, var(--bg) 70%);
}

header h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ── layout ── */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
}

.card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ── intro ── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

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

.concept-box {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
}

.concept-box h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.formula {
    margin-top: 0.75rem;
    font-size: 0.88rem;
    color: var(--muted);
    overflow-x: auto;
}

/* ── controls ── */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.val-badge {
    background: var(--panel2);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    min-width: 2.5rem;
    text-align: center;
}

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--panel);
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-group select {
    width: 100%;
    background: var(--panel2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    font: inherit;
}

.control-group select:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}

/* methods toggles */
.methods-toggle {
    margin-bottom: 1.25rem;
}

.methods-toggle h3 {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.display-toggle {
    margin-bottom: 1.25rem;
}

.display-toggle h3 {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.88rem;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}

.toggle:has(input:checked) {
    border-color: var(--accent);
    background: #1a2530;
}

.methods-toggle .toggle {
    justify-content: center;
    align-items: center;
}

.methods-toggle .toggle span {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.15;
}

.methods-toggle .toggle span::after {
    content: "not included";
    margin-top: 0.2rem;
    font-size: 0.67rem;
    color: #8f8f8f;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.methods-toggle .toggle:has(input:checked) span::after {
    content: "included";
    color: #84e3a0;
}

.toggle input {
    display: none;
}

/* run button & progress */
.run-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #3a8fb0 100%);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #cc4a4a 0%, #a33838 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-danger:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

#progress-section {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#progress-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#progress-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

#progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
    border-radius: 4px;
    transition: width 0.25s ease;
}

#progress-bar.running {
    background: linear-gradient(90deg,
            var(--accent) 0%,
            var(--accent2) 40%,
            var(--accent) 80%,
            var(--accent2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.btn-primary.running {
    animation: btn-pulse 1.4s ease-in-out infinite;
}

@keyframes btn-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(74, 184, 224, 0.0);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(74, 184, 224, 0.25);
    }
}

.status-msg {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
    min-height: 1.2em;
}

/* ── tabs ── */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: var(--panel2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.tab-btn:hover {
    color: var(--text);
    border-color: #444;
}

.tab-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: #0e1e28;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

#tab-weighted-overall.has-empty .chart-row {
    display: none;
}

#tab-scenario-overall.has-empty .chart-row {
    display: none;
}

.chart-desc {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.note-box {
    background: var(--panel2);
    border: 1px solid #2d3f45;
    border-radius: 8px;
    padding: 0.8rem 0.95rem;
    margin-bottom: 1rem;
}

.note-box p {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.note-box ul {
    color: var(--muted);
    padding-left: 1.1rem;
    line-height: 1.55;
    font-size: 0.86rem;
}

.hypothesis-summary {
    color: var(--muted);
    font-size: 0.86rem;
    margin-bottom: 0.75rem;
}

.matrix-wrap {
    margin-bottom: 0.75rem;
}

.matrix-scroll {
    overflow-x: auto;
}

.pairwise-matrix {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pairwise-matrix th,
.pairwise-matrix td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 0.35rem;
    text-align: center;
    font-size: 0.82rem;
}

.pairwise-matrix th {
    color: var(--text);
    background: #1a1a1a;
    font-weight: 600;
}

.pairwise-diag {
    color: #555;
    background: #151515;
}

.pairwise-cell {
    width: 100%;
    min-width: 54px;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 0.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    color: #0d0d0d;
    box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.08);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.pairwise-cell-slot {
    position: relative;
}

.pairwise-cell:hover,
.pairwise-cell:focus-visible {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    filter: saturate(1.05);
}

.pairwise-cell.sig-yes {
    background: #7fe39a;
}

.pairwise-cell.sig-mixed {
    background: #e5c96e;
}

.pairwise-cell.sig-no {
    background: #e08787;
}

.pairwise-cell:focus-visible {
    outline: 2px solid #d8d8d8;
    outline-offset: 1px;
}

.pairwise-hover-template {
    display: none;
}

.hypothesis-hover-card {
    position: fixed;
    z-index: 50;
    width: min(280px, calc(100vw - 24px));
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        linear-gradient(180deg, rgba(37, 41, 48, 0.98), rgba(20, 22, 27, 0.98));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
    color: #f3f4f6;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 140ms ease, transform 140ms ease;
}

.hypothesis-hover-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pairwise-hover-title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    margin-bottom: 0.2rem;
}

.pairwise-hover-scenario {
    font-size: 0.74rem;
    color: #8faab8;
    margin-bottom: 0.35rem;
}

.pairwise-hover-body {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #e9eef5;
    margin-bottom: 0.55rem;
}

.pairwise-hover-metrics {
    display: grid;
    gap: 0.22rem;
    font-size: 0.74rem;
    color: #bcc7d6;
}

.hypothesis-color-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.85rem;
    margin: 0 0 0.6rem;
    padding: 0.5rem 0.6rem;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.8rem;
}

.hypothesis-color-legend .legend-title {
    color: var(--text);
    font-weight: 600;
}

.hypothesis-color-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.hypothesis-color-legend .legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hypothesis-color-legend .legend-swatch.yes {
    background: #7fe39a;
}

.hypothesis-color-legend .legend-swatch.mixed {
    background: #e5c96e;
}

.hypothesis-color-legend .legend-swatch.no {
    background: #e08787;
}

.hypothesis-detail {
    margin-bottom: 0.85rem;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.55;
}

.table-wrap {
    overflow-x: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.result-table th,
.result-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0.55rem;
    text-align: left;
    font-size: 0.83rem;
    white-space: nowrap;
}

.result-table th {
    color: var(--text);
    background: #1a1a1a;
    font-weight: 600;
}

.sortable-th {
    width: 100%;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.sortable-th .sort-arrow {
    color: #8a8a8a;
    font-size: 0.72rem;
    line-height: 1;
}

.sortable-th:hover .sort-arrow,
.sortable-th.is-active .sort-arrow {
    color: #d8d8d8;
}

.sortable-th:focus-visible {
    outline: 2px solid #d8d8d8;
    outline-offset: 2px;
    border-radius: 4px;
}

.result-table td {
    color: var(--muted);
}

.sig-yes {
    color: #7fe39a !important;
    font-weight: 600;
}

.sig-no {
    color: #e08787 !important;
    font-weight: 600;
}

.sig-mixed {
    color: #e5c96e !important;
    font-weight: 600;
}

.star-legend {
    color: #f0cf66;
    font-weight: 600;
}

/* ── charts ── */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.chart-row.four {
    grid-template-columns: repeat(4, 1fr);
}

.chart-row.three {
    grid-template-columns: repeat(3, 1fr);
}

.chart-row.stacked {
    grid-template-columns: 1fr;
    max-width: 920px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .chart-row.four {
        grid-template-columns: 1fr 1fr;
    }

    .chart-row.three {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {

    .chart-row,
    .chart-row.four,
    .chart-row.three {
        grid-template-columns: 1fr;
    }
}

.chart-wrap {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    position: relative;
}

.chart-row.stacked .chart-wrap {
    min-height: 360px;
}

.chart-row.stacked .chart-wrap canvas {
    width: 100% !important;
    height: 320px !important;
}

.scenario-between-stats {
    margin: -0.2rem 0 0.6rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed #2b3d42;
    border-radius: 8px;
    background: #141a1c;
}

.scenario-stats-title {
    color: #95abb0;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    margin-bottom: 0.35rem;
}

.scenario-stats-table-wrap {
    overflow-x: auto;
}

.scenario-stats-table {
    width: fit-content;
    min-width: 720px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #b5c3c6;
}

.scenario-stats-table th,
.scenario-stats-table td {
    border: 1px solid #26363a;
    padding: 0.28rem 0.4rem;
    text-align: left;
    vertical-align: top;
    line-height: 1.35;
}

.scenario-stats-table thead th {
    background: #182126;
    color: #9db2b7;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.scenario-stats-table td strong {
    color: #d7e0e2;
    font-weight: 600;
}

.scenario-stats-group+.scenario-stats-group {
    margin-top: 0.55rem;
}

.scenario-stats-group-label {
    color: #8aa0a5;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.scenario-stats-params {
    color: #6d8389;
    font-size: 0.66rem;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.scenario-ci-flag {
    display: inline-block;
    min-width: 2.1rem;
    padding: 0.05rem 0.32rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
}

.scenario-ci-flag-yes {
    color: #9df2af;
    background: rgba(50, 133, 70, 0.28);
    border: 1px solid rgba(126, 214, 147, 0.44);
}

.scenario-ci-flag-no {
    color: #ffb0b0;
    background: rgba(143, 54, 54, 0.28);
    border: 1px solid rgba(226, 131, 131, 0.45);
}

.scenario-ci-flag-na {
    color: #98a8ac;
    background: rgba(77, 92, 97, 0.25);
    border: 1px solid rgba(124, 141, 146, 0.35);
}

.scenario-stats-divider {
    margin: 0.65rem 0 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid #26363a;
    color: #739097;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.scenario-stats-note {
    color: #82969b;
    font-size: 0.75rem;
}

.scenario-matrix-wrap {
    margin-top: 0.5rem;
}

.scenario-matrix {
    min-width: unset;
    width: auto;
    margin: 0 auto;
}

.scenario-matrix th:first-child {
    text-align: left;
    padding-left: 0.5rem;
}

@media (max-width: 700px) {
    .chart-row.stacked .chart-wrap {
        min-height: 300px;
    }

    .chart-row.stacked .chart-wrap canvas {
        height: 260px !important;
    }

    .scenario-stats-table {
        min-width: 560px;
    }
}

.chart-wrap-full {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    position: relative;
    min-height: 360px;
    max-width: 760px;
    margin: 0 auto;
}

.chart-wrap-full canvas {
    width: 100% !important;
    height: 320px !important;
}

@media (max-width: 700px) {
    .chart-wrap-full {
        min-height: 300px;
    }

    .chart-wrap-full canvas {
        height: 260px !important;
    }
}

/* ── heatmap canvas grid ── */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.heatmap-item {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heatmap-item h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.heatmap-item canvas {
    image-rendering: pixelated;
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 4px;
}

/* colorbar strip */
.colorbar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 260px;
}

.colorbar-strip {
    width: 100%;
    height: 10px;
    border-radius: 3px;
}

.colorbar-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.72rem;
    color: var(--muted);
}

/* ── explainer ── */
details {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    background: var(--panel2);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    transition: background 0.15s;
}

summary::before {
    content: '▶';
    font-size: 0.7em;
    color: var(--accent);
    transition: transform 0.2s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

summary:hover {
    background: #212121;
}

details p {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.7;
    border-top: 1px solid var(--border);
}

/* ── conclusions ── */
#conclusions .conclusions-panel {
    margin-bottom: 0;
    border-color: #2d3f45;
    background: linear-gradient(180deg, #1a1f22 0%, #171a1c 100%);
}

#conclusions .conclusions-panel summary {
    font-size: 0.95rem;
    letter-spacing: 0.15px;
    color: #dbeff6;
    border-bottom: 1px solid transparent;
    background: linear-gradient(90deg, rgba(74, 184, 224, 0.12) 0%, rgba(78, 201, 106, 0.08) 100%);
}

#conclusions .conclusions-panel[open] summary {
    border-bottom-color: #2d3f45;
}

#conclusions .conclusions-panel summary:hover {
    background: linear-gradient(90deg, rgba(74, 184, 224, 0.18) 0%, rgba(78, 201, 106, 0.12) 100%);
}

#conclusions .conclusions-body {
    padding: 1rem 1.05rem 1.15rem;
    color: var(--text);
}

#conclusions .conclusions-body p {
    padding: 0;
    border-top: none;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.72;
}

#conclusions .conclusions-body p+p,
#conclusions .conclusions-body p+ul,
#conclusions .conclusions-body ul+p {
    margin-top: 0.85rem;
}

#conclusions .conclusions-body ul {
    margin-left: 0;
    padding-left: 1.35rem;
    list-style: disc;
    color: var(--text);
    line-height: 1.72;
}

#conclusions .conclusions-body li::marker {
    color: var(--accent);
}

#conclusions .conclusions-body a {
    color: #8fd9f2;
    text-decoration-color: rgba(143, 217, 242, 0.7);
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
    transition: color 0.15s, text-decoration-color 0.15s;
}

#conclusions .conclusions-body a:visited {
    color: #9ecaf7;
    text-decoration-color: rgba(158, 202, 247, 0.65);
}

#conclusions .conclusions-body a:hover {
    color: #b6ebff;
    text-decoration-color: #b6ebff;
}

#conclusions .conclusions-body a:focus-visible {
    outline: 2px solid rgba(74, 184, 224, 0.55);
    outline-offset: 2px;
    border-radius: 3px;
}

#conclusions .conclusions-body li+li {
    margin-top: 0.6rem;
}

/* ── footer ── */
footer {
    text-align: center;
    padding: 2rem 1rem 2.75rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.floating-mode-switcher {
    position: fixed;
    left: 50%;
    bottom: 0.85rem;
    transform: translateX(-50%);
    width: min(96vw, 760px);
    z-index: 35;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(74, 184, 224, 0.28);
    background: linear-gradient(180deg, rgba(20, 23, 30, 0.96), rgba(10, 11, 15, 0.96));
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-switch-actions {
    display: flex;
    gap: 0.5rem;
}

.mode-switch-btn {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    color: #ced8e3;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.mode-switch-btn:hover {
    border-color: rgba(74, 184, 224, 0.72);
    color: #e8f7ff;
}

.mode-switch-btn.ready {
    border-color: rgba(78, 201, 106, 0.62);
}

.mode-switch-btn.active {
    border-color: rgba(74, 184, 224, 0.85);
    background: rgba(74, 184, 224, 0.2);
    color: #f2fbff;
}

.mode-switch-status {
    font-size: 0.8rem;
    color: #9eaec2;
    line-height: 1.35;
    text-align: center;
}

@media (max-width: 640px) {
    body {
        padding-bottom: 8.75rem;
    }

    .floating-mode-switcher {
        bottom: 0.5rem;
        width: calc(100vw - 0.75rem);
        border-radius: 12px;
        padding: 0.6rem;
    }

    .mode-switch-actions {
        flex-direction: column;
    }
}

/* ── scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--panel);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}