* {
    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;
    padding: 20px;
}

.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.difficulty {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.difficulty-buttons {
    display: flex;
    margin-left: 10px;
    gap: 5px;
}

.difficulty-btn {
    padding: 5px 10px;
    font-size: 14px;
    background-color: #e0e0e0;
    color: #333;
}

.difficulty-btn:hover {
    background-color: #d0d0d0;
}

.difficulty-btn.active {
    background-color: #4CAF50;
    color: white;
}

canvas {
    border: 2px solid #333;
    background-color: #f8f8f8;
    display: block;
    margin: 0 auto;
}

.controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

button {
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.instructions {
    margin-top: 20px;
    text-align: left;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.instructions h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.instructions p {
    margin-bottom: 5px;
    color: #555;
}

/* 游戏结束时的弹窗样式 */
.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 10;
}

.game-over h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.game-over p {
    margin-bottom: 15px;
}

.game-over button {
    background-color: #f44336;
}

.game-over button:hover {
    background-color: #d32f2f;
}

/* 响应式设计 */
@media (max-width: 500px) {
    canvas {
        width: 100%;
        height: auto;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    button {
        width: 100%;
        margin-bottom: 5px;
    }
}