* { box-sizing: border-box; }

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Жесткий запрет горизонтального скролла */
}

:root {
    --bg: #050614;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --neon-green: #39ff14;
    --neon-violet: #bc13fe;
    --neon-orange: #ff8c00;
    --ember-hot: #fffbe0; /* Раскаленное ядро искры */
    --divider: rgba(255, 255, 255, 0.08);
    --grid-layout: 2.5fr 1.5fr 1.5fr 80px;
}

/* --- КИБЕРПАНК СКРОЛЛБАР: VIOLET & PINK EDITION --- */

/* 1. Контейнер полосы */
::-webkit-scrollbar {
    width: 14px;
    background-color: #050614; /* Цвет из var(--bg) */
}

/* 2. Дорожка */
::-webkit-scrollbar-track {
    background-color: #050614;
    border: none;
}

/* 3. Ползунок (Thumb) */
::-webkit-scrollbar-thumb {
    /* Градиент: Фиолетовый -> Розовый */
    background-image: linear-gradient(180deg, #bc13fe 0%, #ff00cc 100%);
    
    border-radius: 10px;
    /* Отступ от краев через рамку цвета фона */
    border: 4px solid #050614; 
    background-clip: padding-box;
    transition: all 0.3s ease;
}

/* 4. Свечение и интерактив при наведении */
::-webkit-scrollbar-thumb:hover {
    /* Делаем цвета чуть ярче при наведении */
    background-image: linear-gradient(180deg, #d64fff 0%, #ff5ce0 100%);
    background-clip: padding-box;
    
    /* Неоновое свечение вокруг ползунка */
    box-shadow: 0 0 12px rgba(255, 0, 204, 0.6), 
                inset 0 0 5px rgba(255, 255, 255, 0.3);
}

/* Состояние при активном скролле (нажатии) */
::-webkit-scrollbar-thumb:active {
    background-image: linear-gradient(180deg, #ff00cc 0%, #bc13fe 100%);
    background-clip: padding-box;
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.8);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    overflow-x: hidden;
}

/* --- КИБЕРПАНК ЛОАДЕР: ФИНАЛЬНАЯ ВЕРСИЯ --- */
.loader-wrapper {
    position: fixed; inset: 0; background: var(--bg);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}

.loader-content { text-align: center; width: 650px; }

/* Надпись с мигающим курсором */
.loader-content p {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem; letter-spacing: 5px; margin-bottom: 25px;
    color: var(--neon-violet); text-transform: uppercase;
    text-shadow: 0 0 10px rgba(188, 19, 254, 0.5);
    display: inline-block; /* Важно для корректного отображения курсора */
}

.loader-content p::after {
    content: '_';
    margin-left: 5px;
    color: var(--neon-green);
    text-shadow: 0 0 8px var(--neon-green);
    animation: blink-cursor 0.8s infinite;
}

.liquid-bar {
    height: 50px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    padding: 8px;
}

.water {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #39ff14 0%, #fffb00 50%, #ff0000 100%);
    background-size: 650px 100%;
    /* Крупные сегменты (35px) с заметным расстоянием */
    mask-image: linear-gradient(to right, #000 65%, transparent 65%);
    mask-size: 35px 100%; 
    position: relative;
    animation: water-fill 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Эффект мерцающей прозрачности */
.water::before {
    content: ''; position: absolute; inset: 0;
    background: inherit;
    animation: flicker-opacity 2.5s infinite ease-in-out;
}

/* Финальный блюр (растворение) */
.loader-finish {
    pointer-events: none;
    animation: final-blur-out 1.2s ease-out forwards;
}

@keyframes final-blur-out {
    0% { filter: blur(0px); opacity: 1; }
    40% { filter: blur(15px); opacity: 0.8; }
    100% { filter: blur(40px); opacity: 0; }
}

@keyframes water-fill { 0% { width: 0%; } 100% { width: 100%; } }
@keyframes blink-cursor { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes flicker-opacity { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }


/* --- HEADER & SEARCH --- */
header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(5, 6, 20, 0.95);
    backdrop-filter: blur(25px);
    padding: 25px 0 10px 0;
    border-bottom: 1px solid var(--glass-border);
}

.header-main { display: flex; justify-content: center; margin-bottom: 20px; }

.search-wrapper {
    position: relative;
    width: 500px; 
    border-radius: 30px;
    z-index: 1;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-wrapper.favorite::before {
    content: "";
    position: absolute;
    inset: -15px; 
    z-index: -1;
    background: linear-gradient(90deg, #ff00cc, #3333ff, #00ffcc, #ff00cc);
    background-size: 200% 100%;
    border-radius: 40px;
    animation: flow-smooth 8s linear infinite;
    filter: blur(25px);
    opacity: 0.25;
    transition: opacity 0.5s ease, filter 0.5s ease;
}

@keyframes flow-smooth {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.search-wrapper:has(#searchInput:focus)::before {
    opacity: 0.7;
    filter: blur(35px);
}

#searchInput {
    position: relative;
    width: 100%;
    background: rgba(10, 11, 30, 0.85); 
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 35px;
    border-radius: 30px;
    color: #ffffff; 
    font-size: 1.1rem; 
    text-align: center; 
    outline: none;
    z-index: 2;
    transition: all 0.4s ease;
}

#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease;
}

#searchInput:focus::placeholder { opacity: 0; }

#searchInput:focus {
    border-color: rgba(188, 19, 254, 0.5);
    background: rgba(15, 16, 40, 0.95);
    box-shadow: inset 0 0 15px rgba(188, 19, 254, 0.2); 
}

/* --- TABLE LEGEND --- */
.table-legend {
    display: grid;
    grid-template-columns: var(--grid-layout);
    max-width: 1100px;
    margin: 10px auto 0;
    padding: 10px 25px; 
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    opacity: 0.95;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Центрируем все заголовки, кроме первого */
.leg-col:not(.title) {
    justify-content: center;
    text-align: center;
}

.leg-col {
    padding: 0 15px;
    display: flex;
    align-items: center;
    /* Добавляем прозрачный разделитель, чтобы ширина колонок 
       совпадала с карточками, где есть реальная граница */
    border-right: 1px solid transparent; 
}

/* У последней колонки убираем фантомную границу */
.leg-col.video { 
    border-right: none; 
}

/* --- ОБНОВЛЕННЫЕ КОЛОНКИ КАРТОЧЕК --- */
.col-sep { 
    border-right: 1px solid var(--divider); 
    padding: 0 15px; 
    display: flex; 
    align-items: center; 
    height: 100%; 
    min-height: 30px;
}

/* Центрируем содержимое всех колонок, кроме первой */
.col-sep:nth-child(n+2) {
    justify-content: center;
    text-align: center;
}

.col-sep:last-child { 
    border-right: none; 
    padding: 0; 
}

/* --- GAME CARDS --- */
.game-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px; max-width: 1100px; margin: 15px auto;
    backdrop-filter: blur(15px); opacity: 0; transform: translateY(20px);
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
}
.game-card.show { opacity: 1; transform: translateY(0); }

.card-main { 
    display: grid; 
    grid-template-columns: var(--grid-layout); 
    align-items: center; 
    padding: 20px 25px; 
}

.col-sep { 
    border-right: 1px solid var(--divider); 
    padding: 0 15px; 
    display: flex; 
    align-items: center; 
    height: 100%; 
    min-height: 30px;
}
.col-sep:last-child { border-right: none; justify-content: center; padding: 0; }

.card-comment {
    border-top: 1px solid var(--divider); padding: 15px 25px;
    font-size: 0.85rem; color: #aeb9ff; font-style: italic;
    background: rgba(255, 255, 255, 0.01);
    line-height: 1.4;
}

/* --- STATUS TEXTS --- */
.status-text { font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; }
.status-green { color: var(--neon-green); text-shadow: 0 0 15px rgba(57, 255, 20, 0.3); }
.status-violet { color: var(--neon-violet); text-shadow: 0 0 15px rgba(188, 19, 254, 0.3); }
.status-orange { color: var(--neon-orange); text-shadow: 0 0 15px rgba(255, 140, 0, 0.3); }

/* --- SOFT NEON GLOW EFFECTS --- */
.game-card:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.07); }

.game-card.finished:hover {
    border-color: rgba(57, 255, 20, 0.4);
    box-shadow: 0 0 60px rgba(57, 255, 20, 0.15);
}

.game-card.in-progress {
    border-color: rgba(188, 19, 254, 0.15);
    box-shadow: 0 0 25px rgba(188, 19, 254, 0.04);
}
.game-card.in-progress:hover {
    border-color: rgba(188, 19, 254, 0.6);
    box-shadow: 0 0 60px rgba(188, 19, 254, 0.25);
}

.game-card.dropped:hover {
    border-color: rgba(255, 140, 0, 0.4);
    box-shadow: 0 0 60px rgba(255, 140, 0, 0.15);
}

/* --- КАРТОЧКА ЛЮБИМОЙ ИГРЫ (МЯГКОЕ БЕСШОВНОЕ СИЯНИЕ) --- */
.favorite::after {
    content: ""; 
    position: absolute; 
    inset: -1px; 
    z-index: -1;
    /* Используем радиальный градиент: он не дает вертикальных полос */
    background: radial-gradient(circle at center, #ff00cc, #3333ff, #00ffcc, #ff00cc);
    /* Увеличиваем размер фона, чтобы пятна были крупными */
    background-size: 400% 400%; 
    border-radius: 12px;
    /* Линейная анимация вращения фона */
    animation: flow-ultra-smooth 32s linear infinite; 
    opacity: 0.15;
    transition: none !important;
}

@keyframes flow-ultra-smooth {
    0% {
        background-position: 0% 0%;
    }
    100% {
        /* Двигаем по диагонали для максимально естественного перелива */
        background-position: 400% 400%;
    }
}

.yt-btn svg { fill: #ff0000; filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.2)); transition: 0.3s; }
.yt-btn:hover svg { transform: scale(1.15); filter: drop-shadow(0 0 12px rgba(255, 0, 0, 0.5)); }

/* --- СПЕЦИАЛЬНАЯ КАРТОЧКА --- */
.suggestion-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    background: rgba(188, 19, 254, 0.05) !important;
    border: 1px dashed rgba(188, 19, 254, 0.3) !important;
}

.suggestion-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    color: var(--neon-violet);
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.suggestion-card:hover {
    background: rgba(188, 19, 254, 0.1) !important;
    box-shadow: 0 0 40px rgba(188, 19, 254, 0.15);
    border-style: solid !important;
}

.suggestion-link:hover {
    color: #ffffff;
    text-shadow: 0 0 10px var(--neon-violet);
}

footer { text-align: center; padding: 60px; opacity: 0.3; font-size: 0.8rem; letter-spacing: 1px; }

/* --- СТИЛИ ДЛЯ ИГР В ПЛАНАХ --- */
.planned-game {
    opacity: 0.5 !important; /* Полупрозрачность в обычном состоянии */
    font-style: italic;
    font-weight: 300;
}

.planned-game .card-main strong {
    font-weight: 300; /* Тонкий шрифт для заголовка */
}

.planned-game:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-3px);
}

/* --- РАЗДЕЛИТЕЛЬ СЕКЦИЙ --- */
.section-divider {
    max-width: 1100px;
    margin: 80px auto; /* Свободное пространство размером с карточку */
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%
    );
    position: relative;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    animation: divider-pulse 4s infinite ease-in-out;
}

