It was just after Representative Nancy Mace, Republican of South Carolina, had fired off a blunt text to the No. 3 House G.O.P. leader — featuring two f-bombs and four demands that needed to be met to gain her vote for the party’s debt limit plan — that she experienced a momentary flash of dread.

“Now I’ll look like a flip-flopper,” Ms. Mace worried aloud.

Speaker Kevin McCarthy was planning within hours to hold a vote on his proposal to lift the debt ceiling for a year in exchange for spending cuts and policy changes, and Ms. Mace had just published an op-ed declaring herself a hard no. Now the second-term congresswoman from a swing district, who had already established something of a reputation for publicly breaking with her party but ultimately falling in line behind its policies, was privately negotiating her way to yes.

Ms. Mace would, in fact, vote for the bill after meeting with Mr. McCarthy and extracting several promises from him, including to hold future votes on two of her top priorities: addressing gun violence and women’s issues related to contraceptives and adoption. She anticipated criticism for the turnabout, but consoled herself with the fact that she had leveraged her vote to force her party to take on issues she cared about.

“This is a way I can drive the debate,” she said as she walked back to her office. “It’s a way of using my position to push those issues.”

It was a typical day for Ms. Mace, 45, who represents Charleston and the Lowcountry along South Carolina’s coast, and whose political profile — she is a fiscal conservative but leans toward the center on some social issues — puts her at odds with the hard-right Republicans who now dominate the House.

Ms. Mace, who last year beat a Trump-backed candidate in a primary, is constantly pivoting as she figures out how to survive and play a meaningful role as a mainstream Republican in today’s MAGA-heavy House G.O.P., where extreme members of the party have greater power than ever.

She often styles herself as a maverick independent in the mold of Senator Joe Manchin III, the West Virginia Democrat whose tendency to buck his party has earned him outsize power in the closely divided chamber — and the political fame that goes with it. But she has built the voting record of a mostly reliable Republican foot soldier, even as she publicly criticizes her own party and racks up television hits and social media clicks. And Ms. Mace — savvy and irreverent — has become fluent in the art of the political troll, finding ways to signal to the MAGA base that she hasn’t forsaken it.

She has repeatedly, and baselessly, accused the Biden family of being involved in “prostitution rings.”

Above all, Ms. Mace, a high school dropout and former Waffle House waitress who went on to become the first woman to graduate from the Citadel, is hyper-aware of how she is perceived and of her precarious place in her party.

During Mr. McCarthy’s prolonged fight for this job, Ms. Mace and Representative Marjorie Taylor Greene — who have publicly feuded — huddled together on the House floor chatting about how to secure his victory. When a male lawmaker noticed them and said their joint effort was something Republicans would like to see more of, Ms. Mace dryly disagreed.

“Who do you think you’re kidding?” she said. “The only thing people want to see of me and Marjorie is if we’re wrestling in Jell-O.”

Behind all the tacking back and forth, Ms. Mace insisted, a bigger project is at work. She said she was trying to create a model for a “reasonable” and re-electable Republican in a purple district, and demonstrating that there was a path to winning back moderate and independent voters.

“I’m trying to show how you can bring conservatives and independents along to be on the same page,” she said. “Americans want us to work together. That’s not what’s happening. There’s very little that we’ve done that’s going to get across the finish line to Biden’s desk to sign.”

Ms. Mace has yet to prove that it’s possible.

The debt ceiling vote was the third time in four months that Ms. Mace had publicly threatened to break with her party on an issue where her vote was critical, before ultimately falling in line. In January, Ms. Mace had threatened to oppose the House rules package for the new Republican majority, but ended up supporting it. She had said she would oppose removing Representative Ilhan Omar, Democrat of Minnesota, from the Foreign Affairs Committee, but reversed course.

In both instances, she insisted that she had pried promises from Mr. McCarthy in exchange for her support, such as a vow to institute due process for committee removals in the future. She is aware of the danger of becoming the congresswoman who cried wolf.

“Every handshake I’ve taken with Kevin has been legit,” she said of the speaker. “I haven’t gotten rolled. If I were to get rolled, I’d go nuclear. I’m just trying to move the ball in the right direction — that’s what matters to me.”

Some of her constituents view her tactics in a less flattering light.

“You live around Nancy long enough, she will talk about being bipartisan and reaching across the aisle and working together until the cows come home,” said David Rubin, a Democrat and a retiree who moved to the district six years ago and attended a “coffee with your congresswoman” event with Ms. Mace last week in Summerville. “When it comes down to the actual votes, she always sticks with the party.”

Ms. Mace voted to certify the 2020 election and vociferously condemned President Donald J. Trump after the Jan. 6, 2021, attack on the Capitol, but she did not join the small group of Republicans who supported his impeachment. These days, she avoids the subject of Mr. Trump, the front-runner for the 2024 Republican presidential nomination, at all costs.

“I’ll support the nominee — that’s what I say,” she said while talking on the phone in her car between events in her district. “And then I shut up.”

