/* Базовые плавные переходы для тем оформления */
        html, body, .lang-section, .btn-back, summary, a.file-link, .welcome-card, .feature-card {
            transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
        }

        :root {
            --bg-main: #1a1a1a;
            --bg-panel: #141414;
            --text-color: #e0e0e0;
            --accent: #e65100;
            --accent-hover: #f57c00;
            --border: #27272a;
            --header-text: #f97316;
        }

        body { 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg-main); 
            color: var(--text-color); 
            max-width: 850px; 
            margin: 0 auto; 
            padding: 20px 20px 60px 20px; 
            line-height: 1.6;
        }

        /* Навигация */
        .nav-bar {
            display: flex;
            justify-content: flex-start;
            margin-bottom: 20px;
        }
        .btn-back {
            background: transparent;
            color: var(--text-color);
            border: 1px solid var(--border);
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            text-decoration: none;
            font-weight: 500;
            font-size: 0.9rem;
        }
        .btn-back:hover {
            background: var(--bg-panel);
            border-color: var(--accent);
            color: var(--accent);
        }

        /* Большое двуязычное окно приветствия / контактов */
        .welcome-card {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 25px;
            margin-bottom: 40px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.15);
        }
        .welcome-grid {
            /*display: grid;*/
            display: block;
            /*width: 100%;*/
            grid-template-columns: 1fr;
            gap: 25px;
        }
        @media (max-width: 650px) {
            .welcome-grid { grid-template-columns: 1fr; }
        }
        .welcome-side {
            display: flex;
            width: 100%;
            max-width: 100%;
            flex-direction: column;
            justify-content: flex-start; 
            align-items: center; /* Центрирует элементы по горизонтали */
            text-align: center;  /* Центрирует весь текст и ссылки */
        }
        
        /*.info-block {
            min-height: 70px; 
            margin-bottom: 10px;
        }
        .info-block:first-child {
            min-height: 90px;
        }*/

        .info-block, 
        .info-block:first-child {
            min-height: auto; 
            margin-bottom: 15px;
        }
        
        @media (max-width: 650px) {
            .info-block { min-height: auto; } 
        }
        .welcome-card h2 {
            margin-top: 0;
            font-size: 1.3rem;
            color: var(--header-text);
        }
        .welcome-card p {
            font-size: 0.95rem;
            opacity: 0.85;
            margin-bottom: 15px;
        }
        .contact-action {
            font-weight: 600;
            font-size: 1rem;
        }
        .contact-action a {
            color: var(--accent);
            text-decoration: none;
            border-bottom: 1px dashed var(--accent);
        }
        .contact-action a:hover {
            color: var(--accent-hover);
            border-bottom-style: solid;
        }

        h1 {
            text-align: center;
            font-size: 2rem;
            font-weight: 700;
            color: var(--header-text);
            margin-bottom: 25px;
            letter-spacing: -0.025em;
        }

        /* Стили разделов языков */
        .lang-section {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
            margin-bottom: 15px;
            padding: 5px 10px;
        }
        
        details { margin-bottom: 5px; }
        summary {
            padding: 12px 10px;
            cursor: pointer;
            list-style: none;
            outline: none;
            font-weight: 600;
            display: flex;
            align-items: center;
            border-radius: 6px;
        }
        summary::before {
            content: '→';
            margin-right: 12px;
            color: var(--accent);
            font-weight: bold;
            transition: transform 0.2s ease;
        }
        details[open] > summary::before { transform: rotate(90deg); }
        summary:hover {
            background: rgba(128, 128, 128, 0.05);
            color: var(--accent-hover);
        }

        .level-section { margin-left: 20px; padding-left: 5px; }
        .subfolder { margin-left: 20px; }

        ul { list-style-type: none; padding-left: 25px; margin: 5px 0 15px 0; }
        li { margin-bottom: 8px; display: flex; align-items: center; }
        li::before {
            content: "•";
            color: var(--border);
            margin-right: 10px;
            font-size: 1.2rem;
        }
        
        a.file-link {
            color: var(--text-color);
            text-decoration: none;
            font-size: 0.95rem;
            opacity: 0.9;
        }
        a.file-link:hover { color: var(--accent); text-decoration: underline; }
        
        .empty-msg {
            text-align: center;
            color: var(--text-color);
            opacity: 0.5;
            margin-top: 30px;
        }

        /* --- Секция презентации генераторов --- */
        .showcase-section {
            margin-top: 60px;
            border-top: 1px solid var(--border);
            padding-top: 40px;
        }
        .showcase-title {
            text-align: center;
            font-size: 1.6rem;
            color: var(--header-text);
            margin-bottom: 30px;
        }
        .features-grid {
            display: grid;
            /* Автоматически распределяет карточки по ширине, минимум 260px на карточку */
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 20px;
        }
        @media (max-width: 650px) {
            .features-grid { grid-template-columns: 1fr; }
        }
        .feature-card {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 20px;
            display: flex;
            flex-direction: column;
        }
        /* Контейнер для скриншота */
        .screenshot-wrapper {
            width: 100%;
            height: 150px;
            margin-bottom: 15px;
            border-radius: 6px;
            border: 1px solid var(--border);
            overflow: hidden;
            background: rgba(0,0,0,0.2);
            cursor: pointer; /* <--- указатель */
        }
        .screenshot-wrapper img {
            width: 100%;
            height: 100%;
            object-fit: cover; /* Кадрирует скриншот внутри рамки */
            transition: transform 0.3s ease;
        }
        /* Эффект увеличения скриншота при наведении на карточку */
        .feature-card:hover .screenshot-wrapper img {
            transform: scale(1.05);
        }
        .feature-card h3 {
            margin-top: 0;
            margin-bottom: 12px;
            font-size: 1.1rem;
            color: var(--accent);
        }

        .feature-card p {
            font-size: 0.9rem;
            opacity: 0.8;
            margin: auto 0 0 0; /* Прижимает текст к низу, если заголовки разной длины */
        }

        /* Стили модального окна плеера */
        .modal {
            display: none; 
            position: fixed; 
            z-index: 1000; 
            left: 0; top: 0; 
            width: 100%; height: 100%; 
            background-color: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(5px);
            overflow-y: auto;
            padding: 20px 0;
        }
        .modal-content {
            margin: 40px auto;
            padding: 24px;
            width: 90%;
            max-width: 950px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: var(--bg-panel);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
            position: relative;
        }
        .close-modal {
            color: var(--text-color);
            float: right;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid var(--border);
            padding: 6px 12px;
            border-radius: 6px;
            background: rgba(255,255,255,0.02);
        }
        .close-modal:hover { background: rgba(255,255,255,0.08); color: var(--accent); }
        video {
            width: 100%;
            max-height: 70vh;
            display: block;
            margin: 20px auto 0 auto;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: #000;
            object-fit: contain;
        }
        /* Dojo Match */
        .match-arena {
            display: grid;
            grid-template-columns: 1fr 1.5fr;
            gap: 20px;
            margin-top: 20px;
        }
        @media (max-width: 650px) {
            .match-arena { grid-template-columns: 1fr; }
        }
        .match-column {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .match-card {
            background: var(--bg-main);
            border: 1px solid var(--border);
            padding: 12px 16px;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
            transition: all 0.2s ease;
            font-size: 0.95rem;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            min-height: 45px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .match-card:hover {
            border-color: var(--accent);
            transform: translateY(-1px);
        }
        /* Состояния карт */
        .match-card.selected {
            border-color: var(--accent) !important;
            background: rgba(230, 81, 0, 0.15);
            box-shadow: 0 0 10px rgba(230, 81, 0, 0.4);
        }
        .match-card.matched {
            border-color: #16a34a !important;
            background: rgba(22, 163, 74, 0.1) !important;
            color: #4ade80 !important;
            cursor: default;
            opacity: 0.6;
            pointer-events: none;
            text-decoration: line-through;
        }
        .match-card.error {
            border-color: #dc2626 !important;
            background: rgba(220, 38, 38, 0.15) !important;
            animation: shake 0.3s ease-in-out;
        }
        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-6px); }
            75% { transform: translateX(6px); }
        }
        
        .score-banner {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0,0,0,0.25);
            padding: 10px 20px;
            border-radius: 8px;
            border: 1px solid var(--border);
            margin-bottom: 15px;
        }
        .combo-badge {
            background: var(--accent);
            color: white;
            padding: 2px 8px;
            border-radius: 12px;
            font-weight: bold;
            font-size: 0.8rem;
            display: none;
        }

        /* Общий контейнер — обычный блок, чтобы баннер растягивался на 100% */
        #match-game-area {
            display: none;
            width: 100%;
            margin-top: 20px;
        }

        /* Интерактивная арена под баннером — вот она уже Grid-сетка */
        .match-arena {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(3, auto);
            gap: 15px;
            align-items: center;
            justify-content: center;
            max-width: 650px;
            margin: 25px auto 0 auto;
            position: relative;
            box-sizing: border-box;
        }

        /* Центральное слово: отвязываем жесткие цвета, берем переменные темы */
        .match-card.active-word {
            grid-column: 2;
            grid-row: 2;
            font-size: 1.4rem;
            font-weight: bold;
            text-align: center;
            /* Используем цвета твоей темы */
            background: rgba(255, 255, 255, 0.05); 
            color: var(--text-color);
            border: 3px solid var(--accent); 
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
            z-index: 10;
            padding: 15px 10px;
            border-radius: 8px;
        }

        /* Карточки определений вокруг */
        .match-card.def-option {
            font-size: 0.95rem;
            min-height: 70px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            padding: 10px;
        }

        /* Позиции в сетке */
        .pos-top    { grid-column: 2; grid-row: 1; }
        .pos-bottom { grid-column: 2; grid-row: 3; }
        .pos-left   { grid-column: 1; grid-row: 2; }
        .pos-right  { grid-column: 3; grid-row: 2; }

        /* Адаптив под мобилки */
        @media (max-width: 500px) {
            .match-arena {
                gap: 10px;
            }
            .match-card.def-option {
                font-size: 0.85rem;
                min-height: 60px;
                padding: 6px;
            }
            .match-card.active-word {
                font-size: 1.2rem;
            }
        }

        /* --- Стили для публичного кроссворда Daily Dojo --- */
        /* === ВЕЧНАЯ ЗИМНЯЯ СТАБИЛИЗАЦИЯ ПОЛЯ КРОССВОРДА (АНТИ-ГОБЛИН) === */
        #cw-table { 
            border-collapse: collapse; 
            background: #0f172a !important; /* Глубокий ледник вместо динамического фона */
            width: max-content; 
            margin: 0 auto; 
            box-shadow: 0 0 20px rgba(56, 189, 248, 0.25); /* Ледяное неоновое свечение по контуру */
        }
        #cw-table td {
            width: 40px; 
            min-width: 40px;
            height: 40px; 
            min-height: 40px;
            border: 1px solid #38bdf8 !important; /* Стенки ячеек высечены из чистого льда */
            position: relative; 
            text-align: center; 
            vertical-align: middle; 
            padding: 0;
            box-sizing: border-box; 
        }
        /* Пустые неактивные зоны — вечная мерзлота, куда гоблинам ходу нет */
        .cw-cell-black { 
            background-color: #0b1329 !important; 
        }
        /* Активные клетки — плотный арктический снег для идеального контраста */
        .cw-cell-active { 
            background-color: #ffffff !important; 
            border: 2px solid #0ea5e9 !important; /* Усиленный ледяной каркас */
        }
        #cw-table td input {
            width: 100%; 
            height: 100%; 
            border: none; 
            background: transparent !important;
            text-align: center; 
            font-size: 16px; 
            font-weight: bold;
            color: #0f172a !important; /* Угольно-темный морозный цвет букв — читаемость 100% */
            text-transform: uppercase; 
            outline: none; 
            padding: 0; 
            margin: 0;
            -webkit-appearance: none; 
            appearance: none;
            border-radius: 0;
            box-sizing: border-box; 
            line-height: 40px; 
        }
        /* Номера вопросов — сигнальный рубиновый маркер на белом снегу */
        .cw-cell-number {
            position: absolute; 
            top: 1px; 
            left: 3px;
            font-size: 11px; 
            color: #e11d48 !important; 
            font-weight: bold; 
            pointer-events: none;
            z-index: 2;
        }
        /* Клетка под магической подсказкой — цвет талого ледникового озера */
        #cw-table input.cw-hinted { 
            color: #0369a1 !important; 
            background-color: #e0f2fe !important; 
        }
        /* Абсолютно верный финальный ответ — сибирская хвоя под инеем */
        #cw-table input.cw-correct { 
            background-color: #bbf7d0 !important; 
            color: #166534 !important;
        }

        /* --- Стили для Ледяного Банка Слов --- */
        #cw-words-toggle-btn:hover {
            background: #38bdf8 !important;
            box-shadow: 0 0 15px #38bdf8;
            transform: scale(1.02);
        }
        .cw-word-pill {
            background: #1e293b;
            border: 1px solid #0ea5e9;
            padding: 4px 10px;
            border-radius: 4px;
            font-weight: bold;
            letter-spacing: 1px;
            text-transform: uppercase;
            box-shadow: inset 0 0 5px rgba(56, 189, 248, 0.2);
        }

        /* Состояние слова, когда ученик его нейтрализовал кликом */
        .cw-word-pill.cw-used {
            text-decoration: line-through;
            text-decoration-color: #e11d48 !important; /* Кроваво-красная линия вычеркивания */
            text-decoration-thickness: 2px;
            color: #475569 !important; /* Уходит в глубокий темно-серый цвет */
            background: #0b1329 !important; /* Почти сливается с фоном контейнера */
            border-color: #1e293b !important; /* Погашенные ледяные рамки */
            opacity: 0.5; /* Полупрозрачность для снижения визуального шума */
            box-shadow: none !important;
            transform: none !important;
        }
        
        /* Анти-гоблинский адаптивный щит для списков вопросов */
        .cw-clues-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }

        /* Когда ширина экрана становится меньше 650px, колонки перестраиваются в одну линию */
        @media (max-width: 650px) {
            .cw-clues-grid {
                grid-template-columns: 1fr;
                gap: 25px; /* Немного увеличим отступ между блоками по вертикали */
            }
        }

        /* Выравнивание кнопок управления кроссвордом */
        .cw-controls-row {
            display: flex;
            gap: 15px;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap; /* Позволяет элементам аккуратно вставать в два ряда, если экран совсем узкий */
        }

        @media (max-width: 480px) {
            .cw-controls-row {
                gap: 10px; /* Слегка жмем отступы на самых крошечных экранах */
            }
        }

        /* --- Стили для Системы Вкладок Упражнений --- */
        .exercise-tabs-nav {
            display: flex;
            gap: 12px;
            justify-content: center;
            margin-bottom: 20px;
        }
        .tab-trigger {
            background: var(--bg-panel);
            color: var(--text-color);
            border: 1px solid var(--border);
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
            font-size: 1rem;
            transition: all 0.3s ease;
        }
        .tab-trigger.active {
            background: var(--accent);
            border-color: var(--accent);
            color: #ffffff;
            box-shadow: 0 0 12px var(--accent);
        }

        /* --- Стили для Скрембла (Порядка Слов) --- */
        .scrambled-pool, .scrambled-result {
            min-height: 60px;
            padding: 12px;
            background: rgba(0, 0, 0, 0.25);
            border: 1px dashed var(--border);
            border-radius: 8px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            justify-content: center;
            margin-bottom: 15px;
        }
        .scrambled-result {
            border: 2px solid var(--accent);
            background: rgba(0, 0, 0, 0.4);
        }
        .word-token {
            background: var(--bg-main);
            color: var(--text-color);
            border: 1px solid var(--border);
            padding: 8px 14px;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            user-select: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
            transition: transform 0.1s, background-color 0.2s, border-color 0.2s;
        }
        .word-token:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
        }
        .word-token:active {
            transform: translateY(0);
        }

        .hp-field {
            position: absolute;
            left: -9999px;
            top: -9999px;
        }

        /* 🎯 Стилизация секции формы по центру */
        .form-section {
            max-width: 600px;
            margin: 40px auto 0 auto;
            padding-top: 30px;
            border-top: 1px solid #1e293b;
        }

        .form-headers {
            text-align: center;
            margin-bottom: 24px;
        }

        .form-heading-ru {
            color: #ffffff;
            font-size: 16px;
            font-weight: 600;
            margin: 0 0 4px 0;
        }

        .form-heading-en {
            color: #64748b;
            font-size: 14px;
            margin: 0;
        }

        /* Форма и крупные элементы ввода */
        .centered-lead-form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .form-group label {
            font-size: 13px;
            color: #94a3b8;
            font-weight: 500;
            padding-left: 4px;
        }

        /* Крупные поля ввода */
        .centered-lead-form input[type="email"],
        .centered-lead-form select,
        .centered-lead-form textarea {
            background-color: #152238; /* Поля чуть светлее фона */
            border: 1.5px solid #1e293b;
            border-radius: 8px;
            padding: 14px 18px; /* Крупные отступы */
            font-size: 16px;     /* Крупный текст */
            color: #ffffff;
            outline: none;
            transition: all 0.2s ease;
            width: 100%;
            box-sizing: border-box;
            font-family: inherit;
        }

        .centered-lead-form textarea {
            resize: vertical; /* Разрешаем менять размер только по вертикали */
        }

        /* Эффект фокуса */
        .centered-lead-form input:focus,
        .centered-lead-form select:focus,
        .centered-lead-form textarea:focus {
            border-color: #0091ff;
            box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.25);
            background-color: #1a2942;
        }

        /* Крупная кнопка отправки */
        .large-submit-btn {
            background-color: #0091ff;
            color: #ffffff;
            border: none;
            border-radius: 8px;
            padding: 16px 20px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.2s, transform 0.1s;
            margin-top: 10px;
        }

        .large-submit-btn:hover {
            background-color: #0077d6;
        }

        .large-submit-btn:active {
            transform: scale(0.99);
        }

        /* Непробиваемый Honeypot */
        .hp-field {
            position: absolute;
            left: -9999px;
            top: -9999px;
            opacity: 0;
            width: 0;
            height: 0;
            overflow: hidden;
        }

        /* Адаптивность для планшетов и мобилок */
        @media (max-width: 768px) {
            .welcome-grid {
                flex-direction: column;
                gap: 30px;
            }
            .welcome-card {
                padding: 20px;
                margin: 10px;
            }
        }

        /* Контейнер для уведомлений (всегда поверх всего) */
        .toast-container {
            position: fixed;
            bottom: 24px;
            right: 24px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 12px;
            pointer-events: none; /* Чтобы контейнер не мешал кликам, когда пуст */
        }

        /* Сама плашка уведомления */
        .toast {
            pointer-events: auto; /* А вот на само уведомление кликнуть можно */
            background-color: #2e7d32; /* Спокойный зеленый для успеха */
            color: #ffffff;
            padding: 14px 24px;
            border-radius: 8px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            font-family: sans-serif; /* Или ваш основной шрифт */
            font-size: 14px;
            font-weight: 500;
            line-height: 1.4;
            min-width: 250px;
            max-width: 350px;
            
            /* Эффект плавного появления снизу вверх */
            opacity: 0;
            transform: translateY(30px) scale(0.9);
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        /* Класс, который мы будем вешать через JS для анимации */
        .toast.show {
            opacity: 1;
            transform: translateY(0) scale(1);
        }

        /* Если прилетит ошибка (например, не тот формат email или упал сервер) */
        .toast.error {
            background-color: #d32f2f; /* Красный цвет */
        }

        /* Адаптив под мобилки (уведомление будет падать по центру снизу) */
        @media (max-width: 480px) {
            .toast-container {
                bottom: 16px;
                left: 16px;
                right: 16px;
                align-items: center;
            }
            .toast {
                min-width: auto;
                width: 100%;
                text-align: center;
            }
        }