The court cites safety and fairness in its ruling that allows, but doesn’t order, states to ban transgender girls and women from girls’ and women’s sports.