* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: bold;
}

.score, .high-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid #667eea;
    border-radius: 10px;
    background-color: #f5f5f5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.game-over.hidden {
    display: none;
}

.game-over-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-over-content h2 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 2em;
}

.game-over-content p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #555;
}

.game-over-content span {
    font-weight: bold;
    color: #667eea;
    font-size: 1.3em;
}

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

.controls button {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#startBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#startBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#pauseBtn {
    background: #e74c3c;
    color: white;
}

#pauseBtn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

#restartBtn {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.3s ease;
}

#restartBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.instructions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.instructions p {
    color: #555;
    margin: 5px 0;
    font-size: 0.95em;
}

/* 移动端控制按钮 */
.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 15px;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.middle-row {
    display: flex;
    gap: 5px;
    /* 重新排序：左、下、右 */
    justify-content: center;
    align-items: center;
}

/* 响应式设计 */
@media (max-width: 500px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    #gameCanvas {
        width: 300px;
        height: 300px;
    }

    .game-info {
        font-size: 0.9em;
    }

    .score, .high-score {
        padding: 8px 15px;
    }

    .mobile-controls {
        display: flex;
    }
}
