* {
    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;
}

.water-cycle-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

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

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

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

.cycle-panel,
.distribution-panel {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cycle-panel h3,
.distribution-panel h3 {
    color: #1976D2;
    margin-bottom: 15px;
    font-size: 1.3em;
}

#cycleCanvas,
#distributionCanvas {
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.legend-color.evaporation {
    background: linear-gradient(135deg, #FF9800 0%, #FFB74D 100%);
}

.legend-color.condensation {
    background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%);
}

.legend-color.precipitation {
    background: linear-gradient(135deg, #2196F3 0%, #64B5F6 100%);
}

.legend-color.runoff {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.legend-color.infiltration {
    background: linear-gradient(135deg, #8BC34A 0%, #689F38 100%);
}

.water-stats {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.stat-item:last-child {
    border-bottom: none;
}

.controls-panel {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #1976D2;
    margin-bottom: 20px;
    font-size: 1.5em;
}

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

.control-group {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

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

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
}

.parameter-effect {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
}

.effect-icon {
    font-size: 1.2em;
}

.impact-panel {
    background: #fff3e0;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #FF9800;
}

.impact-panel h4 {
    color: #E65100;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.impact-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.impact-option:hover {
    background: #fff8e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.impact-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.impact-effect {
    font-size: 0.85em;
    color: #E65100;
    font-weight: 500;
}

.formulas-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.formulas-section h3 {
    color: #1976D2;
    margin-bottom: 15px;
    font-size: 1.4em;
}

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

.formula-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.formula-label {
    font-weight: 600;
    color: #1976D2;
    font-size: 0.95em;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #333;
    background: white;
    padding: 8px;
    border-radius: 4px;
}

.data-display-panel {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.data-display-panel h3 {
    color: #1565C0;
    margin-bottom: 15px;
    font-size: 1.4em;
}

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

.data-reading {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.data-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.data-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #1976D2;
    margin: 8px 0;
}

.unit {
    font-size: 0.85em;
    color: #999;
}

.explanation {
    padding: 30px;
    background: #fafafa;
}

.explanation h2 {
    color: #1976D2;
    margin-bottom: 20px;
    font-size: 2em;
}

.explanation h3 {
    color: #1565C0;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.4em;
}

.explanation p {
    line-height: 1.8;
    color: #424242;
    margin-bottom: 15px;
    font-size: 1.05em;
}

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

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

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

    .data-readings {
        grid-template-columns: repeat(2, 1fr);
    }

    header h1 {
        font-size: 2em;
    }
}

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

    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    main {
        padding: 15px;
    }

    .explanation {
        padding: 20px;
    }

    #cycleCanvas,
    #distributionCanvas {
        height: 300px;
    }

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