Coffee — the world's favorite stimulant and essential fuel for countless researchers — is under existential threat from climate change, and scientists are racing to save it.

Nearly all of the 10 million tonnes of coffee consumed globally each year comes from just two species: robusta and the more delicate arabica. But arabica suffers or dies when temperatures rise just a few degrees, while robusta requires massive amounts of water and its yields collapse in drought.

"Coffee is critically threatened by climate change," warns Kassahun Tesfaye, a plant geneticist at Addis Ababa University in Ethiopia, the homeland of arabica coffee.

Researchers are pursuing multiple strategies. The Ethiopian government has established conservation areas and maintains living collections of more than 12,000 arabica plants, betting that natural genetic diversity can be bred — or genetically engineered — for heat and drought tolerance.

But perhaps the most intriguing solution comes from exploring coffee's wild relatives. There are 134 known wild coffee species, and some are remarkably resilient. Aaron Davis of the Royal Botanic Gardens, Kew, has spent decades documenting them.

"The success stories are always about changing the species that farmers grow," Davis says. Two promising candidates are Coffea liberica, which tolerates higher temperatures and requires less water, and Coffea excelsa. When brewed, Davis says, excelsa and a hybrid called "libex" are often indistinguishable from specialty arabica — even to professional tasters.

"A mathematician is a machine for turning coffee into theorems," the late mathematician Paul Erdős once said. Scientists are working to ensure future mathematicians — and the rest of us — still have coffee to turn into ideas.