/* 🎨 УНИВЕРСАЛЬНЫЕ СТИЛИ ДЛЯ ИНТЕРАКТИВНЫХ УРОКОВ v2.0 */
/* Чистый дизайн + Компактный режим + Боковое меню */

/* ========== БАЗОВЫЕ СТИЛИ ========== */

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

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Специфичные стили для страницы урока */
body:has(.app-container) {
    height: 100vh;
    overflow: hidden;
}

/* ========== LAYOUT ========== */

/* Главная страница (список уроков) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.lesson-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lesson-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.lesson-card h3 {
    color: var(--text-dark);
    font-size: 1.1em;
    margin-bottom: 8px;
    margin-top: 0;
    line-height: 1.4;
}

.lesson-card .meta {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.lesson-card .description {
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 12px;
    flex: 1;
    font-size: 0.9em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lesson-card .stats {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    color: var(--text-muted);
    font-size: 0.8em;
    flex-wrap: wrap;
}

.lesson-card .stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Страница урока */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Боковое меню */
.sidebar {
    width: 280px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    display: flex;
    justify-content: flex-end;
}

/* Кнопка закрытия sidebar для мобильных */
.sidebar-header-mobile {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    display: flex;
    justify-content: flex-end;
}

.sidebar-close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

/* === ПРОСТОЙ ДИЗАЙН SIDEBAR (v6.1) === */
.sidebar-header-simple {
    padding: 16px;
    border-bottom: 2px solid var(--border-color);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    animation: logoSpinSmooth 30s infinite;
}

.sidebar-logo:hover {
    animation-play-state: paused;
    transform: scale(1.05);
}

/* Плавное вращение + пульсация (единый ритм) */
@keyframes logoSpinSmooth {
    /* Старт */
    0% {
        transform: rotate(0deg) scale(1);
    }

    /* Плавное вращение с пульсацией (10% = 3 сек) */
    2% {
        transform: rotate(72deg) scale(1.05);
    }
    4% {
        transform: rotate(144deg) scale(1.1);
    }
    6% {
        transform: rotate(216deg) scale(1.15);
    }
    8% {
        transform: rotate(288deg) scale(1.1);
    }
    10% {
        transform: rotate(360deg) scale(1.05);
    }

    /* Остановка и возврат размера (13% = 3.9 сек) */
    13% {
        transform: rotate(360deg) scale(1);
    }

    /* Покой до конца цикла */
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.sidebar-lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    background: var(--light-bg);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.sidebar-lang-switcher .lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    min-width: 36px;
}

.sidebar-lang-switcher .lang-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.sidebar-lang-switcher .lang-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.sidebar-close-mobile {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-close-mobile:hover {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
}

/* На десктопе скрыть старые блоки */
@media (min-width: 769px) {
    .sidebar-header-mobile {
        display: none;
    }
}

/* На мобильных показать кнопку закрытия */
@media (max-width: 768px) {
    .sidebar-close-mobile {
        display: flex;
    }

    .sidebar-logo {
        width: 36px;
        height: 36px;
    }

    .sidebar-lang-switcher .lang-btn {
        font-size: 0.85em;
        padding: 5px 10px;
        min-width: 32px;
    }
}

.view-mode-icon {
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-mode-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--white);
}

.view-mode-icon[data-mode="full"] {
    color: var(--primary);
    border-color: var(--primary);
}

/* ========== КНОПКИ ДЕЙСТВИЙ В SIDEBAR ========== */

.sidebar-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
}

.sidebar-action-btn {
    flex: 1;
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-dark);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sidebar-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--white);
}

.sidebar-action-btn i {
    font-size: 1.1em;
}

/* Навигация по урокам */
.lesson-nav {
    padding: 10px;
}

.nav-item {
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    border: 2px solid transparent;
}

.nav-item:hover:not(.locked) {
    background: var(--light-bg);
    border-color: var(--primary);
}

/* Активный элемент - синий фон, белый текст */
.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    border-color: transparent;
    box-shadow: var(--shadow);
}

/* При ховере на активный элемент - сохраняем градиент и белый текст */
.nav-item.active:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    opacity: 0.9;
}

/* Завершённый элемент - галочка без изменения цвета текста */
.nav-item.completed:not(.active)::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--success);
    margin-left: auto;
    font-size: 0.9em;
}

/* При ховере на завершенный (но не активный) элемент - сохраняем контраст */
.nav-item.completed:not(.active):hover {
    background: var(--light-bg);
    color: var(--text-dark);
}

