Instead of having your spells receive their click shards at random, could they receive a sort of port priority? spells farthest to the left get shards first, with subsequent spells only getting attention once the spell in front is full?
if youre losing your data after clearing ur history, then u lost progress because u emptied the cache, which has the save data, u can turn that off in the settings when about to clear history