This story has been updated.

In 1932, with the Great Depression rocking the industrialized world, a master carpenter in Denmark named Ole Kirk Christiansen desperately needed a way to earn a living. As other businesses closed, Christiansen doubled down on wood, starting a company that manufactured stepladders, ironing boards along with an entirely new product line: wooden toys.

He called the company Lego.

The name derived from the Danish words “leg” and “godt,” meaning play and well. Though Lego’s first toys were simple yo-yos, trucks and ducks on wheels, the company would eventually become one of the most respected brands in the world, alongside Apple and Nike, nevermind Mattel or Hasbro. With it’s connectable plastic bricks, Lego came to reflect the evolution of childhood imagination around the world, a remarkable feat given that its founder didn’t have much schooling.

Listen to this story on “Retropod”:

For more forgotten stories from history, listen online or subscribe: Apple Podcasts | Google Podcasts | Stitcher | More options

But now that childhood playtime is rapidly shifting to screens, Lego is trying to hold onto Christiansen’s legacy. The task is enormous. Earlier this month, after revenue dropped 5 percent for the first half of 2017, Lego  laid off  1,400 employees, about eight percent of its 18,200-person global workforce. On Monday night another toy Goliath, Toys ‘R’ Us, announced it would file for  Chapter 11 bankruptcy, though it promised that its 1,600 stores would remain open. The famous retailer has struggled to compete with Walmart, Target and online giant Amazon.

Even during its earliest days in the 1930s, Lego faced intense challenges, according to David C. Robertson, the author of “Brick by Brick,” a 2013 history of Lego. Ole Kirk Christiansen, a widower, was running the business on his own, all while raising four sons, in the backdrop of the Great Depression and later, the German invasion of Denmark. He got some help from one of his sons, though: Godtfred Kirk Christiansen, who had been building toy models for the company as a teenager, became a Lego manager in 1940. But two years later, the factory suffered a fire, which destroyed Lego’s entire inventory and its blueprints for new toys. Christiansen nearly ended his gambit, according to Robertson, but soldiered on.

By the late 1940s, Lego finally produced what it called “automated binding bricks,” a precursor to the bricks of today. Ole and Godtfred grew interested in them from British inventor Hilary Fisher Page’s plastic, stackable cubes with two rows of four studs. But the Christiansens modified the size of the bricks, sharpening the edges. The only problem was that they weren’t all that sturdy and children hadn’t yet embraced plastic toys. By 1953, the “automatic” pieces got a formal, new name: “Lego Bricks.” But the bricks were selling poorly, Robertson wrote. They didn’t snap to each other very well. They didn’t stick.

Then, in January 1958, Lego obtained a patent for an idea it had been working on for years: a stud-and-tube design that allows kids to snap the bricks together without them coming apart. The new system gave children the chance to build something sturdy, without it wobbling, or coming undone. Lego also made sure that new bricks were always compatible with old ones.

That very same year, the company’s founder died. Ole’s son, Godtfred, took over. But it was the bricks that really built the company. Lego executives, observing how children played with their products, realized the firm’s future success was not about the brick, but what the brick could create: buildings, streets, cities, all filled with people, vehicles, street signs, and bushes. “You can go on and on, building and building. You never get tired of Lego,” one of its publicity campaigns said.

“Decades before the rise of ‘value webs’ and Apple’s ‘brand ecosystem’ of i-centered offerings, Lego took a holistic view of its product family, with the ubiquitous brick as the touchstone,” wrote Robertson, a senior lecturer at MIT’s business school.

Lego began inventing items that, in hindsight, are incredible to think of as innovations: In the 1960s, the company’s bricksmiths invented the wheel, a round brick with a rubber tire. The Lego wheel earned its own patent application. (Robertson wrote in his book that Lego makes more than 300 million tires per year, more than Goodyear or Bridgestone.) Then, it launched Duplo, its line of bigger bricks for preschoolers. In 1968, the first LEGOLAND theme park opened in Billund. Lego was trying to be its own kind of Everything Store or Everything Toy.

The 1970s saw even bigger successes: miniature figures to populate the towns kids were building. Then, castles to evoke a medieval world of knights and royalty. Astronauts followed shortly thereafter — the company’s space theme would later prove instrumental to its future. And the family leadership continued to reign: Kjeld Kirk Kristiansen, Godtfred’s son, took over in the late 1970s and would remain at the helm for years. (The family apparently alternates the spelling of the first letters of its last name.)

After the last of Lego’s patents for its interlocking bricks expired in the late 1980s, the company naturally faced a raft of upstarts seeking to cash in on the brick craze. Lego tried fighting back with lawsuits, but failed, according to Robertson. Still, Lego customers knew the real deal from the fakes. By the early 1990s, Lego experienced double-digit growth in sales, while the rest of the toy industry’s increase hovered around 4 percent, Robertson wrote.

Lego controlled nearly 80 percent of the toy construction market.

Its big success came in the late 1990s. Lucasfilm was about to release the first of a prequel trilogy to the original “Star Wars” movies. And Lego was debating whether to partner with the company to license a set of “Star Wars” toys that would come out at the same time as the film. Astonishingly, Lego executives initially balked, partly as a result of the company’s fierce independence. But Lego, whose executives took pride in the innocent nature of their toys, also fretted about aligning itself with any violence. The company surveyed parents, who didn’t mind the partnership. The positive polling gave Lego the comfort it needed to push ahead with “Star Wars.”

The result? Its “Phantom Menace” Lego “Star Wars” product line killed — comprising more than 15 percent of the company’s sales. The “Star Wars” arrangement ushered in similar, profitable licensing agreements. It wasn’t long until Lego rolled out “Harry Potter” sets of Legos.

Yet, Lego found itself on the brink of bankruptcy in the early part of the new century. In late 2003, the company’s sales sank by 30 percent compared to the year before. Lego was introducing too many product lines, without putting enough attention on its original, core business, Robertson wrote. There were Lego dolls, a Lego kids’ clothing line, and a multitude of other products.

Toy retailers began complaining to Lego that the firm didn’t provide enough inventory of one of the few best-selling items — the Bionicle Legos, which are set in a science fantasy world. The company had also become too reliant on “Stars Wars” and “Harry Potter” movies, and during the years those films weren’t released, Lego’s revenue dropped. The media was reporting that Lego might be sold. One Lego executive even had a discussion with Mattel about acquiring the bruised brand, according to Robertson. In 2004, the tenure of Kjeld Kirk Kristiansen — the grandson of the founder — ended. But he remains the majority shareholder of the holding company that owns Lego.

Eventually, Lego trimmed. It shut down several of its theme parks and killed off poor-performing product lines. It invested in classics that kids always loved: the city Legos, Duplos, Bionicle, Star Wars and Harry Potter. It tried venturing into the online video game world, but failed against the popular makers of Minecraft.

But even as financial analysts and toy experts push Lego to diversify into even more digital and film offerings, the company is doubling down on the bricks, just as its founder, the master carpenter, doubled down on wood during the Great Depression. One of Lego’s newest offerings, available October 1, is a $799.99 “Star Wars” Millennium Falcon.

Inside the box: More than 7,000 bricks.

Read more Retropolis: