Modal overlay logic