Any-Resolution AI-Generated Image Detection by Spectral Learning