/* Завершённый И активный - белая галочка на синем фоне */
.nav-item.completed.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--white);
    margin-left: auto;
    font-size: 0.9em;
    opacity: 0.8;
}

.nav-item.locked {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.nav-item.locked:hover {
    background: transparent;
    border-color: transparent;
}

.nav-item-icon {
    font-size: 1.2em;
}

.nav-item-text {
    flex: 1;
    font-size: 0.95em;
}

.nav-subitem {
    padding-left: 40px;
    font-size: 0.9em;
}

/* Основной контент */
.main-content {
    flex: 1;
    margin-left: 0;
    transition: margin-left 0.3s ease;
    padding: 20px;
    max-width: 100%;
}

.sidebar.open ~ .main-content {
    margin-left: 280px;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Шапка урока - название урока и процент прогресса */
.lesson-header {
    background: var(--white);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 8px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.menu-btn:hover {
    background: var(--light-bg);
}

.lesson-title {
    flex: 1;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lesson-progress-percent {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 45px;
    text-align: right;
    flex-shrink: 0;
}

/* ========== КОНТЕНТ УРОКА ========== */

.lesson-content {
    padding: 40px;
    flex: 1;
    overflow-y: auto;
}

/* Режимы отображения */
.lesson-block {
    display: none;
    animation: fadeIn 0.4s ease;
}

.lesson-block.active {
    display: block;
}

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

/* Заголовки */
h1 {
    color: var(--text-dark);
    font-size: 2.2em;
    margin-bottom: 12px;
    font-weight: 700;
}

h2 {
    color: var(--text-dark);
    font-size: 1.6em;
    margin: 24px 0 16px 0;
    font-weight: 600;
}

h3 {
    color: var(--text-dark);
    font-size: 1.3em;
    margin: 20px 0 12px 0;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1em;
    margin-bottom: 32px;
}

/* Блоки тем */
.theme {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-left: 5px solid var(--primary);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 28px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
}

.theme:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateX(2px);
}

.theme h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.5em;
    margin-bottom: 16px;
}

.theme-content {
    color: var(--text-dark);
    font-size: 1.05em;
    line-height: 1.7;
}

.theme-content p {
    margin-bottom: 18px;
}

.theme-content strong {
    color: var(--secondary);
    font-weight: 600;
}

/* Тайм-коды */
.timecode {
    display: inline-block;
    background: var(--light-bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 8px;
    transition: all 0.2s;
}

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

/* Таблицы */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
}

td {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
}

tr:hover {
    background: var(--light-bg);
    transition: background 0.2s ease;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Цитаты */
blockquote, .quote-block {
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.08) 0%, rgba(102, 126, 234, 0.12) 100%);
    padding: 24px 28px 24px 64px;
    border-radius: 14px;
    border-left: 5px solid var(--secondary);
    margin: 28px 0;
    box-shadow: 0 4px 16px rgba(118, 75, 162, 0.2);
    position: relative;
    font-size: 1.05em;
    line-height: 1.7;
    font-style: italic;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

blockquote:hover, .quote-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.25);
    border-left-width: 6px;
}

blockquote::before, .quote-block::before {
    content: '\f10d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    font-size: 2em;
    color: var(--secondary);
    animation: pulse 2s ease-in-out infinite;
}

.quote-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-weight: 600;
    color: var(--secondary);
    font-style: normal;
    font-size: 0.95em;
}

/* Специфические форматы цитат */
.quote-block.quote-verse {
    font-style: normal;
    font-family: 'Georgia', 'Times New Roman', serif;
    padding: 24px 28px;
    line-height: 1.8;
}

.quote-block.quote-verse .quote-author {
    text-align: center;
    justify-content: center;
    margin-top: 20px;
    font-style: normal;
}

/* Двухколоночный layout для verse */
.verse-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.verse-original {
    text-align: right;
    padding-right: 16px;
    border-right: 2px solid var(--secondary);
    color: var(--text-dark);
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.9;
    font-size: 1.05em;
}

.verse-translation {
    text-align: left;
    padding-left: 16px;
    color: var(--text-dark);
    line-height: 1.8;
    font-size: 1em;
}

/* Адаптивность: на мобильных — одна колонка */
@media (max-width: 768px) {
    .verse-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .verse-original {
        text-align: center;
        padding-right: 0;
        border-right: none;
        border-bottom: 2px solid var(--secondary);
        padding-bottom: 16px;
    }

    .verse-translation {
        text-align: left;
        padding-left: 0;
        padding-top: 4px;
    }
}

.quote-block.quote-prose {
    font-style: normal;
    white-space: pre-line; /* Сохранить переносы строк */
    line-height: 1.8;
}

