If you buy shares in a company, and they go up a lot, is that only "theoretical" money, or "actual" money?

It isn't money at all. When you start out, you have $100 and no stocks. When you buy the stock, you no longer have any money, but you have X shares of ACME. When the price doubles, you still have no money, and still have X shares of ACME.

However, these shares can now be sold in exchange for $200, rather than the $100 you paid for them. You can keep (all or some of) the shares, and continue to have no money, or sell (all or some of) the shares, and no longer have exposure to the potential associated gains (or losses).

Think of it like real estate. If your home value goes up, you can't 'get out' without selling. A home equity loan doesn't count as getting out, because you're not 'out'. Presumably, you would pay back the home equity loan when you sell.

If you own enough stock, a bank can give you a personal loan against those securities, similar to a home equity loan. You have access to some money, but you haven't gotten out.

If you're 'out', it's called a realized capital gain. If you're not 'out', it's an unrealized capital gain.

For the purpose of your question, stocks are pretty much like anything else you can buy and sell. If you spend $100 on a new washing machine; you no longer have $100 but instead you have a new washing machine. If a friend says that they want the exact washing machine you have and are willing to pay you $200 for it, then you can decide if you want to sell that washing machine and make a $100 profit.

There are of course various differences with stocks vs other purchases; but those differences don’t matter here. Until or unless you sell the stock, the “worth” is simply an estimate of how much someone would be willing to pay you for it. You don’t have any actual money.