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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background: #1e1e2e;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 100%;
}

.preview-layout-container {
    max-width: 760px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.header h1 {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 3px;
}

.game-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.preview-main-content {
    width: 100%;
    justify-content: center;
    align-items: stretch;
}

canvas {
    background: #000;
    border: 3px solid #00ff88;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

#gameCanvas {
    display: block;
    flex: 0 0 auto;
}

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

.preview-stats-panel {
    width: 120px;
    flex: 0 0 120px;
}

.preview-queue-panel {
    width: 150px;
    flex: 0 0 150px;
}

.info-box {
    background: #2a2a3e;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #00ff88;
    text-align: center;
    min-width: 120px;
}

.info-box .label {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.info-box .value {
    color: #00ff88;
    font-size: 28px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.next-box {
    background: #2a2a3e;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #00ff88;
    text-align: center;
}

.queue-box {
    background: #2a2a3e;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #00ff88;
    text-align: center;
    height: 100%;
}

.next-box .label,
.queue-box .label {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

#nextPieceCanvas {
    background: #000;
    border: 1px solid #444;
    display: block;
    width: 100%;
    border-radius: 3px;
}

.queue-controls {
    margin-bottom: 10px;
}

.queue-controls label {
    display: block;
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.queue-controls select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #00ff88;
    border-radius: 4px;
    background: #12121c;
    color: #00ff88;
    font-weight: bold;
}

.next-queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 492px;
    overflow-y: auto;
}

.preview-canvas {
    width: 100%;
    height: 60px;
    background: #000;
    border: 1px solid #444;
    border-radius: 3px;
    display: block;
}

.next-empty {
    color: #888;
    font-size: 12px;
    line-height: 1.5;
    padding: 12px 8px;
    border: 1px dashed #444;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #00ff88;
    background: transparent;
    color: #00ff88;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

button:hover {
    background: #00ff88;
    color: #1e1e2e;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.instructions {
    background: #2a2a3e;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid #00ff88;
    color: #ddd;
}

.instructions h3 {
    color: #00ff88;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instructions ul {
    list-style: none;
    font-size: 14px;
    line-height: 1.8;
}

.instructions li {
    margin-bottom: 8px;
}

.instructions strong {
    color: #00ff88;
}

.mobile-controls {
    display: none;
    gap: 10px;
    margin-bottom: 20px;
    flex-direction: column;
}

.control-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mobile-btn {
    padding: 15px 20px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #00ff88;
    background: transparent;
    color: #00ff88;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    flex: 1;
    min-width: 70px;
    user-select: none;
}

.mobile-btn:active {
    background: #00ff88;
    color: #1e1e2e;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    transform: scale(0.95);
}

.rotate-btn {
    flex-basis: 100%;
}

.drop-btn {
    background: rgba(0, 255, 136, 0.1);
}

.drop-btn:active {
    background: #ff7000;
    border-color: #ff7000;
    box-shadow: 0 0 20px rgba(255, 112, 0, 0.6);
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container,
    .preview-layout-container {
        padding: 15px;
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 32px;
        margin-bottom: 15px;
    }
    
    .game-wrapper {
        margin-bottom: 15px;
    }
    
    .main-content,
    .preview-main-content {
        flex-direction: column;
        align-items: center;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
    
    .info-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .info-box, .next-box {
        flex: 1;
        min-width: 70px;
        padding: 10px;
        font-size: 12px;
    }

    .preview-stats-panel,
    .preview-queue-panel,
    .queue-box {
        width: 100%;
        flex: none;
    }

    .info-box .value {
        font-size: 20px;
    }

    .next-queue-list {
        max-height: 320px;
    }

    .preview-canvas {
        height: 52px;
    }

    .controls {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }

    button {
        padding: 10px 15px;
        font-size: 12px;
        flex: 1;
        min-width: 60px;
    }

    .mobile-controls {
        display: flex;
    }

    .mobile-btn {
        padding: 12px 15px;
        font-size: 13px;
    }

    .instructions {
        padding: 15px;
        font-size: 12px;
    }

    .instructions h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .instructions ul {
        font-size: 12px;
        line-height: 1.6;
    }

    .instructions li {
        margin-bottom: 5px;
    }
}