.quote-block.quote-code {
    font-family: 'Courier New', monospace;
    font-style: normal;
    white-space: pre-wrap; /* Сохранить все пробелы и переносы */
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.05) 0%, rgba(44, 62, 80, 0.08) 100%);
}

.quote-author::before {
    content: '\f007';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.9em;
}

/* Списки */
ul, ol {
    margin: 16px 0 16px 24px;
}

li {
    margin-bottom: 8px;
}

/* Выделение */
.highlight-box {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border: 2px solid #ffd700;
    padding: 20px 24px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
    position: relative;
}

.highlight-box::before {
    content: '\f0eb';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -12px;
    left: 20px;
    font-size: 1.3em;
    color: #ffd700;
    background: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emphasis {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    padding: 24px 28px 24px 64px;
    border-radius: 14px;
    border-left: 5px solid #ff9800;
    margin: 28px 0;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.2);
    position: relative;
    font-size: 1.05em;
    line-height: 1.7;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.emphasis:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25);
    border-left-width: 6px;
}

/* ИКОНКИ ДЛЯ EMPHASIS */
.emphasis::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    font-size: 2em;
    animation: pulse 2s ease-in-out infinite;
}

/* star - важно (по умолчанию) */
.emphasis[data-icon="star"]::before,
.emphasis:not([data-icon])::before {
    content: '\f005';
    color: #ff9800;
}

/* check - правило */
.emphasis[data-icon="check"] {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f1 100%);
    border-left-color: #4caf50;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
}

.emphasis[data-icon="check"]::before {
    content: '\f00c';
    color: #4caf50;
}

.emphasis[data-icon="check"]:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.25);
}

/* warning - внимание */
.emphasis[data-icon="warning"] {
    background: linear-gradient(135deg, #ffebee 0%, #fff5f5 100%);
    border-left-color: #f44336;
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.2);
}

.emphasis[data-icon="warning"]::before {
    content: '\f071';
    color: #f44336;
}

.emphasis[data-icon="warning"]:hover {
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.25);
}

/* lightbulb - идея */
.emphasis[data-icon="lightbulb"] {
    background: linear-gradient(135deg, #fffde7 0%, #fffef5 100%);
    border-left-color: #ffc107;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.2);
}

.emphasis[data-icon="lightbulb"]::before {
    content: '\f0eb';
    color: #ffc107;
}

.emphasis[data-icon="lightbulb"]:hover {
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.25);
}

/* heart - суть */
.emphasis[data-icon="heart"] {
    background: linear-gradient(135deg, #fce4ec 0%, #fef0f4 100%);
    border-left-color: #e91e63;
    box-shadow: 0 4px 16px rgba(233, 30, 99, 0.2);
}

.emphasis[data-icon="heart"]::before {
    content: '\f004';
    color: #e91e63;
}

.emphasis[data-icon="heart"]:hover {
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.25);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1.1);
    }
}

.emphasis strong {
    color: #ff6f00;
    font-weight: 700;
}

/* Логические цепочки */
.logic-chain {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 28px;
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.logic-chain-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logic-chain-title::before {
    content: '\f0e8';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary);
}

.logic-step {
    padding: 16px 20px;
    margin: 12px 0;
    border-radius: 10px;
    position: relative;
    padding-left: 56px;
    transition: all 0.3s ease;
}

.logic-step:hover {
    transform: translateX(4px);
}

.logic-step::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.logic-step[data-type="premise"] {
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8ff 100%);
    border-left: 4px solid #2196f3;
}

.logic-step[data-type="premise"]::before {
    background: #2196f3;
}

