body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: transparent; user-select: none; touch-action: none; font-family: 'Segoe UI', sans-serif; }
canvas { display: block; }
#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; display: none; flex-direction: column; justify-content: space-between; }

.overlay-screen { position: absolute; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; padding: 20px; text-align: center; }
.glass-panel { position: absolute; top: 0; left: 0; bottom: 0; width: 100%; max-width: 400px; background: rgba(0,0,0,0.6); backdrop-filter: blur(12px); border-right: 1px solid rgba(255,255,255,0.1); z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
@media (max-width: 600px) { .glass-panel { max-width: 100%; } }
.cannon-card { pointer-events: auto; width: 260px; background: rgba(0,0,0,0.9); border: 2px solid rgba(255,255,255,0.15); border-radius: 20px; padding: 15px; margin: 5px; cursor: pointer; transition: all 0.2s; }
.cannon-card.selected { border-color: #10b981; background: rgba(16, 185, 129, 0.3); }

.btn-mode { pointer-events: auto; width: 260px; padding: 15px; border-radius: 15px; font-weight: 900; text-transform: uppercase; margin-top: 10px; transition: all 0.2s; }
.btn-green { background: #10b981; color: black; }
.btn-blue { background: #3b82f6; color: white; }
.btn-disabled { opacity: 0.3; pointer-events: none; }

.hud-panel { background: rgba(0,0,0,0.95); border: 1px solid rgba(255,255,255,0.2); border-radius: 16px; color: white; padding: 10px 15px; backdrop-filter: blur(10px); pointer-events: auto; }
.hp-bar { width: 120px; height: 12px; background: #111; border-radius: 6px; margin-top: 5px; overflow: hidden; position: relative; }
.hp-fill { height: 100%; transition: width 0.3s; }
.hp-me { background: #00ff88; }
.hp-opp { background: #ff4444; }
.hp-val { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 9px; font-weight: 900; pointer-events: none; text-shadow: 1px 1px 2px black; width: 100%; text-align: center; }

#crosshair { position: absolute; width: 40px; height: 40px; pointer-events: none; display: flex; justify-content: center; align-items: center; transform: translate(-50%, -50%); }
.cross-bit { position: absolute; background-color: #ff3333; }
.h-line { width: 100%; height: 3px; }
.v-line { width: 3px; height: 100%; }
#crosshair.locked .cross-bit { background-color: #00ff66; box-shadow: 0 0 15px #00ff66; }

#controls-left { position: absolute; bottom: 85px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 15px; pointer-events: none; z-index: 10;}
.action-row { display: flex; gap: 12px; pointer-events: auto; }
.btn-action { width: 95px; height: 85px; border-radius: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; color: white; border: 3px solid transparent; position: relative; cursor: pointer; transition: transform 0.1s; }
.btn-action:active { transform: scale(0.95); }
.btn-water { background: #0ea5e9; border-color: #7dd3fc; box-shadow: inset 0 0 15px 5px rgba(255,255,255,0.2), 0 5px 15px rgba(0,0,0,0.5); }
.btn-carbide { background: #475569; border-color: #94a3b8; box-shadow: inset 0 0 15px 5px rgba(255,255,255,0.1), 0 5px 15px rgba(0,0,0,0.5); }
.btn-status-label { position: absolute; top: -14px; text-align: center; font-size: 12px; color: #fde047; font-weight: 900; background: rgba(0,0,0,0.4); padding: 2px 10px; border-radius: 12px; text-shadow: 1px 1px 2px black, -1px -1px 2px black, 1px -1px 2px black, -1px 1px 2px black; border: 1px solid rgba(255,255,255,0.1); z-index: 5; }

#fire-btn { position: absolute; bottom: 30px; right: 20px; width: 100px; height: 100px; background: radial-gradient(circle at 35% 35%, #ff4444, #7f1d1d); border: 5px solid white; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-weight: 900; font-size: 20px; pointer-events: auto; box-shadow: 0 0 30px rgba(255,0,0,0.5); z-index: 10;}
.locked { opacity: 0.4; filter: grayscale(0.8); cursor: not-allowed; }

#room-id-display { font-family: monospace; color: #facc15; font-size: 36px; letter-spacing: 8px; background: rgba(0,0,0,0.8); padding: 10px 20px; border-radius: 12px; border: 3px solid #facc15; margin: 10px 0; font-weight: bold; }
.manual-join-box { pointer-events: auto; margin-top: 20px; width: 100%; max-width: 300px; }
#room-input { width: 120px; padding: 12px; border-radius: 12px; border: 2px solid #3b82f6; background: #000; color: #fff; text-align: center; font-family: monospace; text-transform: uppercase; font-size: 20px; }

#server-status { font-size: 10px; font-weight: bold; position: absolute; top: 10px; right: 10px; padding: 5px 10px; border-radius: 20px; background: rgba(0,0,0,0.5); }
.status-red { color: #ff4444; }
.status-green { color: #00ff88; }

#msg-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #000; border: 4px solid #ff4444; color: white; padding: 30px; border-radius: 20px; text-align: center; z-index: 2000; width: 85%; max-width: 350px; pointer-events: auto; }
.ui-text { text-shadow: 2px 2px 4px black; }

@keyframes nuclearGlitch {
    0% { transform: translate(0); filter: hue-rotate(0deg) contrast(100%); }
    10% { transform: translate(-10px, 10px); filter: hue-rotate(90deg) contrast(200%) brightness(200%) invert(0.2); }
    30% { transform: translate(10px, -10px); filter: invert(0.8) sepia(100%) saturate(1000%) hue-rotate(-50deg); background-color: rgba(255,0,0,0.3); }
    50% { transform: translate(-15px, -5px); filter: hue-rotate(180deg) brightness(300%) contrast(150%); }
    70% { transform: translate(10px, 15px); filter: invert(0) drop-shadow(0 0 50px red) contrast(200%); }
    100% { transform: translate(0); filter: none; }
}
.nuclear-glitch { animation: nuclearGlitch 0.6s cubic-bezier(.25,.8,.25,1) forwards; }

#cannon-selector { position: absolute; bottom: 185px; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; pointer-events: auto; z-index: 5; }
.btn-select-cannon { width: 50px; height: 50px; border-radius: 12px; background: rgba(0,0,0,0.8); border: 2px solid rgba(255,255,255,0.3); color: white; font-weight: 900; transition: all 0.2s; font-size: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.btn-select-cannon.active { border-color: #facc15; background: rgba(250, 204, 21, 0.4); box-shadow: 0 0 20px #facc15; transform: scale(1.1); color: #facc15; }

@media (max-width: 600px) {
    #controls-left { bottom: 65px; gap: 8px; }
    .btn-action { width: 80px; height: 75px; border-radius: 20px; font-size: 11px; }
    #cannon-selector { bottom: 160px; gap: 8px; }
    .btn-select-cannon { width: 42px; height: 42px; font-size: 14px; }
    #fire-btn { width: 75px; height: 75px; font-size: 15px; bottom: 15px; right: 8px; border-width: 3px; }
    .btn-status-label { font-size: 9px; top: -10px; padding: 2px 6px; }
    #gas-ui { bottom: 15px; }
    .hud-panel { padding: 5px 10px; }
    .hp-bar { width: 90px; }
    #emote-controls { bottom: auto; top: 100px; left: 10px; gap: 8px; }
    #emote-controls button { width: 40px; height: 40px; font-size: 20px; }
    #player-badge { top: 10px; left: 10px; padding: 4px 8px; scale: 0.8; transform-origin: top left; }
    #buff-hud { top: 80px; scale: 0.8; }
}
