Ukraine’s military has wrestled Russia’s much-larger army almost to a halt in recent months, having gained a tactical and technological edge.