.logic-step[data-type="conclusion"] {
    background: linear-gradient(135deg, #f3e5f5 0%, #faf4fc 100%);
    border-left: 4px solid #9c27b0;
}

.logic-step[data-type="conclusion"]::before {
    background: #9c27b0;
}

.logic-step[data-type="result"] {
    background: linear-gradient(135deg, #e8f5e9 0%, #f4faf4 100%);
    border-left: 4px solid #4caf50;
}

.logic-step[data-type="result"]::before {
    background: #4caf50;
}

/* step - обычный шаг (серый) */
.logic-step[data-type="step"] {
    background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
    border-left: 4px solid #9e9e9e;
}

.logic-step[data-type="step"]::before {
    background: #9e9e9e;
}

/* action - действие (оранжевый) */
.logic-step[data-type="action"] {
    background: linear-gradient(135deg, #fff3e0 0%, #fffaf5 100%);
    border-left: 4px solid #ff9800;
}

.logic-step[data-type="action"]::before {
    background: #ff9800;
}

/* ========== КВИЗЫ ========== */

.quiz {
    /* Убраны border, padding, box-shadow для упрощения верстки */
    /* Оставлен только margin для отступов между секциями */
    margin: 32px 0;
}

.quiz h3 {
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.3em;
}

.question {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.question:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.question-text {
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 600;
    line-height: 1.5;
}

.question-prompt {
    font-size: 0.95em;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-style: italic;
}

/* Multiple Choice */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    background: var(--light-bg);
    padding: 16px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: 500;
    position: relative;
}

.option:hover {
    background: var(--white);
    border-color: var(--primary);
    transform: translateX(2px);
    box-shadow: var(--shadow);
}

.option.selected {
    background: #e3f2fd;
    color: var(--primary);
    border-color: var(--primary);
}

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

.option.correct::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 20px;
    color: var(--success);
}

.option.incorrect {
    background: #ffebee;
    color: #c62828;
    border-color: var(--danger);
    animation: shake 0.5s;
}

.option.incorrect::after {
    content: '\f00d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 20px;
    color: var(--danger);
}

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

/* True/False */
.true-false-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tf-option {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 1.05em;
}

.tf-option:hover {
    background: var(--white);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tf-option.selected {
    background: #e3f2fd;
    color: var(--primary);
    border-color: var(--primary);
}

.tf-option.correct {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: var(--success);
}

.tf-option.incorrect {
    background: #ffebee;
    color: #c62828;
    border-color: var(--danger);
    animation: shake 0.5s;
}

/* Fill in Blank */
.fill-blank-input {
    padding: 8px 12px;
    border: none;
    border-bottom: 2px solid var(--border-color);
    font-size: 1em;
    font-family: inherit;
    min-width: 150px;
    transition: all 0.3s ease;
    background: transparent;
    text-align: center;
}

.fill-blank-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.fill-blank-input.correct {
    border-bottom-color: var(--success);
    background: rgba(40, 167, 69, 0.1);
    color: #2e7d32;
    font-weight: 600;
}

.fill-blank-input.incorrect {
    border-bottom-color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
    color: #c62828;
    animation: shake 0.5s;
}

/* Matching */
.matching-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 16px 0;
}

.match-column h4 {
    margin-bottom: 16px;
    color: var(--text-dark);
    font-size: 1.05em;
}

.match-item {
    background: var(--light-bg);
    padding: 14px 40px 14px 18px; /* больше места справа для иконки */
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative; /* для ::after */
}

.match-item:hover {
    background: var(--white);
    border-color: var(--primary);
    transform: translateX(2px);
    box-shadow: var(--shadow);
}

.match-item.selected {
    background: #e3f2fd;
    color: var(--primary);
    border-color: var(--primary);
}

.match-item.correct {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border: 2px solid var(--success);
    font-weight: 600;
    cursor: not-allowed;
    pointer-events: none;
}

.match-item.correct:hover {
    transform: none;
    box-shadow: none;
}

.match-item.correct::after {
    content: '✓';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    font-size: 1.4em;
    font-weight: bold;
    opacity: 1;
}

.match-item.incorrect {
    background: #ffebee;
    color: #c62828;
    border: 2px solid var(--danger);
    animation: shake 0.5s;
    cursor: not-allowed;
    pointer-events: none;
    font-weight: 500;
}

.match-item.incorrect:hover {
    transform: none;
}

.match-item.incorrect::after {
    content: '✗';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger);
    font-size: 1.4em;
    font-weight: bold;
    opacity: 1;
}

.match-item.matched {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 2px solid #1976d2;
    cursor: pointer;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
}

.match-item.matched:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    opacity: 1;
}

.match-item.matched::after {
    content: '✕';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #1976d2;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.2s;
}

.match-item.matched:hover::after {
    opacity: 0.7;
}

.match-item.incorrect-match {
    background: #ffebee;
    color: #c62828;
    border: 2px solid var(--danger);
    animation: shake 0.5s, pulse-red 0.5s;
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(244, 67, 54, 0);
    }
}

/* Sequence Order */
.sequence-container {
    margin: 16px 0;
}

.sequence-hint {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0 16px 0;
    font-size: 0.95em;
    color: var(--text-dark);
}

.sequence-item {
    background: var(--light-bg);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 2px solid transparent;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
}

.sequence-item:hover {
    background: var(--white);
    box-shadow: var(--shadow);
}

.sequence-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.seq-btn {
    background: var(--white);
    border: 2px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--text-dark);
}

