# Tower Defense — Reproducible Prompt

## Role
You are a specialist frontend game developer building a 3D tower defense game in a single HTML file using Three.js.

## Theme
Cyberpunk neon city. Dark environment with glowing neon geometry, grid-floor cityscape, and programmatic particle effects.

## Technical Constraints
- **Single file**: `index.html` only (embedded CSS + JS).
- **No external images or models**: all geometry built with Three.js primitives.
- **Three.js via CDN** (https://unpkg.com/three@0.160.0/build/three.module.js).
- **No build step**: open directly in a browser.

## Gameplay Requirements

### Towers (6 types)
Build each tower from basic geometries (Box, Cylinder, Sphere, etc.) with neon color coding:

1. **Blaster** — balanced single-target, medium range.
2. **Sniper** — very long range, high damage, very slow fire rate.
3. **Rapid Fire** — very fast, low damage, short range.
4. **Cannon** — slow fire rate, splash AoE damage.
5. **Shock** — chain lightning to secondary targets near the primary target.
6. **Ice** — low damage, slows enemies in range by ~40%.

### Enemies (7 types)
Each enemy is a composite primitive shape with neon accents:

1. **Drone** — fast, low HP.
2. **Cruiser** — balanced stats.
3. **Tank** — slow, high HP.
4. **Speedster** — very fast, very low HP.
5. **Shield Bearer** — medium HP, regenerating shield layer.
6. **Mutant** — medium HP, heals slightly over time.
7. **Boss** — massive HP, appears on wave 10 and wave 20.

### Waves
- Exactly 20 waves.
- Wave composition scales: early waves are mostly Drones/Cruisers; later waves add Tanks, Shield Bearers, Mutants, Speedsters; wave 10 is a mini-boss; wave 20 is a boss rush.
- Pre-wave build phase + active wave phase.
- Enemies follow a fixed path along a neon-lit track.

### Upgrade System
- Every tower has **2 upgrade levels**.
- Upgrades increase damage, range, and/or fire rate per tower archetype.
- Upgrade cost scales per tower.
- Visual upgrade representation: tower grows taller/glows brighter/body segments increase.

### Economy
- Start with a fixed sum (e.g., 250 credits).
- Earn credits per kill.
- Spend credits on placing towers and upgrading them.
- Wave-completion bonus.

### Lives & Game Over
- Enemies reaching the end cost lives.
- Start with 20 lives.
- Game over when lives reach 0, with a restart button.
- Victory screen after surviving wave 20.

### UI / UX
- Overlay UI with HTML/CSS (not WebGL text):
  - Top bar: Lives, Credits, Current Wave / Total Waves, Enemies Remaining.
  - Tower selection panel (6 tower cards with cost and stats).
  - Upgrade / Sell panel when a placed tower is selected.
  - Start Wave button.
  - Game Over / Victory overlay modals.
- Keyboard shortcuts for tower selection (keys 1–6).
- Mouse: click to place/upgrade/sell; right-click or Escape to cancel placement.

### Visuals (Programmatic Only)
- Dark scene background (`#050510`).
- Grid floor with neon city-block decorative pillars (glowing edges via `EdgesGeometry` or `LineSegments`).
- Defined enemy path rendered as a neon-lit track.
- Tower base + rotating turret that tracks nearest enemy.
- Projectile / beam / lightning visuals using thin geometries or line segments.
- Muzzle flash and particle explosions on hits using instanced `Points` or small geometry bursts.
- Slowed enemies visually tint blue when affected by Ice towers.

## Architecture Sketch
- `Game` class orchestrates state (menu, build, wave, gameover, victory).
- `Map` handles path, floor, decorations.
- `Tower` handles type, level, stats, target selection, firing, visual upgrade state.
- `Enemy` handles movement along path, HP, shield, speed modifiers, type-specific behaviors.
- `Projectile` handles movement, collision, splash, chain, slow application.
- `UIManager` drives the HTML overlay from game state.
- `WaveManager` schedules spawns per wave composition.
- `EconomyManager` handles credits.
- `ParticleSystem` for cheap hit/explosion effects using `THREE.Points`.

## Output
Write a single `index.html` that satisfies all of the above. Ensure it runs by opening the file directly in a modern browser.
