:root {
  --fondo: #08090c;
  --vetro: rgba(9, 10, 14, 0.88);
  --testo: #efebe4;
  --tenue: #a8a39b;
  --accento: #d8322a;
  --accento-t: #fff6ef;
  --oro: #d9a441;
  --bordo: rgba(255, 255, 255, 0.09);
  --ok: #e8e2d6;
  color-scheme: dark;
}
* { 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: 5px 12px;
  background: #120708; color: var(--tenue); border-bottom: 1px solid rgba(216,50,42,.35);
  font: 700 13px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .12em; text-transform: uppercase; }

.schermata { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 48px 16px 16px;
  background: radial-gradient(ellipse at 30% 40%, rgba(60,8,6,.35), rgba(0,0,0,.82)); }
.finestra { position: relative; width: min(470px, 100%); max-height: calc(100dvh - 80px); overflow: auto; background: var(--vetro);
  border: 1px solid var(--bordo); border-top: 3px solid var(--accento); padding: 26px 28px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.finestra.larga { width: min(700px, 100%); }
.accento { display: none; }
.sigillo { position: absolute; right: 22px; top: 22px; width: 54px; height: 54px; display: grid; place-items: center;
  background: var(--accento); color: #fff4ea; font: 900 24px/1 "Barlow Condensed", sans-serif; transform: rotate(-6deg);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.18); }
h1, h2 { font: 900 clamp(30px, 6vw, 44px)/0.95 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 0 0 12px; letter-spacing: .02em; }
h1 { font-size: clamp(46px, 10vw, 72px); }
h1 span { color: var(--accento); }
h1 small { display: block; margin-top: 6px; font: 700 15px/1.2 "Barlow", sans-serif; letter-spacing: .22em; color: var(--oro); }
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: #ff8a7a; }
button, .bottone { display: block; width: 100%; min-height: 46px; margin: 6px 0; padding: 10px 14px; border: 1px solid var(--bordo);
  background: #17181d; color: var(--testo); font: 600 17px "Barlow", sans-serif; cursor: pointer; text-align: center; text-decoration: none;
  transition: background .15s, transform .1s, border-color .15s; }
button:hover, .bottone:hover { background: #22232a; border-color: rgba(216,50,42,.45); }
button:active { transform: scale(.985); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.pri { background: var(--accento); color: var(--accento-t); border-color: transparent; font-weight: 800; letter-spacing: .02em; }
button.pri:hover { background: #e8443a; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
label { display: block; margin: 10px 0 4px; color: var(--tenue); font-size: 14px; }
input, select { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 8px 12px; background: #0f1014; color: var(--testo);
  border: 1px solid var(--bordo); font: 16px "Barlow", sans-serif; }
input[type=range] { padding: 0; accent-color: var(--accento); }
.comandi, .funzioni, .classifica, .missioni { padding-left: 0; list-style: none; margin: 0; }
.comandi li { display: flex; gap: 12px; padding: 4px 0; align-items: baseline; }
.comandi kbd { min-width: 128px; padding: 2px 8px; background: rgba(255,255,255,.07); font: 600 14px "Barlow", sans-serif; }
.funzioni li { padding: 3px 0; color: var(--tenue); }
.funzioni b { color: var(--testo); }
.classifica li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--bordo); }
.classifica li b { color: var(--oro); }
.testo-lungo p { color: var(--tenue); font-size: 15px; }
.grado { margin: 4px 0 12px; padding: 8px 12px; border-left: 3px solid var(--oro); background: rgba(217,164,65,.08); font-size: 15px; }
.grado:empty { display: none; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud-sx { position: absolute; top: 40px; left: 16px; padding: 10px 14px; background: linear-gradient(90deg, rgba(0,0,0,.6), rgba(0,0,0,.2)); min-width: 230px; }
.nome-eroe { font: 900 24px/1 "Barlow Condensed", sans-serif; letter-spacing: .08em; }
.nome-eroe .vite { color: var(--accento); letter-spacing: .1em; margin-left: 6px; font-size: 20px; }
.etichetta { font: 600 11px/1 "Barlow", sans-serif; color: var(--tenue); text-transform: uppercase; letter-spacing: .12em; margin: 8px 0 4px; }
.barra { width: 210px; height: 9px; background: rgba(255,255,255,.14); }
.barra i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #a9241c, #ff5a3c); transition: width .2s; }
.barra.ken i { background: linear-gradient(90deg, #b8692a, #ffc06a); transition: width .05s; }
.riga { display: flex; gap: 10px; align-items: center; margin-top: 8px; font: 700 15px "Barlow Condensed", sans-serif; letter-spacing: .05em; }
.ninjutsu { padding: 2px 8px; background: var(--accento); color: #fff; }
.ninjutsu.spento { background: rgba(255,255,255,.12); color: var(--tenue); text-decoration: line-through; }
.hud-centro { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); padding: 8px 14px; background: rgba(0,0,0,.5);
  max-width: min(560px, 60vw); text-align: center; font-size: 15px; }
.hud-centro:empty { display: none; }
.hud-dx { position: absolute; top: 40px; right: 16px; padding: 8px 14px; background: linear-gradient(270deg, rgba(0,0,0,.6), rgba(0,0,0,.2)); text-align: right; min-width: 130px; }
.punti { font: 900 32px/1 "Barlow Condensed", sans-serif; }
.tempo { font: 800 22px "Barlow Condensed", sans-serif; color: var(--testo); letter-spacing: .06em; }
.tempo.urgente { color: #ff5a3c; animation: pulsa .5s ease-in-out infinite alternate; }
.bombe { font: 700 15px "Barlow Condensed", sans-serif; color: var(--oro); letter-spacing: .05em; }
.combo { font: 900 22px "Barlow Condensed", sans-serif; color: var(--oro); }
.combo:empty { display: none; }
@keyframes pulsa { to { opacity: .55; } }
.messaggio { position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%); padding: 8px 18px; background: rgba(0,0,0,.6);
  font: 800 22px "Barlow Condensed", sans-serif; letter-spacing: .04em; text-align: center; max-width: 90vw; }
.disinnesco { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); width: 160px; text-align: center; font: 700 13px "Barlow", sans-serif; }
.disinnesco .barra { width: 100%; }
.disinnesco .barra i { background: linear-gradient(90deg, #2c9a52, #7dffa6); transition: none; }
.boss { position: absolute; bottom: 74px; left: 50%; transform: translateX(-50%); width: min(560px, 82vw); text-align: center; font: 900 18px "Barlow Condensed", sans-serif; letter-spacing: .16em; color: #ff8a5c; }
.boss .barra { width: 100%; height: 12px; margin-top: 4px; }
.avversari { position: absolute; right: 16px; top: 150px; 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: #7fc8ff; }
.galla { position: fixed; z-index: 11; pointer-events: none; transform: translate(-50%, -50%); font: 900 22px "Barlow Condensed", sans-serif; color: var(--oro);
  text-shadow: 0 2px 6px rgba(0,0,0,.8); animation: sale 1s ease-out forwards; }
@keyframes sale { to { transform: translate(-50%, -160%); opacity: 0; } }
.cartello { position: fixed; z-index: 15; left: 50%; top: 32%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: entra .5s ease-out; }
.cartello .num { font: 700 14px "Barlow", sans-serif; letter-spacing: .3em; text-transform: uppercase; color: var(--oro); }
.cartello .nome { font: 900 clamp(44px, 9vw, 86px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; text-shadow: 0 4px 30px rgba(0,0,0,.8); }
.cartello .nome::after { content: ""; display: block; width: 90px; height: 4px; background: var(--accento); margin: 12px auto; }
.cartello .testo { max-width: 560px; margin: 0 auto; font-size: 17px; color: #ddd6cb; text-shadow: 0 2px 10px #000; }
@keyframes entra { from { opacity: 0; transform: translate(-50%, -40%); } }

/* telefono */
.touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.stick { position: absolute; left: 24px; bottom: 28px; width: 136px; height: 136px; border-radius: 50%; background: rgba(255,255,255,.07);
  border: 1px solid var(--bordo); pointer-events: auto; touch-action: none; }
.stick i { position: absolute; left: 43px; top: 43px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.28); }
.tbtn { position: absolute; width: 70px; height: 70px; min-height: 0; border-radius: 50%; pointer-events: auto; padding: 0;
  background: rgba(255,255,255,.12); font: 800 20px "Barlow Condensed", sans-serif; touch-action: none; }
#tAttacco { right: 22px; bottom: 30px; width: 86px; height: 86px; background: rgba(216,50,42,.55); font-size: 30px; }
#tSalta { right: 122px; bottom: 26px; }
#tKen { right: 32px; bottom: 132px; background: rgba(217,164,65,.4); }
#tNinjutsu { right: 116px; bottom: 112px; width: 58px; height: 58px; font-size: 16px; }
#tUsa { right: 196px; bottom: 50px; width: 58px; height: 58px; }

.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); } }
.credit { position: fixed; right: 12px; bottom: 10px; z-index: 20; font-size: 12px; opacity: .75; }
.credit a { color: var(--tenue); text-decoration: none; }

@media (max-width: 640px) {
  .hud-sx { min-width: 0; padding: 8px 10px; }
  .barra { width: 140px; }
  .hud-centro { top: 150px; font-size: 13px; max-width: 80vw; }
  .avversari { top: auto; bottom: 200px; right: 8px; min-width: 150px; font-size: 13px; }
  .sigillo { width: 42px; height: 42px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 3s; } .tempo.urgente, .galla, .cartello { animation: none; } }
