I've had a number of bear encounters... first time was while camping in Yosemite. Tied a line between two trees and put a tarp over it for a quick temp shelter. Woke in the middle of the night to tree limbs crashing down on the tarp, and could barely make out a black bear cub that had climbed one of the trees. Panic time - "where's the mom?" Didn't stick around to find out - beat it out of there, didn't sleep until the sun came up.
But the "closest call" was when a huge black bear got into our garbage shed attached to the outside of my house in Four Mile Canyon west of Boulder. There was a vertical window next to the shed and when I heard the noise, went to the window. It was dark outside, so I cupped my hands around my face to block out the light and pressed my face up against the glass. The bear's nose was 2-3 inches from my nose. I assure you, THAT will get your attention. I about had a heart attack.
The bear was unfazed. He plucked the door off the garbage shed (solid 2x6 construction with 6" strap hinges), grabbed a bag and headed across the creek. A half hour later found me outside with a flashlight picking garbage out of the creek bed, heart still going at 120bpm...