> I got a bit off-topic now, do you want me to amend the commit and move the styles to viewer.css?

Yes, pelase. We are trying to keep as much styles as possible from js code.

One small nit: I don't think you need to check this.overlay.parentNode: for appendChild nothing will happen, for remove use this.overlay.remove()