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

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

.game-container {
    position: relative;
    border: 3px solid #8B4513;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 70%, #90EE90 70%);
}

/* 游戏控制按钮 */
.game-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn.active {
    background: #ff6b6b;
    color: white;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.score {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 36px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

.high-score {
    position: absolute;
    top: 65px;
    left: 20px;
    font-size: 16px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

/* 通用屏幕样式 */
.start-screen, .game-over-screen, .pause-screen, .settings-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.98);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.start-screen h1 {
    font-size: 36px;
    color: #FF6347;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.start-screen p {
    font-size: 16px;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* 难度选择器 */
.difficulty-selector {
    margin: 20px 0;
    padding: 15px;
    background: rgba(240, 240, 240, 0.8);
    border-radius: 10px;
}

.difficulty-selector label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.difficulty-selector select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #FF6347;
}

/* 游戏结束屏幕 */
.game-over-screen {
    display: none;
}

.game-over-screen.show {
    display: block;
}

.game-over-screen h2 {
    font-size: 32px;
    color: #FF4500;
    margin-bottom: 25px;
}

.score-display {
    background: rgba(240, 248, 255, 0.8);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.score-display p {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.game-stats {
    background: rgba(248, 248, 248, 0.8);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.game-stats p {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

/* 暂停屏幕 */
.pause-screen {
    display: none;
}

.pause-screen.show {
    display: block;
}

.pause-screen h2 {
    font-size: 28px;
    color: #4CAF50;
    margin-bottom: 20px;
}

.pause-screen p {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
}

/* 设置屏幕 */
.settings-screen {
    display: none;
    text-align: left;
    width: 500px;
    max-width: 95vw;
}

.settings-screen.show {
    display: block;
}

.settings-screen h2 {
    text-align: center;
    font-size: 28px;
    color: #333;
    margin-bottom: 25px;
}

.settings-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(248, 248, 248, 0.8);
    border-radius: 12px;
}

.settings-section h3 {
    font-size: 18px;
    color: #444;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.setting-item {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.setting-item label {
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.setting-item select, .setting-item input[type="range"] {
    flex: 1;
    min-width: 150px;
}

.setting-item select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.setting-item input[type="range"] {
    margin-right: 10px;
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* 统计信息网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border-left: 4px solid #FF6347;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

/* 按钮样式 */
.game-btn {
    background: linear-gradient(135deg, #FF6347, #FF4500);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    box-shadow: 0 4px 15px rgba(255, 99, 71, 0.3);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 99, 71, 0.4);
}

.game-btn.secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.game-btn.secondary:hover {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.game-btn.danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.game-btn.danger:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.button-group {
    text-align: center;
    margin-top: 20px;
}

.start-screen.hide, .game-over-screen.hide, .pause-screen.hide, .settings-screen.hide {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .settings-screen {
        width: 95vw;
        padding: 20px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .setting-item label {
        margin-bottom: 8px;
        min-width: auto;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .game-controls {
        top: 5px;
        right: 5px;
        gap: 5px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #gameCanvas {
        width: 100vw;
        height: 100vh;
    }
    
    .game-container {
        border: none;
        border-radius: 0;
    }
    
    .score {
        font-size: 28px;
        top: 15px;
        left: 15px;
    }
    
    .high-score {
        font-size: 14px;
        top: 50px;
        left: 15px;
    }
    
    .start-screen, .game-over-screen, .pause-screen, .settings-screen {
        padding: 20px 15px;
        width: 95%;
        max-width: none;
    }
    
    .start-screen h1 {
        font-size: 24px;
    }
    
    .start-screen p {
        font-size: 14px;
    }
    
    .game-over-screen h2, .pause-screen h2 {
        font-size: 20px;
    }
    
    .score-display p, .game-stats p {
        font-size: 16px;
    }
    
    .game-btn {
        padding: 10px 20px;
        font-size: 14px;
        margin: 3px;
    }
    
    .settings-screen h2 {
        font-size: 22px;
    }
    
    .settings-section h3 {
        font-size: 16px;
    }
    
    .difficulty-selector {
        padding: 10px;
    }
    
    .difficulty-selector select {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .start-screen, .game-over-screen, .pause-screen, .settings-screen {
        background: rgba(40, 40, 40, 0.98);
        color: #fff;
    }
    
    .settings-section {
        background: rgba(60, 60, 60, 0.8);
    }
    
    .setting-item label {
        color: #ddd;
    }
    
    .stat-item {
        background: rgba(80, 80, 80, 0.8);
        color: #fff;
    }
    
    .stat-label {
        color: #ccc;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
    from { transform: translate(-50%, -60%); opacity: 0; }
    to { transform: translate(-50%, -50%); opacity: 1; }
}

.start-screen, .game-over-screen.show, .pause-screen.show, .settings-screen.show {
    animation: slideIn 0.3s ease-out;
}

.game-btn {
    position: relative;
    overflow: hidden;
}

.game-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.game-btn:active::before {
    width: 300px;
    height: 300px;
}