/* ── Leaderboards Page (sidebar shell) ─────────────────────── */

.lb-shell {
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    text-align: left;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.lb-sidebar {
    position: sticky;
    top: 140px; /* below fixed site header (70px) + action bar (70px) */
    flex: 0 0 230px;
    height: calc(100vh - 242px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: rgba(8, 8, 8, 0.82);
    border: 1px solid rgba(255, 191, 0, 0.12);
    border-radius: 14px;
    margin: 16px 0 16px 16px;
    padding: 12px 10px 16px;
    box-sizing: border-box;
}

.lb-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.lb-nav-group {
    margin-bottom: 6px;
}

.lb-nav-group-label {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.58rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(240, 236, 230, 0.32);
    padding: 14px 12px 6px;
}

.lb-tab {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    height: auto; /* override global button height */
    background: transparent;
    border: none;
    border-radius: 9px;
    padding: 10px 12px;
    color: rgba(240, 236, 230, 0.55);
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.lb-tab > i:first-child {
    width: 18px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 191, 0, 0.45);
    flex-shrink: 0;
    transition: color 0.2s;
}

.lb-tab > span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-tab:hover {
    color: rgba(240, 236, 230, 0.9);
    background: rgba(255, 255, 255, 0.04);
}

/* anchor variant of a sidebar tab (navigates away, e.g. The Abyss) */
.lb-tab-link {
    box-sizing: border-box;
    text-decoration: none;
}

.lb-tab-link > i:first-child {
    animation: lb-abyss-spin 5s linear infinite;
}

@keyframes lb-abyss-spin {
    to { transform: rotate(360deg); }
}

.lb-tab.active {
    background: rgba(255, 191, 0, 0.13);
    color: #ffbf00;
}

.lb-tab.active > i:first-child {
    color: #ffbf00;
}

/* Powered-by + search pinned to the top of the rail, above the nav */
.lb-sidebar-head {
    padding: 2px 6px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 191, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Content column + top bar ─────────────────────────────── */
.lb-content-col {
    flex: 1;
    min-width: 0;
}

.lb-topbar {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 18px 24px 0;
    max-width: 940px;
    margin: 0 auto;
    box-sizing: border-box;
}

.lb-heading {
    font-family: 'DragonSlayer', serif;
    color: #ffbf00;
    font-size: 1.5rem;
    letter-spacing: 4px;
    margin: 0;
    text-shadow: 0 0 14px rgba(255, 191, 0, 0.18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-subhead {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(240, 236, 230, 0.4);
    white-space: nowrap;
}

.lb-page {
    width: 100%;
    max-width: 940px;
    margin: 0 auto;
    padding: 18px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Powered-by ───────────────────────────────────────────── */
.lb-powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(8, 8, 8, 0.7);
    border: 1px solid rgba(255, 191, 0, 0.1);
    border-radius: 10px;
    flex-wrap: nowrap;       /* keep "Powered by" + logo on a single line */
    white-space: nowrap;
    overflow: hidden;
}

.lb-powered-text {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.62rem;
    letter-spacing: 1.5px;   /* tightened so the label stays on one line in the narrow rail */
    color: rgba(240, 236, 230, 0.45);
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 0;            /* allow the text to shrink rather than force a wrap */
}

.lb-rr-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;          /* logo keeps its size; the text shrinks first */
    text-decoration: none;
    transition: opacity 0.2s;
}

.lb-rr-link:hover {
    opacity: 0.8;
}

.lb-rr-logo {
    height: 24px;
    object-fit: contain;
}

/* ── Player Search ───────────────────────────────────────── */
.lb-search-wrap {
    display: flex;
    gap: 0;
    width: 100%;
}

.lb-search-input {
    flex: 1;
    min-width: 0;
    background: rgba(8, 8, 8, 0.7);
    border: 1px solid rgba(255, 191, 0, 0.12);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 10px 14px;
    color: #f0ece6;
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
    outline: none;
    transition: border-color 0.2s;
}

.lb-search-input::placeholder {
    color: rgba(240, 236, 230, 0.3);
}

.lb-search-input:focus {
    border-color: rgba(255, 191, 0, 0.35);
}

.lb-search-btn {
    background: rgba(255, 191, 0, 0.15);
    border: 1px solid rgba(255, 191, 0, 0.12);
    border-radius: 0 10px 10px 0;
    padding: 10px 15px;
    color: #ffbf00;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
    height: auto;
}

.lb-search-btn:hover {
    background: rgba(255, 191, 0, 0.25);
}

/* ── Player Links ────────────────────────────────────────── */
.lb-player-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.lb-player-link:hover {
    color: #ffbf00;
    text-decoration: underline;
}

/* ── Table ────────────────────────────────────────────────── */
.lb-table-wrap {
    background:
        radial-gradient(ellipse 120% 60% at 50% -20%, rgba(255, 191, 0, 0.06), transparent 60%),
        rgba(8, 8, 8, 0.88);
    border: 1px solid rgba(255, 191, 0, 0.16);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.lb-table th,
.lb-table td {
    padding: 13px 16px;
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 191, 0, 0.06);
}

.lb-table th {
    background: linear-gradient(180deg, rgba(255, 191, 0, 0.12), rgba(255, 191, 0, 0.05));
    border-bottom: 1px solid rgba(255, 191, 0, 0.22);
    color: #ffbf00;
    font-size: 0.66rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    text-align: center;
}

.lb-table th.lb-col-name {
    text-align: left;
}

.lb-table td {
    color: rgba(240, 236, 230, 0.82);
}

.lb-table tbody tr {
    animation: lb-row-in 0.4s ease both;
}

@keyframes lb-row-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.lb-table tbody tr:hover td {
    background-color: rgba(255, 191, 0, 0.04);
}

.lb-table tr:last-child td {
    border-bottom: none;
}

/* ── Columns ──────────────────────────────────────────────── */
.lb-col-rank {
    width: 72px;
    text-align: center !important;
}

.lb-col-name {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-col-rating {
    width: 110px;
    text-align: center !important;
}

.lb-rating-num {
    font-family: 'DragonSlayer', serif;
    font-size: 1.02rem;
    letter-spacing: 1.5px;
    color: #ffbf00;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255, 191, 0, 0.18);
}

.lb-col-games {
    width: 90px;
    text-align: center !important;
    color: rgba(240, 236, 230, 0.45);
    font-variant-numeric: tabular-nums;
}

.lb-col-winrate {
    width: 120px;
    text-align: center !important;
}

/* Experience board columns */
.lb-col-level {
    width: 110px;
    text-align: center !important;
}

.lb-level-num {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DragonSlayer', serif;
    font-size: 1.0rem;
    letter-spacing: 1px;
    color: #ffbf00;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255, 191, 0, 0.18);
}

.lb-level-num i {
    font-size: 0.66rem;
    color: rgba(255, 191, 0, 0.85);
}

.lb-col-xp {
    width: 150px;
    text-align: center !important;
}

.lb-xp-num {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: rgba(240, 236, 230, 0.88);
}

.lb-xp-unit {
    margin-left: 5px;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: rgba(240, 236, 230, 0.38);
}

/* ── Rank badges ──────────────────────────────────────────── */
.lb-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-family: 'DragonSlayer', serif;
    font-size: 0.78rem;
    letter-spacing: 0;
    color: rgba(240, 236, 230, 0.55);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 191, 0, 0.14);
    font-variant-numeric: tabular-nums;
}

.lb-rb-1 {
    background: radial-gradient(circle at 35% 28%, #fff3b0 0%, #ffd700 38%, #c08a00 78%, #7a5600 100%);
    border: none;
    color: #3a2800;
    font-size: 0.82rem;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.2);
    animation: lb-glow-gold 2.4s ease-in-out infinite;
}

.lb-rb-2 {
    background: radial-gradient(circle at 35% 28%, #ffffff 0%, #cfd4dc 40%, #8d949e 80%, #5d636b 100%);
    border: none;
    color: #23262a;
    box-shadow: 0 0 10px rgba(200, 208, 218, 0.4);
}

.lb-rb-3 {
    background: radial-gradient(circle at 35% 28%, #f0b27d 0%, #cd7f32 45%, #8c5418 85%, #5e3810 100%);
    border: none;
    color: #2e1a05;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.4);
}

@keyframes lb-glow-gold {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.45), 0 0 26px rgba(255, 215, 0, 0.16); }
    50%      { box-shadow: 0 0 18px rgba(255, 215, 0, 0.7),  0 0 40px rgba(255, 215, 0, 0.3); }
}

/* ── Podium rows (top 3) ──────────────────────────────────── */
.lb-gold td {
    color: #ffd700;
    background-image: linear-gradient(90deg, rgba(255, 215, 0, 0.09), transparent 65%);
}

.lb-silver td {
    color: #cfd4dc;
    background-image: linear-gradient(90deg, rgba(200, 208, 218, 0.07), transparent 65%);
}

.lb-bronze td {
    color: #d99857;
    background-image: linear-gradient(90deg, rgba(205, 127, 50, 0.08), transparent 65%);
}

.lb-gold .lb-col-name,
.lb-silver .lb-col-name,
.lb-bronze .lb-col-name {
    font-size: 0.95rem;
    letter-spacing: 1px;
}

.lb-gold .lb-rating-num   { color: #ffd700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.35); }
.lb-silver .lb-rating-num { color: #cfd4dc; text-shadow: 0 0 10px rgba(200, 208, 218, 0.3); }
.lb-bronze .lb-rating-num { color: #d99857; text-shadow: 0 0 10px rgba(205, 127, 50, 0.3); }

.lb-gold .lb-level-num   { color: #ffd700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.35); }
.lb-silver .lb-level-num { color: #cfd4dc; text-shadow: 0 0 10px rgba(200, 208, 218, 0.3); }
.lb-bronze .lb-level-num { color: #d99857; text-shadow: 0 0 10px rgba(205, 127, 50, 0.3); }
.lb-gold .lb-level-num i, .lb-silver .lb-level-num i, .lb-bronze .lb-level-num i { color: inherit; }

/* Heavier divider under the podium */
.lb-top3-end td {
    border-bottom: 1px solid rgba(255, 191, 0, 0.25);
}

/* ── Own row highlight ────────────────────────────────────── */
.lb-me td {
    background-color: rgba(255, 191, 0, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 191, 0, 0.25), inset 0 -1px 0 rgba(255, 191, 0, 0.25);
}

.lb-you-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #ffbf00;
    color: #0e0e0e;
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 1.5px;
    vertical-align: middle;
}

/* ── Win-rate cell: percentage + mini bar ─────────────────── */
.lb-wr {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 64px;
}

.lb-wr-num {
    font-weight: bold;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.lb-wr-bar {
    width: 64px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.lb-wr-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.lb-wr-hot .lb-wr-num  { color: #ffbf00; }
.lb-wr-hot .lb-wr-fill { background: linear-gradient(90deg, #6dbf74, #ffbf00); box-shadow: 0 0 6px rgba(255, 191, 0, 0.5); }

.lb-wr-pos .lb-wr-num  { color: #6dbf74; }
.lb-wr-pos .lb-wr-fill { background: #6dbf74; }

.lb-wr-mid .lb-wr-num  { color: rgba(240, 236, 230, 0.6); }
.lb-wr-mid .lb-wr-fill { background: rgba(240, 236, 230, 0.45); }

.lb-wr-neg .lb-wr-num  { color: rgba(220, 110, 90, 0.85); }
.lb-wr-neg .lb-wr-fill { background: rgba(220, 110, 90, 0.7); }

.lb-winrate-none {
    color: rgba(240, 236, 230, 0.3);
}

.lb-loading {
    text-align: center;
    color: rgba(240, 236, 230, 0.5);
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.9rem;
    letter-spacing: 2px;
    padding: 48px 0 !important;
}

/* ── Pagination ───────────────────────────────────────────── */
.lb-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.lb-page-btn {
    background: rgba(255, 191, 0, 0.06);
    border: 1px solid rgba(255, 191, 0, 0.15);
    border-radius: 8px;
    padding: 8px 14px;
    color: rgba(240, 236, 230, 0.6);
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-width: 36px;
    text-align: center;
}

.lb-page-btn:hover:not(:disabled) {
    background: rgba(255, 191, 0, 0.14);
    color: #ffbf00;
}

.lb-page-btn.active {
    background: rgba(255, 191, 0, 0.18);
    color: #ffbf00;
    border-color: rgba(255, 191, 0, 0.35);
    font-weight: bold;
}

.lb-page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.lb-page-dots {
    color: rgba(240, 236, 230, 0.3);
    padding: 0 4px;
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.8rem;
}

/* ── Footer Link ──────────────────────────────────────────── */
.lb-footer-link {
    text-align: center;
    padding: 8px 0;
}

.lb-footer-link a {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: rgba(255, 191, 0, 0.5);
    text-decoration: none;
    transition: color 0.2s;
}

.lb-footer-link a:hover {
    color: #ffbf00;
}

.lb-footer-link i {
    font-size: 0.6rem;
    margin-left: 4px;
}

/* ── Responsive: sidebar becomes a wrapping chip bar ──────── */
@media only screen and (max-width: 1024px), only screen and (hover: none) {
    .lb-shell {
        flex-direction: column;
    }

    .lb-sidebar {
        position: static;
        flex: none;
        width: auto;
        height: auto;
        overflow: visible;
        flex-direction: column;
        margin: 12px 12px 0;
        padding: 12px 12px 14px;
    }

    .lb-nav {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    /* Flatten the groups into one wrapping chip row */
    .lb-nav-group {
        display: contents;
    }

    .lb-nav-group-label {
        display: none;
    }

    .lb-tab {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        border: 1px solid rgba(255, 191, 0, 0.18);
        border-radius: 999px;
        padding: 7px 14px;
    }

    .lb-tab.active {
        border-color: rgba(255, 191, 0, 0.55);
    }

    .lb-tab > i:first-child {
        width: auto;
    }

    .lb-sidebar-head {
        margin: 0 0 10px;
        padding: 0 0 10px;
        border-bottom: 1px solid rgba(255, 191, 0, 0.08);
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .lb-search-wrap {
        flex: 1;
    }

    .lb-powered {
        flex: 0 0 auto;
    }

    .lb-topbar {
        padding: 14px 12px 0;
        max-width: none;
    }

    .lb-page {
        padding: 14px 12px 60px;
        max-width: none;
        gap: 16px;
    }
}

/* ── Narrow phones: tighten the table ─────────────────────── */
@media only screen and (max-width: 767px) {
    .lb-sidebar-head {
        flex-direction: column;
    }

    .lb-table th,
    .lb-table td {
        padding: 10px 8px;
        font-size: 0.78rem;
    }

    .lb-col-rank {
        width: 50px;
    }

    .lb-rank-badge {
        width: 28px;
        height: 28px;
        font-size: 0.66rem;
    }

    .lb-rb-1 {
        font-size: 0.7rem;
    }

    .lb-col-rating {
        width: 76px;
    }

    .lb-rating-num {
        font-size: 0.9rem;
    }

    .lb-col-games {
        display: none;
    }

    .lb-col-winrate {
        width: 78px;
    }

    .lb-col-level {
        width: 70px;
    }

    .lb-col-xp {
        width: 96px;
    }

    .lb-xp-unit {
        display: none;
    }

    .lb-wr,
    .lb-wr-bar {
        min-width: 0;
        width: 48px;
    }

    .lb-gold .lb-col-name,
    .lb-silver .lb-col-name,
    .lb-bronze .lb-col-name {
        font-size: 0.85rem;
    }

    .lb-you-tag {
        margin-left: 5px;
        padding: 1px 5px;
        font-size: 0.5rem;
    }

    .lb-page-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        min-width: 30px;
    }
}
