﻿:root {
    --arcade-background: #01040a;
    --arcade-panel: rgba(5, 15, 27, 0.88);
    --arcade-cyan: #73e4ff;
    --arcade-blue: #168cff;
    --arcade-purple: #8957ff;
    --arcade-white: #eefcff;
    --arcade-muted: rgba(206, 238, 248, 0.55);
    --arcade-border: rgba(107, 218, 255, 0.22);
}

html.arcade-loading,
body.arcade-loading {
    overflow: hidden;
}

.arcade-loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 22px;
    overflow: hidden;
    background: radial-gradient( circle at 50% 35%, rgba(15, 116, 210, 0.2), transparent 42% ), linear-gradient( 145deg, #06101c, var(--arcade-background) 58%, #000 );
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

    .arcade-loader.is-leaving {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

.arcade-background {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px), radial-gradient(circle, #6fdfff 0 1px, transparent 1.5px);
    background-position: 0 0, 40px 70px;
    background-size: 130px 130px, 190px 190px;
    opacity: 0.22;
    animation: arcade-stars 30s linear infinite;
}

    .arcade-background::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient( rgba(91, 208, 255, 0.018) 1px, transparent 1px ), linear-gradient( 90deg, rgba(91, 208, 255, 0.018) 1px, transparent 1px );
        background-size: 42px 42px;
        mask-image: radial-gradient( circle at center, #000, transparent 78% );
    }

.arcade-shell {
    position: relative;
    z-index: 2;
    width: min(920px, 100%);
    padding: 22px;
    border: 1px solid var(--arcade-border);
    border-radius: 20px;
    background: var(--arcade-panel);
    box-shadow: 0 0 60px rgba(0, 116, 255, 0.14), inset 0 0 40px rgba(76, 199, 255, 0.025);
    backdrop-filter: blur(18px);
}

.arcade-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.arcade-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(115, 228, 255, 0.65)) drop-shadow(0 0 18px rgba(22, 140, 255, 0.35));
}

.arcade-heading h1 {
    margin: 3px 0 0;
    color: var(--arcade-white);
    font-family: Arial, sans-serif;
    font-size: clamp(18px, 3vw, 28px);
    letter-spacing: 0.02em;
}

.arcade-kicker {
    color: var(--arcade-cyan);
    font-family: "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 0.24em;
}

.arcade-system-status {
    padding: 8px 11px;
    border: 1px solid rgba(115, 228, 255, 0.22);
    border-radius: 100px;
    color: var(--arcade-cyan);
    background: rgba(31, 160, 255, 0.07);
    font-family: "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

    .arcade-system-status.is-ready {
        border-color: rgba(84, 255, 175, 0.35);
        color: #72ffbd;
        background: rgba(33, 255, 153, 0.07);
    }

.arcade-hud {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

    .arcade-hud div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 9px 12px;
        border: 1px solid rgba(105, 214, 255, 0.1);
        background: rgba(9, 28, 47, 0.62);
        color: var(--arcade-muted);
        font-family: "Courier New", monospace;
        font-size: 9px;
        letter-spacing: 0.12em;
    }

    .arcade-hud strong {
        color: var(--arcade-white);
        font-size: 12px;
    }

.arcade-game-container {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(105, 214, 255, 0.19);
    border-radius: 12px;
    background: radial-gradient( circle at 50% 100%, rgba(14, 93, 170, 0.14), transparent 52% ), #01060c;
    box-shadow: inset 0 0 40px rgba(0, 116, 255, 0.1), 0 0 24px rgba(0, 116, 255, 0.08);
}

#arcade-game {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 12 / 7;
    touch-action: none;
    image-rendering: pixelated;
}

.arcade-game-container::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient( 0deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 4px );
}

.arcade-message {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(0, 4, 10, 0.8);
    backdrop-filter: blur(6px);
    color: var(--arcade-white);
    font-family: "Courier New", monospace;
    font-size: clamp(20px, 4vw, 38px);
    letter-spacing: 0.2em;
}

