:root {
    --bg-base: #070913;
    --bg-surface: rgba(15, 23, 42, 0.75);
    --bg-surface-elevated: rgba(26, 38, 64, 0.85);
    --bg-card: rgba(13, 20, 36, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 255, 204, 0.35);
    --border-glow: rgba(139, 92, 246, 0.35);

    --accent-primary: #00ffcc;
    --accent-secondary: #00a2ff;
    --accent-violet: #8b5cf6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-emerald: #10b981;
    --accent-purple: #c084fc;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow-glow: 0 0 25px rgba(0, 255, 204, 0.15);
    --shadow-violet: 0 0 25px rgba(139, 92, 246, 0.2);
}

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

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 5% 10%, rgba(139, 92, 246, 0.09) 0%, transparent 45%),
        radial-gradient(circle at 95% 20%, rgba(0, 255, 204, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 50% 90%, rgba(0, 162, 255, 0.06) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* App Header */
.app-header {
    background: rgba(7, 9, 19, 0.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #00ffcc, #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.35);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(90deg, #00ffcc, #38bdf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.header-status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.9); }
}

/* Kahneman Banner */
.kahneman-banner {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.12) 0%, rgba(0, 255, 204, 0.10) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.25);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.kahneman-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
}

.pill-s1 {
    background: rgba(0, 255, 204, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 255, 204, 0.35);
}

.pill-s2 {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.35);
}

/* Layout Grid */
.jev-grid {
    display: grid;
    grid-template-columns: 340px 1.25fr 1.15fr;
    gap: 1.25rem;
    padding: 1.25rem 2rem;
    flex: 1;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1400px) {
    .jev-grid {
        grid-template-columns: 310px 1fr;
    }
    .col-cascade {
        grid-column: span 2;
    }
}

@media (max-width: 992px) {
    .jev-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .col-cascade {
        grid-column: span 1;
    }
}

/* Panel Styles */
.panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.panel-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex: 1;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #00a2ff);
    color: #070a12;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(0, 255, 204, 0.45);
    transform: translateY(-1px);
}

.btn-violet {
    background: linear-gradient(135deg, var(--accent-violet), #ec4899);
    color: #fff;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.btn-violet:hover {
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-highlight);
    background: var(--bg-surface-elevated);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
}

/* Preset Cards */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.preset-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.preset-card:hover {
    border-color: var(--border-highlight);
    background: rgba(30, 41, 59, 0.6);
    transform: translateX(3px);
}

.preset-card.active {
    border-color: var(--accent-primary);
    background: rgba(0, 255, 204, 0.08);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.12);
}

.preset-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preset-card-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.preset-badge {
    font-size: 0.62rem;
    font-family: var(--font-mono);
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Primitives Badges */
.primitive-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    font-weight: 700;
}

.primitive-choice {
    background: rgba(0, 255, 204, 0.12);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 255, 204, 0.3);
}

.primitive-score {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.primitive-noul {
    background: rgba(139, 92, 246, 0.12);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Form inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-control {
    background: rgba(7, 10, 20, 0.75);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.15);
}

/* Question List in Studio */
.question-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: border-color 0.2s;
}

.question-item:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.question-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.question-name {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.78rem;
    color: #38bdf8;
}

/* Results Display Cards */
.result-card {
    background: rgba(13, 20, 36, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-value-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.res-true {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.res-false {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.4);
}

.res-choice {
    background: rgba(0, 255, 204, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 255, 204, 0.35);
}

.res-score {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.probability-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.probability-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00a2ff, var(--accent-primary));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Distribution Bars for Choice */
.dist-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
}

.dist-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

/* Hybrid Stepper / Timeline */
.pipeline-stepper {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.step-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    position: relative;
    transition: all 0.2s;
}

.step-card.active {
    border-color: var(--accent-primary);
    background: rgba(0, 255, 204, 0.05);
}

.step-card.bypassed {
    opacity: 0.5;
    border-style: dashed;
}

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

.step-title {
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.step-time-badge {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--accent-primary);
}

/* JSON Output Inspector */
.json-box {
    background: #05070d;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: #a5f3fc;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.45;
}

/* Benchmarking Comparison Card */
.benchmark-widget {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(0, 255, 204, 0.05));
    border: 1px solid rgba(0, 255, 204, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.bench-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.bench-val {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.bench-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
}
