Fixed Safari bug by switching order of invisible & detached styles