/*
 * Плагин GEN
 * Основные стили плагина GEN
 * C:\wamp64\www\test-w\wp-content\plugins\GEN\css\gen-styles.css
 */

/* Общие стили для модулей */
h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

/* Аккордеон для теории */
.gen-theory-accordion {
    margin-bottom: 20px;
}

.gen-theory-accordion h3 {
    cursor: pointer;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0;
    font-size: 18px;
    position: relative;
}

.gen-theory-accordion h3:after {
    content: '+';
    position: absolute;
    right: 15px;
    top: 10px;
}

.gen-theory-accordion h3.active:after {
    content: '-';
}

.gen-section-theory {
    min-height: 0px !important;
    /* Убираем минимальную высоту 200*/
}

.gen-theory-content {

    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    /* border-top: none; */
    border-radius: 10px 10px 10px 10px;
    display: block;
    line-height: 1.2;
    font-size: 14px;
}

.gen-theory-content-hidden {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Отдельное упражнение */
.gen-exercise {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.gen-exercise-sentence {
    margin-bottom: 5px;
    font-size: 16px;
}

/* Поле ввода */
.gen-exercise-input {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    margin: 0 5px;
}

/* Правильный ответ */
.gen-correct-answer {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Неправильный ответ */
.gen-wrong-answer {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Обратная связь */
.gen-exercise-feedback {
    margin-top: 5px;
    font-size: 14px;
}

.gen-correct {
    color: #28a745;
    font-weight: bold;
}

.gen-wrong {
    color: #dc3545;
    font-weight: bold;
}

/* Кнопки управления */
.gen-exercise-controls {
    margin-top: 20px;
}

.gen-exercise-controls button {
    padding: 8px 15px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.gen-check-answers {
    background-color: #4CAF50;
    color: white;
}

.gen-show-answers {
    background-color: #2196F3;
    color: white;
}

.gen-reset-answers {
    background-color: #f44336;
    color: white;
}

/* Сообщения об ошибках */
.gen-error-message {
    padding: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    margin-bottom: 20px;
}

/* Аккордеон для информации */
.gen-info-accordion {
    margin-bottom: 20px;
}

.gen-info-accordion h3 {
    cursor: pointer;
    padding: 10px 15px;
    background-color: #e7f3fe;
    border: 1px solid #b6d4fe;
    border-radius: 4px;
    margin: 0;
    font-size: 18px;
    position: relative;
    color: #084298;
}

.gen-info-accordion h3:after {
    content: '+';
    position: absolute;
    right: 15px;
    top: 10px;
}

.gen-info-accordion h3.active:after {
    content: '-';
}

.gen-info-content {
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #b6d4fe;
    border-top: none;
    border-radius: 0 0 4px 4px;
    display: none;
}

/* Аккордеон для заметок */
.gen-notes-accordion {
    margin-bottom: 20px;
}

.gen-notes-accordion h3 {
    cursor: pointer;
    padding: 10px 15px;
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 4px;
    margin: 0;
    font-size: 18px;
    position: relative;
    color: #664d03;
}

.gen-notes-accordion h3:after {
    content: '+';
    position: absolute;
    right: 15px;
    top: 10px;
}

.gen-notes-accordion h3.active:after {
    content: '-';
}

.gen-notes-content {
    padding: 15px;
    background-color: #fff8e1;
    border: 1px solid #ffecb5;
    border-top: none;
    border-radius: 0 0 4px 4px;
    display: none;
}

.gen-notes-textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    resize: vertical;
}

/* Аккордеон для объяснений */
.gen-explanation-accordion {
    margin-bottom: 20px;
}

.gen-explanation-accordion h3 {
    cursor: pointer;
    padding: 10px 15px;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
    border-radius: 4px;
    margin: 0;
    font-size: 18px;
    position: relative;
    color: #0f5132;
}

.gen-explanation-accordion h3:after {
    content: '+';
    position: absolute;
    right: 15px;
    top: 10px;
}

.gen-explanation-accordion h3.active:after {
    content: '-';
}

.gen-explanation-content {
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #badbcc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    display: none;
}

/* Общие стили для всех элементов плагина */
.gen-task,
.gen-sentence-de-line,
.gen-correct-sentence-line,
.gen-sentence-translation-line,
.gen-task input[type="text"],
.gen-controls,
.gen-button-container,
.gen-hinweis,
.gen-module-container {
    font-family: Arial, sans-serif;
}

/* Основной контент (.gen-module-container) - для упражнений и нижнего сайдбара */
.gen-module-container {
    position: relative;
    /* Высота центральной области без шапки и подвала */
    height: calc(100vh - var(--header-height) - var(--footer-height) - var(--gen-bottom-gap, 0px)) !important;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--gen-bottom-gap, 0px)) !important;
    max-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--gen-bottom-gap, 0px)) !important;
    flex: 1 1 auto;
    overflow: hidden !important;
    /* собственных скроллов у контейнера нет */
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    /* Белый фон для упражнений */
}

