- No need for querySelector("head"), you can reference the element via document.head
- Unless you need to support IE11, you can just call n.remove() instead of n.parentNode.removeChild(n)
- What's up with the multiple style elements and the .reverse()? Why not add the CSS to a single style element and specify everything in the correct order?