html, body {
    height: 100%; /* Full height of the page */
    margin: 0; /* Remove default margin */
    display: flex;
    justify-content: center; /* Center content horizontally */
    align-items: center; /* Center content vertically */
    background-color: #f0f0f0; /* Background color */
}

* {
    font-family: 'Roboto', sans-serif;
}

#htmlContainer {
    display: flex;
    flex-direction: row; /* Side-by-side arrangement in landscape */
    align-items: center; /* Center items horizontally */
    justify-content: center; /* Center items vertically */
    height: 90vh;
    width: 90vw;
    margin: auto; /* Center the container on the page */
    text-align: center;
}

#leftPanel, #rightPanel {
    width: 50vw; /* Half of the container width */
    max-width: 600px; /* Maximum width */
    height: auto; /* Maintain aspect ratio */
    margin: 0;
    display: flex;
    flex-direction: column; /* Arrange contents vertically */
    justify-content: center; /* Center the contents */
    align-items: center; /* Center the contents */
}

#rightPanel {
    padding-left: 0vw;
    gap: 40px;
}

#gameCanvas {
    width: 100%; /* Half of the container width */
    height: auto; /* Maintain aspect ratio */
    margin: 0;
}

#newGameSelector {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border: none; /* Explicitly remove any border */
}

#optionsContainer {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

#gridSizeSelector, #aiDifficultySelector {
    padding: 12px 30px;
    border: 1px solid #04AA6D; /* Green border */
    border-radius: 5px;
    font-family: 'Roboto', sans-serif;
    font-size: large;
    background-color: white;
    color: black;
    cursor: pointer;
    margin: 0 10px; /* Spacing between selectors */
}

    #gridSizeSelector:hover, #aiDifficultySelector:hover {
        background-color: #f3f3f3; /* Slightly darker or lighter on hover */
    }
    
    #gridSizeSelector:focus, #aiDifficultySelector:focus {
        outline: none; /* Removes the default focus outline */
        box-shadow: 0 0 5px #04AA6D; /* Adds a subtle shadow with the button color */
    }

#playerTable {
    width: 90%; /* Full width of its container */
    border-collapse: collapse; /* Remove space between table cells */
    border: 1px solid rgb(184, 184, 184); /* Grey border */
    display: none; /* Initially invisible */
}

.headerRow, .playerNameStyle, .playerScoreStyle, .playerRoundsStyle {
    font-family: 'Roboto', Courier, monospace;
    font-weight: 300;
    vertical-align: middle;
}

.playerNameStyle, .playerScoreStyle, .playerRoundsStyle {
    font-size: larger;
    font-weight: 700;
    color: rgb(31, 31, 31);
}

.player1Colour {
    color: blue;
}

.player2Colour {
    color: red;
}

.headerRow {
    font-size: medium;
}

.highlight-player1 {
    background-color: rgb(220, 229, 255);
}

.highlight-player2 {
    background-color: rgb(255, 220, 220);
}

@keyframes flashBlue {
    0% { 
        color: white;
        background-color: blue;
    }
    100% { 
        color: rgb(31, 31, 31);
        background-color: transparent; 
    }
}

@keyframes flashRed {
    0% { 
        color: white;
        background-color: red;
    }
    100% { 
        color: rgb(31, 31, 31);
        background-color: transparent; 
    }
}

#playerTable td {
    padding: 8px; /* Padding inside each cell */
    border: 1px solid rgb(184, 184, 184); /* Grey border for each cell */
}

#playerTable td:first-child {
    text-align: left; /* Left-align text in the first column */
    width: 50%; /* First column width */
}

#playerTable td:nth-child(2), #playerTable td:nth-child(3) {
    text-align: center; /* Center-align text in the second and third columns */
    width: 25%; /* Width for second and third columns */
}

/* Styles for portrait orientation */
@media screen and (orientation: portrait) {
    #htmlContainer {
        width: 100vw;
        height: auto;
        flex-direction: column; /* Stack vertically */
    }
    #leftPanel {
        width: 100%; /* 95% of the viewport width */
        max-width: none; /* Remove the max-width restriction */
        height: auto; /* Maintain aspect ratio */
        margin-bottom: 3vh;
    }
    #rightPanel {
        width: 90%; /* 95% of the viewport width */
        max-width: none; /* Remove the max-width restriction */
        height: auto; /* Maintain aspect ratio */
        padding-right: 2vw;
        gap: 3vh;
    }
    #gridSizeSelector, #aiDifficultySelector {
        font-family: 'Roboto', sans-serif;
        font-size: 4vw;
        background-color: white;
        color: black;
        cursor: pointer;
        margin: 0 10px; /* Spacing between selectors */
    }
    #newGameSelector {
        gap: 1.5vh;
    }
    .playerNameStyle, .playerScoreStyle, .playerRoundsStyle {
        font-size: 4vw;
        font-weight: 700;
    }
    .headerRow {
        font-size: 3vw;
    }
}