Pixar favorites like “Toy Story” and “Monsters, Inc.” have always been built on the strength of imagination. But the studio's newest offering, “Inside Out,” might be the first to do it literally.

“Inside Out” takes place almost entirely within the mind of an 11-year-old girl. Her individual emotions are the main characters, and as they navigate the inner workings of her mind, “Inside Out” teaches us a fascinating — and entertaining —lesson about the nature of joy and sadness.

Riley (voiced by Kaitlyn Dias) is a happy, all-American kid who loves hockey and her parents, at least until her dad’s startup company takes them to San Francisco. Standing at the cusp of puberty and thrust into a foreign environment — the cafe around the corner only serves broccoli pizza — Riley finds her world has been plunged into chaos.

Inside her mind, a cast of colorful emotions scrambles to manage the vast control board that steers Riley’s ship. Joy (Amy Poehler) has always been the default leader, but over time, she’s had to make room for a host of less desirable roommates. There’s Sadness (Phyllis Smith), Disgust (Mindy Kaling), Fear (Bill Hader) and, of course, Anger (Lewis Black).

Every time Riley creates a specific memory, her mind generates a globe that is color-coordinated to its dominant emotion — yellow for joy, blue for sadness, etc. The major events in Riley’s life create core memories, which in turn power her islands of personality, such as friendship and family.

Up until now, all of Riley’s core memories have been associated with joy. But when she has an awful first day at her new school, Riley creates her first sad core memory, and chaos ensues.

Of course, in the world of “Inside Out,” chaos means that Joy and Sadness take an epic journey through the complex world of Riley’s mind. They visit the different personality islands and the vast labyrinth of Riley’s long-term memory and take an amusing detour through abstract thought, never far from a bottomless pit that represents her forgotten memories.

The idea was inspired by director Pete Docter’s own daughter, and he wisely builds the story around the polarity between joy and sadness. He also scored big in the casting department. Poehler is perfect as the enthusiastic, highly strung Joy, and Smith (who will be familiar to fans of TV’s “The Office”) is vital as Sadness, the emotion with the most important character arc.

It’s a pretty creative way of illustrating the dramatic life-or-death way things like moving feel when you’re a kid (or an adult, really). Some of the complexity will probably be lost on younger viewers — at one point the characters learn that when Sadness touches a happy memory, Riley begins to see it in a melancholy light — but the story itself is entertaining enough to keep the kids’ attention.

Still, adults might be the best audience to fully appreciate “Inside Out.” Pixar movies have always maintained a delicate balance between their young primary audiences and the adults paying for the movie tickets. In this case, the scales might be tipped more to Mom and Dad than ever.

It’s really the only weakness in an imaginative and insightful film.

“Inside Out” is preceded by “Lava,” an amusing animated short about a very unlikely love story.

“Inside Out” is rated PG for mild action and peril.

Joshua Terry is a freelance writer and photojournalist who appears weekly on "The KJZZ Movie Show" and also teaches English composition for Salt Lake Community College. Find him online at facebook.com/joshterryreviews.