Marine reserves reduce risk of climate-driven phase shift by reinstating size- and habitat-specific trophic interactions.