* {
    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;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #333;
    margin: 0;
    padding: 0;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

h1 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

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

.score, .high-score {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.3);
}

.difficulty-selector {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.difficulty-selector label {
    font-weight: bold;
    color: #4a5568;
}

.difficulty-selector select {
    padding: 8px 16px;
    border: 2px solid #4a5568;
    border-radius: 10px;
    background: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    border-color: #48bb78;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

#gameCanvas {
    border: 4px solid #4a5568;
    border-radius: 10px;
    background-color: #2d3748;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.game-controls {
    margin-bottom: 20px;
}

.game-controls button {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 0 10px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.game-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.game-controls button:active {
    transform: translateY(0);
}

.game-controls button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#helpBtn {
    background: linear-gradient(45deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 0 10px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
}

#helpBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

#helpBtn:active {
    transform: translateY(0);
}

.instructions-content {
    text-align: left;
    line-height: 1.6;
}

.instructions-content p {
    margin: 8px 0;
    color: #4a5568;
}

.instructions-content strong {
    color: #2d3748;
}

#closeHelpBtn {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 30px;
    margin-top: 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

#closeHelpBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.mobile-controls {
    display: none;
    margin-top: 20px;
}

.control-row {
    display: flex;
    justify-content: center;
    margin: 5px 0;
}

.control-btn {
    background: linear-gradient(45deg, #4299e1, #3182ce);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    margin: 5px;
    border-radius: 50%;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.control-btn:active {
    transform: translateY(0);
    background: linear-gradient(45deg, #3182ce, #2c5282);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
    
    .mobile-controls {
        display: block;
    }
    
    .game-controls button {
        padding: 10px 20px;
        margin: 5px;
        font-size: 0.9em;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    animation: modalSlideIn 0.4s ease-out forwards;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 2em;
}

.modal-content p {
    margin: 10px 0;
    font-size: 1.2em;
    color: #4a5568;
}

#playAgainBtn {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 15px 30px;
    margin-top: 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

#playAgainBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes gameOver {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes victory {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.game-over {
    animation: gameOver 0.5s ease-in-out;
}

.victory {
    animation: victory 1s ease-in-out;
}

.pulse {
    animation: pulse 0.6s ease-in-out infinite;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
    width: 100%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

.footer p {
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}