:root {
    --bg-color: #020205;
    --neon-blue: #00f0f0;
    --neon-red: #ff003c;
    --border: #1a1a2e;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(var(--border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    color: #fff;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    touch-action: manipulation;
    overflow: hidden;
}

.game-wrapper {
    display: flex;
    gap: 30px;
    padding: 25px;
    background: rgba(5, 5, 15, 0.9);
    border: 2px solid var(--neon-blue);
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0, 240, 240, 0.15);
    backdrop-filter: blur(8px);
}

.side-panel { display: flex; flex-direction: column; gap: 15px; }

.game-title { 
    font-size: 1.8rem; 
    margin: 0; 
    color: var(--neon-blue); 
    text-shadow: 0 0 15px var(--neon-blue); 
    letter-spacing: 2px;
    line-height: 1;
}

.stat-box { 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid var(--border); 
    padding: 12px; 
    text-align: center; 
}

.label { font-size: 0.6rem; color: var(--neon-blue); letter-spacing: 2px; margin-bottom: 5px; }
.value { font-size: 1.5rem; font-weight: bold; }

.stats-row { display: flex; gap: 10px; }
.desc-text { font-size: 0.7rem; color: #667; margin: 0; text-transform: uppercase; }

.score-entry { display: flex; justify-content: space-between; font-size: 0.8rem; margin: 4px 0; color: #889; }
.score-entry span:first-child { color: var(--neon-red); }

.main-board { position: relative; }
canvas#tetris { background: #000; border: 2px solid var(--border); width: 300px; height: 500px; }

/* Fixed Overlay: Ensure it is strictly hidden when the 'hidden' class is present */
.overlay-text { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: var(--neon-red); font-weight: bold; font-size: 1.8rem; z-index: 100;
    text-shadow: 0 0 20px var(--neon-red); text-align: center; width: 100%;
}

.hidden { display: none !important; }

#start-btn {
    width: 100%; padding: 15px; background: transparent; color: var(--neon-blue);
    border: 2px solid var(--neon-blue); font-weight: bold; cursor: pointer; 
    letter-spacing: 4px; transition: 0.3s;
}

#start-btn:hover { background: var(--neon-blue); color: #000; box-shadow: 0 0 20px var(--neon-blue); }

.mobile-controls { display: none; }
.hint { font-size: 0.65rem; color: #445; margin-top: 15px; text-align: center; }

@media (max-width: 768px) {
    .game-wrapper { flex-direction: column; align-items: center; padding: 15px; gap: 10px; }
    .desktop-only { display: none; }
    .mobile-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
    .t-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--neon-blue); color: var(--neon-blue); padding: 20px; font-size: 1.5rem; border-radius: 8px; }
    #rotate, #drop { grid-column: 2; }
    canvas#tetris { width: 80vw; height: auto; aspect-ratio: 3/5; }
}