/* Стили для страницы worksheets */

/* Превью всех страниц PDF (как в готовых материалах) */
.worksheet-pdf-pages-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
    align-items: flex-start;
}
.worksheet-pdf-page-preview {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 900px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    background: #fff;
}

/* Убираем инлайн стили, переносим в CSS */
.bingo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.bingo-card {
    border: 2px solid var(--primary, #0d6efd);
    border-radius: 0;
    padding: 1rem;
}

.bingo-card table {
    margin-bottom: 0;
}

/* Индикатор загрузки */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.btn-primary .spinner-border {
    margin-left: 0.5rem;
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Валидация форм */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

/* Крестик удаления карточки — смена цвета при наведении */
.cards-card-delete {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.cards-card-delete:hover {
    color: #fff !important;
    background-color: #dc3545 !important;
}

/* Готовые наборы слов — сворачиваемая карточка */
.word-sets-card .card-header {
    background-color: var(--bs-light, #f8f9fa);
    border-bottom: 1px solid rgba(0, 0, 0, 0.075);
    user-select: none;
    cursor: pointer;
}

.word-sets-card-header:hover {
    background-color: var(--bs-gray-200, #e9ecef);
}

.word-sets-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.word-sets-card-header[aria-expanded="true"] .word-sets-chevron {
    transform: rotate(180deg);
}

/* Строка «Уровень — Категория — Кнопка» на одной высоте */
.word-sets-row .word-sets-field {
    display: flex;
    flex-direction: column;
}
/* Высота и выравнивание только у триггера и кнопки; select уровня не трогаем — иначе не видно выбранное значение */
.word-sets-row .word-set-level-trigger.word-sets-control,
.word-sets-row .word-set-category-trigger.word-sets-control,
.word-sets-row .word-set-saved-trigger.word-sets-control,
.word-sets-row .word-sets-button-wrap .btn.word-sets-control {
    height: 2.075rem;
    min-height: 2.075rem;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
}
.word-sets-row .word-set-level-trigger.word-sets-control,
.word-sets-row .word-set-category-trigger.word-sets-control,
.word-sets-row .word-set-saved-trigger.word-sets-control {
    padding-top: 0;
    padding-bottom: 0;
}
.word-sets-row .word-sets-button-wrap .btn.word-sets-control {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    justify-content: center;
}

/* Выпадающий список уровня (как у категории — триггер + панель, значение видно в форме) */
.word-set-level-dropdown {
    min-width: 5rem;
}
.word-set-level-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}
.word-set-level-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 100%;
    z-index: 1050;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.25rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.word-set-level-dropdown.open .word-set-level-panel {
    display: block;
}
.word-set-level-option {
    padding: 0.35rem 0.75rem;
    cursor: pointer;
}
.word-set-level-option:hover {
    background-color: var(--bs-gray-100, #f8f9fa);
}

/* Выпадающий список категорий с галочками */
.word-set-category-dropdown {
    min-width: 10rem;
}

.word-set-category-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.word-set-category-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 100%;
    max-height: 14rem;
    overflow-y: auto;
    z-index: 1050;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.25rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.word-set-category-dropdown.open .word-set-category-panel {
    display: block;
}

.word-set-category-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    gap: 0.5rem;
}

.word-set-category-option:hover {
    background-color: var(--bs-gray-100, #f8f9fa);
}

.word-set-category-check {
    visibility: hidden;
    color: var(--bs-success, #198754);
    font-weight: bold;
}

.word-set-category-option.selected .word-set-category-check {
    visibility: visible;
}

/* Выпадающий список «Сохранённые слова» — как «Категория»: триггер «Выбрать» + панель только с пунктами */
.word-set-saved-dropdown {
    min-width: 10rem;
}

.word-set-saved-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.word-set-saved-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 100%;
    max-height: 14rem;
    overflow-y: auto;
    z-index: 1050;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.25rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.word-set-saved-dropdown.open .word-set-saved-panel {
    display: block;
}

.word-set-saved-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    gap: 0.5rem;
}

.word-set-saved-option:hover {
    background-color: var(--bs-gray-100, #f8f9fa);
}

.word-set-saved-check {
    visibility: hidden;
    color: var(--bs-success, #198754);
    font-weight: bold;
}

.word-set-saved-option.selected .word-set-saved-check {
    visibility: visible;
}

/* Результаты */
.result-section {
    scroll-margin-top: 2rem;
}

/* Рамка фокуса для всей обертки, включая кнопки - без разделения */
.result-wrapper:focus-within {
    outline: 2px solid var(--primary, #0d6efd);
    outline-offset: 2px;
    border-radius: var(--radius-lg);
}

/* Убираем отдельную рамку у result-section, чтобы не было разделения */
.result-section:focus {
    outline: none;
}

/* Кнопки действий с результатами */
.result-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.result-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px; /* Единая высота для всех кнопок */
    padding: 0.625rem 1.5rem;
    white-space: nowrap;
    font-weight: 600;
    border-radius: var(--radius-full, 50px);
}

.result-actions .btn-outline-primary {
    border: 2px solid var(--primary, #4361ee);
    color: var(--primary, #4361ee);
    background: transparent;
    transition: all 0.3s ease;
}

.result-actions .btn-outline-primary:hover {
    background: var(--primary, #4361ee);
    color: white;
    border-color: var(--primary, #4361ee);
}

/* Карточки Dobble */
.dobble-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.dobble-cards img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .bingo-grid {
        flex-direction: column;
        gap: 1rem;
    }
    
    .dobble-cards .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section {
    animation: fadeIn 0.3s ease-in;
}

/* Улучшение доступности */
.btn-clear:focus,
.btn-download:focus {
    outline: 2px solid var(--primary, #0d6efd);
    outline-offset: 2px;
}

/* Стили для селекта с фиксированной шириной */
.form-select-fixed-width {
    width: 150px;
}

/* ============================================
   УЛУЧШЕНИЯ ДИЗАЙНА
   ============================================ */

/* Поиск типов заданий */
.task-search-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.task-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.task-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

.task-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

/* Трехколоночный макет: типы заданий слева, задание посередине, инструкция справа */
.worksheets-container {
    display: grid;
    grid-template-columns: 280px minmax(800px, 1200px) 320px;
    gap: 2rem;
    width: 100%;
    max-width: calc(280px + 1200px + 320px + 4rem); /* ширина всех колонок + gaps */
    margin: 0 auto 2rem auto;
    padding: 0 1rem;
    align-items: start;
    box-sizing: border-box;
}

/* Переопределяем ограничения Bootstrap container для правильного центрирования */
main.container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

main.container > .worksheets-container {
    margin-left: auto;
    margin-right: auto;
}

.tasks-sidebar {
    flex: 0 0 280px;
    background: white;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.tasks-sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200, #e5e7eb);
}

.tasks-sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark, #1e293b);
    margin: 0;
}

.tasks-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    margin-bottom: 0.5rem;
}

.task-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-md, 8px);
    background: var(--gray-50, #f9fafb);
    color: var(--dark, #1e293b);
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.task-button:hover {
    background: var(--gray-100, #f3f4f6);
    border-color: var(--gray-300, #d1d5db);
    transform: translateX(4px);
}

.task-button.active {
    background: linear-gradient(135deg, var(--primary, #4361ee) 0%, rgba(67, 97, 238, 0.9) 100%);
    color: white;
    border-color: var(--primary, #4361ee);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.task-button.active:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

.task-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.domino-icon-img {
    display: block;
    width: 1.6em;
    height: 1.6rem;
    object-fit: contain;
}

.inline-icon {
    display: inline-flex;
    vertical-align: -0.18em;
    margin-right: 0.35rem;
}

.inline-icon .domino-icon-img {
    width: 1.6em;
    height: 1.6em;
}

.task-text {
    flex: 1;
    font-size: 0.875rem;
}

.worksheets-content {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.worksheet-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Карточка с инструкцией справа */
.instructions-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
}

.instructions-card {
    background: white;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

/* Скрытие элементов при поиске */
.task-item.hidden {
    display: none !important;
}

/* Адаптивность для мобильных */
@media (max-width: 1800px) {
    .worksheets-container {
        grid-template-columns: 260px minmax(600px, 1000px) 300px;
        max-width: calc(260px + 1000px + 300px + 4rem);
    }
}

@media (max-width: 1600px) {
    .worksheets-container {
        grid-template-columns: 260px minmax(500px, 900px) 300px;
        max-width: calc(260px + 900px + 300px + 4rem);
    }
}

@media (max-width: 1400px) {
    .worksheets-container {
        grid-template-columns: 240px minmax(400px, 800px) 280px;
        max-width: calc(240px + 800px + 280px + 4rem);
    }
}

@media (max-width: 1200px) {
    .worksheets-container {
        grid-template-columns: 240px minmax(300px, 600px) 280px;
        max-width: calc(240px + 600px + 280px + 4rem);
    }
}

@media (max-width: 992px) {
    .worksheets-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .tasks-sidebar {
        position: static;
        max-height: none;
        width: 100%;
    }
    
    .tasks-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.5rem;
    }
    
    .task-button {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .task-text {
        font-size: 0.7rem;
    }
    
    .instructions-sidebar {
        position: static;
        max-height: none;
    }
    
    .instructions-card {
        max-height: none;
    }
}

/* Toast-уведомления */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 99999 !important; /* Очень высокий z-index */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    pointer-events: none; /* Позволяем кликать сквозь контейнер */
}

.toast-container .toast {
    pointer-events: auto; /* Но сам toast кликабельный */
}

.toast {
    background: white;
    border: none;
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    opacity: 1 !important; /* Принудительно видимый */
    visibility: visible !important;
}

.toast-success {
    border-left: 4px solid #10b981 !important;
    background: #ffffff !important;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3) !important;
}

.toast-success .toast-title {
    color: #10b981 !important;
    font-weight: 700 !important;
}

.toast-success .toast-message {
    color: #1e293b !important;
    font-weight: 500 !important;
}

.toast-success .toast-icon {
    font-size: 1.75rem !important;
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: var(--dark);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Улучшенные формы с floating labels */
.form-group-floating {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-control-floating {
    padding: 1.25rem 1rem 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control-floating:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

.form-label-floating {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--gray-400);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s ease;
    background: white;
    padding: 0 0.25rem;
}

.form-control-floating:focus ~ .form-label-floating,
.form-control-floating:not(:placeholder-shown) ~ .form-label-floating {
    top: -0.5rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

/* Обертка для результатов и кнопок */
.result-wrapper {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
}

/* Улучшенные результаты - только прокручиваемая область */
.result-section {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.05) 0%, rgba(76, 201, 240, 0.05) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 2rem;
    border: 1px solid rgba(67, 97, 238, 0.1);
    border-bottom: none;
    /* Превью PDF может быть высоким — даём больше места под прокрутку */
    max-height: clamp(600px, 75vh, 950px);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 1;
}

/* Кнопки действий - полностью отделены от result-section, всегда видны вне прокрутки */
.result-wrapper .result-actions {
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 1rem 2rem;
    border: 1px solid rgba(67, 97, 238, 0.1);
    border-top: 1px solid rgba(67, 97, 238, 0.2);
    margin-top: 0;
    flex-shrink: 0;
}

/* Стилизация скроллбара для result-section */
.result-section::-webkit-scrollbar {
    width: 8px;
}

.result-section::-webkit-scrollbar-track {
    background: rgba(67, 97, 238, 0.05);
    border-radius: 4px;
}

.result-section::-webkit-scrollbar-thumb {
    background: rgba(67, 97, 238, 0.3);
    border-radius: 4px;
}

.result-section::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 97, 238, 0.5);
}

.result-section h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.result-section h5::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-success);
    color: white;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: bold;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .worksheets-container {
        padding: 0 0.25rem;
    }

    .tasks-sidebar {
        padding: 1rem;
    }

    .tasks-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
    }

    .task-item {
        flex: 0 0 auto;
        margin-bottom: 0;
        min-width: 130px;
    }

    .task-button {
        min-height: 100%;
        text-transform: none;
        letter-spacing: 0;
    }

    .word-sets-row {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .word-sets-field,
    .word-set-level-dropdown,
    .word-set-category-dropdown,
    .word-set-saved-dropdown {
        width: 100%;
        min-width: 0;
    }

    .word-sets-row .word-set-level-trigger.word-sets-control,
    .word-sets-row .word-set-category-trigger.word-sets-control,
    .word-sets-row .word-set-saved-trigger.word-sets-control,
    .word-sets-row .word-sets-button-wrap .btn.word-sets-control {
        width: 100%;
        min-width: 0;
    }

    .lesson-cta-alert {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .lesson-cta-alert .btn {
        width: 100%;
        margin-left: 0 !important;
    }

    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
    }
    
    .nav-tabs {
        padding: 0.5rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
    }
    
    .result-section {
        padding: 1rem;
    }

    .result-wrapper .result-actions {
        padding: 0.75rem 1rem;
    }

    .result-actions .btn,
    .result-actions form,
    .result-actions form .btn {
        width: 100%;
    }

    .sudoku-grid td {
        padding: 4px;
    }

    .sudoku-4x4 td {
        width: 56px;
        height: 56px;
        font-size: 14px;
    }

    .sudoku-6x6 td {
        width: 42px;
        height: 42px;
        font-size: 12px;
    }

    .sudoku-9x9 td {
        width: 32px;
        height: 32px;
        font-size: 10px;
    }
}

/* Стили для судоку */
.sudoku-grid {
    border-collapse: collapse;
    margin: 0 auto;
}

.sudoku-grid td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.sudoku-grid td.filled {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #212529;
}

.sudoku-grid td.empty {
    background-color: #ffffff;
}

/* Стили для судоку 4×4 */
.sudoku-4x4 {
    max-width: 400px;
}

.sudoku-4x4 td {
    width: 80px;
    height: 80px;
    font-size: 16px;
}

.sudoku-4x4 tr:nth-child(2n) td {
    border-bottom: 3px solid #212529;
}

.sudoku-4x4 td:nth-child(2n) {
    border-right: 3px solid #212529;
}

.sudoku-4x4 tr:first-child td {
    border-top: 3px solid #212529;
}

.sudoku-4x4 td:first-child {
    border-left: 3px solid #212529;
}

/* Стили для судоку 6×6 */
.sudoku-6x6 {
    max-width: 500px;
}

.sudoku-6x6 td {
    width: 60px;
    height: 60px;
    font-size: 14px;
}

.sudoku-6x6 tr:nth-child(2n) td {
    border-bottom: 3px solid #212529;
}

.sudoku-6x6 tr:nth-child(4n) td {
    border-bottom: 3px solid #212529;
}

.sudoku-6x6 td:nth-child(3n) {
    border-right: 3px solid #212529;
}

.sudoku-6x6 tr:first-child td {
    border-top: 3px solid #212529;
}

.sudoku-6x6 td:first-child {
    border-left: 3px solid #212529;
}

/* Стили для судоку 9×9 */
.sudoku-9x9 {
    max-width: 600px;
}

.sudoku-9x9 td {
    width: 50px;
    height: 50px;
    font-size: 12px;
}

.sudoku-9x9 tr:nth-child(3n) td {
    border-bottom: 3px solid #212529;
}

.sudoku-9x9 td:nth-child(3n) {
    border-right: 3px solid #212529;
}

.sudoku-9x9 tr:first-child td {
    border-top: 3px solid #212529;
}

.sudoku-9x9 td:first-child {
    border-left: 3px solid #212529;
}

/* ============================================
   СТИЛИ ДЛЯ ИНСТРУКЦИЙ
   ============================================ */

.instructions-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(67, 97, 238, 0.2);
}

.instructions-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary, #4361ee);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instructions-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--dark, #1e293b);
}

.instruction-section {
    margin-bottom: 1.5rem;
}

.instruction-section:last-child {
    margin-bottom: 0;
}

.instruction-section h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary, #4361ee);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instruction-section p {
    margin-bottom: 0.75rem;
    color: var(--gray-700, #374151);
}

.instruction-section ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.instruction-section li {
    margin-bottom: 0.5rem;
    color: var(--gray-700, #374151);
}

.instruction-section code {
    background: rgba(67, 97, 238, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
    color: var(--primary, #4361ee);
    font-family: 'Courier New', monospace;
}

/* Адаптивность для инструкций */
@media (max-width: 1200px) {
    .worksheet-layout {
        grid-template-columns: 1fr 280px;
        gap: 1.5rem;
    }
    
    .worksheet-instructions {
        padding: 1.25rem;
    }
}

@media (max-width: 992px) {
    .worksheet-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .worksheet-instructions {
        position: static;
        max-height: none;
    }
    
    .instructions-header h4 {
        font-size: 1.125rem;
    }
    
    .instruction-section h5 {
        font-size: 0.9375rem;
    }
}

@media (max-width: 420px) {
    .task-item {
        min-width: 118px;
    }

    .sudoku-4x4 td {
        width: 50px;
        height: 50px;
        font-size: 13px;
    }

    .sudoku-6x6 td {
        width: 36px;
        height: 36px;
        font-size: 11px;
    }

    .sudoku-9x9 td {
        width: 28px;
        height: 28px;
        font-size: 9px;
    }
}