@keyframes divider-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Исправление отступа поиска (System Instruction) */
header {
    padding: 60px 0 20px 0 !important;
}

/* --- КАРТОЧКА ПРЕДЛОЖЕНИЯ (ВСЕГДА АКТУАЛЬНАЯ) --- */
.suggestion-card {
    background: rgba(188, 19, 254, 0.1) !important;
    border: 1px dashed var(--neon-violet) !important;
    opacity: 1 !important; /* Игнорируем прозрачность планов */
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease !important;
}

.suggestion-card:hover {
    background: rgba(188, 19, 254, 0.2) !important;
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.3);
    transform: scale(1.01);
}

.suggestion-link {
    color: var(--neon-violet);
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    width: 100%;
    text-align: center;
}

/* --- ИГРЫ В ПЛАНАХ (ОСТАЛЬНЫЕ БЕЗ ССЫЛОК) --- */
.planned-game {
    opacity: 0.4;
    font-style: italic;
}

.planned-game .card-main strong {
    font-weight: 300;
}

/* --- РАЗДЕЛИТЕЛЬ --- */
.section-divider {
    max-width: 1100px;
    margin: 80px auto; 
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

/* --- ПЛАВАЮЩАЯ КНОПКА "НАВЕРХ" --- */
.scroll-top-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 55px;
    height: 55px;
    border-radius: 15px; /* Сочетается с карточками */
    background: rgba(10, 11, 30, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Настройки для 3D переворота */
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Появление кнопки при прокрутке */
.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Радужное свечение под кнопкой */
.scroll-top-btn::before {
    content: "";
    position: absolute;
    inset: -2px;
    background: linear-gradient(90deg, #ff00cc, #3333ff, #00ffcc, #ff00cc);
    background-size: 300% 100%;
    border-radius: 16px;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: flow-smooth 4s linear infinite;
}

.scroll-top-btn:hover::before { opacity: 0.8; }
.scroll-top-btn:hover { color: var(--neon-violet); border-color: rgba(188, 19, 254, 0.5); }

/* --- АНИМАЦИИ ПРИ КЛИКЕ --- */
.scroll-top-btn.clicked {
    animation: calendar-flip 0.7s ease-in-out;
}

/* Искры разлетающиеся во все стороны */
.scroll-top-btn.clicked::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    background: transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    /* Рисуем 8 искр с помощью теней, используя ваши переменные */
    box-shadow: 
        0 -40px 0 2px var(--ember-hot), 
        40px -40px 0 0 var(--neon-violet), 
        40px 0 0 2px var(--neon-green), 
        40px 40px 0 0 var(--ember-hot), 
        0 40px 0 2px var(--neon-violet), 
        -40px 40px 0 0 var(--neon-green), 
        -40px 0 0 2px var(--ember-hot), 
        -40px -40px 0 0 var(--neon-violet);
    animation: sparks-burst 0.7s ease-out forwards;
    pointer-events: none;
}

@keyframes calendar-flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(180deg) scale(1.1); } /* Переворот и легкое увеличение */
    100% { transform: rotateX(360deg) scale(1); }  /* Возврат в исходное (полный оборот) */
}

