From my experience with tax laws, no country will tax you for gambling losses, they can only do that if you have an aggregate gambling gain over the tax period.
And the issue is that it's not easy for countries to tax their citizens the way you have explained, though it's viable for you to prove you gained or lost. However, some would still evade tax through that as there are many schemes through which they do this, especially when they could gamble online, and with crypto.
This is why a country that wants to tax its citizens always has arrangements with the gambling company, they might tax your ticket directly or have the record they will duplicate for the government in order to know how to tax you. But one must be living in their country for the latter to be effective.
Either way, it depends on the country, but you shouldn't be taxed if you are not gaining.
I have never seen or heard such countries that imposed taxes even in times when you are at loss. Maybe it could be true for some who are really making it huge in gambling, but for those who are at loss, it will be additional loss for them if ever the government will still taxed them. Like in lottery, although taxes maybe included already in our tickets or bets, but most especially if you hit the jackpot prize, you will never receive the full winning amount indicated in the screen as they will still deduct quite big amount for the tax.