KATOWICE, Poland — Efforts to agree on the fine print of the Paris climate accord drew closer Thursday, three years after the landmark agreement on curbing global warming, but negotiators remained deadlocked on the thorniest issues and appeared set for overtime.

A summary text from the Polish diplomat chairing the talks was expected around midnight as the two-week U.N. climate summit in the southern Polish city of Katowice neared its scheduled end on Friday.

Diplomats and ministers had huddled behind closed doors, some overnight, weighing every word of the draft text covering issues such as how countries will count both their greenhouse gas emissions and their efforts to reduce them.

Along with the Paris accord rulebook, the other main issues at the talks are how much financial support poor countries will get to combat and adapt to climate change, and what kind of message to send about future work to curb climate change.

Last week, the United States, Russia, Saudi Arabia and Kuwait blocked the endorsement of a scientific report on a key element of the Paris climate agreement: capping global warming at 1.5 degrees Celsius (2.7 degrees Fahrenheit), if possible. That angered other countries and environmentalists, who accused the four oil-exporting nations of stalling progress toward the accord’s most ambitious emissions-cutting target.

Mohamed Adow, a climate expert at Christian Aid, said the discussions on financial support seemed to be moving in the right direction, though the overall outcome of the talks was uncertain.

Developing countries have been promised billions of dollars in aid, loans and other financial support to help them reduce their emissions.

Developing countries have been promised billions of dollars in aid, loans and other financial support to help them reduce their emissions and adapt to inevitable changes in the world’s climate.

Some are also demanding money to make up for the damage already caused by global warming, arguing that rich industrial nations are to blame for most of the carbon dioxide and other greenhouse gases humans have pumped into the atmosphere.

“Real action requires real money for real solutions,” said Adow. “The European Union needs to separate itself from the laggards like Australia, Japan and the United States.”

While U.S. President Donald Trump has announced he’s pulling out of the Paris accord, American officials dangled the possibility that the U.S. might consider rejoining if it gets more favorable terms.

But China, a key broker of the 2015 Paris accord, dismissed the idea of revising core parts of the pact.

“China and the U.S. have worked together with all other countries to complete the negotiation and thus make the Paris Agreement a milestone achievement in global climate governance,” Beijing’s chief negotiator, Xie Zhenhua, told reporters. “We will not reopen negotiations on issues where we have already reached agreement.”

Xie also pushed back on demands from rich nations for China — the world’s largest polluter — to accept the accounting and reporting rules that developed countries must follow, but indicated it might decide to adopt uniform standards further down the line.

He noted that while China is the largest single emitter of polluting gases, its gross domestic product per capita remains below the world average.

German negotiator Karsten Sach expressed optimism a deal could be reached, rating the draft texts that emerged between Wednesday night and Thursday morning as “somewhere between seven and eight” out of ten.

“Quite good, but not perfect,” he said.

One veteran of global climate talks said it wasn’t unusual for negotiations to hit a crisis toward the end, as exhausted negotiators try to reconcile a complex set of drafts with their national interests.

“In a positive way, it’s creative chaos,” said Hans Joachim Schellnhuber, founder of the Potsdam Institute for Climate Impact Research. “But I do not know how it will be this time.”

Some observers predicted the talks would likely continue into Saturday in an effort to secure a deal this year and maintain confidence in the multi-step global process.

“It was determined in Paris this was the deadline for agreeing on the implementation rules,” said Alden Meyer of the Union of Concerned Scientists. “If it slips because countries can’t agree or there’s major splits among countries, I think that undermines confidence that this process is going to move forward in the way that it needs to.”

Others questioned whether the elaborate annual summit, now being staged for the 24th time with over 30,000 participants, is still the best way to fight climate change.

“There is a view among many of us that this is failing,” said former Maldives President Mohamed Nasheed.

Associated Press reporter Monika Scislowska contributed to this report.