.arcade-mobile-controls {
    display: none;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 8px;
    margin-top: 9px;
}

    .arcade-mobile-controls button {
        min-height: 48px;
        border: 1px solid rgba(111, 223, 255, 0.25);
        border-radius: 8px;
        color: var(--arcade-cyan);
        background: rgba(15, 71, 112, 0.25);
        font-family: "Courier New", monospace;
        font-weight: bold;
        touch-action: manipulation;
    }

        .arcade-mobile-controls button:active {
            background: rgba(37, 151, 225, 0.35);
            transform: scale(0.97);
        }

.arcade-loading-panel {
    margin-top: 17px;
}

.arcade-progress-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 8px;
    color: var(--arcade-muted);
    font-family: "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 0.13em;
}

.arcade-progress-track {
    height: 3px;
    overflow: hidden;
    background: rgba(111, 223, 255, 0.09);
}

.arcade-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient( 90deg, var(--arcade-purple), var(--arcade-blue), var(--arcade-cyan), #fff );
    box-shadow: 0 0 8px rgba(91, 219, 255, 0.9), 0 0 18px rgba(24, 143, 255, 0.55);
    transition: width 0.3s ease;
}

.arcade-ready-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid rgba(89, 255, 182, 0.2);
    border-radius: 10px;
    background: rgba(27, 130, 91, 0.08);
    animation: arcade-ready-in 0.5s ease;
}

    .arcade-ready-panel > div:first-child {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .arcade-ready-panel strong,
    .arcade-ready-panel small {
        display: block;
    }

    .arcade-ready-panel strong {
        color: #78ffc1;
        font-family: "Courier New", monospace;
        font-size: 11px;
        letter-spacing: 0.13em;
    }

    .arcade-ready-panel small {
        margin-top: 3px;
        color: var(--arcade-muted);
    }

.arcade-ready-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #65ffb2;
    box-shadow: 0 0 8px #65ffb2, 0 0 20px rgba(101, 255, 178, 0.65);
    animation: arcade-ready-pulse 1.3s ease-in-out infinite;
}

.arcade-ready-actions {
    display: flex;
    gap: 9px;
}

.arcade-primary-button,
.arcade-secondary-button,
.arcade-floating-enter {
    min-height: 42px;
    padding: 0 17px;
    border-radius: 7px;
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.arcade-primary-button {
    border: 1px solid var(--arcade-cyan);
    color: #00121d;
    background: var(--arcade-cyan);
    box-shadow: 0 0 18px rgba(115, 228, 255, 0.24);
}

.arcade-secondary-button {
    border: 1px solid rgba(115, 228, 255, 0.3);
    color: var(--arcade-cyan);
    background: rgba(12, 67, 105, 0.22);
}

    .arcade-primary-button:hover,
    .arcade-secondary-button:hover,
    .arcade-floating-enter:hover {
        transform: translateY(-2px);
    }

.arcade-instructions {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 13px;
    color: rgba(201, 231, 241, 0.34);
    font-family: "Courier New", monospace;
    font-size: 8px;
    letter-spacing: 0.12em;
}

.arcade-floating-enter {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(101, 255, 178, 0.45);
    color: #7dffc3;
    background: rgba(3, 26, 23, 0.87);
    box-shadow: 0 0 20px rgba(101, 255, 178, 0.12);
    backdrop-filter: blur(12px);
}

    .arcade-floating-enter span {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #72ffbd;
        box-shadow: 0 0 8px #72ffbd;
    }

.is-hidden {
    display: none !important;
}

@keyframes arcade-stars {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(130px);
    }
}

