/* Современный тёмный фон с эффектом стекла */
body {
    margin: 5;
    min-height: 100vh;
    overflow: hidden;
    /* Красивый градиент вместо плоского цвета */
    background: #4b6cb7;
    font-family: 'Segoe UI', sans-serif;
    color: white;
}

/* --- ЗАГОЛОВОК --- */
h1 {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 25px;
    color: #fff;
    /* Эффект свечения текста */
    text-shadow: 0 0 20px rgba(100, 200, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.attr {
    transition: transform 0.3s ease;
}

.attr:hover {
    transform: scale(1.05); /* Увеличение на 5% */
}

.square
{
    position: absolute;
    background-color: lightgrey;
}

.square:hover, .square.possible:hover
{
    background-color: lightblue;
}

.square.possible
{
    background-color: lightgreen;
}

#response {
    font-size: 15px;
}

/* Полноэкранное уведомление */
.overlay {
    display: none;  /* Скрыто по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.15);  /* Тёмный фон */
    z-index: 9999;  /* Поверх всех элементов */
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    text-align: center;
    color: white;
}

.overlay-content #overlay-icon {
    font-size: 100px;
    display: block;
    margin-bottom: 20px;
}

.overlay-content h1 {
    font-size: 72px;
    margin: 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Цвета для правильного/неправильного ответа */
.overlay.success #overlay-icon {
    color: #4CAF50;  /* Зелёный */
}

.overlay.success h1 {
    color: #4CAF50;
}

.overlay.error #overlay-icon {
    color: #f44336;  /* Красный */
}

.overlay.error h1 {
    color: #f44336;
}

/* Анимация появления */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Анимация исчезновения */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.overlay.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.main-wrapper {
    display: flex !important;
    flex-direction: column !important; /* Вертикальное расположение */
    gap: 0px !important; /* Вертикальный отступ между блоками */
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

/* Контейнер для кнопок в ряд */
.button-container {
    display: flex !important;
    gap: 10px !important; /* Расстояние между кнопками */
    flex-wrap: wrap !important; /* Перенос на маленьких экранах */
    padding: 5px !important; /* Было 10px → ставим 5px или 0 */
    padding-bottom: 0 !important;
}

/* Общие стили для обеих кнопок */
#generate,
#check {
    height: 5vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    font-size: 2.2vh !important;
    padding: 0 32px !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    white-space: nowrap !important; /* Текст не переносится */
}

/* Кнопка #generate - оранжево-розовая */
#generate {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.5) !important;
}

#generate:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 10px 30px rgba(250, 112, 154, 0.6) !important;
}

#generate:active {
    transform: translateY(-1px) scale(0.98) !important;
}

/* Кнопка #check - зелёная */
#check {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5) !important;
}

#check:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 10px 30px rgba(17, 153, 142, 0.6) !important;
}

#check:active {
    transform: translateY(-1px) scale(0.98) !important;
}

#check:disabled,
#check.disabled {
    background: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none !important;
}

.difficulty-selector {
    display: flex;
    gap: 10px;
    margin: 0 !important
    background: rgba(255, 255, 255, 0.1);
    padding: 0 !important;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: fit-content;

    height: 5vh !important;
    box-sizing: border-box !important; /* Чтобы padding не ломал высоту */

    /* Выравнивание */
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden;
}

/* 🔹 Кнопка сложности */
.difficulty-btn {
    flex: 1 !important;
    height: 100% !important; /* Растягиваем на всю высоту селектора */
    max-height: 5vh !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 0 !important;
    padding: 0 15px !important; /* Боковые отступы для текста */

    border: none !important;
    border-radius: 0 !important; /* Убираем скругление у всех */
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    min-width: 60px !important;
    margin: 0 !important; /* Убираем марджины */
}

.difficulty-btn:first-child {
    border-radius: 16px 0 0 16px !important;
}

/* Скругляем правый край у последней кнопки */
.difficulty-btn:last-child {
    border-radius: 0 16px 16px 0 !important;
}

.difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.difficulty-btn:hover::before {
    opacity: 1;
}

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

.difficulty-text {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}


/* 🔹 Активная кнопка */
.difficulty-btn.active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.difficulty-btn.active::before {
    opacity: 0;
}

