    /* --- Tema Synthwave: fucsia, ciano e giallo su nero-viola --- */
    :root {
        --pink: #ff2bd6; --cyan: #00f0ff; --yellow: #ffe600; --ink: #0b0614; --ink2: #170a2b;
        --s: 1;                                        /* su desktop grande l'interfaccia cresce (la imposta musicbox.js) */
        --gap: 8px;
        --dash-h: calc(58px * var(--s));
        --ans-h: calc(128px * var(--s));
        --bar-h: 0px;                                  /* altezza della barra pulsanti quando sta sopra (touch) */
    }
    html.has-touch { --bar-h: 56px; --ans-h: 168px; }
    html.has-touch #utility-bar { position: static; order: -1; margin-top: 4px; }

    body { background: #0a0612; }
    .game-wrapper { height: var(--app-h, 100vh); height: var(--app-h, 100dvh); gap: var(--gap); padding: 4px 0; overflow: hidden; }
    .stage {
        --ar: 1.3333;                                  /* larghezza / altezza del canvas (la imposta musicbox.js) */
        --h: min(2400px, calc(var(--app-h, 100vh) - var(--dash-h) - var(--ans-h) - var(--bar-h) - var(--gap) * 2 - 14px), calc(100vw / var(--ar)));
        width: calc(var(--h) * var(--ar));
        flex: none;
        display: flex;
        flex-direction: column;
        gap: var(--gap);
    }
    @supports (height: 100dvh) {
        .stage { --h: min(2400px, calc(var(--app-h, 100dvh) - var(--dash-h) - var(--ans-h) - var(--bar-h) - var(--gap) * 2 - 14px), calc(100vw / var(--ar))); }
    }
    #crt-container { width: 100%; height: var(--h); max-width: none; max-height: none; flex: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; background: var(--ink); box-shadow: 0 0 22px rgba(255, 43, 214, 0.25); }
    #gameCanvas { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; image-rendering: auto; }
    #start-screen { background-color: rgba(8, 3, 18, 0.93); }

    /* Telefono in orizzontale: campo a sinistra, dashboard e risposte in colonna a destra */
    @media (orientation: landscape) and (max-height: 520px) {
        :root { --dash-h: 58px; }
        .game-wrapper { flex-direction: row; justify-content: center; align-items: center; padding: 4px; }
        .stage {
            --side-w: min(360px, 42vw);
            --h: min(calc(var(--app-h, 100vh) - 8px), calc((100vw - var(--side-w) - 24px) / var(--ar)));
            width: calc(var(--h) * var(--ar) + var(--side-w) + var(--gap));
            height: var(--h);
            display: grid;
            grid-template-columns: calc(var(--h) * var(--ar)) var(--side-w);
            grid-template-rows: 56px var(--dash-h) minmax(0, 1fr);
            grid-template-areas: "cv bar" "cv dash" "cv ans";
            column-gap: var(--gap);
            row-gap: var(--gap);
        }
        @supports (height: 100dvh) {
            .stage { --h: min(calc(var(--app-h, 100dvh) - 8px), calc((100vw - var(--side-w) - 24px) / var(--ar))); }
        }
        #crt-container { grid-area: cv; }
        #dashboard { grid-area: dash; }
        #answers { grid-area: ans; height: auto; }
        #utility-bar, html.has-touch #utility-bar, html.bar-side #utility-bar {
            position: absolute; top: 4px; right: 4px; left: auto; order: 0; margin: 0; flex-direction: row;
        }
    }

    /* --- Dashboard --- */
    .dash {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr) auto;
        height: var(--dash-h);
        border: 2px solid #6a1a86;
        background: var(--ink);
        box-shadow: inset 0 0 14px rgba(255, 43, 214, 0.14);
        overflow: hidden;
        font-size: calc(16px * var(--s));
    }
    .dash-cell { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 0.7em; border-right: 1px solid #3a1450; }
    .dash-cell:last-child { border-right: 0; }
    .dash .lbl { font-size: 0.6em; letter-spacing: 0.14em; color: #b46ad0; line-height: 1.2; }
    .dash strong { display: block; font-size: 1.4em; line-height: 1.1; color: var(--cyan); text-shadow: 0 0 8px rgba(0, 240, 255, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dash-place strong { font-size: 1.1em; color: var(--yellow); text-shadow: 0 0 8px rgba(255, 230, 0, 0.55); }
    .dash-place strong.long { font-size: 0.9em; }
    .dash-place strong.masked { color: #7a4a96; text-shadow: none; letter-spacing: 0.18em; }
    #hud-sub { display: block; min-height: 1.1em; font-size: 0.62em; line-height: 1.2; color: #e3b8f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #hud-lives { display: flex; gap: 0.3em; align-items: center; height: 1.6em; }
    #hud-lives svg { width: 1.6em; height: 1.4em; display: block; }
    #hud-lives svg.lost .heart { display: none; }
    #hud-lives svg:not(.lost) .cross { display: none; }
    #hud-lives svg.gain { animation: heartGain 0.7s ease-out; }
    #hud-lives svg.hit { animation: heartHit 0.45s ease-out; }
    @keyframes heartGain { 0% { transform: scale(2.2); filter: brightness(3); } 100% { transform: scale(1); filter: none; } }
    @keyframes heartHit { 0% { transform: scale(1.5) rotate(-12deg); } 40% { transform: scale(0.8) rotate(10deg); } 100% { transform: scale(1); } }
    #hud-score.bump { animation: scoreBump 0.35s ease-out; }
    @keyframes scoreBump { 0% { transform: scale(1.35); color: #fff; } 100% { transform: scale(1); } }

    /* --- Griglia risposte 2x2 --- */
    .answers { position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(0, 1fr); gap: var(--gap); height: var(--ans-h); transition: opacity 0.2s; }
    .answers.waiting .ans { opacity: 0.45; filter: saturate(0.5); }
    .ans {
        position: relative;
        height: 100%;
        display: flex;
        align-items: center;
        gap: 0.6em;
        text-align: left;
        padding: 0.3em 0.7em;
        font-family: 'Courier New', Courier, monospace;
        font-weight: bold;
        font-size: calc(17px * var(--s));
        line-height: 1.15;
        color: #e8f9ff;
        background: #0e0720;
        border: 3px solid #7a1f96;
        border-radius: 6px;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.08s, background 0.1s, border-color 0.1s;
    }
    .ans .key { flex: none; display: grid; place-items: center; width: 1.8em; height: 1.8em; border: 2px solid currentColor; border-radius: 4px; font-size: 0.85em; color: var(--pink); }
    .ans .txt { min-width: 0; overflow-wrap: break-word; hyphens: manual; }
    @media (max-width: 520px) {
        .ans { gap: 0.4em; padding: 0.3em 0.45em; }
        .ans .key { width: 1.5em; height: 1.5em; font-size: 0.8em; }
        .ans .txt { font-size: 0.92em; }
    }
    .ans:hover, .ans.sel { border-color: var(--cyan); background: #16103a; box-shadow: 0 0 12px rgba(0, 240, 255, 0.55); }
    .ans:hover .key, .ans.sel .key { color: var(--cyan); }
    .ans:active { transform: scale(0.97); background: #241a58; }
    .answers.locked .ans { pointer-events: none; }
    .ans.ok { background: #39ff14; color: #02200a; border-color: #fff; box-shadow: 0 0 26px #39ff14; }
    .ans.ok .key { color: #02200a; }
    .ans.bad { background: #ff2d4a; color: #fff; border-color: #fff; box-shadow: 0 0 26px #ff2d4a; animation: ansShake 0.3s; }
    .ans.bad .key { color: #fff; }
    .ans.reveal { border-color: #39ff14; box-shadow: 0 0 18px #39ff14; animation: ansPulse 0.5s 3; }
    .ans.dim { opacity: 0.4; }
    @keyframes ansShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
    @keyframes ansPulse { 50% { background: #14461c; } }

    /* --- Dashboard su telefono/tablet ---
       La dashboard e' larga quanto il campo (a volte meno di 280 px). La colonna PUNTI prende sempre lo spazio che serve al punteggio
       (riserva 6 caratteri, "99.999"), le VITE non si stringono e lo stile cede il resto; il carattere si adatta alla larghezza in
       musicbox.js (fitDash). Con spazio a sufficienza le colonne restano quelle di sempre. Sul desktop nulla cambia. */
    html.ib-m .dash { grid-template-columns: minmax(max-content, 1fr) minmax(7em, 1.9fr) max-content; }
    html.ib-m #hud-score { min-width: calc(var(--score-ch, 6) * 1ch); }
    html.ib-m .dash-place .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.05em; }

    /* --- Esito del round su telefono e tablet: box HTML al posto dei 4 bottoni (testo nitido e leggibile) ---
       Su desktop resta il pannello disegnato nel canvas. La dimensione del testo (--rf) la sceglie musicbox.js. */
    .res-box { display: none; }
    html.ib-m .res-box.show {
        position: absolute; inset: 0; z-index: 2;
        display: flex; flex-direction: column; justify-content: center; gap: 0.3em;
        box-sizing: border-box; padding: 6px 10px; overflow: hidden;
        font-family: 'Courier New', Courier, monospace; font-size: var(--rf, 13px); line-height: 1.28;
        background: rgba(8, 3, 18, 0.98); border: 3px solid var(--rc, #ff2d4a); border-radius: 6px;
        box-shadow: 0 0 16px var(--rc, #ff2d4a), inset 0 0 18px rgba(0, 0, 0, 0.7);
        cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none; user-select: none;
        animation: resIn 0.28s ease-out 0.25s both;
    }
    html.ib-m .res-box.tight { line-height: 1.12; gap: 0.12em; padding-top: 3px; padding-bottom: 3px; }
    .res-box.ok { --rc: #39ff14; }
    .res-box.bad { --rc: #ff2d4a; }
    .res-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 0.8em; }
    .res-title { font-size: 1.55em; font-weight: bold; line-height: 1.15; color: var(--rc, #ff2d4a); text-shadow: 0 0 8px var(--rc, #ff2d4a); }
    .res-sub { font-size: 0.95em; font-weight: bold; color: var(--yellow); }
    .res-name { font-size: 1.12em; font-weight: bold; line-height: 1.2; color: #fff; text-transform: uppercase; overflow-wrap: anywhere; }
    .res-place { color: #e3b8f5; }
    .res-refs { font-size: 1em; font-weight: bold; color: var(--cyan); overflow-wrap: anywhere; }
    .res-fact { font-size: 1em; color: #e3d3f5; overflow-wrap: anywhere; }
    /* con il box in vista i bottoni sotto si spengono (dopo mezzo secondo, il tempo di vedere il rosso/verde) */
    html.ib-m .answers.boxed .ans { opacity: 0 !important; transition: opacity 0.2s ease 0.5s; }
    @keyframes resIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
    @media (prefers-reduced-motion: reduce) { html.ib-m .res-box.show { animation: none; } }

    /* --- Tasto PLAY (all'inizio di ogni round: serve anche a sbloccare l'audio del browser) --- */
    #play-wrap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; text-align: center; width: 90%; pointer-events: none; }
    #btn-play {
        pointer-events: auto;
        height: auto; line-height: 1.1; white-space: nowrap;
        font-family: 'Courier New', Courier, monospace; font-weight: bold;
        font-size: max(18px, calc(var(--h) * 0.075));
        letter-spacing: 0.08em;
        padding: 0.45em 1.3em;
        color: var(--ink); background: var(--pink);
        border: 3px solid #fff; border-radius: 10px;
        cursor: pointer;
        box-shadow: 0 0 20px var(--pink), 0 0 50px rgba(255, 43, 214, 0.55);
        animation: playPulse 1.1s ease-in-out infinite;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    #btn-play:hover { background: #ff6ee6; }
    #btn-play:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
    #play-hint { display: inline-block; margin-top: 0.7em; padding: 0.25em 0.8em; background: rgba(8, 3, 18, 0.78); border-radius: 4px; font-size: max(11px, calc(var(--h) * 0.026)); color: var(--yellow); text-shadow: 0 0 6px rgba(255, 230, 0, 0.6); }
    @keyframes playPulse {
        0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--pink), 0 0 50px rgba(255, 43, 214, 0.55); }
        50% { transform: scale(1.08); box-shadow: 0 0 32px var(--pink), 0 0 80px rgba(255, 43, 214, 0.8); }
    }
    @media (prefers-reduced-motion: reduce) { #btn-play { animation: none; } }

    /* --- Schermate (iniziale, pausa, finale) --- */
    .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
