#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Fill parent */
    width: 100%; /* Fill parent */
    /* MODIFIED: Make container flexible */
    flex: 1;
    min-height: 0;
    overflow: hidden; /* Prevent container from causing scrollbars */
    background-color: #0d1117;
}

.game-board {
    border: 8px solid #21262d; /* Dark border */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background-color: #000;
}

#game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 17, 23, 0.8); /* Overlay matching new dark theme */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    border-radius: 0.5rem; /* Match canvas rounding */
}

#canvas-wrapper {
    position: relative;
    width: 100%;
    flex: 1 1 0%;
    min-height: 0px;
    /* NEW */
    background-color: #0d1117; /* MODIFIED: Darker letterbox */
    display: flex;
    justify-content: center;
    align-items: center;
}
canvas#gameCanvas {
    display: block;
    max-width: 95%;
    max-height: 95%;
    height: auto;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
}

#score-area {
    width: 100%;
    background: #161b22;
    border-bottom: 2px solid #30363d;
}

canvas {
    /* Rules to scale the 600x600 logical canvas to fit the container */
    display: block;
    /* NEW sizing logic */
    width: auto;
    height: 100%;
    max-width: 100%;
    /* object-fit: contain; */ /* Not using object-fit */
    aspect-ratio: 1 / 1; /* Explicitly keep it square */
    /* max-height: 100%; */ /* Already handled by height: 100% */
}

#touch-controls {
    display: none; /* Hidden by default, JS will show it */
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 400px; /* MODIFIED: Increased height from 150px */
    background-color: #aaa; /* Add a bg */
    border-top: 4px solid #555; /* Add a border */
}

/* MODIFIED: Style for the joystick canvas (now a wide touchpad) */
#joystickCanvas {
    height: 100%; /* 200px tall */
    width: 100%; /* MODIFIED: Take full width */
    background-color: #555; /* Darker bg */
}


/* Styles for touch-screen devices */
@media (hover: none) and (pointer: coarse) {
    /* MODIFIED: Removed all rules, JS now handles visibility */
}