/* O-RING: Neon Reflex — stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Share+Tech+Mono&family=Orbitron:wght@700;900&display=swap');

:root {
    --neon-green: #00ff88;
    --neon-cyan: #00eeff;
    --neon-magenta: #ff00cc;
    --neon-yellow: #ffe600;
    --dark-bg: #030810;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--dark-bg);
    color: var(--neon-green);
    font-family: 'Share Tech Mono', monospace;
    overflow: hidden;
    touch-action: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 8px);
    height: 100dvh;
    width: 100vw;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.15) 2px,
        rgba(0,0,0,0.15) 4px
    );
    pointer-events: none;
    z-index: 100;
}

#wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 8px;
}

/* =================== SCHERMATE OVERLAY =================== */
.screen-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.screen-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* INSERT COIN */
#insert-coin-screen {
    background: radial-gradient(circle at center, #051520 0%, var(--dark-bg) 100%);
}
/* INSERT COIN — titolo con pallina sprite */
.coin-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    gap: 0;
}
#ball-canvas {
    image-rendering: pixelated;
    display: block;
    margin-bottom: 2px;
}
.coin-dash {
    display: inline-block;
    transform: scaleX(0.5);
    transform-origin: left center;
    margin-right: -0.5em;
    vertical-align: middle;
}
.coin-ring {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(36px, 11vw, 58px);
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--neon-cyan);
    text-shadow: 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-cyan);
    line-height: 1;
    margin-left: 0.06em;
}
.coin-subtitle {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    letter-spacing: 5px;
    color: var(--neon-magenta);
    text-shadow: 0 0 15px var(--neon-magenta);
    margin-bottom: 40px;
}
.coin-instructions {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    letter-spacing: 1px;
    color: rgba(0,255,136,0.7);
    text-align: center;
    line-height: 2.2;
    margin-bottom: 30px;
    max-width: 350px;
}
.instr-hint {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    letter-spacing: 1px;
    color: rgba(0,238,255,0.3);
    display: block;
    margin-top: 6px;
}
.coin-prompt {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--neon-yellow);
    animation: blink 1s infinite;
    margin-bottom: 28px;
}
.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.mode-btn {
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(0,255,136,0.3);
    border-radius: 8px;
    color: rgba(0,255,136,0.6);
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    padding: 12px 0;
    width: 120px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
}
.mode-btn.selected {
    background: rgba(0,255,136,0.2);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 20px rgba(0,255,136,0.4);
}
.mode-btn:active {
    transform: scale(0.95);
}
.coin-credits {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    letter-spacing: 1px;
    color: rgba(0,255,136,0.4);
    text-align: center;
    margin-top: 10px;
}
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ── STELLE CSS MSX (background INSERT COIN) ──────────────────── */
.ic-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.ic-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.ic-stars span {
    position: absolute;
    display: block;
    width: 2px;
    height: 2px;
    background: rgba(0,238,255,0.7);
    border-radius: 50%;
    animation: star-twinkle var(--dur, 2s) ease-in-out infinite var(--del, 0s);
}
@keyframes star-twinkle {
    0%,100% { opacity: 0.8; }
    50%      { opacity: 0.1; }
}
/* Posizioni e timing casuali delle 20 stelle */
.ic-stars span:nth-child(1)  { left:  8%; top: 12%; --dur:2.1s; --del:0.0s; }
.ic-stars span:nth-child(2)  { left: 78%; top:  7%; --dur:1.8s; --del:0.3s; }
.ic-stars span:nth-child(3)  { left: 22%; top: 32%; --dur:2.4s; --del:0.7s; }
.ic-stars span:nth-child(4)  { left: 65%; top: 22%; --dur:1.6s; --del:1.1s; }
.ic-stars span:nth-child(5)  { left: 90%; top: 45%; --dur:2.2s; --del:0.2s; }
.ic-stars span:nth-child(6)  { left: 40%; top: 68%; --dur:1.9s; --del:0.9s; }
.ic-stars span:nth-child(7)  { left: 55%; top: 80%; --dur:2.5s; --del:0.4s; }
.ic-stars span:nth-child(8)  { left: 12%; top: 55%; --dur:1.7s; --del:1.3s; }
.ic-stars span:nth-child(9)  { left: 83%; top: 70%; --dur:2.0s; --del:0.6s; }
.ic-stars span:nth-child(10) { left: 33%; top: 15%; --dur:2.3s; --del:0.1s; }
.ic-stars span:nth-child(11) { left:  5%; top: 82%; --dur:1.5s; --del:0.8s; }
.ic-stars span:nth-child(12) { left: 70%; top: 90%; --dur:2.6s; --del:0.5s; }
.ic-stars span:nth-child(13) { left: 48%; top: 42%; --dur:1.8s; --del:1.2s; }
.ic-stars span:nth-child(14) { left: 92%; top: 15%; --dur:2.1s; --del:0.3s; }
.ic-stars span:nth-child(15) { left: 18%; top: 75%; --dur:2.4s; --del:0.7s; }
.ic-stars span:nth-child(16) { left: 60%; top: 55%; --dur:1.6s; --del:1.0s; }
.ic-stars span:nth-child(17) { left: 28%; top: 90%; --dur:2.2s; --del:0.2s; }
.ic-stars span:nth-child(18) { left: 75%; top: 38%; --dur:1.9s; --del:0.6s; }
.ic-stars span:nth-child(19) { left: 45%; top:  5%; --dur:2.0s; --del:1.4s; }
.ic-stars span:nth-child(20) { left:  2%; top: 42%; --dur:2.3s; --del:0.9s; }

