The US has never lost a war. Withdrawing due to lack of political support is not defeat resulting from being overwhelmed by an enemy force. If you had your way, victory can only be acheived in afghanistan by committing genocide and killing every radical muslim in afghanistan that will support the taliban or occupying countries for centuries. Both iraq and afghanistan were won within months of the start of the conflict. Korea is technically still in a state of war with the north unable to advance past the 38th. Vietnam perhaps, because the US had heavy casualties but technically the US was supporting the south and ceased support due to domestic politics.

Right now, by any serious account, even if all the armies of the world joined forced they cannot defeat the US on an all out conflict. Now the US might again star a war over Taiwan and come another election cycle it will just not be a popular thing and withdraw after enduring casualties in the 10s of thousands and losing trillions of dollars. That kind of a lame withdrawal I can see.

But a conflict with China, unlike small boring countries will mean attack on mainland US!! Something that hasn't happened since pearl harbor. And is very unlikely to fizzle out of popularity in a few years. It will probably be the one thing that can unite the US and save american democracy ironically.

You gotta understand, it isn't the 5-6x times bigger military budget, much much bigger navy,huge territory far away from China or allies, the insane sprawling military complex, the diet and health of military aged men (never mind the obesity, when americans bulk, it is at scale),supply chain,800 bases around the world (china has like 2), NATO support,etc... far beyond that the US has something every military starves for:experience!! Since WW2, every generation of americans has has a major war and the US is constantly engaged in subterfuge or random smaller skirmishes around the world. The PLA of China has never had a real war since it's inception, perhaps it can defend the mainland or even Taiwan but the US can keep coming back and hammer them out unless they can manage to get their 2 carriers to get a few hundred thousand chinese to mainland US, use nukes (and risk getting nuked back) or technologically overwhelm US bases and carriers by a large margin. Their economy is great but the stability of their government depends on it, halting most of their international trade will not help their stability.

Now my speculation is that Xi will attempt to invade Taiwan and the US will retaliate and support Taiwan but both the US and China will avoid mainland or non-military targets and come up with a treaty that will save faces on both ends after like a year at most because they will both miss the money too much.

But keep in mind also, chinese intelligence has a chokehold on key american figures and can be overwhelming to US counterintel. If you think the fee republicans supporting Russia now is a big deal, half of congress might support China in a war, if not openly, china might be able to manipulate them to push for a more ukraine-like passive support.

The US is like godzilla and other countries are like japanese people in older movies when it attacks tokyo. You can defeat it, just not in an outright battle of strength.