/* Навигация версии для игроков */
.player-nav {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.player-nav-link {
    flex: 1 1 0;
    text-align: center;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #424242;
    background: #2a2a2a;
    color: #e0e0e0;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
}

.player-nav-link:hover {
    background: #333;
    border-color: #666;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

.player-nav-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.player-nav-link.active {
    background: #ff9800;
    border-color: #ffb74d;
    color: #111;
    box-shadow: 0 6px 18px rgba(255, 152, 0, 0.45);
}

@media (max-width: 768px) {
    .player-nav {
        flex-direction: column;
    }

    .player-nav-link {
        flex: 1 1 100%;
    }
}

/* Дополнительный класс, если нужно отдельно стилизовать блок фильтров рейтинга */
.rating-filters {
    display: flex;
    gap: 8px;
    padding: 20px 30px 16px 30px;
    border-bottom: 2px solid #424242;
}

.rating-filters .filter-tab {
    padding: 6px 14px;
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.rating-filters .filter-tab:hover {
    background: #1e3a4d;
    border-color: #42a5f5;
    color: #eaf6ff;
}

.rating-filters .filter-tab.active {
    background: #2196f3;
    border-color: #42a5f5;
    color: #fff;
    font-weight: 600;
}

/* Заголовок секции турниров (версия для игроков) */
.tournaments-page-header {
    padding: 20px 30px 10px 30px;
}

/* Фильтры на странице турниров (версия для игроков) */
.tournaments-filters {
    display: flex;
    gap: 8px;
    padding: 10px 30px 14px 30px;
    border-bottom: 2px solid #424242;
}

.tournaments-filters .filter-tab {
    padding: 6px 14px;
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tournaments-filters .filter-tab:hover {
    background: #1e3a4d;
    border-color: #42a5f5;
    color: #eaf6ff;
}

.tournaments-filters .filter-tab.active {
    background: #2196f3;
    border-color: #42a5f5;
    color: #fff;
    font-weight: 600;
}

/* Цвета кнопок фильтров по тирам — как у бейджей в таблице */
.tournaments-filters .filter-tab.active[data-tier="S-Tier"] {
    background: #e91e63;
    border-color: #e91e63;
}
.tournaments-filters .filter-tab.active[data-tier="A-Tier"] {
    background: #ff9800;
    border-color: #ff9800;
}
.tournaments-filters .filter-tab.active[data-tier="B-Tier"] {
    background: #2196f3;
    border-color: #42a5f5;
}
.tournaments-filters .filter-tab.active[data-tier="C-Tier"] {
    background: #9e9e9e;
    border-color: #9e9e9e;
}

/* Бейджи статуса турниров в колонке «Статус» */
.tournaments-table .tournament-tier {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}
.tournaments-table .tier-btier {
    background: #2196f3;
    color: white;
}
.tournaments-table .tier-atier {
    background: #ff9800;
    color: white;
}
.tournaments-table .tier-stier {
    background: #e91e63;
    color: white;
}
.tournaments-table .tier-ctier {
    background: #9e9e9e;
    color: white;
}

/* Ссылка названия турнира */
.tournaments-table a.tournament-name-cell,
.tournaments-table .tournament-name-link {
    color: #2196f3;
    text-decoration: none;
}
.tournaments-table a.tournament-name-cell:hover,
.tournaments-table .tournament-name-link:hover {
    text-decoration: underline;
}

/* --- Страница одного турнира: отступы, ссылка «Назад», таблица + блок информации --- */
.tournament-page {
    padding-left: 30px;
    padding-right: 30px;
    padding-top: 20px;
    padding-bottom: 20px;
}
.tournament-page-header .tournament-page-title {
    margin-left: 0;
    padding-left: 0;
}
.tournament-back-link {
    display: inline-block;
    padding: 8px 0;
    color: #9e9e9e;
    text-decoration: none;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}
.tournament-back-link:hover {
    color: #2196f3;
}

/* --- Страница одной команды --- */
.team-page {
    padding-left: 30px;
    padding-right: 30px;
    padding-top: 20px;
    padding-bottom: 20px;
}
.team-page-header {
    margin-bottom: 12px;
}
.team-page-title {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
}
.team-page-summary {
    margin-bottom: 24px;
}
.team-page-summary p {
    margin: 6px 0;
}
.team-matches-section {
    margin-top: 20px;
}
.team-section-title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
}

/* --- Статистика команды на отдельной странице --- */
.team-stats-section {
    margin-top: 8px;
    margin-bottom: 24px;
}
.team-stats-title {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2196f3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.team-stats-title::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 16px;
    background: linear-gradient(to bottom, #2196f3 2px, transparent 2px);
    background-size: 4px 4px;
    opacity: 0.9;
}
.team-stats-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.team-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.team-stats-card {
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 8px;
    padding: 14px 16px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 160px;
}
/* Стиль как на скриншоте: значение сверху (крупно), подпись снизу */
.team-stats-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 4px;
}
.team-stats-label {
    font-size: 0.875rem;
    font-weight: 400;
    color: #e0e0e0;
}
.team-stats-card--neutral {
    border-left-width: 1px;
    border-left-color: #424242;
}
.team-stats-card--blue   { border-left: 4px solid #2196f3; }
.team-stats-card--green  { border-left: 4px solid #4caf50; }
.team-stats-card--red    { border-left: 4px solid #f44336; }
.team-stats-card--cyan   { border-left: 4px solid #00bcd4; }
.team-stats-card--orange { border-left: 4px solid #ff9800; }
.team-stats-card--purple { border-left: 4px solid #9c27b0; }
.team-stats-card--gray   { border-left: 4px solid #9e9e9e; }
.team-stats-card--yellow { border-left: 4px solid #ffeb3b; }

/* --- Статистика производительности (график + боковая панель) --- */
.performance-stats-section {
    margin-top: 24px;
    margin-bottom: 24px;
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 10px;
    overflow: hidden;
    padding: 20px;
}
.performance-stats-title {
    margin: 0 0 16px 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}
.performance-chart-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
    flex-wrap: wrap;
}
.performance-chart-main {
    flex: 1 1 400px;
    min-width: 0;
}
.performance-chart-nav {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.performance-chart-range {
    font-size: 0.9rem;
    color: #aaa;
}
.performance-chart-canvas-wrap {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 12px;
    overflow: hidden;
    min-height: 320px;
}
.performance-chart-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 320px;
}
.performance-chart-sidebar {
    flex: 0 0 200px;
    background: #252525;
    border: 1px solid #424242;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.performance-wl {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.performance-wl-w {
    background: #2e7d32;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
}
.performance-wl-sep {
    color: #888;
    font-weight: 600;
}
.performance-wl-l {
    background: #c62828;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
}
.performance-elo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.performance-elo-label {
    font-size: 0.9rem;
    color: #aaa;
}
.performance-elo-value {
    font-weight: 700;
    color: #fff;
}
.performance-elo-value.performance-elo-change.positive {
    color: #4caf50;
}
.performance-elo-value.performance-elo-change.negative {
    color: #f44336;
}

@media (max-width: 700px) {
    .performance-chart-sidebar {
        flex: 1 1 100%;
    }
}

/* Таблица истории рейтинга на странице игрока */
.team-history-table-container {
    margin-top: 8px;
    border-radius: 8px;
    border: 1px solid #424242;
    background: #2a2a2a;
    overflow-x: auto;
}
.team-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.team-history-table thead {
    background: #1a1a1a;
}
.team-history-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    border-bottom: 2px solid #424242;
    white-space: nowrap;
}
.team-history-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #424242;
    color: #e0e0e0;
}
.team-history-table a {
    color: #2196f3;
    text-decoration: none;
}
.team-history-table a:hover {
    text-decoration: underline;
}
.team-history-table tbody tr:hover td {
    background: #333333;
}
.team-history-table tbody tr:last-child td {
    border-bottom: none;
}
.team-history-table .delta-positive {
    color: #4caf50;
    font-weight: 600;
}
.team-history-table .delta-negative {
    color: #f44336;
    font-weight: 600;
}

.rating-team-link,
.teams-letter-link {
    color: #2196f3;
    text-decoration: none;
}
.rating-team-link:hover,
.teams-letter-link:hover {
    text-decoration: underline;
}

.tournament-results-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.tournament-results-layout-info-only {
    margin-bottom: 28px;
}
.tournament-results-table-wrap {
    flex: 0 1 auto;
    min-width: 0;
    background: #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #424242;
}
.tournament-results-table {
    width: max-content;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.tournament-results-table thead {
    background: #1e1e1e;
    color: #fff;
}
.tournament-results-table th {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #424242;
}
.tournament-results-table th:first-child {
    text-align: center;
}
.tournament-results-table th:nth-child(2),
.tournament-results-table th:nth-child(3) {
    text-align: center;
}
.tournament-results-table th:nth-child(4) {
    text-align: left;
}
.tournament-results-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #383838;
    color: #e0e0e0;
}
.tournament-results-table td:nth-child(1) {
    text-align: center;
}
.tournament-results-table td:nth-child(2),
.tournament-results-table td:nth-child(3) {
    text-align: center;
}
.tournament-results-table td:nth-child(4) {
    text-align: left;
}
.tournament-results-table td.result-team-cell {
    text-align: left;
}
.tournament-results-table tbody tr:last-child td {
    border-bottom: none;
}
/* Заливка цветом только в первом столбце «Место». Не ставим display:flex на td — ломает rowspan. */
.tournament-results-table td.result-place-cell,
.tournament-results-table td[class*="result-place-cell"] {
    vertical-align: middle;
}
.result-place-cell .result-place-cell-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 100%;
}
.tournament-result-row.place-1 .result-place-cell,
.tournament-result-row.place-1 .result-place-cell .result-place-cell-inner {
    background: #FFD700;
    color: #111;
}
.tournament-result-row.place-2 .result-place-cell,
.tournament-result-row.place-2 .result-place-cell .result-place-cell-inner {
    background: #C0C0C0;
    color: #111;
}

/* --- Страница одного турнира: таблица «Матчи турнира» --- */
.tournament-matches-section {
    margin-top: 18px;
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 10px;
    overflow: hidden;
}

.tournament-matches-header {
    padding: 14px 16px;
    background: #1e1e1e;
    border-bottom: 1px solid #424242;
}

.tournament-matches-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}

.tournament-matches-table-container {
    overflow-x: auto;
}

.tournament-matches-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 860px; /* чтобы таблица не ломалась на узких экранах */
}

.tournament-matches-table thead {
    background: #202020;
    color: #fff;
}

.tournament-matches-table th {
    padding: 10px 12px;
    font-weight: 600;
    border-bottom: 1px solid #424242;
    text-align: left;
    white-space: nowrap;
}

.tournament-matches-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #383838;
    color: #e0e0e0;
    vertical-align: middle;
}

.tournament-matches-table tbody tr:nth-child(odd) td {
    background: rgba(255, 255, 255, 0.02);
}

.tournament-matches-table tbody tr:hover td {
    background: rgba(33, 150, 243, 0.08);
}

.tournament-match-id,
.tournament-match-format {
    white-space: nowrap;
}

.tournament-matches-table th.tournament-match-game-th,
.tournament-match-game {
    text-align: center;
}
.tournament-match-game {
    white-space: nowrap;
}

.tournament-match-date,
.tournament-match-stage {
    white-space: nowrap;
}

.tournament-match-team {
    font-weight: 600;
    white-space: nowrap;
    width: 1%;
}

.tournament-match-team-link {
    color: #2196f3;
    text-decoration: none;
}

.tournament-match-team-link:hover {
    text-decoration: underline;
}

.tournament-matches-table th.tournament-match-score-th,
.tournament-match-score {
    text-align: center;
}
.tournament-match-score {
    white-space: nowrap;
}

.tournament-match-team.team-winner {
    color: #a5d6a7;
}

.tournament-match-team.team-loser {
    color: #ef9a9a;
    opacity: 0.95;
}

.tournament-match-team.team-draw {
    color: #e0e0e0;
    opacity: 0.9;
}

/* Цвет ссылок внутри ячеек победителя/проигравшего */
.tournament-match-team.team-winner .tournament-match-team-link {
    color: #a5d6a7;
}

.tournament-match-team.team-loser .tournament-match-team-link {
    color: #ef9a9a;
}

.tournament-match-team.team-draw .tournament-match-team-link {
    color: #e0e0e0;
}
.tournament-result-row.place-3 .result-place-cell,
.tournament-result-row.place-3 .result-place-cell .result-place-cell-inner {
    background: #CD7F32;
    color: #fff;
}
.tournament-result-row.place-4 .result-place-cell,
.tournament-result-row.place-4 .result-place-cell .result-place-cell-inner {
    background: #B87333;
    color: #fff;
}
.tournament-result-row:not(.place-1):not(.place-2):not(.place-3):not(.place-4) .result-place-cell,
.tournament-result-row:not(.place-1):not(.place-2):not(.place-3):not(.place-4) .result-place-cell .result-place-cell-inner {
    background: #333;
    color: #e0e0e0;
}
.result-place-medal-icon {
    font-size: 1.5rem;
    line-height: 1;
}
.result-place-label {
    font-weight: 600;
}
.result-team-link {
    color: #2196f3;
    text-decoration: none;
}
.result-team-link:hover {
    text-decoration: underline;
}
.result-bonus-cell {
    white-space: nowrap;
}

/* Блок информации о турнире (справа) — тянется до края контейнера */
.tournament-info-block {
    flex: 1 1 280px;
    min-width: 280px;
    background: #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #424242;
}
.tournament-info-block-title {
    background: #3d4a2e;
    color: #fff;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 1rem;
}
.tournament-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 16px;
    border-bottom: 1px solid #383838;
    gap: 12px;
}
.tournament-info-row:last-child {
    border-bottom: none;
}
.tournament-info-label {
    color: #aaa;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.tournament-info-value {
    color: #e0e0e0;
    font-weight: 500;
    text-align: right;
}
.tournament-results-layout-info-only .tournament-info-block {
    flex: 1 1 320px;
    min-width: 320px;
}

/* --- Страница «Матчи»: ссылки и счёт --- */
.matches-table .matches-table-link {
    color: #2196f3;
    text-decoration: none;
}
.matches-table .matches-table-link:hover {
    text-decoration: underline;
}
.matches-table .matches-score-cell {
    text-align: center;
}
.matches-table .team-winner .matches-table-link {
    color: #4caf50;
}
.matches-table .team-loser .matches-table-link {
    color: #f44336;
}

/* --- Страница «Матчи»: блок статистики (карточки) --- */
.matches-stats-section {
    margin-bottom: 24px;
}
.matches-stats-title {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2196f3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.matches-stats-title::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 16px;
    background: linear-gradient(to bottom, #2196f3 2px, transparent 2px);
    background-size: 4px 4px;
    opacity: 0.9;
}
.matches-stats-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    width: 100%;
}
@media (max-width: 900px) {
    .matches-stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 500px) {
    .matches-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
.matches-stats-card {
    background: #2a2a2a;
    border: 1px solid #424242;
    border-radius: 8px;
    padding: 12px 14px;
    border-left-width: 4px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.matches-stats-label {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 4px;
}
.matches-stats-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}
.matches-stats-card--blue   { border-left-color: #2196f3; }
.matches-stats-card--green  { border-left-color: #4caf50; }
.matches-stats-card--orange { border-left-color: #ff9800; }
.matches-stats-card--purple { border-left-color: #9c27b0; }
.matches-stats-card--red    { border-left-color: #f44336; }
.matches-stats-card--cyan   { border-left-color: #00bcd4; }

/* Подсказка при ошибке загрузки (локальный сервер) */
.empty-message--load {
    font-style: normal;
    max-width: 520px;
    margin: 0 auto;
}
.empty-message--load code {
    display: inline-block;
    padding: 2px 8px;
    background: #333;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}