/* ── HOW TO PLAY BUTTON ───────────────────────────────────────── */
#music-toggle {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(0,238,255,0.4);
    cursor: pointer;
    margin-bottom: 14px;
    transition: color 0.2s;
    user-select: none;
}
#music-toggle:hover {
    color: rgba(0,238,255,0.75);
}
#music-toggle.muted {
    color: rgba(255,255,255,0.18);
}

.htp-btn {
    background: transparent;
    border: 1px solid rgba(0,238,255,0.35);
    border-radius: 4px;
    color: rgba(0,238,255,0.6);
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
    width: calc(120px * 2 + 15px);
}
.htp-btn:hover, .htp-btn:active {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0,238,255,0.3);
}

/* ── TOP SCORES OVERLAY ──────────────────────────────────────── */
#topscores-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(3,8,16,0.92);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
#topscores-overlay.active {
    display: flex;
}
.ts-tabs {
    margin-top: 16px;
}
.ts-scores {
    margin-bottom: 10px;
}

/* ── HOW TO PLAY OVERLAY ─────────────────────────────────────── */
#howtoplay-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(3,8,16,0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    overflow-y: auto;
}
#howtoplay-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.htp-box {
    font-family: 'Share Tech Mono', monospace;
    color: rgba(0,255,136,0.85);
    max-width: 420px;
    width: 90%;
    padding: 24px 20px;
    border: 1px solid rgba(0,238,255,0.25);
    box-shadow: 0 0 40px rgba(0,238,255,0.08);
}
.htp-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.85rem, 4vw, 1.1rem);
    font-weight: 900;
    color: var(--neon-cyan);
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 16px var(--neon-cyan);
}
.htp-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0,255,136,0.1);
}
.htp-section:last-of-type { border-bottom: none; }
.htp-label {
    font-size: clamp(0.65rem, 2.8vw, 0.78rem);
    color: var(--neon-yellow);
    letter-spacing: 2px;
    margin-bottom: 5px;
}
.htp-text {
    font-size: clamp(0.62rem, 2.6vw, 0.74rem);
    color: rgba(255,255,255,0.7);
    line-height: 1.65;
}
.htp-key {
    display: inline-block;
    background: rgba(0,238,255,0.12);
    border: 1px solid rgba(0,238,255,0.4);
    border-radius: 3px;
    color: var(--neon-cyan);
    font-size: 0.85em;
    padding: 1px 5px;
    margin: 0 2px;
}
.htp-hi     { color: var(--neon-yellow); }
.htp-red    { color: #ff0033; }
.htp-cyan   { color: var(--neon-cyan); }
.htp-yellow { color: var(--neon-yellow); }
.htp-purple { color: #cc44ff; }
.htp-close {
    text-align: center;
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    color: rgba(0,255,136,0.4);
    letter-spacing: 2px;
    margin-top: 18px;
    animation: blink 1.2s infinite;
}
#ready-screen {
    background: var(--dark-bg);
    text-align: center;
}
.ready-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--neon-green);
    text-shadow: 0 0 40px var(--neon-green);
    animation: pulse 0.6s ease-in-out;
    padding: 0 20px;
}
@keyframes pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* GAME OVER */
#gameover-screen {
    padding: 20px;
    overflow-y: auto;
    text-align: center;
}
.go-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 29px;
    font-weight: 400;
    letter-spacing: 4px;
    color: #ff0055;
    text-shadow: 0 0 30px #ff0055;
    margin-bottom: 20px;
    animation: glitch 0.3s infinite;
    text-align: center;
    width: 100%;
}
@keyframes glitch {
    0%, 90% { transform: translate(0); }
    92% { transform: translate(-2px, 1px); }
    94% { transform: translate(2px, -1px); }
    96% { transform: translate(-1px, 2px); }
    100% { transform: translate(0); }
}
.final-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: var(--neon-yellow);
    margin-bottom: 30px;
}

