Bejeweled Selection of Items is not Precise on Browser

I am working on the bejeweled example of https://www.emanueleferonato.com in Phaser CE to make a game that fits in a cordova app on android and also Itch, Facebook IG and of course on a simple browser

My first port of the example of the tutorial on itch even if sometimes it bugs, in fact looks fine and seems to work as expected, but on the browser it doesn’t select the right items and selects other items then creates a bug

The code of the basical example is available on my github repo

The selection function is coded like this

function orbSelect(e){
     if(canPick){
          var row = Math.floor(e.clientY / orbSize);
          var col = Math.floor(e.clientX / orbSize);
          var pickedOrb = gemAt(row, col)

And the fieldSize is window.innerWidth / orbSize

function gemAt(row, col){
     if(row < 0 || row >= fieldSize || col < 0 || col >= fieldSize){
          return -1;
     }
     return gameArray[row][col];
}