/* --- Basic Setup & Theme --- */
body {
    background-color: #212121;
    background-image: url('https://www.transparenttextures.com/patterns/concrete-wall.png');
    color: #E0E0E0;
    font-family: 'Staatliches', cursive;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    min-height: 100vh;
    text-align: center;
}

header h1 {
    font-size: 4rem;
    color: #D32F2F;
    letter-spacing: 5px;
    margin: 20px 0;
    text-shadow: 2px 2px 4px #000;
}

header h1 a {
    text-decoration: none;
    color: inherit;
}

.content-container {
    position: relative;
    width: 728px;
    margin: 0 auto;
}

main {
    width: 100%;
}

.leaderboard {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 30px;
    width: 280px;
    background-color: #313131;
    border: 5px solid #E0E0E0;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
}

/* --- Layout Containers --- */
.jumbotron {
    width: 100%;
    height: 90px;
    background-color: #111;
    border: 4px solid #424242;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #616161;
    box-sizing: border-box;
}

.ring {
    width: 100%;
    background-color: #313131;
    border: 5px solid #E0E0E0;
    padding: 20px;
    box-sizing: border-box; 
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
}

.leaderboard h2 {
    color: #D32F2F;
    font-size: 2rem;
    margin-top: 0;
    border-bottom: 2px solid #424242;
    padding-bottom: 10px;
}

/* --- LEADERBOARD COLUMN FIX --- */
.leaderboard-header, .leaderboard li {
    display: flex;
    padding: 5px;
    box-sizing: border-box;
    align-items: center;
}

.leaderboard-header {
    font-family: 'Staatliches', cursive;
    font-size: 1rem;
    color: #9E9E9E;
    border-bottom: 1px solid #424242;
}

.leaderboard ol {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: 'Oswald', sans-serif;
}

.leaderboard li {
    font-size: 1.8rem;
    border-bottom: 1px solid #424242;
}
.leaderboard li:last-child {
    border-bottom: none;
}
.leaderboard li.no-scores {
    font-size: 1rem;
    color: #9E9E9E;
    justify-content: center;
    padding-top: 20px;
}


/* Define column widths */
.leaderboard-header span:nth-child(1), .leaderboard li span:nth-child(1) { /* Rank */
    width: 20%;
    text-align: left;
}
.leaderboard-header span:nth-child(2), .leaderboard li span:nth-child(2) { /* Accuracy */
    width: 45%;
    text-align: center;
}
.leaderboard-header span:nth-child(3), .leaderboard li span:nth-child(3) { /* Score */
    width: 35%;
    text-align: right;
}
/* --- END FIX --- */

/* --- Stats Display (Corners) --- */
.stats-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
}

.stat-box {
    width: 30%;
}

.stat-box h2 {
    color: #D32F2F;
    font-size: 1.5rem;
    margin: 0;
}

.stat-box p {
    font-size: 3rem;
    margin: 0;
}

/* --- Main Game Area --- */
#game-area {
    min-height: 250px;
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
}

/* State-based visibility control */
#game-area.state-active #prompt-container,
#game-area.state-results #results-container {
    display: block;
}

#game-area.state-start .mode-selector,
#game-area.state-results .mode-selector, 
#game-area.state-start .options-container,
#game-area.state-results .options-container,
#game-area.state-start #start-button,
#game-area.state-results #start-button {
    display: flex;
}
#game-area.state-start #start-button,
#game-area.state-results #start-button {
    display: block;
}

#prompt-container,
#results-container,
.mode-selector,
.options-container,
#start-button {
    display: none;
}


#key-prompt {
    font-family: 'Oswald', sans-serif;
    font-size: 12rem;
    margin: 0;
    text-shadow: 4px 4px 8px #000;
}

#start-button {
    font-family: 'Staatliches', cursive;
    font-size: 2.5rem;
    background-color: #D32F2F;
    color: #E0E0E0;
    border: 3px solid #E0E0E0;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#start-button:hover {
    background-color: #B71C1C;
}

#results-container h2, #results-container p {
    margin: 10px;
}

#final-score {
    font-size: 3rem;
}

#accuracy {
    font-size: 2rem;
}

/* --- Styles for other pages and footer --- */
body:not(.home-page) main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.content-page {
    text-align: left;
    max-width: 800px;
    padding: 20px;
    font-family: sans-serif;
    line-height: 1.6;
}

.content-page a {
    color: #D32F2F;
}

footer {
    width: 100%;
    margin-top: 40px;
    padding-bottom: 20px;
}

footer a {
    color: #9E9E9E;
    text-decoration: none;
    margin: 0 10px;
    font-size: 1rem;
}

footer a:hover {
    text-decoration: underline;
}

.mode-selector {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    border-bottom: 2px solid #424242;
    padding-bottom: 20px;
}

.options-container {
    flex-direction: column; 
    align-items: flex-start;
    margin-top: 20px;
    margin-bottom: 25px; 
    font-size: 1.2rem;
    gap: 10px;
}

.option {
    display: flex;
    align-items: center;
}

.option input[type="checkbox"], .option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

#prompt-container.countdown-active #key-prompt {
    font-size: 8rem;
}

#prompt-container.countdown-active #key-prompt::before {
    content: 'GET READY';
    display: block;
    font-family: 'Staatliches', cursive;
    font-size: 2.5rem;
    color: #9E9E9E;
    margin-bottom: 10px;
}

#reset-button {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Staatliches', cursive;
    font-size: 1.5rem;
    background-color: #424242;
    color: #E0E0E0;
    border: 2px solid #9E9E9E;
    padding: 10px 30px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

#reset-button:hover {
    opacity: 1;
}

body.game-active #reset-button {
    display: block;
}

@media (max-width: 1080px) {
    .content-container {
        position: static;
        width: 100%;
        max-width: 728px;
    }
    .leaderboard {
        position: static;
        margin: 20px auto 0;
        width: 100%;
        max-width: 728px;
    }
}
