You're matching the CSS selector but aren't adding it back into the returned value - it's just being replaced by the callback function
So what you need to do is capture those parts too, and return them from the callback, like this:
echo '<pre>'.
preg_replace_callback( '~(.*?{)(.*?)(})~s', function ($match) {
return $match[1] . mySort( $match[2] ) . $match[3];
}
,$css )
.'</pre>';