/* ── Reset & Variables ──────────────────────── */

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

:root {
    --bg: #09090f;
    --bg-card: #111118;
    --bg-card-hover: #1a1a25;
    --bg-input: #14141c;
    --border: #222233;
    --border-focus: #3a3a5a;
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --text-dimmer: #555570;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────── */

.header {
    border-bottom: 1px solid var(--border);
    background: rgba(9, 9, 15, 0.85);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-mark {
    display: flex;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.nav {
    display: flex;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.2rem;
    border-radius: 10px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--text);
}

.nav-btn.active {
    color: var(--text);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.github-link {
    color: var(--text-dim);
    transition: color 0.2s;
    display: flex;
}

.github-link:hover {
    color: var(--text);
}

/* ── Hero Section ──────────────────────────── */

.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

.hero-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2.5rem;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1rem;
    color: var(--text-dim);
    max-width: 640px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

/* Pipeline visualization */
.hero-pipeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}

.pipeline-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    text-align: center;
    min-width: 150px;
    transition: all 0.3s;
}

.pipeline-step:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.pipeline-step.highlight-step {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.06);
}

.pipeline-num {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.12);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.4rem;
}

.pipeline-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.pipeline-detail {
    font-size: 0.7rem;
    color: var(--text-dimmer);
}

.pipeline-arrow {
    color: var(--text-dimmer);
    padding: 0 0.3rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .hero-pipeline { flex-direction: column; gap: 0.5rem; }
    .pipeline-arrow { transform: rotate(90deg); }
    .pipeline-step { min-width: unset; width: 100%; max-width: 300px; }
}

/* ── Main Layout ───────────────────────────── */

.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

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

.router-layout {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .router-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Panels ────────────────────────────────── */

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

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-description {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* ── Input ─────────────────────────────────── */

.textarea-wrapper {
    margin-bottom: 1rem;
}

textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    padding: 1rem;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.6;
}

textarea::placeholder {
    color: var(--text-dimmer);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.72rem;
    color: var(--text-dimmer);
    font-family: var(--mono);
}

.footer-sep { opacity: 0.3; }
.footer-hint { margin-left: auto; opacity: 0.5; }

.select-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
}

.select-control:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Buttons ───────────────────────────────── */

.action-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn {
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

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

.btn-primary:hover {
    background: #5558e6;
    box-shadow: 0 0 24px var(--accent-glow);
}

.btn-glow {
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.btn-secondary {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-focus);
}

.btn-icon {
    font-size: 1rem;
}

/* ── Example Chips ─────────────────────────── */

.examples-section h3 {
    font-size: 0.72rem;
    color: var(--text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.6rem;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chip {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--text);
}

/* ── Empty State ───────────────────────────── */

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-dim);
}

.empty-visual {
    margin-bottom: 1.5rem;
}

.empty-nodes {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.empty-node {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    animation: float 3s ease-in-out infinite;
}

.empty-node.center {
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    animation: pulse-center 2s ease-in-out infinite;
}

.empty-node.n1 { top: 10%; left: 20%; animation-delay: 0s; }
.empty-node.n2 { top: 5%; left: 60%; animation-delay: 0.4s; }
.empty-node.n3 { top: 40%; left: 85%; animation-delay: 0.8s; }
.empty-node.n4 { top: 70%; left: 75%; animation-delay: 1.2s; }
.empty-node.n5 { top: 80%; left: 30%; animation-delay: 1.6s; }
.empty-node.n6 { top: 35%; left: 5%; animation-delay: 2s; }

@keyframes float {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(-8px); opacity: 0.7; }
}

@keyframes pulse-center {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 rgba(99,102,241,0); }
    50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 20px rgba(99,102,241,0.3); }
}

.empty-state h3 {
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 400px;
    margin: 0 auto;
}

.routing-time {
    font-size: 0.72rem;
    color: var(--accent-light);
    font-family: var(--mono);
    background: rgba(99, 102, 241, 0.08);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ── Animation ─────────────────────────────── */

.fade-in-up {
    animation: fadeInUp 0.4s ease-out both;
}

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

/* ── Routing Flow ──────────────────────────── */

.routing-flow {
    margin-bottom: 1.5rem;
}

.flow-container {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    overflow-x: auto;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.flow-result {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.flow-step-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.flow-provider-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-weight: 700;
    color: white;
    font-size: 0.7rem;
}

.flow-step-label {
    font-size: 0.65rem;
    color: var(--text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.flow-step-value {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.flow-connector {
    display: flex;
    align-items: center;
    color: var(--text-dimmer);
    font-size: 0.6rem;
    padding: 0 0.15rem;
    flex-shrink: 0;
}

.flow-line {
    width: 16px;
    height: 1px;
    background: var(--border);
}

.flow-arrow {
    font-size: 0.55rem;
    opacity: 0.5;
}

/* ── Recommended Model Card ────────────────── */

.rec-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(99, 102, 241, 0.01));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.rec-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--provider-color);
}

.rec-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.rec-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent-light);
}

