/* Модальное окно сравнения */
#player-comparison-modal {
    display: none;
    position: fixed;
    z-index: 1002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(8, 10, 18, 0.82);
    overflow: auto;
    backdrop-filter: blur(12px);
}

#player-comparison-modal .wide-modal {
    max-width: 850px;
    width: 96%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 10px auto;
    background: linear-gradient(180deg, rgba(35, 41, 58, 0.98), rgba(20, 25, 37, 0.98));
    border-radius: 16px;
    border: 1px solid rgba(255, 223, 143, 0.16);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.28);
    transform: scale(0.95);
    transform-origin: center;
    padding: 3px;
}

@keyframes comparisonModalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(0.95) translateY(0);
    }
}

#player-comparison-modal .wide-modal {
    animation: none;
    position: relative;
    padding-top: 12px;
}

.comparison-results {
    padding: 12px 14px 14px 14px;
    color: #fff9e7;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
}

.comparison-header {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 223, 143, 0.2);
}

.back-btn {
    background: rgba(40, 45, 60, 0.8);
    color: #ffdf8f;
    border: 1px solid rgba(255, 223, 143, 0.3);
    padding: 7px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1em;
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 90px;
}

.back-btn:hover {
    background: rgba(255, 223, 143, 0.1);
    border-color: rgba(255, 223, 143, 0.5);
}

.comparison-header h2 {
    color: #ffdf8f;
    text-align: center;
    margin: 0 auto;
    font-size: 1.5em;
    font-weight: 600;
    flex: 1;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.players-comparison-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px;
    background: rgba(30, 35, 50, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(255, 223, 143, 0.2);
}

.player-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.player-name-compact {
    font-size: 1.15em;
    font-weight: bold;
    color: #ffdf8f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    width: 100%;
}

.player-rating-compact {
    font-size: 1.1em;
    color: #fff9e7;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(30, 35, 50, 0.8);
    border-radius: 5px;
    border: 1px solid rgba(255, 223, 143, 0.2);
    min-width: 60px;
    text-align: center;
}

.vs-compact {
    text-align: center;
}

.vs-label-compact {
    color: #ffdf8f;
    font-weight: bold;
    font-size: 1.15em;
    padding: 5px 12px;
    background: rgba(30, 35, 50, 0.8);
    border-radius: 5px;
    border: 1px solid rgba(255, 223, 143, 0.3);
    display: inline-block;
    margin-bottom: 6px;
}

.rating-diff-compact {
    font-weight: bold;
    font-size: 1.05em;
    padding: 4px 8px;
    border-radius: 5px;
    display: inline-block;
}

.rating-diff-compact.positive {
    color: #86fc8a;
    background: rgba(40, 167, 69, 0.2);
}

.rating-diff-compact.negative {
    color: #fd8962;
    background: rgba(220, 53, 69, 0.2);
}

.stats-section-header {
    color: #ffdf8f;
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 223, 143, 0.2);
}

.stats-grid-dense {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.stat-item-dense {
    background: rgba(30, 35, 50, 0.6);
    border: 1px solid rgba(255, 223, 143, 0.2);
    border-radius: 7px;
    padding: 10px 8px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 60px;
}

.stat-item-dense:hover {
    border-color: rgba(255, 223, 143, 0.4);
    transform: translateY(-1px);
}

.stat-value-dense {
    font-size: 1.4em;
    font-weight: bold;
    color: #ffdf8f;
    margin-bottom: 3px;
    line-height: 1.1;
}

.stat-label-dense {
    font-size: 0.95em;
    color: #b8b8b8;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-and-overall-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.stats-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 0;
}

.stats-card-dense {
    background: rgba(30, 35, 50, 0.6);
    border: 1px solid rgba(255, 223, 143, 0.2);
    border-radius: 7px;
    padding: 10px 12px;
}

.stats-card-header {
    color: #ffdf8f;
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 223, 143, 0.2);
}

