* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-2: #252836;
    --border: #2e3244;
    --text: #e4e6f0;
    --text-dim: #8b8fa3;
    --accent: #6c63ff;
    --accent-hover: #7f78ff;
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --blue: #60a5fa;
    --pink: #d4537e;
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.muted { color: var(--text-dim); font-size: 14px; }
.text-red { color: var(--red); }

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

header h1 .logo {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: white;
}

header nav { display: flex; gap: 4px; }

header nav button {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

header nav button:hover { color: var(--text); background: var(--surface-2); }
header nav button.active { color: var(--text); background: var(--accent); }

/* Main layout */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

.section { display: none; }
.section.active { display: block; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface-2);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Personality card */
.personality-card-content {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-dim);
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* Output display */
.output-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
}

/* Status indicator */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
}

.status.ok { background: rgba(52, 211, 153, 0.1); color: var(--green); }
.status.error { background: rgba(248, 113, 113, 0.1); color: var(--red); }
.status.loading { background: rgba(251, 191, 36, 0.1); color: var(--yellow); }

/* --- Pipeline Steps --- */
.pipeline-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 150px;
}

.step-icon {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: white;
    flex-shrink: 0;
}

.step-info { min-width: 0; }
.step-name { font-size: 13px; font-weight: 600; }
.step-detail { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

.step-arrow { color: var(--text-dim); font-size: 18px; flex-shrink: 0; }

/* --- Post Variants --- */
.variant-card {
    background: var(--surface-2);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.variant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.variant-strategy { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.variant-score { font-size: 14px; font-weight: 700; color: var(--accent); }

.variant-preview {
    font-size: 12px;
    color: var(--text-dim);
    max-height: 60px;
    overflow: hidden;
    line-height: 1.5;
}

/* Score bars */
.score-bars { margin-bottom: 10px; }

.score-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

.score-bar-row > span:first-child { width: 70px; text-align: right; }
.score-bar-row > span:last-child { width: 30px; }

.score-bar {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* --- Quality Gate --- */
.quality-header { margin-bottom: 12px; }

.quality-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.quality-badge.pass { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.quality-badge.fail { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.quality-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-item {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
}

.check-item.pass { background: rgba(52, 211, 153, 0.1); color: var(--green); }
.check-item.fail { background: rgba(248, 113, 113, 0.1); color: var(--red); }

/* --- Influence Score --- */
.influence-overall {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.influence-ring {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: conic-gradient(
        var(--accent) calc(var(--pct) * 1%),
        var(--surface-2) calc(var(--pct) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.influence-ring::before {
    content: '';
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--surface);
    position: absolute;
}

.influence-ring span {
    position: relative;
    z-index: 1;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.influence-label {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.4;
}

.influence-breakdown {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.influence-category {
    background: var(--surface-2);
    border-radius: 10px;
    padding: 16px;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.cat-score { color: var(--accent); font-weight: 700; }

.cat-detail {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.match-item:last-child { border-bottom: none; }
.match-item.violation { color: var(--red); }

.match-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.match-tag.belief { background: rgba(108, 99, 255, 0.15); color: var(--accent); }
.match-tag.story { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.match-tag.style_rule { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }

.match-sim { margin-left: auto; color: var(--text-dim); font-weight: 600; }

.vocab-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px;
}

.vocab-tag.used { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.vocab-tag.violation { background: rgba(248, 113, 113, 0.15); color: var(--red); }

/* Final Post */
#final-post {
    width: 100%;
    min-height: 200px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
}

.post-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* --- Graph (vis-network) --- */
#graph-container {
    width: 100%;
    height: 650px;
    background: #0a0c12;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* vis-network tooltip override */
div.vis-tooltip {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
    padding: 10px 14px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    max-width: 320px !important;
    line-height: 1.5 !important;
}

.graph-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-dim);
}

.filter-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.filter-btn:hover { color: var(--text); border-color: var(--accent); }
.filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* (vis-network handles its own tooltips) */

/* Node detail */
.node-detail {
    min-height: 60px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.detail-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-field {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.field-label {
    color: var(--text-dim);
    min-width: 90px;
    font-weight: 500;
}

/* Node list */
.node-list { list-style: none; max-height: 400px; overflow-y: auto; }

.node-list li {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s;
}

.node-list li:hover { background: var(--surface-2); }
.node-list li:last-child { border-bottom: none; }

.node-type-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.node-type-badge.belief { background: rgba(108, 99, 255, 0.15); color: var(--accent); }
.node-type-badge.story { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.node-type-badge.style_rule { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.node-type-badge.thinking_model { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.node-type-badge.vocabulary { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.node-type-badge.contrast_pair { background: rgba(212, 83, 126, 0.15); color: var(--pink); }

/* History items */
.history-item {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.history-item .meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.history-item .content {
    font-size: 14px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ======================== */
/* Graph Section Layout     */
/* ======================== */
#graph.section.active {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.graph-main-card { grid-column: 1; }
.graph-sidebar { grid-column: 2; display: flex; flex-direction: column; gap: 20px; }

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.graph-header h2 { margin-bottom: 0; }

.graph-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.graph-hint {
    font-size: 12px;
    margin-bottom: 12px;
}

.btn-small {
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }

/* ======================== */
/* Edit Panel               */
/* ======================== */
.edit-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.edit-input:focus { border-color: var(--accent); }
textarea.edit-input { resize: vertical; min-height: 60px; }
select.edit-input { cursor: pointer; }

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.25);
}

/* Connections in edit panel */
.connections-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.connection-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.connection-item {
    font-size: 12px;
    padding: 6px 10px;
    background: var(--bg);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.connection-item:hover { background: var(--surface-2); }

.edge-type {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
}

.field-value {
    font-size: 12px;
    color: var(--text-dim);
    word-break: break-all;
}

/* ======================== */
/* Add Node Modal           */
/* ======================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 440px;
}

.modal-card h2 { margin-bottom: 20px; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ======================== */
/* Toast Notifications      */
/* ======================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast-ok { background: var(--green); color: #0a0c12; }
.toast-error { background: var(--red); color: white; }

/* ======================== */
/* Pipeline Stepper         */
/* ======================== */
.pipeline-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 24px 16px;
    margin: 16px 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.step-indicator {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.4s ease;
}

.step.pending .step-indicator {
    background: #2a2d3a;
    color: #6b7085;
    border: 2px solid #3b3f54;
}

.step.active .step-indicator {
    background: var(--accent);
    color: white;
    border: 2px solid var(--accent);
    animation: pulse 1.5s infinite;
}

.step.completed .step-indicator {
    background: var(--green);
    color: #0a0c12;
    border: 2px solid var(--green);
    font-size: 18px;
}

.step-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.step.active .step-label { color: var(--text); }
.step.completed .step-label { color: var(--green); }

.step-connector {
    width: 60px;
    height: 2px;
    background: #2a2d3a;
    margin: 0 4px;
    margin-bottom: 28px;
    transition: background 0.4s ease;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(108, 99, 255, 0); }
}

/* ======================== */
/* Stage Panels             */
/* ======================== */
.stage-panel {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slideIn {
    animation: slideIn 0.3s ease;
}

.badge {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

/* ── Post Cards Grid ── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.post-card {
    background: #1a1d27;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    transition: border-color 0.3s ease;
}

.post-card.top-pick {
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.engine-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(108, 99, 255, 0.2);
    color: #a5a0ff;
    white-space: nowrap;
}

.post-length {
    font-size: 11px;
    color: var(--text-muted);
}

.post-card-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
}

.post-card-full {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.btn-expand {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 6px;
}

.btn-expand:hover { text-decoration: underline; }

/* ── Streaming card ── */
.post-card.streaming {
    border-color: var(--accent);
    border-style: solid;
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.15);
}

.streaming-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
}

.stream-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1s infinite;
}

.post-card-stream {
    font-family: 'Inter', monospace;
    font-size: 13px;
    color: var(--green);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 40px;
}

/* ── Voting Matrix ── */
.vote-grid {
    display: grid;
    grid-template-columns: 140px repeat(auto-fill, minmax(50px, 1fr));
    gap: 2px;
    font-size: 12px;
}

.vote-header-cell {
    padding: 6px 4px;
    text-align: center;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-agent-cell {
    padding: 8px 6px;
    color: var(--text);
    font-weight: 500;
    font-size: 11px;
    display: flex;
    align-items: center;
}

.vote-cell {
    padding: 8px 4px;
    text-align: center;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text);
    cursor: default;
    transition: transform 0.2s ease;
}

.vote-cell:hover {
    transform: scale(1.15);
    z-index: 10;
}

/* ── Top Posts Summary ── */
.top-posts-summary h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text);
}

.top-post-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.top-badge {
    font-size: 20px;
}

.top-score {
    margin-left: auto;
    font-weight: 600;
    color: var(--green);
}

/* ── Comparison View ── */
.comparison-view {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #1a1d27;
}

.comparison-header {
    margin-bottom: 10px;
}

.comparison-columns {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: start;
}

.comparison-col h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.comparison-col.original .comparison-text { color: var(--text-muted); }
.comparison-col.refined .comparison-text { color: var(--green); }

.comparison-text {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comparison-arrow {
    color: var(--accent);
    font-size: 24px;
    padding-top: 24px;
    font-weight: bold;
}

/* ── Final Result ── */
.final-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quality-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

.quality-pill.pass { background: rgba(52, 211, 153, 0.2); color: var(--green); }
.quality-pill.fail { background: rgba(248, 113, 113, 0.2); color: var(--red); }

.score-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.score-item {
    background: #1a1d27;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.score-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* ======================== */
/* Header / Founder Select  */
/* ======================== */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

#founder-selector {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

/* ======================== */
/* Creativity Slider        */
/* ======================== */
.creativity-slider-group {
    margin: 16px 0;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.slider-label-left, .slider-label-right {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

#creativity-slider {
    flex: 1;
    accent-color: var(--accent);
    height: 6px;
}

.slider-value {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}

/* ======================== */
/* Opening Line Massacre    */
/* ======================== */
.openings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.opening-card {
    background: #1a1d27;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    transition: border-color 0.3s;
}

.opening-card.winner {
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

.opening-num {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.opening-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

.opening-strategy {
    font-size: 11px;
    color: var(--accent);
    margin-top: 6px;
}

.opening-vote-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.vote-agent-name {
    font-size: 11px;
    color: var(--text);
    width: 130px;
    flex-shrink: 0;
}

.vote-cell-mini {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.opening-winner-card {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid var(--green);
    border-radius: 8px;
    padding: 16px;
}

.winner-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.winner-text {
    font-size: 16px;
    color: var(--text);
    line-height: 1.5;
}

/* ======================== */
/* Coverage                 */
/* ======================== */
.coverage-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coverage-bar-label {
    font-size: 13px;
    color: var(--text);
    width: 140px;
    flex-shrink: 0;
}

.coverage-bar {
    flex: 1;
    height: 12px;
    background: #2a2d3a;
    border-radius: 6px;
    overflow: hidden;
}

.coverage-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 6px;
    transition: width 0.6s ease;
}

.coverage-pct {
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    width: 100px;
    text-align: right;
}

.coverage-type-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.coverage-type-label {
    font-size: 12px;
    color: var(--text-muted);
    width: 120px;
    text-transform: capitalize;
}

.coverage-type-pct {
    font-size: 12px;
    color: var(--text-muted);
    width: 100px;
    text-align: right;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 3px;
}

.heatmap-cell {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    cursor: default;
}

.opportunity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

/* ======================== */
/* Responsive               */
/* ======================== */
@media (max-width: 1024px) {
    #graph.section.active {
        grid-template-columns: 1fr;
    }
    .graph-sidebar { grid-column: 1; }
}

@media (max-width: 768px) {
    header { flex-direction: column; gap: 12px; }
    main { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pipeline-steps { flex-direction: column; }
    .step-arrow { transform: rotate(90deg); }
}
