Dynamic marine protected areas can improve the resilience of coral reef systems.