Hamiltonian bridge for scale-dependent optimal control of particles and fields