body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
}

.game-container {
    text-align: center;
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100vh;
    box-sizing: border-box;
}

#gameCanvas {
    border: 2px solid #333;
    background-color: #1a1a1a;
    width: 100%;
    height: auto;
    max-width: 100%;
    touch-action: none; /* 防止触摸滚动 */
}

.score {
    font-size: 24px;
    margin: 10px 0;
    color: #333;
    font-weight: bold;
}

h1 {
    font-size: 28px;
    margin-top: 0;
}

/* 控制按钮样式 */
#controls {
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.horizontal-container {
    display: flex;
    justify-content: center;
    margin: 5px 0;
}

.control-btn {
    width: 80px;
    height: 80px;
    margin: 5px;
    font-size: 24px;
    font-weight: bold;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 0 #2980b9;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.control-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #2980b9;
}

/* 游戏结束对话框样式 */
.game-over-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    text-align: center;
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

.game-over-dialog h2 {
    color: #e74c3c;
    font-size: 32px;
    margin-top: 0;
}

.game-over-dialog p {
    font-size: 24px;
    margin: 20px 0;
}

.restart-btn {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 0 #27ae60;
    touch-action: manipulation;
}

.restart-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #27ae60;
}

/* 适配小屏幕设备 */
@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .score {
        font-size: 20px;
    }
    
    .control-btn {
        width: 70px;
        height: 70px;
        font-size: 20px;
    }
    
    .game-over-dialog {
        padding: 20px;
    }
    
    .game-over-dialog h2 {
        font-size: 28px;
    }
    
    .game-over-dialog p {
        font-size: 20px;
    }
}