General Rule:
The wash-sale rule keeps investors from selling at a loss, buying the same (or "substantially identical") investment back within a 61-day window, and claiming the tax benefit. It applies to most of the investments you could hold in a typical brokerage account or IRA, including stocks, bonds, mutual funds, exchange-traded funds (ETFs), and options.
More specifically, the wash-sale rule states that the tax loss will be disallowed if you buy the same security, a contract or option to buy the security, or a "substantially identical" security, within 30 days before or after the date you sold the loss-generating investment (it's a 61-day window).
See details at:
Wash-Sale Rules | Avoid this tax pitfall | Fidelity
Essentially, this is the
Infield Fly Rule of investing.
So, my take would be:
1) a) $-20. That is you have a $20 loss that can offset other gains
2) Not sure what you mean by "all the shares." But, you need to wait until the 31st day.
3) No, you cannot buy TSLA options right away and still deduct the loss.
Note that if you do all your trading in one account, most brokerages will interpret the Wash Rules for you in your subsequent 1099. And note that trading in different accounts doesn't change the rule.