Gender question!

If genitalia doesn't define gender than..... What does? Serious question. Is it how you dress? Because clothes aren't gendered. How you act? Because gender is not a set of actions, it's what you are not how you are. How you feel? Because again, gender has no rules at all! So what is it