* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.game-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 90%;
    max-width: 500px;
}

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

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

/* 速度控制区域样式 */
.speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1rem;
    color: #4a5568;
}

#speedSlider {
    width: 150px;
    cursor: pointer;
}

/* 移动设备上的速度控制样式 */
@media (max-width: 480px) {
    .speed-control {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    #speedSlider {
        width: 100%;
        max-width: 200px;
    }
}

.score, .level {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4a5568;
}

#gameCanvas {
    border: 3px solid #4a5568;
    border-radius: 10px;
    margin-bottom: 20px;
    background: #f7fafc;
}

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

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

/* 缩小的控制按钮样式 */
.control-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #4a5568;
    color: white;
    min-width: 80px;
}

.btn:hover:not(:disabled) {
    background: #2d3748;
    transform: translateY(-2px);
}

.btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.game-instructions {
    font-size: 0.9rem;
    color: #718096;
}

/* 方向键控制样式 */
.direction-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    display: none; /* 默认隐藏，在移动设备上显示 */
}

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

.direction-row:first-child {
    margin-bottom: 10px;
}

.direction-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #4a5568;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.direction-btn:hover {
    background: #2d3748;
    transform: translateY(-2px);
}

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

/* 响应式设计 */
@media (max-width: 480px) {
    .game-container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .game-controls {
        flex-wrap: wrap;
    }
    
    /* 增强移动设备上的控制按钮点击体验 */
    .control-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        min-width: 70px;
        min-height: 40px;
        border-radius: 8px;
        touch-action: manipulation; /* 防止双击缩放 */
        -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
    }
    
    /* 添加控制按钮触摸反馈效果 */
    .control-btn:not(:disabled) {
        transition: all 0.1s ease;
    }
    
    .control-btn:not(:disabled):active {
        transform: scale(0.95);
    }
    
    /* 在移动设备上显示方向键 */
    .direction-controls {
        display: block;
    }
    
    /* 调整移动设备上的方向键大小 */
    .direction-btn {
        width: 70px;
        height: 70px;
        font-size: 1.7rem;
        border-radius: 12px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}