Phase transition in Stabilizer Entropy and efficient purity estimation