The "best match" variant is chosen when the layout is loaded based on the variant size and the device screen size. The script of the selected variant will be applied.
I recommend you to use as few as possible variants and preferably put all the designer script in the general script.
You can use code such as the following code to change the layout based on the screen size (ActivitySize returns the approximate screen size in inches):