@keyframes arcade-ready-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes arcade-ready-pulse {
    0%, 100% {
        opacity: 0.45;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@media (max-width: 700px) {
    .arcade-loader {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .arcade-shell {
        margin: auto 0;
        padding: 14px;
        border-radius: 14px;
    }

    .arcade-header {
        grid-template-columns: auto 1fr;
    }

    .arcade-system-status {
        display: none;
    }

    .arcade-logo {
        width: 42px;
        height: 42px;
    }

    .arcade-mobile-controls {
        display: grid;
    }

    .arcade-ready-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .arcade-ready-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

        .arcade-ready-actions button {
            padding: 0 10px;
        }

    .arcade-instructions {
        display: none;
    }

    .arcade-floating-enter {
        top: 12px;
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arcade-background,
    .arcade-ready-dot {
        animation: none;
    }
}

/* ========================================================================== */
/* GRALDEV ARCADE - INTEGRAZIONE CORRETTA                                     */
/* ========================================================================== */

.arcade-loader {
    padding:
        max(10px, env(safe-area-inset-top))
        max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom))
        max(10px, env(safe-area-inset-left));
}

.arcade-shell {
    max-height: calc(
        100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px
    );
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(115, 228, 255, 0.25) transparent;
}

.arcade-game-container {
    min-height: 0;
}

.arcade-start-screen {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 38px);
    overflow-y: auto;
    background:
        radial-gradient(circle at 50% 38%, rgba(17, 119, 216, 0.25), transparent 50%),
        rgba(0, 5, 12, 0.94);
    backdrop-filter: blur(10px);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.arcade-start-screen.is-starting {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.arcade-start-content {
    width: min(540px, 100%);
    margin: auto;
    text-align: center;
}

.arcade-start-kicker {
    color: var(--arcade-cyan);
    font-family: "Courier New", monospace;
    font-size: clamp(8px, 1.6vw, 10px);
    letter-spacing: 0.25em;
}

.arcade-start-content h2 {
    margin: 8px 0 10px;
    color: var(--arcade-white);
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(24px, 5vw, 42px);
    line-height: 1.05;
    text-shadow: 0 0 18px rgba(78, 202, 255, 0.35);
}

.arcade-start-description {
    max-width: 460px;
    margin: 0 auto 22px;
    color: rgba(218, 242, 250, 0.68);
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(12px, 2.1vw, 15px);
    line-height: 1.55;
}

.arcade-desktop-instructions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.arcade-command {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 82px;
    padding: 12px;
    border: 1px solid rgba(111, 223, 255, 0.17);
    border-radius: 10px;
    background: rgba(6, 28, 47, 0.7);
}

.arcade-command strong {
    flex-basis: 100%;
    color: rgba(230, 249, 255, 0.78);
    font-family: "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.arcade-command > span {
    color: rgba(204, 235, 245, 0.35);
    font-family: "Courier New", monospace;
    font-size: 8px;
    text-transform: uppercase;
}

.arcade-key-group {
    display: flex;
    gap: 5px;
}

.arcade-command kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 31px;
    padding: 0 8px;
    border: 1px solid rgba(115, 228, 255, 0.42);
    border-bottom-width: 3px;
    border-radius: 5px;
    color: var(--arcade-white);
    background: rgba(18, 77, 113, 0.58);
    box-shadow:
        0 0 10px rgba(74, 204, 255, 0.11),
        inset 0 0 7px rgba(115, 228, 255, 0.08);
    font-family: "Courier New", monospace;
    font-size: 12px;
    font-weight: bold;
}

.arcade-command .arcade-space-key {
    min-width: 105px;
}

.arcade-touch-instructions {
    display: none;
}

.arcade-touch-preview {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.arcade-touch-preview span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid rgba(115, 228, 255, 0.28);
    border-radius: 7px;
    color: var(--arcade-cyan);
    background: rgba(17, 79, 119, 0.32);
    font-family: "Courier New", monospace;
    font-size: 13px;
    font-weight: bold;
}

.arcade-touch-preview .arcade-touch-fire {
    color: #e5faff;
    background: linear-gradient(135deg, rgba(80, 72, 210, 0.42), rgba(16, 128, 198, 0.38));
}

.arcade-touch-instructions p {
    margin: 0 0 15px;
    color: rgba(211, 238, 247, 0.58);
    font-size: 12px;
    line-height: 1.45;
}

.arcade-objective {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 11px 14px;
    border-left: 2px solid var(--arcade-cyan);
    color: rgba(218, 243, 251, 0.62);
    background: rgba(30, 109, 157, 0.1);
    text-align: left;
}

.arcade-objective-icon {
    color: var(--arcade-cyan);
    font-size: 25px;
    text-shadow: 0 0 12px rgba(115, 228, 255, 0.75);
}

.arcade-objective strong,
.arcade-objective small {
    display: block;
}

.arcade-objective strong {
    margin-bottom: 3px;
    color: var(--arcade-cyan);
    font-family: "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 0.18em;
}

.arcade-objective small {
    font-size: 11px;
    line-height: 1.4;
}

.arcade-start-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(280px, 100%);
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid var(--arcade-cyan);
    border-radius: 7px;
    color: #00131e;
    background: linear-gradient(90deg, #58d4ff, #8aebff);
    box-shadow:
        0 0 15px rgba(115, 228, 255, 0.25),
        0 0 35px rgba(27, 137, 255, 0.12);
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.arcade-start-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 18px rgba(115, 228, 255, 0.42),
        0 0 42px rgba(27, 137, 255, 0.2);
}

.arcade-loading-note {
    display: block;
    margin-top: 11px;
    color: rgba(211, 238, 247, 0.34);
    font-family: "Courier New", monospace;
    font-size: 8px;
    letter-spacing: 0.08em;
}

/* Il vecchio media query mostrava i comandi touch prima dell'avvio. */
.arcade-mobile-controls {
    display: none;
}

.arcade-mobile-controls button {
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.arcade-mobile-controls button.is-pressed {
    transform: scale(0.96);
    color: #fff;
    background: rgba(44, 157, 220, 0.55);
}

@media (max-width: 700px), (pointer: coarse) {
    .arcade-desktop-instructions {
        display: none;
    }

    .arcade-touch-instructions {
        display: block;
    }

    .arcade-mobile-controls {
        display: none;
    }

    .arcade-loader.game-started .arcade-mobile-controls {
        display: grid;
    }

    .arcade-start-screen {
        align-items: flex-start;
        padding: 16px 14px;
    }

    .arcade-ready-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .arcade-ready-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 420px) {
    .arcade-loader {
        padding: 6px;
    }

    .arcade-shell {
        padding: 10px;
        border-radius: 12px;
    }

    .arcade-header {
        gap: 9px;
        margin-bottom: 9px;
    }

    .arcade-logo {
        width: 36px;
        height: 36px;
    }

    .arcade-heading h1 {
        font-size: 16px;
    }

    .arcade-kicker {
        font-size: 7px;
        letter-spacing: 0.16em;
    }

    .arcade-hud div {
        padding: 7px;
        font-size: 7px;
    }

    .arcade-hud strong {
        font-size: 9px;
    }

    .arcade-start-content h2 {
        margin-top: 5px;
        font-size: 22px;
    }

    .arcade-start-description {
        margin-bottom: 13px;
        font-size: 11px;
    }

    .arcade-touch-preview span {
        min-height: 38px;
    }

    .arcade-objective {
        margin-bottom: 13px;
        padding: 9px 11px;
    }

    .arcade-mobile-controls button {
        min-height: 46px;
    }

    .arcade-progress-header {
        font-size: 7px;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    .arcade-loader {
        align-items: flex-start;
        padding: 6px;
    }

    .arcade-shell {
        width: min(880px, 100%);
        margin: auto;
        padding: 8px 11px;
    }

    .arcade-header {
        margin-bottom: 6px;
    }

    .arcade-logo {
        width: 32px;
        height: 32px;
    }

    .arcade-heading h1 {
        font-size: 15px;
    }

    .arcade-hud {
        margin-bottom: 4px;
    }

    .arcade-hud div {
        padding: 4px 7px;
    }

    .arcade-start-screen {
        padding: 8px 16px;
    }

    .arcade-start-content {
        width: min(650px, 100%);
    }

    .arcade-start-content h2 {
        margin: 3px 0 4px;
        font-size: 21px;
    }

    .arcade-start-description {
        margin-bottom: 7px;
        font-size: 10px;
    }

    .arcade-touch-instructions p,
    .arcade-loading-note {
        display: none;
    }

    .arcade-touch-preview {
        max-width: 300px;
        margin: 0 auto 7px;
    }

    .arcade-touch-preview span {
        min-height: 32px;
    }

    .arcade-objective {
        max-width: 520px;
        margin: 0 auto 7px;
        padding: 6px 9px;
    }

    .arcade-start-button {
        min-height: 36px;
    }

    .arcade-mobile-controls {
        margin-top: 4px;
    }

    .arcade-mobile-controls button {
        min-height: 36px;
    }

    .arcade-loading-panel {
        margin-top: 7px;
    }
}


/* ========================================================================== */
/* MOBILE MISSION BRIEFING V3                                                  */
/* ========================================================================== */

.arcade-start-screen {
    z-index: 30;
}

.arcade-touch-heading,
.arcade-touch-control-grid,
.arcade-touch-tip {
    display: none;
}

@media (max-width: 700px), (pointer: coarse) {
    .arcade-start-screen {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        padding:
            max(14px, env(safe-area-inset-top))
            max(12px, env(safe-area-inset-right))
            max(14px, env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left));
        overflow-y: auto;
        overscroll-behavior: contain;
        background:
            radial-gradient(circle at 50% 14%, rgba(0, 229, 255, 0.17), transparent 32%),
            radial-gradient(circle at 82% 68%, rgba(127, 0, 255, 0.14), transparent 36%),
            linear-gradient(180deg, rgba(1, 7, 15, 0.97), rgba(0, 3, 9, 0.985));
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .arcade-start-screen::before {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        background:
            linear-gradient(rgba(115, 228, 255, 0.025) 1px, transparent 1px),
            linear-gradient(90deg, rgba(115, 228, 255, 0.025) 1px, transparent 1px);
        background-size: 34px 34px;
        mask-image: radial-gradient(circle at center, #000 25%, transparent 88%);
        -webkit-mask-image: radial-gradient(circle at center, #000 25%, transparent 88%);
    }

    .arcade-start-content {
        position: relative;
        width: min(430px, 100%);
        max-height: calc(
            100dvh -
            env(safe-area-inset-top) -
            env(safe-area-inset-bottom) -
            28px
        );
        margin: auto;
        padding: 22px 17px 17px;
        overflow-x: hidden;
        overflow-y: auto;
        border: 1px solid rgba(115, 228, 255, 0.22);
        border-radius: 24px;
        background:
            linear-gradient(145deg, rgba(15, 34, 54, 0.95), rgba(4, 14, 27, 0.97));
        box-shadow:
            0 24px 80px rgba(0, 0, 0, 0.62),
            0 0 42px rgba(0, 165, 255, 0.10),
            inset 0 1px 0 rgba(255, 255, 255, 0.045);
        scrollbar-width: none;
    }

    .arcade-start-content::-webkit-scrollbar {
        display: none;
    }

    .arcade-start-content::before {
        content: "";
        position: absolute;
        top: 0;
        left: 18%;
        right: 18%;
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--arcade-cyan), transparent);
        box-shadow: 0 0 16px rgba(115, 228, 255, 0.75);
    }

    .arcade-start-kicker {
        display: inline-flex;
        align-items: center;
        min-height: 26px;
        padding: 0 11px;
        border: 1px solid rgba(115, 228, 255, 0.20);
        border-radius: 999px;
        background: rgba(0, 229, 255, 0.065);
        font-size: 7px;
        letter-spacing: 0.20em;
    }

    .arcade-start-content h2 {
        max-width: 330px;
        margin: 13px auto 8px;
        font-size: clamp(27px, 8vw, 36px);
        line-height: 0.98;
        letter-spacing: -0.035em;
        text-wrap: balance;
    }

    .arcade-start-description {
        max-width: 330px;
        margin: 0 auto 18px;
        color: rgba(222, 245, 252, 0.66);
        font-size: 12px;
        line-height: 1.48;
        text-wrap: balance;
    }

    .arcade-touch-instructions {
        display: block;
        margin-bottom: 14px;
        text-align: left;
    }

    .arcade-touch-heading {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 8px;
        margin-bottom: 9px;
        padding: 0 3px;
        font-family: "Courier New", monospace;
    }

    .arcade-touch-heading-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--arcade-cyan);
        box-shadow: 0 0 10px rgba(115, 228, 255, 0.85);
    }

    .arcade-touch-heading strong {
        color: rgba(231, 250, 255, 0.84);
        font-size: 9px;
        letter-spacing: 0.16em;
    }

    .arcade-touch-heading small {
        color: rgba(189, 226, 239, 0.38);
        font-size: 7px;
        letter-spacing: 0.12em;
    }

    .arcade-touch-control-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .arcade-touch-control-card {
        display: grid;
        grid-template-columns: 105px 1fr;
        align-items: center;
        gap: 12px;
        min-height: 78px;
        padding: 11px;
        border: 1px solid rgba(115, 228, 255, 0.14);
        border-radius: 14px;
        background:
            linear-gradient(135deg, rgba(15, 54, 82, 0.56), rgba(7, 26, 44, 0.72));
        box-shadow: inset 0 0 18px rgba(0, 229, 255, 0.025);
    }

    .arcade-touch-control-card.arcade-touch-fire-card {
        border-color: rgba(154, 105, 255, 0.22);
        background:
            linear-gradient(135deg, rgba(73, 40, 132, 0.34), rgba(10, 31, 53, 0.76));
    }

    .arcade-touch-control-buttons {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }

    .arcade-touch-key {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid rgba(115, 228, 255, 0.38);
        border-bottom-width: 3px;
        border-radius: 11px;
        color: #dffaff;
        background:
            linear-gradient(180deg, rgba(25, 112, 157, 0.75), rgba(10, 51, 82, 0.92));
        box-shadow:
            0 7px 16px rgba(0, 0, 0, 0.24),
            inset 0 1px 0 rgba(255, 255, 255, 0.09),
            0 0 14px rgba(0, 196, 255, 0.09);
        font-family: "Courier New", monospace;
        font-size: 15px;
        font-weight: 700;
    }

    .arcade-touch-key.arcade-touch-fire {
        width: 94px;
        color: #fff;
        border-color: rgba(178, 130, 255, 0.52);
        background:
            linear-gradient(135deg, rgba(123, 63, 219, 0.92), rgba(15, 135, 201, 0.92));
        letter-spacing: 0.12em;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.34);
    }

    .arcade-touch-control-copy strong,
    .arcade-touch-control-copy small {
        display: block;
    }

    .arcade-touch-control-copy strong {
        margin-bottom: 4px;
        color: var(--arcade-white);
        font-family: "Courier New", monospace;
        font-size: 10px;
        letter-spacing: 0.14em;
    }

    .arcade-touch-control-copy small {
        color: rgba(205, 235, 245, 0.54);
        font-size: 10px;
        line-height: 1.35;
    }

    .arcade-touch-tip {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 9px;
        padding: 9px 10px;
        border-radius: 10px;
        color: rgba(211, 239, 248, 0.56);
        background: rgba(0, 229, 255, 0.045);
        font-size: 9px;
        line-height: 1.35;
    }

    .arcade-touch-tip-badge {
        flex: 0 0 auto;
        padding: 3px 6px;
        border: 1px solid rgba(115, 228, 255, 0.24);
        border-radius: 5px;
        color: var(--arcade-cyan);
        font-family: "Courier New", monospace;
        font-size: 7px;
        font-weight: 700;
        letter-spacing: 0.12em;
    }

    .arcade-objective {
        margin-bottom: 14px;
        padding: 11px 12px;
        border: 1px solid rgba(101, 255, 178, 0.14);
        border-left: 3px solid #65ffb2;
        border-radius: 12px;
        background: rgba(22, 103, 73, 0.08);
    }

    .arcade-objective-icon {
        display: grid;
        flex: 0 0 auto;
        place-items: center;
        width: 35px;
        height: 35px;
        border: 1px solid rgba(101, 255, 178, 0.22);
        border-radius: 50%;
        color: #78ffc1;
        background: rgba(101, 255, 178, 0.06);
        font-size: 19px;
    }

    .arcade-objective strong {
        color: #78ffc1;
        font-size: 8px;
    }

    .arcade-objective small {
        color: rgba(220, 246, 237, 0.60);
        font-size: 10px;
        line-height: 1.35;
    }

    .arcade-start-button {
        position: relative;
        width: 100%;
        min-height: 55px;
        border-radius: 14px;
        font-size: 11px;
        letter-spacing: 0.11em;
        box-shadow:
            0 12px 28px rgba(0, 142, 202, 0.22),
            0 0 24px rgba(115, 228, 255, 0.16);
    }

    .arcade-start-button::after {
        content: "";
        position: absolute;
        inset: 2px;
        pointer-events: none;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 11px;
    }

    .arcade-loading-note {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin-top: 10px;
        color: rgba(207, 237, 247, 0.40);
        font-size: 7px;
        line-height: 1.35;
    }

    .arcade-loading-note::before {
        content: "";
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #65ffb2;
        box-shadow: 0 0 7px rgba(101, 255, 178, 0.75);
        animation: arcade-ready-pulse 1.3s ease-in-out infinite;
    }
}

@media (max-width: 380px) {
    .arcade-start-content {
        padding: 18px 13px 14px;
        border-radius: 20px;
    }

    .arcade-start-content h2 {
        font-size: 25px;
    }

    .arcade-start-description {
        margin-bottom: 14px;
        font-size: 11px;
    }

    .arcade-touch-control-card {
        grid-template-columns: 92px 1fr;
        gap: 9px;
        min-height: 71px;
        padding: 9px;
    }

    .arcade-touch-key {
        width: 38px;
        height: 38px;
        border-radius: 9px;
        font-size: 13px;
    }

    .arcade-touch-key.arcade-touch-fire {
        width: 80px;
    }

    .arcade-touch-control-copy small {
        font-size: 9px;
    }
}

@media (max-height: 700px) and (orientation: portrait) {
    .arcade-start-content {
        padding-top: 16px;
        padding-bottom: 13px;
    }

    .arcade-start-kicker {
        min-height: 22px;
    }

    .arcade-start-content h2 {
        margin-top: 9px;
        font-size: 25px;
    }

    .arcade-start-description {
        margin-bottom: 12px;
    }

    .arcade-touch-control-card {
        min-height: 66px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .arcade-touch-tip {
        display: none;
    }

    .arcade-objective {
        margin-bottom: 10px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .arcade-start-button {
        min-height: 49px;
    }
}

@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
    .arcade-start-screen {
        place-items: start center;
        padding: 7px max(10px, env(safe-area-inset-right)) 7px max(10px, env(safe-area-inset-left));
    }

    .arcade-start-content {
        width: min(760px, 100%);
        max-height: calc(100dvh - 14px);
        display: grid;
        grid-template-columns: minmax(180px, 0.75fr) minmax(340px, 1.25fr);
        grid-template-areas:
            "kicker controls"
            "title controls"
            "description controls"
            "objective controls"
            "action action";
        column-gap: 16px;
        row-gap: 8px;
        padding: 13px 15px 11px;
        text-align: left;
    }

    .arcade-start-kicker {
        grid-area: kicker;
        align-self: start;
        justify-self: start;
    }

    .arcade-start-content h2 {
        grid-area: title;
        align-self: center;
        max-width: 240px;
        margin: 0;
        font-size: 23px;
        text-align: left;
    }

    .arcade-start-description {
        grid-area: description;
        align-self: end;
        max-width: 250px;
        margin: 0 0 2px;
        font-size: 9px;
        text-align: left;
    }

    .arcade-touch-instructions {
        grid-area: controls;
        align-self: center;
        margin: 0;
    }

    .arcade-touch-control-grid {
        grid-template-columns: 1fr 1fr;
    }

    .arcade-touch-control-card {
        grid-template-columns: 1fr;
        gap: 6px;
        min-height: 100px;
        text-align: center;
    }

    .arcade-touch-control-copy small,
    .arcade-touch-tip {
        display: none;
    }

    .arcade-objective {
        grid-area: objective;
        align-self: end;
        margin: 0;
    }

    .arcade-start-button {
        grid-area: action;
        min-height: 42px;
    }

    .arcade-loading-note {
        display: none;
    }
}

/* ========================================================================== */
/* APPLE / SAFARI STABILITY PATCH                                             */
/* ========================================================================== */

html.arcade-loading,
body.arcade-loading {
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
}

body.arcade-loading #site-root,
#site-root[aria-hidden="true"] {
    visibility: hidden !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

#site-root[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

.arcade-loader {
    width: 100%;
    height: 100%;
    min-height: 100svh;
    pointer-events: auto;
    touch-action: none;
    isolation: isolate;
    -webkit-user-select: none;
    user-select: none;
}

/* Durante la dissolvenza l'overlay continua a intercettare i tocchi.
   Evita il ghost tap di Safari sulle card e sui video sottostanti. */
.arcade-loader.is-leaving {
    opacity: 0;
    visibility: visible !important;
    pointer-events: auto !important;
}

html.apple-touch-device .arcade-loader {
    background:
        radial-gradient(
            circle at 50% 32%,
            rgba(15, 116, 210, 0.16),
            transparent 45%
        ),
        #020711;
    transition-duration: 0.36s;
}

html.apple-touch-device .arcade-background {
    animation: none !important;
    opacity: 0.11;
}

html.apple-touch-device .arcade-background::before,
html.apple-touch-device .arcade-game-container::after {
    display: none !important;
}

html.apple-touch-device .arcade-shell,
html.apple-touch-device .arcade-start-screen,
html.apple-touch-device .arcade-message,
html.apple-touch-device .arcade-floating-enter {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.apple-touch-device .arcade-shell {
    background: rgba(5, 15, 27, 0.98);
    box-shadow:
        0 0 18px rgba(0, 116, 255, 0.08),
        inset 0 0 12px rgba(76, 199, 255, 0.02);
}

html.apple-touch-device .arcade-start-screen {
    background:
        radial-gradient(
            circle at 50% 24%,
            rgba(17, 119, 216, 0.17),
            transparent 45%
        ),
        #020811;
}

html.apple-touch-device .arcade-logo {
    filter: none !important;
}

html.apple-touch-device .arcade-start-content h2,
html.apple-touch-device .arcade-objective-icon {
    text-shadow: none !important;
}

html.apple-touch-device .arcade-game-container,
html.apple-touch-device .arcade-progress-bar,
html.apple-touch-device .arcade-ready-dot,
html.apple-touch-device .arcade-primary-button,
html.apple-touch-device .arcade-start-button,
html.apple-touch-device .arcade-floating-enter,
html.apple-touch-device .arcade-touch-key {
    box-shadow: none !important;
}

html.apple-touch-device .arcade-ready-panel,
html.apple-touch-device .arcade-ready-dot {
    animation: none !important;
}

html.apple-touch-device .arcade-start-screen,
html.apple-touch-device .arcade-shell {
    -webkit-overflow-scrolling: touch;
}

html.apple-touch-device #arcade-game {
    image-rendering: auto;
}

@media (max-width: 700px), (pointer: coarse) {
    .arcade-loader {
        overflow: hidden;
    }

    .arcade-shell {
        max-height: calc(
            100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 14px
        );
    }
}

@supports (-webkit-touch-callout: none) {
    .arcade-loader {
        min-height: -webkit-fill-available;
    }
}

/* Il body resta fisso, ma il briefing può scorrere verticalmente su iPhone. */
html.arcade-loading,
body.arcade-loading {
    touch-action: auto;
}

.arcade-loader {
    touch-action: auto;
}

.arcade-start-screen,
.arcade-shell {
    touch-action: pan-y;
}

#arcade-game,
.arcade-mobile-controls,
.arcade-mobile-controls button {
    touch-action: none;
}
