Your pawn structure after 4. ... d5 looks odd to me. Moving the pawns to e6 and d5 is good for bringing your bishop out along the f8-a3 diagonal, but you have already fianchettoed this bishop. So now what will become of your other bishop? I think moving a pawn to d6 and then later making a break with c5 is a better plan, though there are lots of good approaches so don't get locked into that idea if it isn't best.
18. ... Qf4. Why exchange queens? I think a more active plan is to double the rooks on the f-file. You can get all your pieces pointed at white's kingside.
You remark at move 22 that white's king is exposed. But you should also notice that you have no open lines of attack toward the king, and it looks like you can't create any either.
22. ... d4. Why are you trying to open the game? You should be concerned with limiting advanced outposts for his knight. With this move you release control on c4 and e4. These squares are jumping off points for the knight to get to d6. More importantly, you give yourself a weak pawn oafter 23. cxd4 cxd4
23. ... Be4. Yes, you shouldn't have given up a pawn for no reason here. Of course, if you take on d4, your pawn is weak and will likely be lost (as was the pawn on c5).
Your hopes for a draw in the endgame were pretty unfounded. Down two pawns is a significant diadvantage. After the rooks are traded, the one pawn advantage is easily enough for the win.
There are certain games in your life, which you work so hard to get a good position in, just to end up losing because of one horrible move. This was one of those games.
Admittedly, I didn't play well at all. But I want you to tell me what I could have done differently. Hoping for some analysis