It took a while for President Trump to get used to working with the Republican-led Congress, but he developed a style of dealing with lawmakers that led to the passage of tax reform and a number of smaller measures.

Now, though, with Democrats winning control of the House, Trump faces the challenge of working with an empowered opposition whose leaders are motivated by intense animus toward the president -- and who will have the ability to stop any Trump legislative initiatives cold. On the other hand, with the Republicans keeping and strengthening control of the Senate, Trump will be able to continue what has been the single most important accomplishment that has bonded him not just with his base but with the Republican establishment that remains cool to him: judicial appointments.

In the runup to the midterms, when Trump adopted a Senate-focused campaign strategy, some left-leaning commentators suggested that Trump was desperate to keep the Senate because he knew it would be the jury that could acquit him if he is impeached by the House. But the fact is, if impeachment happened, Trump could easily be acquitted by a Democratic-controlled Senate, just as Bill Clinton was acquitted by a Republican-led Senate. A much bigger factor is this: Trump needs the Senate to stay in Republican hands to keep his extraordinary line of judicial confirmations going. And now he has it.

GOP Sen. Lindsey Graham saw it Tuesday evening, tweeting, "When the GOP maintains control of the Senate, the conservative judicial train is going to keep running!" So far, the Senate has confirmed two Trump Supreme Court justices, 29 circuit court of appeals judges, and 53 district court judges. That is more than any other president in memory at this stage in his presidency. About one-sixth of the federal judiciary now consists of Trump nominees. Look for Trump and Senate GOP leaders to keep increasing that number.

It's particularly notable that the event that helped give the Senate a bigger Republican majority for future confirmations was the Supreme Court confirmation of Brett Kavanaugh. West Virginia Democratic Sen. Joe Manchin voted for Kavanaugh and won. Indiana Democratic Sen. Joe Donnelly voted against Kavanaugh and lost. North Dakota Democratic Sen. Heidi Heitkamp voted against Kavanaugh and lost. Missouri Democratic Sen. Claire McCaskill voted against Kavanaugh and lost. Montana Democratic Sen. Jon Tester and Florida Democratic Sen. Bill Nelson both voted against Kavanaugh, and both are trailing in races that have not yet been called. (Nevada Republican Sen. Dean Heller appears to be the only Republican who voted for Kavanaugh and lost.)

"What happened with Justice Kavanaugh was the moment our side got as invigorated as their side," Missouri Republican Sen. Roy Blunt said Tuesday night. "You could tell the difference from that moment on."

An increased Senate majority will also give Republicans more flexibility should there be intraparty debates over confirming Trump nominees. With just 51 Republicans in the Senate, any two GOP members -- say, Sens. Susan Collins and Lisa Murkowski -- could keep a nomination from going forward by voicing objections. With a bigger GOP majority, party leadership will be able to confirm a nominee even if Collins and Murkowski objects.

So look for Trump to pursue an even more Senate-focused strategy. A continued string of judicial confirmations, coupled with executive actions that do not require congressional approval, could give the president more accomplishments even if he cannot pass legislation.

Still, Trump cannot ignore the House, and certainly not a House that plans to bury him in subpoenas and might possibly try to impeach him. At the very least, Trump will have to beef up the White House counsel's office and prepare for battle each day with the new Democratic chairmen of key House committees -- House Intelligence Committee chairman Rep. Adam Schiff, Judiciary Committee chairman Rep. Jerrold Nadler, Oversight Committee chairman Rep. Elijah Cummings, and others.

For the first few months of Democratic control, the biggest story out of the House might be an internal Democratic squabble as Rep. Nancy Pelosi tries to solidify support as Speaker. Along with that, there might be a spirited debate among Democrats about how much to pursue the president -- impeachment? -- versus pursuing a policy agenda.

In her victory speech at Democratic headquarters election night, Pelosi steered clear of attacks on Trump. She never mentioned the president and said nothing suggesting impeachment. Instead, she discussed lowering health care costs, and specifically lowering prescription drug costs. She also mentioned working to raise wages, clean up corruption, build infrastructure, and curb "dark interest money." Pelosi's brief mention of "accountability" was her only suggestion of action against the president.

[Related: Why Speaker Nancy Pelosi and Donald Trump will want to work with each other (a bit)]

Finally, there might be legislative projects on which Trump could work with Democratic House leaders. The president has never been a doctrinaire conservative on the issue of federal spending -- no president of either party has been for a long time -- and might be open to spending bills favored by the new House majority. At other times, Trump might find Pelosi & Co. to be a useful foil as he campaigns for re-election in 2020.

It will all be part of a new reality in a new phase of Trump's presidency. Other presidents, like Barack Obama and Bill Clinton, have faced first midterm losses and gone on to win re-election. If Trump can keep the nominations machine going, and skillfully manage his relations with the Democratic House, there's a chance he can do it, too.