/* Tetris — Tema neon multicolore su sfondo scuro */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #0a0a1a;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

canvas {
    display: block;
    background: #0d0d2b;
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.1);
}

/* Schermate overlay */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.95);
    z-index: 10;
    padding: 20px;
    text-align: center;
}

.screen h1 {
    color: #8a2be2;
    font-size: 2.5rem;
    text-shadow: 0 0 20px #8a2be2;
    margin-bottom: 10px;
}

.screen h2 {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.screen p {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    margin-bottom: 24px;
}

.final-score {
    color: #8a2be2 !important;
    font-size: 1.4rem !important;
    font-weight: 700;
}

.final-lines {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.9rem !important;
}

.game-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid #8a2be2;
    background: transparent;
    color: #8a2be2;
    border-radius: 30px;
    cursor: pointer;
    margin: 6px;
    transition: all 0.3s;
    min-width: 180px;
}

.game-btn:hover, .game-btn:active {
    background: #8a2be2;
    color: #0a0a1a;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

.game-btn.secondary {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
}

.game-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: white;
    box-shadow: none;
}

.controls-hint {
    margin-top: 20px;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
}

/* HUD */
#hud {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 12px;
    z-index: 5;
    pointer-events: none;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    color: rgba(255,255,255,0.5);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-left #scoreDisplay {
    color: #8a2be2;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(138,43,226,0.5);
}

.hud-center #linesDisplay {
    color: #00ccff;
    font-size: 1.2rem;
    font-weight: 700;
}

.hud-right #levelDisplay {
    color: #39ff14;
    font-size: 1.2rem;
    font-weight: 700;
}

.hud-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Controlli touch */
#touchControls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    padding: 0 10px;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(138, 43, 226, 0.4);
    background: rgba(138, 43, 226, 0.1);
    color: #8a2be2;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ctrl-btn:active {
    background: rgba(138, 43, 226, 0.3);
    transform: scale(0.92);
    box-shadow: 0 0 15px rgba(138,43,226,0.4);
}

.ctrl-btn.rotate {
    font-size: 1.6rem;
    border-color: rgba(0,204,255,0.4);
    background: rgba(0,204,255,0.1);
    color: #00ccff;
}

.ctrl-btn.drop {
    border-color: rgba(255,51,102,0.4);
    background: rgba(255,51,102,0.1);
    color: #ff3366;
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 360px) {
    .screen h1 { font-size: 2rem; }
    .ctrl-btn { width: 48px; height: 48px; font-size: 1.2rem; }
    .ctrl-btn.rotate { font-size: 1.4rem; }
}
