* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
}

.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    width: 100%;
    max-width: 900px;
    gap: 20px;
}

.game-board-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-board {
    display: block;
    background-color: #2c3e50;
    border: 2px solid #34495e;
    border-radius: 5px;
}

/* 下一个方块预览 */
.next-piece-preview {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(44, 62, 80, 0.7);
    border-radius: 5px;
    padding: 5px;
}

#next-piece {
    display: block;
    background-color: transparent;
}

/* 游戏信息显示 */
.game-info-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background-color: rgba(44, 62, 80, 0.7);
    padding: 10px;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    z-index: 10;
}

/* 游戏控制按钮 */
.game-controls {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

button {
    padding: 8px 16px;
    background-color: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: rgba(41, 128, 185, 0.8);
}

#pause-button {
    background-color: rgba(231, 76, 60, 0.8);
}

#pause-button:hover {
    background-color: rgba(192, 57, 43, 0.8);
}

/* 触屏控制 */
.touch-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* 默认隐藏，在移动设备上显示 */
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 300px;
}

.touch-controls-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.control-btn {
    width: 60px;
    height: 45px;
    background-color: rgba(52, 152, 219, 0.7);
    color: white;
    border: none;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#rotate-btn {
    background-color: rgba(155, 89, 182, 0.7);
    width: 80px;
}

#drop-btn {
    background-color: rgba(46, 204, 113, 0.7);
    width: 200px;
}

.control-btn:active {
    opacity: 0.5;
}

/* PC端控制说明 */
.desktop-controls {
    width: 250px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls-info h2 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.key-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.key {
    background-color: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    padding: 5px 10px;
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.key-desc {
    color: #7f8c8d;
    font-size: 14px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        flex-direction: column;
        align-items: center;
    }
    
    .game-board-container {
        width: 100%;
    }
    
    #game-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1/2;
    }
    
    .next-piece-preview {
        transform: scale(0.8);
    }
    
    .game-info-overlay {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .touch-controls {
        display: flex; /* 在移动设备上显示 */
    }
    
    .control-btn {
        width: 50px;
        height: 40px;
        font-size: 14px;
    }
    
    #rotate-btn {
        width: 70px;
    }
    
    #drop-btn {
        width: 170px;
    }
    
    .game-controls button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* 在移动设备上隐藏PC端控制说明 */
    .desktop-controls {
        display: none;
    }
}

/* 桌面端样式调整 */
@media (min-width: 769px) {
    .container {
        justify-content: center;
    }
    
    .game-board-container {
        margin-right: 20px;
    }
    
    #game-board {
        width: 300px;
        height: 600px;
    }
}