:root {
  --fondo: #14100d;
  --vetro: rgba(10, 13, 19, 0.86);
  --testo: #ececec;
  --tenue: #a2a7ae;
  --accento: #ff6a2b;
  --accento-t: #160a04;
  --bordo: rgba(255, 255, 255, 0.09);
  --errore: #ff7a6b;
  --ok: #74e083;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --vetro: rgba(10, 13, 19, 0.86); } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); color: var(--testo); overflow: hidden;
  font: 16px/1.45 "Barlow", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
canvas#scena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

.demo-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center; padding: 6px 12px;
  background: var(--accento); color: var(--accento-t); font: 800 14px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .08em; }

.schermata { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 48px 16px 16px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.35), rgba(0,0,0,.7)); }
.finestra { width: min(460px, 100%); max-height: calc(100dvh - 80px); overflow: auto; background: var(--vetro);
  border: 1px solid var(--bordo); padding: 26px 28px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.finestra.larga { width: min(680px, 100%); }
.accento { display: block; width: 48px; height: 3px; background: var(--accento); margin-bottom: 10px; }
h1, h2 { font: 800 clamp(30px, 6vw, 44px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 0 0 12px; letter-spacing: .02em; }
h2 { font-size: 32px; }
h3 { font: 600 13px/1 "Barlow", sans-serif; color: var(--tenue); text-transform: uppercase; letter-spacing: .1em; margin: 18px 0 6px; }
.tenue { color: var(--tenue); }
.piccolo { font-size: 13px; color: var(--tenue); margin-top: 14px; }
a { color: var(--accento); }
button, .bottone { display: block; width: 100%; min-height: 46px; margin: 6px 0; padding: 10px 14px; border: 1px solid var(--bordo);
  background: #1d2028; color: var(--testo); font: 600 17px "Barlow", sans-serif; cursor: pointer; text-align: center; text-decoration: none;
  transition: background .15s, transform .1s; }
button:hover, .bottone:hover { background: #272b35; }
button:active { transform: scale(.985); }
button.pri { background: var(--accento); color: var(--accento-t); border-color: transparent; font-weight: 800; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
label { display: block; margin: 10px 0 4px; color: var(--tenue); font-size: 14px; }
input { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 8px 12px; background: #11141a; color: var(--testo);
  border: 1px solid var(--bordo); font: 16px "Barlow", sans-serif; }
.comandi, .funzioni, .classifica { padding-left: 0; list-style: none; margin: 0; }
.comandi li { display: flex; gap: 12px; padding: 4px 0; align-items: baseline; }
.comandi kbd { min-width: 120px; padding: 2px 8px; background: rgba(255,255,255,.08); font: 600 14px "Barlow", sans-serif; }
.funzioni li { padding: 3px 0; color: var(--tenue); }
.classifica li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--bordo); }
.classifica li b { color: var(--accento); }
.testo-lungo p { color: var(--tenue); font-size: 15px; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud-sx { position: absolute; top: 44px; left: 16px; padding: 10px 14px; background: rgba(0,0,0,.45); }
.barra { width: 200px; height: 10px; background: rgba(255,255,255,.15); }
.barra i { display: block; height: 100%; width: 100%; background: var(--ok); transition: width .2s; }
.punti { margin-top: 6px; font: 800 20px "Barlow Condensed", sans-serif; }
.hud-centro { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); padding: 8px 14px; background: rgba(0,0,0,.45);
  max-width: min(560px, 60vw); text-align: center; font-size: 15px; }
.hud-dx { position: absolute; top: 44px; right: 16px; padding: 8px 14px; background: rgba(0,0,0,.45); font: 800 20px "Barlow Condensed", sans-serif; }
.mirino { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 26px; color: rgba(255,255,255,.85); }
.messaggio { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); padding: 8px 18px; background: rgba(0,0,0,.55);
  font: 800 20px "Barlow Condensed", sans-serif; }
.danno { position: fixed; inset: 0; z-index: 9; pointer-events: none; background: rgba(150,0,0,.35); opacity: 0; transition: opacity .35s; }

.touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.stick { position: absolute; left: 24px; bottom: 28px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.08);
  border: 1px solid var(--bordo); pointer-events: auto; touch-action: none; }
