/* TILT! Il Flipper che si Sveglia: comandi touch (come InsertBit Pinball), schermata iniziale, coroncina in classifica */
    /* Controlli Mobile (Touch): tre tasti neon. SX e DX = flipper, LANCIA = molla (tieni premuto e rilascia) */
    #mobile-pinball-controls {
        display: none;
        width: 100%;
        height: 80px;
        margin-top: 10px;
        position: relative;
    }
    .touch-zone {
        position: absolute;
        top: 0;
        height: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-family: 'Courier New', monospace;
        font-weight: bold;
        font-size: 20px;
        line-height: 1;
        letter-spacing: 1px;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: none; /* Previene lo scroll */
        --tz: 57, 255, 20;
        color: rgb(var(--tz));
        background: rgba(10, 10, 14, 0.82);
        border: 2px solid rgba(var(--tz), 0.75);
        border-radius: 12px;
        box-shadow: 0 0 8px rgba(var(--tz), 0.25), inset 0 0 14px rgba(var(--tz), 0.12);
        text-shadow: 0 0 6px rgba(var(--tz), 0.8);
        transition: background 0.06s linear, box-shadow 0.06s linear, transform 0.06s linear;
    }
    .touch-zone .tz-ico { font-size: 1.5em; }
    .touch-zone .tz-lbl { font-size: 1em; }
    .touch-zone.on {
        background: rgba(var(--tz), 0.3);
        box-shadow: 0 0 18px rgba(var(--tz), 0.7), inset 0 0 22px rgba(var(--tz), 0.35);
        transform: scale(0.97);
        color: #fff;
    }
    #touch-left { left: 0; width: 40%; }
    #touch-right { left: 40%; width: 40%; }
    #touch-plunger {
        right: 0; width: 18%;
        --tz: 255, 170, 0;
        --charge: 0;
        /* barra di carica della molla: sale dal basso mentre tieni premuto */
        background:
            linear-gradient(to top, rgba(255, 170, 0, 0.62) 0, rgba(255, 170, 0, 0.62) calc(var(--charge, 0) * 100%), rgba(255, 170, 0, 0) calc(var(--charge, 0) * 100%)),
            rgba(10, 10, 14, 0.82);
        font-size: 15px;
        letter-spacing: 0;
    }
    #touch-plunger.on { background:
            linear-gradient(to top, rgba(255, 170, 0, 0.85) 0, rgba(255, 170, 0, 0.85) calc(var(--charge, 0) * 100%), rgba(255, 170, 0, 0.18) calc(var(--charge, 0) * 100%)),
            rgba(10, 10, 14, 0.82); }

    @media (max-width: 768px) {
        #mobile-pinball-controls { display: block; }
    }

    /* ---- Telefono in verticale: striscia sotto il tavolo, tre tasti affiancati ----
       (selettori piu' specifici di quelli di mobile.css, che viene caricato dopo) */
    html.ib-m.ib-flow:not(.ib-land) body #mobile-pinball-controls {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
        height: 78px;
        max-width: 600px;
        margin: 0 auto;
        padding: 4px 10px 6px;
    }
    html.ib-m.ib-flow:not(.ib-land) body #mobile-pinball-controls .touch-zone {
        position: relative;
        top: auto; left: auto; right: auto;
        width: auto;
        height: auto;
        min-height: 0;
        font-size: 17px;
    }
    html.ib-m.ib-flow:not(.ib-land) body #mobile-pinball-controls #touch-left,
    html.ib-m.ib-flow:not(.ib-land) body #mobile-pinball-controls #touch-right { flex: 1 1 0; }
    html.ib-m.ib-flow:not(.ib-land) body #mobile-pinball-controls #touch-plunger { flex: 0 0 27%; font-size: 14px; }

    /* ---- Telefono in orizzontale: i tasti restano due meta' trasparenti sopra la parte bassa dello schermo ---- */
    html.ib-land.ib-flow body #mobile-pinball-controls .touch-zone {
        position: absolute;
        top: 6px; bottom: 6px; height: auto;
        background: rgba(255, 255, 255, 0.03);
        border: 2px dashed rgba(var(--tz), 0.32);
        box-shadow: none;
        color: rgba(var(--tz), 0.55);
        text-shadow: none;
        font-size: 16px;
    }
    html.ib-land.ib-flow body #mobile-pinball-controls #touch-left { left: 6px; right: auto; width: calc(39% - 6px); }
    html.ib-land.ib-flow body #mobile-pinball-controls #touch-right { left: 40.5%; right: auto; width: calc(39% - 6px); }
    html.ib-land.ib-flow body #mobile-pinball-controls #touch-plunger {
        left: auto; right: 6px; width: calc(19% - 6px);
        background:
            linear-gradient(to top, rgba(255, 170, 0, 0.55) 0, rgba(255, 170, 0, 0.55) calc(var(--charge, 0) * 100%), rgba(255, 170, 0, 0) calc(var(--charge, 0) * 100%)),
            rgba(255, 170, 0, 0.05);
        opacity: 1;
        font-size: 14px;
    }
    html.ib-land.ib-flow body #mobile-pinball-controls .touch-zone.on {
        background: rgba(var(--tz), 0.22);
        border-style: solid;
        border-color: rgba(var(--tz), 0.9);
        color: #fff;
    }
    html.ib-land.ib-flow body #mobile-pinball-controls #touch-plunger.on {
        background:
            linear-gradient(to top, rgba(255, 170, 0, 0.8) 0, rgba(255, 170, 0, 0.8) calc(var(--charge, 0) * 100%), rgba(255, 170, 0, 0.12) calc(var(--charge, 0) * 100%));
    }

    /* ---- TILT!: schermata iniziale ---- */
    .tilt-box .tilt-logo {
        font-size: 3.2rem; letter-spacing: 6px; margin: 0;
        color: #ffd24a;
        text-shadow: 0 0 6px #ff8a3d, 0 0 18px #ff3b8a, 3px 3px 0 #3a0a2a;
        animation: tilt-wobble 2.6s ease-in-out infinite;
    }
    .tilt-box h3 { color: #4ab8ff; letter-spacing: 2px; }
    .tilt-keys { margin: 10px 0 0; font-size: 0.78rem; color: #b8b8c8; text-align: center; line-height: 1.4; }
    .tilt-keys .k-touch { display: none; }
    html.ib-m .tilt-keys .k-pc { display: none; }
    html.ib-m .tilt-keys .k-touch { display: inline; }
    .tilt-start { margin-top: 14px; }
    .tilt-back { display: block; margin-top: 12px; font-size: 13px; color: #8aa; text-decoration: none; letter-spacing: 1px; }
    .tilt-back:hover, .tilt-back:focus-visible { color: #fff; text-decoration: underline; }
    @keyframes tilt-wobble {
        0%, 100% { transform: rotate(-2deg); }
        50% { transform: rotate(2deg) scale(1.04); }
    }
    @media (prefers-reduced-motion: reduce) { .tilt-box .tilt-logo { animation: none; } }

    /* coroncina in classifica per chi supera i 3.000.000 */
    .tilt-crown { margin-left: 4px; filter: drop-shadow(0 0 4px #ffd700); }

    /* Schermi stretti: menu iniziale piu' compatto */
    @media (max-width: 420px) {
        .tilt-box .tilt-logo { font-size: 2.5rem; letter-spacing: 4px; }
    }
