They can’t invade Taiwan because Taiwan is too close for the mainland to have any hope of blocking their nuclear retaliation.
It would cost the Chinese Communists Shanghai and the area around it at a minimum.
Correct. The reason China won’t invade Taiwan is because for decades Taiwan’s not so secret response plan has been to load up B61-equivalent nuclear bombs on their F-16s or their current stealthiest platforms and send them to every single mainland city they can reach. There is no shortage of brave Taiwanese male (and now no few female) pilots willing to volunteer for this, even if it’s almost assuredly a one way trip. The reality is that the mainland Chinese forces cannot ensure that one of them doesn’t get close enough even to Beijing to toss-bomb before dying, let alone their far closer coastal industrial belts. Taiwan has ensured that if they go down, China as an industrial or financial power goes with it even if they don’t hit Beijing.
Otherwise, the Chinese would have steamrollered them like they did Tibet.