body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #121212;
    color: white;
    font-family: 'Helvetica Neue', sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 800px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#game-canvas {
    width: 100%;
    height: 100%;
    background-color: #000;
}

#ui-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none; /* Allow clicks to pass through to the canvas */
}

#stats {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    font-size: 1.2em;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0));
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: all; /* Re-enable pointer events for these screens */
}

h1 {
    font-size: 3em;
    margin-bottom: 20px;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

p {
    font-size: 1.5em;
    margin-bottom: 30px;
}

button {
    padding: 15px 30px;
    font-size: 1.5em;
    cursor: pointer;
    border: 2px solid white;
    background-color: transparent;
    color: white;
    border-radius: 10px;
    transition: background-color 0.3s, color 0.3s;
}

button:hover {
    background-color: white;
    color: black;
}

.hidden {
    display: none !important;
}

#mobile-controls {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px 0;
    display: none; /* Hidden by default */
    justify-content: space-around;
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
}

#mobile-controls button {
    font-size: 2.5em;
    padding: 10px 30px;
    pointer-events: all;
    user-select: none; /* Prevent text selection on hold */
    -webkit-user-select: none;
}

/* Show mobile controls only on touch devices or small screens */
@media (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    #mobile-controls {
        display: flex;
    }
}
