/* --- RESET & BASE --- */
* { 
    padding: 0; 
    margin: 0; 
    box-sizing: border-box; 
}

body { 
    background-color: #1a1a1a; 
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; 
    color: white; 
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

#menu {
    width: 520px; /* Increased slightly for better column spacing */
    max-height: 90vh;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    border: 2px solid #444;
    border-radius: 24px;
    padding: 30px;
    animation: fadeIn 0.5s ease-out;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* --- HEADER NAVIGATION --- */
.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
}

.title-group {
    text-align: center;
}

h1 { 
    font-size: 26px; 
    font-weight: 900; 
    letter-spacing: 3px; 
    margin-bottom: 2px;
    text-transform: uppercase;
}

#boardSub { 
    font-size: 10px; 
    color: #888; 
    letter-spacing: 1px;
    text-transform: uppercase; 
}

.nav-arrow {
    font-size: 28px;
    color: #ff4444;
    cursor: pointer;
    padding: 10px 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    color: white;
    text-shadow: 0 0 15px #ff4444;
    transform: scale(1.2);
}

.nav-arrow:active {
    transform: scale(0.9);
}

/* --- SCROLLABLE CONTAINER --- */
.leaderboard-wrapper {
    width: 100%;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 25px;
}

/* Custom Scrollbar */
.leaderboard-wrapper::-webkit-scrollbar { width: 6px; }
.leaderboard-wrapper::-webkit-scrollbar-track { background: transparent; }
.leaderboard-wrapper::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
.leaderboard-wrapper::-webkit-scrollbar-thumb:hover { background: #ff4444; }

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Ensures columns stay aligned during swaps */
}

thead th {
    position: sticky;
    top: 0;
    background: #0a0a0a;
    z-index: 10;
    font-size: 10px;
    font-weight: 800;
    color: #ff4444;
    padding: 15px 10px;
    text-align: left;
    border-bottom: 2px solid #222;
    letter-spacing: 1px;
}

/* Column Width Adjustments */
th:nth-child(1), td:nth-child(1) { width: 45px; text-align: center; } /* # */
th:nth-child(2), td:nth-child(2) { width: 140px; } /* Name */
th:nth-child(3), td:nth-child(3) { width: 75px; }  /* Score */
th:nth-child(4), td:nth-child(4) { width: 55px; }  /* Level */
th:nth-child(5), td:nth-child(5) { width: 85px; }  /* Time */
th:nth-child(6), td:nth-child(6) { width: 100px; } /* Date/Coins */

td {
    padding: 12px 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tr td:nth-child(2) { color: #fff; font-weight: bold; font-family: inherit; }
tr td:nth-child(3) { color: #ffeb3b; font-weight: 900; }

/* --- BUTTONS --- */
.btn-group-vertical { width: 220px; }

.menu-btn { 
    width: 100%;
    padding: 14px; 
    cursor: pointer; 
    background: transparent; 
    color: #ff4444; 
    border: 2px solid #ff4444; 
    font-weight: 800; 
    border-radius: 50px; 
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.menu-btn:hover { 
    background: #ff4444; 
    color: white;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#leaderboardBody tr {
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

#leaderboardBody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

#leaderboardBody tr:hover {
    background: rgba(255, 68, 68, 0.05);
}
