body {
    background-color: #1a1917;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    color: #bababa;
    margin: 0;
}

.navbar {
    background-color: #1a1917;
    padding: 1rem 2rem;
    position: fixed;
    top: 5px;
    left: 5px;
    right: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 3px solid #39ff14; 
    box-shadow: 0 0 10px #39ff14;
    border-bottom: 4px solid #39ff14;
    width: auto;
    border-radius: 15px;
    z-index: 1000;
}

.nav-auth {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: #39ff14;
    color: #fff;
    border: 2px solid #39ff14;
    border-radius: 6px;
    padding: 6px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    flex: 1;
    min-width: 85px;
    text-align: center;
}

.nav-btn:hover {
    background: #24a30e;
    border-color: #24a30e;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(36, 163, 14, 0.35);
}

.logo {
    font-size: 1.6rem;
    font-weight: bold;
    color: #39ff14;
    letter-spacing: 1px;
}

.signup-btn {
    background: #39ff14;
    color: #fff;
    border: 2px solid #39ff14;
}

.signup-btn:hover {
    background: #24a30e;
    border-color: #24a30e;
}

.main-container {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    padding: 5px;
    padding-bottom: 20px;
}

/* Button links inside main container cards - styled to rise slightly */
.main-container a {
    display: inline-block;
    padding: 8px 14px;
    background: #39ff14;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    border: 2px solid #39ff14;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.main-container a:hover {
    background: #24a30e;
    border-color: #24a30e;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(36, 163, 14, 0.35);
}
/* For a not in main container */
a {
    display: inline-block;
    padding: 8px 14px;
    background: #39ff14;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    border: 2px solid #39ff14;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

a:hover {
    background: #24a30e;
    border-color: #24a30e;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(36, 163, 14, 0.35);
}

.module-card {
    background-color: #312e2b;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #403d39;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

input {
    background: #1a1917;
    border: 2px solid #403d39;
    padding: 12px;
    color: #fff;
    border-radius: 4px;
    margin-bottom: 5px;
}

.modal-content input,
#auth-modal input,
#auth-modal .input-group input {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

.action-btn {
    background: #39ff14;
    border: none;
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    height: 42px;
}

.action-btn:hover {
    background: #24a30e;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(36, 163, 14, 0.35);
}

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
}

.modal-content {
    background: #262421;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 320px;
    text-align: center;
}

#modal-title {
    transition: transform 0.2s, text-shadow 0.2s;
    display: inline-block;
}

#modal-title:hover {
    transform: translateY(-4px);
    text-shadow: 0 6px 14px rgba(255, 255, 255, 0.25);
}

#up_btn {
    background-color: #39ff14;
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    position: fixed;
    right: 25px;
    bottom: 25px;
    cursor: pointer;
    z-index: 2000;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

#up_btn:hover {
    background-color: #24a30e;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(36, 163, 14, 0.35);
}

#stat-result-container {
    margin-top: 20px;
    padding: 15px;
    background: #1a1917;
    border-radius: 8px;
    border-left: 5px solid #39ff14;
    min-height: 60px;
}

.cancel-btn {
    background: black;
    border: 2px solid #940000;
    color: #940000;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
    height: 42px;
}
.cancel-btn:hover {
    background: #940000;
    color: #fff;
    border-color: #940000;
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(148, 0, 0, 0.35);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
        flex-direction: column;
        gap: 10px;
        margin-left: 0px;
        margin-right: 0px;
        border-radius: 15px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-auth, #nav-user-profile {
        display: flex;
        gap: 5px;
    }

    .nav-btn {
        padding: 4px 10px;
        font-size: 0.9rem;
    }

    .main-container {
        margin-top: 30px;
        padding: 20px;
        gap: 20px;
        grid-template-columns: 1fr;
    }

    .module-card {
        padding: 15px;
    }

    .modal-content {
        width: 90%;
        margin: 20% auto;
        padding: 20px;
    }

    input {
        width: 100%;
        box-sizing: border-box;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-group input {
        width: 100%;
    }

    #up_btn {
        width: 35px;
        height: 35px;
        right: 15px;
        bottom: 15px;
    }
}

/* ... [Keep your top code the same until the 480px media query] ... */

