/* ========== ТУРНИРЫ ========== */
#tab-tournaments.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tournaments-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    padding: 2px;
    padding-right: 4px;
}

/* Видимый скроллбар для турниров */
.tournaments-grid::-webkit-scrollbar {
    width: 8px;
}

.tournaments-grid::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.tournaments-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.tournaments-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

/* Центрирование через auto margin */
.tournament-card:first-child {
    margin-top: auto;
}

.tournament-card:last-child {
    margin-bottom: auto;
}

.tournament-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.tournament-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tournament-card.clan-tournament {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 2px solid #667eea30;
}

.tournament-card.clan-tournament:hover {
    border-color: #667eea;
}

.tournament-icon {
    font-size: 1.6em;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.tournament-content {
    flex: 1;
    min-width: 0;
}

.tournament-card h3 {
    margin-bottom: 1px;
    color: #333;
    font-size: 0.85em;
}

.tournament-card p {
    color: #666;
    font-size: 0.7em;
    margin-bottom: 2px;
    line-height: 1.2;
}

.tournament-schedule {
    display: flex;
    gap: 6px;
    font-size: 0.65em;
    color: #555;
    font-weight: 500;
}

/* Динамический статус от JS */
.tournament-card .tournament-status {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 0;
    margin: 0;
    background: transparent;
    font-size: 0.65em;
    flex-wrap: wrap;
    align-items: center;
}

.tournament-card .tournament-status .status-upcoming,
.tournament-card .tournament-status .format,
.tournament-card .tournament-status .participants {
    font-size: 1em;
    white-space: nowrap;
}

.tournament-card .play-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.75em;
}

/* ========== DESKTOP: 5 карточек в ряд ========== */
@media (min-width: 1000px) {
    .tournaments-grid {
        flex-direction: row;
        gap: 10px;
        align-items: stretch;
        overflow: visible;
        justify-content: center;
    }
    
    .tournament-card:first-child {
        margin-top: 0;
    }
    
    .tournament-card:last-child {
        margin-bottom: 0;
    }
    
    .tournament-card {
        flex: 1;
        flex-direction: column;
        text-align: center;
        padding: 12px 10px;
        justify-content: flex-start;
        min-width: 0;
    }
    
    .tournament-icon {
        font-size: 2em;
        width: auto;
        margin-bottom: 6px;
    }
    
    .tournament-content {
        width: 100%;
    }
    
    .tournament-card h3 {
        font-size: 0.9em;
        margin-bottom: 3px;
    }
    
    .tournament-card p {
        font-size: 0.7em;
        margin-bottom: 4px;
    }
    
    .tournament-schedule {
        justify-content: center;
        flex-direction: column;
        gap: 1px;
        margin-bottom: 6px;
        font-size: 0.65em;
    }
    
    .tournament-card .tournament-status {
        flex-direction: column;
        gap: 2px;
        margin-bottom: 6px;
        font-size: 0.6em;
    }
    
    .tournament-card .play-btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 0.8em;
        margin-top: auto;
    }
}

