/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --secondary-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f5f7fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Заголовок */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

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

/* Навигация */
.navigation {
    background: white;
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navigation .container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 20px;
}

.nav-btn {
    background: var(--bg-light);
    border: 2px solid transparent;
    color: var(--text-dark);
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Основной контент */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 300px);
}

.content-section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.content-section.active {
    display: block;
}

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

.section-title {
    font-size: 2rem;
    color: white;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* Теоретические карточки */
.theory-card {
    background: white;
    padding: 30px;
    margin-bottom: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.theory-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.theory-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theory-card p {
    margin-bottom: 15px;
    color: var(--text-light);
    font-size: 1.05rem;
}

.theory-card ul {
    list-style: none;
    padding-left: 0;
}

.theory-card ul li {
    padding: 8px 0;
    color: var(--text-light);
}

.theory-card.important {
    border: 3px solid var(--danger-color);
    background: linear-gradient(to right, #fff5f5, white);
}

/* Список газов */
.gas-list li {
    background: var(--bg-light);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.gas-name {
    font-weight: 600;
    font-size: 1.2rem;
    display: block;
    margin-bottom: 5px;
}

.gas-percent {
    float: right;
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
}

.gas-desc {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 5px 0 0 0;
}

/* Информация о загрязнении */
.pollution-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pollution-block {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.pollution-block h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.pollution-block ul {
    list-style: none;
}

.pollution-block ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.pollution-block ul li::before {
    content: "•";
    position: absolute;
    left: 5px;
    color: var(--primary-color);
    font-weight: bold;
}

/* Диаграммы */
.chart-container {
    background: white;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    margin: 0 auto;
    max-width: 600px;
}

/* Информационные карточки */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.info-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.info-card p {
    color: var(--text-light);
}

/* Секция горения */
.combustion-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.combustion-demo {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.combustion-demo h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.combustion-demo > p {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* Свеча */
.candle-container {
    position: relative;
    width: 100px;
    height: 200px;
    margin: 30px auto;
}

.flame {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    background: radial-gradient(ellipse at center, #ffeb3b 0%, #ff9800 50%, #f44336 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.flame.burning {
    opacity: 1;
    animation: flicker 0.5s infinite alternate;
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: translateX(-50%) scale(0.95);
        opacity: 1;
    }
}

.candle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 120px;
    background: linear-gradient(to bottom, #fff9c4, #f0e68c);
    border-radius: 5px 5px 0 0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.candle-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: #795548;
    border-radius: 5px;
}

/* Уровень кислорода */
.oxygen-level {
    margin: 30px 0;
}

.oxygen-level label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
}

.oxygen-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-light);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.oxygen-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

#oxygenPercent {
    display: inline-block;
    margin-left: 10px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Кнопки управления */
.controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Информация о горении */
.combustion-info {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.combustion-info h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.status-message {
    color: var(--text-light);
    font-size: 0.95rem;
}

.combustion-chart {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.combustion-chart h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* Тест */
.test-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.question {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--bg-light);
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
}

.question h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.option input[type="radio"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option label {
    cursor: pointer;
    flex: 1;
    font-size: 1rem;
}

.option.correct {
    background: #e8f5e9;
    border-color: var(--secondary-color);
}

.option.incorrect {
    background: #ffebee;
    border-color: var(--danger-color);
}

.test-submit {
    text-align: center;
    margin-top: 30px;
}

/* Результаты теста */
.test-results {
    text-align: center;
}

.test-results h3 {
    color: var(--primary-color);
    margin-bottom: 30px;
}

.score-display {
    margin: 30px 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-hover);
}

.score-circle span {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

#scoreMessage {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin: 20px 0;
}

/* Сопоставление */
.matching-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.matching-container h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.instruction {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

.matching-game {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.column h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.matching-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 400px;
}

.matching-item {
    padding: 20px;
    background: var(--bg-light);
    border: 3px solid var(--border-color);
    border-radius: 10px;
    cursor: move;
    transition: all 0.3s ease;
    user-select: none;
}

.matching-item:hover {
    transform: scale(1.02);
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.matching-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.matching-item.drag-over {
    border-color: var(--secondary-color);
    background: #e8f5e9;
}

.matching-item.correct-match {
    background: #e8f5e9;
    border-color: var(--secondary-color);
    animation: successPulse 0.5s ease;
}

.matching-item.incorrect-match {
    background: #ffebee;
    border-color: var(--danger-color);
    animation: errorShake 0.5s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.matching-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.result-message {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
}

.result-message.success {
    background: #e8f5e9;
    color: var(--secondary-color);
}

.result-message.error {
    background: #ffebee;
    color: var(--danger-color);
}

/* Футер */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 0;
    text-align: center;
    color: var(--text-dark);
    margin-top: 50px;
}

.footer p {
    margin: 5px 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .combustion-container,
    .matching-game,
    .pollution-info {
        grid-template-columns: 1fr;
    }

    .navigation .container {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav-btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .theory-card,
    .chart-container,
    .test-container,
    .matching-container {
        padding: 20px;
    }
}