Maximum genus, connectivity, and Nebeský's theorem