body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    color: white;
    background-attachment: fixed;
}

.game-wrapper {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90vw;
    /* 添加contain属性提升渲染性能 */
    contain: layout style paint;
}

.game-header {
    text-align: center;
    margin-bottom: 15px;
}

.game-title {
    font-size: 2.5rem;
    margin: 0;
    background: linear-gradient(to right, #ffd700, #ffa500, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
    animation: titleGlow 2s infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #e60073, 0 0 20px #e60073;
    }
    to {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6;
    }
}

.game-subtitle {
    font-size: 1rem;
    color: #ccc;
    margin-top: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.game-container {
    position: relative;
    margin: 0 auto;
}

#game-canvas {
    border: 3px solid #444;
    border-radius: 8px;
    background: linear-gradient(135deg, #87CEEB, #E0F7FA);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    max-width: 100%;
    height: auto;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 10px 20px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    /* 添加contain属性提升渲染性能 */
    contain: layout style paint;
}

.stat-item {
    display: flex;
    align-items: center;
    margin: 5px 10px;
}

.stat-icon {
    margin-right: 8px;
    font-size: 1.2rem;
}

.stat-value {
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.5);
}

.instructions {
    display: none;
}

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

.control-button {
    background: linear-gradient(to bottom, #4a90e2, #357abd);
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    outline: none;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    background: linear-gradient(to bottom, #5aa0f2, #458ace);
}

.control-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-wrapper {
        padding: 15px;
        margin: 10px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    .stats-bar {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
    
    .stat-item {
        margin: 3px 5px;
    }
    
    .mobile-controls {
        display: block;
    }
    
    #game-canvas {
        width: 95vw;
        height: auto;
    }
    
    .control-button {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-wrapper {
        padding: 10px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .game-subtitle {
        font-size: 0.8rem;
    }
    
    .stats-bar {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .stat-item {
        margin: 2px 3px;
    }
    
    .stat-icon {
        font-size: 1rem;
    }
    
    .control-button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}