#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center vertically */
    height: 90dvh; 
    max-height: 90dvh;
    padding-top: 64px; /* Matches standard Tailwind h-16 nav height */

    width: 100%;
    max-width: 600px; /* Increased max-width */
    padding: 10px;
    
    position: relative; /* Needed for overlay */
    margin: 0 auto; /* Explicitly center the container */
    box-sizing: border-box; /* Include padding in height calculation */

}

/* Wordle Grid */
#grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px; /* Increased gap */
    width: 382px; /* Increased width (5 * 70 + 4 * 8) */
    margin-bottom: 5px; /* Reduced from 20px */
}
.tile {
    width: 70px; /* Increased size */
    height: 65px; /* Increased size */
    border: 2px solid #30363d; /* Dark border */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem; /* Increased font size */
    font-weight: bold;
    text-transform: uppercase;
    color: #fff;
    transition: all 0.3s ease;
}

/* Tile states */
.tile.correct { background-color: #16a34a; border-color: #16a34a; } /* Green */
.tile.present { background-color: #ca8a04; border-color: #ca8a04; } /* Yellow */
.tile.absent { background-color: #374151; border-color: #374151; } /* Dark Gray */
.tile.typing { border-color: #c9d1d9; } /* Lighter border while typing */

/* On-screen Keyboard */
#keyboard-container {
    margin-top: 5px; /* Reduced from 10px */
    width: 100%; /* Make keyboard take full width */
    max-width: 600px; /* Increased max-width */
}
.key-row {
    display: flex;
    justify-content: center;
    margin: 5px 0; /* Increased margin */
    width: 100%;
}
.key {
    font-family: 'Press Start 2P', cursive; /* Ensure pixel font */
    background-color: #4b5563; /* Gray key */
    color: #fff;
    border: none;
    height: 60px; /* Increased height */
    margin: 4px; /* Increased margin */
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem; /* Increased font size */
    flex-grow: 1; /* Allow keys to grow */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-basis: 0; /* Equal basis for flex grow */
    transition: background-color 0.2s ease;
}
.key-lg {
    flex-grow: 1.5; /* Make Enter/Del slightly wider */
}
.key:hover:not(:disabled) { background-color: #6b7280; }
.key.correct { background-color: #16a34a; } /* Green */
.key.present { background-color: #ca8a04; } /* Yellow */
.key.absent { background-color: #374151; color: #9ca3af; } /* Dark Gray, Dim text */
.key:disabled { opacity: 0.6; cursor: default; } /* Style for disabled keys */

/* RPS Game */
#rps-container {
    background-color: #000;
    border: 4px solid #30363d;
    padding: 5px;
    width: 382px; /* Match grid width */
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px; /* Add space below grid */
}
#rps-container.hidden {
    display: none !important;
}
#rps-display {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 15px;
    font-size: 3.5rem; /* Larger icons */
    color: #c9d1d9;
}
.rps-choice {
    width: 110px; /* Increased size */
    height: 110px; /* Increased size */
    border: 2px dashed #30363d;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}
/* RPS Result Colors */
.rps-choice.win {
    border-color: #16a34a; /* Green */
    color: #16a34a;
}
.rps-choice.lose {
    border-color: #ef4444; /* Red */
    color: #ef4444;
}
.rps-choice.draw {
    border-color: #ca8a04; /* Yellow */
}
/* Checkmark icon for locked choice */
.fa-check {
    color: #16a34a; /* Green check */
}

#rps-buttons {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 10px;
}
.rps-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.25rem; /* Increased size */
    width: 90px; /* Increased size */
    height: 70px; /* Increased size */
    padding: 5px; /* Adjust padding */
    /* Inherits .btn styles from global CSS */
}

#rps-keys {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

/* --- Mobile Optimization --- */
@media (max-width: 420px) {
    body {
        padding: 0.5rem; /* 8px, save more space */
    }

    /* Scale down game elements */
    #grid-container {
        width: 295px; /* 5*55px + 4*5px */
        gap: 5px;
        margin-bottom: 0px;
    }
    .tile {
        width: 55px;
        height: 50px;
        font-size: 2.25rem;
    }
    #rps-container {
        width: 295px; /* Match grid */
        margin-top: 4px;
        padding: 8px;
    }
    #rps-display {
        font-size: 2.5rem;
        margin-bottom: 5px;
    }
    .rps-choice {
        width: 80px;
        height: 80px;
    }
    .rps-btn {
        font-size: 1.75rem;
        width: 75px;
        height: 55px;
    }

    #keyboard-container {
        max-width: 100%; /* Use full width */
        margin-top: 5px; /* Reduced from 10px */
    }
    .key {
        height: 48px;
        font-size: 0.8rem;
        margin: 2px;
        border-radius: 3px;
    }
    .key-lg {
        font-size: 0.7rem;
    }
    
    /* Reduce title size */
    #game-container h1.pixel-text {
        font-size: 1.75rem; /* text-4xl is 2.25rem, this is smaller */
        margin-bottom: 0.25rem; /* mb-2 is 0.5rem */
    }
    #game-container #message-bar {
        font-size: 0.8rem; /* text-base is 1rem */
    }
    #game-container #guess-timer {
        font-size: 1.5rem; /* text-3xl is 1.875rem */
    }

    /* Adjust game-container padding */
    #game-container {
        padding-top: 10px; /* a bit less for mobile */
        padding-bottom: 10px; /* Less padding, but still present */
        justify-content: flex-start; /* Switch back to top alignment on mobile to fit everything */
    }

    /* Adjust floating buttons for mobile */
    .game-control-btn {
        height: 35px;
        padding: 0 10px;
        font-size: 0.6rem;
    }
}

/* Even smaller screens */
@media (max-width: 360px) {
    body {
        padding: 0.25rem; /* 4px */
    }
    #grid-container {
        width: 270px; /* 5*50 + 4*5 */
        gap: 5px;
    }
    .tile {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    #rps-container {
        width: 270px;
        margin-top: 8px;
    }
    .rps-choice {
        width: 50px;
        height: 50px;
    }
    .rps-btn {
        font-size: 1.5rem;
        width: 70px;
        height: 50px;
    }
    .key {
        height: 45px;
        font-size: 0.75rem;
    }
    #game-container h1.pixel-text {
        font-size: 1.5rem; 
    }
}