Mechanics and stability of vesicles and droplets in confined spaces.