:root {
    --bg-dark: #0a0a0c;
    --card-bg: rgba(255, 255, 255, 0.03);
    --accent: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.3);
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --diamond: #b9f2ff;
    --text: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.glow-bg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 255, 0.05) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.dashboard-container {
    width: 100%;
    padding: 0 3rem;
}

/* Header */
header {
    padding: 4rem 0 2rem;
    text-align: center;
}

h1 {
    font-size: 3rem;
    letter-spacing: 4px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.accent {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.subtitle {
    opacity: 0.6;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

/* ─── TOP NAV ─────────────────────────────────────────────────── */
.top-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 2rem;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop searches sit in col 1 and col 3 */
.top-controls .desktop-search:first-child { justify-self: start; }
.top-controls .desktop-search:nth-child(3) { justify-self: end; }

/* Mobile dropdown sits below the grid — hidden by default */
.search-menu-wrapper {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    padding-top: 0.5rem;
}
.search-menu-wrapper.active { display: flex; }

.logo-mini { text-align: center; }
.logo-mini h1 { font-family: 'Outfit', sans-serif; font-weight: 900; text-transform: uppercase; }

.menu-toggle-btn {
    display: none;
    background: rgba(0,242,255,0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: 0.2s;
    margin-top: 0.4rem;
}
.menu-toggle-btn:hover { background: var(--accent); color: #000; }

.search-box {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.3rem;
    border-radius: 12px;
    display: flex;
    flex: 1;
    max-width: 480px;
    min-width: 0;
}
.search-box input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: white;
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    outline: none;
}
.search-box button {
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 0 1.2rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.search-box button:hover { background: #00d8e6; }

/* ─── MAIN DASHBOARD LAYOUT ───────────────────────────────────── */
.dashboard-container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

.dashboard-wrapper {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    margin-top: 2rem;
    width: 100%;
    align-items: flex-start;
}

.board-sidebar {
    width: 320px;
    flex: 0 0 320px;
}

.board-right-sidebar {
    width: 320px;
    flex: 0 0 320px;
}

.board-main-content {
    flex: 1 1 0;
    min-width: 0; /* critical: prevents flex overflow */
}

/* Sidebar tall leaderboard */
.board-sidebar .mini-leaderboard {
    height: auto;
    min-height: 500px;
}

/* ─── LEADERBOARD CARDS ───────────────────────────────────────── */
.leaderboard-grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.mini-leaderboard {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.5rem;
    letter-spacing: 2px;
    opacity: 0.8;
    margin: 2rem 0 1rem;
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
}

.card-header-small {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.card-header-small h3 { font-size: 1rem; letter-spacing: 1px; opacity: 0.8; }

.badge {
    background: rgba(0,242,255,0.1);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ─── MINI TABLE ──────────────────────────────────────────────── */
.mini-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}
.mini-table-container::-webkit-scrollbar { width: 4px; }
.mini-table-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.mini-table-container::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

table { width: 100%; border-collapse: collapse; }

th { font-size: 0.75rem; opacity: 0.5; text-align: left; padding: 0.4rem 0.5rem; white-space: nowrap; }

td {
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

/* Rank column: shrinks to content */
td:first-child { white-space: nowrap; width: 1%; }
/* Value column: shrinks to content */
td:last-child { white-space: nowrap; width: 1%; }
/* Name+emotes column: takes remaining space, clips overflow — does NOT expand */
td:nth-child(2) { width: 100%; max-width: 0; overflow: hidden; }

.board-rank { font-weight: 700; color: var(--accent); display: inline-block; }

.board-user {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.board-icon { width: 20px; height: 20px; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.board-emoji { font-size: 1rem; flex-shrink: 0; }

.board-name {
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}
.board-name:hover { color: var(--accent); }

.board-badges {
    display: inline-flex;
    gap: 3px;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 1;
    font-size: 0.85rem;
}

.val-display { text-align: right; opacity: 0.8; font-weight: 700; font-family: 'JetBrains Mono'; white-space: nowrap; }

/* ─── NAME TIERS ─────────────────────────────────────────────── */
.board-name.name-lvl-1 { color: #00ffff; }
.board-name.name-lvl-2 { color: #0066ff; }
.board-name.name-lvl-3 { color: #ff66cc; }
.board-name.name-lvl-4 { color: #ff9933; }
.board-name.name-lvl-5 { color: #ff0000; font-style: italic; }
.board-name.name-lvl-6 { color: #9900ff; font-style: italic; }
.board-name.name-lvl-7 { color: #ffff00; font-style: italic; }
.board-name.name-lvl-8 { color: #00ff00; font-style: italic; }
.board-name.name-lvl-9 { color: #ffcc00; font-style: italic; }
.board-name.name-lvl-10 { color: #ffffff; text-shadow: 0 0 10px rgba(255,255,255,0.5); font-style: italic; }

/* ─── TIER BUBBLES ───────────────────────────────────────────── */
.tier-bubble { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tier-1 { background-color: var(--bronze); box-shadow: 0 0 5px var(--bronze); }
.tier-2 { background-color: var(--silver); box-shadow: 0 0 5px var(--silver); }
.tier-3 { background-color: var(--gold); box-shadow: 0 0 5px var(--gold); }
.tier-4 { background-color: var(--diamond); box-shadow: 0 0 10px var(--accent-glow); }

/* ─── SPOTLIGHT ──────────────────────────────────────────────── */
.spotlight-card {
    background: linear-gradient(135deg, rgba(0,242,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid var(--accent-glow);
    padding: 1.2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* ─── CARD ───────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 2rem;
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal {
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
}
.modal.active { display: flex; }
.modal-content {
    width: 95%;
    max-width: 1000px;
    position: relative;
    border: 1px solid var(--accent-glow);
    animation: modalIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.emote-gallery-item { position: relative; padding: 10px; }
.active-tag {
    position: absolute; top: -5px; right: -5px;
    background: var(--accent); color: #000;
    font-size: 0.5rem; font-weight: 900;
    padding: 2px 5px; border-radius: 4px;
    box-shadow: 0 0 10px var(--accent-glow);
}

.close-btn { position: absolute; right: 20px; top: 20px; font-size: 2rem; cursor: pointer; opacity: 0.4; transition: 0.2s; }
.close-btn:hover { opacity: 1; color: var(--accent); }

footer { text-align: center; padding: 4rem 0; opacity: 0.3; font-size: 1rem; }

/* ─── TABLET (1300px and below) ──────────────────────────────── */
@media (max-width: 1300px) {
    .board-sidebar { width: 260px; flex: 0 0 260px; }
    .board-right-sidebar { width: 260px; flex: 0 0 260px; }
    .dashboard-container { padding: 0 1rem; }
}

/* ─── COLLAPSE TO MOBILE (900px and below) ───────────────────── */
@media (max-width: 900px) {
    /* Nav: switch to stacked, show toggle */
    .top-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 0.8rem 1rem;
    }
    .desktop-search { display: none !important; }
    .menu-toggle-btn { display: inline-block; }

    /* Layout: single column */
    .dashboard-wrapper {
        flex-direction: column;
    }
    .board-sidebar, .board-right-sidebar {
        width: 100%;
        flex: none;
        order: 2;
    }
    .board-right-sidebar { order: 3; }
    .board-main-content { order: 1; min-width: 0; }

    /* Grid: single column */
    .leaderboard-grid-main { grid-template-columns: 1fr; }
    .mini-leaderboard { height: auto; min-height: 400px; }

    .stats-grid-4 { grid-template-columns: 1fr 1fr; }

    .card { padding: 1rem; border-radius: 12px; }

    .dashboard-container { padding: 0 0.5rem; }

    .search-box { max-width: 100%; width: 100%; }
    .search-box input { padding: 0.6rem 0.7rem; font-size: 0.9rem; }
    .search-box button { padding: 0 0.9rem; font-size: 0.8rem; }

    .search-menu-wrapper { padding-top: 0.75rem; }
}

/* ─── SMALL MOBILE (500px and below) ─────────────────────────── */
@media (max-width: 500px) {
    h1 { font-size: 1.5rem; }
    .section-title { font-size: 1.1rem; }
}

