How do faceit levels work?

I was the level 2 green but after sometime I dropped back to level 1 gray. My guess is because I didn’t play much.
But how do they work? And what are they for?