.seq-btn:hover:not(:disabled) {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.seq-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sequence-text {
    flex: 1;
    font-weight: 500;
}

.sequence-item.correct {
    border-left-color: var(--success);
    background: #e8f5e9;
    border-color: var(--success);
}

.sequence-item.incorrect {
    border-left-color: var(--danger);
    background: #ffebee;
    border-color: var(--danger);
    animation: shake 0.5s;
    border-left-width: 5px;
}

/* Drag & Drop */
.drop-zone {
    background: var(--light-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    min-height: 120px;
    margin: 12px 0;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: #e3f2fd;
    border-style: solid;
}

.draggable-item {
    background: var(--white);
    padding: 14px 18px;
    border-radius: 10px;
    margin: 8px;
    cursor: move;
    display: inline-block;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    font-weight: 500;
}

.draggable-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.draggable-item.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

/* Сообщения */
.message {
    padding: 18px 24px;
    border-radius: 12px;
    margin: 20px 0;
    font-weight: 500;
    display: none;
    box-shadow: var(--shadow);
    position: relative;
}

.message.show {
    display: block;
    animation: slideIn 0.4s ease;
}

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

.message.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #f4faf4 100%);
    color: #2e7d32;
    border-left: 5px solid var(--success);
}

.message.success i {
    color: var(--success);
    font-size: 1.1em;
    margin-right: 8px;
}

.message.warning {
    background: linear-gradient(135deg, #fff3e0 0%, #fffaf5 100%);
    color: #f57c00;
    border-left: 5px solid #ff9800;
}

.message.warning i {
    color: #ff9800;
    font-size: 1.1em;
    margin-right: 8px;
}

.message.error {
    background: linear-gradient(135deg, #ffebee 0%, #fff5f5 100%);
    color: #c62828;
    border-left: 5px solid var(--danger);
}

.message.error i.fa-times-circle,
.message.error i.fa-exclamation-triangle {
    color: var(--danger);
    font-size: 1.1em;
    margin-right: 8px;
}

/* Специальные кнопки внутри message */
.message-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-top: 16px;
    justify-content: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.message-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
}

.btn-hint {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    padding: 8px 16px;
    font-size: 0.9em;
    white-space: nowrap;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
}

.btn-hint:hover {
    background: linear-gradient(135deg, #ffb300 0%, #ffa000 100%);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    transform: translateY(-2px);
}

.btn-retry {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 10px 18px;
    font-size: 0.95em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: auto;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-retry:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.4);
    transform: translateY(-1px);
}

.btn-retry i,
.btn-hint i {
    margin-right: 8px;
    font-size: 0.9em;
}

/* Подсказка с эталонным ответом */
.canonical-hint {
    display: inline-block;
    margin-left: 12px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    color: #1976d2;
    border-radius: 6px;
    font-size: 0.85em;
    border: 1px solid #90caf9;
    animation: fadeIn 0.3s ease;
}

.canonical-hint i {
    margin-right: 6px;
    color: #1976d2;
}

.canonical-hint strong {
    color: #0d47a1;
    font-weight: 600;
}

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

/* Кнопка "Показать правильные ответы" */
.btn-show-answers {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    padding: 10px 18px;
    font-size: 0.95em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: auto;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.btn-show-answers:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.4);
    transform: translateY(-1px);
}

.btn-show-answers i {
    margin-right: 8px;
    font-size: 0.9em;
}

/* Кнопка "Пропустить квиз" */
.btn-skip-quiz {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 10px 18px;
    font-size: 0.95em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: auto;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
    transition: all 0.3s ease;
}

.btn-skip-quiz:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    box-shadow: 0 3px 10px rgba(255, 152, 0, 0.4);
    transform: translateY(-1px);
}

.btn-skip-quiz i {
    margin-right: 8px;
    font-size: 0.9em;
}

.message-text span {
    font-weight: 500;
}

/* ========== КНОПКИ ========== */

.btn-container {
    display: flex;
    gap: 14px;
    margin-top: 32px;
    justify-content: center;
}

button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    border: none;
    padding: 16px 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button:disabled::before {
    display: none;
}

/* Нижняя панель навигации */
.bottom-navigation {
    padding: 0;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    position: sticky;
    bottom: 0;
    z-index: 50;
}

/* Прогресс-бар в нижней панели */
.bottom-progress-container {
    background: var(--light-bg);
    height: 4px;
    position: relative;
    overflow: hidden;
}

.bottom-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
}

.bottom-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Навигация компактного режима */
.compact-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 40px;
}

.compact-navigation > span {
    font-size: 0.9em;
    color: var(--text-muted);
    white-space: nowrap;
}

