html, body {
    height: 100%;
    overflow: hidden;
    margin: 0;
    font-family: system-ui, Arial, sans-serif;
}

body {
    background: #0a0c14;
    color: #fff;
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100dvh; /* dvh = dynamic viewport height, exclut la barre d'adresse mobile */
    overflow: hidden;
}

/* ── Barre HUD ───────────────────────────────────────────────── */
#ui-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 12px;
    height: 56px;
    flex-shrink: 0;
    background: rgba(10, 12, 20, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 20;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: clamp(13px, 2.8vw, 17px);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e0e0e0;
    min-width: 0;
}

/* Arme : occupe l'espace restant, tronque si besoin */
#weapon-box {
    flex: 1 1 0;
    min-width: 0;
}

#current-weapon {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#current-weapon img {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 1px;
}

.hud-score  { color: #2ed573; flex-shrink: 0; }
.hud-penalty{ color: #ffa502; flex-shrink: 0; }
.hud-timer  { color: #fff;    flex-shrink: 0; }
.hud-timer.urgent { color: #ff4757; animation: pulse 0.6s infinite alternate; }

@keyframes pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* ── Canvas ──────────────────────────────────────────────────── */
canvas {
    display: block;
    background: #000;
    cursor: crosshair;
    touch-action: none;
    flex: 1;
}

/* ── D-Pad ───────────────────────────────────────────────────── */
#dpad {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 100;
    /* Visible uniquement sur écrans tactiles */
    display: none;
}

/* Afficher sur écrans tactiles (pointer: coarse = doigt) */
@media (pointer: coarse) {
    #dpad { display: flex; }
}

.dpad-middle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dpad-center {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
}

.dpad-btn {
    width: 70px;
    height: 70px;
    background: rgba(20, 22, 35, 0.85);
    border: 1.5px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    color: rgba(255,255,255,0.80);
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: background 0.08s, transform 0.08s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.dpad-btn:active,
.dpad-btn.pressed {
    background: rgba(80, 100, 180, 0.70);
    transform: scale(0.92);
    color: #fff;
}

/* ── Boutons zoom +/- ────────────────────────────────────────── */
#zoom-bar {
    position: fixed;
    bottom: 24px;
    left: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    z-index: 100;
    height: 218px;
}

#zoom-bar button {
    width: 44px;
    height: 44px;
    background: rgba(20, 22, 35, 0.82);
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: rgba(255,255,255,0.85);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: background 0.08s, transform 0.08s;
}

#zoom-bar button:active {
    background: rgba(80, 100, 180, 0.70);
    transform: scale(0.92);
}