/* Name Entry */
.name-entry {
    margin-bottom: 30px;
}
.name-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    margin-bottom: 15px;
}
.name-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}
.char-box {
    width: 50px;
    height: 60px;
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 26px;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-cyan);
}
.char-box.active {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px var(--neon-yellow);
}
.letter-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    max-width: 400px;
    margin-bottom: 20px;
}
.letter-btn {
    background: rgba(0,238,255,0.1);
    border: 1px solid var(--neon-cyan);
    border-radius: 4px;
    color: var(--neon-cyan);
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 14px 6px;
    cursor: pointer;
    transition: all 0.1s;
}
.letter-btn:active {
    background: var(--neon-cyan);
    color: var(--dark-bg);
    transform: scale(0.95);
}
.submit-btn {
    display: block;
    margin: 0 auto 10px;
    background: rgba(0,255,136,0.2);
    border: 2px solid var(--neon-green);
    border-radius: 8px;
    color: var(--neon-green);
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    padding: 15px 40px;
    cursor: pointer;
    letter-spacing: 2px;
}
.submit-btn:active {
    background: var(--neon-green);
    color: var(--dark-bg);
}

/* Leaderboard Tabs */
.hs-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 0;
    width: 100%;
    max-width: 400px;
}
.hs-tab {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,0,204,0.25);
    color: rgba(255,255,255,0.3);
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.15s;
}
.hs-tab:first-child {
    border-radius: 6px 0 0 0;
    border-right: none;
}
.hs-tab:not(:first-child):not(:last-child) {
    border-right: none;
}
.hs-tab:last-child {
    border-radius: 0 6px 0 0;
}
.hs-tab.active {
    background: rgba(255,0,204,0.15);
    border-color: var(--neon-magenta);
    color: var(--neon-magenta);
    text-shadow: 0 0 10px var(--neon-magenta);
}
.hs-tab:active {
    background: rgba(255,0,204,0.25);
}
.hs-loading {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 20px 0;
}

/* High Scores */
.highscores {
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255,0,204,0.25);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 10px 0 4px;
    margin-bottom: 10px;
}
.hs-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--neon-magenta);
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 15px var(--neon-magenta);
}
#scores-list,
#ts-scores-list {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,0,204,0.4) transparent;
}
#scores-list::-webkit-scrollbar,
#ts-scores-list::-webkit-scrollbar { width: 4px; }
#scores-list::-webkit-scrollbar-track,
#ts-scores-list::-webkit-scrollbar-track { background: transparent; }
#scores-list::-webkit-scrollbar-thumb,
#ts-scores-list::-webkit-scrollbar-thumb { background: rgba(255,0,204,0.4); border-radius: 2px; }

.hs-sep {
    height: 1px;
    background: rgba(255,0,204,0.25);
    margin: 2px 15px 2px;
}
.hs-entry-player {
    opacity: 0.72;
    font-style: italic;
}
.loadmore-btn {
    display: block;
    width: calc(100% - 30px);
    margin: 4px 15px;
    padding: 7px 0;
    background: transparent;
    border: 1px solid rgba(255,0,204,0.25);
    border-radius: 3px;
    color: rgba(255,0,204,0.6);
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
}
.loadmore-btn:hover,
.loadmore-btn:active {
    background: rgba(255,0,204,0.1);
    color: var(--neon-magenta);
}
.loadmore-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.hs-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    margin-bottom: 5px;
    background: rgba(0,0,0,0.3);
    border-left: 3px solid rgba(0,255,136,0.3);
}
.hs-entry.new-record {
    background: rgba(0,255,136,0.15);
    border-left-color: var(--neon-green);
    animation: highlight 0.5s ease-in-out 3;
}
@keyframes highlight {
    0%, 100% { background: rgba(0,255,136,0.15); }
    50% { background: rgba(0,255,136,0.3); }
}
.hs-rank {
    color: var(--neon-yellow);
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    min-width: 35px;
}
.hs-name {
    flex: 1;
    text-align: center;
    color: var(--neon-cyan);
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
}
.hs-score {
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    min-width: 60px;
    text-align: right;
}
.continue-btn {
    background: rgba(255,230,0,0.2);
    border: 2px solid var(--neon-yellow);
    border-radius: 8px;
    color: var(--neon-yellow);
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    padding: 12px 30px;
    cursor: pointer;
    letter-spacing: 2px;
    margin-top: 20px;
}
.continue-btn:active {
    background: var(--neon-yellow);
    color: var(--dark-bg);
}

