/* Анимация движения искры по контуру */
@keyframes border-spark-path {
    0% { top: 0; left: 0; transform: translate(-50%, -50%); }
    25% { top: 0; left: 100%; transform: translate(-50%, -50%); }
    50% { top: 100%; left: 100%; transform: translate(-50%, -50%); }
    75% { top: 100%; left: 0; transform: translate(-50%, -50%); }
    100% { top: 0; left: 0; transform: translate(-50%, -50%); }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0; padding: 0; background-color: #f0f0f0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; box-sizing: border-box; color: #333; font-size: 16px; line-height: 1.6;
}
*, *::before, *::after { box-sizing: inherit; }

/* Контейнер */
.container { text-align: center; padding: 25px 30px; margin: 20px auto; background-color: white; border-radius: 10px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); max-width: 900px; width: 90%; }

/* Типографика */
h1, h2, h3, h4, h5, h6 { color: #333; margin-top: 0; margin-bottom: 0.8em; line-height: 1.3; }
h1 { font-size: 2em; margin-bottom: 1em; } h2 { font-size: 1.5em; margin-top: 1.5em; }
p { margin-top: 0; margin-bottom: 1em; color: #555; }
label { display: block; margin-bottom: 8px; color: #555; text-align: left; font-weight: bold; font-size: 0.95em; }
a { color: #508EB7; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #0356AF; text-decoration: underline; }
hr { border: none; border-top: 1px solid #eee; margin: 25px 0; }

/* Формы */
input[type="text"], input[type="number"], input[type="color"], input[type="email"], input[type="password"], textarea, select { width: 100%; padding: 10px 12px; margin-bottom: 15px; background-color: #f8f9fa; border: 1px solid #ccc; border-radius: 5px; font-size: 1em; line-height: 1.5; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input[type="number"] { -moz-appearance: textfield; } input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #80bdff; box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
::placeholder { color: #999; opacity: 1; } textarea { resize: vertical; min-height: 120px; }
select { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%508EB7%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 12px center; background-size: 10px auto; padding-right: 30px; }

/* Общие кнопки (не из сетки с анимацией) */
button.general-button { display: inline-block; padding: 10px 20px; font-size: 1em; font-weight: bold; text-align: center; vertical-align: middle; cursor: pointer; border: 1px solid transparent; border-radius: 5px; background-color: #508EB7; color: white; transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; user-select: none; }
button.general-button:hover { background-color: #0356AF; border-color: #0356AF; } button.general-button:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); } button.general-button:active { background-color: #004085; border-color: #004085; } button.clear-button { background-color: #6c757d; border-color: #6c757d; } button.clear-button:hover { background-color: #5a6268; border-color: #545b62; } button.clear-button:focus { box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); } button.clear-button:active { background-color: #545b62; border-color: #4e555b; }
.button-group { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; margin-bottom: 15px; } .button-group button { margin: 0; }

/* ==========================================================================
Стили для главной страницы (index.html) - АНИМАЦИЯ "ИСКРА СО ШЛЕЙФОМ"
========================================================================== */

.buttons-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 15px;
    margin-bottom: 30px;
    align-items: stretch; /* Убеждаемся, что это значение по умолчанию */
}

.buttons-grid button {
    position: relative; /* Для ::before */
    z-index: 1;
    border: 2px solid transparent; /* << ИЗМЕНЕНО: Добавлена прозрачная граница для выравнивания */
    background-color: #508EB7; /* Основной цвет кнопки */
    color: white;
    border-radius: 8px; /* Увеличено скругление углов */
    box-shadow: none;
    transition: background-color 0.25s ease-out, border-color 0.25s ease-out; /* Добавлен transition для border */
    cursor: pointer;
    width: 100%;
    padding: 0; margin: 0;
    font-weight: normal;
    overflow: hidden; /* Обрезаем все, что выходит за рамки кнопки */
    -webkit-tap-highlight-color: transparent;
    /* Кнопка будет растягиваться по высоте благодаря Grid */
}

/* Затемняем фон кнопки при наведении */
.buttons-grid button:hover {
    background-color: #0356AF; /* Цвет фона при наведении */
}

/* --- АНИМАЦИЯ "ИСКРА СО ШЛЕЙФОМ" --- */
/*.buttons-grid button::before {
/*    content: '';
/*    position: absolute;
/*    z-index: 2; /* Искра над кнопкой, но под текстом */
/*    width: 8px; height: 8px; /* Размер искры */
/*    background: radial-gradient(circle, #ADD8E6 0%, #87CEFA 40%, #508EB7 80%, transparent 100%); /* Синий градиент искры */
/*    border-radius: 50%;
/*    box-shadow:
        0 0 5px 2px rgba(173, 216, 230, 0.7),
        0 0 12px 4px rgba(0, 123, 255, 0.4);
    top: 0; left: 0;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    animation: border-spark-path 6s linear infinite;
    animation-play-state: paused;
}

/* Показываем и запускаем анимацию при наведении */
.buttons-grid button:hover::before {
    opacity: 1; /* Показываем искру и шлейф */
    animation-play-state: running; /* Запускаем движение */
}

/* Состояние при нажатии (без изменения размера) */
.buttons-grid button:active {
    background-color: #004085; /* Еще темнее при клике */
    transition: background-color 0.1s ease;
}

/* Ссылка внутри кнопки */
.buttons-grid button a {
    position: relative;
    z-index: 3;
    color: white; text-decoration: none;
    /* Центрирование текста и обеспечение заполнения */
    display: flex;
    align-items: center;     /* Центрирование по вертикали */
    justify-content: center; /* Центрирование по горизонтали */
    width: 100%;
    height: 100%;            /* Заставляем ссылку заполнить высоту кнопки */
    /* Управление минимальной высотой и отступами */
    padding: 8px 10px;
    min-height: 40px;        /* Установлена минимальная высота */
    /* --- */
    box-sizing: border-box;
    font-size: 0.9em;
    text-align: center;
    line-height: 1.3;
    font-weight: bold;
}
.buttons-grid button a:hover { text-decoration: none; color: white; }

/* === НОВЫЙ СТИЛЬ ДЛЯ ВЫДЕЛЕННЫХ КНОПОК === */
.buttons-grid button.button-highlight {
    background-color: #508EB7; /* Их особый фиолетово-синий фон */
    border: 3px dashed #0356AF; /* Синяя прерывистая граница */
}

/* Ховер-эффект для выделенных кнопок (можно настроить, если стандартный не нравится) */
.buttons-grid button.button-highlight:hover {
    background-color: #0356AF; /* Чуть темнее их основного цвета при наведении */
    border-color: #0356AF; /* Можно изменить цвет границы при наведении, если нужно */
}
/* ========================================= */


/* Остальные стили для главной (сообщение, часы) */
.message { margin-top: 20px; text-align: center; font-size: 0.9em; color: #555; padding: 15px; border: 1px solid #eee; border-radius: 5px; background-color: #f9f9f9; }
#clock-container { text-align: center; margin-top: 25px; padding: 10px; } #clock-label { font-size: 1em; color: #555; margin-bottom: 5px; } #clock { font-size: 1.8em; font-weight: bold; color: #333; }

/* Общие классы вывода */
#result, .result-display { margin-top: 20px; padding: 15px; border: 1px solid #eee; border-radius: 5px; background-color: #f8f9fa; text-align: left; word-wrap: break-word; overflow-x: auto; font-family: "Courier New", Courier, monospace; font-size: 0.95em; }
.output-highlight { display: inline-block; padding: 8px 12px; background-color: #e9ecef; border-radius: 4px; font-weight: bold; color: #333; cursor: pointer; user-select: none; margin-top: 10px; text-align: center; width: 100%; }

/* Неактивная кнопка */
#btn-word-generator { background-color: #b0bec5 !important; box-shadow: none; opacity: 0.7; cursor: not-allowed; pointer-events: none; transform: none; border: none; }
#btn-word-generator::before { display: none !important; } /* Гарантированно отключаем искру */
#btn-word-generator a { cursor: not-allowed; color: #f5f5f5; }

/* Медиа-запросы */
@media (max-width: 992px) {
    .container { max-width: 95%; }
    .buttons-grid { grid-template-columns: repeat(3, 1fr); grid-gap: 12px; }
    .buttons-grid button a {
        padding: 8px 8px;
        min-height: 38px;
        height: 100%;
        font-size: 0.85em;
    }
}
@media (max-width: 768px) {
    h1 { font-size: 1.8em; }
    h2 { font-size: 1.4em; }
    .buttons-grid { grid-template-columns: repeat(2, 1fr); grid-gap: 10px; }
    /* Стили для .buttons-grid button a наследуются от max-width: 992px, если не переопределены */
}
@media (max-width: 480px) {
    body { font-size: 15px; }
    .container { padding: 15px; border-radius: 5px; }
    h1 { font-size: 1.6em; }
    h2 { font-size: 1.3em; }
    button.general-button { padding: 8px 16px; font-size: 0.95em; }
    input[type="text"], input[type="number"], input[type="color"], textarea, select { padding: 8px 10px; }
    .buttons-grid { grid-template-columns: 1fr 1fr; } /* Изменено на 2 колонки */
    .buttons-grid button a {
        padding: 8px 8px;
        min-height: 38px;
        height: 100%;
        font-size: 0.85em;
    }
    #clock { font-size: 1.6em; }
}


/* === СТИЛИ, ПЕРЕНЕСЕННЫЕ ИЗ INDEX.HTML === */
/* Стили Cookie Баннера */
#cookieConsentBanner {
    display: none; /* Изначально скрыт, управляется JS */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 20px;
    text-align: center;
    z-index: 1000;
    font-size: 14px;
    border-top: 1px solid #444;
}

#cookieConsentBanner p {
    margin: 0 0 10px 0;
    line-height: 1.5;
    /* Убедимся, что цвет наследуется или белый */
    color: white;
}

#cookieConsentBanner a {
    color: #aaccff;
    text-decoration: underline;
}
#cookieConsentBanner a:hover {
     color: #ffffff;
}

#acceptCookieConsent {
    padding: 8px 18px;
    background-color: #508EB7;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#acceptCookieConsent:hover {
    background-color: #0356AF;
}
/* --- Конец стилей Cookie Баннера --- */

/*
    Стили для .message, #clock-container, #clock, #clock-label
    уже были в основном блоке CSS, поэтому дублировать их не нужно.
    Проверил, они там есть и соответствуют тем, что были в <style>.
*/
/* ========================================= */