body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    background-color: #1e1e1e; /* Dark background */
    color: #f4f4f4; /* Light text color */
    margin: 0;
    padding: 0 10px; /* Add some padding for mobile */
}

.container {
    text-align: center;
    max-width: 100%;
    overflow: hidden; /* Prevent overflow on mobile */
}

canvas {
    border: 1px solid #f4f4f4; /* Light border for canvas */
    margin-bottom: 20px;
    background-color: white; /* Keep the grid background white for contrast */
    width: 100%; /* Make canvas responsive */
    max-width: 500px; /* Ensure canvas doesn't get too large on desktop */
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px; /* Ensure controls don't overlap footer */
}

.control-group {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

button, select, input {
    margin: 5px;
    background-color: #2e2e2e; /* Darker background for controls */
    color: #f4f4f4; /* Light text color */
    border: 1px solid #f4f4f4; /* Light border */
    flex: 1 1 auto; /* Allow items to grow and shrink */
    min-width: 120px; /* Set a minimum width for buttons and inputs */
}

button.selected {
    background-color: #4e4e4e; /* Slightly lighter background for selected buttons */
}

footer {
    text-align: center;
    color: #f4f4f4; /* Light text color */
    margin-top: auto; /* Push footer to bottom */
    margin-bottom: 10px; /* Add margin for space */
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (min-width: 600px) {
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-group {
        margin: 10px;
    }
}
