Hi! Thank you for your feedback!
You lose the game by reaching 0 health. The red bar is the health bar, which decreases every 4 ticks (overtime) depending on how many keys spawned. Special/Elite keys do considerably more damage, so you need to kill them fast.
The game is about collecting XP orbs, upgrade your weapons (the tool bar in screen bottom), and survive for around 30 minutes (where all keys are destroyed).
Hope you give it another try !