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

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

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

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

.subtitle {
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    margin-bottom: 30px;
}

/* Canvas Section */
.canvas-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.canvas-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.cylinder-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cylinder-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

.legend-color.isothermal {
    background: #3498db;
}

.legend-color.isobaric {
    background: #2ecc71;
}

.legend-color.isochoric {
    background: #f39c12;
}

.legend-color.current {
    background: #e74c3c;
}

/* Right Controls */
.right-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-card h3 {
    font-size: 1.2rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.control-item {
    margin-bottom: 15px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

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

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

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

.control-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Process Buttons */
.process-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.process-btn {
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.process-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.process-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

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

.control-btn {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Checkbox Items */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    user-select: none;
    color: #555;
}

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

.info-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    font-size: 1.2rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.state-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.state-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.state-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

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

/* Formula Display */
.formula-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formula-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #2ecc71;
}

.formula-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.formula {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2ecc71;
    font-family: 'Courier New', monospace;
}

/* Application Display */
.application-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.application-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
}

.application-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #f39c12;
    margin-bottom: 5px;
}

.application-desc {
    display: block;
    font-size: 0.85rem;
    color: #666;
}

/* Educational Content */
.educational-content {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.education-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.education-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.education-section h3 {
    font-size: 1.3rem;
    color: #667eea;
    margin-bottom: 12px;
    font-weight: 600;
}

.education-section p {
    line-height: 1.8;
    color: #555;
    font-size: 1rem;
}

.education-section p strong {
    color: #333;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .right-controls {
        order: 2;
    }

    .canvas-section {
        order: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }

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

    .state-display {
        grid-template-columns: 1fr;
    }

    .process-buttons {
        flex-direction: column;
    }

    .animation-buttons {
        flex-direction: column;
    }
}

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

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .control-card {
        padding: 15px;
    }

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