:root {
    --bg-color: #f0f0f0;
    --grid-color: #00000015;
    --ui-text: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none; /* Prevent scrolling on mobile */
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas/joysticks */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#score-container {
    margin-top: 20px;
    font-size: 24px;
    font-weight: bold;
    color: var(--ui-text);
    text-shadow: 1px 1px 2px white;
}

#health-bar-container {
    width: 200px;
    height: 20px;
    background-color: #ddd;
    border-radius: 10px;
    margin-top: 10px;
    border: 2px solid #555;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background-color: #86C232;
    transition: width 0.1s ease-out, background-color 0.2s;
}

/* Mobile Controls Zones */
.joystick-zone {
    position: absolute;
    bottom: 0;
    height: 60%;
    width: 50%;
    pointer-events: auto; /* Enable touch in these zones */
}

#joystick-left {
    left: 0;
}

#joystick-right {
    right: 0;
}

/* Hide joysticks on non-touch devices (fallback logic in JS will handle actual detection) */
@media (hover: hover) and (pointer: fine) {
    .joystick-zone {
        display: none;
    }
}