body { margin: 0; overflow: hidden; background-color: #1a1a1a; color: white; font-family: 'Segoe UI', sans-serif; touch-action: none; }
        #canvas-container { width: 100vw; height: 100vh; display: block; }
        #ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
        
        .btn { position: absolute; pointer-events: auto; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.5); color: white; padding: 8px 16px; border-radius: 20px; font-weight: bold; user-select: none; backdrop-filter: blur(5px); font-size: 12px; }
        .btn:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.2); }
        
        
        #top-bar { position: absolute; top: 0; left: 0; width: 100%; height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; box-sizing: border-box; background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent); pointer-events: none; }
        .menu-group { display: flex; gap: 10px; pointer-events: auto; }
        
        #mode-btn { border-color: #00ccff; color: #00ccff; box-shadow: 0 0 10px rgba(0, 204, 255, 0.3); }
        #save-btn { border-color: #00ff00; color: #00ff00; }
        #load-btn { border-color: #ffff00; color: #ffff00; }
        #view-btn { border-color: #ff00ff; color: #ff00ff; }
        #view-back-btn { border-color: #ff00ff; color: #ff00ff; box-shadow: 0 0 10px rgba(255, 0, 255, 0.3); font-size: 16px; padding: 10px 24px; }
        
        #palette-container { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; width: 90%; }
        #color-palette { display: flex; gap: 5px; margin-bottom: 5px; pointer-events: auto; background: rgba(0,0,0,0.5); padding: 5px; border-radius: 20px; }
        .color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #555; cursor: pointer; transition: 0.2s; }
        .color-swatch.selected { border-color: white; transform: scale(1.2); box-shadow: 0 0 8px white; }
        #color-picker { width: 30px; height: 30px; border: none; padding: 0; background: none; cursor: pointer; border-radius: 50%; overflow: hidden; }
        #palette { display: flex; gap: 10px; background: rgba(30, 30, 30, 0.9); padding: 10px; border-radius: 30px; pointer-events: auto; border: 1px solid rgba(255,255,255,0.2); overflow-x: auto; max-width: 100%; }
        .palette-item { min-width: 45px; height: 45px; border-radius: 8px; border: 2px solid #555; cursor: pointer; transition: 0.2s; position: relative; display: flex; align-items: center; justify-content: center; font-size: 10px; color: rgba(255,255,255,0.7); background: #333; }
        .palette-item.selected { border-color: white; transform: scale(1.1); z-index: 10; color: white; box-shadow: 0 0 10px white; }
        
        #p-normal { background: #00ccff; }
        #p-armor { background: #888888; }
        #p-engine { background: #ff4400; }
        #p-turret { background: #ffd700; }
        #p-triple { background: #ffaa00; }
        #p-missile { background: #9933ff; }
        #p-cannon { background: #444; border: 1px solid #aaaaaa; color: #fff; }
        #p-wave { background: #004444; border: 1px solid #00ffff; color: #00ffff; font-weight: bold; box-shadow: 0 0 5px #00ffff; }
        #p-delete { background: #333; border-color: #ff0000; color: #ff0000; font-weight: bold; } 
        
        #build-msg { text-align: center; font-size: 12px; opacity: 0.8; text-shadow: 1px 1px 2px black; margin-bottom: 5px; }

        
        #battle-ui { display: none; width: 100%; height: 100%; }
        #stick-area { position: absolute; bottom: 40px; left: 40px; width: 120px; height: 120px; background: rgba(255,255,255,0.05); border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); pointer-events: auto; }
        #stick-knob { position: absolute; top: 35px; left: 35px; width: 50px; height: 50px; background: rgba(0, 255, 255, 0.8); border-radius: 50%; pointer-events: none; box-shadow: 0 0 10px cyan; }
        #boost-btn { position: absolute; bottom: 50px; right: 40px; width: 70px; height: 70px; border-radius: 50%; background: rgba(255, 69, 0, 0.2); border: 2px solid orangered; display: flex; align-items: center; justify-content: center; font-weight: bold; pointer-events: auto; color: orangered; box-shadow: 0 0 10px orangered; }
        #fire-btn { position: absolute; bottom: 140px; right: 50px; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 215, 0, 0.2); border: 2px solid gold; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 12px; pointer-events: auto; color: gold; box-shadow: 0 0 10px gold; }
        #normal-btn { position: absolute; bottom: 50px; right: 130px; width: 60px; height: 60px; border-radius: 50%; background: rgba(0, 204, 255, 0.2); border: 2px solid #00ccff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; pointer-events: auto; color: #00ccff; box-shadow: 0 0 10px #00ccff; }
        #triple-btn { position: absolute; bottom: 140px; right: 130px; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 170, 0, 0.2); border: 2px solid #ffaa00; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; pointer-events: auto; color: #ffaa00; box-shadow: 0 0 10px #ffaa00; }
        #missile-btn { position: absolute; bottom: 230px; right: 50px; width: 60px; height: 60px; border-radius: 50%; background: rgba(153, 51, 255, 0.2); border: 2px solid #9933ff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; pointer-events: auto; color: #9933ff; box-shadow: 0 0 10px #9933ff; }
        
        #wave-btn { position: absolute; bottom: 320px; right: 50px; width: 60px; height: 60px; border-radius: 50%; background: rgba(0, 255, 255, 0.2); border: 2px solid #00ffff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; pointer-events: auto; color: #00ffff; box-shadow: 0 0 15px #00ffff; }

        #cannon-btn { position: absolute; bottom: 230px; right: 130px; width: 60px; height: 60px; border-radius: 50%; background: rgba(50, 50, 50, 0.4); border: 2px solid #aaaaaa; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; font-size: 10px; pointer-events: auto; color: #aaaaaa; box-shadow: 0 0 10px #aaaaaa; }
        #cannon-gauge { display: flex; gap: 2px; margin-top: 4px; width: 40px; height: 6px; }
        #cannon-gauge div { flex: 1; background: #00ff00; height: 100%; border-radius: 2px; transition: width 0.1s, background 0.1s; }

        #crosshair { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); pointer-events: none; border: 1px solid rgba(255,255,255,0.5); border-radius: 50%; opacity: 0; }
        
        #status-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none; z-index: 100; }
        #status-bar .btn { position: relative; pointer-events: auto; min-width: 80px; text-align: center; white-space: nowrap; }

        
        #file-input { display: none; }