/* Контейнер упражнений */
.gen-exercises-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* 60% от высоты РОДИТЕЛЯ (.gen-module-container), а не окна */
    height: 80% !important;
    min-height: 0 !important;
    /* позволяем flex корректно распределять высоту */
    max-height: 80% !important;
    flex: 0 0 80% !important;
    padding: 0px;
    margin: 0;
    overflow: auto;
}

/* Задание */
.gen-task {
    margin-bottom: 0px;
    padding: 10px 20px 0px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    /*border-bottom: 1px solid #e0e0e0; */
}

/* Проверенное задание */
.gen-task.checked {
    background-color: #f5f5f5;
    border-left: 3px solid #28a745;
    opacity: 0.9;
}

/* Последнее задание без нижней границы */
.gen-task:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Разделитель между заданиями */
.gen-task-separator {
    height: 1px;
    background-color: #ddd;
    margin: 15px 0;
}

/* Строка с немецким предложением */
.gen-sentence-de-line {
    margin-bottom: 5px;
    font-size: 18px;
    padding: 2px 5px;
}

/* Строка с правильным ответом */
.gen-correct-sentence-line {
    margin-bottom: 5px;
    font-size: 18px;
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #28a745;
    padding: 2px 5px;
    min-height: 24px;
    border-radius: 4px;
}

/* Строка с переводом */
.gen-sentence-translation-line {
    margin-bottom: 5px;
    font-size: 16px;
    color: #a8abad;
    padding: 2px 5px;
}

/* Поля ввода */
.gen-task input[type="text"] {
    padding: 2px 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
    margin: 0 5px;
    min-width: 80px;
}

/* Правильный ответ */
.gen-task input[type="text"].gen-correct {
    border-color: #28a745;
    background-color: #e6ffe6 !important;
    color: #155724;
}

/* Неправильный ответ */
.gen-task input[type="text"].gen-incorrect {
    border-color: #dc3545;
    background-color: #ffe6e6 !important;
    color: #721c24;
}

/* Выделение правильного ответа */
.correct {
    color: #28a745;
    font-weight: bold;
}

/* Точечная подсветка фрагментов правильного ответа */
.gen-correct-answer-highlight {
    font-weight: bold;
    color: #155724;
    background-color: rgba(212, 237, 218, 0.5);
    /* полупрозрачный зелёный */
    padding: 0 2px;
    border-radius: 2px;
}

/* Правильный ответ в предложении */
span.correct {
    background-color: #d4edda;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    color: #155724;
}

/* Кнопки */
.gen-controls,
.gen-button-container {
    margin-top: 10px;
    margin-bottom: 0;
    padding: 5px;
}

.gen-controls button,
.gen-button-container button {
    margin-right: 10px;
    padding: 8px 16px;
    font-size: 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}

.gen-check-button {
    background-color: #007bff;
    color: #fff;
}

.gen-check-button:hover {
    background-color: #0069d9;
}

.gen-next-button {
    background-color: #28a745;
    color: #fff;
}

.gen-next-button:hover {
    background-color: #218838;
}

