* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: #1a1a2e;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#game-container {
    position: relative;
    width: 900px;
    height: 600px;
    background-color: #4CAF50;
    border: 8px solid #3e2723;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0,255,100,0.2);
    overflow: hidden;
}

/* UI Bar */
#ui-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 100;
    border-bottom: 4px solid #3e2723;
}

#sun-counter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #FFEB3B;
    color: #333;
    border: 4px solid #F57F17;
    border-radius: 10px;
    width: 80px;
    height: 60px;
    margin-right: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    font-weight: bold;
}
#sun-icon { font-size: 24px; line-height: 1; }
#sun-count { font-size: 20px; line-height: 1; }

#seed-bank {
    display: flex;
    gap: 10px;
    flex: 1;
}

.seed-card {
    position: relative;
    width: 60px;
    height: 70px;
    background: #81C784;
    border: 3px solid #388E3C;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    transition: transform 0.1s;
}

.seed-card:hover { transform: scale(1.05); }
.seed-card.selected { border-color: #FFEB3B; box-shadow: 0 0 15px #FFEB3B; transform: scale(1.1); }
.seed-card.disabled { filter: grayscale(100%) brightness(0.6); cursor: not-allowed; }

.seed-icon { font-size: 32px; position: absolute; top: 2px; }
.seed-cost { font-size: 14px; font-weight: bold; color: black; background: rgba(255,255,255,0.7); padding: 0 4px; border-radius: 8px; }

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    border-radius: 5px;
    transform-origin: bottom;
    pointer-events: none;
}

#shovel-container {
    width: 60px;
    height: 70px;
    background: #795548;
    border: 3px solid #4E342E;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 36px;
    transition: 0.2s;
}
#shovel-container:hover { transform: scale(1.05); }
#shovel-container.selected { border-color: #FFEB3B; box-shadow: 0 0 15px #FFEB3B; }

/* Progress Bar */
#progress-bar-container {
    position: absolute;
    bottom: 10px;
    right: 20px;
    width: 200px;
    height: 20px;
    background: #333;
    border: 2px solid #000;
    border-radius: 10px;
    z-index: 100;
}
#progress-fill {
    height: 100%;
    background: #4CAF50;
    width: 100%;
    border-radius: 8px;
    transition: width 0.3s;
}
#progress-head {
    position: absolute;
    top: -10px;
    left: 100%; /* controlled by js */
    font-size: 24px;
    transform: translateX(-50%);
    transition: left 0.3s;
}

/* Lawn Grid */
#lawn {
    position: absolute;
    top: 80px; /* Below UI */
    left: 0;
    width: 900px;
    height: 520px;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(5, 1fr);
    background: repeating-linear-gradient(90deg, transparent, transparent 100px, rgba(0,0,0,0.05) 100px, rgba(0,0,0,0.05) 200px);
}

.cell {
    position: relative;
    border: 1px dashed rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}
.cell:hover { background-color: rgba(255, 255, 255, 0.2); cursor: pointer; }

/* Entities */
.entity {
    position: absolute;
    font-size: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
    user-select: none;
    pointer-events: none; /* Let clicks pass through to cells/lawn */
}

/* Specific entity rules */
.zombie { z-index: 10; font-size: 50px; }
.plant { z-index: 5; }
.projectile { z-index: 20; width: 15px; height: 15px; background: #81C784; border-radius: 50%; box-shadow: 0 0 5px #4CAF50;}
.sun { z-index: 25; font-size: 36px; cursor: pointer; pointer-events: auto; transition: top 0.05s linear; animation: pulse 1s infinite alternate; }
.lawnmower { z-index: 8; font-size: 44px; }

/* Health Bars for entities */
.health-bar-bg {
    position: absolute;
    bottom: -5px;
    width: 40px;
    height: 6px;
    background: rgba(0,0,0,0.5);
    border-radius: 3px;
    left: 50%;
    transform: translateX(-50%);
}
.health-bar-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 3px;
    transition: width 0.1s, background-color 0.1s;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.1); filter: brightness(1.2); }
}

@keyframes plant-bob {
    0% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(-3px) scaleY(1.05); }
    100% { transform: translateY(0) scaleY(1); }
}

@keyframes zombie-walk {
    0% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
    100% { transform: rotate(-5deg); }
}

.animate-plant { animation: plant-bob 2s infinite ease-in-out; }
.animate-zombie { animation: zombie-walk 1.5s infinite ease-in-out; }

/* Overlays */
.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.overlay.hidden { display: none; }
.overlay h1 { font-size: 64px; color: #FFEB3B; margin-bottom: 20px; text-shadow: 0 0 20px #FF9800; }
.overlay p { font-size: 24px; margin-bottom: 40px; }
button {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    background: #4CAF50;
    border: 3px solid #388E3C;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}
button:hover { background: #66BB6A; transform: scale(1.05); }

/* Back btn */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.3);
    transition: 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.2); }

/* Shovel Cursor overlay */
#custom-cursor {
    position: fixed;
    pointer-events: none;
    font-size: 40px;
    z-index: 9999;
    display: none;
    transform: translate(-10px, -20px);
}
