There was never any question whether Japan could withstand total war with the US, the only question was whether the US would be willing to engage in total war against Japan. The attack on Pearl Harbor was a gamble that enough damage would be done to the Pacific Fleet that the US would conclude that rebuilding their navy would not be worth the trouble (and that by the time they did so, Japan would be entrenched enough in their positions that the US would not be willing to take the casualties needed to dislodge them), and concede the Pacific to Japan.
However, the attack failed to destroy the Pacific fleet, the US quickly built further forces that surpassed the pre-Pearl Harbor strength, the attack galvanized public opinion to support total war, the Japanese navy suffered several devastating defeats, the US cut off Japanese supply lines, and Germany was eventually taken out of the war. After Midway, it was clear that the tide had turned against the Japanese.
By the time of the first nuclear bombing (Aug 6), Germany had surrendered, the US had captured Okinawa, the home islands were cut off from supplies, the Japanese navy was almost completely destroyed, the air force was on its last legs, and the US was bombing Japan with impunity. Did the bomb beat them? No, they were already beaten.
It didn’t take a military genius to see that, while it might be possible to fight a decisive battle against one great power invading from one direction, it would not be possible to fight off two great powers attacking from two different directions.
That's silly. The Japanese military was completely outmatched by the US. Adding the USSR changed the timelines, but the ultimate outcome was already a foregone conclusion. The capture of Okinawa eliminated any military justification for continuing the war, and all that was left was psychological and political. Whether the atomic bombing or the Soviet invasion provided the final push to where the Japanese leaders were unable to continue their pretense of not yet being defeated cannot be defended on the basis of the military situation, but must appeal to the psychology of the leaders.
The Soviet invasion was strategically decisive — it foreclosed both of Japan’s options [hoping for Soviet mediation and threatening large casualties in an invasion]
The invasion did little to affect Japan's ability to inflict casualties on an invasion force. This ability was not based on lack of US forces, but on asymmetric warfare that even an overwhelming force would be vulnerable to.
Obviously, if the bombings weren’t necessary to win the war, then bombing Hiroshima and Nagasaki was wrong.
That is not at all obvious. If the bombings were based on a good faith belief that they were necessary, then they were not wrong, even if that belief was wrong.