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

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --boyle-color: #e74c3c;
    --charles-color: #27ae60;
    --gaylussac-color: #9b59b6;
    --bg-color: #ecf0f1;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

/* Three Panels */
.three-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

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

.law-panel {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.boyle-panel {
    border-top: 5px solid var(--boyle-color);
}

.charles-panel {
    border-top: 5px solid var(--charles-color);
}

.gaylussac-panel {
    border-top: 5px solid var(--gaylussac-color);
}

.panel-header {
    text-align: center;
    margin-bottom: 10px;
}

.panel-header h2 {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.law-formula {
    font-size: 1.2em;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
    color: var(--accent-color);
    margin: 5px 0;
}

.law-condition {
    font-size: 0.85em;
    color: #7f8c8d;
}

.canvas-container {
    width: 100%;
    height: 180px;
    margin-bottom: 10px;
}

.canvas-container canvas,
.cylinder-display canvas {
    width: 100%;
    height: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

.cylinder-display {
    width: 100%;
    height: 120px;
    margin-bottom: 10px;
}

.law-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
}

.stat-value {
    font-weight: bold;
    color: var(--primary-color);
}

/* Ideal Gas Summary */
.ideal-gas-summary {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    text-align: center;
}

.ideal-gas-summary h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.formula-display {
    font-size: 2em;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.unified-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.unified-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.unified-label {
    font-size: 0.85em;
    color: #7f8c8d;
}

.unified-formula {
    font-size: 1.2em;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
    color: var(--primary-color);
}

/* Controls Section */
.controls-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.control-card h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.control-row {
    margin-bottom: 12px;
}

.control-row label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.value-display {
    background: var(--accent-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Range Slider */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-color);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

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

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
}

/* Buttons */
.animation-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.control-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s;
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

/* Explanation Section */
.explanation {
    padding: 25px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
    border-radius: 15px;
}

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

.explanation h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0369a1;
    margin: 18px 0 10px;
}

.explanation p {
    line-height: 1.7;
    color: #374151;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.6em;
    }

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

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

    .three-panels {
        grid-template-columns: 1fr;
    }
}