/* =================== GAME UI =================== */
#hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    max-width: 420px;
}

.hud-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: rgba(0,255,136,0.5);
    text-transform: uppercase;
}

.hud-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    text-shadow: 0 0 12px var(--neon-cyan);
}

.hud-title {
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    letter-spacing: 4px;
}

#lives-dots { display: flex; gap: 6px; margin-top: 2px; }
.life-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--neon-magenta);
    box-shadow: 0 0 8px var(--neon-magenta);
}
.life-dot.dead { background: #1a0010; box-shadow: none; border: 1px solid rgba(255,0,204,0.2); }

#game-container {
    position: relative;
    border: 2px solid rgba(0,255,136,0.3);
    box-shadow: 0 0 20px rgba(0,255,136,0.15);
    border-radius: 4px;
    max-width: 420px;
    width: 100%;
}

canvas { display: block; width: 100%; height: auto; }

.hud-phrase { display: none; }

/* =================== PHRASE BAR LED =================== */
#phrase-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    max-width: 420px;
    padding: 6px 8px;
    margin-top: 3px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(0,255,136,0.18);
    border-radius: 6px;
    flex-shrink: 0;
    overflow: hidden;
}
.pbar-tag {
    font-family: 'Orbitron', monospace;
    font-size: 7px;
    letter-spacing: 2px;
    color: rgba(0,255,136,0.35);
    flex-shrink: 0;
    padding-right: 6px;
    border-right: 1px solid rgba(0,255,136,0.15);
}
#phrase-bar-chars {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.pbc {
    font-family: 'Share Tech Mono', monospace;
    font-size: var(--cell-font-size, 13px);
    display: inline-block;
    min-width: 0.65em;
    text-align: center;
}
.pbc-sp { display: inline-block; width: 0.45em; }
.pbc-c  { color: rgba(0,255,136,0.5); }
.pbc-t  { color: #00eeff; text-shadow: 0 0 8px #00eeff; animation: pbc-blink .7s ease-in-out infinite; }
.pbc-s  { color: rgba(255,255,255,0.4); }
.pbc-p  { color: rgba(255,255,255,0.1); }
@keyframes pbc-blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* =================== CONTROLS =================== */
#controls {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    max-width: 420px;
    width: 100%;
    flex: 1;
    min-height: 100px;
    padding: 0;
}

#fire-row {
    display: flex;
    justify-content: center;
    max-width: 420px;
    width: 100%;
    height: 72px;
    flex-shrink: 0;
    margin-bottom: 6px;
    padding-top: 6px;
}
#fire-row.hidden { display: none; }



#pause-row {
    display: flex;
    max-width: 420px;
    width: 100%;
    padding: 0;
    height: 56px;
    flex-shrink: 0;
    margin-top: 6px;
    justify-content: center;
}

