MIAMI — Surprising even themselves, Donald Trump and his Republican rivals turned Thursday’s presidential debate into a civil and detailed discussion of Social Security, trade and immigration that left Trump to shake his head and declare at the midpoint: “So far, I can’t believe how civil it’s been up here.”

The candidates found plenty of areas of common ground. And often when they differed, they laid out their differences in even tones and without vitriol.

“We’re all in this together,” said Trump, sounding more like a conciliator than a provocateur as he strives to unify the party behind his own candidacy. “We’re going to come up with solutions. We’re going to find the answer things.”

Not that it was all sweetness and light. Ted Cruz, eager to cement his position as the party’s last best alternative to Trump, did have a firm counter to Trump, saying flatly at one point: “His solutions don’t work.”

In a meaty discussion of Social Security, Cruz and Marco Rubio said they’d gradually raise the retirement age for younger workers to help stabilize the system and stave off financial disaster for the system.

Trump, in contrast, said he’d do “everything within my power not to touch Social Security, to leave it the way it is.”

The billionaire businessman couldn’t resist taking a dig at the Democrats, saying he’d been watching them intensely on such issues —”even though it’s a very, very boring thing to watch” — and that they weren’t doing anything on Social Security.

Cruz said the system was “careening toward insolvency” and it would be irresponsible not to address that. Rubio said Trump’s plan to save the system by reducing wouldn’t work. Eliminating all fraud and waste “is not enough,” he said. “The numbers don’t add up.”

Each of the candidates had an urgent mission as the GOP debate gave them a last chance to put their case to a televised audience of millions before voters in Florida and four other states dish out delegates next Tuesday. Those elections will go a long way toward determining the outcome of the primary season.

Cruz was seeking to make it a two-man race with Trump. Rubio was out to save his flagging candidacy by energizing voters in his home state of Florida. John Kasich was hoping his above-the-fray strategy would finally pay off.

Trump, for his part, was itching to give his front-runner’s campaign a giant thrust toward the nomination by dominating his dwindling cast of rivals.

Republican National Committee Chairman Reince Priebus said in advance he was hoping for a more “G-rated debate” than the last Republican face-off, a week ago, when the candidates engaged in a two-hour brawl that featured shouting, insults and even sexual innuendo.

President Barack Obama, offering political commentary from the sidelines, said the party was going through a “Republican crackup” that had taken on the tone of a “circus.” He blamed the GOP itself for fostering the idea “that cooperation or compromise somehow is a betrayal.”

Trump told CNBC on Thursday that the imperative to win the GOP nomination had made him “not necessarily as politically correct and even as nice as you would like to be as a person.”

Earlier in the week, he’d pledged a “softer” debate in Miami, but he also made his vow to finish what he’d begun.

While Trump talks about showing a softer side, some of his rallies have had a harder edge, with the candidate at times seeming to encourage physical altercations with protesters. At a rally in Las Vegas, for example, he said he’d like to punch a protester in the face. On Wednesday, a man was charged with assault for attacking a protester who was being escorted out of a Trump rally in Fayetteville, North Carolina.

Rubio, Trump’s chief antagonist, has been rethinking his own tone.

After mocking the billionaire businessman on everything from a bad spray tan to his spelling to his “small hands,” the Florida senator admitted to having regrets.

“My kids were embarrassed by it, and if I had to do it again, I wouldn’t,” he said.

Florida is the biggest prize of Tuesday’s five-state round of voting, and all 99 of the state’s delegates will go to the winner.

In all, 367 Republican delegates will be at stake, with voting also occurring in Illinois, Missouri, North Carolina, Ohio and the Northern Mariana Islands.

Earlier Thursday, Cruz showcased his first Senate endorsement, from Mike Lee of Utah, a tea party favorite. Cruz has few friends among the GOP in the Senate.

As Rubio’s fortunes declined this past week, Sens. Lindsey Graham of South Carolina and Dean Heller of Nevada raised the possibility of Cruz as the alternative, but others stood firm in their support for Rubio and declined to even discuss the prospect of Cruz as their choice.

Ohio Gov. Kasich, who has tried to stay out of the name-calling, pinned his hopes of survival on bringing home the 66 delegates in his state’s winner-take-all primary. He has yet to win anywhere.

In the race for delegates, Trump has 458, Cruz 359, Rubio 151 and Kasich 54. It takes 1,237 to win the Republican nomination for president.