:root {
    --site-bg: #10161d;
    --panel-bg: #121822;
    --panel-border: #1d2633;
    --row-bg: #2b3647;
    --row-hover: #344154;
    --text: #edf3ff;
    --muted: #8292ad;
    --gold: #f0bb38;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: var(--site-bg);
}

button,
input,
a {
    font: inherit;
}

.hidden {
    display: none !important;
}

.page-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 18px 32px;
}

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 10px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
}

.brand-logo {
    width: 138px;
    display: block;
}

.primary-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 9px;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    line-height: 1;
}

.nav-icon {
    width: 15px;
    height: 15px;
    object-fit: contain;
    flex: 0 0 15px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: #182131;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icons {
    display: flex;
    gap: 8px;
}

.header-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #182131;
    border: 1px solid var(--panel-border);
}

.header-icon-link img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.search-shell {
    position: relative;
    min-width: 140px;
}

.search-box {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: #182131;
    border: 1px solid var(--panel-border);
}

.search-box input {
    font-size: 12px;
}

.search-box input {
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.search-box input::placeholder,
.search-icon {
    color: #7a8dab;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    padding: 8px;
    border-radius: 14px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    z-index: 20;
}

.search-suggestions.active {
    display: grid;
    gap: 6px;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.search-suggestion-item:hover {
    background: #182131;
}

.search-suggestion-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.content {
    margin-top: 42px;
    min-height: calc(100vh - 108px);
}

.leaderboard-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px 14px 18px;
    min-height: calc(100vh - 132px);
    display: flex;
    flex-direction: column;
}

.board-view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tabs-panel-wrap {
    position: relative;
    z-index: 2;
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
}

.tabs-panel {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 0;
}

.mode-tab {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: max-content;
    padding: 10px 16px;
    color: #d4d9e2;
    background: transparent;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.mode-tab:hover,
.mode-tab.active {
    color: var(--text);
    border-color: #8f3a3d;
    background: #2a2128;
}

.mode-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.panel-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: #182131;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.info-pill::before {
    content: "i";
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #2d3a50;
    font-size: 11px;
}

.board-header {
    padding: 0 14px 12px;
    color: #6c7d9b;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.overall-grid {
    display: grid;
    grid-template-columns: 136px minmax(260px, 1fr) 92px minmax(280px, 360px);
    gap: 14px;
    align-items: center;
}

.leaderboard-list {
    display: grid;
    gap: 10px;
    align-content: start;
    min-height: 100%;
}

.ranking-card {
    padding: 10px 14px;
    background: #16202d;
    border: 1px solid #222d3b;
    border-radius: 16px;
    cursor: pointer;
}

.ranking-card:hover,
.ranking-card:focus-visible {
    background: #1a2533;
    outline: none;
}

.ranking-card-empty {
    opacity: 0.82;
}

.rank-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 0 12px;
    border-radius: 12px;
    background: #243042;
}

.podium-1 .rank-panel {
    background: #d3a12e;
    color: #1f1402;
}

.podium-2 .rank-panel {
    background: #a9b4c2;
    color: #142030;
}

.podium-3 .rank-panel {
    background: #a66739;
    color: #1f1209;
}

.rank-number {
    min-width: 44px;
    font-size: 28px;
    font-style: italic;
    font-weight: 900;
}

.player-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
}

.player-name {
    margin: 0 0 6px;
    font-size: 20px;
}

.player-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
}

.player-title-icon {
    width: 18px;
    height: 18px;
}

.player-title-text {
    color: #f5d87a;
}

.player-points {
    color: #7b93b6;
}

.region-panel {
    display: flex;
    justify-content: center;
}

.region-pill {
    min-width: 50px;
    padding: 10px 0;
    border-radius: 12px;
    text-align: center;
    font-weight: 800;
}

.region-na {
    color: #ff8d95;
    background: #5a2530;
}

.region-eu {
    color: #8fff8d;
    background: #275333;
}

.region-as {
    color: #85d6ff;
    background: #214c69;
}

.region-other {
    color: #c4d4ef;
    background: #40506b;
}

