Do you hold Costa Rican residence (a DIMEX card) today?
Only temporary or permanent residence counts. Time on the remote-worker stay, as a student, or under an Article 94 special category does not, however long it runs. Your DIMEX card states the category it was issued under; if you are unsure, the immigration department (DGME) can confirm it. Minors cannot naturalise in their own right.