/* Цвета для активной кнопки */
.difficulty-btn[data-difficulty="easy"].active {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-color: #11998e;
}

.difficulty-btn[data-difficulty="easy"].active .difficulty-text,
.difficulty-btn[data-difficulty="easy"].active .difficulty-sub {
    color: white;
}

.difficulty-btn[data-difficulty="medium"].active {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    border-color: #f5576c;
}

.difficulty-btn[data-difficulty="medium"].active .difficulty-text,
.difficulty-btn[data-difficulty="medium"].active .difficulty-sub {
    color: white;
}

.difficulty-btn[data-difficulty="hard"].active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: #fa709a;
}

.difficulty-btn[data-difficulty="hard"].active .difficulty-text,
.difficulty-btn[data-difficulty="hard"].active .difficulty-sub {
    color: white;
}

/* 🔹 Анимация при клике */
.difficulty-btn:active {
    transform: scale(0.95);
}

/* Кнопка "Сбросить" (оранжевая/красная) */
#reset {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    /*width: 150px;  уменьшите ширину */
    height: 5vh !important;
    margin: 10px 0;
}

#reset:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.5);
}

#reset:disabled,
#reset.disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none !important;
    pointer-events: none; /* Запрещает клики */
}

.controls-wrapper {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important; /* Центрирование по вертикали */
    gap: 10px !important; /* Расстояние между селектором и кнопкой */
    padding: 0 !important;
    margin: 0 !important;
}

.home
{
    background: transparent !important;
}

.image {
    transition: transform 0.3s ease;
}

.image:hover {
    transform: scale(1.05); /* Увеличение на 5% */
}


/* === МОБИЛЬНАЯ ВЕРСИЯ (до 768px) === */
@media (max-width: 768px) {
    h1 {
        font-size: 20px !important;
        margin: 5px 0 10px 0 !important;
    }

    .main-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 8px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* === РЯД 1: Генерировать + Проверить (ГОРИЗОНТАЛЬНО) === */
    .button-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Запрещаем перенос */
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important; /* Убираем внешние отступы */
        padding: 0 !important;
    }

    #generate {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 40px !important;
        font-size: 12px !important;
        padding: 0 8px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        touch-action: manipulation !important;
    }

    #check {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 100px !important;
        max-width: 40% !important;
        height: 40px !important;
        min-height: 48px !important;
        font-size: 13px !important;
        padding: 0 15px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        touch-action: manipulation !important;
    }

    /* === РЯД 2: Селектор + Сбросить === */
    .controls-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        width: 100% !important;
        align-items: center !important;
    }

    .difficulty-selector {
        flex: 1 1 65% !important;
        height: 40px !important;
        padding: 4px !important;
        gap: 4px !important;
        box-sizing: border-box !important;
        display: flex !important;
    }

    .difficulty-btn {
        flex: 1 1 30% !important;
        height: 100% !important;
        min-height: 40px !important;
        padding: 0 5px !important;
        border-radius: 8px !important;
        min-width: 0 !important;
    }

    .difficulty-btn:first-child,
    .difficulty-btn:last-child {
        border-radius: 8px !important;
    }

    .difficulty-text {
        font-size: 11px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    #reset {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 80px !important;
        max-width: 30% !important;
        height: 40px !important;
        font-size: 13px !important;
        padding: 0 10px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        touch-action: manipulation !important;
    }

    /* === Блок с ответом === */
    #response {
        font-size: 13px !important;
    }
}

/* === ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 375px) === */
@media (max-width: 375px) {
    #generate {
        font-size: 11px !important;
        padding: 0 5px !important;
    }

    #check {
        font-size: 12px !important;
        min-width: 90px !important;
    }

    #reset {
        font-size: 12px !important;
        min-width: 70px !important;
    }

    .difficulty-text {
        font-size: 10px !important;
    }
}

/* === Тактильный отклик === */
@media (hover: none) {
    #generate:active,
    #check:active,
    #reset:active,
    .difficulty-btn:active {
        transform: scale(0.95) !important;
        opacity: 0.9 !important;
        transition: all 0.1s ease !important;
    }
}

* {
    -webkit-tap-highlight-color: transparent;
    outline: none !important;
}
