/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-board {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.score-item {
    text-align: center;
    padding: 10px 20px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.score-item:hover {
    transform: translateY(-2px);
}

.score-item .label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.score-item span:last-child {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #4CAF50;
}

/* 主游戏区域 */
.game-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: start;
}

.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 460px;
}

#gameCanvas {
    border: 3px solid #333;
    border-radius: 10px;
    background: #1a1a1a;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

#gameCanvas:hover {
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
}

/* 游戏覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    transition: opacity 0.3s ease;
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #4CAF50;
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

/* 控制面板 */
.control-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-panel > div {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.control-panel h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(45deg, #2196F3, #64B5F6);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-danger {
    background: linear-gradient(45deg, #F44336, #EF5350);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

/* 难度按钮 */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-difficulty {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    color: #333;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.btn-difficulty:hover {
    background: linear-gradient(45deg, #e9ecef, #dee2e6);
    transform: translateY(-1px);
}

.btn-difficulty.active {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    border-color: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 操作说明 */
.instructions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instruction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.instruction-item:hover {
    background: #e9ecef;
}

.key {
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: bold;
}

.desc {
    font-size: 0.9rem;
    color: #666;
}

/* 移动端控制 */
.mobile-controls {
    display: none;
}

.dpad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 5px;
    max-width: 150px;
    margin: 0 auto;
}

.dpad-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.dpad-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.dpad-btn:active {
    transform: scale(0.95);
}

.dpad-up {
    grid-column: 2;
    grid-row: 1;
}

.dpad-middle {
    grid-column: 1 / 4;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
}

.dpad-down {
    grid-column: 2;
    grid-row: 3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .game-header {
        padding: 15px 20px;
        text-align: center;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .score-board {
        justify-content: center;
        gap: 15px;
    }
    
    .game-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-panel {
        width: 100%;
        order: 2;
    }
    
    .game-area {
        order: 1;
        padding: 20px;
        min-height: auto;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .mobile-controls {
        display: block;
    }
    
    .instructions-section {
        display: none;
    }
    
    .difficulty-buttons,
    .control-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn {
        flex: 1;
        min-width: 80px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-item {
        padding: 8px 15px;
    }
    
    .score-item span:last-child {
        font-size: 1.5rem;
    }
    
    .game-area {
        padding: 15px;
    }
    
    #gameCanvas {
        max-width: 300px;
    }
    
    .control-panel > div {
        padding: 15px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.btn-primary:not(:disabled):hover {
    animation: pulse 0.6s ease-in-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.8);
}

