@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Orbitron:wght@700&display=swap');

body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; 
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
    font-family: 'Bebas Neue', 'Segoe UI', sans-serif; color: white;
}
canvas {
    display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
#gameCanvas3d { z-index: 1; }
#gameCanvas {
    z-index: 2;
    pointer-events: none;
    image-rendering: pixelated;
}

#ui-layer { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 10; pointer-events: none; 
}
#ui-layer > div { pointer-events: auto; }

.hidden { display: none !important; }

#start-screen, #qr-screen {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px);
}

h1 { 
    font-family: 'Orbitron', sans-serif;
    font-size: 6rem; text-transform: uppercase; letter-spacing: 10px; 
    color: #ffcc00; text-shadow: 0 0 20px #ff3300, 0 0 40px #aa0000; 
    margin-bottom: 2rem; text-align: center;
}

button {
    font-size: 3rem; padding: 1rem 4rem; margin: 1rem; 
    border: 3px solid rgba(255,255,255,0.2); border-radius: 8px;
    background: linear-gradient(180deg, #333, #111); 
    color: #fff; text-transform: uppercase; cursor: pointer; 
    transition: all 0.3s ease; font-family: 'Bebas Neue', sans-serif; letter-spacing: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
button:hover, button:focus {
    background: linear-gradient(180deg, #ff4d00, #aa0000); 
    border-color: #ffcc00; outline: none; box-shadow: 0 0 30px #ff3300;
    transform: scale(1.05);
}

p[style] { font-size: 2.5rem !important; } /* override inline */

.qr-container { display: flex; gap: 4rem; justify-content: center; align-items: center; }
.player-qr { 
    text-align: center; background: rgba(30,30,40,0.9); padding: 2rem; 
    border-radius: 15px; border: 2px solid #555; box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    transition: transform 0.3s;
}
.player-qr.joined { border-color: #00ff00; transform: scale(1.05); box-shadow: 0 0 40px rgba(0,255,0,0.3); }
.player-qr h3 { font-size: 2.5rem; margin-top: 0; margin-bottom: 1.5rem; letter-spacing: 2px; }
.player-qr img { width: 250px; height: 250px; border: 5px solid white; border-radius: 8px;}
.player-qr div { margin-top: 1.5rem; font-size: 2rem; min-height: 2rem; color: #aaa; }
.player-qr div.joined { color: #00ff00; text-shadow: 0 0 10px #00ff00; }

#player1-qr h3 { color: #ffd700; text-shadow: 0 0 15px #ffaa00; }
#player2-qr h3 { color: #00bfff; text-shadow: 0 0 15px #0055ff; }

#btn-start-game { margin-top: 3rem; font-size: 4rem; background: linear-gradient(180deg, #00dd00, #007700); border-color: #00ff00; text-shadow: 0 2px 5px black; }

#game-ui {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 2rem 5rem 1.5rem; width: calc(100% - 10rem);
    position: relative; box-sizing: border-box;
}
.health-bar-container {
    width: 42%; height: 52px; background: rgba(0, 0, 0, 0.78);
    border: 3px solid rgba(255, 255, 255, 0.28); border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative; overflow: hidden;
}
.health-bar-container::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 50%;
    background: rgba(255,255,255,0.1); pointer-events: none;
}
.health-bar { height: 100%; transition: width 0.15s ease-out; }
.p1-health { background: linear-gradient(to bottom, #ffea00, #ff8c00); }
.p2-health { background: linear-gradient(to bottom, #00e5ff, #0055ff); }
.p1-health.danger, .p2-health.danger { background: linear-gradient(to bottom, #ff3300, #990000); }

.timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 5.25rem; font-weight: bold; color: #fff;
    text-shadow: 0 0 28px #ffcc00, 0 0 8px #ff6600, 3px 3px 8px #000;
    line-height: 52px; margin: 0 1.5rem;
    min-width: 5.5rem; text-align: center;
    padding: 0 0.75rem;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 12px;
    border: 2px solid rgba(255, 204, 0, 0.35);
}

.weapon-hud {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(92vw, 52rem);
    padding: 0.55rem 1.4rem;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.95rem, 2.2vw, 1.4rem);
    font-weight: 700;
    color: #f5e6ff;
    text-align: center;
    text-shadow: 0 0 14px rgba(168, 85, 247, 0.9), 0 2px 10px #000;
    background: rgba(8, 6, 18, 0.88);
    border: 2px solid rgba(200, 160, 255, 0.45);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65);
    z-index: 25;
    pointer-events: none;
    line-height: 1.35;
}

#winner-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 5rem; color: #fff; text-shadow: 0 0 20px #ff3300, 0 0 50px #ff0000, 5px 5px 0px #000;
    white-space: nowrap; text-align: center; margin: 0; z-index: 100; pointer-events: none;
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoomIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
