Given the price limit of $400, I would go with a used bike. This way you can get quality parts for less.
In terms of type, I would go with a road/track bike over a mountain bike since you said you would do city riding. Go with a relaxed geometry, no need for anything twitchy.