@keyframes sparks-burst {
    0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@media (max-width: 768px) {
    /* 1. Сбрасываем сетку шапки и карточек */
    .table-legend {
        display: none !important; /* На мобилках легенда не нужна */
    }

    .card-main {
        display: flex !important;
        flex-direction: column !important; /* Все элементы в столбик */
        width: 100% !important;
        padding: 15px !important;
        gap: 12px;
    }

    /* 2. Сбрасываем жесткие отступы и границы колонок */
    .col-sep {
        width: 100% !important;
        border-right: none !important;
        padding: 0 !important;
        justify-content: flex-start !important;
        min-height: auto !important;
    }

    .col-sep:last-child {
        margin-top: 10px;
        padding-top: 15px !important;
        border-top: 1px solid var(--divider);
        justify-content: center !important; /* Центрируем кнопку внутри контейнера */
        width: 100% !important;
    }

    /* 3. Ограничиваем ширину контейнеров */
    header, main, footer {
        width: 100% !important;
        max-width: 100vw !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* 4. Поиск должен занимать всю доступную ширину */
    .header-main {
        width: 100% !important;
        display: flex;
        justify-content: center;
    }

    .search-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    #searchInput {
        width: 100% !important;
        font-size: 16px; /* Предотвращает авто-зум в iOS */
    }

    /* 5. Кнопка видео на всю ширину для удобства нажатия */
    .yt-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto !important; /* Убираем растяжение на всю ширину */
        min-width: 120px; /* Даем минимальную ширину для удобства нажатия */
        padding: 8px 20px !important;
        background: rgba(255, 0, 0, 0.1);
        border: 1px solid rgba(255, 0, 0, 0.3);
        border-radius: 8px;
    }
}