.stats-rows-dense {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-row-dense {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 4px 0;
    font-size: 1em;
}

.stats-label-dense {
    color: #b8b8b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-value-dense {
    color: #fff9e7;
    font-weight: 600;
    text-align: right;
    min-width: 50px;
}

.win-rate-badge {
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.95em;
    min-width: 45px;
    text-align: center;
    display: inline-block;
}

.win-rate-badge.high {
    background: rgba(40, 167, 69, 0.25);
    color: #86fc8a;
}

.win-rate-badge.medium {
    background: rgba(255, 193, 7, 0.25);
    color: #ffd351;
}

.win-rate-badge.low {
    background: rgba(220, 53, 69, 0.25);
    color: #fd8962;
}

.overall-winrate-compact {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    background: rgba(30, 35, 50, 0.6);
    border: 1px solid rgba(255, 223, 143, 0.2);
    border-radius: 7px;
    padding: 10px 12px;
    margin-bottom: 0;
    font-size: 1em;
}

.overall-winrate-label {
    color: #ffdf8f;
    font-size: 1.05em;
    font-weight: 600;
    white-space: nowrap;
    text-align: left;
}

.overall-winrate-value {
    font-size: 1.6em;
    font-weight: 800;
    text-align: center;
    padding: 0 10px;
}

.overall-winrate-value.high { color: #86fc8a; }
.overall-winrate-value.medium { color: #ffd351; }
.overall-winrate-value.low { color: #fd8962; }

.overall-winrate-summary {
    color: #b8b8b8;
    font-size: 1em;
    text-align: right;
    white-space: nowrap;
}

.recent-matches-compact-section {
    margin-bottom: 12px;
}

.matches-list-ultra-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-item-ultra-compact {
    background: rgba(30, 35, 50, 0.6);
    border: 1px solid rgba(255, 223, 143, 0.2);
    border-radius: 7px;
    padding: 8px 10px;
    transition: all 0.2s ease;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 0.95em;
}

.match-item-ultra-compact:hover {
    border-color: rgba(255, 223, 143, 0.4);
    transform: translateY(-1px);
}

.match-item-ultra-compact.win {
    border-left: 3px solid #28a745;
}

.match-item-ultra-compact.loss {
    border-left: 3px solid #dc3545;
}

.match-result-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.match-result-icon.win { background: #28a745; }
.match-result-icon.loss { background: #dc3545; }

.match-info-ultra-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-width: 0;
}

.match-map-ultra-compact {
    font-weight: 600;
    color: #ffdf8f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1em;
}

.match-details-ultra-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #b8b8b8;
    flex-wrap: wrap;
}

.match-date-ultra-compact {
    white-space: nowrap;
    font-size: 0.9em;
}

.match-type-ultra-compact {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    font-weight: 600;
}

.match-type-ultra-compact.opponent {
    background: rgba(220, 53, 69, 0.2);
    color: #fd8962;
    border: 1px solid rgba(220, 53, 69, 0.4);
}

.match-type-ultra-compact.teammate {
    background: rgba(23, 162, 184, 0.2);
    color: #6edff6;
    border: 1px solid rgba(23, 162, 184, 0.4);
}

.match-rating-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.95em;
    min-width: 40px;
    flex-shrink: 0;
}

.rating-change-value {
    font-weight: bold;
    font-size: 1.1em;
}

.rating-change-value.positive {
    color: #86fc8a;
}

.rating-change-value.negative {
    color: #fd8962;
}

.rating-change-label {
    color: #b8b8b8;
    font-size: 0.85em;
    text-align: center;
    white-space: nowrap;
}

.no-games-compact {
    text-align: center;
    padding: 14px;
    background: rgba(30, 35, 50, 0.6);
    border-radius: 7px;
    border: 1px solid rgba(255, 223, 143, 0.2);
    margin-top: 12px;
}

.no-games-compact p {
    color: #b8b8b8;
    font-size: 1em;
    margin: 0;
}

#player-comparison-modal .wide-modal::-webkit-scrollbar {
    width: 6px;
}

#player-comparison-modal .wide-modal::-webkit-scrollbar-track {
    background: rgba(30, 35, 50, 0.3);
    border-radius: 3px;
}

#player-comparison-modal .wide-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 223, 143, 0.3);
    border-radius: 3px;
}

#player-comparison-modal .wide-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 223, 143, 0.5);
}

@media (max-width: 1024px) {
    #player-comparison-modal .wide-modal {
        max-width: 96%;
        margin: 8px auto;
    }

    .players-comparison-row {
        gap: 10px;
        padding: 10px;
    }

    .stats-grid-dense {
        grid-template-columns: repeat(2, 1fr);
    }

    .overall-winrate-compact {
        grid-template-columns: 1fr auto 1fr;
        font-size: 0.95em;
    }
}

@media (max-width: 768px) {
    #player-comparison-modal .wide-modal {
        width: 98%;
        max-height: 92vh;
        margin: 6px auto;
        transform: scale(1);
    }

    .comparison-results {
        padding: 10px 12px 12px 12px;
        font-size: 14px;
    }

    .comparison-header h2 {
        font-size: 1.3em;
        max-width: 60%;
    }

    .stats-grid-dense {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stats-cards-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .overall-winrate-compact {
        grid-template-columns: 1fr auto 1fr;
        font-size: 0.9em;
        padding: 8px;
    }

    .match-item-ultra-compact {
        grid-template-columns: auto 1fr;
        gap: 10px;
    }

    .match-rating-change {
        grid-column: 1 / span 2;
        flex-direction: row;
        justify-content: space-between;
        padding-top: 5px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 480px) {
    .players-comparison-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px;
    }

    .player-compact {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 5px;
    }

    .player-name-compact {
        max-width: none;
        text-align: left;
        flex: 1;
        font-size: 1.05em;
    }

    .vs-compact {
        order: 1;
        padding: 5px 0;
    }

    .stats-grid-dense {
        grid-template-columns: 1fr;
    }

    .stat-item-dense {
        min-height: 55px;
    }

    .overall-winrate-compact {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 6px;
    }

    .overall-winrate-label,
    .overall-winrate-summary {
        text-align: center;
    }

    .match-item-ultra-compact {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .match-info-ultra-compact {
        order: 1;
    }

    .match-rating-change {
        flex-direction: row;
        justify-content: space-between;
        gap: 15px;
        padding-top: 5px;
    }
}

@media (max-height: 700px) {
    #player-comparison-modal .wide-modal {
        max-height: 95vh;
        margin: 5px auto;
    }

    .comparison-results {
        padding: 8px 10px 10px 10px;
        font-size: 13px;
    }

    .stats-grid-dense {
        gap: 6px;
    }

    .stat-item-dense {
        min-height: 50px;
        padding: 8px;
    }

    .matches-list-ultra-compact {
        gap: 6px;
    }
}
