China shares gyrate as Beijing scrambles to calm markets