How to compensate for citric acid in hard candy?
You are breaking the sugar into fructose and glucose, getting invert syrup

I'd suggest making the sugar base and then adding fine powder or dissolved acid with rapid cooling to stop the hydrolysis.

Or use a paste of fine citric acid with some oil to slow down dissolving of the acid.

You can also try to use mechanical mixing like extruder screw or rolls to keep the water contents lower and better control heating.

Also note that your candies can turn soft and sticky over time.