:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-blue: #3b82f6;
    /* Route 1 */
    --accent-orange: #f97316;
    /* Route 2 */
    --success: #10b981;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    main {
        grid-template-columns: repeat(2, 1fr);
    }

    .network-card {
        grid-column: span 2;
    }

    .controls-card {
        grid-column: 1 / 2;
    }

    .chart-card {
        grid-column: 2 / 3;
    }
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 0.5rem;
}

/* Network Diagram */
.network-diagram-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 250px;
}

.network-svg {
    width: 100%;
    max-width: 600px;
    height: 100%;
}

.node {
    fill: #fff;
    stroke: var(--text-primary);
    stroke-width: 2px;
}

.node-text {
    font-weight: 600;
    font-size: 1.2rem;
    dominant-baseline: central;
}

.link {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 3px;
    transition: stroke-width 0.3s, stroke 0.3s;
}

.link-label {
    font-size: 0.9rem;
    fill: var(--text-secondary);
}

.route-1-link {
    stroke: var(--accent-blue);
}

.route-2-link {
    stroke: var(--accent-orange);
}

/* Slider & Controls */
.slider-container {
    margin-bottom: 2rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: white;
}

.route-1-badge {
    background-color: var(--accent-blue);
}

.route-2-badge {
    background-color: var(--accent-orange);
}

.total-demand {
    color: var(--text-secondary);
    font-weight: 600;
}

.modern-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
    transition: opacity .2s;
}

.modern-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(30, 41, 59, 0.1);
    transition: background .3s;
}

.modern-slider::-webkit-slider-thumb:hover {
    background: #0f172a;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.total-stat {
    grid-column: span 2;
    background: #e0f2fe;
    /* Light blue tint */
}

.stat-box h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-box .formula {
    font-size: 1.0rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.25rem;
}

/* Equilibrium State */
.stat-box.equilibrium {
    background: var(--success);
    color: white;
    transition: background-color 0.3s ease;
}

.stat-box.equilibrium h3,
.stat-box.equilibrium .value,
.stat-box.equilibrium .formula {
    color: white;
}

.hidden {
    display: none;
}

@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chart */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}