That silence is a deliberate contrast to former Representative Liz Cheney of Wyoming, another Republican who tried to move her party — and failed miserably, ultimately losing her seat because she refused to stay quiet about her unrelenting opposition to Mr. Trump and his election lies. In fact, Ms. Mace ultimately joined Republicans in voting to oust Ms. Cheney from her leadership post.

Still, as Ms. Cheney did in her final days in Congress, Ms. Mace regularly warns her party that it is at risk of losing its way. She argues that Republicans will lose control of the House if they fail to temper their most extreme stances on abortion and guns.

“Signing a six-week ban that puts women who are victims of rape and girls who are victims of incest in a hard spot isn’t the way to change hearts and minds,” Ms. Mace said last month on CBS’s “Face The Nation,” responding to a new six-week abortion ban instituted by Gov. Ron DeSantis of Florida. “It’s not compassionate.”

On guns, she supports improved alert systems and stronger background checks.

But Ms. Mace has also co-sponsored legislation that would ban transgender women and girls from participating in athletic programs designated for women. On fiscal issues, she is aligned with the hard-right Freedom Caucus.

And while she criticized Republicans for choosing an abortion-related bill as one of their first acts in the majority, saying it would hurt the party and alienate many of her constituents, she voted for the legislation, which could subject doctors who perform abortions to criminal penalties.

Representative Ro Khanna, Democrat of California, who serves with Ms. Mace on the Oversight Committee, said he found her effective in trying to find common ground while working within the constraints of her party.

“She doesn’t do things that would marginalize her and make her completely ineffective in her party,” Mr. Khanna said. “There’s only so much she can do to push the party. If the Republican conference had everyone of Nancy Mace’s temperament and ideology, we’d be in a much better place in our country.”

Yet Ms. Mace’s approach comes with political risks.

In 2020, she won election to Congress by narrowly defeating a Democrat. Last year, she won by 14 points, after her district was redrawn to make the electorate more conservative. But the seat could shift again in 2024; federal judges ordered South Carolina to redraw its congressional maps after ruling that the lines split Black neighborhoods and diluted their votes in the last election.

Conservative voters in her district are increasingly skeptical of Ms. Mace.

“Sometimes I think she speaks out, particularly on the abortion thing, she needs to let that go,” said Paula Arrington, a retiree who attended an event with Ms. Mace in her district last week and who is of no relation to Ms. Mace’s former Trump-backed challenger, Katie Arrington. “We’re real conservatives and we support the Republican Party.”

Over a skinny margarita and tacos at a waterside restaurant in Mount Pleasant near her district office, Ms. Mace credited Mr. Trump with fueling her political rise, but unlike other Republicans, it was his wrath — not his backing — that made the difference.

She worked for Mr. Trump’s 2016 campaign, but after she broke sharply with him after the Jan. 6 attack, the former president called her “nasty” and “disloyal.” He supported her opponent in last year’s Republican primary, in which he savaged Ms. Mace for fighting with her own party and said she was “despised by almost everyone.”

“He defined me as an independent voice in a way that I couldn’t have,” she said. “I would not have won by 14 points had Donald Trump not come after me, and had I not been outspoken when Roe v. Wade was overturned.”

Ms. Mace, who sold commercial real estate before being elected to the statehouse and then to Congress, is obsessed with her work and has huge ambitions.

She only halfheartedly denies that she’s thinking about a run for Senate at some point — “La la la la la,” she said, putting her fingers in her ears, when asked about running for a statewide office — while her aides half-jokingly pass along an article that floats her as a potential presidential running mate to former Gov. Chris Christie of New Jersey.

In a party shaped by extremists who view the middle ground with disdain, the day-to-day can be pretty “lonely,” she said, noting that she has few friends on Capitol Hill. She got a dog during the pandemic, a Havanese named Liberty, and started carrying a gun at all times when threats against her increased after she voted to certify the election. She said that only “emboldens me,” as does the fact that she’s not the popular girl at the lunch table. She calls herself “a caucus of one.”

Her hardened exterior is in part the result of personal trauma. She was molested at a swimming pool when she was 14 and said that for years she blamed herself, because she had been wearing a two-piece bathing suit. She was raped when she was 16, leading her to drop out of high school.

“I was in a really bad situation for a long time,” she said. She was on Prozac and then self-medicated with marijuana, which she credits with reducing her anxiety and saving her life.

“You carry it for a lifetime,” she said. “When I want to punch a bully in the face, it’s all still there. I’ll bring a gun to a knife fight, and that’s overkill. It’s still there.”

Yet Ms. Mace is anything but aloof. As she took meetings across her district on a recent Wednesday, she shared personal details, joking with a reporter about doing the “walk of shame” home from her fiancé’s house and talking openly about her struggle with long Covid.

“I overshare because I do want to connect with people on a personal level,” she said, explaining why she had told several groups throughout the day that she had gained the “freshman 15” during her first term in Congress and subsequently cut out bread. “Everyone struggles with their weight.”

Ms. Mace, who has two teenage children, said she does not read books or have any hobbies. She rarely takes vacations. She is divorced and engaged to be married to an entrepreneur, but has set no wedding date.

The grind is worth it, she said, if she can shift her party even a touch.

“The message matters,” Ms. Mace said. “I’m trying to move the national narrative.”