body {
    background: #1a1a2e;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    touch-action: none;
    overscroll-behavior: none;
}

.game-title {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 4rem;
    font-weight: 900;
    color: #e94560;
    letter-spacing: 15px;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
}

.game-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #16213e;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5), 0 0 20px rgba(78, 184, 68, 0.2);
    border: 2px solid #0f3460;
}

canvas {
    background-color: #0f3460;
    /* border: 4px solid #0f3460;*/
    display: block;
}

#tetris {
    width: 240px;
    height: 400px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    border-radius: 5px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 120px;
}

.stat-box {
    background: #0f3460;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
}

.label {
    font-size: 0.8rem;
    color: #e94560;
    font-weight: bold;
    margin-bottom: 5px;
}

.value {
    font-size: 1.5rem;
    font-family: ui-monospace, "SF Mono", 'Courier New', Courier, monospace;
}

#next {
    background: #0f3460;
    margin: 0 auto;
    width: 80px;
    height: 100px;
}

.footer {
    position: fixed;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.controls {
    font-size: 0.8rem;
    color: #95a5a6;
    text-align: center;
}

.credits {
    font-size: 0.8rem;
    color: #95a5a6;
    opacity: 0.8;
}

#start-btn {
    background: #e94560;
    color: white;
    border: none;
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s;
    font-weight: 700;
    touch-action: manipulation;
}

#start-btn:hover {
    background: #ff4d6d;
}

.mobile-controls {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    justify-content: space-around;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.d-pad-mid {
    display: flex;
    gap: 10px;
}

.ctrl-btn {
    background: #0f3460;
    color: white;
    border: 2px solid #e94560;
    border-radius: 12px;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 #8a2c40;
    transition: all 0.1s;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ctrl-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #8a2c40;
}

.drop-btn {
    width: 100px;
    height: 60px;
    font-weight: bold;
    font-size: 1rem;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    .footer .controls {
        display: none; /* Hide keyboard instructions on mobile */
    }
    .credits {
        display: none; /* Hide credits on mobile */
    }
    body {
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 20px;
    }
    .game-title {
        display: none; /* Title takes too much space on small screens */
    }
}
