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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #000;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
}

.main-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
}

/* --- Side Panels --- */
.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 140px;
    flex-shrink: 0;
}

.panel-box {
    background: #111;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.panel-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 8px;
}

.hold-box canvas,
.next-box canvas {
    display: block;
    margin: 0 auto;
    background: transparent;
}

/* --- Stats --- */
.stats-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* --- Controls List --- */
.controls-box {
    text-align: left;
}

.controls-list {
    list-style: none;
    font-size: 11px;
    color: #aaa;
    line-height: 1.8;
}

.controls-list kbd {
    display: inline-block;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 0 4px;
    font-family: inherit;
    font-size: 10px;
    color: #ddd;
    min-width: 18px;
    text-align: center;
}

/* --- Center / Game Board --- */
.center-panel {
    flex-shrink: 0;
}

.game-container {
    border: 2px solid #444;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

#tetrisCanvas {
    display: block;
    background-color: #000;
}

/* --- Overlay (Pause / Game Over) --- */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
}

.overlay-title {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: 12px;
}

.overlay-score {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 20px;
}

.overlay-button {
    padding: 8px 24px;
    font-size: 14px;
    font-family: inherit;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.overlay-button:hover {
    background: #555;
}

.overlay-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --- Texture Status --- */
.texture-status {
    font-size: 10px;
    line-height: 1.4;
    color: #ff8a8a;
    word-break: break-word;
    max-width: 140px;
}

/* --- Touch Controls (mobile) --- */
.touch-controls {
    display: none;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.touch-btn {
    width: 52px;
    height: 52px;
    font-size: 20px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.touch-btn:active {
    background: #333;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .main-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 10px;
    }

    .left-panel,
    .right-panel {
        flex-direction: row;
        width: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .left-panel {
        order: 2;
    }

    .center-panel {
        order: 1;
    }

    .right-panel {
        order: 3;
    }

    .controls-box {
        display: none;
    }

    .touch-controls {
        display: flex;
    }

    .texture-status {
        max-width: 100%;
    }
}