You’ve seen the story a thousand times. Glum guy meets kooky, free-spirited gal and she brings all the color and joy his life was lacking. But the unconventional romantic comedy “Ruby Sparks” steers that familiar premise into unexpectedly strange, hilarious, ominous and poignant directions.

In this fractured fairy tale, introverted novelist Calvin magically brings his fantasy girl Ruby to life, and then tries to rewrite her when she begins developing a mind of her own.

The film’s sharp observations about couplehood and its discontents owe something to the creative partners who brought it to the screen. Zoe Kazan wrote the film and co-stars with her offscreen boyfriend of five years, Paul Dano. The directors are the husband-wife team of Jonathan Dayton and Valerie Faris (“Little Miss Sunshine”). Together they provide a bifocal view of male-female relationships, finding much to satirize and much to love.

After the universally beloved “Little Miss Sunshine,” Faris and Dayton spent five years searching for a worthy follow-up. Deal after deal went wrong.

“I couldn’t fathom the idea of coming out with anything I loved less,” Dayton said. “A film is two years of your life, so you’d better love it deeply and be ready to carry it with you the rest of your life.”

“We felt a duty to the audience and to the art form,” Faris said.

In Kazan’s script, they sensed a worthy successor. Both are films about trying to make dreams come true, and expecting others to conform to our fantasies. Reflecting Faris’ dance background, each film reaches its emotional peak in a raucous dance scene.

“What interested us in this film was the idea of what we see in our partners, what we want them to be,” she said. “If you had the opportunity to control them, would you take it? What’s the logical outcome to that scenario?”

The film’s twists subvert the conventional romantic formula. That, plus the dark quirks of the hero’s personality, made it a dubious project, “but we kept plowing ahead, hoping no one would notice,” Dayton said. “There’s a knee-jerk reaction where people can’t do something that’s unsympathetic. But we all make mistakes. We’re going to go there and hopefully you’ll recover with us.”

This was a character that Dano would have wanted to play regardless of who had written it, he said. “When I was reading pages as Zoe wrote, my excitement was genuine,” he said. “I liked the surprises and unexpected things that keep you on your toes.”

The character of Calvin veers from paranoia about losing his mind, to the giddy high of love, to childish sulks and manipulative pushiness.

It’s an actor’s feast, Dano said. “To me, that light and dark feels really human. Both sides are appealing. When Calvin thinks he’s going crazy, it’s funny, and to explore what controlling is like, we have to go to a dark place without excusing it. I liked the whole kit and caboodle. I like to do the drama because that’s more scary to me, but I like to do really broad comedy, too.”

Dano, 28, who has acted opposite Daniel Day-Lewis and Robert De Niro, said that acting with his girlfriend was a situation that “gives you an extra hump of self-consciousness. But after Day 2, it was OK. That’s part of my job as an actor, to exorcise any doubts or nervousness.”

Although Kazan, also 28, is the granddaughter of celebrated theater and screen director Elia Kazan (“On the Waterfront,” “A Streetcar Named Desire”), it wasn’t a family expectation that she would enter show business. “My parents were very laissez-faire,” she said.

As a child, she naturally gravitated to the local video store and fell in love with the idea of writing and performing. “I’m always surprised that it has worked out as well as it has,” Kazan said.

She didn’t begin “Ruby Sparks” as an acting project for herself and Dano, but when he asked if that was what she had in mind, “it seemed totally clear that’s what I was doing.”

Faris and Dayton encouraged Kazan to make the conflicts between her characters outwardly visible, making her performance more physically demanding than she initially imagined. The tensions that build between Calvin and Ruby climax in a frenetic dance scene that required Kazan to flail like a banshee for an entire working day. “It was like a marathon,” she said. “I almost threw up after that.”

The “Ruby Sparks”‘ theme of a woman who is defined by a man’s imagination of what she should be reflected experiences from her past relationships, Kazan said.

“I have felt very defined by the person I’m with, by their idea of love and of a person worth loving,” she said. “In the effort to live up to that in previous relationships, I’ve lost track of myself a little. I’m really interested in why men do that and why do women bend to it. What is it about the romantic in a man that makes them overlook the person that they’re with?

“I feel like we all start with the idea of a person before we get to know them as we fall in love, but it feels somehow different for men than it is for women. That’s reflected in our culture in a movie like ‘500 Days of Summer’ or ‘Annie Hall,’ where you see the man’s perspective on the relationship and not so much the woman’s. I was trying to address that head-on.”