:root {
    --primary-blue: #0d1e6b;
    --dark-purple: #3b196b;
    --highlight-yellow: #ffc425;
    --highlight-red: #d93829;
    --light-blue: #40a3e6;
    --pixel-font: 'Press Start 2P', cursive;
}
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
body {
    background-color: var(--primary-blue);
    background-image: linear-gradient(45deg, var(--dark-purple) 25%, transparent 25%), linear-gradient(-45deg, var(--dark-purple) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--dark-purple) 75%), linear-gradient(-45deg, transparent 75%, var(--dark-purple) 75%);
    background-size: 60px 60px;
    background-position: 0 0, 0 30px, 30px -30px, -30px 0px;
    color: white;
    font-family: var(--pixel-font);
    text-align: center;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}
img { image-rendering: pixelated; }

.main-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    max-width: 1000px;
    margin: 0 auto 40px auto;
    position: relative;
}
#site-logo {
    max-width: 150px;
}
.leaderboard-link {
    display: inline-block;
    background-color: var(--highlight-red);
    color: white;
    padding: 15px 30px;
    font-size: 1rem;
    text-decoration: none;
    border: 3px solid white;
    box-shadow: 0 6px 0 #8b231a;
    transition: transform 0.1s ease-out;
    margin-top: 0;
}
.leaderboard-link:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #8b231a;
}

.page-title { color: var(--highlight-yellow); text-shadow: 3px 3px 0 var(--highlight-red); font-size: 2rem; letter-spacing: 2px; }

.game-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px; 
    max-width: 1000px; 
    margin: 40px auto; 
}

.game-card { background: #0000004d; border: 4px solid var(--light-blue); padding: 20px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 8px 0 #1b6ead; }
.game-card:hover { transform: translateY(-5px); box-shadow: 0 12px 0 #1b6ead; }
.game-card img { max-width: 100%; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: var(--primary-blue); border: 4px solid var(--light-blue); padding: 40px; width: 90%; max-width: 500px; position: relative; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.modal-content h2 { color: var(--highlight-yellow); margin-top: 0; }
.btn { font-family: var(--pixel-font); font-size: 0.9rem; padding: 12px 24px; border: 3px solid white; background-color: #555; color: white; cursor: pointer; box-shadow: 0 5px 0 #333; transition: all 0.1s ease-out; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #333; }
.btn.btn-primary { background-color: var(--highlight-red); box-shadow: 0 5px 0 #8b231a; }
.btn.btn-primary:active { box-shadow: 0 2px 0 #8b231a; }
.close-btn { position: absolute; top: 10px; right: 20px; background: none; border: none; font-size: 2.5rem; color: white; cursor: pointer; }
.hidden { display: none !important; }
.auth-form-container { display: flex; flex-direction: column; gap: 15px; margin: 20px 0; }
.auth-input { font-family: var(--pixel-font); font-size: 1rem; padding: 10px; background-color: #0000004d; border: 2px solid var(--light-blue); color: white; }
.error-message { color: var(--highlight-red); font-size: 0.8rem; min-height: 1em; }
#form-toggle-link, #form-toggle-link a { font-size: 0.8rem; color: white; text-decoration: none; }
#form-toggle-link a { text-decoration: underline; }
#user-status { position: absolute; top: 20px; right: 20px; font-size: 0.9rem; }
#user-status span { text-shadow: 2px 2px #223; }
#user-status a, #user-status button { font-family: var(--pixel-font); color: white; text-decoration: none; background: none; border: none; cursor: pointer; text-shadow: 2px 2px #222; font-size: 0.9rem; }
.leaderboard-container { max-width: 800px; margin: 40px auto; background-color: rgba(0,0,0,0.3); border: 4px solid var(--light-blue); padding: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px; border: 2px solid var(--light-blue); text-align: left; }
th { background-color: var(--dark-purple); color: var(--highlight-yellow); }
tr:nth-child(even) { background-color: rgba(0,0,0,0.2); }

@media (max-width: 480px) {
    .leaderboard-container table {
        width: 100%;
    }
    .leaderboard-container th, .leaderboard-container td {
        padding: 8px 4px;
        font-size: 0.7rem;
    }
}

/* More specific rule for the date cell to ensure it applies */
.leaderboard-container td.date-cell {
    font-size: 0.45em;
}