#game-canvas {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Position mobile controls in the bottom-right corner */
#mobile-controls {
    display: grid;
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    /* Use CSS grid to arrange the buttons in 2 rows:
       The first row centers the Up arrow,
       The second row places Left, Down, and Right buttons */
    grid-template-areas:
          ". up ."
          "left down right"
          "space space space";
    grid-gap: 5px;
    /* Styling for the container */
    background: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 5px;
}

/* General button styling */
#mobile-controls button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #333;
    color: #fff;
    font-size: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s, transform 0.1s;
}

/* Pressed effect: change background color and slight scale down */
#mobile-controls button:active {
    background-color: #555;
    transform: scale(0.95);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

#mobile-numeric-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 5px;
    z-index: 1000;
}

#mobile-numeric-controls button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #333;
    color: #fff;
    font-size: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s, transform 0.1s;
}

#mobile-numeric-controls button:active {
    background-color: #555;
    transform: scale(0.95);
}

/* Assign grid areas to buttons */
#btn-up {
    grid-area: up;
}

#btn-left {
    grid-area: left;
}

#btn-down {
    grid-area: down;
}

#btn-right {
    grid-area: right;
}

#mobile-controls button#btn-space {
    grid-area: space;
    width: unset;
}