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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a3d0f 0%, #2d5016 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#game-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100vh - 40px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.screen.hidden {
    display: none;
}

/* Welcome Screen */
.welcome-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 3rem;
    border-radius: 20px;
    border: 4px solid #8B4513;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.welcome-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.welcome-content h2 {
    font-size: 1.5rem;
    color: #FFD700;
    margin-bottom: 1.5rem;
}

.tagline {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #ccc;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.menu-btn {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    border: 3px solid #654321;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s;
    font-weight: bold;
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.high-score-display {
    font-size: 0.9rem;
    color: #FFD700;
}

/* Game Screen */
#game-screen {
    z-index: 1;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    z-index: 5;
    border-bottom: 3px solid #8B4513;
}

.hud-left, .hud-right {
    flex: 1;
}

.hud-center {
    flex: 2;
    text-align: center;
}

.garden-hp-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.hp-bar-container {
    width: 200px;
    height: 20px;
    background: #333;
    border: 2px solid #666;
    border-radius: 10px;
    overflow: hidden;
}

.hp-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff0000 0%, #ff6666 100%);
    width: 100%;
    transition: width 0.3s;
}

#game-canvas {
    display: block;
    background: #2d5016;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Stats Panel */
#stats-panel {
    position: absolute;
    right: 10px;
    top: 80px;
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem;
    border-radius: 10px;
    border: 2px solid #8B4513;
    min-width: 200px;
    z-index: 5;
}

#stats-panel h3 {
    margin-bottom: 1rem;
    text-align: center;
    color: #FFD700;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.stat-row span:last-child {
    color: #FFD700;
    font-weight: bold;
}

/* Controls Guide */
#controls-guide {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    border: 2px solid #8B4513;
    z-index: 5;
    max-width: 200px;
}

.controls-header {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    color: #FFD700;
}

.controls-content {
    padding: 0 1rem 1rem 1rem;
    font-size: 0.85rem;
}

.controls-content div {
    margin-bottom: 0.3rem;
}

.controls-content.collapsed {
    display: none;
}

/* Upgrade Screen */
.upgrade-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
    padding: 2rem;
    border-radius: 20px;
    border: 4px solid #FFD700;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.upgrade-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #FFD700;
}

.wave-complete {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #90EE90;
}

.upgrade-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.upgrade-card {
    background: linear-gradient(135deg, #654321 0%, #8B4513 100%);
    border: 3px solid #A0522D;
    border-radius: 10px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.upgrade-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
}

.upgrade-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upgrade-card .title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #FFD700;
}

.upgrade-card .description {
    font-size: 0.9rem;
    color: #ccc;
}

/* Game Over Screen */
.gameover-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
    padding: 3rem;
    border-radius: 20px;
    border: 4px solid #ff0000;
}

.gameover-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #ff6666;
}

.final-stats {
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

.final-stats p {
    margin-bottom: 0.5rem;
}

.final-stats span {
    color: #FFD700;
    font-weight: bold;
}

#new-record {
    color: #FFD700;
    font-size: 1.5rem;
    margin-top: 1rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
    border-top: 2px solid #8B4513;
}

footer a {
    color: #FFD700;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-content h1 {
        font-size: 2rem;
    }
    
    .welcome-content {
        padding: 2rem 1rem;
    }
    
    #hud {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .hp-bar-container {
        width: 100px;
    }
    
    #stats-panel {
        font-size: 0.8rem;
        min-width: 150px;
    }
    
    .upgrade-cards {
        grid-template-columns: 1fr;
    }
}