Is this possible? Changing both variable and variant state at the same time

I’m trying to create a component like this:

Requirement 1: The component should be unselected unless the user has clicked on it, including clicking on the number stepper, which should also update the number variable. This is not working – clicking on the embedded stepper component prevents the variant from changing.

Requirement 2: I also want this component to be general-purpose, so that an instance of the component can be assigned a different variable for the number. This is not working – Set Variable on the component instances doesn’t work, unless I detach it from the master component (and then my variant change interactions don’t work anymore).

Is what I’m trying to do possible in Figma? How would you do this?

Demo Figma file (make a copy of this file rather than editing it)