In pressed white robes and clutching crisp résumés, young Saudi men packed a massive hall at a university in the capital city this month to wait in long lines to pitch themselves to employers.
It was one of three job fairs in Riyadh in two weeks, and the high attendance was fueled in part by fear among the younger generation of what a future of cheap oil will mean in a country where oil is everything.
For decades, the royal family has used the kingdom's immense oil wealth to lavish benefits on its people, including free education and medical care, generous energy subsidies and well-paid (and often undemanding) government jobs. No one paid taxes, and if political rights were not part of the equation, that was fine with most people.
But the drop in oil prices to below $30 a barrel from more than $100 a barrel in June 2014 means that the old math no longer works. Low oil prices have knocked a chunk out of the government budget and now pose a threat to the unwritten social contract that has long underpinned life in the kingdom, the Arab world's largest economy and a key American ally.
The shift is already echoing through the economy, with government projects delayed, spending limits imposed on ministries and high-level discussions about measures long considered impossible, like imposing taxes and selling shares of Saudi Aramco, the state-run oil giant that is estimated to be the world's most valuable company.
The proposal announced on Tuesday by the oil ministers of Saudi Arabia, Russia, Qatar and Venezuela to freeze output levels is one attempt to stabilize world oil prices, but it remained uncertain how effective it would be if other countries, like Iran and Iraq, declined to follow suit.
For younger Saudis — 70 percent of the population is under 30 — the oil shock has meant a lowering of expectations as they face the likelihood that they will have to work harder than their parents, enjoy less job security and receive fewer perks.
"For the older generation, it was easier," said Abdulrahman Alkhelaifi, 20, during a break from his job at McDonald's. "They'd get out of university and get a government job. Now you need an advanced degree."
Of his generation, he said, "The weight is on our necks."
It is hard to overstate the importance of oil in the development of modern Saudi Arabia. In decades, it rocketed a poor, mostly rural country to affluence, with most of its 21 million citizens now living in cities festooned with skyscrapers and streets filled with S.U.V.s.
Oil wealth also allowed the ruling Al Saud family to maintain its grip on power, wield clout abroad through checkbook diplomacy and invest billions of dollars in promoting an austere interpretation of Islam around the world.
The oil boom over the past decade helped all of this, and was good for Saudis at home. Household incomes rose, and the number of men and women pursuing higher education multiplied.
But the fat years left the economy poorly structured, economists say: 90 percent of government revenues are from oil; 70 percent of working Saudis are employed by the government; and even the private sector remains heavily dependent on government spending.
Nor did advances in education create a large professional class or inculcate a culture of hard work. Most of the country's engineers and health care workers are foreign, and many government employees vacate their offices midafternoon, or earlier.
But with oil revenues crashing and the numbers of young people reaching the work force growing by the day, those jobs have become harder to get as the government cuts costs and pushes Saudis toward the private sector, where job security and salaries are lower on average.
"There is an issue with the sustainability of the economic model in Saudi Arabia, and the oil price can be seen as a wake-up call," said Fahad Alturki, chief economist at Jadwa Investment in Riyadh.
Saudi Arabia still has room to maneuver, he said, thanks to large cash reserves, low public debt and lots of new infrastructure that can aid economic growth.
But the generational differences are clear.
One woman who recently earned a Ph.D. in a medicine-related field in the United States said that her father had been tracked into the military, where he got training abroad, free housing, medical care and schooling for his children. When her mother finished her degree in Arabic, she immediately got a job near her house — and a cash bonus from the state, just for graduating.
Their daughter has struggled to find work, despite being better educated and fluent in English. Her husband, also educated in the United States, is also unemployed, and they live with her family.
"My parents had great opportunities," she said, requesting anonymity so as not to hinder her job search. "They provided well and we had a comfortable life, so I always thought it would be the same for us."
These economic stresses come at a time of chaos in the Middle East and of generational change in the royal family.
Spearheading economic policy is Prince Mohammed bin Salman, whose father, King Salman, passed over older and more experienced princes to put the 30-year-old in charge of many of the country's most important affairs, stirring private anger among some other royals.
Prince Mohammed, who is also the defense minister and second in line to the throne, has launched a costly war in Yemen and talks about radical changes to the economy, like raising fuel prices, imposing taxes on undeveloped land and some consumer goods, and privatizing state-run companies.
But details on implementation are scarce, causing uncertainty over many issues like what it will cost to fill a gas tank or power a factory in five years. That has made it hard for businesses to plan for the future, which further undermines the sputtering economy.
At the same time, Saudis are not accustomed to the government taking bold, fast action. Change tends to be introduced incrementally. That cultural trait is now complicating the need to move fast to meet the economic and demographic challenges.
A Saudi executive in the construction industry said that change was needed, but that moving too fast could hurt businesses.
"It has to be done and I am with it, but you can't change decades' worth of problems in a few years," he said, speaking on the condition of anonymity so as not to jeopardize his business interests. "No way."
Economists say that at least 250,000 young Saudis enter the job market every year, and that making them effective members of the work force is a major challenge.
The glut of graduates was clear at the job fair, where most applicants had come from large public universities that often fail to give students the language and technical skills employers want. Most of those interviewed had never had a job before and said their fathers worked for the government. While some thought private companies offered better experience, many wanted the perks of a government job.
"It's a good experience, but there is no rest and no job security," said Ali al-Ariyani, 24, who worked at a private hospital and wanted a change. "The days are long and you can't even go out to smoke."
At a separate location for women, many applicants complained that their degrees had not given them the skills, like fluency with computers, that employers want. One group of women had earned degrees in microbiology only to learn that they lacked the required licenses for hospital jobs.
"Our main issue is that our university did not prepare us for the job market," said Khuloud al-Khateeb, 23, adding that many hospitals preferred to hire foreigners for lower salaries.
In recent years, the government has pushed for greater Saudi employment, penalizing companies with few Saudi employees. Many employers hate the program, saying it forces them to swell their payrolls with people who contribute little.
Even companies that have hired lots of Saudis have often had to rely on significant social engineering to get them working.
Saudis made up one-third of the crew at a Riyadh McDonald's on a recent morning, manning the drive-up window and cash register and making fries.
"Is this spicy?" one yelled to a colleague. "One large fries, please!"
While they do the same work as foreigners, they earn much more. Salaries for foreign crew start at $320 a month, while Saudis get $1,460, part of which is subsidized by the government.
The company also gives Saudis more flexibility and has created fast-track programs to move them into management.
Four Saudi workers gathered in a break room said they liked their jobs but worried that they would not be as successful as their fathers, all of whom worked for the government. They knew the government had less money to employ citizens, which meant their generation would have to work harder.
"The government is good, but our generation is spoiled," said Ahmed Mohammed, 21. "Everyone wants a government job."
His colleagues agreed. "Everyone wants to sit at home and get paid," Mr. Alkhelaifi said.
Sheikha al-Dosary contributed reporting.