:root { 
    --bg: #1a1a1a; 
    --card: #242424; 
    --header-bg: #121212; 
    --slot-bg: #1e1e1e;
    --role-active-bg: #3E4C54; 
    --text: #eeeeee; 
    --accent: #2ecc71; 
    --dropdown-bg: #1e1e1e; 
    --dropdown-hover: #2a2a2a; 
    --separator: #333333;
}

body { 
    background: var(--bg); 
    color: var(--text); 
    font-family: 'Google Sans Code', monospace; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 0px; 
    margin: 0; 
    min-height: 100vh;
    box-sizing: border-box;
}

/* Центрирование контента и ограничение ширины */
.titles-container { 
    text-align: center; 
    margin-top: 25px; /* Это создаст нужное расстояние от меню */
    margin-bottom: 50px; 
    width: 100%;
}

h1 { 
    margin: 0; 
    letter-spacing: 6px; 
    font-weight: 700; 
    color: #fff; 
    text-transform: uppercase; 
    font-size: clamp(24px, 5vw, 40px); 
}

.subtitle { 
    margin-top: 10px; 
    color: #666; 
    font-size: 13px; 
    letter-spacing: 2px; 
    text-transform: uppercase; 
    font-weight: 700; 
}

.nations-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); 
    gap: 30px; 
    width: 100%; 
    max-width: 1400px; /* Ограничиваем ширину для больших экранов */
    flex: 1; 
}

.country-card { 
    background: var(--card); 
    border: 1px solid var(--separator); 
    overflow: visible; 
    position: relative; 
    z-index: 1; 
}

.country-card.active-dropdown { z-index: 999; }

.country-header { 
    height: 90px; 
    padding: 0 20px; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    background: var(--header-bg); 
    border-bottom: 1px solid var(--separator); 
    position: relative; 
    overflow: hidden;
}

.flag-bg {
    position: absolute; 
    right: 0; 
    top: 0; 
    height: 100%; 
    width: 70%; 
    background-size: cover; 
    background-position: center;
    -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 100%); 
    opacity: 0.6; 
    z-index: 1;
}

.flag-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(to right, #121212 0%, rgba(18,18,18,0) 65%); 
    z-index: 2; 
}

.country-name { 
    font-weight: 700; 
    text-transform: uppercase; 
    color: #fff; 
    z-index: 3; 
    font-size: 24px; 
    position: relative; 
}

.download-link { 
    font-size: 10px; 
    color: #888; 
    cursor: pointer; 
    margin-top: 2px; 
    z-index: 4; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    position: relative; 
    font-family: 'Google Sans Code', monospace; /* Исправлено по просьбе */
}

.download-link:hover { color: var(--accent); }

.squad-row { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    background: var(--separator); 
    gap: 1px; 
}

.player-slot { 
    background: var(--slot-bg); 
    position: relative; 
    display: flex; 
    flex-direction: column; 
}

.player-role { 
    width: 100%; 
    height: 30px; 
    background: var(--slot-bg); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: #333; 
    transition: all 0.2s;
}

.player-slot.has-player .player-role { 
    background: var(--role-active-bg); 
    color: #fff; 
}

.photo-container { 
    width: 100%; 
    aspect-ratio: 1/1; 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: var(--slot-bg); 
}

.player-photo { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    z-index: 1; 
    display: none; 
}

.slot-hint { 
    position: absolute; 
    font-size: 40px; 
    color: #2a2a2a; 
    font-weight: bold; 
}

.player-label { 
    width: 100%; 
    background: var(--header-bg); 
    font-size: 11px; 
    text-align: center; 
    padding: 12px 0; 
    border-top: 1px solid var(--separator); 
    color: #fff; 
    font-weight: 700; 
}

/* NAVIGATION */
.top-nav {
    width: 100%;
    padding: 40px 0 0 0; /* Было 40px */
    display: flex;
    justify-content: center;
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    background-color: transparent; /* Изменил с #151515 на прозрачный */
    padding: 10px 25px;
    border-radius: 100px;
    border: none;
    box-shadow: none; /* Также убрал тень, чтобы фон полностью исчез */
}

