Not screwed. When my husband was 40, he was just getting out college and getting his first career track job with benefits. We had negative net worth to the tune of ~150K! GOOD TIMES, YO. Then we proceeded to just slowly pay down debt, rather than jumping on debt and retirement with any aggression, for about FIVE MORE years. Anyway, it's 16 years on and we have a net worth of ~700K now and anticipate it climbing rapidly over the next few years. No real early retirement in the cards, but he could likely quit at 62 (not that he's likely to) and we are on track to have a very secure retirement.
Also, personal financial principles are not that complicated. 1) Pay off high interest debt and don't run up more. 2) Keep a secure emergency fund so you don't run up more debt. 3) Invest an absolute minimum of 10% of every paycheck in a tax advantaged retirement account, and ramp that percentage up as needed for your personal situation. That covers the absolute essentials.
A 401k is just a vehicle that serves as a 'basket' of investments (often a mix of stocks and bonds) offered by employers, that allows you to save a bunch of money pretax (lowering your taxable income). Some employers offer a 'match' of some portion of the money the employee puts in (FREE MONEY). IRAs are a similar vehicle, that anyone can use (no need for employer to offer), with a lower contribution limit. Roth IRAs are a similar vehicle where you put post tax money, but the gains are then not taxed in the future.