In 2008 Raul Castro took over a country where most people couldn't own computers or cellphones, leave without permission, run most types of private businesses or enter resort hotels.
Castro set about re-engineering the system he had helped create and Cuba opened dramatically over his decade in office. But when Castro steps down as president Thursday he will leave his successor a host of problems that are deeper than on the day his brother Fidel formally handed over power.
Cuba has nearly 600,000 private entrepreneurs, more than 5 million cellphones, a bustling real estate market and one of the world's fastest-growing airports. Foreign debt has been paid. Tourism numbers have more than doubled since Castro and President Barack Obama re-established diplomatic relations in 2015, making Cuba a destination for nearly 5 million visitors a year, despite a plunge in relations under the Trump administration.
On the other side of the ledger, Cuba's Soviet-style command economy still employs three of every four Cuban workers but produces little. Private sector growth has been largely frozen. The average monthly state salary is $31 — so low that workers often live on stolen goods and handouts from relatives overseas. Foreign investment remains anemic. The island's infrastructure is falling deeper into disrepair. The break with Washington dashed dreams of detente with the U.S., and after two decades of getting Venezuelan subsidies totaling more than $6 billion a year, Cuba's patron has collapsed economically with no replacement in the wings.
Castro's inability or unwillingness to fix Cuba's structural problems with deep and wide-ranging reforms has many wondering how a successor without Castro's founding father credentials will manage the country over the next five or 10 years.
"People in Cuba really haven't processed yet what it means to have a government without Raul or Fidel leading it," said Yassel Padron Kunakbaeva, a prolific 27-year-old blogger who writes frequently from what he describes as a Marxist, revolutionary perspective. "We're entering unknown territory."
Tens of thousands of highly educated professionals are abandoning the island each year, leaving Cuba with the combination of third-world economy and the demographics of a graying European nation. After a 2016 recession, Cuba said growth was 1.6 percent last year, although official accounts remain opaque and questioned by experts. The single-party government controls virtually all forms of expression and organization, with near-zero tolerance of public criticism or dissent. The mood on the street is pessimistic, with few expecting a better future anytime soon.
"The political future of whoever takes over in April depends on the economic question," said Jose Raul Viera Linares, a former first deputy minister of foreign affairs. "It's the possibility for young people to dream, to design their own future. That's all based in the material wealth that this country is able to achieve."
The greatest immediate challenge for Castro's expected successor — 57-year-old Vice President Miguel Diaz-Canel Bermudez — is unwinding a byzantine dual-currency system featuring one type of Cuban peso worth 4 cents and another that is nearly a dollar. The system was designed to insulate a state-run, egalitarian internal market using "national money" from trade with the outside world denominated in "convertible pesos."
The barrier between the two worlds swiftly collapsed and the system has fostered big economic distortions. Inefficient state enterprises receive mammoth subsidies by obtaining expensive convertible pesos for the price of the cheaper "Cuban peso." The dual-currency system also allows private businesses to receive subsidized goods and services like water and electricity in Cuban pesos, then turn around and charge their relatively wealthy clients in convertible pesos at a significant profit.
Castro called for elimination of the dual currencies from the beginning of his presidency, but never got around to it. In one of his final speeches last year he called once again for the system's urgent elimination, a process that many expect to start in Diaz-Canel's first year in power. Eliminating dual currency is widely seen as necessary for Cuba's economy to grow, but it carries risks of inflation and major disruption for inefficient state businesses whose subsidized balance sheets will finally become understandable when they are denominated in a single currency.
Those state businesses gained new competitors as Castro expanded the space for capitalism in the Cuban economy by permitting private enterprise in dozens of fields ranging from agriculture to hospitality to construction.
"We've risen up economically. The new possibilities have changed my life, of course," said Yanelis Garcia, a 44-year-old mother of three who saved money from raising pigs in her backyard to slowly build a prosperous six-room bed-and-breakfast and taxi business in the central city of Santa Clara. "I've always liked having my own business to be able to provide for my family. It's been really good."
Cubans fill thousands of flights a year to Miami, Panama and Cancun, where they cram duffel bags with gym socks and Xboxes for the vibrant private sector and rising middle class. But last August, the Cuban government froze new licenses for private bed-and-breakfasts, restaurants and other popular businesses, leaving many Cubans questioning how their government envisions a path to prosperity.
"We've seen necessary reforms and I think that in the future there will have to be more," said Norma Chiang, a 77-year-old state accountant and auditor. "Self-employment needs to be broadened, little things like bakeries or food stands that can be in the hands of individuals and not the state."
Despite the image of Raul Castro as an all-powerful military strongman, many Cubans say back-and-forth moves and the overall slow pace of reform have shown the difficulty of modernizing a Soviet-era bureaucracy controlled by hundreds of thousands of civil servants who would be threatened by a transition into a market economy, a difficulty Castro's successor will also face.
"No one dares to disobey Raul to his face. They quietly don't get things done and search for ways to cover their backs so no one can accuse them of not getting things done," Padron said.
Cuba's next president also must find a way to make its economy grow while maintaining social stability and satisfying the millions of Cubans who depend on the state and a shrinking list of subsidized essentials sold in Cuban pesos for their survival. While Cuba sees Russia as one of its closest allies, Cuba's leaders are desperate to prevent the sort of shock transition to capitalism that marked the end of the Soviet Union.
"I can't eat, dress myself and live on $20 a month," said Adela Arpajon, a 54-year-old accountant for the Communist Party. "I either eat or buy clothes. It's hard, but that's the way it is."
Wariness of disruption is exacerbated by Cuba's increasing economic dependence on the Cuban emigres and exiles once seen by the Communist government as a threat to its survival.
As part of his broader immigration reforms, Raul Castro changed Cuba's relationship with its diaspora by allowing Cubans to maintain their rights to own property and receive social benefits as long as they return once every two years. That change fueled the growth of a new class of Cubans who earn money overseas but invest at home and are responsible for hundreds of millions, if not billions, of dollars in small-scale investment on the island in recent years.
More than 20,000 Cuban emigres have "repatriated" and regained their property rights since the emigration reforms, according to Cuban figures. Still, the flow of emigres back to Cuba is swamped by the outward flood of Cubans unleashed by Castro's elimination of the hated exit permit known as the "white card." According to U.S. Homeland Security statistics, the United States admitted 463,502 Cubans between 2006 and 2016, with tens of thousands more heading to countries such as Spain and Ecuador.
"I don't think people have realized how momentous that is in terms of for the first time having circular migration," said Lisandro Perez, an expert on the Cuban diaspora at New York's John Jay College of Criminal Justice. "They take back things, they finance private restaurants. It's a totally different ballgame."
Castro's successor will have to manage the delicate relationship with Cuba's prosperous exiles at a time when relations with the U.S. have dropped from an unprecedented high under President Barack Obama to a deep low under President Donald Trump.
For Reinaldo Taladrid, a popular commentator on state television, tensions with the U.S. will serve as a brake on any reforms sought by Raul Castro's successor.
"While there's a sense of a state of siege, there's an instinct of self-preservation that doesn't have anything to do with politics. It's the human instinct for self-preservation. You have the world's most powerful state, the most powerful government in the history of humanity that has regime change in Cuba as its official policy," Taladrid said. "While that's true this little, poor country's government will have a siege mentality, and it's logical to have it."