Single-cell imaging reveals spontaneous phenotypic sorting and bet-hedging in developing biofilms