Before updating the code, we need to modify the CSS to ensure the game canvas fits the full width of the available screen. This adjustment enhances the viewing experience, particularly on smaller screens.
To achieve this, add the following CSS rule:
canvas {
width: 100%;
}
This ensures the game dynamically adjusts to the size of its container, providing a seamless and responsive experience.