.nav-btn {
    background: var(--white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 12px 20px;
    /* min-width убран - пусть кнопки будут компактными */
}

.nav-btn::before {
    display: none;
}

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

.nav-btn:disabled {
    opacity: 0.3;
    background: var(--light-bg);
}

/* ========== ЗАВЕРШЕНИЕ УРОКА ========== */

.completion {
    text-align: center;
    padding: 60px 20px;
}

.completion-icon {
    font-size: 6em;
    margin-bottom: 24px;
    animation: celebration 1s ease;
}

@keyframes celebration {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
}

.completion h2 {
    color: var(--success);
    margin-bottom: 20px;
    font-size: 2em;
}

.completion-date {
    color: var(--text-muted);
    margin: 24px 0;
    font-size: 1.05em;
}

.certificate-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 3px solid var(--success);
    border-radius: 16px;
    padding: 40px;
    margin: 40px auto;
    max-width: 650px;
    box-shadow: var(--shadow-lg);
}

/* ========== RESPONSIVE ========== */

/* Desktop - sidebar открыт по умолчанию */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 280px;
        padding: 0;
    }

    .content-wrapper {
        max-width: none;
        margin: 0;
        border-radius: 0;
    }

    .menu-btn {
        display: none;
    }

    .overlay {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    /* Планшеты - 2 колонки */
    .lessons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    /* Главная страница */
    .lessons-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .lesson-card {
        padding: 16px;
    }

    /* Страница урока */
    .sidebar {
        width: 100%;
    }

    .sidebar.open ~ .main-content {
        margin-left: 0;
    }

    .main-content {
        padding: 0;
    }

    .lesson-content {
        padding: 24px 20px;
    }

    /* Компактный хедер для мобильных */
    .lesson-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .menu-btn {
        padding: 6px;
        font-size: 1.3em;
        min-width: 36px;
        height: 36px;
    }

    .lesson-title {
        font-size: 0.95em;
    }

    .lesson-progress-percent {
        font-size: 0.85em;
        min-width: 40px;
    }

    /* Кнопки действий в сайдбаре на мобильных */
    .sidebar-actions {
        padding: 10px;
    }

    .sidebar-action-btn {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    /* Компактная нижняя навигация для мобильных */
    .compact-navigation {
        padding: 10px 12px;
        gap: 8px;
        justify-content: space-between;
    }

    .compact-navigation > span {
        font-size: 0.85em;
        flex-shrink: 0;
        text-align: center;
        min-width: 80px;
    }

    .compact-navigation .nav-btn {
        padding: 10px 12px;
        font-size: 0.9em;
        min-width: auto;
        width: auto !important;
        flex-shrink: 0;
    }

    /* Только стрелочки на узких экранах */
    .nav-btn .btn-text {
        display: none;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
    }

    .theme {
        padding: 20px;
    }

    .theme::before {
        width: 4px;
    }

    blockquote, .quote-block {
        padding: 20px 24px 20px 56px;
        font-size: 1em;
        margin: 20px 0;
    }

    blockquote::before, .quote-block::before {
        left: 16px;
        font-size: 1.6em;
    }

    .emphasis {
        padding: 20px 24px 20px 56px;
        font-size: 1em;
        margin: 20px 0;
    }

    .emphasis::before {
        left: 16px;
        font-size: 1.6em;
    }

    .highlight-box::before {
        top: -10px;
        left: 16px;
        width: 24px;
        height: 24px;
        font-size: 1.1em;
    }

    .logic-chain {
        padding: 20px;
    }

    .logic-step {
        padding: 12px 16px 12px 48px;
    }

    .logic-step::before {
        left: 16px;
        width: 20px;
        height: 20px;
    }

    .true-false-options {
        grid-template-columns: 1fr;
    }

    .matching-container {
        grid-template-columns: 1fr;
    }

    .btn-container {
        flex-direction: column;
    }

    .btn-container button {
        width: 100%;
    }

    /* Навигация остается горизонтальной (НЕ меняем flex-direction) */
    .compact-navigation {
        /* flex-direction остается row по умолчанию */
        gap: 8px;
    }

    .nav-btn {
        /* width: auto для компактных кнопок - НЕ растягивать! */
        width: auto !important;
        padding: 8px 12px;
        font-size: 0.85em;
        flex-shrink: 0;
    }
}

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

    /* Главная страница */
    .container {
        padding: 12px;
    }

    .lesson-card {
        padding: 16px;
    }

    /* Страница урока */
    .content-wrapper {
        border-radius: 0;
    }

    .lesson-content {
        padding: 20px 16px;
    }

    h1 {
        font-size: 1.5em;
    }

    .theme {
        padding: 16px;
    }

    .theme h2 {
        font-size: 1.3em;
    }

    /* .quiz padding убран, так как теперь у .quiz нет padding */

    .question {
        padding: 16px;
    }

    .option, .tf-option, .match-item {
        padding: 12px 16px;
    }

    .sequence-item {
        padding: 12px;
        padding-left: 48px;
    }

    .btn-container button {
        padding: 14px 28px;
        font-size: 1em;
    }

    /* Навигационные кнопки - компактные */
    .nav-btn {
        padding: 8px 10px !important;
        font-size: 0.9em !important;
        min-width: auto !important;
        width: auto !important;
    }

    .logic-chain {
        padding: 16px;
    }

    blockquote, .quote-block {
        padding: 16px 20px 16px 48px;
        font-size: 0.95em;
        margin: 16px 0;
    }

    blockquote::before, .quote-block::before {
        left: 12px;
        font-size: 1.4em;
    }

    .quote-author {
        font-size: 0.85em;
        margin-top: 12px;
    }

    .emphasis {
        padding: 16px 20px 16px 48px;
        font-size: 0.95em;
        margin: 16px 0;
    }

    .emphasis::before {
        left: 12px;
        font-size: 1.4em;
    }

    .certificate-box {
        padding: 28px;
    }

    .completion-icon {
        font-size: 4em;
    }

    .completion h2 {
        font-size: 1.6em;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px 12px;
    }

    .message {
        padding: 14px 18px;
        font-size: 0.95em;
    }

    .message-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .message-actions {
        flex-direction: column;
    }

    .btn-hint,
    .btn-retry {
        width: 100%;
        text-align: center;
    }
}

