The electric fence is the way to go. If you are worried about the liability of someone getting shocked, you can unplug it while people are in the yard.
I live in the NW corner of CT, and every time you heard a story on the news about a bear in an urban area, CT Dept of Wildlife officials...