body {
    margin: 0;
    overflow: hidden; /* Hide scrollbars */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

canvas {
    display: block;
}

#ui-container {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-family: sans-serif;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10; /* Ensure UI is above touch controls */
}

#inventory {
    margin-top: 5px;
}

/* Retro Text Overlays */
#game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P', monospace;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 100;
    width: 100%;
}

#game-message.game-over {
    opacity: 1;
    color: #ff0000;
    font-size: 3em;
    text-shadow: 4px 4px #000000;
    animation: game-over-pulse 0.8s infinite;
}

#game-message.victory {
    opacity: 1;
    color: #00ff00;
    font-size: 4em;
    text-shadow: 4px 4px #000000;
    line-height: 1.2;
}

@keyframes game-over-pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* --- NEW: Touch Controls --- */
.hidden {
    display: none !important; /* Use !important to ensure override */
}

#touch-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Below UI, above canvas */
    pointer-events: none; /* Container doesn't block, only children */
}

.touch-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-color: rgba(128, 128, 128, 0.1); */ /* REMOVED - Potentially obscuring elements */
    pointer-events: auto; /* Areas are interactive */
    -webkit-tap-highlight-color: transparent; /* Remove blue flash on tap */
}

.touch-area:active {
    /* background-color: rgba(128, 128, 128, 0.3); */ /* REMOVED - Potentially obscuring elements */
    /* Add alternative feedback if needed, e.g., slight border change */
}

#touch-up {
    clip-path: polygon(0 0, 100% 0, 50% 50%);
}

#touch-right {
    clip-path: polygon(100% 0, 100% 100%, 50% 50%);
}

#touch-down {
    clip-path: polygon(0 100%, 100% 100%, 50% 50%);
}

#touch-left {
    clip-path: polygon(0 0, 0 100%, 50% 50%);
}

#touch-spear {
    position: absolute;
    bottom: 20px; /* Position from bottom */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Fine-tune centering */
    width: 80px; /* Button size */
    height: 80px;
    background-color: rgba(200, 0, 0, 0.5); /* Reddish, semi-transparent */
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%; /* Make it circular */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px; /* Smaller font for button */
    text-align: center;
    pointer-events: auto; /* Button is interactive */
    z-index: 6; /* Above touch areas */
    -webkit-tap-highlight-color: transparent; /* Remove blue flash on tap */
}

#touch-spear::before {
    content: "THROW"; /* Text inside the button */
}

#touch-spear:active {
    background-color: rgba(200, 0, 0, 0.8); /* Darker red when pressed */
}
/* --- End Touch Controls --- */