Test-time Adaptation in Non-stationary Environments via Adaptive Representation Alignment