Ahoy, parents: Daniel Handler’s new novel, “We Are Pirates,” spools out a series of unfortunate events, but it’s not for your kids — and don’t let the fantastic embossed cover lead you astray. Although the scent of Lemony Snicket’s gothic humor lingers over this tale of upper-middle-class despair, it’s assuredly one of Handler’s adult books.

As the voyage begins, we seem to be sailing into the still, clear waters of domestic satire. Phil and Marina Needle live in a condo they can’t afford in San Francisco, where hardly anybody can afford a condo. Their marriage has “reached the timberline of their affection,” but they don’t notice yet. They also don’t notice that their 14-year-old daughter, Gwen, has grown unhappy and fiercely bored — did I mention she’s 14? When a drugstore manager calls to report that she has been caught shoplifting, Phil’s daughter seems suddenly alien: “He did not know anything about a girl who would steal things from a drugstore. Gwen didn’t seem like she could be this girl. He pictured a shoplifter, and it was somebody more glamorous, more methodical, than this shaking thing with one foot on the coffee table and the other on tiptoe on the carpet, quivering and annoying the dog.”

Phil doesn’t realize how intensely his daughter wants to be free — from the common humiliations of high school, the viscous love of her parents, the lame constraints of their consumer lives. But if he’d only listen, he’d sympathize because he feels essentially the same quiet desperation. While Gwen imagines that she’s a taller and savvier girl named Octavia, Phil fantasizes about featuring blues singer Belly Jefferson in a bold new radio show that “would be broadcast everywhere [and] embody the American outlaw spirit.”

As Americans have been realizing for a long time, there is no more territory to light out for, and this is a story about how corrosive that outlaw spirit becomes when it ferments in the tightly sealed confines of contemporary life. Jumping between parallel story lines, Handler is just as sensitive to the frustration of overregulated teens as he is to the weariness of overscheduled executives. An extended riff on Phil’s big business meeting offers Handler a chance to satirize the annoyance of travel, the incompetence of Phil’s secretary, the vanity of his very rich boss. If these are not particularly fresh subjects, they are, at least, delivered with Handler’s typically arch tone.

But who is narrating this novel?

"We Are Pirates" by Daniel Handler. (Bloomsbury USA)

That’s a surprisingly complex problem, which adds some zest before the plot grows tragic. A first-person narrator opens the story by crashing Phil and Marina’s Fourth of July party — an allusion to our dead spirit of independence — but this voice is never identified. One moment the narrator is an admiring acquaintance of the Needles; another moment he enjoys unimpeded access to these characters’ thoughts and feelings. Sometimes he’s physically present; other times, he’s reporting on events from what sounds like decades or even centuries later. Every few pages, he reminds us that the Needles (and we) lived in a particular historical moment:

“At the time this story takes place, the bridge was called the Bay Bridge.”

“The people who had the idea would end up very wealthy, which was how winning was gauged during this era of American history.”

“It was hard not to watch any television that was turned on, as it always was during this era.”

That affectation becomes increasingly funny, even as it reminds us of the peculiarity and the impermanence of our own lives.

It’s also curious to see that Handler has sprinkled in wry comments about racial attitudes in the early 21st century. After all, “We Are Pirates” is his first book since his problematic gig as host of the National Book Awards in November. That evening was drolling along well enough until his wink-wink sense of humor betrayed him into delivering a racially tinged “joke” about Jacqueline Woodson, the African American author who had just won the Young People’s Literature award. His crude remarks cost him $100,000 in compensatory charity and an elegant skewering by Woodson a few days later in the New York Times.

He comported himself afterward with sincere remorse and seems to have escaped any permanent damage to his reputation, but now these self-conscious cracks about race in “We Are Pirates” feel radioactive, as when he tells us: “Just about everybody else, by the way, in this book is white.” Later a woman screams “the way the appearance of a black man makes everything suddenly scary.” When bleeding-heart liberal Phil needs help, he’s happy to see that the police officers on hand are black. “They would work hard and ruthlessly,” he thinks, “twice as hard, due to injustice.” At a coffee shop, “the guy with bloodshot eyes returned and stretched his hand across the counter to greet the other guy in a knocking, clasping ritual believed at the time to be favored by black people.”

Handler is doing something treacherous here with his signature irony: simultaneously enacting and mocking the latent racism in enlightened white society. This isn’t a significant aspect of “We Are Pirates,” but it’s a hazardous reef he could easily have sailed around. During this era, plenty of white novelists never mention black people at all — a bizarre, reality-warping omission for which they receive little criticism.

Perhaps it’s a remnant of that American outlaw spirit that tempts Handler to risk these satiric jabs. He can always prance away, pretend it was all just meant in fun — never mind. But his young heroine, Gwen, can’t critique her society so deftly or from such a secure position. Her isolated mind swells from discontent to rage. As the story progresses, she’s seduced by the moldy pirate tales she reads at an old folks home where she’s forced to “volunteer” as penance for shoplifting. When you’re a pirate, Gwen discovers, “you can do whatever you want. Go anyplace.” What Babbitt or Rabbit or teenage girl wouldn’t be heartened by that notion? “It is this philosophy that had sent Gwen bolt upright in bed,” Handler writes. “One day you have taken enough, and you begin to take it all back.”

Discouragement is everywhere when everywhere is mapped and watched and regulated. “There’s no pirates now,” Gwen knows — but “she did have the spirit of rebellion.” And soon she has collected a small but rowdy crew of fearless sailors who will be “the scourge of the San Francisco Bay Area.” For a few magical days, anything seems possible in the well-rigged ship of her imagination.

But the modern world is so adept at foiling pirates or independence of any kind. Gwen can parrot the salty language of those classic sea tales, but when she tries to launch her own adventure, she slips from farce to bloodbath, from J.M. Barrie to Quentin Tarantino. “The misdeeds of impulse” multiply rapidly in this gory plot hatched by young people whose moral sense has been infected by “the awful howl of vengeance.”

That’s the tragedy Handler signals in this dark and whimsical novel: Yes, we are pirates, but we’re chained on barren land. Has that theme ever been explored in such a weird mixture of impish wit and tender sympathy?

Ron Charles is the editor of Book World. You can follow him on Twitter @RonCharles.

WE ARE PIRATES

By Daniel Handler

Bloomsbury. 269 pp. $26