/* Контейнер зала славы */
.top-list-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ================= НАТИВНЫЙ АККОРДЕОН (ОДИН ЭЛЕМЕНТ) ================= */

.rank-card-details {
    display: block;
    width: 100%;
    margin-bottom: 6px;
}

.rank-card-details summary {
    list-style: none;
    cursor: pointer;
    outline: none;
}

.rank-card-details summary::-webkit-details-marker {
    display: none;
}

/* Карточка внутри details */
.rank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ================= КРУТАЯ ЗАЛИВКА ФОНА ================= */

.rank-card-details:not([open]) .rank-card.wr-high {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.04) var(--winrate, 0%), rgba(255, 255, 255, 0.03) var(--winrate, 0%), rgba(255, 255, 255, 0.03) 100%);
}
.rank-card-details:not([open]) .rank-card.wr-high:hover {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.08) var(--winrate, 0%), rgba(255, 255, 255, 0.06) var(--winrate, 0%), rgba(255, 255, 255, 0.06) 100%);
}

.rank-card-details:not([open]) .rank-card.wr-mid {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.04) var(--winrate, 0%), rgba(255, 255, 255, 0.03) var(--winrate, 0%), rgba(255, 255, 255, 0.03) 100%);
}
.rank-card-details:not([open]) .rank-card.wr-mid:hover {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0.08) var(--winrate, 0%), rgba(255, 255, 255, 0.06) var(--winrate, 0%), rgba(255, 255, 255, 0.06) 100%);
}

.rank-card-details:not([open]) .rank-card.wr-low {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.16) 0%, rgba(244, 63, 94, 0.02) var(--winrate, 0%), rgba(255, 255, 255, 0.03) var(--winrate, 0%), rgba(255, 255, 255, 0.03) 100%);
}
.rank-card-details:not([open]) .rank-card.wr-low:hover {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.25) 0%, rgba(244, 63, 94, 0.05) var(--winrate, 0%), rgba(255, 255, 255, 0.06) var(--winrate, 0%), rgba(255, 255, 255, 0.06) 100%);
}

.rank-card:hover {
    transform: translateX(3px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.rank-card-details[open] .rank-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    background: rgba(255, 255, 255, 0.06);
    transform: none;
    margin-bottom: 0;
    text-shadow: none;
}

/* ================= ЦВЕТА ДЛЯ ЦИФРЫ ВИНРЕЙТА ================= */
.rank-winrate {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
    color: #ffffff;
    opacity: 0.9;
}

/* ================= ПОДСВЕТКА СВОЕЙ ЛИГИ ================= */
.rank-card-details.mine .rank-card {
    border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 40%, transparent);
    box-shadow: none;
}

.rank-card-details.mine .rank-card:hover {
    border-color: color-mix(in srgb, var(--accent, #6366f1) 60%, transparent);
}

/* ================= БЕЙДЖИ ================= */
.league-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 12px rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
}

.city-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: #e4e4e7;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
    margin-left: 2px;
}

/* ================= ПАНЕЛЬ ДЕТАЛЕЙ ================= */
.rank-details-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    animation: slideDown 0.3s ease-out;
    overflow: hidden;
    margin-top: -1px;
    margin-bottom: 6px;
}

.rank-details-wrapper .rd-grid {
    padding: 16px 14px 16px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px 12px;
}

.rd-item { display: flex; flex-direction: column; gap: 6px; }
.rd-label { font-size: 11px; color: rgba(255, 255, 255, 0.5); text-transform: none; letter-spacing: 0.2px; font-weight: 500; }
.rd-value { font-size: 16px; font-weight: 600; color: #ffffff; letter-spacing: -0.3px; }
.text-emerald-400, .text-red-400 { color: #ffffff !important; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================= МЕНЮ, КАРТОЧКИ, ОБЕРТКИ ================= */
.apple-card {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.apple-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.matches-divider { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 12px 0; }

.match-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
    animation: matchSlideIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    opacity: 0;
}

.match-stage-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.18);
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
    margin-bottom: 8px;
}

.match-score-row-centered { display: flex; align-items: center; justify-content: center; gap: 8px; }
.match-score-row-centered .match-player-name { font-size: 12px; font-weight: 500; color: #ffffff; white-space: nowrap; flex-shrink: 0; }
.match-score-row-centered .match-player-name.winner { color: #fbbf24; font-weight: 600; }
.match-score-badge { font-size: 13px; font-weight: 700; color: #ffffff; background: rgba(255, 255, 255, 0.08); padding: 3px 10px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }

@keyframes matchSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.top-list-wrapper {
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    padding-bottom: 10px;
    transition: all 0.3s ease;
}

.top-list-wrapper:has(.expanded) {
    -webkit-mask-image: none;
    mask-image: none;
    padding-bottom: 0;
}

.top-list-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    overscroll-behavior-y: contain;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 310px;
}

.top-list-container.expanded {
    max-height: 420px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.top-list-container.expanded::-webkit-scrollbar { width: 4px; }
.top-list-container.expanded::-webkit-scrollbar-track { background: transparent; }
.top-list-container.expanded::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }

.hidden-item { display: none !important; }

.top-toggle-btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: #a1a1aa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.top-toggle-btn-full:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
}

.top-toggle-btn-full:active { transform: scale(0.98); }

.my-position-block {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.my-position-label {
    font-size: 11px;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-left: 6px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.my-position-block .rank-card.mine {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.03) 100%);
    border-left: 3px solid var(--accent, #6366f1);
    border-color: rgba(99, 102, 241, 0.2);
}

.my-position-block .rank-card.mine .rank-number {
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .rank-card { padding: 10px 12px; gap: 10px; }
}

/* =========================================
   КАСТОМНЫЙ ДРОПДАУН ГОРОДОВ
   ========================================= */

/* Кнопка в шапке */
.city-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    border-radius: 10px;
    color: #e4e4e7;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.city-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.city-selector-btn:active {
    transform: scale(0.96);
}

/* Сам выпадающий список (скрыт по умолчанию) */
.city-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: top right;
}

.city-dropdown.show {
    display: flex;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Строка внутри списка */
.city-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #e4e4e7;
    cursor: pointer;
    transition: all 0.15s ease;
}

.city-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.city-dropdown-item.selected {
    background: rgba(99, 102, 241, 0.15);
    color: #ffffff;
    font-weight: 600;
}

.city-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Бейдж с кодом города внутри списка */
.city-option-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: #e4e4e7;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    letter-spacing: 0.5px;
}