/* ========== ИКОНКИ ========== */

/* Отступы для иконок Font Awesome */
.fa, .fas, .far, .fal, .fab {
    margin-right: 6px;
}

/* Иконки в кнопках без отступа справа, если они единственные */
button > .fa:only-child,
button > .fas:only-child,
button > .far:only-child,
button > .fal:only-child,
button > .fab:only-child {
    margin-right: 0;
}

/* Иконки в заголовках */
h1 .fa, h1 .fas, h1 .far, h1 .fal, h1 .fab,
h2 .fa, h2 .fas, h2 .far, h2 .fal, h2 .fab,
h3 .fa, h3 .fas, h3 .far, h3 .fal, h3 .fab {
    margin-right: 10px;
}

/* ========== УТИЛИТЫ ========== */

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

.text-muted {
    color: var(--text-muted);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ========== АНИМАЦИИ ========== */

.fade-in {
    animation: fadeIn 0.4s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* Overlay для мобильного меню */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== v5.0: ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА (iOS-СТИЛЬ) ========== */

/* Overlay для панели языка */
.language-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.language-sheet-overlay.show {
    display: block;
    opacity: 1;
}

/* Панель выбора языка (выезжает снизу) */
.language-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-sheet.open {
    transform: translateY(0);
}

.language-sheet-content {
    background: var(--white);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.language-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1em;
}

.sheet-close-btn {
    background: none;
    border: none;
    font-size: 1.3em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

/* Опции языка */
.language-options {
    padding: 12px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1em;
    text-align: left;
}

.language-option:hover {
    background: var(--light-bg);
}

.language-option.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.language-option.active .language-check {
    opacity: 1;
    color: var(--primary);
}

.language-check {
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--primary);
    width: 20px;
    flex-shrink: 0;
}

.language-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-dark);
}

.language-code {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--light-bg);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .language-sheet-header {
        padding: 16px 20px;
        font-size: 1em;
    }

    .language-option {
        padding: 14px 20px;
    }

    .language-options {
        max-height: 60vh;
    }
}

/* ========== v5.0: СИСТЕМА НАГРАД ========== */

