Hi, thanks for playing the game! Yea the number of cookies is your HP so when you have 0 cookies left, that means you ran out of your health so you lose the game. The point is to control you expenses while also maintaining your HP so you can survive through waves of enemies.