.gen-check-button:disabled,
.gen-next-button:disabled,
.gen-explain-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Нижний сайдбар */
.gen-bottom-sidebar {
    position: relative;
    width: 100%;
    /* 40% от высоты РОДИТЕЛЯ (.gen-module-container) */
    height: 20% !important;
    min-height: 0 !important;
    max-height: 20% !important;
    flex: 0 0 20% !important;
    box-sizing: border-box;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Заголовок нижнего сайдбара */
.gen-bottom-sidebar-header {
    background-color: #e0e0e0;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    flex-wrap: nowrap;
}

/* Заголовок модуля в нижнем сайдбаре */
.gen-module-title {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контент нижнего сайдбара */
.gen-bottom-sidebar-content {
    padding: 10px;
    overflow: auto;
    flex: 1;
}

/* Статистика в заголовке */
.gen-stats-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Стиль для процента статистики в нижнем сайдбаре */
.gen-stats-header .stats-percentage {
    font-size: 16px;
}

.gen-stats-percent {
    margin-right: 5px;
}

.gen-stats-correct {
    color: green;
    margin-right: 2px;
}

.gen-stats-incorrect {
    color: red;
}

/* Заголовки в сайдбаре */
.gen-bottom-sidebar h3 {
    margin-top: 15px;
    margin-bottom: 0px;
    font-size: 18px;
    color: #007bff;
    /* border-bottom: 1px solid #ddd; */
    /* Удалено */
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gen-bottom-sidebar h4 {
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

/* Блоки в сайдбаре */
.gen-task-description {
    margin-bottom: 25px;
    font-size: 14px;
    border-bottom: 1px solid #dddddd8f;
    /* Добавлено */
    padding-bottom: 15px;
    /* Добавлено */
}

.gen-theory,
.gen-stats {
    margin-bottom: 15px;
    font-size: 14px;
}

.gen-stats p {
    margin: 5px 0;
}

/* Подсказка */
.gen-hinweis {
    font-size: 14px;
    color: #6c757d;
}

/* Стили для заголовков в нижнем сайдбаре */
.gen-theory-content h2 {
    font-size: 18px;
    margin-top: 15px;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.2;
}

.gen-theory-content h3 {
    font-size: 16px;
    margin-top: 12px;
    margin-bottom: 6px;
    color: #444;
    line-height: 1.2;
}

/* Стили для таблиц в теории и блоках с рамкой */
.gen-theory-content table,
.gen-bordered-content table,
.theory-block table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
    table-layout: auto;
}

.gen-theory-content th,
.gen-theory-content td,
.gen-bordered-content th,
.gen-bordered-content td,
.theory-block th,
.theory-block td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.gen-theory-content th,
.gen-bordered-content th,
.theory-block th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.gen-theory-content tr:nth-child(even),
.gen-bordered-content tr:nth-child(even),
.theory-block tr:nth-child(even) {
    background-color: #f9f9f9;
}

#gen-task-description-content {
    padding: 15px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
    border: 1px solid #ddd;
    border-radius: 10px 10px 10px 10px;
    display: block;
    line-height: 1.2;
    font-size: 14px;
    padding-bottom: 5px;
    margin-bottom: 5px;
    /* Увеличьте этот отступ, чтобы линия была хорошо видна */



}

/* Убрали жёлтую полосу у первой строки с полем ввода в LLM-шаблоне */
.gen-llm-input-container {
    background-color: transparent;
    /* без подсветки */
}

.gen-llm-input-container.correct {
    background-color: #ccffcc;
    /* светло-зеленый */
}

.gen-llm-input-container.incorrect {
    background-color: #ffcccc;
    /* светло-красный */
}

/* Match Pairs: строки и подсветки */
.gen-matchpairs {
    display: flex;
    gap: 20px;
}

.gen-left-col,
.gen-right-col {
    flex: 1;
}

.gen-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    margin: 6px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease;
}

.gen-row .gen-row-number {
    display: inline-block;
    width: 28px;
    text-align: center;
    color: #666;
    font-weight: 600;
}

.gen-row.selected {
    outline: 2px dashed #3b82f6;
}

/* Correct — зелёная */
.gen-row.correct {
    background: #dff0d8 !important;
    border-color: #c3e6cb !important;
    color: #155724;
}

/* Wrong — красная */
.gen-row.wrong {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24;
}

/* Disabled state (после правильного ответа) */
.gen-row.correct input,
.gen-row.correct .gen-row-text {
    opacity: 0.9;
}

.gen-row.disabled,
.gen-row.correct {
    pointer-events: none;
}

/* Нижний сайдбар: фиксированная высота 40% окна */
.gen-sidebar-lower {
    box-sizing: border-box;
    height: 20vh;
    max-height: 20vh;
    overflow: auto;
    padding: 12px;
    border-top: 1px solid #ececec;
    background: #fff;
}

/* Адаптив: на узких экранах колонки — одна под другой */
@media (max-width:900px) {
    .gen-matchpairs {
        flex-direction: column;
    }
}

/* Match Pairs: красный фон для неправильных ответов */
.gen-match-incorrect {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24;
}

/* Match Pairs: архивный блок — выравнивание левой колонки по правому краю */
.gen-match-archived .gen-match-left-list .gen-match-item .gen-match-item-text {
    text-align: right;
}

/* Архивный блок — делаем всё неинтерактивным на всякий случай */
.gen-match-archived .gen-match-item {
    pointer-events: none;
}

/* Стили для кнопок переключения между упражнениями и теорией */
.gen-module-switcher-buttons {
    display: flex;
    justify-content: flex-end;
    /* Выравнивание по правому краю */
    margin-bottom: 10px;
    /* Отступ от контейнера модуля */
    padding-right: 10px;
    /* Отступ от правого края */
}

.gen-switcher-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 8px 15px;
    margin-left: 5px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.gen-switcher-button:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.gen-switcher-button.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Обертка для контейнера упражнений и нижнего сайдбара */
.gen-exercises-and-sidebar-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    /* Занимает всю доступную высоту gen-module-container */
}

