/*
 * VIBE FPS — HUD e override responsive.
 * Questo foglio è il layer di stile dedicato all'HUD: viene caricato DOPO il
 * <style> inline di index.html e ne rifinisce dimensioni, spaziature e stati
 * responsivi. Tieni qui le regole HUD nuove invece di duplicarle inline.
 */
:root {
  --hud-safe: clamp(24px, 2.25vw, 44px);
  --hud-panel: rgba(3, 9, 17, .76);
  --hud-border: rgba(177, 242, 248, .28);
}

.hud-shell {
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  letter-spacing: .02em;
}

.hud-panel {
  background:
    linear-gradient(105deg, rgba(3, 9, 17, .9), rgba(7, 17, 27, .68)),
    linear-gradient(90deg, rgba(115, 239, 249, .035), transparent 55%);
  border-color: var(--hud-border);
  box-shadow: inset 0 1px rgba(255,255,255,.035), inset 0 0 35px rgba(34,201,220,.028), 0 14px 42px rgba(0,0,0,.28);
  backdrop-filter: blur(12px) saturate(1.2);
}

.hud-top { left: var(--hud-safe); right: var(--hud-safe); top: calc(var(--hud-safe) * .72); }
.sector { font-size: clamp(12px, .8vw, 15px); letter-spacing: 3.8px; margin-bottom: 8px; color: rgba(214,252,255,.92); }
.mission-card { width: clamp(420px, 31vw, 510px); padding: 18px 22px 17px; }
.micro-label { font-size: clamp(10px, .65vw, 12px); letter-spacing: 2.5px; color: rgba(208,245,248,.62); }
#objective-text { font-size: clamp(16px, 1.05vw, 20px); letter-spacing: 1px; }
.mission-line { gap: 13px; margin-top: 9px; }
.mission-pip { width: 8px; height: 8px; background: #eafcff; box-shadow: 0 0 12px rgba(125,244,255,.75); }
.mission-progress { height: 3px; margin-top: 15px; }

.telemetry { min-width: 235px; padding: 15px 18px; }
.telemetry-row { margin-top: 7px; font-size: clamp(10px, .7vw, 13px); color: rgba(220,245,248,.6); }
.telemetry-row b { color: rgba(232,253,255,.92); }

.radar-wrap { left: var(--hud-safe); bottom: 157px; width: 220px; height: 220px; }
#radar { width: 220px; height: 220px; border-color: rgba(196,247,250,.34); box-shadow: inset 0 0 40px rgba(0,229,255,.06), 0 10px 28px rgba(0,0,0,.3); }
.radar-tag { top: -22px; font-size: 10px; letter-spacing: 2.2px; }

.vitals { left: var(--hud-safe); bottom: var(--hud-safe); width: clamp(340px, 25vw, 400px); }
.vital-row { grid-template-columns: 62px 1fr 46px; gap: 11px; margin-top: 9px; }
.vital-name { font-size: clamp(10px, .7vw, 13px); letter-spacing: 2px; }
.vital-value { font-size: clamp(13px, .85vw, 16px); }
.bar { height: 9px; border: 1px solid rgba(255,255,255,.05); }

.weapon-hud { right: var(--hud-safe); bottom: var(--hud-safe); width: clamp(340px, 25vw, 390px); padding: 18px 22px 19px; }
.weapon-name { font-size: clamp(14px, 1vw, 18px); color: rgba(229,253,255,.95); }
#ammo { font-size: clamp(60px, 4.2vw, 76px); letter-spacing: -7px; font-weight: 250; }
.reserve { font-size: clamp(19px, 1.4vw, 25px); }
.ammo-cells { height: 6px; gap: 4px; margin-top: 10px; }
.reload-message { top: -34px; font-size: 11px; }

#sound-state { right: var(--hud-safe); bottom: 152px; font-size: 10px; }
#toast-stack { right: var(--hud-safe); top: 148px; width: 340px; }
.toast { padding: 10px 13px; font-size: 11px; border-right-color: rgba(225,252,255,.82); }

#crosshair { width: 50px; height: 50px; }
#crosshair .top, #crosshair .bottom { left: 24px; height: 9px; }
#crosshair .left, #crosshair .right { top: 24px; width: 9px; }
#crosshair .top { top: 5px; } #crosshair .bottom { bottom: 5px; }
#crosshair .left { left: 5px; } #crosshair .right { right: 5px; }
#crosshair .cross-dot { left: 23.5px; top: 23.5px; }
.hud-shell.sprinting + #hud, #hud.onboarding-hidden { opacity: 0 !important; }
#hud { transition: opacity .8s ease; bottom: 26px; font-size: 11px; }

.target-marker {
  width: 68px;
  height: 48px;
  opacity: .78;
  border-color: rgba(255,91,113,.86);
  transition: width .12s ease, height .12s ease, filter .12s ease;
}
.target-marker::after { top: 52px; font-size: 9px; letter-spacing: .8px; }
.target-health { top: -9px; height: 3px; }
.target-state { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); color: #ffc857; font: 800 9px ui-monospace, monospace; letter-spacing: 2px; }
.target-marker.evade-warning { width: 82px; height: 58px; border-color: #ffc857; filter: drop-shadow(0 0 9px rgba(255,200,87,.65)); animation: targetWarning .14s infinite alternate; }
.target-marker.offscreen { width: 22px; height: 22px; border: 0; clip-path: none; opacity: .75; }
.target-marker.offscreen::before { content: ''; position: absolute; inset: 1px; border: 2px solid rgba(255,79,104,.85); transform: rotate(45deg); }
.target-marker.offscreen::after, .target-marker.offscreen .target-health { display: none; }
.target-marker.offscreen .target-state { bottom: -19px; color: rgba(255,113,132,.82); }
@keyframes targetWarning { to { opacity: .42; } }

.critical .vitals { animation: criticalPulse .55s infinite alternate; }
@keyframes criticalPulse { to { filter: drop-shadow(0 0 10px rgba(255,52,78,.38)); } }
.danger-text { color: #ff465f; }

.settings-panel {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(980px, 94vw);
  padding: 15px 20px 14px;
  display: grid;
  /* Riga 1: titolo · qualità · reset. Riga 2: i 4 slider a tutta larghezza
     (ognuno ~220px — review demo: prima erano troppo corti). */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 12px 16px;
  background: rgba(3,9,16,.72);
  border: 1px solid rgba(159,239,246,.18);
  backdrop-filter: blur(12px);
  z-index: 3;
}
.settings-title { grid-column: 1 / 3; grid-row: 1; color: rgba(200,244,248,.5); font: 800 10px ui-monospace, monospace; letter-spacing: 1.8px; white-space: nowrap; }
/* L1: wrapper dei due toggle (qualità AUTO/ULTRA + lingua IT/EN) nella cella 3. */
.panel-toggles { grid-column: 3 / 4; grid-row: 1; display: flex; gap: 14px; justify-self: center; }
.reset-level { grid-column: 4 / 5; grid-row: 1; justify-self: end; }
.quality-toggle { display: flex; gap: 4px; }
.quality-toggle button { padding: 8px 12px; color: rgba(221,249,252,.55); background: rgba(255,255,255,.035); border: 1px solid rgba(156,238,246,.15); font: 800 10px ui-monospace, monospace; cursor: pointer; }
.quality-toggle button.selected { color: #eaffff; border-color: rgba(119,246,255,.7); background: rgba(0,229,255,.1); box-shadow: inset 0 0 12px rgba(0,229,255,.08); }
.reset-level { padding: 8px 12px; color: rgba(255,213,147,.82); background: rgba(255,173,76,.06); border: 1px solid rgba(255,193,105,.28); font: 800 10px ui-monospace, monospace; letter-spacing: .7px; cursor: pointer; white-space: nowrap; }
.reset-level:hover { color: #fff1cf; border-color: rgba(255,205,126,.8); background: rgba(255,173,76,.14); box-shadow: 0 0 14px rgba(255,173,76,.12); }
/* Slider: etichetta sopra, controllo sotto a tutta larghezza. I range nativi
   erano troppo piccoli da usare (review demo) — traccia e thumb custom. */
.settings-panel label { grid-row: 2; display: grid; grid-template-columns: 1fr; gap: 6px; align-items: center; color: rgba(213,245,248,.62); font: 700 9px ui-monospace, monospace; letter-spacing: 1.4px; }
.settings-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.settings-panel input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(0,229,255,.42), rgba(119,246,255,.14));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.45);
}
.settings-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: #a8f4ff;
  border: 1px solid rgba(8,26,36,.65);
  box-shadow: 0 0 9px rgba(0,229,255,.6);
}
.settings-panel input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(119,246,255,.2);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.45);
}
.settings-panel input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(8,26,36,.65);
  border-radius: 50%;
  background: #a8f4ff;
  box-shadow: 0 0 9px rgba(0,229,255,.6);
}

