Fortunately, in Penal Code Sec. 337j(e)(2)(D) we're told that games played with cards in a private home where no one profits from the running of the game are 100% fine. So yes, since online poker is played at home with the only gains being your winnings, it's perfectly legal.
As of early 2024, only six states have legalized online poker Nevada, Delaware, New Jersey, Pennsylvania, West Virginia, and Michigan. The state of online poker varies from state to state due to a number of factors including state laws, gaming interests, and of course, politics.