The people waiting for hours in front of the drugstore were dazed with heat and boredom when the gunmen arrived.

The robbers demanded a cellphone from a 25-year-old in black shorts. Instead of handing it over, Junior Perez took off running. Eight shots rang out, and he fell face down.

The dozens of shoppers in line were unmoved. They held their places as the gunmen went through Perez's pockets. They watched as thick ribbons of blood ran from the young man's head. And when their turn came, they bought two tubes each of rationed toothpaste.

"These days, you have to put the line above everything," said pharmacist Haide Mendoza, who was there that morning.

As Venezuela's lines have grown longer and more dangerous, they have become not only the stage for everyday life, but a backdrop to death. More than two dozen people were killed in line in the past 12 months, including a 4-year-old girl caught in gang crossfire. An 80-year-old woman was crushed to death when an orderly line of shoppers suddenly turned into a mob of looters — an increasingly common occurrence as Venezuela runs out of just about everything.

The extent of the country's economic collapse can be measured in the length of its lines. The average Venezuelan shopper spends 35 hours waiting to buy subsidized goods each month. That's three times more than in 2014, according to the polling firm Datanalisis.

"As the economy breaks down, life is telescoping to be just lines," said Datanalisis president Luis Vicente Leon. "You're inevitably going to get conflict, fights, tricks, you name it."

Venezuela's vast oil wealth once fueled a bustling economy. But years of mismanagement under a socialist government disrupted much of the nation's production, and a steep drop in the price of oil left the country unable to pay to import basic necessities.

Shortages now top voters' lists of concerns, surpassing even safety. That's stunning in a country with one of the world's highest murder rates.

Ahead of the weekend, bank lines grow long because ATM limits capped at $8 daily have not kept up with triple-digit inflation. Machines are tapped out by Saturday afternoon.

On Mondays and Tuesdays, the lines outside immigration offices spill down the street, as if people suddenly decided over the weekend that they could not handle one more week standing around while life passes them by.

Each night, men push broken-down gas guzzlers along a river to line up at a warehouse that sells car batteries, but runs out of stock by mid-morning.

The longest lines are for what is in the shortest supply: food.

Nine out of 10 Venezuelans say they can't buy enough to eat as scarcity drives up prices, according to a study by Simon Bolivar University. They often line up not knowing what they'll get when they finally reach the front. When the supply trucks arrive, workers throw open the doors, game-show style, to reveal whether shoppers will be taking home precious pantry staples, or a booby prize like dog food.

Sometimes the disappointment is unbearable. Hundreds of people stormed a Caracas market last month after the truck they had been waiting for was diverted. "We're starving," they cried, as shopkeepers lowered metal gates over doors and windows.

Soldiers with tear gas and rifles increasingly stand guard over supermarkets to maintain order. But the state security forces killed three people in June while trying to control nationwide food riots.

A few blocks away from where Perez died in the toothpaste line, shoppers waiting to buy groceries watched a mob set fire to an accused thief. After the man was taken away in an ambulance, some of his assailants got in line to do their shopping.

Although the threat of violence hovers in the air, the line also is a place of normal and sometimes extraordinary life.

Merlis Moreno gave birth to a baby girl this spring while waiting to buy chicken in the oven-hot plains town of El Tigre. The skinny 21-year-old delivered her daughter with the help of a supermarket janitor and used a sheet from the backroom as swaddling.

Kids do homework on the curb. Some young men use the empty hours to meet women. More often, though, love stories end in line.

Sasha Ramos broke up with her boyfriend of five years amid a spat over a blocks-long line for razors. He'd spent the morning complaining that they were hardly moving. They argued and he stormed away, leaving her staring at the ground next to strangers who had heard it all.

"These lines are not good for love," Ramos said.

The bleakest lines are at the Caracas morgue. While the other lines are about shortages, this one stems from an excess of death.

Perez's body was among 400 homicide cases the morgue's skeletal staff handled in April. That's more than the annual number of homicides in New York or Los Angeles.

As they wait for hours to collect their loved ones, red-eyed relatives cover their noses with handkerchiefs to blunt the acrid stench. Embalming chemicals have run out.

Then it's off to the city cemetery.

The wait to be buried there: Three days.

___

Hannah Dreier is on Twitter at https://twitter.com/hannahdreier. Her work can be found at http://bigstory.ap.org/content/hannah-dreier.