/* 游戏全局样式 */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    height: 100vh;
}

#game-container {
    height: 100vh;
    position: relative;
}

/* 屏幕切换基础样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* 加载界面 */
#loading-screen {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
}

.game-title {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
}

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* 主菜单样式 */
#main-menu {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.game-subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-buttons .btn {
    min-width: 200px;
    font-size: 1.1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.menu-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.version-info {
    margin-top: 2rem;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* 关卡选择界面 */
#level-select {
    background: linear-gradient(135deg, #81C784, #4CAF50);
    padding: 2rem;
    overflow-y: auto;
}

.level-header h2 {
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.level-button {
    background: linear-gradient(135deg, #FFF, #F5F5F5);
    border: 3px solid #4CAF50;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.level-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-color: #388E3C;
}

.level-button.locked {
    background: #E0E0E0;
    border-color: #BDBDBD;
    cursor: not-allowed;
    opacity: 0.6;
}

.level-button.completed {
    background: linear-gradient(135deg, #C8E6C9, #A5D6A7);
    border-color: #2E7D32;
}

.level-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.level-stars {
    font-size: 1.2rem;
    color: #FFD700;
    margin: 0.5rem 0;
}

.level-difficulty {
    font-size: 0.9rem;
    color: #666;
}

/* 帮助和设置界面 */
#help-screen, #settings-screen {
    background: linear-gradient(135deg, #E8F5E8, #C8E6C9);
    padding: 2rem;
    overflow-y: auto;
}

.help-container, .settings-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.help-content h4 {
    color: #2E7D32;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.help-content ul {
    list-style-type: none;
    padding-left: 0;
}

.help-content li {
    background: #F1F8E9;
    margin: 0.5rem 0;
    padding: 0.8rem;
    border-radius: 5px;
    border-left: 4px solid #4CAF50;
}

/* 游戏界面样式 */
#game-screen {
    background: #87CEEB;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.game-top-ui {
    background: rgba(0,0,0,0.8);
    color: white;
    height: 60px;
    z-index: 10;
}

.sun-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,193,7,0.2);
    border-radius: 20px;
    padding: 0.5rem 1rem;
}

.sun-icon {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #FFD700, #FFA000);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.sun-icon::before {
    content: '☀️';
    font-size: 1.2em;
}

#sun-count {
    font-size: 1.3rem;
    font-weight: bold;
    color: #FFD700;
}

.level-info {
    font-size: 1.1rem;
    font-weight: bold;
}

/* 植物选择栏 */
.plant-selector-container {
    background: rgba(0,0,0,0.7);
    padding: 0.5rem;
    z-index: 9;
}

.plant-selector {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.plant-card {
    min-width: 70px;
    height: 80px;
    background: linear-gradient(135deg, #FFF, #F0F0F0);
    border: 2px solid #4CAF50;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
}

.plant-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-color: #2E7D32;
}

.plant-card.selected {
    border-color: #FF6B35;
    box-shadow: 0 0 10px rgba(255,107,53,0.5);
    transform: translateY(-3px);
}

.plant-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.plant-icon {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.plant-cost {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(255,193,7,0.9);
    color: #333;
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.plant-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
}

/* 游戏画布 */
.game-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 70%, #228B22 100%);
}

/* 游戏内覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
}

.wave-progress {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 200px;
    pointer-events: auto;
}

.wave-info {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    text-align: center;
}

#wave-text {
    font-weight: bold;
    margin-bottom: 0.5rem;
    display: block;
}

.wave-progress-bar {
    height: 8px;
}

.shovel-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.shovel-tool {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8D6E63, #5D4037);
    border: 3px solid #3E2723;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.shovel-tool:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.shovel-tool i {
    color: #FFF;
    font-size: 1.5rem;
}

.shovel-tool.active {
    border-color: #FF6B35;
    box-shadow: 0 0 15px rgba(255,107,53,0.6);
}

/* 暂停和游戏结束界面 */
#pause-screen, #game-over-screen {
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.pause-container, .game-over-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 400px;
    width: 90%;
}

.pause-container h2, .game-over-container h2 {
    color: #2E7D32;
    margin-bottom: 1.5rem;
}

.pause-buttons, .game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-stats {
    background: #F5F5F5;
    border-radius: 8px;
    padding: 1rem;
    text-align: left;
}

.game-stats h5 {
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 0.3rem 0;
}

/* 阳光动画 */
.sun-drop {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #FFD700, #FFA000);
    border-radius: 50%;
    cursor: pointer;
    z-index: 8;
    animation: sunGlow 2s ease-in-out infinite alternate;
    box-shadow: 0 0 15px rgba(255,215,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sun-drop::before {
    content: '☀️';
    font-size: 1.5em;
}

@keyframes sunGlow {
    0% { box-shadow: 0 0 15px rgba(255,215,0,0.6); }
    100% { box-shadow: 0 0 25px rgba(255,215,0,0.9); }
}

.sun-collect-animation {
    animation: sunCollect 0.8s ease-out forwards;
}

@keyframes sunCollect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
}

/* 子弹和特效 */
.bullet {
    position: absolute;
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, #90EE90, #32CD32);
    border-radius: 50%;
    z-index: 7;
    box-shadow: 0 0 5px rgba(50,205,50,0.5);
}

.explosion {
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #FF6B35, #FF4500);
    border-radius: 50%;
    z-index: 6;
    animation: explode 0.5s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* 植物放置指示器 */
.plant-placement-indicator {
    position: absolute;
    border: 2px dashed #4CAF50;
    background: rgba(76,175,80,0.2);
    pointer-events: none;
    z-index: 6;
    border-radius: 5px;
}

/* 游戏网格线 */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.grid-line {
    position: absolute;
    background: rgba(255,255,255,0.1);
}

.grid-line.horizontal {
    width: 100%;
    height: 1px;
}

.grid-line.vertical {
    width: 1px;
    height: 100%;
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.8rem;
    z-index: 30;
    pointer-events: none;
    white-space: nowrap;
}

/* 通用按钮样式 */
.btn-game {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.btn-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

.btn-game:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 动画和过渡效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(76,175,80,0.7);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(76,175,80,0.9);
} 