For a long gun, probably something like a 30.06 rifle (or larger) or 12 gage shotgun. If a handgun, probably something like a 10mm or 44 caliber. When talking big game animals, you're also talking about bigger calibers as well when you pose the question as what is ideal. The only reason I didn't list 45 and 357 calibers is that I would prefer the large capacity magazine of a 10mm or the hand cannon quality of a 44 if settling for a lower number of rounds capacity.
Some decades ago and 19 years old, I was day hiking a trail in a remote corner of the Guadalupe Mountains in New Mexico. A mile up the trail, I heard a big cat snarl. Never saw the mountain lion but froze, walked backwards a ways with my hunting knife in hand then retreated at a walk back down the way I had come up. Dumb dumb, dumb and I survived to learn a lesson.
Since then, I have a rifle or shotgun very handy for in and around camp and sometimes on me if further out. Also, I have a 9MM with modern self defense loads usually in an outside the waistband holster as opposed to a less accessible inside waistband carry.
Carry whatever you can shoot accurately. A hit with a 9mm or .38 special is better than a miss with a 10mm or .44. I carry a Ruger GP100 .357 with a 3” barrel loaded with 185gr flat point cast lead bullets that I load myself to less than maximum so it is comfortable to shoot and I shoot it well. It resides in a comfortable pancake holster on my right hip. To my way of thinking it is the ultimate compromise of size, weight, and power. Ideally I’d use a 12 bore shotgun loaded with #1 or #4 buckshot but I’ll have the .357 on me rather than trying to remember which tree I leaned the shotgun against.
Mountain lions have impressive offensive weapons but they are thin-skinned animals and are not particularly bulletproof. Think large dog that climbs trees with bigger teeth and wicked claws.