.stick i { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.3); }
.tbtn { position: absolute; right: 24px; bottom: 36px; width: 74px; height: 74px; min-height: 0; border-radius: 50%; pointer-events: auto;
  background: rgba(255,255,255,.12); font-size: 28px; padding: 0; }
.tbtn2 { right: 112px; bottom: 60px; }

.caricamento { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; background: var(--fondo); gap: 10px; }
.giro { width: 42px; height: 42px; border: 3px solid var(--bordo); border-top-color: var(--accento); border-radius: 50%; animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 3s; } }

.credit { position: fixed; right: 12px; bottom: 10px; z-index: 20; font-size: 12px; opacity: .75; }
.credit a { color: var(--tenue); text-decoration: none; }

/* Zona Cenere */
.etichetta { font: 600 11px/1 "Barlow", sans-serif; color: var(--tenue); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 4px; }
.messi { font: 600 14px "Barlow", sans-serif; color: var(--tenue); }
.emp { margin-top: 6px; font: 800 14px "Barlow Condensed", sans-serif; letter-spacing: .08em; display: flex; align-items: center; gap: 4px; }
.carica { display: inline-block; width: 18px; height: 8px; background: #59c8ff; box-shadow: 0 0 8px #59c8ff; }
.carica.vuota { background: rgba(255,255,255,.15); box-shadow: none; }
.hud-dx { text-align: center; }
.tempo { font: 800 24px "Barlow Condensed", sans-serif; }
.tempo.urgente { color: var(--errore); animation: lampeggia 1s steps(2) infinite; }
@keyframes lampeggia { 50% { opacity: .45; } }
.bussola { display: flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px "Barlow", sans-serif; color: #ffb18a; margin-top: 2px; }
.freccia { display: inline-block; color: var(--accento); font-size: 18px; transition: transform .08s linear; }
.allerta { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font: 800 22px "Barlow Condensed", sans-serif; letter-spacing: .14em; padding: 2px 14px; }
.allerta:empty { display: none; }
.allerta.l0 { color: #9fd9a8; background: rgba(0,0,0,.4); }
.allerta.l1 { color: #ffd23f; background: rgba(60,45,0,.55); }
.allerta.l2 { color: #fff; background: rgba(190,30,20,.75); animation: lampeggia .6s steps(2) infinite; }
.avversari { position: absolute; right: 16px; top: 120px; list-style: none; margin: 0; padding: 8px 12px; background: rgba(0,0,0,.5); min-width: 190px; font-size: 14px; }
.avversari li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 2px 0; }
.avversari li small { grid-column: 1 / -1; color: var(--tenue); font-size: 12px; }
.avversari li b { color: #7fe6ff; }
.avversari .tit { display: block; color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.mirino { font-size: 30px; color: rgba(255,255,255,.7); }
.grado { margin: 4px 0 12px; padding: 8px 12px; border-left: 3px solid var(--accento); background: rgba(255,106,43,.08); font-size: 15px; }
.grado:empty { display: none; }
.tbtn3 { right: 24px; bottom: 124px; font-size: 22px; }
.tbtn.attivo { background: var(--accento); color: var(--accento-t); }
.schermata { background: radial-gradient(ellipse at center, rgba(20,10,4,.3), rgba(10,6,3,.75)); }
@media (max-width: 640px) {
  .hud-centro { top: 150px; font-size: 13px; max-width: 80vw; }
  .avversari { top: auto; bottom: 180px; right: 8px; min-width: 150px; font-size: 13px; }
  .barra { width: 140px; }
  .allerta { top: 116px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .tempo.urgente, .allerta.l2 { animation: none; } }