/* Контейнер для теории */
.gen-theory-content-container {
    padding: 20px;
    overflow: auto;
    height: 100%;
    /* Занимает всю доступную высоту gen-module-container */
    box-sizing: border-box;
    background-color: #fff;
}

.gen-theory-full-content {
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 10px;
    line-height: 1.6;
    font-size: 16px;
}

/* True/False Styling */
.gen-true-false-options label {
    display: block;
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.gen-true-false-options label:hover {
    background-color: #f5f5f5;
}

.gen-correct-answer-label {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724;
}

.gen-wrong-answer-label {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24;
}

/* Radio Fill Module Styling */
.gen-radio-fill-placeholder {
    display: inline-block;
    min-width: 80px;
    padding: 2px 5px;
    margin: 0 5px;
    background-color: #f7f7f7;
    border: 1px solid #ced4da;
    border-radius: 4px;
    vertical-align: middle;
    color: #333;
    font-size: 16px;
    text-align: center;
    cursor: default;
    transition: all 0.3s ease;
}

.gen-radio-fill-placeholder.filled {
    background-color: #fff;
    border-color: #007bff;
    color: #007bff;
}

.gen-radio-fill-placeholder.gen-correct-answer {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.gen-radio-fill-placeholder.gen-wrong-answer {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.gen-radio-fill-placeholder.gen-correct-answer {
    color: #155724;
    border-bottom-color: #28a745;
}

.gen-radio-fill-placeholder.gen-wrong-answer {
    color: #721c24;
    border-bottom-color: #dc3545;
}

.gen-radio-fill-options-container {
    margin-top: 25px;
}

.gen-radio-fill-options-container.gen-split-view {
    display: flex;
    gap: 20px;
}

.gen-radio-fill-group {
    flex: 1;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.gen-group-label {
    font-weight: bold;
    margin-bottom: 15px;
    color: #555;
    text-align: center;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.gen-radio-fill-grid {
    display: grid;
    gap: 10px;
}

.gen-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gen-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gen-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gen-radio-fill-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid transparent;
    /* Hide border but keep layout stable */
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
    text-align: center;
    font-size: 15px;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.gen-radio-fill-option:hover {
    background-color: #f0f4f8;
    /* border-color: #c0d0e0; Removed border */
    transform: translateY(-1px);
}

.gen-radio-fill-input {
    display: none;
}

/* Selected/Correct/Wrong states for Options */
.gen-radio-fill-option.selected {
    /* border-color: #007bff; Removed */
    background-color: #e7f1ff;
    color: #0056b3;
    font-weight: bold;
}

/* Re-declaring with higher specificity if needed, or reusing existing classes */
.gen-radio-fill-option.gen-correct-answer-label {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
}

.gen-radio-fill-option.gen-wrong-answer-label {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

/* Additional helper for disabling interactions */
.gen-radio-fill-group.disabled {
    opacity: 0.7;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .gen-radio-fill-options-container.gen-split-view {
        flex-direction: column;
    }

    .gen-grid-cols-3,
    .gen-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Chk-Box Module Styles */
.gen-chk-box-placeholder {
    display: inline-block;
    min-width: 50px;
    border-bottom: 2px solid #333;
    margin: 0 5px;
    text-align: center;
    color: #007bff;
    font-weight: bold;
}

.gen-chk-box-options-container {
    margin-top: 20px;
}

.gen-chk-box-grid {
    display: grid;
    gap: 10px;
}

.gen-chk-box-grid.gen-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gen-chk-box-grid.gen-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gen-chk-box-grid.gen-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gen-chk-box-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    background-color: #fff;
    user-select: none;
}

.gen-chk-box-option:hover {
    background-color: #f5f5f5;
}

.gen-chk-box-input {
    margin-right: 10px;
    /* Increase size slightly */
    transform: scale(1.2);
    /* Make checking visible if we hide input? No, keep it visible for checkboxes */
}

/* Selected state */
.gen-chk-box-option.selected {
    background-color: #e7f1ff;
    border-color: #007bff;
}

/* Feedback states */
.gen-chk-box-option.gen-correct-answer-label {
    background-color: #d4edda !important;
    border-color: #28a745 !important;
    color: #155724 !important;
}

.gen-chk-box-option.gen-wrong-answer-label {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24 !important;
}

.gen-chk-box-option.gen-missed-answer-label {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
    color: #856404 !important;
}

/* Button container */
.gen-chk-box-actions {
    margin-top: 20px;
}

/* Responsive adjustments for chk-box */
@media (max-width: 600px) {

    .gen-chk-box-grid.gen-grid-cols-3,
    .gen-chk-box-grid.gen-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   LEGO EXERCISE STYLES (Sentence Building)
   ======================================== */

/* Lego exercise container */
.lego-exercise {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Translation (task description) */
.lego-translation {
    font-size: 18px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
    border-radius: 4px;
}

/* Answer area container */
.lego-answer-area {
    margin-bottom: 25px;
}

/* Answer field (contenteditable) */
.lego-answer-field {
    min-height: 48px;
    /* Reduced from 60px */
    padding: 10px 15px;
    /* Reduced padding */
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #f1c40f;
    /* Yellow border initially */
    border-radius: 6px;
    background-color: #fffbef;
    /* Light yellow background initially */
    cursor: text;
    transition: all 0.3s ease;
    position: relative;
    /* Ensure height grows with content */
    height: auto;
    overflow-y: hidden;
}

.lego-answer-field:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.lego-answer-field:focus {
    outline: none;
    border-color: #f39c12;
    /* Darker yellow on focus */
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2);
}

/* Word blocks container */
.lego-word-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* Slightly reduced gap */
    margin-bottom: 20px;
    padding: 12px;
    /* Reduced padding */
    background-color: #f8f9fa;
    border-radius: 6px;
    min-height: 30px;
    /* Reduced min-height */
}

/* Individual word block */
.lego-word-block {
    padding: 6px 12px;
    /* Reduced padding */
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    background-color: #fff;
    border: 2px solid #3498db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lego-word-block:hover {
    background-color: #3498db;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.lego-word-block:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Used word block (clicked and added to answer) */
.lego-word-block.used {
    opacity: 0.4;
    pointer-events: none;
    background-color: #ecf0f1;
    border-color: #bdc3c7;
    color: #7f8c8d;
}

/* Word in answer field */
.lego-answer-word {
    display: inline-block;
    padding: 6px 12px;
    margin: 2px;
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    background-color: #e8f4f8;
    border: 1px solid #3498db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lego-answer-word:hover {
    background-color: #ffebee;
    border-color: #e74c3c;
    color: #c0392b;
}

/* Clear button */
.lego-clear-button {
    background-color: #95a5a6;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.lego-clear-button:hover {
    background-color: #7f8c8d;
}

/* Correct answer state */
.lego-exercise.correct .lego-answer-field {
    border-color: #27ae60;
    background-color: #eafaf1;
}

/* Incorrect answer state */
.lego-exercise.incorrect .lego-answer-field {
    border-color: #e74c3c;
    background-color: #fdedec;
}

/* Responsive design for lego */
@media (max-width: 768px) {
    .lego-translation {
        font-size: 16px;
        padding: 12px;
    }

    .lego-answer-field {
        min-height: 50px;
        font-size: 14px;
        padding: 12px;
    }

    .lego-word-block {
        padding: 8px 14px;
        font-size: 14px;
    }

    .lego-word-blocks {
        gap: 8px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .lego-word-blocks {
        gap: 6px;
        padding: 10px;
    }

    .lego-word-block {
        padding: 6px 12px;
        font-size: 13px;
    }

    .lego-clear-button {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
}

/* ====================================================================
   U2bHoeren Module Styles
   ==================================================================== */

.gen-u2b-hoeren-exercise {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 20px 0;
}

/* Video Section */
.u2b-video-section {
    max-width: 700px;
    margin: 0 auto 20px;
}

.u2b-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.u2b-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

.u2b-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    gap: 15px;
    border-radius: 12px;
}

.u2b-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ff6b6b;
    border-radius: 50%;
    animation: u2b-spin 1s linear infinite;
}

@keyframes u2b-spin {
    to {
        transform: rotate(360deg);
    }
}

.u2b-loading-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.u2b-video-info {
    margin-top: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4ecdc4;
}

.u2b-video-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.4;
}

.u2b-video-meta {
    font-size: 13px;
    color: #666;
    display: flex;
    gap: 15px;
}

.u2b-video-channel::before {
    content: '📺 ';
}

.u2b-video-duration::before {
    content: '⏱ ';
}

/* Questions Section */
.u2b-questions-section {
    margin-top: 25px;
}

.u2b-questions-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4ecdc4;
}

.u2b-questions-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

.u2b-question-block {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.u2b-question-block:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.u2b-question-text {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.5;
}

.u2b-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.u2b-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.u2b-option:hover {
    border-color: #4ecdc4;
    background: #e8f8f7;
}

.u2b-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #4ecdc4;
}

.u2b-option-text {
    flex: 1;
    color: #333;
    line-height: 1.4;
}

/* Checked state */
.u2b-option:has(input:checked) {
    border-color: #4ecdc4;
    background: #e8f8f7;
}

/* Result states */
.u2b-option.correct {
    background: #d4edda !important;
    border-color: #28a745 !important;
}

.u2b-option.correct .u2b-option-text {
    color: #155724;
}

.u2b-option.correct::after {
    content: '✓';
    margin-left: auto;
    color: #28a745;
    font-weight: bold;
    font-size: 18px;
}

.u2b-option.incorrect {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
}

.u2b-option.incorrect .u2b-option-text {
    color: #721c24;
}

.u2b-option.incorrect::after {
    content: '✗';
    margin-left: auto;
    color: #dc3545;
    font-weight: bold;
    font-size: 18px;
}

.u2b-option.missed {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
}

.u2b-option.missed .u2b-option-text {
    color: #856404;
}

.u2b-option.missed::after {
    content: '!';
    margin-left: auto;
    color: #856404;
    font-weight: bold;
    font-size: 18px;
}

/* Controls */
.u2b-controls {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.u2b-check-btn,
.u2b-next-btn {
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.u2b-check-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #44b8b0 100%);
    color: white;
}

.u2b-check-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #44b8b0 0%, #3aa39c 100%);
    transform: translateY(-1px);
}

.u2b-check-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.u2b-next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.u2b-next-btn:hover {
    background: linear-gradient(135deg, #5a6fd9 0%, #6a4292 100%);
    transform: translateY(-1px);
}

/* Feedback */
.u2b-feedback {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 15px;
}

.u2b-feedback.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
}

.u2b-feedback.partial {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    color: #856404;
}

.u2b-feedback.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #dc3545;
    color: #721c24;
}

/* Error message */
.u2b-error-message {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    color: #856404;
}

.u2b-error-icon {
    font-size: 32px;
}

.u2b-error-text strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.u2b-error-text p {
    margin: 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .gen-u2b-hoeren-exercise {
        padding: 15px;
    }

    .u2b-options-grid {
        grid-template-columns: 1fr;
    }

    .u2b-question-block {
        padding: 15px;
    }

    .u2b-controls {
        flex-direction: column;
    }

    .u2b-check-btn,
    .u2b-next-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .u2b-video-info {
        padding: 10px 12px;
    }

    .u2b-video-title {
        font-size: 14px;
    }

    .u2b-video-meta {
        flex-direction: column;
        gap: 5px;
    }

    .u2b-option {
        padding: 10px 12px;
    }
}

/* ====================================================================
   TTSSST Module Styles (Text-to-Speech / Speech-to-Text)
   ==================================================================== */

/* Контейнер панели управления */
.gen-ttssst-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

/* Группы TTS и SST */
.ttssst-tts-group,
.ttssst-sst-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Разделитель */
.ttssst-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

/* Кнопки */
.ttssst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ttssst-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.ttssst-btn:active {
    transform: scale(0.95);
}

.ttssst-btn .ttssst-icon {
    font-size: 16px;
    line-height: 1;
}

/* Кнопка микрофона в режиме записи */
.ttssst-mic.recording {
    background: rgba(255, 59, 48, 0.8);
    animation: pulse-recording 1s infinite;
}

.ttssst-mic.recording .ttssst-icon {
    color: white;
}

@keyframes pulse-recording {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    }
}

/* Кнопка Стоп+Проверить */
.ttssst-stop-check {
    background: rgba(52, 199, 89, 0.3);
}

.ttssst-stop-check:hover {
    background: rgba(52, 199, 89, 0.5);
}

/* Toggle переключатели */
.ttssst-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.ttssst-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ttssst-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: 0.3s;
}

.ttssst-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ttssst-toggle input:checked+.ttssst-slider {
    background-color: #4cd964;
}

.ttssst-toggle input:checked+.ttssst-slider:before {
    transform: translateX(16px);
}

.ttssst-toggle input:focus+.ttssst-slider {
    box-shadow: 0 0 0 2px rgba(76, 217, 100, 0.3);
}

/* Адаптивность TTSSST */
@media (max-width: 768px) {
    .gen-ttssst-controls {
        gap: 4px;
        padding: 2px 4px;
        margin-right: 8px;
    }

    .ttssst-btn {
        width: 28px;
        height: 28px;
    }

    .ttssst-btn .ttssst-icon {
        font-size: 14px;
    }

    .ttssst-toggle {
        width: 32px;
        height: 18px;
    }

    .ttssst-slider:before {
        height: 14px;
        width: 14px;
    }

    .ttssst-toggle input:checked+.ttssst-slider:before {
        transform: translateX(14px);
    }
}

/* Тёмная тема TTSSST */
@media (prefers-color-scheme: dark) {
    .gen-ttssst-controls {
        background: rgba(0, 0, 0, 0.3);
    }

    .ttssst-divider {
        background: rgba(255, 255, 255, 0.2);
    }

    .ttssst-btn {
        background: rgba(255, 255, 255, 0.1);
    }

    .ttssst-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .ttssst-slider {
        background-color: rgba(255, 255, 255, 0.15);
    }
}

/* Hide multilingual theory blocks by default to prevent flash of content */
.theory-content-lang {
    display: none;
}

/* Remove default formatting for HTML theory source */
.gen-theory-html-source .gen-theory-full-content {
    border: none;
    background-color: transparent;
    padding: 0;
}

/* Utility class for user HTML theory content to mimic standard card style */
.gen-bordered-content,
.theory-block {
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    line-height: 1.6;
    font-size: 16px;
    margin-bottom: 20px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* Typography and specific elements inside theory containers */
.gen-theory-content h3,
.gen-bordered-content h3,
.theory-block h3 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
}

.gen-theory-content h4,
.gen-bordered-content h4,
.theory-block h4 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 10px;
}

.gen-theory-content strong,
.gen-bordered-content strong,
.theory-block strong {
    color: #3498db;
}

.gen-theory-content em,
.gen-bordered-content em,
.theory-block em {
    font-style: italic;
    color: #555;
    display: inline-block;
    margin-top: 5px;
}

/* Lists in theory blocks */
.gen-theory-content ul,
.gen-bordered-content ul,
.theory-block ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 15px;
}

.gen-theory-content li,
.gen-bordered-content li,
.theory-block li {
    margin-bottom: 10px;
}

/* Important notes / color boxes */
.gen-theory-content .important-note,
.gen-bordered-content .important-note,
.theory-block .important-note {
    background-color: #eaf2f8;
    border-left: 4px solid #3498db;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

.gen-bordered-content-test {
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    line-height: 1.6;
    font-size: 16px;
}