* {
    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, #1a365d 0%, #2d3748 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 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;
}

.earth-system-panel,
.temperature-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);
}

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

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

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

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

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

.legend-color.solar {
    background: #ffd93d;
}

.legend-color.infrared {
    background: #ef4444;
}

.legend-color.absorbed {
    background: #f87171;
}

.temp-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(300px, 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);
}

.range-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6b7280;
    gap: 10px;
}

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

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

.scenario-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scenario-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.scenario-btn:active {
    transform: translateY(0);
}

.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: 200px;
}

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

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

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

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

.calc-item {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    border-left: 4px solid #0ea5e9;
}

.calc-item span:first-child {
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 5px;
}

.calc-item span:last-child {
    color: #0284c7;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
}

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

.ghg-contributions 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;
    }

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

    .scenario-btn {
        width: 100%;
        margin-right: 0;
    }

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

    .explanation {
        padding: 20px;
    }
}
