Zoe Kazan woke up one morning with an idea. "I quickly got down as much as I could - five pages or so," she recalls.

And then she showed it to her boyfriend, Paul Dano. The two actors live together in Brooklyn.

"Paul said, 'You're writing this for us, right?'

"And it hadn't occurred to me," she says, "because these characters felt so real that I was just concentrating on them. But when he said that, I thought, Yeah, obviously I am. So I wrote the rest of the screenplay with us in mind."

That screenplay, finished in the spring of 2010 and called He Loves Me, and then The Girlfriend, before coming around to Ruby Sparks, is an ingenious comedy fantasy romance. It stars Kazan in the title role, and Dano as a novelist who enjoyed huge success with his literary debut - published when he was all of 19. Now, 10 years on, he's grappling with a crippling case of writer's block.

Directed by Jonathan Dayton and Valerie Faris of Little Miss Sunshine, the 2006 indie hit in which Dano had a key role, Ruby Sparks - opening Friday at the Ritz Five and Rave Motion Pictures/NJ - takes a whimsical premise to some seriously reflective, wonderful, and even dangerous places.

The premise: that Calvin Weir-Fields (Dano) has sat down at his typewriter, struggling mightily to get his writing back on track, and created a character - an ethereal, malleable young woman named Ruby Sparks.

The next thing you know, Calvin meets an ethereal, malleable young woman named Ruby Sparks. His character has literally come to life, and any actions or attributes he types out on his trusty Olympia are taken on by the real, flesh-and-blood Ruby.

Then again, is she real, or is Calvin just losing it?

Kazan was inspired by the Greek myth of Pygmalion and Galatea, but also by the desire to write a romantic comedy from a woman's point of view - one that examines how men idealize women, and how partners in a relationship can project their fantasies and expectations on each other in ways that sometimes aren't all that viable, or beneficial.

"I wanted to write about relationships and what happens to people in relationships, especially when they try to change the other person," she explains.

"The film has magical elements, but it also contains a lot of emotional truth," says Dano, in a separate interview. "So what Ruby is going through can be funny, but also scary at the same time."

Dano and Kazan - who traveled to Philadelphia with their movie's directing duo a few weeks ago - have been an item for four years now. They had appeared in Kelly Reichardt's Meek's Cutoff together. And they were determined that they'd team up again for Ruby Sparks.

"I said to my agents that I'm absolutely certain that I don't want to sell this [screenplay], and we need to keep as much control as we can," Kazan says. "And we'll make it with me and Paul, no matter what. So even if that means that we're doing it ourselves in our backyard, then that's how we're going to do it."

She smiles.

"It's funny what happens when you make something nonnegotiable. People don't negotiate with you about it!"

There's a great scene in Ruby Sparks in which Calvin has finally convinced his brother (Chris Messina) that Ruby is both the author's creation and a living, breathing human being, and that anything Calvin types, Ruby does.

So Messina's character tells Calvin that he owes it to all the men in the world to give Ruby some awesome sex skills. Right there, in other hands, Ruby Sparks could have turned into a horndog Hollywood sex farce.

"Yes, if it had been written by a man and directed by a man," says Faris, laughing.

"I really credit Zoe for making this look easy," adds Faris' directing partner, Dayton. "It is a very particular, very tricky line to walk where she was able to make this fantastic concept seem ultimately very real."

Kazan, 28, is third-generation Hollywood. Her grandfather was Elia Kazan, the storied screen director and cofounder of the Actors Studio. Her grandmother Mary Molly Thacher was a playwright. Her parents are both writers and directors - Nicholas Kazan and Robin Swicord. Raised in L.A., Kazan's been living in New York for the last seven years, and writing plays and screenplays between acting jobs.

And while she shows her work to her mother and father, she also tries to maintain a professional distance.

"We're a very close-knit family and it was hard enough for me to break away and move across the country and put those boundaries there," she explains. "I actually think it's harder for children to break away when their parents are like them, when you don't have something to rebel against and they're just like awesome people. . . .

"So, they're a great resource. But more often, rather than showing them a script and asking for notes, I'll call them up if I'm stuck on something . . . it's nice to have the comfort of knowing that they know what I'm talking about."

And unlike Calvin, Kazan has not wrestled with writer's block.

"I think for me, it's easier because there's not that much pressure," says Kazan, who has four writing projects going right now. "I could decide never to write again, and it would be fine, because I love to do what I'm making my living at - which is acting. . . . I sort of feel like I'm always in the Garden of Eden. I'm just writing and it's for pleasure. I mean, obviously there are deadlines, and I've had plays produced and had to write to certain actors and have certain expectations from the people that run the theater companies, so it's not all pleasure. But I do think there's a way in which I've kept myself innocent."

And although Calvin writes on a typewriter, Kazan sticks to her computer. Holed up in his big, empty, hillside house, Calvin taps away - the sound of the keys hitting paper echoing around and around.

"For me, the typewriter is so indicative of where Calvin is in his life," Kazan says. "He's in this place where he needs desperately to have a machine that works faster, but he can't let go of the past. He can't let go of the thing that he wrote his first novel on.

"So often we have magical thinking about our own creative process - you know, that it's mysterious to us. People do a lot of things to try to trick themselves into thinking that they can repeat the magic, like wearing the same thing, or eating the same thing, or having the same routines, and for me that typewriter represents that.

"And also, it's an object for which there is only one purpose, unlike a computer. . . . You look at a computer and so many people see a gateway to the world - you know, Facebook and online dating and the World Wide Web - and I just really wanted him to feel very, very isolated.

"You can't really take a typewriter into public, it's not like a laptop, and so he's anchored to the desk with this heavy mechanical object.

"This beautiful heavy mechanical object."

On Movies:

Inquirer movie critic Steven Rea talks with real-life partners Paul Dano and Zoe Kazan about acting as a couple in "Ruby Sparks" at www.philly.com/rubysparks


Contact Steven Rea at 215-854-5629 or srea@phillynews.com. Read his blog, "On Movies Online," at www.philly.com/onmovies