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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* 移动设备全屏布局 */
@media (max-width: 768px) {
    body {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }
}

.game-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    margin: 0 auto;
}

/* 移动设备全屏布局 */
@media (max-width: 768px) {
    .game-container {
        border-radius: 0;
        padding: 10px;
        box-shadow: none;
        height: 100vh;
        display: flex;
        flex-direction: column;
        margin: 0;
    }
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.tetris-canvas {
    border: 2px solid #333;
    background-color: #000;
    border-radius: 5px;
    display: block;
    max-width: 100%;
    height: auto;
}

/* 移动设备上自动调整画布大小 */
@media (max-width: 768px) {
    .tetris-canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.next-piece {
    background-color: #f8f8f8;
    border-radius: 5px;
    padding: 10px;
}

.next-piece h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

#nextPiece {
    border: 1px solid #ddd;
    background-color: #000;
    display: block;
    margin: 0 auto;
}

.score-board {
    background-color: #f8f8f8;
    border-radius: 5px;
    padding: 15px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.score-item:last-child {
    margin-bottom: 0;
}

.score-item span:first-child {
    color: #666;
}

.score-item span:last-child {
    color: #333;
    font-weight: bold;
}

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

.audio-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

/* 移动设备上的音频控制样式 */
@media (max-width: 768px) {
    .audio-controls {
        margin-bottom: 120px; /* 为底部控制按钮留出空间 */
    }
}

.control-btn {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-btn:hover:not(:disabled) {
    background-color: #45a049;
}

.control-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.mobile-controls {
    display: none;
    margin-bottom: 20px;
}

/* 移动设备上固定底部控制 */
@media (max-width: 768px) {
    .mobile-controls {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(255, 255, 255, 0.95);
        padding: 15px 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
}

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

.mobile-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.mobile-btn:active {
    transform: scale(0.95);
}

.action-btn {
    background-color: #FF9800;
    width: 80px;
    height: 80px;
    font-size: 1.2rem;
}

.instructions {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .game-area {
        flex-direction: column;
        align-items: center;
        flex: 1;
        overflow-y: auto;
        margin-bottom: 10px;
    }
    
    .game-info {
        width: 100%;
        max-width: 300px;
    }
    
    .instructions {
        font-size: 0.8rem;
        margin-bottom: 120px; /* 为底部控制按钮留出空间 */
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .action-btn {
        width: 70px;
        height: 70px;
        font-size: 1rem;
    }
    
    .control-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}