/* ========== БОЛЬШИЕ ЭКРАНЫ ========== */
@media (min-width: 1200px) {
    .tournaments-grid {
        gap: 14px;
    }
    
    .tournament-card {
        padding: 16px 14px;
    }
    
    .tournament-icon {
        font-size: 2.5em;
        margin-bottom: 8px;
    }
    
    .tournament-card h3 {
        font-size: 1em;
        margin-bottom: 4px;
    }
    
    .tournament-card p {
        font-size: 0.8em;
        margin-bottom: 6px;
    }
    
    .tournament-schedule {
        font-size: 0.75em;
        margin-bottom: 8px;
    }
    
    .tournament-card .tournament-status {
        font-size: 0.7em;
        margin-bottom: 8px;
    }
    
    .tournament-card .play-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

/* ========== ТУРНИРЫ СТАТУСЫ ========== */
.tournament-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-active {
    color: #28a745;
    font-weight: bold;
}

.status-upcoming {
    color: #ffc107;
    font-weight: bold;
}

.status-waiting {
    color: #6c757d;
}

.tournament-status .participants,
.tournament-status .time {
    font-size: 0.9em;
    color: #666;
}

.tournament-status .format {
    font-size: 0.8em;
    color: #667eea;
    font-weight: bold;
}

button.joined {
    background: #6c757d !important;
    cursor: default;
}

button.registered {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
}

button.registered:hover {
    background: linear-gradient(135deg, #c82333, #bd2130) !important;
}

/* ========== ЛОББИ ТУРНИРА ========== */
.tournament-lobby {
    width: calc(100vw - 16px);
    height: calc(100svh - 74px);
    max-width: 1200px;
    max-height: calc(100svh - 74px);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.tournament-lobby .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    height: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 10px;
    transition: all 0.2s;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.tournament-lobby .modal-close:hover {
    transform: scale(1.1);
}

.tournament-lobby h2 {
    margin: 0 0 8px 0;
    padding-right: 60px;
    flex-shrink: 0;
}

.tournament-lobby .bracket-preview,
.tournament-lobby .tournament-participants {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tournament-lobby .participants-list {
    max-height: none;
    flex: 1;
    overflow-y: auto;
}

.tournament-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.tournament-status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.tournament-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.tournament-status-badge.waiting {
    background: #fff3cd;
    color: #856404;
}

.tournament-participants {
    margin-bottom: 20px;
}

.tournament-participants h3 {
    margin-bottom: 15px;
}

.participants-list {
    max-height: 300px;
    overflow-y: auto;
}

.tournament-participant {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.tournament-participant.new {
    animation: fadeIn 0.3s ease;
    background: #d4edda;
}

.tournament-participant.me {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
}

.tournament-participant.clickable {
    cursor: pointer;
}

.tournament-participant.clickable:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.participant-position {
    font-weight: bold;
    color: #667eea;
    width: 40px;
}

.participant-rating {
    color: #666;
}

.no-participants {
    text-align: center;
    color: #999;
    padding: 20px;
}

.tournament-hint {
    text-align: center;
    color: #666;
    margin-bottom: 8px;
    font-style: italic;
    font-size: 0.9em;
}

.tournament-actions {
    text-align: center;
    flex-shrink: 0;
    padding-top: 8px;
}

.tournament-actions .play-btn {
    margin: 3px;
}

.tournament-actions .play-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.participants-count {
    font-size: 0.9em;
    color: #666;
}

/* ========== BRACKET ========== */
.bracket-preview {
    margin: 8px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.bracket-preview h3 {
    margin-bottom: 8px;
    font-size: 0.95em;
    color: #333;
}

.bracket-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.bracket-match {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.85em;
    border: 1px solid #e9ecef;
}

.match-player-wrap {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-player-wrap:hover {
    opacity: 0.8;
}

.match-player-wrap .avatar-with-vip {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-player-wrap .avatar-with-vip .match-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #aaa;
    background-image: url('/images/photo.png');
    background-size: cover;
    background-position: center;
}

.match-player-wrap .avatar-with-vip .vip-badge {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 6px;
    padding: 1px 3px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border-radius: 2px;
    font-weight: bold;
    z-index: 1;
}

.match-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #aaa;
    background-image: url('/images/photo.png');
    background-size: cover;
    background-position: center;
}

.match-avatar-empty {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed #ccc;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.match-player-wrap.winner .match-avatar,
.match-player-wrap.winner .avatar-with-vip .match-avatar {
    border-color: #28a745;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.5);
}

.match-player-wrap.me .match-avatar,
.match-player-wrap.me .avatar-with-vip .match-avatar {
    border-color: #667eea;
    box-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
}

.bracket-match.done {
    background: #d4edda;
    border-color: #28a745;
}

.bracket-match.running {
    background: #fff3cd;
    border-color: #ffc107;
    animation: pulse 1.5s infinite;
}

.bracket-match.pending {
    background: #e2e3e5;
}

.bracket-match.my-match {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.match-player {
    font-weight: 500;
}

.match-player.winner {
    color: #28a745;
    font-weight: bold;
}

.match-player.me {
    font-weight: bold;
    color: #667eea;
}

.match-player.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.match-player.clickable:hover {
    color: #667eea;
    text-decoration: underline;
}

.match-vs {
    color: #999;
    font-size: 0.8em;
}

.more-matches {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 10px;
    font-style: italic;
}

.bracket-match-info {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    text-align: center;
    flex-shrink: 0;
}

.bracket-match-info h3 {
    margin: 0 0 4px 0;
    color: #667eea;
    font-size: 0.95em;
}

.bracket-match-info p {
    margin: 2px 0;
    color: #333;
    font-size: 0.85em;
}

.bracket-match-info.waiting {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
}

.bracket-match-info .waiting-message {
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
}

.bracket-match-info .waiting-message p {
    margin: 3px 0 0;
    color: #666;
    font-size: 0.8em;
}

.bracket-match-info .waiting-icon {
    font-size: 1.2em;
    animation: spin 2s linear infinite;
}

/* ========== РАУНДЫ СЕТКИ ========== */
.bracket-round {
    margin-bottom: 20px;
}

.bracket-round h4 {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.bracket-round h4:hover {
    color: #333;
}

.round-toggle {
    font-size: 0.8em;
    width: 12px;
}

.round-count {
    font-weight: normal;
    color: #999;
    font-size: 0.85em;
}

.bracket-round.collapsed .bracket-matches {
    display: none;
}

.tournament-format {
    font-size: 0.85em;
    padding: 3px 10px;
    background: #e9ecef;
    border-radius: 12px;
    color: #495057;
}

/* ========== ТАЙМЕР ГОТОВНОСТИ ========== */
.ready-timer-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 4px;
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85em;
}

.ready-timer {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    min-width: 28px;
    text-align: center;
}

.ready-timer.warning {
    color: #dc3545;
    animation: blink 0.5s infinite;
}

.pulse-btn {
    animation: pulse-scale 1.5s infinite;
}

/* ========== ПОПАПЫ ТУРНИРА ========== */
.elimination-popup {
    text-align: center;
    max-width: 400px;
}

.elimination-icon {
    font-size: 4em;
    margin: 20px 0;
}

.elimination-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.elimination-rewards {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
}

.elimination-rewards span {
    font-size: 1.1em;
    font-weight: bold;
}

.elimination-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.elimination-actions .play-btn {
    flex: 1;
    max-width: 150px;
}

.tournament-result-popup {
    text-align: center;
    max-width: 400px;
}

.result-icon {
    font-size: 5em;
    margin: 20px 0;
    animation: bounce 0.5s ease;
}

.result-message {
    color: #666;
    margin-bottom: 20px;
}

.reward-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    font-size: 1.2em;
}

.reward-info span {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    padding: 10px 15px;
    border-radius: 10px;
}

/* ========== ОЖИДАНИЕ ========== */
.waiting-info {
    text-align: center;
    padding: 30px;
}

.waiting-icon {
    font-size: 3em;
    animation: spin 2s linear infinite;
}

.waiting-info h3 {
    margin: 15px 0;
}

.waiting-info p {
    color: #666;
    margin: 5px 0;
}

/* ========== ПОБЕДА ========== */
.victory-popup {
    text-align: center;
    max-width: 400px;
}

.victory-icon {
    font-size: 4em;
    margin: 20px 0;
    animation: bounce 0.6s ease;
}

.victory-stats {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

/* ========== ТЕСТОВЫЕ ТУРНИРЫ ========== */
.test-tournament-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed #667eea;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
}

.test-tournament-card h3 {
    margin-bottom: 5px;
    color: #333;
}

.test-tournament-card p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.test-tournament-status {
    background: #e9ecef;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.test-tournament-status b {
    color: #667eea;
    font-size: 1.2em;
}

.test-tournament-actions {
    display: flex;
    gap: 10px;
}

.test-tournament-actions .play-btn {
    flex: 1;
}

.test-tournaments-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    z-index: 1000;
    transition: all 0.2s;
}

.test-tournaments-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.test-tournaments-btn::before {
    content: '🧪 ';
}

/* ========== LADDER ТУРНИР (стиль как у плей-офф) ========== */
/* Ladder наследует стили от .tournament-lobby (полноэкранный) */

.ladder-lobby h2 {
    color: #333;
    margin: 0 0 8px 0;
    padding-right: 60px;
    flex-shrink: 0;
}

.ladder-lobby .tournament-info {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.ladder-lobby .tournament-timer {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    padding: 6px 12px;
    border-radius: 6px;
}

.ladder-lobby .participants-count {
    color: #666;
    font-size: 0.9em;
}

/* Статистика игрока - компактная версия */
.my-ladder-stats {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.my-ladder-stats h4 {
    margin: 0;
    color: #667eea;
    font-size: 0.85em;
    white-space: nowrap;
}

.my-ladder-stats .stats-row {
    display: flex;
    gap: 10px;
}

.my-ladder-stats .stat {
    font-size: 0.95em;
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.my-ladder-stats .stat.win {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.my-ladder-stats .stat.draw {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.my-ladder-stats .stat.loss {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

/* Таблица лидеров - занимает всё свободное место */
.ladder-standings {
    margin: 0 0 10px 0;
    padding: 10px;
    padding-right: 2px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: auto;
}

/* Видимый скроллбар как в достижениях */
.ladder-standings::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.ladder-standings::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.ladder-standings::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.ladder-standings::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

.ladder-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.ladder-table th,
.ladder-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.ladder-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    font-size: 0.9em;
}

.ladder-table tbody tr:hover {
    background: #f8f9fa;
}

.ladder-table .player-avatar-cell {
    padding: 4px 2px;
    width: 28px;
}

.ladder-avatar {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-image: url('/images/photo.png');
    background-size: cover;
    background-position: center;
    border: 2px solid;
    vertical-align: middle;
}

.ladder-avatar.clan-avatar {
    border-radius: 6px;
}

/* Аватар клана с эмблемой */
.ladder-avatar.clan-emblem-avatar {
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea40, #667eea20);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: none;
}

.clan-emblem-icon {
    font-size: 14px;
    line-height: 1;
}

/* Эмблема клана в предпросмотре турнира */
.clan-preview-emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea40, #667eea20);
    border: 2px solid #667eea;
}

.clan-preview-emblem .emblem-icon {
    font-size: 18px;
    line-height: 1;
}

.clan-name-styled {
    font-weight: 600;
    color: inherit;
}

.clan-name-badge {
    background: linear-gradient(135deg, #ff980020, #ff570020);
    color: #ff9800;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid #ff980050;
}

/* Стили ников перенесены в customization.css */
.ladder-table .ladder-player-cell {
    text-align: left;
    cursor: pointer;
    max-width: 120px;
}

.ladder-table .ladder-player-cell .player-name-styled {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 90px;
    vertical-align: middle;
}

.ladder-table .my-row {
    background: linear-gradient(90deg, #667eea20, #764ba220) !important;
    font-weight: bold;
}

.ladder-table .win {
    color: #28a745;
    font-weight: 600;
}

.ladder-table .draw {
    color: #ffc107;
    font-weight: 600;
}

.ladder-table .loss {
    color: #dc3545;
    font-weight: 600;
}

.ladder-table .finished td {
    opacity: 0.7;
}

/* Действия в ladder турнире */
.ladder-lobby .tournament-actions {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

/* Информация о матчах - компактная */
.matches-left-info {
    text-align: center;
    padding: 8px 15px;
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.matches-left-info p {
    margin: 0;
    font-size: 0.9em;
}

.matches-left-info b {
    color: #667eea;
    font-size: 1.1em;
}

/* Сообщение о завершении - компактное */
.ladder-finished-message {
    text-align: center;
    padding: 10px 15px;
    background: #d4edda;
    border: 1px solid #28a745;
    border-radius: 6px;
}

.ladder-finished-message p {
    margin: 3px 0;
    color: #155724;
    font-size: 0.9em;
}

.ladder-result .ladder-standings {
    max-height: 200px;
}

/* Попапы результатов - стиль как elimination-popup */
.pending-reward-popup {
    text-align: center;
    max-width: 400px;
}

.pending-reward-popup .place-info {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin: 15px 0;
    padding: 10px;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border-radius: 8px;
}

.ladder-match-result-popup {
    text-align: center;
    max-width: 400px;
}

.ladder-match-result-popup .result-icon {
    font-size: 4em;
    margin: 20px 0;
    animation: bounce 0.5s ease;
}

.ladder-match-result-popup .points-earned {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin: 15px 0;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border-radius: 10px;
}

.ladder-match-result-popup .match-score {
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #e9ecef;
}

.ladder-bonus-popup {
    text-align: center;
    max-width: 400px;
}

.ladder-bonus-popup .bonus-icon {
    font-size: 4em;
    margin: 20px 0;
    animation: bounce 0.5s ease;
}

.ladder-bonus-popup .bonus-points {
    font-size: 2em;
    font-weight: bold;
    color: #28a745;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-radius: 10px;
    border: 1px solid #28a745;
}

.bonus-note {
    background: #e7f3ff;
    padding: 8px 15px;
    border-radius: 6px;
    color: #0066cc;
    font-size: 0.9em;
    margin-bottom: 10px;
}

/* ========== РЕЖИМ НАБЛЮДАТЕЛЯ ========== */
.spectator-mode {
    border: 2px dashed #aaa;
}

.spectator-badge {
    background: rgba(0, 0, 0, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 15px;
    color: #666;
    font-size: 0.9em;
}

.spectator-view {
    max-height: 80vh;
    overflow-y: auto;
}

.spectator-view .spectator-badge {
    background: linear-gradient(135deg, #333, #444);
    border: 1px solid #555;
}

.active-tournament-item {
    transition: transform 0.2s, box-shadow 0.2s;
}

.active-tournament-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
}

/* ========== КНОПКИ ТУРНИРНЫХ КАРТОЧЕК ========== */
.tournament-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tournament-buttons .play-btn {
    padding: 6px 10px;
    font-size: 0.75em;
    white-space: nowrap;
}

.tournament-buttons .play-btn.secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

.tournament-buttons .play-btn.secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
}

@media (min-width: 1000px) {
    .tournament-buttons {
        flex-direction: column;
        width: 100%;
        gap: 4px;
    }
    
    .tournament-buttons .play-btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 0.8em;
    }
}

/* ========== ПРЕДПРОСМОТР ТУРНИРА ========== */
.tournament-preview-modal {
    width: calc(100vw - 16px);
    height: calc(100svh - 74px);
    max-width: 1200px;
    max-height: calc(100svh - 74px);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.tournament-preview-modal .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    height: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 10px;
    transition: all 0.2s;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.tournament-preview-modal .modal-close:hover {
    transform: scale(1.1);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-right: 60px; /* Место для кнопки закрытия */
}

.preview-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.preview-timer-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-timer-label {
    color: #666;
    font-size: 0.9em;
}

.preview-timer {
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border-radius: 8px;
}

.preview-timer.starting {
    color: #28a745;
    background: linear-gradient(135deg, #28a74515, #28a74515);
    animation: pulse 1s infinite;
}

.preview-info {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.preview-format,
.preview-count,
.preview-start {
    padding: 5px 12px;
    background: #f8f9fa;
    border-radius: 15px;
    font-size: 0.85em;
    color: #555;
}

.preview-format {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    color: #667eea;
    font-weight: 600;
}

.preview-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.preview-participants-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.preview-participants-section h3,
.preview-bracket-section h3 {
    font-size: 1em;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.preview-participants-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
}

.preview-participants-list::-webkit-scrollbar {
    width: 6px;
}

.preview-participants-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.preview-participants-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.preview-participant {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background 0.2s;
}

.preview-participant:hover {
    background: #e9ecef;
}

.preview-pos {
    font-weight: bold;
    color: #667eea;
    width: 24px;
    text-align: center;
}

.preview-frame {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('/images/photo.png');
    background-size: cover;
    background-position: center;
}

.preview-participant .avatar-with-vip {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.preview-participant .avatar-with-vip .vip-badge {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 6px;
    padding: 1px 3px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border-radius: 2px;
    font-weight: bold;
    white-space: nowrap;
}

.preview-frame.frame-gold {
    border-color: #ffd700;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

.preview-frame.frame-silver {
    border-color: #c0c0c0;
    box-shadow: 0 0 6px rgba(192, 192, 192, 0.5);
}

.preview-frame.frame-bronze {
    border-color: #cd7f32;
    box-shadow: 0 0 6px rgba(205, 127, 50, 0.5);
}

.preview-frame.frame-diamond {
    border-color: #00d9ff;
    box-shadow: 0 0 6px rgba(0, 217, 255, 0.5);
}

.preview-name {
    flex: 1;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-rating {
    color: #666;
    font-size: 0.9em;
}

.preview-bracket-section {
    margin-top: 10px;
}

.preview-bracket {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.bracket-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.bracket-match-preview {
    background: white;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.bracket-match-num {
    font-size: 0.75em;
    color: #999;
    margin-bottom: 6px;
}

.bracket-player {
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 2px 0;
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-player.bye {
    color: #999;
    font-style: italic;
}

.bracket-vs {
    color: #999;
    font-size: 0.75em;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.preview-actions .play-btn {
    min-width: 120px;
}

.preview-actions .test-start-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.preview-actions .test-start-btn:hover {
    background: linear-gradient(135deg, #ee5a5a, #dc4c4c);
    transform: translateY(-2px);
}

/* ========== МОБИЛЬНЫЕ ЭКРАНЫ ========== */
@media (max-width: 500px) {
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 50px;
    }
    
    .tournament-preview-modal .modal-close,
    .tournament-lobby .modal-close {
        padding: 6px 10px;
        font-size: 1.2em;
    }
    
    .preview-timer {
        font-size: 1.2em;
    }
    
    .preview-info {
        gap: 8px;
    }
    
    .preview-format,
    .preview-count,
    .preview-start {
        padding: 4px 10px;
        font-size: 0.8em;
    }
    
    .bracket-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .tournament-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .tournament-buttons .play-btn {
        padding: 5px 8px;
        font-size: 0.7em;
    }
    
    .tournament-lobby h2 {
        font-size: 1.1em;
        padding-right: 50px;
    }
    
    .tournament-info {
        flex-direction: row;
        gap: 6px;
        padding: 8px 10px;
        font-size: 0.85em;
    }
    
    .bracket-matches {
        grid-template-columns: 1fr;
    }
    
    .bracket-match-info {
        padding: 6px 8px;
    }
    
    .bracket-match-info h3 {
        font-size: 0.85em;
    }
    
    .bracket-match-info p {
        font-size: 0.75em;
    }
    
    .ready-timer {
        font-size: 1em;
    }
    
    /* Ladder мобильные стили */
    .my-ladder-stats {
        flex-direction: column;
        gap: 8px;
        padding: 8px 10px;
    }
    
    .my-ladder-stats h4 {
        font-size: 0.8em;
    }
    
    .my-ladder-stats .stats-row {
        gap: 8px;
    }
    
    .my-ladder-stats .stat {
        font-size: 0.85em;
        padding: 3px 8px;
    }
    
    .ladder-standings h4 {
        font-size: 0.85em;
    }
    
    .ladder-table {
        font-size: 0.75em;
    }
    
    .ladder-table th,
    .ladder-table td {
        padding: 5px 3px;
    }
    
    .ladder-table .ladder-player-cell .player-name-styled {
        max-width: 70px;
    }
    
    .ladder-lobby .tournament-actions {
        gap: 6px;
    }
}

/* ========== ТУРНИР "МОЩЬ СЕЗОНА" ========== */

/* Карточка турнира */
.season-power-card {
    background: linear-gradient(135deg, #ffd700, #ff8c00) !important;
    border: 2px solid #ffb700;
}

.season-power-card .tournament-icon {
    font-size: 1.8em;
}

.season-power-tickets {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.season-power-tickets .ticket-icon {
    font-size: 1.2em;
}

.season-power-tickets .tickets-count {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

.season-power-tickets .tickets-label {
    color: #555;
    font-size: 0.85em;
}

/* Модальное окно */
.season-power-modal {
    max-width: 600px;
    width: 95%;
}

.season-power-modal .modal-header {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    margin: -20px -20px 15px;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
}

.season-power-modal .modal-header h2 {
    margin: 0;
    color: #333;
}

.season-power-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.season-power-info .tournament-badge {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    color: #333;
}

.season-power-info .participants-count {
    font-size: 0.9em;
    color: #444;
}

/* Панель билетов и статистики */
.my-stats-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.tickets-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #ffd700, #ffb700);
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(255, 183, 0, 0.3);
}

.ticket-icon-large {
    font-size: 2em;
}

.tickets-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.tickets-max {
    font-size: 1.4em;
    color: #666;
}

.tickets-label {
    font-size: 0.85em;
    color: #555;
    margin-left: 4px;
}

.my-season-stats {
    display: flex;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.my-season-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 60px;
}

.my-season-stats .stat-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
}

.my-season-stats .stat-label {
    font-size: 0.75em;
    color: #666;
}

.my-season-stats .stat-item.win { border-left: 3px solid #28a745; }
.my-season-stats .stat-item.draw { border-left: 3px solid #ffc107; }
.my-season-stats .stat-item.loss { border-left: 3px solid #dc3545; }

/* Кнопки действий */
.season-power-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.find-match-btn {
    font-size: 1.1em;
    padding: 12px 30px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.find-match-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.find-match-btn.searching {
    background: linear-gradient(135deg, #ffc107, #ff8c00);
    animation: pulse 1.5s infinite;
}

.find-match-btn .cancel-text {
    font-size: 0.75em;
    opacity: 0.8;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.find-match-btn.disabled,
.find-match-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Таблица лидеров */
.standings-section h3 {
    margin: 0 0 10px;
    font-size: 1.1em;
    color: #333;
}

.ladder-standings-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.ladder-standings {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.ladder-standings th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 8px;
    text-align: center;
    position: sticky;
    top: 0;
}

.ladder-standings td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.ladder-standings .my-row {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.1));
}

.ladder-standings .ladder-player-cell {
    text-align: left;
    cursor: pointer;
}

.ladder-standings .ladder-player-cell:hover {
    text-decoration: underline;
}

.ladder-standings .empty-standings {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.ladder-standings td.win { color: #28a745; }
.ladder-standings td.draw { color: #ffc107; }
.ladder-standings td.loss { color: #dc3545; }

.you-marker {
    font-size: 0.8em;
    color: #667eea;
    margin-left: 4px;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .my-stats-panel {
        flex-direction: column;
        gap: 12px;
    }
    
    .tickets-display {
        width: 100%;
        justify-content: center;
    }
    
    .my-season-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .my-season-stats .stat-item {
        min-width: 50px;
        padding: 6px 10px;
    }
    
    .my-season-stats .stat-value {
        font-size: 1.2em;
    }
    
    .ladder-standings-wrapper {
        max-height: 200px;
    }
}

/* ========== РЕЗУЛЬТАТЫ ТУРНИРА МОЩЬ СЕЗОНА ========== */

.season-power-result-modal {
    max-width: 500px;
    text-align: center;
}

.season-power-result-modal .result-header {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    margin: -20px -20px 20px;
    padding: 20px;
    border-radius: 10px 10px 0 0;
}

.season-power-result-modal .result-header h2 {
    margin: 0;
    color: #333;
}

.season-power-result-modal .my-place {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.season-power-result-modal .place-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.season-power-result-modal .place-text {
    display: block;
    color: #666;
    font-size: 0.9em;
}

.season-power-result-modal .place-points {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
}

.season-power-result-modal .rewards-section,
.season-power-result-modal .standings-section {
    margin-bottom: 20px;
    text-align: left;
}

.season-power-result-modal .rewards-section h3,
.season-power-result-modal .standings-section h3 {
    margin: 0 0 10px;
    font-size: 1em;
    color: #666;
}

.season-power-result-modal .rewards-list {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    padding: 15px;
    border-radius: 8px;
}

.season-power-result-modal .reward-item {
    padding: 5px 0;
    font-size: 0.95em;
}

.season-power-result-modal .standings-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.season-power-result-modal .result-row {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.season-power-result-modal .result-row:last-child {
    border-bottom: none;
}

.season-power-result-modal .result-row.my-row {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.1));
    border-radius: 6px;
}

.season-power-result-modal .result-place {
    width: 40px;
    font-weight: bold;
}

.season-power-result-modal .result-name {
    flex: 1;
}

.season-power-result-modal .result-points {
    font-weight: bold;
    color: #667eea;
}
