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

:root {
    --susceptible-color: #2196F3;
    --infected-color: #F44336;
    --recovered-color: #4CAF50;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* Simulation Container */
.simulation-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 30px;
}

.canvas-wrapper {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
}

.canvas-wrapper.large {
    grid-column: 1;
}

canvas {
    width: 100%;
    height: auto;
    display: block;
}

#sirChart {
    height: 450px;
}

#phaseChart {
    height: 600px;
}

#comparisonChart,
#caseChart {
    height: 350px;
}

/* Controls Panel */
.controls-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.controls-panel h3 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3rem;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
}

.value-display {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1rem;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

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

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.slider-bar {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    overflow: hidden;
}

.slider-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.2s ease;
}

/* Metric Card */
.metric-card {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.metric-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.metric-meaning {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-scenario {
    width: 100%;
    margin-top: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.btn-scenario:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Model Toggle */
.model-toggle {
    margin-top: 15px;
}

.model-toggle label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.model-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Phase Container */
.phase-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.phase-controls {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.phase-controls h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.3rem;
}

.phase-instruction {
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 6px;
}

.phase-info {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.info-label {
    font-weight: 500;
    color: #666;
}

.info-value {
    font-weight: 600;
    color: #667eea;
}

/* Exploration */
.exploration-container h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 1.8rem;
}

.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.scenario-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: default;
}

.scenario-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.scenario-card h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.scenario-card p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.scenario-params {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.scenario-r0 {
    color: #667eea;
    font-weight: 600;
}

.comparison-chart h4 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3rem;
}

/* Cases */
.cases-container h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 1.8rem;
}

.case-timeline {
    position: relative;
    margin-bottom: 40px;
}

.case-timeline::before {
    content: '';
    position: absolute;
    left: 120px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.case-item {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    position: relative;
}

.case-year {
    width: 100px;
    text-align: right;
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
    padding-top: 5px;
}

.case-content {
    flex: 1;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.case-content h4 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.case-content p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 15px;
}

.case-metrics {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.case-metric {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.case-metric .metric-label {
    font-size: 0.85rem;
    color: #888;
}

.case-metric .metric-value {
    font-weight: 600;
    color: #667eea;
}

.case-visualization h4 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3rem;
}

/* Education */
.education-container h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 1.8rem;
}

.education-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.education-section h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.formula-box {
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin: 20px 0;
    border-radius: 6px;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #333;
}

.education-section ul {
    list-style-position: inside;
    line-height: 2;
}

.education-section li {
    margin-bottom: 8px;
}

.education-section li strong {
    color: #667eea;
}

.mechanics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mechanic-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    border-top: 4px solid #667eea;
}

.mechanic-card h5 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.mechanic-card p {
    color: #666;
    margin-bottom: 12px;
}

.mechanic-card ul {
    list-style-position: inside;
    line-height: 1.8;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #888;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .simulation-container,
    .phase-container {
        grid-template-columns: 1fr;
    }

    .canvas-wrapper.large {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tabs {
        gap: 8px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .scenarios-grid {
        grid-template-columns: 1fr;
    }

    .case-timeline::before {
        left: 80px;
    }

    .case-year {
        width: 60px;
        font-size: 0.9rem;
    }

    .case-item {
        flex-direction: column;
        gap: 10px;
    }

    .case-year {
        text-align: left;
    }

    .mechanics-grid {
        grid-template-columns: 1fr;
    }

    .legend {
        flex-direction: column;
        gap: 15px;
    }
}