/* Sotto i 1100px: intestazione, poi qualità/reset, poi gli slider 2×2 —
   mai schiacciati sotto una dimensione utilizzabile. */
@media (max-width: 1100px) {
  .settings-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .settings-title { grid-column: 1 / -1; grid-row: 1; }
  .panel-toggles { grid-column: 1 / 2; grid-row: 2; justify-self: start; }
  .reset-level { grid-column: 2 / 3; grid-row: 2; justify-self: end; }
  .settings-panel label { grid-row: auto; }
}

@media (max-width: 900px) {
  .mission-card { width: min(58vw, 440px); }
  .telemetry { min-width: 170px; }
  .radar-wrap { width: 175px; height: 175px; bottom: 145px; }
  #radar { width: 175px; height: 175px; }
  .vitals { width: 300px; }
  .weapon-hud { width: 300px; }
}

/* Apex Sentinel — barra del boss (in alto al centro) e marker dedicato. */
#boss-bar {
  position: fixed; left: 50%; top: calc(var(--hud-safe) * .72);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px; min-width: 300px; max-width: 46vw;
  background: linear-gradient(105deg, rgba(3,9,17,.9), rgba(7,17,27,.68));
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  box-shadow: inset 0 0 30px rgba(255,45,149,.06), 0 12px 34px rgba(0,0,0,.3);
  backdrop-filter: blur(10px);
  z-index: 12; opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
