In the Los Angeles exurb of Santa Clarita there lived, not long ago, Charlie, a manic/depressive who kept meds in the kitchen, ancient treasure maps under his pillow, and his teenage daughter on tenterhooks.

Charlie lives in a house with a sagging porch and graying paint (suggestive of its owner's belly and temples), a dilapidated Victorian, an anachronism drowning in the rising stucco tide of development.

His adventures, a picaresque tale of madness, buried treasure and daddy/daughter love, are told in King of California, a delightful shaggy-dude story that, despite its allusions to Shakespeare's The Tempest, unfolds like Don Quixote Goes to Costco.

Charlie (Michael Douglas), magnificently wild-eyed and woolly-haired, is released from a mental institution after two years. This prompts Miranda (Evan Rachel Wood), his supremely self-reliant 16-year-old, to get back on "the bipolar pony," as she calls riding Dad's mood swings.

An unreconstructed beatnik and onetime jazzman, Charlie sees that they have paved the orange groves he remembers to put up big-box stores.

And while the antiestablishment figure is proud that Miranda has outwitted child welfare by saying that she lives with her mom (who decamped when she was 7), he's horrified that she works - gasp! - for McDonald's. And that she craves - how's that? - a dishwasher, that establishment status symbol.

The nicely detailed, resonant film written and directed by newcomer Mike Cahill sets us up to expect that the physics of comedy will involve a levelheaded caretaker helping her seesawing father achieve some kind of balance.

But what if the slightly square Miranda (imaginative enough to fool the social workers, pragmatic enough to work two shifts) plays two for the seesaw? What if she rides along with her father's crackpot theory, developed while he read California history in the institution, that a 17th-century conquistador buried a cache of doubloons near a ravine where a Costco now stands? What if she declines to parent her parent and instead rides shotgun to a scheme that most health-care diagnosticians would call delusional?

Charlie's quest dovetails with Miranda's hunger for parental connection. As Cahill gently depicts it, Charlie builds a castle in the air, Miranda furnishes it, and the audience gets a privileged visit. To the credit of Douglas, who does his most poignant work since Wonder Boys, and Wood, an ingenue of startling emotional resources, we suspend disbelief.

Whether Charlie and Miranda get the gold is insignificant. The treasure of the film is the unearthing of the family bond, magically played by Douglas and Wood.

King of California *** (out of four stars)

Written and directed by Mike Cahill. With Michael Douglas and Evan Rachel Wood. Distributed by First Look Pictures.

Running time: 1 hour, 33 mins.

Parent's guide: PG-13 (profanity, mature themes, drug references)

Playing at: Ritz at the BourseEndText

Contact movie critic Carrie Rickey

at 215-854-5402 or crickey@phillynews.com. Read her blog, "Flickgrrl," at http://go.philly.com/.