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

.vapor-pressure-container {
    max-width: 1400px;
    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, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

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

main {
    padding: 30px;
}

.graph-selector,
.substance-selector {
    text-align: center;
    margin-bottom: 25px;
}

.graph-selector h3,
.substance-selector h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
}

.graph-options,
.substance-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.graph-btn,
.substance-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid #0ea5e9;
    background: white;
    color: #0ea5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.graph-btn:hover,
.substance-btn:hover {
    background: #0ea5e9;
    color: white;
    transform: translateY(-2px);
}

.graph-btn.active,
.substance-btn.active {
    background: #0ea5e9;
    color: white;
}

.canvas-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    margin-bottom: 30px;
}

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

#vaporPressureCanvas {
    width: 100%;
    height: 400px;
    display: block;
}

.molecular-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

#molecularCanvas {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.molecular-stats {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.temp-control {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.temp-control label {
    display: block;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.temp-control label span:last-child {
    color: #0ea5e9;
}

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

.temp-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    transition: all 0.2s ease;
}

.temp-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #0284c7;
    transform: scale(1.1);
}

.slider-hint {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    font-style: italic;
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-item span:first-child {
    display: block;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

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

.controls-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

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

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

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

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

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

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

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #0284c7;
    transform: scale(1.1);
}

.custom-only {
    display: none;
}

.custom-only:not([style*="display: none"]) {
    display: block;
}

.toggle-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    background: white;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.toggle-label:hover {
    background: #f0f9ff;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

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

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

.formula-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
}

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

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

.substance-table {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.substance-table table {
    width: 100%;
    border-collapse: collapse;
}

.substance-table th,
.substance-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.substance-table th {
    background: #f0f9ff;
    color: #0c4a6e;
    font-weight: 700;
}

.substance-table tbody tr:hover {
    background: #f8fafc;
}

.substance-table tbody tr.active {
    background: #e0f2fe;
    font-weight: 600;
}

.explanation {
    padding: 30px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
}

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

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

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

@media (max-width: 1024px) {
    .canvas-wrapper {
        grid-template-columns: 1fr;
    }
}

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

    header h1 {
        font-size: 1.6rem;
    }

    main {
        padding: 15px;
    }

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

    .stats-panel {
        grid-template-columns: 1fr 1fr;
    }

    .graph-options,
    .substance-options {
        flex-direction: column;
    }

    .graph-btn,
    .substance-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr;
    }
}
