* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; touch-action: none; font-family: 'Fredoka One', sans-serif; }
body { background-color: #000; overflow: hidden; width: 100vw; height: 100vh; }

#game-container { position: relative; width: 100%; height: 100%; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,0.7); font-size: 24px; pointer-events: none; }

#hud-top { position: absolute; top: 10px; left: 10px; display: flex; gap: 10px; pointer-events: none; }
.health-bar { display: flex; gap: 2px; }
.heart { width: 20px; height: 20px; background: #CC0000; clip-path: polygon(50% 100%, 0 50%, 0 20%, 25% 0, 50% 20%, 75% 0, 100% 20%, 100% 50%); }

#hotbar-container { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; background: rgba(0,0,0,0.5); padding: 5px; border-radius: 10px; pointer-events: auto; }
.hotbar-slot { width: 50px; height: 50px; background: #444; border: 3px solid #666; border-radius: 5px; display: flex; justify-content: center; align-items: center; position: relative; cursor: pointer; }
.hotbar-slot.active { border-color: #FFD700; background: #555; }
.hotbar-slot img { max-width: 80%; max-height: 80%; }
.slot-count { position: absolute; bottom: 2px; right: 4px; color: #fff; font-size: 14px; text-shadow: 1px 1px 0 #000; }

/* Mobile Controls */
#mobile-controls { position: absolute; bottom: 80px; left: 0; width: 100%; height: 150px; pointer-events: none; display: flex; justify-content: space-between; padding: 0 20px; }
#joystick-base { width: 120px; height: 120px; background: rgba(255,255,255,0.2); border-radius: 50%; position: relative; pointer-events: auto; margin-top: 30px; }
#joystick-knob { width: 50px; height: 50px; background: rgba(255,255,255,0.6); border-radius: 50%; position: absolute; top: 35px; left: 35px; }
#action-buttons { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: auto; }
.action-btn { background: rgba(255,255,255,0.3); border: 2px solid rgba(255,255,255,0.5); border-radius: 50%; width: 60px; height: 60px; color: #fff; font-size: 14px; font-weight: bold; cursor: pointer; }
.action-btn:active { background: rgba(255,255,255,0.6); transform: scale(0.9); }

.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); display: flex; flex-direction: column; justify-content: center; align-items: center; pointer-events: auto; z-index: 100; }
.hidden { display: none !important; }
.logo-box { font-size: 80px; margin-bottom: 20px; filter: drop-shadow(0 5px 0 #000); animation: float 2s infinite alternate; }
@keyframes float { 0% { transform: translateY(0); } 100% { transform: translateY(-10px); } }
h1 { font-size: 60px; color: #fff; text-shadow: 0 5px 0 #333; margin-bottom: 10px; text-align: center; }
p { color: #ccc; font-size: 24px; margin-bottom: 30px; }
.ui-button { background: linear-gradient(180deg, #5DA831 0%, #3D8811 100%); color: white; padding: 15px 50px; font-size: 32px; border-radius: 10px; border: 4px solid #7BC842; cursor: pointer; box-shadow: 0 8px 0 #2A5A0A; transition: all 0.1s; }
.ui-button:active { transform: translateY(8px); box-shadow: 0 0px 0 #2A5A0A; }

#inventory-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; background: rgba(0,0,0,0.8); padding: 20px; border-radius: 10px; margin-bottom: 20px; }
.inv-slot { width: 50px; height: 50px; background: #444; border: 2px solid #666; position: relative; }

@media (min-width: 769px) { .mobile-only { display: none !important; } }
/* CG-batch-overlay-fix */
#game-canvas, canvas#game-canvas { touch-action: none; }
#game-ui.screen,
#game-ui.screen.active { pointer-events: none !important; }
