Entanglement as a probe of confinement