* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1220; font-family: 'Outfit', system-ui, sans-serif; }
#app { position: relative; width: 100%; height: 100%; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

#hud {
    position: absolute; inset: 0; pointer-events: none; z-index: 5;
    display: flex; justify-content: space-between; padding: 12px 14px;
}
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 8px; }
#turn-banner {
    font-family: 'Press Start 2P', monospace; font-size: 11px;
    background: #22c55e; color: #052e16; padding: 8px 12px; border-radius: 8px;
    box-shadow: 0 4px 0 #14532d; width: fit-content;
}
#turn-banner.team2 { background: #3b82f6; color: #0c1e3d; box-shadow: 0 4px 0 #1e3a8a; }
#worm-name { color: #fff; font-weight: 800; font-size: 16px; text-shadow: 1px 1px 0 #000; }
#wind-box {
    background: rgba(0,0,0,0.5); color: #e2e8f0; font-weight: 700; font-size: 13px;
    padding: 6px 10px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.15); width: fit-content;
}
#wind-arrow { color: #fbbf24; }
.meter-box {
    background: rgba(0,0,0,0.5); border-radius: 10px; padding: 6px 10px;
    border: 2px solid rgba(255,255,255,0.12); min-width: 150px;
}
.meter-label {
    font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: #94a3b8; margin-bottom: 3px;
}
.meter-track {
    height: 10px; border-radius: 999px; background: #1e293b; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}
.meter-track.time { margin-top: 2px; }
#move-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #22c55e, #a3e635);
    transition: width 0.08s linear;
}
#time-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #ef4444, #fbbf24 40%, #22c55e);
    transition: width 0.1s linear;
}
.meter-text { font-size: 11px; font-weight: 700; color: #e2e8f0; margin-top: 3px; }
.hud-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; }
#weapon-bar {
    display: flex; gap: 5px; flex-wrap: wrap; justify-content: center;
    pointer-events: auto; max-width: min(720px, 96vw);
}
.wpn {
    font-size: 11px; font-weight: 800; padding: 7px 8px; border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.55); color: #fff;
    cursor: pointer; pointer-events: auto;
}
.wpn.active { border-color: #fbbf24; background: rgba(251,191,36,0.25); box-shadow: 0 0 12px rgba(251,191,36,0.4); }
.wpn .key { opacity: 0.5; font-size: 10px; margin-left: 4px; }
#power-track {
    width: min(280px, 70vw); height: 16px; border-radius: 999px;
    background: rgba(0,0,0,0.55); border: 2px solid rgba(255,255,255,0.25); overflow: hidden;
}
#power-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #22c55e, #fbbf24, #ef4444);
}
#msg {
    min-height: 22px; color: #fef08a; font-weight: 800; font-size: 14px;
    text-shadow: 0 0 8px #000, 1px 1px 0 #000; text-align: center;
}
#teams { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.team-card {
    background: rgba(0,0,0,0.5); border-radius: 10px; padding: 8px 10px;
    border: 2px solid rgba(255,255,255,0.12); min-width: 140px;
}
.team-card h4 { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.team-card.t1 h4 { color: #4ade80; }
.team-card.t2 h4 { color: #60a5fa; }
.hp-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #fff; font-weight: 700; margin: 2px 0; }
.hp-mini { flex: 1; height: 8px; background: #1e293b; border-radius: 4px; overflow: hidden; }
.hp-mini > i { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #22c55e); }

#touch-pad {
    position: absolute; z-index: 6; left: 0; right: 0; bottom: 10px;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
}
#touch-pad:not(.hidden) { display: flex; }
.pad-row { display: flex; gap: 8px; pointer-events: auto; }
.pad-row button {
    min-width: 72px; min-height: 52px; padding: 8px 12px; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3); background: rgba(0,0,0,0.55);
    color: #fff; font-weight: 800; font-size: 14px; cursor: pointer;
}
#btn-fire { background: rgba(239,68,68,0.55); min-width: 100px; }

.screen {
    position: absolute; inset: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, rgba(34,197,94,0.2), rgba(11,18,32,0.94) 70%);
    backdrop-filter: blur(6px); padding: 16px;
}
.screen.hidden { display: none !important; }
.card {
    max-width: 460px; width: 100%; background: rgba(15,23,42,0.9);
    border: 3px solid rgba(34,197,94,0.4); border-radius: 20px;
    padding: 28px 22px; text-align: center; color: #fff;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.kicker { font-family: 'Press Start 2P', monospace; font-size: 9px; color: #86efac; letter-spacing: 0.08em; margin-bottom: 12px; }
h1 {
    font-family: 'Press Start 2P', monospace; font-size: clamp(28px, 8vw, 40px);
    color: #4ade80; text-shadow: 4px 4px 0 #14532d; margin-bottom: 12px;
}
h2 { font-family: 'Press Start 2P', monospace; font-size: 22px; color: #fbbf24; margin-bottom: 12px; line-height: 1.4; }
.tag { color: #94a3b8; font-weight: 600; margin-bottom: 16px; }
.mode-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.mode {
    padding: 10px 14px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.4); color: #fff; font-weight: 800; cursor: pointer;
}
.mode.active { border-color: #4ade80; background: rgba(34,197,94,0.25); }
.howto { list-style: none; text-align: left; margin: 0 auto 18px; max-width: 380px; }
.howto li {
    background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25);
    border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; font-weight: 600;
}
.howto b { color: #fbbf24; }
.cta {
    font-family: 'Press Start 2P', monospace; font-size: 12px;
    background: linear-gradient(180deg, #4ade80, #16a34a); color: #052e16;
    border: none; border-radius: 12px; padding: 16px 22px; cursor: pointer;
    box-shadow: 0 6px 0 #14532d;
}
.cta:active { transform: translateY(4px); box-shadow: 0 2px 0 #14532d; }
.back { display: inline-block; margin-top: 14px; color: #64748b; font-weight: 700; text-decoration: none; }
.back:hover { color: #4ade80; }
.hidden { display: none !important; }

@media (max-width: 700px) {
    #teams { display: none; }
    #touch-pad.hidden { display: flex !important; } /* show on narrow */
}