.rec-margin {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.rec-margin.close-call {
    color: var(--warning);
}

.rec-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.rec-model-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.provider-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.rec-model-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.rec-tags {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.rec-provider {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.rec-tier {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rec-reasoning-tag {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}

.tier-frontier { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.tier-mid { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.tier-fast { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.tier-economy { background: rgba(136, 136, 160, 0.15); color: #8888a0; }

/* Score ring */
.rec-score {
    text-align: center;
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.score-ring-svg {
    transform: rotate(0);
}

.score-ring-progress {
    transition: stroke-dasharray 0.8s ease-out;
}

.score-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    font-weight: 700;
    font-size: 0.88rem;
    font-family: var(--mono);
}

.score-label {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-dimmer);
}

/* ── Signal Bars ───────────────────────────── */

.signal-bars {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.signal-bar-item {
    display: grid;
    grid-template-columns: 100px 1fr 38px;
    align-items: center;
    gap: 0.5rem;
}

.signal-label {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.signal-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.signal-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease-out;
}

.signal-value {
    font-size: 0.68rem;
    font-family: var(--mono);
    color: var(--text-dim);
    text-align: right;
}

.reasoning-signal .signal-label {
    color: #a78bfa;
}

/* ── Model Meta ────────────────────────────── */

.rec-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-item {
    text-align: center;
}

.meta-label {
    font-size: 0.6rem;
    color: var(--text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.meta-value {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--mono);
}

/* ── Analysis ──────────────────────────────── */

.analysis-section, .scores-section, .explanation-section {
    margin-bottom: 1.5rem;
}

.analysis-section h3, .scores-section h3, .explanation-section h3 {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-hint {
    font-size: 0.65rem;
    color: var(--text-dimmer);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.rankings-subtitle {
    font-size: 0.65rem;
    color: var(--text-dimmer);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6rem;
}

.analysis-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem;
    text-align: center;
    transition: border-color 0.2s;
}

.analysis-card:hover {
    border-color: var(--border-focus);
}

.analysis-card.highlight {
    border-color: rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.04);
}

.analysis-icon {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.analysis-label {
    font-size: 0.65rem;
    color: var(--text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analysis-value {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

.secondary-tasks {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-dim);
}

.complexity-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.2rem;
}

.complexity-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ── Task Classification Scores ────────────── */

.task-scores-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.task-score-row {
    display: grid;
    grid-template-columns: 22px 140px auto 1fr 36px;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    transition: background 0.15s;
}

.task-score-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.task-score-row.primary {
    background: rgba(99, 102, 241, 0.06);
}

.task-score-icon {
    font-size: 0.85rem;
}

.task-score-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-badge {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
}

.primary-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-light);
}

.secondary-badge {
    background: rgba(234, 179, 8, 0.12);
    color: var(--warning);
}

.task-score-bar-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
}

.task-score-bar {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.4s ease-out;
}

.task-score-row.primary .task-score-bar {
    background: var(--accent-light);
}

.task-score-row.secondary .task-score-bar {
    background: var(--warning);
}

.task-score-val {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    text-align: right;
}

/* ── Model Scores List ─────────────────────── */

.model-scores-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.score-row {
    display: grid;
    grid-template-columns: 26px 10px 125px 1fr 48px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    cursor: default;
}

.score-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.score-row.top {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.score-rank {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dimmer);
    text-align: center;
    font-family: var(--mono);
}

.score-row.top .score-rank {
    color: var(--accent-light);
}

.provider-dot-small {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.score-model-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-bar-wrapper {
    height: 5px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease-out;
}

.score-number {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--text-dim);
    text-align: right;
}

/* ── Signal Heatmap ────────────────────────── */

.signal-heatmap {
    overflow-x: auto;
}

.heatmap-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 500px;
}

.heatmap-header, .heatmap-row {
    display: grid;
    grid-template-columns: 140px repeat(5, 1fr);
    gap: 2px;
}

.heatmap-corner {
    background: transparent;
}

.heatmap-col-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    padding: 0.4rem;
}

.heatmap-row-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heatmap-row.top-row .heatmap-row-label {
    font-weight: 700;
    color: var(--accent-light);
}

.heatmap-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-family: var(--mono);
    font-weight: 500;
    cursor: default;
    transition: transform 0.1s;
    /* Dynamic background based on --heat */
    background: rgba(99, 102, 241, calc(var(--heat) * 0.35));
    color: var(--text);
}

.heatmap-cell:hover {
    transform: scale(1.08);
    z-index: 2;
}

/* ── Explanation ───────────────────────────── */

.explanation-text {
    font-size: 0.85rem;
    line-height: 1.75;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.explanation-text strong {
    color: var(--text);
    font-weight: 600;
}

.explanation-text p {
    margin-bottom: 0.4rem;
}

/* ── Execution Results ─────────────────────── */

.execution-results {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.execution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.execution-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
}

.execution-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: var(--mono);
}

.exec-response {
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
}

.exec-response pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0.75rem 0;
}

.exec-response code {
    font-family: var(--mono);
    font-size: 0.8rem;
}

.exec-response code:not(pre code) {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.exec-error {
    color: var(--danger);
    padding: 0.5rem;
}

/* ── Loading ───────────────────────────────── */

.loading-dots {
    display: flex;
    gap: 0.3rem;
    padding: 1rem;
    justify-content: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── How It Works ──────────────────────────── */

.hiw-layout {
    max-width: 900px;
    margin: 0 auto;
}

.hiw-hero {
    text-align: center;
    padding: 1rem 0 2rem;
}

.hiw-hero h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.hiw-hero p {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.hiw-section {
    margin-bottom: 2.5rem;
    border-left: 2px solid var(--border);
    padding-left: 1.5rem;
    position: relative;
}

.hiw-section::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.hiw-step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.hiw-step-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-light);
    font-family: var(--mono);
}

.hiw-step-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.hiw-content {
    font-size: 0.88rem;
    color: var(--text-dim);
    line-height: 1.75;
}

.hiw-content p {
    margin-bottom: 0.75rem;
}

.hiw-content strong {
    color: var(--text);
}

.hiw-code {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    margin: 0.75rem 0;
}

.hiw-code code {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--accent-light);
}

.hiw-signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.hiw-signal {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.hiw-signal strong {
    display: block;
    font-size: 0.82rem;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.hiw-signal span {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.hiw-formula {
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    margin: 0.75rem 0;
    overflow-x: auto;
}

.hiw-formula code {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text);
}

.hiw-formula sub {
    font-size: 0.65em;
    color: var(--accent-light);
}

.hiw-dimensions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.hiw-dim {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.hiw-dim-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.88rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hiw-dim-weight {
    font-size: 0.65rem;
    font-family: var(--mono);
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.hiw-dim-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.hiw-priorities {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hiw-priority {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.hiw-pri-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.hiw-pri-weights {
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--text-dim);
}

/* ── Benchmark ─────────────────────────────── */

.benchmark-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bench-stat {
    text-align: center;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.bench-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--accent-light);
}

.bench-stat-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bench-distribution {
    margin-bottom: 1.5rem;
}

.bench-distribution h4 {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dim);
}

.dist-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dist-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 50px;
    align-items: center;
    gap: 0.75rem;
}

.dist-label {
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.dist-bar {
    height: 20px;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.dist-count {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--text-dim);
}

.benchmark-table-wrapper {
    overflow-x: auto;
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.benchmark-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.65rem;
}

.benchmark-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    vertical-align: middle;
}

.benchmark-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.bench-query {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dim);
}

.bench-score {
    font-family: var(--mono);
    font-weight: 600;
}

.bench-margin {
    font-family: var(--mono);
    font-size: 0.72rem;
}

.bench-margin.close {
    color: var(--warning);
}

.task-tag {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.mini-complexity {
    height: 4px;
    width: 44px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.3rem;
}

.mini-bar {
    height: 100%;
    border-radius: 2px;
}

/* ── Models Tab ────────────────────────────── */

.provider-section {
    margin-bottom: 2rem;
}

.provider-heading {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.provider-icon-small {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.65rem;
}

.model-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.model-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: all 0.2s;
    border-top: 2px solid var(--provider-color);
}

.model-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.model-card-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.tier-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.68rem;
    color: var(--text-dimmer);
}

.stat-value {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--mono);
}

.model-card-complexity {
    margin-bottom: 0.75rem;
}

.range-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    position: relative;
    margin-top: 0.3rem;
}

.range-fill {
    height: 100%;
    border-radius: 3px;
    position: absolute;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-dimmer);
    margin-top: 0.2rem;
}

.model-card-strengths {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.strength-tag {
    font-size: 0.62rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    color: var(--text-dim);
}

/* ── Settings ──────────────────────────────── */

.settings-layout {
    max-width: 700px;
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.setting-group label.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.provider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.tag-subtle {
    font-size: 0.68rem;
    color: var(--text-dimmer);
    font-weight: 400;
}

.key-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.setting-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
}

.setting-input:focus {
    outline: none;
    border-color: var(--accent);
}

.toggle-vis-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
    padding: 0 0.5rem;
    font-size: 0.85rem;
}

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

/* ── Weights ───────────────────────────────── */

.weights-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.weight-control {
    display: grid;
    grid-template-columns: 120px 1fr 40px;
    align-items: center;
    gap: 0.75rem;
}

.weight-control label {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.weight-control input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}

.weight-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.weight-value {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: right;
}

/* ── Footer ────────────────────────────────── */

.footer {
    max-width: 1400px;
    margin: 2rem auto 0;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-dimmer);
    font-size: 0.78rem;
}

.footer-sub {
    margin-top: 0.25rem;
    font-size: 0.7rem !important;
    opacity: 0.6;
}

/* ── Toast ─────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.25rem;
    font-size: 0.82rem;
    color: var(--text);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Scrollbar ─────────────────────────────── */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}
