* {
    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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

#gameCanvas {
    border: 3px solid #333;
    border-radius: 10px;
    background-color: #fafafa;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.score {
    color: #28a745;
}

.level {
    color: #007bff;
}

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

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

#startBtn {
    background-color: #28a745;
    color: white;
}

#startBtn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

#pauseBtn {
    background-color: #ffc107;
    color: #212529;
}

#pauseBtn:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
}

#resetBtn {
    background-color: #dc3545;
    color: white;
}

#resetBtn:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.instructions {
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 500px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    button {
        flex: 1;
        min-width: 100px;
    }
}

/* 移动端方向键控制 */
.mobile-controls {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 150px;
    height: 150px;
    margin: 10px auto 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 10px;
}

.mobile-controls button {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    min-height: 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mobile-controls button:active {
    background-color: #0056b3;
    transform: scale(0.95);
}

#up {
    grid-column: 2;
    grid-row: 1;
}

#left {
    grid-column: 1;
    grid-row: 2;
}

#down {
    grid-column: 2;
    grid-row: 3;
}

#right {
    grid-column: 3;
    grid-row: 2;
}

/* 隐藏中间的空白格子 */
.mobile-controls > div:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
    visibility: hidden;
}

/* 移动设备上始终显示控制按钮 */
@media (max-width: 768px) {
    .mobile-controls {
        display: grid;
    }
}