.nav-item {
    text-decoration: none;
    color: #666;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item:hover { color: #bbb; }
.nav-item.active { color: #FFFFFF; }

.nav-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

/* DROPDOWN */
.custom-dropdown { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; }

.search-input {
    width: 100%;
    padding: 12px;
    background: #121212;
    border: none;
    border-bottom: 1px solid #444;
    color: #fff;
    font-family: 'Google Sans Code', monospace;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dropdown-trigger { width: 100%; height: 100%; background: transparent; border: none; cursor: pointer; }

.dropdown-menu { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    width: 260px; 
    max-height: 300px; 
    background: var(--dropdown-bg); 
    border: 1px solid #444; 
    box-shadow: 0 15px 50px rgba(0,0,0,0.9); 
    overflow-y: auto; 
    display: none; 
    z-index: 9999; 
}

.custom-dropdown.open .dropdown-menu { display: block; }

.dropdown-item { 
    display: flex; 
    align-items: center; 
    padding: 10px 12px; 
    cursor: pointer; 
    border-bottom: 1px solid #2a2a2a; 
}

.dropdown-item:hover { background: var(--dropdown-hover); }
.item-avatar { width: 34px; height: 34px; object-fit: cover; margin-right: 12px; background: #333; }

footer {
    margin-top: 40px; /* Отступ над футером */
    padding: 40px 0;  /* Одинаковый отступ сверху и снизу внутри футера */
    border-top: 1px solid var(--separator);
    width: 100%;
    text-align: center;
}

/* Оверлей на весь экран */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none; /* Управляется через JS */
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 50px 0;
}

.modal-content {
    background: #121212;
    width: 90%;
    max-width: 1200px;
    padding: 6px 30px 30px 30px; /* Уменьшили верхний отступ с 30px до 15px */
    border-radius: 0px;            /* Убрали закругление углов (было 8px или 12px) */
    position: relative;
    border: 1px solid #333;
}

.close-btn {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    color: #666; font-size: 30px;
    cursor: pointer;
}
/* Настройка сетки внутри модалки (как в основном гриде) */
#stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Чтобы слоты в статистике выглядели компактнее, так как их может быть меньше 5 */
#stats-container .squad-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

/* Счётчик пиков поверх фото или под именем */
.pick-count {
    font-size: 12px;
    color: #ffb700;
    font-weight: bold;
    margin-top: 5px;
}

#save-rosters-btn,
#show-stats {
    background: none;
    border: 1px solid #333333; /* --border-color из вашего файла */
    color: #666666;
    font-family: 'Google Sans Code', monospace;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: 0.2s;
    gap: 200px;
    margin-bottom: 200px;
    margin: 30px 3px; /* небольшое расстояние между кнопками */
    display: inline-block;
    border-radius: 0; /* убираем закругления, если были */
}

#save-rosters-btn:hover, 
#show-stats:hover {
    border-color: #ffffff; /* --accent из вашего файла */
    color: #ffffff;
}

.titles-container {
    text-align: center;
    margin-bottom: 0px;
}

.download-button {
    /* Сбрасываем старые стили градиентов или теней, если они мешают */
    box-shadow: none !important;
    background-image: none !important;
}

/* Сетка для статистики в поп-ауте (4 игрока в ряд, до 2 рядов) */
.stats-grid-5 {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important; 
    grid-template-rows: auto; 
    gap: 0 !important;
    background: transparent !important;
    width: 100%;
}

.stats-grid-5 .player-slot {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

.stats-grid-5 .pick-count {
    background: var(--header-bg);
    color: #ffb700;
    font-size: 10px;
    font-weight: 700;
    padding: 0 0 10px 0;
    text-align: center;
    border-bottom: none;
}

/* Убираем лишние отступы у лейбла, чтобы влез счетчик */
.stats-grid-5 .player-label {
    padding: 10px 0 5px 0;
    border-bottom: none;
}

/* Адаптив: если экран узкий, переключаем на 2 или 3 в ряд */
@media (max-width: 1000px) {
    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Робимо хедери неклікабельними */
.country-header.no-click {
    cursor: default;
    pointer-events: none; /* Користувач не зможе взаємодіяти з елементами всередині */
}

/* Прибираємо межі між гравцями (сітку) */
.squad-row.no-gap {
    gap: 0 !important;
    background: transparent !important;
}

/* Прибираємо внутрішні межі слотів */
.player-slot.no-border {
    border: none !important;
}

.player-label.no-border {
    border-bottom: 1px !important; /* Видаляє лінію знизу */
    padding-bottom: none !important; /* Зменшує відступ для кращого вигляду */
}

.pick-count.thin-font {
    border-top: none !important;
    font-weight: 700 !important;
    font-size: 10px;
    color: #888;
    text-align: center;
    background: var(--header-bg);
    padding-bottom: 12px;
}

.player-slot.no-border {
    border: none !important;
    display: flex;
    flex-direction: column;
}

/* Стиль для напису загальної кількості піків у хедері */
.total-picks-label {
    font-size: 10px;
    color: #ffffff;
    z-index: 10;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
}

/* Для основної сітки у модалці */
.stats-grid-5 {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
}

/* Полностью убираем любые разделительные линии в карточках статистики */
.stats-grid-5 .player-label,
.stats-grid-5 .player-label.no-border {
    border-top: none !important;
    border-bottom: none !important;
}

.stats-grid-5 .pick-count,
.stats-grid-5 .pick-count.thin-font {
    border-top: none !important;
    margin-top: 0 !important; /* Убираем возможные зазоры */
}

/* Убираем разделитель в самом слоте, если он есть */
.stats-grid-5 .player-slot.no-border {
    border: none !important;
}

/* 1. Сетка СТРАН (чтобы было 3-4 страны в ряд, как раньше) */
#stats-modal .nations-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)) !important; /* Возвращаем колонки стран */
    gap: 20px !important;
    padding: 20px !important;
    width: 100% !important;
}

/* 2. Сетка ИГРОКОВ внутри каждой страны (строго 5 в ряд) */
#stats-modal .stats-grid-5 {
    display: grid !important;
    grid-template-columns: repeat(5, 100fr) !important; /* Магия 5 колонок */
    grid-template-rows: auto !important;
    gap: 0 !important;
    background: var(--separator) !important;
    width: 100% !important;
}

/* 3. Убираем фиксу с ширины слотов, которая выталкивала 5-го игрока */
#stats-modal .stats-grid-5 .player-slot {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
}

/* Фикс для мобилок, чтобы не поплыло */
@media (max-width: 1100px) {
    #stats-modal .nations-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    }
}

.footer-text { font-size: 12px; color: #666; letter-spacing: 2px; margin-bottom: 15px; }
.social-icon { width: 24px; height: 24px; fill: #666; margin: 0 10px; transition: fill 0.2s; }
.social-icon:hover { fill: var(--accent); }