Still gropping through the dark of political midnight, a dozen moderate congressional Democrats met privately at a Chesapeake Bay retreat last week to ponder their shrinking world.

It was a sobering session.

In January, for the first time in 26 years, Democrats will not be running the congressional show. They will be out of power in the Senate, their House majority will be diminished and Ronald Reagan will be in the White House.

Yet for all the morning-after hurt from Nov. 4, a fascinating political brew already has begun to cook as Democrats move from their role as inititators and orchestrators to the minority role of opposition and holders-of-the-line.

From the Chesapeake retreat to congressional corridors, Democrats were talking with unaccustomed vigor about uniting their party, reexamining their ideas and, in the spirit of good losers, letting Repubicans trip over their own promises.

Uniformly, in one interview after another, Democrats from House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) on down talked about cooperating with the president-elect and giving the GOP a chance.

And while Democrats expect a Republican-conservation assault on some of their favorite social programs, no one anticipates wholesale emasculations, for not even the new majority is of one mind on what should go.

"Our job now is to try to fight for the best of our programs," said Sen. Patrick J. Leahy (D-Vt.), one of the few Senate liberals who survived the bloodletting and was reelected.

"But a lot of us are not going to back off," Leahy added. "I have no intention of doing so. If we are willing to stand up and admit some of our programs do not work, and make the other side come forth with more than their one-liner solutions, I don't think the Republicans will do things that make hungry people hungrier or radicalize the minorities. For us to follow Mr. Reagan will depend on the degree of reasonableness he brings to his leadership role. I'll work with him and give him a chance."

O'Neill and other House leaders, such as outgoing Democratic Caucus Chairman Thomas S. Foley (Wash.) and Rules Committee Chairman Richard Bolling (Mo.), spoke similarly. They'll give Reagan and the GOP-dominated Senate a fair chance to make good on Republican promises to work economic and organizational magic.

"But if the administration moves in radical ways to undo programs enacted over the last two generations, there will be opposition," Foley said. "If Mr. Reagan can improve the efficiency of the federal government without hurting benefits, there isn't a Democrat out there who doesn't want to do that."

Rep. Toby Moffett (D-Conn.), one of the liberals at the Chesapeake retreat, echoed the feeling.

"There was a widespread consensus that we can't afford a bunch of factions among House Democrats," Moffet said. "We can't just be the firece opposition party. We are a [ideological] minority in the House. We don't have the strength to do anything."

That key theme runs through most conversations and speclation about the incoming 97th Congress and how it relates to the future of Democrats' liberal-to-moderate elements.

Did the seemingly conservative tide at the polls mean their demise? Will all liberal programs topple? Who will speak for them?What will Sen. Edward M. Kennedy of Massachusetts, the best-known of that group, finally do and say about his wing of the party?

Kennedy, for now, is not giving interviews on the subject.

"There's not much point to doing that yet" one of his aides explained. "We know what the questions are.We're less certain about the answers."

Some members of the liberal-moderate group, such as Alan Cranston (Calif.), Max Baucus (Mont.) and Leahy, see a certain silver lining -- call it new opportunity -- in the Republican takeover.

"Election Tuesday awakened a lot of us. Democrats are not the majority party by right," Baucus said. "We have to go back as Democrats and find our beginnings. We do need some new ideas, but we must remember the beginnings are more noble, more positive."

Cranston, the outgoing majority whip, said, "I think we do need to redefine our goals and our methods of achieving them, but we do not need to abandon the goals."

Added Leahy: "A lot of us are going to have to work in a bipartisan fashion, for there are no simple answers . . . . But yes, this can be a good catharsis, even though some superb people of our party have gone down the tubes."

While Republicans will hold a whip hand in the Senate and the executive branch, some senators such as moderate Gary Hart (D-Colo.) are not so sure that the GOP will readily find ways to fulfill its promises.

He said Republicans campaigned against the federal regulations as though they had "sprouted up from nowhere, rooted in nothing," rather than being dictated by laws Congress had passed.

To stem the tide of regulation, he said, the GOP will have to change basic laws, which he is uncertain will happen until the philosophical bent of the new Congress becomes clearer.

Sen. Spark Matsunaga of Hawaii, another of the moderate Democrats, speculated that his party may profit from its new minority role.

"There were indications in our caucus this week that Democrats already are beginning to think more in terms of party," Matsunaga said. "It may strengthen our party structure to the point that those who abandon party line will suffer." *tIn due time, he said, "the new Senate leadership and the president will begin to realize they will need the support of Democrats, and they will need to cater to the new minority. . . . My experience is that the Senate deals across party lines much more than the House."

Matsunaga, a former House member, was touching on an important element in the way Congress operates. Dspite the labels, party lines in the House and Senate often tend to blur and then emerge as regional or ideological coalitions.

The blurring seems to occur more frequently in the clubbier, more collegial Senate. Two examples: Conservative Sen. Bob Dole (R-Kan.), who will become Finance Committee chairman, ususally gets his way with current Chairman Russell B. Long (D-La.). Conservative James McClure (R-Idaho), who will become Energy Committee Chairman, often gets his way with current Chairman Henry Jackson (D-Wash.).

The Democrats are expecting -- and, given the way the institution operates, probably will get -- similar treatment when they become the minority. Sen. Walter D. Huddleston (D-Ky.), acknowledging thanks to Sen. Ted Stevens (R-Alaska) on an appropriations bill Thursday, said it plainly: "I trust that come the first of the year, [you] will remember the many courtesies extended from this side of the aisle." Stevens nodded in a friendly, clubby fashion.

Bipartisan backscratching tends to occur less in the more pluralistic House, and some of the liberal-moderate Democrats are worried about a future that may be more troubling.

"It goes against my nature but we're going to be in the position of blocking outrageous legislation rather than initiating new ideas," said Rep. Morris K. Udall (D-Ariz9), one of the liberal lights. "It'll be a period of consolidation, fine-tuning the old laws and curing old mistakes."

Udall, chairman of the Interior Committee, added: "The plain fact is that the House is Democratic but only nominally. Technically, I'll be in control of one of the key House committees, but I won't have the votes there or on the floor."

Another of the Democratic centrists, Leon Panetta of California, said, "The next two years can be very difficult. Members will be running scared . . . so we should not be obsructionists, particularly if there is no alternative. My hope is that we can begin to look at some alternatives to offer on the House floor that are positive. It means we have to admit that not all the Democratic solutions were right."

There is another element in the GOP rise to power that Democrats are watching intensely -- the role the New Right will play and whether it will capture the Reagan administration.

Most Democrats think this will not occur and that Reagan, to prevent it from happening, will need a friendly hand from time to time from the loyal opposition. To get that hand, he will have to trade favors.

Otherwise, Leahy cautioned, a difficult period lies ahead. Without naming names, he said the GOP tide has elected "some people with no sense of history or why the Senate even exists, people running for their own ego gratification or the gratification of single-issue groups."

He added: "That makes it difficult if the public thinks the Senate will respond on an hour-by-hour basis to our problems. If that happens, it will be the greatest danger to the Senate and the country. It should alarm Republicans as much as Democrats."