@media (max-width: 480px) {
    .navbar {
        margin-left: 0px;
        margin-right: 0px;
        border-radius: 10px;
    }

    .logo {
        font-size: 1rem;
    }

    .main-container {
        padding: 10px;
        /* Increased to 140px so content starts BELOW the fixed navbar */
        margin-top: 30px;
    }

    .modal-content {
        width: 90%; /* Changed from min() to simple % for better support */
        margin: 25% auto;
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        box-sizing: border-box;
    }

    .modal-content input,
    .modal-content .action-btn,
    .modal-content .cancel-btn {
        width: 100%;
        margin: 0 auto;
        max-width: 100%;
        box-sizing: border-box;
    }

    .nav-auth, #nav-user-profile {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .nav-btn {
        flex: 1;
        min-width: 0;
        /* Removed max-width to let them fill the space evenly */
    }

    /* Fixed the broken brackets here */
    .module-card {
        padding: 10px;
    }

    h2 {
        font-size: 1.2rem;
    }

    .action-btn, .cancel-btn {
        padding: 10px;
        font-size: 0.9rem;
        height: auto; /* Let it fit the text */
    }
    #container {
        margin-left: 0px;
        margin-right: 0px;
    }
} /* End of 480px query */

footer {
    padding-bottom: 53px;
    color: #bababa;
    font-size: 0.9rem;
    border-top: 3px solid #39ff14;
    position: relative;
    bottom: 0;
    width: auto;
    margin-left: 5px;
    margin-right: 5px;
}
footer h3, p{
    margin-left: 20px;
    font-size: medium;
    color: #bababa;
}
footer h3{
    font-size: 20px;
}
footer p {
    margin-left: 40px;
    margin-top: -10px;
}
#container {
    border: 3px solid #39ff14;
    border-radius: 15px;
    margin-left: 5px;
    margin-right: 5px;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.5); 
    margin-bottom: 5px;
}
/* Card containers hold images and buttons; buttons are positioned absolutely at the bottom */
.card-container {
    position: relative;
    width: auto;
    height: 98%;
    margin-left: 10px;
    margin-top: 10px;
    margin-right: 10px;
    border: 2px solid #39ff14;
    border-radius: 10px;
    overflow: hidden;
    background-color: #111;
    display: inline;
}
.card-container img {
    width: 100%;
    border-bottom: 2px solid #39ff14;
}

#user-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 0 !important; /* This forces it to be a square */
    border: 2px solid #39FF14; /* Neon Green Frame */
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.5); /* Glow */
    margin-right: 10px;
    object-fit: cover;
    display: block;
}

.leaderboard-container {
    max-height: 500px;
    overflow-y: auto;
    border: 3px solid #39FF14; /* The neon border */
    background: #1a1a1a;
    margin: 10px;
    border-radius: 15px;
    padding: 0; /* Change this to 0 to remove the inside gap */
        box-shadow: 0 0 10px rgba(57, 255, 20, 0.5); /* Neon glow effect */
}

/* Scrollbar */
.leaderboard-container::-webkit-scrollbar {
    width: 5px;
}
.leaderboard-container::-webkit-scrollbar-thumb {
    background: #39FF14;
    border-radius: 10px;
}
.leaderboard-container::-webkit-scrollbar-track {
    background: #111;
}

#leaderboard-table th {
    position: sticky; /* Keeps the Rank/Name/Rating headers at the top while you scroll */
    top: 0;
    background: black;
    z-index: 10;
    padding-top: 10px;
}
.leaderboard-header {
    color: #39FF14;
    font-family: monospace;
    letter-spacing: 2px;
    margin-bottom: 15px;
    font-weight: bold;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    color: #eee;
}

#leaderboard-table th {
    text-align: left;
    color: #39FF14;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
}

#leaderboard-table thead th {
    position: sticky;
    top: 0; /* Sticks exactly to the top of the container */
    background: #111; /* Dark background for the bar */
    z-index: 10;
    padding: 15px 10px; /* Gives the bar some height */
    text-transform: uppercase;
    font-size: 0.8rem;
    border-bottom: 1px solid #333; /* Line under the bar */
    padding-left: 15px !important; /* Adjust this number (5px-15px) until it lines up */
    text-align: left;
}

#leaderboard-table td {
    padding: 12px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.neon-green {
    color: #39FF14;
    text-shadow: 0 0 5px #39FF14;
}
#leaderboard-table tbody td {
    padding-left: 20px;
}