* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    text-align: center;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 15px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.game-container {
    margin-bottom: 15px;
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

#gameCanvas {
    border: 2px solid #333;
    background-color: #e6f7ff;
    border-radius: 5px;
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.info-panel {
    text-align: center;
}

.score {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

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

.controls button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    min-width: 90px;
}

.controls button:hover,
.controls button:active {
    background-color: #45a049;
}

.controls button:nth-child(2) {
    background-color: #ff9800;
}

.controls button:nth-child(2):hover,
.controls button:nth-child(2):active {
    background-color: #e68900;
}

.controls button:nth-child(3) {
    background-color: #f44336;
}

.controls button:nth-child(3):hover,
.controls button:nth-child(3):active {
    background-color: #da190b;
}

.instructions {
    margin-top: 15px;
    color: #666;
    font-size: 0.8em;
    display: none; /* 在移动端默认隐藏文字说明 */
}

/* 移动端虚拟方向按钮样式 */
.mobile-controls {
    margin-top: 20px;
    display: block;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    width: 200px;
    height: 200px;
}

.d-pad-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 8px;
    background-color: #3498db;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    transition: all 0.1s;
}

.d-pad-btn:active {
    background-color: #2980b9;
    transform: scale(0.95);
}

.d-pad-middle {
    display: flex;
    gap: 80px;
    margin: 10px 0;
}

/* 使用伪元素添加箭头符号 */
.d-pad-btn.up::before {
    content: '↑';
}

.d-pad-btn.down::before {
    content: '↓';
}

.d-pad-btn.left::before {
    content: '←';
}

.d-pad-btn.right::before {
    content: '→';
}

/* 响应式设计 */
@media (min-width: 768px) {
    .container {
        max-width: 500px;
        padding: 20px;
    }
    
    h1 {
        font-size: 2.5em;
        margin-bottom: 20px;
    }
    
    .score {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .instructions {
        display: block;
    }
    
    .mobile-controls {
        display: none; /* 在桌面端隐藏虚拟方向按钮 */
    }
}