/* ===== RIGHT RAIL (BXH) - Desktop ===== */
.right-rail {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}


.leaderboard-card {
    background: white;
    border-radius: 12px;
    padding: 10px;
    /* Compact padding */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef2f6;
}

/* ... headers ... */

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Gap between Pos and User block */
    padding: 8px 4px;
    /* Compact row padding */
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.rank-item:hover {
    background-color: #f8fafc;
    transform: translateX(2px);
}

.rank-item:last-child {
    border-bottom: none;
}

/* Rank Position */
.rank-pos {
    width: 20px;
    /* Smaller width */
    min-width: 20px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: #cbd5e1;
}

/* Top 3 Colors */
.rank-item.top1 .rank-pos {
    color: #fbbf24;
    font-size: 18px;
    font-weight: 800;
}

.rank-item.top2 .rank-pos {
    color: #94a3b8;
    font-size: 16px;
    font-weight: 800;
}

.rank-item.top3 .rank-pos {
    color: #d97706;
    font-size: 16px;
    font-weight: 800;
}

/* Wrapper for Avatar + Info to ensure horizontal alignment */
.rank-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    /* Enable truncation in flex child */
}

/* Avatar - already inline styled in JS but good to keep base */
.rank-avatar {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.rank-item.top1 .rank-avatar {
    border: 2px solid #fbbf24;
}

.rank-item.top2 .rank-avatar {
    border: 2px solid #cbd5e1;
}

.rank-item.top3 .rank-avatar {
    border: 2px solid #d97706;
}

/* Info */
.rank-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
    overflow: hidden;
    /* For truncation */
}

.rank-name {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-amount {
    font-size: 12px;
    font-weight: 500;
    color: #ef4444;
}

.rank-loading {
    text-align: center;
    padding: 15px;
    color: #64748b;
    font-size: 12px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.leaderboard-header h3 {
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(to right, #DAA520, #FFD700);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    text-transform: uppercase;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Remove gap for list view */
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    border-radius: 4px;
    /* Slight radius for hover effect */
}

.rank-item:hover {
    background-color: #f8fafc;
    transform: translateX(2px);
    /* Subtle shift */
}

.rank-item:last-child {
    border-bottom: none;
}

/* Rank Position */
.rank-pos {
    width: 24px;
    min-width: 24px;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    color: #94a3b8;
    /* Default for 4+ */
}

/* Top 3 Colors */
.rank-item.top1 .rank-pos {
    color: #fbbf24;
    /* Gold */
    font-size: 20px;
    text-shadow: 0 1px 0 rgba(251, 191, 36, 0.4);
}

.rank-item.top2 .rank-pos {
    color: #94a3b8;
    /* Silver */
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(148, 163, 184, 0.4);
}

.rank-item.top3 .rank-pos {
    color: #d97706;
    /* Bronze */
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(217, 119, 6, 0.2);
}

/* Top 3 Styling - Premium Cards (Soft & Rounded) */
.rank-item.top1 {
    background: linear-gradient(to right, #fff77354, #fdffc945);
    /* Very soft yellow */
    border: 2px solid #f7ef6f9e;
    /* Lighter Gold border */
    box-shadow: 0 4px 10px rgba(251, 191, 36, 0.1);
    margin-bottom: 10px;
    border-radius: 16px;
    /* Rounder corners */
}

.rank-item.top2 {
    background: linear-gradient(to right, #e3e5e77d, #ffffff);
    border: 2px solid #e1e4e7a6;
    /* Lighter Silver border */
    margin-bottom: 10px;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.rank-item.top3 {
    background: linear-gradient(to right, #f5d7b06e, #ffe8c500);
    border: 1.8px solid #dbba8e5c;
    /* Lighter Bronze border */
    margin-bottom: 10px;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

/* Hover effects for top 3 */
.rank-item.top1:hover,
.rank-item.top2:hover,
.rank-item.top3:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
}

/* Specific text colors */
.rank-item.top1 .rank-pos {
    color: #d97706;
    text-shadow: none;
    font-size: 24px;
}

.rank-item.top2 .rank-pos {
    color: #64748b;
    text-shadow: none;
    font-size: 20px;
}

.rank-item.top3 .rank-pos {
    color: #b45309;
    text-shadow: none;
    font-size: 20px;
}

/* Avatar Styling already inline in JS, but adding border here just in case */
.rank-avatar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank-item.top1 .rank-avatar {
    border: 2px solid #fbbf24;
}

.rank-item.top2 .rank-avatar {
    border: 2px solid #cbd5e1;
}

.rank-item.top3 .rank-avatar {
    border: 2px solid #d97706;
}

/* Info Text */
.rank-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Left align */
    justify-content: center;
    line-height: 1.3;
}

.rank-name {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.rank-amount {
    font-size: 13px;
    font-weight: 600;
    color: #ef4444;
    /* Red for money */
}

.rank-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-style: italic;
}

/* ===== NEW CENTER COLUMN LAYOUT ===== */
.center-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    /* Fix flex overflow */
}

/* Override existing main-area styles if needed */
.main-area {
    flex: initial !important;
    /* Let center-column handle flex */
    width: 100%;
}

/* ===== MOBILE RANK BANNER ===== */
.mobile-rank-banner {
    display: none;
    /* Hide on Desktop */
    background: white;
    border-radius: 12px;
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #eef2f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
    /* For shimmer effect */
}

/* Shimmer Animation */
.mobile-rank-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.8) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    /* Fast pass */
    100% {
        left: 200%;
    }

    /* Wait before next pass */
}

.mobile-rank-banner:active {
    transform: scale(0.98);
    background: #f8fafc;
}

.mobile-rank-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-dot-banner {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    animation: pulse-green 2s infinite;
}

.mobile-rank-banner h3 {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
    /* Create a gradient with a white streak in the middle for shine */
    background: linear-gradient(90deg,
            #B8860B 0%,
            #FFD700 20%,
            #e58812 50%,
            #FFD700 80%,
            #B8860B 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: text-shimmer 3s linear infinite;
}

@keyframes text-shimmer {
    to {
        background-position: 200% center;
    }
}

.mobile-rank-banner-right {
    display: flex;
    align-items: center;
}

.rank-arrow-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

/* MOBILE MODAL */
.mobile-rank-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    align-items: flex-end;
    /* Slide from bottom */
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-rank-modal.active {
    display: flex;
    opacity: 1;
}

.mobile-rank-content {
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px 16px 16px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.mobile-rank-modal.active .mobile-rank-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
}

.modal-drag-indicator {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

/* RESPONSIVE: Hide Right Rail on Tablet/Mobile, Show Banner */
@media (max-width: 1024px) {
    .right-rail {
        display: none;
    }

    /* Push Left Rail down to align with Tabs (skipping Banner height) */
    .left-rail {
        padding-top: 58px;
        /* ~Height of Banner (46px) + Gap (12px) */
        transition: padding 0.9s;
    }

    .mobile-rank-banner {
        display: flex;
        margin-left: -65px;
        /* Shift slightly left per user request */
        margin-right: -2px;
        /* Slight expansion right */
        width: calc(47% + 8px);
        /* Compensate width */
    }
}