.reward-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.reward-content {
    background: white;
    padding: 48px;
    border-radius: 24px;
    text-align: center;
    max-width: 500px;
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.reward-content.show {
    transform: scale(1);
}

.badge-icon-large {
    font-size: 120px;
    margin-bottom: 24px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.reward-title {
    font-size: 2em;
    margin-bottom: 12px;
    color: var(--primary);
}

.reward-message {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.badge-name {
    font-size: 1.5em;
    margin: 24px 0;
    color: var(--success);
}

.completion-stats {
    background: var(--light-bg);
    padding: 24px;
    border-radius: 12px;
    margin: 24px 0;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* ========== v5.0: БЕЙДЖИ "ПРОЙДЕНО" НА КАРТОЧКАХ ========== */

.lesson-card {
    position: relative; /* Для позиционирования бейджа */
}

.completion-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
}

.completion-badge .badge-icon {
    font-size: 1.2em;
}

.completion-badge .badge-date {
    font-size: 0.85em;
    opacity: 0.9;
}

.lesson-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ========== АДАПТИВНОСТЬ ДЛЯ НАГРАД ========== */

@media (max-width: 768px) {
    .reward-content {
        padding: 32px 24px;
        max-width: 90%;
        margin: 0 20px;
    }

    .badge-icon-large {
        font-size: 80px;
    }

    .reward-title {
        font-size: 1.5em;
    }

    .badge-name {
        font-size: 1.2em;
    }

    .completion-stats {
        padding: 16px;
    }

    .completion-badge {
        top: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .reward-content {
        padding: 24px 16px;
    }

    .badge-icon-large {
        font-size: 60px;
    }

    .completion-badge {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
    }

    .completion-badge .badge-date {
        font-size: 0.75em;
    }
}

/* ============================================
   AUDIO PLAYER (for MP3-based lessons)
   ============================================ */

.audio-player-container {
    position: sticky;
    top: 60px; /* Below the header */
    z-index: 900;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 12px 20px;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.audio-play-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.audio-play-btn i {
    display: block;
    line-height: 1;
}

.audio-play-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-time {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}

.audio-progress-container {
    flex: 1;
    min-width: 0;
}

.audio-progress-bar {
    height: 6px;
    background: var(--light-bg);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-speed-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 42px;
    text-align: center;
}

.audio-speed-btn:hover {
    background: var(--light-bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* Timecode links for audio navigation */
.timecode-audio {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), rgba(var(--primary-rgb), 0.12));
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.timecode-audio:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateX(2px);
    box-shadow: 0 4px 8px rgba(var(--primary-rgb), 0.25);
}

.timecode-audio:hover i {
    color: white;
}

.timecode-audio i {
    color: var(--primary);
    font-size: 1.1em;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .audio-player-container {
        top: 50px;
        padding: 10px 16px;
    }

    .audio-player {
        gap: 12px;
    }

    .audio-play-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .audio-time {
        font-size: 12px;
        min-width: 40px;
    }

    .audio-speed-btn {
        font-size: 12px;
        padding: 5px 10px;
        min-width: 38px;
    }

    .timecode-audio {
        padding: 8px 12px;
        font-size: 14px;
        gap: 6px;
    }

    .timecode-audio i {
        font-size: 1em;
    }
}

/* ============================================
   TRANSLATION BUTTON STYLES
   ============================================ */

.translation-section {
    margin: 20px 16px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

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

.translation-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.translation-info i {
    color: var(--primary);
}

.btn-generate-translation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary), #667eea);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-generate-translation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4);
}

.btn-generate-translation:active {
    transform: translateY(0);
}

.btn-generate-translation i {
    font-size: 18px;
}

.translation-note {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

/* Translation Progress */
.translation-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.progress-label i {
    color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #667eea);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   CONTENT SECTION (для расширенного режима)
   ============================================ */

.content-section {
    margin: 20px 0;
    padding: 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-left: 4px solid #6c63ff;
}

.content-section[data-icon="book"] {
    border-left-color: #6c63ff; /* Синий - контекст */
}

.content-section[data-icon="lightbulb"] {
    border-left-color: #ffc107; /* Желтый - объяснение */
}

.content-section[data-icon="info"] {
    border-left-color: #17a2b8; /* Голубой - информация */
}

.content-section[data-icon="key"] {
    border-left-color: #28a745; /* Зеленый - практика */
}

.content-section[data-icon="eye"] {
    border-left-color: #e83e8c; /* Розовый - наблюдение */
}

.content-section[data-icon="target"] {
    border-left-color: #fd7e14; /* Оранжевый - цель */
}

.section-title {
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    font-size: 1.1em;
    opacity: 0.8;
}

.section-content {
    margin-top: 10px;
}

.section-content > p:first-child {
    margin-top: 0;
}

.section-content > p:last-child {
    margin-bottom: 0;
}

/* Вложенные элементы в секции */
.section-content .emphasis {
    margin: 12px 0;
}

.section-content table {
    margin: 12px 0;
}

.section-content ul {
    margin: 8px 0;
}

.section-content .logic-chain {
    margin: 12px 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .translation-section {
        margin: 16px 12px;
        padding: 12px;
    }

    .btn-generate-translation {
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-generate-translation i {
        font-size: 16px;
    }
}
