redeal() in functions.js
function redeal() {
  if (g_click_card!=-1) {
    g_click_card.classList.remove('highlight');
  }
  g_z=50;
  g_click_card=-1;
  deal(); draw();
}

Next, we're going to look at an undo facility.

But once again, we'll need to remove any active highlight so I propose creating a new helper function, highlight_off().

highlight_off() in helpers.js
function highlight_off() {
  if (g_click_card!=-1) {
    g_click_card.classList.remove('highlight');
    g_click_card=-1;
  }
}
revised redeal() in functions.js
function redeal() {
  highlight_off();
  g_z=50;
  deal(); draw();
}