Specifically, I would like to have a custom "this page contains spoilers"-box at the top of the page, and the spoilers hidden from view in a good way.
I think I've managed to get the spoilers to hide for now (though I'm open for suggestions for a better way, like a colapsible box that you can't acidentally view through hovering over it too long), but I have no idea how to add the box at the top like the Rean Schwarzer page has it. I've looked through the source code, but I simply have no idea what triggers this box there and how to replicate it.
There are several ways. Different template:spoiler (as used by Kiseki wiki) and a <span class> as used by Ceal wiki.
I myself am partial to another couple of templates, as I use on this page. At the top I have a "Template:SpoilerWarning" tophat and in the body you'll see another form of a template:Spoiler which creates a button which needs to be pressed to reveal it. This solution is versatile as you can either have several scattered spoilered text and images reveal/hide all at the same time, or several *different* spoiler buttons able to reveal/hide independently.