Z - shoots normal bullets, no magic cost (I think)
X - DO A BARREL ROLL (temporary invulnerability, costs MAGIC)
left-click - LAZER (turns into a laser sword at close range, within the circle)
The story is that you play as Flandre, Remilia's little sister, and you've been asked to clean up the Scarlet Mansion. You were only allowed to do it after Remilia made it very clear that you weren't to use magic or destroy anything, and you agreed. But you totally will anyway.
The enemy is the library's automatic intruder engagement system. It means to kill you. Your objective is to clean up the trash, which is outlined in red, by DESTROYING it with your magical spells, all the while avoiding death by the hands of Patchouli's anti-intruder system. Destroying furniture, lamp posts, and other objects in Patchouli's library will lower your score, but on the other hand you get items that increase your magic and health, so...better the bookshelf than yourself, I guess.