body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #222;
    overflow: hidden;
    font-family: 'Press Start 2P', cursive; /* A classic arcade font would be nice, but fallback to sans-serif */
}

canvas {
    background-color: #000;
    border: 2px solid #fff;
    display: block;
}

#mobile-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    display: none; /* Hidden by default, shown only on small screens via media query */
}

.control-button {
    background-color: rgba(255, 255, 255, 0.2); /* Semi-transparent white */
    color: #fff;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    user-select: none; /* Prevent text selection on tap */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.control-button:active, .control-button.active-button {
    background-color: rgba(255, 255, 255, 0.4);
}

/* New styles for settings button and modal */
#settings-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 101; /* Ensure it's above other elements if needed */
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Press Start 2P', cursive;
}

#settings-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 200; /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
    display: flex; /* Use flexbox for centering content */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.modal-content {
    background-color: #000; /* Changed to match the canvas background for a darker, game-like theme */
    padding: 30px;
    border: 2px solid #fff;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5); /* Green glow */
}

.modal-content h3 {
    margin-top: 0;
    font-size: 1.8em;
    color: #0f0;
    font-family: 'Press Start 2P', cursive;
}

.modal-content label {
    font-size: 1.1em;
    margin-bottom: 10px;
    font-family: 'Press Start 2P', cursive;
}

.modal-content input[type="range"] {
    width: 80%;
    margin-bottom: 10px;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border-radius: 5px;
    background: #333; /* Darker track to better fit the theme */
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
}

.modal-content input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #0f0;
    cursor: pointer;
}

.modal-content input[type="range"]::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #0f0;
    cursor: pointer;
}

#sensitivity-value {
    font-size: 1.2em;
    color: #0f0;
    margin-bottom: 10px;
    font-family: 'Press Start 2P', cursive;
}

#close-settings {
    background-color: rgba(255, 0, 0, 0.4);
    color: #fff;
    border: 2px solid #f00;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    align-self: center;
    font-family: 'Press Start 2P', cursive;
}

#close-settings:hover {
    background-color: rgba(255, 0, 0, 0.6);
}

@media (max-width: 820px) { /* Adjust breakpoint as needed, canvas is 800px wide */
    #mobile-controls {
        display: flex; /* Show mobile controls */
    }

    body {
        flex-direction: column; /* Stack canvas and controls vertically on small screens */
        justify-content: flex-start; /* Align content to top */
        padding-top: 20px; /* Add some padding from top */
    }

    canvas {
        width: 100%; /* Make canvas responsive */
        max-width: 800px; /* Keep max width */
        height: auto; /* Adjust height proportionally */
        max-height: 600px; /* Keep max height */
    }

    #settings-button {
        top: 10px; /* Adjust position for mobile */
        right: 10px;
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .modal-content {
        width: 90%;
        padding: 20px;
    }
}

@font-face {
    font-family: 'Press Start 2P';
    src: url('https://fonts.gstatic.com/s/pressstart2p/v14/8Lg6g_N8M8t-CNlJ_7G_vTjRjP_0qQ.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}