I have recently finished listening to the learning company's course on the Ottoman empire (great courses plus / wondrium). I was startled by the sharp pivot of how inferior the Ottoman military became starting in the first Russo-Ottoman war, and then all subsequent conflicts (including getting their Navy completely destroyed multiple times). This is similar to the Mughal empire getting defeated by the British after soundly defeating it in 1685 in the first British-Mughal war. And of course there is the century of humiliation of the Qing dynasty.
I've read about the internal problems of the Ottomans with the Janissaries, and the internal decline of the Mughal empire - so my question isn't why those mighty empires were at a temporary disadvantage. It's more about why the European advantage was insurmountable. Why didn't the Ottomans manage to catch up after "the auspicious event". Why were all the attempts at modernization except those of the Japanese in the 19th century a failure? whereas in the 20th century we have plenty of examples of relatively less technologically advanced societies repelling western powers after receiving arms from 3rd parties (Algeria, Vietnam, Afghanistan, etc). One could argue that Russia did not successfully "modernize" following the Crimean war, but remained a very viable military power. Why the Russians and not the Ottomans?
More can of course be said, but in the case of the Qing in particular I'd direct you to two recent answers that cover aspects of your question:
Covering the 18th century: https://www.reddit.com/r/AskHistorians/comments/o9qve6/dear_early_modern_historians_were_the/h3fb1me/
Covering the 19th century: https://www.reddit.com/r/AskHistorians/comments/pe5k6z/why_did_the_qing_so_fiercely_resist_reform_and/hawboy7/