#controls.grid-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.ctrl-btn {
    flex: 1;
    background: linear-gradient(180deg, rgba(0,238,255,0.07) 0%, rgba(0,238,255,0.02) 60%, rgba(0,238,255,0.06) 100%);
    border: 1px solid rgba(0,238,255,0.35);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    touch-action: none;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.1s, box-shadow 0.1s;
}
.ctrl-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,238,255,0.7), transparent);
}
.ctrl-btn-sym {
    font-size: 36px;
    color: #fff;
    text-shadow: 0 0 14px var(--neon-cyan), 0 0 28px var(--neon-cyan);
    line-height: 1;
    pointer-events: none;
}
.ctrl-btn-label {
    font-family: 'Orbitron', monospace;
    font-size: 8px;
    letter-spacing: 2px;
    color: rgba(0,238,255,0.5);
    pointer-events: none;
}
.pause-label {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(0,238,255,0.6);
}
#btnPause {
    border-radius: 0;
    flex: 0 0 60%;
    padding: 12px 0 env(safe-area-inset-bottom);
    border: none;
    background: transparent;
    font-size: 110%;
}
.ctrl-btn.arrow .ctrl-btn-sym { font-size: 44px; }
.ctrl-btn.pressed {
    background: linear-gradient(180deg, rgba(0,238,255,0.22) 0%, rgba(0,238,255,0.10) 100%);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 18px rgba(0,238,255,0.45), inset 0 0 12px rgba(0,238,255,0.08);
}
.ctrl-btn.hidden { display: none; }
/* ── FIRE BUTTON (ARCADE MODE) — after .ctrl-btn to win cascade ── */
.fire-btn {
    flex: 0 0 100%;
    max-width: 100%;
    background: linear-gradient(180deg, rgba(255,0,51,0.18) 0%, rgba(255,0,51,0.06) 100%);
    border-color: rgba(255,0,51,0.65);
    animation: fire-pulse 1.2s ease-in-out infinite;
}
.fire-btn::before {
    background: linear-gradient(90deg, transparent, rgba(255,0,51,0.7), transparent);
}
.fire-sym {
    font-family: 'Orbitron', monospace;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ff0033;
    text-shadow: 0 0 14px #ff0033, 0 0 28px #ff0033;
}
.fire-btn.pressed {
    background: linear-gradient(180deg, rgba(255,0,51,0.40) 0%, rgba(255,0,51,0.20) 100%);
    border-color: #ff0033;
    box-shadow: 0 0 24px rgba(255,0,51,0.6), inset 0 0 14px rgba(255,0,51,0.12);
}

@keyframes fire-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255,0,51,0.3); }
    50%       { box-shadow: 0 0 22px rgba(255,0,51,0.7); }
}

#score-flash {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace; font-size: 28px;
    color: var(--neon-yellow); opacity: 0; pointer-events: none;
}

#build-version {
    margin-top: 6px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: rgba(0, 238, 255, 0.4);
    letter-spacing: 0.05em;
}

#phrase-flash {
    position: fixed;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    opacity: 0; pointer-events: none; z-index: 150; text-align: center;
    padding: 8px 14px;
    background: rgba(3,8,16,0.70);
    border: 1px solid rgba(255,230,0,0.5);
    box-shadow: 0 0 10px rgba(255,230,0,0.25);
    border-radius: 4px;
    max-width: 200px;
}
.pf-phrase {
    font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 900;
    letter-spacing: 2px; color: var(--neon-yellow);
    text-shadow: 0 0 8px var(--neon-yellow);
}
.pf-author {
    font-family: 'Share Tech Mono', monospace; font-size: 10px;
    letter-spacing: 1px; color: rgba(0,238,255,0.7);
}
.pf-bonus {
    font-family: 'Orbitron', monospace; font-size: 13px; font-weight: 900;
    color: var(--neon-yellow); text-shadow: 0 0 8px var(--neon-yellow);
}

@keyframes flash {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(1.2); }
}
.flash-anim { animation: flash 0.6s ease-out forwards; }

/* ── Performance hint: promuovi layer GPU per elementi animati frequentemente ── */
.screen-overlay, .flash-anim, .pbc-t { will-change: opacity, transform; }

#extralife-flash {
    position: fixed; top: 35%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace; font-size: 22px; font-weight: 900;
    letter-spacing: 4px;
    color: var(--neon-magenta);
    text-shadow: 0 0 20px var(--neon-magenta), 0 0 40px var(--neon-magenta);
    opacity: 0; pointer-events: none;
}
@keyframes extralife {
    0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
    20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}
.extralife-anim { animation: extralife 1.8s ease-out forwards; }

@keyframes phraseReveal {
    0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.85); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02); }
    70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); }
}
.phrase-anim { animation: phraseReveal 2.4s ease-out forwards; }

/* Responsive tweaks */
@media (max-width: 400px) {
    .coin-ring { font-size: clamp(28px, 9vw, 40px); }
    .coin-subtitle { font-size: 9px; }
    .coin-instructions { font-size: 6px; max-width: 300px; }
    .coin-prompt { font-size: 9px; }
    .mode-btn { font-size: 9px; padding: 10px 0; width: 100px; }
    .htp-btn { width: calc(100px * 2 + 15px); font-size: 8px; }
    .ready-text { font-size: 14px; letter-spacing: 1px; }
    .go-title { font-size: 18px; }
    .letter-grid { grid-template-columns: repeat(7, 1fr); }
}
