[code][details=Spoiler title (click this)] Spoiler text [/details][code]
makes this:
[details=Spoiler title (click this)] Spoiler text [/details]
which might be what you’re looking for.
Centering isn’t possible, I’m afraid.
Edit: my phone’s not showing it properly, so if it’s not working there’s a proper example here: Discourse Formatting Sheet