In situ spheroid formation in distant submillimetre-bright galaxiesGalaxy evolution is intricately linked to stellar mass and environment.