Where are you based out of?
I'm not in the EU, but rather in Turkiye. I'm a US citizen, and though it's legal to work here for companies who don't have a local presence, the HR departments at American companies tend to get cold feet.
I'm curious how you check? I ended up hiring a lawyer to research legality here. A site that explains all of these for any region would be pretty sweet.