body {
    color: #ededf0;
    background-color: #0b0b0e;
    background-image:
        radial-gradient(ellipse 70% 45% at 50% 0%, rgba(147, 51, 234, 0.14), transparent 70%),
        radial-gradient(ellipse 90% 60% at 50% 115%, rgba(88, 28, 135, 0.10), transparent 70%),
        radial-gradient(ellipse 120% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
    background-attachment: fixed;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0b0b0e; }
::-webkit-scrollbar-thumb { background: #33343c; border-radius: 4px; }
.player-row { background-color: #15151a; border-bottom: 1px solid #232329; transition: all 0.15s ease; }
.player-row:hover { background-color: #1d1d23; border-color: #33343c; }
.rank-badge { font-family: 'Geist Mono', monospace; font-weight: 700; font-size: 0.875rem; text-align: center; }
.rank-1 { color: #fbbf24; text-shadow: 0 0 10px rgba(251,191,36,0.4); }
.rank-2 { color: #b3b8c2; }
.rank-3 { color: #cd7f32; }
.flag-icon {
    width: 32px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    min-width: 32px;
}
.flag-icon-sm {
    width: 22px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
    min-width: 22px;
}
.flag-click { cursor: pointer; transition: transform 0.15s ease; }
.flag-click:hover { transform: scale(1.2); }
.flag-hero {
    width: 48px; height: 32px;
    min-width: 48px;
}
.filter-select {
    background-color: #121217; border: 1px solid #08080a; color: #ededf0;
    font-size: 0.7rem; border-radius: 0.5rem; padding: 0.5rem 0.6rem; width: 100%;
}
.filter-select:focus { outline: none; border-color: #ffd21e; }
.country-btn { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.country-btn:hover, .country-btn.open { border-color: #ffd21e; }
.country-menu {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    margin-top: 0.25rem; max-height: 16rem; overflow-y: auto; overflow-x: hidden;
    background-color: #121217; border: 1px solid #08080a; border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.country-option { display: flex; align-items: center; gap: 0.55rem; width: 100%; text-align: left; padding: 0.45rem 0.6rem; font-size: 0.7rem; color: #ededf0; }
.country-option:hover { background-color: #1b1b21; }
.country-option.active { background-color: #2b2344; }
.country-stats {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}
#playerDrawer { transition: transform 0.3s ease; transform: translateX(100%); }
#playerDrawer.open { transform: translateX(0); }
.stat-line { display: flex; justify-content: space-between; align-items: baseline; }
.elo-plus { color: #ffd21e; }
.elo-minus { color: #f87171; }
.dropdown-menu {
    position: absolute; right: 0; top: 100%; z-index: 100;
    min-width: 180px; background-color: #121217; border: 1px solid #08080a; border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); margin-top: 0.25rem;
}
.dropdown-item { display: block; width: 100%; text-align: left; padding: 0.6rem 1rem; font-size: 0.8rem; color: #ededf0; cursor: pointer; }
.dropdown-item:hover { background-color: #1b1b21; }
.offline-pill { font-size: 8px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 900;
    padding: 2px 6px; border-radius: 4px; background-color: #2b2020; color: #f87171; margin-right: 5px; vertical-align: 2px; }
.back-btn { font-size: 0.75rem; font-weight: 700; color: #ffd21e; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.4rem; }
.back-btn:hover { color: #ffe066; }
@media (min-width: 768px) {
    .content-area { margin-right: 24rem; }
}

/* ===== Polishing batch ===== */

/* Request 2: Geist everywhere, including native dropdowns */
select, option {
    font-family: 'Geist', 'ui-sans-serif', 'system-ui', sans-serif;
}

/* Request 4: drawer gets a distinct yellow scrollbar */
#playerDrawer::-webkit-scrollbar { width: 10px; }
#playerDrawer::-webkit-scrollbar-track { background: #0d0d11; }
#playerDrawer::-webkit-scrollbar-thumb {
    background: #ffd21e;
    border-radius: 5px;
    border: 2px solid #0d0d11;
}

/* More button aligned with the sidebar filter dropdown arrows — Desktop only */
@media (min-width: 1320px) {
    #moreDropdown {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 18.5rem;
    }
}

/* Sidebar inner content sticks on desktop (correct target, not .sidebar) */
@media (min-width: 768px) {
    .sidebar-inner {
        position: sticky;
        top: 4rem;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }
}

/* ===== Loading overlay ===== */
#loadingOverlay { transition: opacity 0.25s ease-out; }
#loadingOverlay.hidden { opacity: 0; pointer-events: none; }

/* ===== Responsive behavior ===== */

/* Minimum width for desktop/tablet: prevents crushing */
@media (min-width: 768px) {
    .layout-shell {
        min-width: 1320px;  /* Increased for extra breathing room */
    }
}

/* Mobile / Shrunk Desktop spacing (aggressive) */
@media (max-width: 767px) {

    /* Data row cells */
    .player-row > div:nth-child(1) { min-width: 40px !important; }
    .player-row > div:nth-child(2) { min-width: 64px !important; }
    .player-row > div:nth-child(3) { min-width: 170px !important; padding-left: 1.25rem !important; } /* usernames pushed right */
    .player-row > div:nth-child(4) { min-width: 80px !important; }
    .player-row > div:nth-child(5) { min-width: 90px !important; }
}

/* ===== More dropdown wrapper positioning ===== */

/* Mobile/Tablet: wrapper needs relative positioning for the menu to anchor correctly */
@media (max-width: 1319px) {
    #moreDropdown {
        position: relative;
        display: inline-block;
        margin-left: 1rem;
    }
}

/* Inactive players are dimmed (osu! style) */
.player-row-offline { opacity: 0.45; }
.player-row-offline:hover { opacity: 0.8; }

/* Season history rows: hover identical to player rows */
.season-row { transition: all 0.15s ease; }
.season-row:hover { background-color: #1d1d23; }

/* Placeholder for players with no known country */
.flag-placeholder {
    width: 32px; height: 22px; border-radius: 4px;
    background: #232329; color: #5b5b64;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0; min-width: 32px;
}

/* Unified pagination bar (osu! style) */
#playerPagination, #countryPagination {
    display: flex; justify-content: center; align-items: center;
}
#playerPagination > div, #countryPagination > div {
    display: flex; align-items: center; gap: 3px;
}

/* Pagination numbers: frameless, osu! style */
.pg-link, .pg-current, .pg-dot {
    display: inline-block; min-width: 26px; padding: 3px 6px;
    text-align: center; border-radius: 9999px;
    font-family: 'Geist Mono', monospace; font-size: 0.72rem; font-weight: 700;
}
.pg-link { color: #9a9aa3; text-decoration: none; }
.pg-link:hover { color: #ffffff; }
.pg-current { background: #ffd21e; color: #0b0b0e; }
.pg-dot { color: #5b5b64; padding: 3px 2px; }

/* Extra breathing room between Prev/Next and the page numbers */
#btnPrev, #btnPrevTop, #btnPrevC, #btnPrevCTop { margin-right: 5px; }
#btnNext, #btnNextTop, #btnNextC, #btnNextCTop { margin-left: 5px; }

/* Country ranking: fixed minimum width prevents crushing; scroll when zoomed */
#countryRankingWrap { overflow-x: auto !important; }

/* Country LIST */
.cr-head-list,
.country-row {
    grid-template-columns: 40px minmax(160px, 5fr) minmax(70px, 1fr) minmax(90px, 1fr) minmax(100px, 1fr) !important;
}

/* Country DETAIL (standard) */
.cr-head-detail,
#countryRankingList .player-row:not(.country-row) {
    grid-template-columns: 40px 52px minmax(220px, 4fr) 90px minmax(100px, 4fr) !important;
}

/* Country DETAIL (peak sort) */
.cr-peak-mode .cr-head-detail,
#countryRankingList.cr-peak-mode .player-row:not(.country-row) {
    grid-template-columns: 40px 52px minmax(220px, 6fr) minmax(100px, 6fr) !important;
}

/* Each cell takes exactly one track */
.cr-head-list > div,
.country-row > div,
.cr-head-detail > div,
.player-row:not(.country-row) > div {
    grid-column: auto !important;
}

/* ===== Player ranking table ===== */
#playerTableWrap { overflow-x: auto; }

#playerView:not(.pv-peak-mode) #playerHeader,
#playerView:not(.pv-peak-mode) #leaderboard .player-row {
    grid-template-columns: 40px 52px minmax(220px, 4fr) 90px minmax(100px, 4fr) !important;
}
#playerView.pv-peak-mode #playerHeader,
#playerView.pv-peak-mode #leaderboard .player-row {
    grid-template-columns: 40px 52px minmax(220px, 6fr) minmax(100px, 6fr) !important;
}
#playerHeader > div,
#leaderboard .player-row > div { grid-column: auto !important; }

/* Flash highlight when jumping to a player from their season history */
.player-row.row-highlight {
    background-color: #23232b;
    border-color: #3d3d47;
    animation: rowFlashOut 1.6s ease forwards;
}
@keyframes rowFlashOut {
    0%, 35% { background-color: #23232b; }
    100% { background-color: #15151a; }
}

.hidden-el { display: none; }

#dFlagPh { width: 48px; height: 32px; font-size: 16px; }
