/* Il simulatore: colori e caratteri da DIREZIONE.md. Angoli vivi, niente ombre né sfumature. */
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("/assets/caratteri/atkinson-hyperlegible-next-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Bodoni Moda"; src: url("/assets/caratteri/bodoni-moda-latin-opsz.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
:root {
  --pietra: #F2EEE4; --inchiostro: #0F2A3A; --leccio: #2F4A36; --giallo: #F2B705; --rosso: #C8321F; --rosso-testo: #A82A19; --mantello: #5E6A72; --riga: #A9B4BB;
  --testo: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif; --titoli: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --planata: cubic-bezier(.2, .7, .2, 1);
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--inchiostro); color: var(--pietra); font-family: var(--testo); font-size: 16px; overscroll-behavior: none; }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
.vola { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.vola-tela { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--giallo); outline-offset: 2px; }

/* tasti */
.tasto { font: 600 16px/1.2 var(--testo); min-height: 48px; padding: 12px 18px; border: 2px solid var(--pietra); background: transparent; color: var(--pietra); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 0; transition: background-color 110ms ease-out, color 110ms ease-out, transform 90ms ease-out; }
.tasto:hover { background: rgba(242, 238, 228, 0.12); }
.tasto:active { transform: translateY(1px); }
.tasto-pieno { background: var(--pietra); color: var(--inchiostro); }
.tasto-pieno::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rosso); flex: none; }
.tasto-pieno:hover { background: #fff; }
.tasto[disabled] { opacity: 0.6; cursor: progress; }
.tasto-icona { width: 48px; height: 48px; border: 0; background: rgba(15, 42, 58, 0.72); color: var(--pietra); display: grid; place-items: center; cursor: pointer; padding: 0; border-radius: 0; }
.tasto-icona svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tasto-icona[aria-pressed="true"] { background: var(--pietra); color: var(--inchiostro); }
.tasto-icona[data-tasto-audio][aria-pressed="false"] [data-onde] { opacity: 0.25; }

/* caricamento: il mondo si vede dietro quando è pronto */
.carico { position: absolute; inset: 0; display: grid; align-items: end; padding: calc(24px + var(--sa-t)) calc(24px + var(--sa-r)) calc(72px + var(--sa-b)) calc(24px + var(--sa-l)); background: var(--inchiostro) url("/assets/img/volo-anteprima-960.webp") center / cover no-repeat; z-index: 5; }
@media (min-width: 1000px) { .carico { background-image: url("/assets/img/volo-anteprima.webp"); } }
.carico.pronto { background: transparent; }
.carico[hidden] { display: none; }
.carico-testo { max-width: 34rem; background: var(--inchiostro); padding: 24px 24px 28px; border-left: 6px solid var(--pietra); }
.carico-nome { margin: 0 0 4px; font-size: 15px; letter-spacing: 0.02em; color: var(--riga); display: flex; align-items: center; gap: 10px; }
.carico-nome::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--rosso); }
.carico-titolo { font: 600 clamp(34px, 7vw, 56px)/1.02 var(--titoli); margin: 0 0 16px; }
.carico-stato { margin: 0 0 12px; font-size: 17px; line-height: 1.45; }
.carico-barra { height: 4px; background: rgba(242, 238, 228, 0.2); margin: 0 0 20px; }
.carico-barra span { display: block; height: 100%; width: 0; background: var(--pietra); transition: width 200ms linear; }
.carico.pronto .carico-barra { display: none; }
.carico-nota { margin: 14px 0 0; font-size: 15px; color: var(--riga); }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.hud[hidden] { display: none; }
.hud button, .hud a, .hud .tocco, .hud .levetta, .hud .ali { pointer-events: auto; }
.hud-alto { position: absolute; top: calc(10px + var(--sa-t)); left: calc(10px + var(--sa-l)); right: calc(10px + var(--sa-r)); display: flex; align-items: flex-start; gap: 10px; }
.hud-gara { background: rgba(15, 42, 58, 0.78); padding: 8px 14px 9px; display: flex; gap: 18px; align-items: baseline; }
.hud-gara[hidden], .hud-punti[hidden] { display: none; }
.hud-gara p, .hud-punti { margin: 0; font-variant-numeric: tabular-nums; }
.hud-anelli { font-size: 26px; font-weight: 700; }
.hud-tempo { font-size: 22px; font-weight: 600; }
.hud-di { font-size: 15px; font-weight: 400; color: #d7dde0; }
.hud-punti { background: rgba(15, 42, 58, 0.78); padding: 8px 14px 9px; font-size: 26px; font-weight: 700; }
.hud-tasti { margin-left: auto; display: flex; gap: 6px; }
.hud-avviso { position: absolute; left: 50%; top: calc(76px + var(--sa-t)); transform: translateX(-50%); margin: 0; padding: 9px 16px; background: var(--pietra); color: var(--inchiostro); font-size: 17px; font-weight: 600; max-width: min(92vw, 40rem); text-align: center; opacity: 0; transition: opacity 400ms var(--planata); }
.hud-avviso.vivo { opacity: 1; }
.hud-esito { position: absolute; left: 50%; top: 38%; transform: translate(-50%, 0); margin: 0; font: 700 34px/1 var(--testo); color: var(--pietra); opacity: 0; white-space: nowrap; }
.hud-esito.vivo { animation: esito 1.5s var(--planata) forwards; }
@keyframes esito { 0% { opacity: 0; transform: translate(-50%, 10px); } 15% { opacity: 1; transform: translate(-50%, 0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -24px); } }
.hud-freccia { position: absolute; width: 52px; height: 52px; transform: translate(-50%, -50%); }
.hud-freccia-m { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; padding: 1px 6px; background: rgba(15, 42, 58, 0.78); color: var(--pietra); font: 600 14px/1.3 var(--testo); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hud-freccia[hidden] { display: none; }
.hud-freccia svg { width: 100%; height: 100%; fill: none; stroke: var(--pietra); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.hud-freccia svg circle { fill: var(--rosso); stroke: var(--pietra); stroke-width: 2; }
.hud-mappa { position: absolute; left: calc(12px + var(--sa-l)); bottom: calc(64px + var(--sa-b)); width: 140px; height: 140px; border-radius: 50%; background: rgba(15, 42, 58, 0.72); border: 2px solid rgba(242, 238, 228, 0.7); }
.con-tocco .hud-mappa { top: calc(70px + var(--sa-t)); bottom: auto; width: 104px; height: 104px; }
.testa-anteprima { position: absolute; right: calc(12px + var(--sa-r)); bottom: calc(64px + var(--sa-b)); width: 132px; aspect-ratio: 4 / 3; background: var(--inchiostro); border: 2px solid var(--pietra); overflow: hidden; }
.testa-anteprima[hidden] { display: none; }
.con-tocco .testa-anteprima { top: calc(122px + var(--sa-t)); bottom: auto; width: 104px; }
.testa-anteprima video, .testa-anteprima canvas { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.hud-demo .hud-tasti { display: none; }

/* comandi al tocco */
.tocco { display: none; position: absolute; left: 0; right: 0; bottom: calc(66px + var(--sa-b)); height: 46%; pointer-events: none; }
.con-tocco .tocco { display: block; }
.levetta { position: absolute; left: 0; bottom: 0; width: 58%; height: 100%; touch-action: none; }
.levetta-base { position: absolute; left: calc(var(--x, 96px) - 60px); top: calc(var(--y, 70%) - 60px); width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(242, 238, 228, 0.75); background: rgba(15, 42, 58, 0.35); opacity: 0.55; }
.levetta:not(.attiva) .levetta-base { left: calc(28px + var(--sa-l)); top: auto; bottom: 18px; }
.levetta.attiva .levetta-base { opacity: 1; }
.levetta-pomo { position: absolute; left: 34px; top: 34px; width: 48px; height: 48px; border-radius: 50%; background: var(--pietra); }
.ali { position: absolute; right: calc(22px + var(--sa-r)); bottom: 18px; width: 96px; height: 96px; border-radius: 50%; border: 2px solid var(--pietra); background: rgba(15, 42, 58, 0.55); color: var(--pietra); font: 700 18px var(--testo); touch-action: none; }
.ali.premuto { background: var(--pietra); color: var(--inchiostro); }

/* pannelli */
.pannello { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: calc(16px + var(--sa-t)) calc(16px + var(--sa-r)) calc(64px + var(--sa-b)) calc(16px + var(--sa-l)); background: rgba(15, 42, 58, 0.5); overflow-y: auto; touch-action: pan-y; user-select: text; -webkit-user-select: text; }
.pannello[hidden] { display: none; }
.pannello-corpo { width: min(36rem, 100%); background: var(--pietra); color: var(--inchiostro); padding: 24px 24px 22px; border-top: 6px solid var(--inchiostro); }
.pannello h2 { font: 600 34px/1.05 var(--titoli); margin: 0 0 14px; }
.pannello p { font-size: 17px; line-height: 1.5; margin: 0 0 12px; }
.pannello .tasto { border-color: var(--inchiostro); color: var(--inchiostro); }
.pannello .tasto:hover { background: rgba(15, 42, 58, 0.08); }
.pannello .tasto-pieno { background: var(--inchiostro); color: var(--pietra); }
.pannello .tasto-pieno:hover { background: #1a3d52; }
.pannello-azioni { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.comandi-elenco { margin: 18px 0 8px; padding: 14px 0 0; border-top: 1px solid var(--riga); display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 15px; line-height: 1.45; }
.comandi-elenco dt { font-weight: 700; } .comandi-elenco dd { margin: 0; }
.pannello-opzioni { display: flex; flex-wrap: wrap; gap: 8px 18px; border-top: 1px solid var(--riga); padding-top: 12px; margin-top: 12px; font-size: 15px; }
.scelta { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.scelta input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--inchiostro); }
.scelta select { font: 15px var(--testo); min-height: 40px; border: 1px solid var(--inchiostro); background: #fff; color: var(--inchiostro); border-radius: 0; padding: 0 8px; }
.pannello-link { font-size: 15px !important; margin-top: 12px !important; }
.pannello-link a { color: var(--inchiostro); text-underline-offset: 3px; display: inline-block; min-height: 44px; line-height: 44px; }
.testa-stato { font-weight: 600; min-height: 1.5em; }
.arrivo-punti { font: 700 52px/1 var(--titoli) !important; margin: 4px 0 12px !important; }
.arrivo-punti span { font-variant-numeric: tabular-nums; }
.arrivo-conti { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: 16px; border-top: 1px solid var(--riga); padding-top: 10px; }
.arrivo-conti dt { color: var(--mantello); } .arrivo-conti dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.arrivo-record { font-weight: 600; }
.arrivo-form { border-top: 1px solid var(--riga); padding-top: 14px; margin-top: 6px; }
.arrivo-form[hidden] { display: none; }
.arrivo-form label { font-weight: 700; display: block; margin-bottom: 8px; }
.arrivo-riga { display: flex; flex-wrap: wrap; gap: 8px; }
.arrivo-riga input { flex: 1 1 12rem; min-height: 48px; font: 18px var(--testo); padding: 8px 12px; border: 2px solid var(--inchiostro); border-radius: 0; background: #fff; color: var(--inchiostro); }
.nota { font-size: 15px !important; color: var(--mantello); margin: 8px 0 0 !important; }
.errore { color: var(--rosso-testo); font-weight: 700; font-size: 16px !important; min-height: 1.4em; margin: 6px 0 0 !important; }

/* avviso obbligatorio, sempre visibile */
.avviso-ai { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; z-index: 7; padding: 7px calc(12px + var(--sa-r)) calc(7px + var(--sa-b)) calc(12px + var(--sa-l)); background: rgba(15, 42, 58, 0.86); color: var(--pietra); font-size: 14px; line-height: 1.35; text-align: center; }
.senza-js { position: fixed; inset: auto 16px 80px; background: var(--pietra); color: var(--inchiostro); padding: 16px; font-size: 17px; }

@media (max-width: 560px) {
  .hud-anelli, .hud-punti { font-size: 21px; } .hud-tempo { font-size: 18px; }
  .hud-gara { gap: 10px; padding: 6px 10px; } .hud-punti { padding: 6px 10px; }
  .hud-tasti { gap: 4px; } .tasto-icona { width: 44px; height: 44px; }
  .hud-alto { flex-wrap: wrap; }
  .hud-avviso { top: calc(186px + var(--sa-t)); font-size: 15px; }
  .pannello h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .hud-esito.vivo { animation: none; opacity: 1; }
  .hud-avviso, .tasto, .carico-barra span { transition: none; }
}

/* partenza: due modi di pilotare, una riga che spiega il cronometro */
.carico-azioni { display: flex; flex-wrap: wrap; gap: 10px; }
.carico-azioni[hidden], .carico-come[hidden] { display: none; }
.carico-come { margin: 14px 0 0; font-size: 15px; line-height: 1.45; color: #d7dde0; max-width: 30rem; }
/* etichette dei tasti dello HUD sugli schermi larghi */
.tasto-etichetta { display: none; }
@media (min-width: 900px) {
  .tasto-icona { width: auto; min-width: 48px; padding: 0 12px 0 10px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
  .tasto-etichetta { display: inline; font: 600 15px var(--testo); }
}
/* esito dell'invio alla classifica: pieno, non spento */
.pannello .tasto-pieno.fatto, .pannello .tasto-pieno.fatto[disabled] { opacity: 1; background: var(--leccio); color: var(--pietra); cursor: default; }
