:root {
    --primary-color: #4F46E5; /* Indigo */
    --primary-light: #EEF2FF;
    --secondary-color: #10B981; /* Emerald */
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --bg-main: #F9FAFB;
    --bg-card: #FFFFFF;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    scroll-behavior: smooth;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.hero {
    background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.hero h2 {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Navigation */
.sticky-nav {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

/* Sections */
main {
    padding: 3rem 0;
}

.lesson-section {
    margin-bottom: 4rem;
    scroll-margin-top: 5rem;
    animation: fadeIn 0.8s ease-out;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-light);
    padding-bottom: 0.75rem;
}

.section-icon {
    font-size: 2rem;
    margin-right: 1rem;
    background: var(--primary-light);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.section-header h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 700;
}

.content-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.content-box:hover {
    box-shadow: var(--shadow-lg);
}

p {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}

.formula {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 1.2rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 1.5rem 0;
    letter-spacing: 0.05em;
    border: 1px dashed #A5B4FC;
}

.formula.large {
    font-size: 1.5rem;
    padding: 1.5rem;
}

/* Grid layout for cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: #A5B4FC;
}

.card:hover::before {
    transform: scaleX(1);
}

.card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.highlight-box {
    background: #F0FDF4;
    border-left: 5px solid var(--secondary-color);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Simulation UI */
.simulation-container {
    background: linear-gradient(145deg, #ffffff, #f3f4f6);
    border: 1px solid var(--border-color);
}

.experiment-app {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 2rem;
}

.exp-header h5 {
    font-size: 1.3rem;
    color: var(--text-main);
    text-align: center;
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.exp-body {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    align-items: center;
    justify-content: center;
}

.tube-container {
    position: relative;
    width: 160px;
    height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.test-tube {
    width: 130px;
    height: 300px;
    border: 5px solid rgba(209, 213, 219, 0.8);
    border-top: none;
    border-radius: 0 0 65px 65px;
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,0.9);
    box-shadow: inset -5px -5px 15px rgba(0,0,0,0.05), inset 5px 0 15px rgba(255,255,255,0.8), 0 15px 25px rgba(0,0,0,0.1);
}

.test-tube::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    height: 12px;
    border: 5px solid rgba(209, 213, 219, 0.8);
    border-radius: 6px;
}

.gas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: background-color 0.8s ease;
    mix-blend-mode: multiply;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
}

.temp-indicator {
    margin-top: 1.5rem;
    font-weight: 700;
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
    font-size: 1.1rem;
    border: 1px solid var(--primary-light);
}

.controls {
    flex: 1;
    min-width: 320px;
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.controls label {
    display: block;
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

input[type=range] {
    width: 100%;
    margin-bottom: 0.8rem;
    accent-color: var(--primary-color);
    height: 8px;
    border-radius: 4px;
    outline: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.explanation-box {
    padding: 1.5rem;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    min-height: 100px;
    line-height: 1.6;
    border-left: 4px solid var(--primary-color);
}

/* Quiz UI */
.quiz-item {
    background: var(--bg-main);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.mt-4 {
    margin-top: 2rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.2rem;
}

.btn-option {
    padding: 1rem 1.5rem;
    text-align: left;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.05rem;
    font-family: inherit;
    transition: var(--transition);
    font-weight: 500;
}

.btn-option:hover {
    background: var(--primary-light);
    border-color: #A5B4FC;
    transform: translateX(5px);
}

.btn-option.correct {
    background: #D1FAE5;
    border-color: #10B981;
    color: #065F46;
}

.btn-option.wrong {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #991B1B;
}

.feedback {
    margin-top: 1.2rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    animation: fadeIn 0.3s ease-out;
}

.feedback.hidden {
    display: none;
}

.feedback.success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid #10B981;
}

.feedback.error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid #EF4444;
}

/* Application UI */
.application-box {
    background: linear-gradient(135deg, #1E1B4B 0%, #3730A3 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.application-box::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
}

.application-box h4 {
    color: #C7D2FE;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.application-box .formula {
    background: rgba(255, 255, 255, 0.1);
    color: #FFF;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.feature-list {
    list-style-type: none;
    margin-top: 2rem;
}

.feature-list li {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

.feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: #34D399;
    font-weight: bold;
    font-size: 1.4rem;
    background: rgba(52, 211, 153, 0.2);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

footer {
    background: #111827;
    color: #9CA3AF;
    text-align: center;
    padding: 3rem 0;
    margin-top: 5rem;
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .exp-body {
        flex-direction: column;
        gap: 2rem;
    }
    
    .controls {
        width: 100%;
        min-width: unset;
    }
}
