Last week, Major League Baseball had one of its most admirable, intelligent and dignified moments in many years. Faced with an array of mind-twisting issues, involving billions of dollars and affecting every team and career in the game, MLB’s owners, union and players got everything right, or right enough. With no deadline, they still did it within a day of what would’ve been Opening Day.

Talk about your monster problem. Teams owe players $4 billion in salary this year. Two months of games have been canceled. Because of the novel coronavirus pandemic, the whole season may be a wash. Who takes the financial hit? And in what proportions? How could players leave their comfort zones and help teams? And how could teams reciprocate by acting fairly toward players on the issues most important to them?

In spring training two weeks ago, I asked players about some of these issues and instead of the usual owner-union saber-rattling, I heard, in one case from Washington Nationals player rep Max Scherzer: “We’ll work it out. We’re in this together.”

And it certainly looks like they did.

The worst-case scenario is a canceled season. You work backward from that. Who is most endangered in that case? The answer: minor league players, young major leaguers with little service time and the franchises themselves, who may be crushed by a zero-revenue year.

Who is least endangered by a canceled season? Veteran players who have had a shot at free agency and, through merit or luck, had a chance at their big payday.

What has MLB done? Addressed all of those concerns as thoroughly and fairly as possible. Maybe ugly devil-in-the-details problems will appear. But I doubt it. After a lifetime of watching labor-management rancor or at least brinkmanship, I almost want to cheer.

MLB teams will advance the players (through the union) $170 million. If no games are played this year, they can keep it. For their part, players will not challenge the loss of their salaries in that case. That’d be: “So long, $4 billion.” In a canceled season, a vet would lose his whole salary. Hey, he’ll live.

Minor leaguers get helped most. At the bottom, players with $46,000 contracts will get $250 a day — in other words, $46,500 for the 186 days in a baseball season. Those at the top of the minors with good salaries may make $1,000 a day for those 186 days. The rest of the $170 million goes to players with big league contracts who ask for advances. The “need” formula? Who cares? The wealthier players took care of the smaller fry. The owners forked over enough.

Owners wanted to know if players would be willing to play an extended season, including playoffs, until Thanksgiving, using warm-weather sites or domes. Would players accept doubleheaders, maybe quite a few of them, to jam in as many games as possible? Would players be open to an altered postseason format with more than the current 10 teams? Maybe 16? If necessary, would players perform in empty stadiums, as a TV-only product?

On all points, the players basically said, “Yes,” although they phrased it, as you would expect, in the language of “we’ll consider it.” MLBPA President Tony Clark made it clear: “The players just want to play. That’s what they do.”

Of course, this is not nobility but just common sense, because the owners and players also agreed that all 2020 contracts would be paid based on the number of games played. For a simple example, if the season is 81 games, not 162, then every player gets 50 percent of his original deal. Whatever the number, just work out the ratio. Play a doubleheader — well, sure, we’ll get paid twice.

What did the players get? And which players got it?

Owners agreed, and this is no small concession, that if the entire season is canceled, players would be given credit for service time based on their 2019 season. The value of that to young players is huge because it potentially gets them to free agency, as well as arbitration, a year sooner.

For example, Juan Soto would get credit for a full season of service time if the 2020 season is killed; that would make him eligible for arbitration before the 2021 season. Instead of making less than $1 million, he would be judged on his 2019 stats and probably get something close to $10 million. And he would be a free agent after the 2023 season instead of a year later.

For hundreds of young players, this is a fair shake. Careers are short, and prime years are precious. Teams will just have to bite the bullet. In that worst case, the Nats would never “get back” Soto’s 2020 season.

In short, if this season is nixed, vets would give up huge salaries without a whine, evoking a huge sigh of relief from teams. But young players, who haven’t had a shot at big money, would move a year closer to pay dirt even with zero games this year.

One bitter quirk in the canceled-season scenario is that Mookie Betts, in his walk year, might never play a game for the Los Angeles Dodgers if this whole season is erased. Betts would still be a free agent after 2020, and the Dodgers would lose the players they traded to get him.

Also, teams who built on the idea that this was a title-window season, a prime chance with a big star in his walk year, might feel the pain. For example, catcher J.T. Realmuto becomes a free agent and could leave Philadelphia after this year whether games are played or not. Who got lucky? Maybe a team like the Nats, who completed a title run in their last season with Anthony Rendon at third base.

There are other sub-clauses and conditions. Normally, I’d explain them. But in a pandemic, this doesn’t feel like the time. What is relevant to the mood of the moment? Cooperation and common sense.

A sport that has been notorious for tense-to-awful labor relations for decades decided to make a quick-and-dirty, split-the-pain deal for the good of the sport. The rich players sacrificed for the . . . well, less rich players. Labor understood that no one wins if the “capitalists” — the club owners — get crushed.

The alternative, with lawyers slicing and dicing financial duties under the current collective bargaining agreement — which was reached long before anyone thought you could go to jail for driving down the street without an “essential” reason — would have been insanity, a Gordian knot with no sword available to cut it.

“We got an agreement that’s good for the game. It’s great that everybody operated in good faith,” Nats General Manager Mike Rizzo said Monday. “I’m not an expert on all the specifics. But we got a completed deal. Hat’s off!”

Now, if the novel coronavirus can just be stifled sufficiently and in time to have some form of a season, that would be great news for baseball. But it would be far, far better news, in its implications, for all of us.