:root {
    --light-tile: #eeeed2;
    --dark-tile: #769656;
}

body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #1a1a1a;
    color: white;
    overflow: hidden; /* Stops the page from scrolling */
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.board-wrapper {
    /* Use 80% of the screen's smallest side, but never more than 500px */
    width: min(80vh, 80vw);
    height: min(80vh, 80vw);
    max-width: 500px; 
    max-height: 500px;
    margin: 20px 0;
}

#chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    border: 5px solid #333;
}

.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Font size also scales with the board */
    font-size: min(6vh, 6vw); 
    cursor: pointer;
}

/* Fix font size for when the board hits its 500px limit */
@media (min-height: 625px) and (min-width: 625px) {
    .tile {
        font-size: 40px;
    }
}

.light { background-color: var(--light-tile); }
.dark { background-color: var(--dark-tile); }

.white-piece { color: #fff; -webkit-text-fill-color: #fff; }
.black-piece { color: #000; -webkit-text-fill-color: #000; }

.valid-move::after {
    content: "";
    width: 25%;
    height: 25%;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
}

#reset-btn {
    padding: 10px 20px;
    cursor: pointer;
    background: #eee;
    border: none;
    border-radius: 4px;
}