.tiers-panel {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.gamemode-tier {
    width: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.gamemode-tier img {
    width: 30px;
    height: 30px;
    padding: 6px;
    object-fit: contain;
    border-radius: 50%;
    background: #0e141d;
    border: 1px solid #2d3d59;
}

.tier-label {
    font-size: 11px;
    font-weight: 800;
}

.tier-ht1,
.tier-lt1 {
    color: #ffd04d;
}

.tier-ht2,
.tier-lt2 {
    color: #9dc7ff;
}

.tier-ht3,
.tier-lt3 {
    color: #ff9d60;
}

.tier-ht4,
.tier-lt4 {
    color: #b698ff;
}

.tier-ht5,
.tier-lt5 {
    color: #9ea8ba;
}

.tier-empty {
    color: #5d6a82;
}

.tierlist-columns {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 10px;
    min-height: 100%;
    align-content: stretch;
}

.tier-column {
    background: #172131;
    border: 1px solid #243349;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.tier-column-list {
    flex: 1;
}

.tier-column-header {
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 900;
}

.tier-column-1 .tier-column-header {
    background: #5a4820;
    color: #ffbd2b;
}

.tier-column-2 .tier-column-header {
    background: #3e4452;
    color: #c8d1dd;
}

.tier-column-3 .tier-column-header {
    background: #5d3e2e;
    color: #d8894d;
}

.tier-column-4 .tier-column-header,
.tier-column-5 .tier-column-header {
    background: #263244;
    color: #c4daff;
}

.tier-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid #223044;
    background: var(--row-bg);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.tier-player-row:hover {
    background: var(--row-hover);
}

.tier-player-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tier-player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

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

.tier-player-arrow {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-weight: 800;
}

.arrow-high {
    color: #78a8ff;
}

.arrow-low {
    color: #5d7399;
}

.arrow-none {
    color: #465674;
}

.tier-column-empty,
.ranking-placeholder {
    padding: 18px;
    color: var(--muted);
}

.player-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100;
}

.modal-content {
    width: min(430px, 100%);
    padding: 28px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
}

.info-modal-content {
    width: min(760px, 100%);
}

.info-modal-header h2 {
    margin: 0 0 16px;
    font-size: 24px;
}

.info-modal-body {
    display: flex;
    justify-content: center;
}

.kit-info-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 14px;
    background: #0e141d;
}

.close-modal {
    float: right;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: #243042;
    color: #a8b8d8;
    font-size: 28px;
    cursor: pointer;
}

.modal-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    margin-top: 32px;
}

.modal-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid #d8ab22;
}

.modal-hero-copy h2 {
    margin: 0;
    font-size: 28px;
}

.modal-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #51461f;
    color: #ffd54f;
    font-weight: 800;
}

.modal-title-badge img {
    width: 18px;
    height: 18px;
}

.modal-region {
    margin: 14px 0 0;
    color: #7c8fb0;
    font-size: 15px;
    font-weight: 600;
}

.namemc-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #182131;
    color: #9fb8e4;
    text-decoration: none;
}

.modal-section {
    margin-top: 28px;
}

.modal-section h3 {
    margin: 0 0 12px;
    font-size: 18px;
    text-transform: uppercase;
    color: #d3deef;
}

.modal-rank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #2f405a;
    border-radius: 12px;
    background: #162132;
}

.modal-rank-value {
    min-width: 52px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #efb52a;
    color: #1f1402;
    font-size: 28px;
    font-style: italic;
    font-weight: 900;
    text-align: center;
}

.modal-rank-label {
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
}

.modal-rank-points {
    color: #8ea5c7;
    font-weight: 600;
}

.modal-tiers-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
    border: 1px solid #2f405a;
    border-radius: 12px;
    background: #162132;
}

.modal-tier-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.modal-tier-chip img {
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 50%;
    background: #0e141d;
    border: 1px solid #2d3d59;
}

@media (max-width: 1180px) {
    .tierlist-columns {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

@media (max-width: 1080px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .primary-nav {
        justify-content: flex-start;
    }

    .header-right {
        flex-wrap: wrap;
    }

    .search-shell {
        min-width: 0;
        width: 100%;
    }

    .overall-grid {
        grid-template-columns: 120px 1fr;
    }

    .board-header div:nth-child(3),
    .board-header div:nth-child(4) {
        display: none;
    }

    .region-panel,
    .tiers-panel {
        grid-column: 2;
        justify-content: flex-start;
    }

    .tierlist-columns {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 12px;
    }

    .panel-toolbar {
        flex-direction: column;
    }

    .overall-grid {
        grid-template-columns: 1fr;
    }

    .board-header {
        display: none;
    }

    .rank-panel,
    .player-panel,
    .region-panel,
    .tiers-panel {
        width: 100%;
    }

    .tierlist-columns {
        grid-template-columns: 1fr;
    }
}
