/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 30%, #f9fbe7 70%, #f0f4c3 100%);
    color: #2e7d32;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* 游戏容器 */
.game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    background: linear-gradient(135deg, rgba(232, 245, 232, 0.4) 0%, rgba(241, 248, 233, 0.4) 50%, rgba(249, 251, 231, 0.4) 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(139, 195, 74, 0.2);
    backdrop-filter: blur(10px);
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 15px;
}

.game-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 50%, #cddc39 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.score-item {
    background: linear-gradient(135deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 195, 74, 0.3);
    box-shadow: 0 4px 12px rgba(139, 195, 74, 0.3);
    transition: all 0.3s ease;
}

.score-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 195, 74, 0.4);
}

.score-item .label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.score-item span:last-child {
    font-weight: bold;
    margin-left: 5px;
}

/* 游戏主体 */
.game-main {
    display: flex;
    flex: 1;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.game-board {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(139, 195, 74, 0.3);
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 50%, #f9fbe7 100%);
    border: 3px solid transparent;
    background-clip: padding-box;
}

.game-board::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
    border-radius: 15px;
    z-index: -1;
}

#gameCanvas {
    display: block;
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 50%, #4caf50 100%);
    border-radius: 12px;
}

/* 游戏覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 195, 74, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    border-radius: 12px;
}

.overlay-content {
    text-align: center;
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 50%, #f9fbe7 100%);
    color: #2e7d32;
    padding: 30px;
    border-radius: 20px;
    border: 2px solid rgba(139, 195, 74, 0.4);
    box-shadow: 0 15px 30px rgba(139, 195, 74, 0.3);
    backdrop-filter: blur(10px);
}

.overlay-content h2 {
    margin-bottom: 15px;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 50%, #cddc39 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.overlay-content p {
    margin-bottom: 20px;
    opacity: 0.8;
    color: #388e3c;
}

/* 游戏按钮 */
.game-btn {
    background: linear-gradient(45deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    margin: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 195, 74, 0.3);
    font-weight: 600;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 195, 74, 0.4);
    background: linear-gradient(45deg, #8bc34a 0%, #aed581 50%, #c5e1a5 100%);
}

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

/* 侧边栏 */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}



/* 手机端控制 */
.mobile-controls {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    pointer-events: none;
    z-index: 20;
}

.mobile-controls-left {
    position: absolute;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
}

.mobile-controls-right {
    position: absolute;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
}

.control-btn {
    width: 55px;
    height: 55px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(45deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(139, 195, 74, 0.3);
    user-select: none;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.control-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* 游戏统计界面 */
.game-stats {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 125, 50, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.stats-content {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
    color: #1b5e20;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 20px 40px rgba(46, 125, 50, 0.4);
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.stats-content h2 {
    margin-bottom: 25px;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(46, 125, 50, 0.3);
    box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
}

.achievement {
    background: linear-gradient(45deg, #81c784, #66bb6a);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: bold;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(46, 125, 50, 0.3);
}

.end-summary {
    margin: 16px 0 24px;
    font-size: 1.05rem;
    line-height: 1.8;
}
.end-summary strong {
    color: #2e7d32;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 5px;
        position: relative;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-board {
        gap: 10px;
    }
    
    .score-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .game-main {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        position: relative;
    }
    
    .game-board {
        position: relative;
        z-index: 10;
    }
    
    .game-sidebar {
        flex-direction: row;
        justify-content: center;
        min-width: unset;
        width: 100%;
    }
    

    
    .mobile-controls {
        display: block;
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stats-content {
        padding: 20px;
        width: 95%;
    }

}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.3rem;
    }
    
    .score-board {
        gap: 8px;
    }
    
    .score-item {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    #gameCanvas {
        width: 200px;
        height: 400px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .mobile-controls-left,
    .mobile-controls-right {
        gap: 10px;
    }
    
    .mobile-controls-left {
        left: 5px;
    }
    
    .mobile-controls-right {
        right: 5px;
    }
    
    .game-sidebar {
        flex-direction: column;
        gap: 10px;
    }
    

}

/* 隐藏类 */
.hidden {
    display: none !important;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.pulse {
    animation: pulse 2s infinite;
}
