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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.acid-rain-container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

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

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    padding: 40px;
}

.simulation-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.atmosphere-panel,
.phmap-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.atmosphere-panel h3,
.phmap-panel h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

#atmosphereCanvas,
#phmapCanvas,
#impactCanvas {
    width: 100%;
    height: 400px;
    display: block;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pollutant-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #475569;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #e2e8f0;
}

.legend-color.so2 {
    background: #ffc864;
}

.legend-color.nox {
    background: #ff9696;
}

.legend-color.acid {
    background: #ff6b6b;
}

.legend-color.rain {
    background: #4a90d9;
}

.ph-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-item span:first-child {
    font-weight: 600;
    color: #4b5563;
}

.stat-item span:last-child {
    color: #dc2626;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
}

.controls-panel {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.controls-panel h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #78350f;
    margin-bottom: 25px;
}

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

.control-group {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.control-group label span:last-child {
    color: #2563eb;
    font-weight: 700;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    margin-bottom: 10px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.emission-source {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 8px;
}

.source-icon {
    font-size: 1.2rem;
}

.mitigation-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.mitigation-panel h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
}

.mitigation-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.mitigation-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mitigation-option:hover {
    background: #dcfce7;
}

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

.mitigation-option input[type="checkbox"]:checked + span {
    color: #15803d;
    font-weight: 600;
}

.reduction {
    margin-left: auto;
    padding: 4px 8px;
    background: #22c55e;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.formulas-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.formulas-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

.formula-list {
    display: grid;
    gap: 15px;
}

.formula-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.formula-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    min-width: 180px;
}

.formula {
    font-family: 'Times New Roman', serif;
    font-size: 1rem;
    color: #1e40af;
    font-style: italic;
}

.ph-display-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.ph-display-panel h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

.ph-readings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.ph-reading {
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    text-align: center;
}

.ph-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
}

.ph-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0284c7;
    margin-bottom: 10px;
}

.ph-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.ph-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #eab308 50%, #ef4444 100%);
    transition: width 0.5s ease;
}

.concentration-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0284c7;
}

.unit {
    font-size: 0.9rem;
    color: #64748b;
}

.impact-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.impact-panel h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

.explanation {
    padding: 40px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-top: 1px solid #e5e7eb;
}

.explanation h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

.explanation h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #0369a1;
    margin: 25px 0 12px;
}

.explanation p {
    line-height: 1.9;
    color: #374151;
    margin-bottom: 15px;
    font-size: 1rem;
}

.explanation strong {
    color: #0c4a6e;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 20px;
    }

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

    .mitigation-options {
        grid-template-columns: 1fr;
    }

    .ph-readings {
        grid-template-columns: 1fr;
    }

    .pollutant-legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .explanation {
        padding: 20px;
    }
}