#boss-bar.show { opacity: 1; }
#boss-name { font: 900 13px ui-monospace,monospace; letter-spacing: 2px; color: var(--pink); text-shadow: 0 0 12px rgba(255,45,149,.6); white-space: nowrap; }
.boss-track { flex: 1; height: 7px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
#boss-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg,#ff2d95,#ff6b7a,#ffd166); box-shadow: 0 0 10px rgba(255,45,149,.8); transition: width .12s linear; }
#boss-hp { font: 700 11px ui-monospace,monospace; letter-spacing: 1px; color: rgba(255,214,230,.85); white-space: nowrap; text-shadow: 0 0 10px rgba(255,45,149,.5); }
#boss-state { font: 700 10px ui-monospace,monospace; letter-spacing: 1px; color: rgba(226,251,255,.66); white-space: nowrap; }

/* Marker Apex più grande e con colori dedicati. */
.target-marker.apex-marker {
  width: 74px; height: 52px;
  border-left-color: var(--pink, #ff2d95);
  border-right-color: var(--pink, #ff2d95);
  opacity: .95;
}
.target-marker.apex-marker .target-health { top: -9px; height: 3px; }
.target-marker.apex-marker .target-health i { background: var(--pink, #ff2d95); box-shadow: 0 0 8px var(--pink, #ff2d95); }
.target-marker.apex-marker::after { top: 55px; color: rgba(255,170,199,.9); font: 800 9px ui-monospace,monospace; }

/* Vital HUD: pannello a strati in basso a sinistra, con valori e barre
   abbastanza grandi da restare leggibili durante movimento e combattimento. */
.vitals {
  left: var(--hud-safe);
  bottom: var(--hud-safe);
  width: clamp(360px, 28vw, 470px);
  padding: 18px 22px 16px;
  display: grid;
  gap: 13px;
  border-left: 3px solid rgba(119,246,255,.72);
}
.radar-wrap { bottom: 330px; }
.vitals-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 5px; border-bottom: 1px solid rgba(119,246,255,.16); }
.vitals-head strong { display: block; margin-top: 3px; color: rgba(230,253,255,.92); font: 900 14px/1 ui-monospace, monospace; letter-spacing: 2px; }
.vitals-foot { color: rgba(194,235,242,.48); font: 800 9px ui-monospace, monospace; letter-spacing: 1.5px; }
.vital-meter { display: grid; gap: 6px; }
.vital-meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.vital-name { font-size: 13px; letter-spacing: 2.8px; color: rgba(218,247,250,.78); }
.vital-value { color: #effeff; font: 900 clamp(30px, 2.35vw, 42px)/.82 ui-monospace, monospace; letter-spacing: -2px; text-shadow: 0 0 14px rgba(119,246,255,.28); }
.bar { display: block; height: 13px; transform: skewX(-18deg); background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.08); overflow: hidden; }
.bar > i { display: block; height: 100%; transition: width .18s; box-shadow: 0 0 13px currentColor; }
.vitals .health-meter .bar > i { background: linear-gradient(90deg,#ff304e,#ff957a); color: #ff465f; }
.vitals .shield-meter .bar > i { background: linear-gradient(90deg,#116cff,#6ff5ff); color: #40dfff; }
.vitals .stamina-meter .bar > i { background: linear-gradient(90deg,#e99a28,#fff08a); color: #ffc857; }
.vitals-foot { display: flex; justify-content: space-between; padding-top: 2px; border-top: 1px solid rgba(255,255,255,.08); }
/* Vite: separatore + cuori (uno per vita restante) nel pannello vitals. */
.vitals .lives-meter { padding-top: 5px; border-top: 1px solid rgba(119,246,255,.16); }
.lives-hearts { display: flex; align-items: center; gap: 6px; }
.life-heart {
  color: rgba(255,255,255,.14);
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255,59,92,0);
  transition: color .15s ease, text-shadow .15s ease, filter .15s ease;
}
.life-heart.full { color: #ff3b5c; text-shadow: 0 0 10px rgba(255,59,92,.75); }
.lives-value {
  /* Stessa tipografia dei valori HEALTH/SHIELD/STAMINA (.vital-value), con
     accento colore: il numero vite deve essere grande quanto gli altri. */
  color: rgba(255,120,140,.92);
  font: 900 clamp(30px, 2.35vw, 42px)/.82 ui-monospace, monospace;
  letter-spacing: -2px;
  text-shadow: 0 0 14px rgba(255,120,140,.32);
}
.weapon-hud #weapon-name { min-width: 0; }

@media (max-width: 900px) {
  .vitals { width: 340px; padding: 15px 18px 14px; }
  .vital-value { font-size: 32px; }
}
@media (max-width: 720px) {
  .vitals { left: 12px; bottom: 20px; width: min(52vw, 300px); padding: 12px 14px; gap: 8px; }
  .vitals-head strong { font-size: 10px; }
  .vitals-foot { font-size: 7px; }
  .vital-name { font-size: 9px; letter-spacing: 1.6px; }
  .vital-value { font-size: 25px; }
  .bar { height: 9px; }
}

/* ============================================================
   MODALITÀ SMARTPHONE (touch)
   ============================================================ */
/* Contenitore dei controlli touch: visibile solo in touch e durante il gioco. */
#touch-controls {
  position: fixed; inset: 0;
  z-index: 20;
  pointer-events: none;
  display: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
#touch-controls.active { display: block; }

/* Joystick virtuali: base + pollice. */
.touch-joystick {
  position: absolute;
  width: 92px; height: 92px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}
.touch-joystick.active { opacity: 1; }
.touch-joystick-base {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(125, 246, 255, .35);
  background: radial-gradient(circle, rgba(125,246,255,.06), rgba(255,255,255,.02) 60%, transparent 70%);
  box-shadow: inset 0 0 18px rgba(125,246,255,.12), 0 0 14px rgba(0,0,0,.4);
}
.touch-thumb {
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(214,252,255,.9), rgba(125,246,255,.35) 60%, rgba(0,229,255,.15));
  border: 1px solid rgba(125,246,255,.6);
  box-shadow: 0 0 16px rgba(125,246,255,.5), 0 4px 10px rgba(0,0,0,.5);
}

/* Pulsanti touch: colonna a destra (fuoco, salto, ecc.) + sprint a sinistra.
   Le inset env(safe-area-*) tengono i controlli fuori dalla tacca/indicator. */
.touch-buttons-right {
  position: absolute;
  right: max(22px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: 120px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
  pointer-events: none;
}
.touch-btn {
  pointer-events: auto;
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(125, 246, 255, .5);
  background: radial-gradient(circle at 35% 30%, rgba(20,60,70,.85), rgba(3,9,17,.7));
  color: rgba(226,251,255,.95);
  font: 900 11px ui-monospace, monospace;
  letter-spacing: 1px;
  box-shadow: inset 0 0 14px rgba(125,246,255,.18), 0 6px 16px rgba(0,0,0,.45);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
.touch-btn:active { transform: scale(.94); background: radial-gradient(circle at 35% 30%, rgba(40,120,140,.9), rgba(3,9,17,.8)); }
.touch-btn-fire {
  width: 92px; height: 92px;
  border-color: rgba(255,120,80,.7);
  background: radial-gradient(circle at 35% 30%, rgba(120,30,20,.85), rgba(40,8,6,.75));
  box-shadow: inset 0 0 20px rgba(255,120,80,.3), 0 8px 20px rgba(0,0,0,.5);
  font-size: 13px;
}
.touch-btn-fire:active { background: radial-gradient(circle at 35% 30%, rgba(200,60,30,.9), rgba(60,12,8,.8)); }
.touch-btn-jump { width: 76px; height: 76px; }
.touch-btn-melee { width: 60px; height: 60px; font-size: 10px; }
#touch-btn-sprint {
  position: absolute;
  left: max(22px, calc(env(safe-area-inset-left, 0px) + 12px)); bottom: 120px;
  width: 76px; height: 76px;
}
#touch-btn-pause {
  position: absolute;
  top: max(14px, calc(env(safe-area-inset-top, 0px) + 10px));
  right: max(14px, calc(env(safe-area-inset-right, 0px) + 10px));
  width: 46px; height: 46px;
  font-size: 8px;
  background: radial-gradient(circle at 35% 30%, rgba(20,60,70,.62), rgba(3,9,17,.62));
}

/* Rotate-device guard: overlay full-screen in portrait su touch. */
.rotate-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(8,18,28,.98), rgba(2,6,12,.99));
  color: rgba(226,251,255,.95);
  text-align: center;
}
/* L'attributo hidden deve davvero nascondere l'overlay: senza questa regola il
   display:flex qui sopra avrebbe la precedenza sul display:none di default di
   [hidden] (foglio UA), e l'overlay resterebbe visibile anche su desktop. */
.rotate-overlay[hidden] { display: none; }
.rotate-icon { font-size: 56px; animation: rotate-device 1.6s ease-in-out infinite; }
@keyframes rotate-device {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}
.rotate-title { font: 900 22px ui-monospace, monospace; letter-spacing: 3px; text-shadow: 0 0 20px rgba(125,246,255,.6); }
.rotate-sub { font: 700 12px ui-monospace, monospace; letter-spacing: 2px; color: rgba(125,246,255,.7); }

/* Su touch: nasconde l'HUD di default e regola il layout per il landscape. */
@media (pointer: coarse) {
  #hud, .keys { display: none; }
  /* Il mirino resta attivo anche in touch durante l'azione: la visibilità è
     governata da syncHudVisibility() (mobile viewfinder deploy). */
  .radar-wrap { display: none; }
  .vitals { left: 10px; bottom: 10px; width: min(240px, 34vw); padding: 10px 12px; gap: 6px; }
  .lives-hearts { gap: 4px; }
  .life-heart { font-size: 12px; }
  .weapon-hud { right: 10px; bottom: 10px; width: min(240px, 34vw); padding: 10px 12px; }
  #toast-stack { right: 10px; top: 58px; width: 260px; }
  #sound-state { display: none; }
  .hud-top { top: 6px; left: 10px; right: 10px; }
  .mission-card { width: min(300px, 42vw); padding: 10px 12px; }
  .telemetry { display: none; }
  /* I controlli touch non devono interferire con i bottoni del pannello. */
  .settings-panel { font-size: 13px; }
}

/* ============================================================
   SMARTPHONE IN LANDSCAPE (schermi bassi)
   Menu avvio/pausa compatto — mai sovrapposto al CTA — e
   colonna pulsanti touch adattata all'altezza dello schermo.
   ============================================================ */

/* Menu: compatto, scrollabile di sicurezza, settings-panel in flow (sotto il
   CTA) invece di absolute-bottom: prima il pannello copriva il pulsante di
   avvio sui telefoni. .keys è già nascosto dal blocco (pointer: coarse). */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  #overlay {
    justify-content: flex-start;
    overflow-y: auto;
    padding: 40px 16px 14px;
  }
  #overlay .boot, #overlay .build { top: 10px; font-size: 7px; letter-spacing: 1px; }
  #overlay .boot { left: 14px; }
  #overlay .build { right: 14px; }
  #overlay .credit { display: none; }
  #overlay h1 { font-size: clamp(22px, 7vh, 34px); letter-spacing: 3px; margin-bottom: 2px; }
  #overlay .sub { font-size: 9px; margin-bottom: 10px; letter-spacing: 1px; }
  #overlay .brief {
    width: min(560px, 92vw);
    padding: 8px 14px;
    margin-bottom: 10px;
    font-size: 9px;
    line-height: 1.5;
    max-height: 4.5em;
    overflow: hidden;
  }
  #overlay .cta { font-size: 12px; padding: 9px 30px; }
  #overlay .loading-panel { margin: 12px 0 4px; }
  #overlay .gpu-warning { margin: 10px 0 4px; padding: 8px 12px; font-size: 9px; }
  .settings-panel {
    position: static;
    transform: none;
    margin: 8px auto 2px;
    width: min(600px, 94vw);
    padding: 6px 10px;
    gap: 4px 10px;
    font-size: 10px;
  }
  .settings-panel .settings-title { font-size: 8px; letter-spacing: 1.2px; }
  .settings-panel label { gap: 2px; font-size: 8px; }
  .settings-panel input[type="range"] { height: 15px; }
  .settings-panel .quality-toggle button,
  .settings-panel .reset-level { padding: 4px 8px; font-size: 8px; }
}

/* Touch in gioco su schermi bassi (landscape): la colonna a destra era alta
   ~420px (60–92px per pulsante + gap 14px) e finiva fuori schermo — reload e
   melee in cima alla colonna uscivano dal bordo alto. Qui i pulsanti scalano
   con l'altezza (vh) e l'HUD arma si compatta per non collidere con il fuoco. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .touch-buttons-right {
    right: max(10px, calc(env(safe-area-inset-right, 0px) + 8px));
    bottom: calc(10px + 18vh);
    gap: clamp(4px, 1.3vh, 8px);
  }
  .touch-btn {
    width: clamp(38px, 11.5vh, 48px);
    height: clamp(38px, 11.5vh, 48px);
    font-size: clamp(7px, 1.9vh, 10px);
    letter-spacing: .5px;
  }
  .touch-btn-melee {
    width: clamp(34px, 10vh, 42px);
    height: clamp(34px, 10vh, 42px);
    font-size: clamp(6px, 1.6vh, 9px);
  }
  .touch-btn-jump {
    width: clamp(42px, 13vh, 54px);
    height: clamp(42px, 13vh, 54px);
  }
  .touch-btn-fire {
    width: clamp(48px, 15vh, 62px);
    height: clamp(48px, 15vh, 62px);
    font-size: clamp(8px, 2.4vh, 11px);
  }
  #touch-btn-sprint {
    left: max(10px, calc(env(safe-area-inset-left, 0px) + 8px));
    width: clamp(42px, 13vh, 54px);
    height: clamp(42px, 13vh, 54px);
    font-size: clamp(7px, 1.9vh, 10px);
  }
  /* HUD arma compatto: la colonna pulsanti parte sopra di esso. */
  .weapon-hud { width: min(170px, 32vw); padding: 6px 9px; }
  .weapon-hud #weapon-name { font-size: 9px; }
  .weapon-hud #ammo { font-size: 28px; letter-spacing: -3px; }
  .weapon-hud .reserve { font-size: 12px; }
  .weapon-hud .ammo-cells { display: none; }
  .weapon-hud .reload-message { top: -16px; font-size: 9px; }
}
