function startGame() {



/*
  var img = new Image();   
  img.src = 'banner.png';  
  img.alt = 'Triggers V10';
  img.style.width = '100%'; 
  img.style.height = 'auto'; 
  img.id = 'banner-image';
  banner.appendChild(img);
*/
    // Button Bar
    addButtonsToButtonBar();
    addButtonsToButtonBar_sub();
    addButtonsToButtonBar_sub_more();
    add_stats_bar();
    if(showAPI==true)
    {
      load_api();
    }

    const quickBoard = q_rouletteTable();
    
    inputBar.appendChild(quickBoard);

    updateBorderVisibility();

document.body.appendChild(q_random_button_sticky());
document.body.appendChild(q_random_button_sticky_auto_spin());

}

function runAfterUpdates()
{

   updateBuildMissAllNewNumber();
  showHistoryBoard();
  updatePatternNewNumber();
  v_number_container_update();
  update_alert();
  onSpin_frequency();
  update_stats();
  bouncyUpdate();
  comboUpdate();
  statsAfterSpin();
	updateBorderVisibility();
  updateNumbersCount();

updateNumbersCount();


}

function updateNumbersCount() {
  const span = document.getElementById('numbers-count');
  if (span) {
    span.textContent = `Count: ${numbers.length}`;
  }
}

document.addEventListener('DOMContentLoaded', function() {
  var myTable = document.getElementById('quick-table');
  var lastTapTime = 0;
  
  myTable.addEventListener('touchend', function(event) {
      var currentTime = new Date().getTime();
      var tapLength = currentTime - lastTapTime;
      if (tapLength < 300 && tapLength > 0) { // Adjust threshold as needed, 300ms is typical
          event.preventDefault(); // Prevents the double-tap zoom

      }
      lastTapTime = currentTime;
  });

  setupCoordinateDisplay();
});

function setupCoordinateDisplay() {
  const table = document.getElementById('rouletteTable');
  const coordsDisplay = document.getElementById('coords');

  table.addEventListener('mousemove', function(event) {
      // Calculate the coordinates relative to the element
      const rect = table.getBoundingClientRect();
      const x = event.clientX - rect.left; // x position within the element.
      const y = event.clientY - rect.top;  // y position within the element.

      // Display the coordinates
      coordsDisplay.style.display = 'block';
      coordsDisplay.style.left = `${event.clientX + 10}px`; // Offset by 10px to not overlap cursor
      coordsDisplay.style.top = `${event.clientY + 10}px`;
      coordsDisplay.textContent = `x: ${x}, y: ${y}`;
  });

  table.addEventListener('mouseleave', function() {
      coordsDisplay.style.display = 'none'; // Hide the coordinate display when not over the table
  });
}

function updateImageSize(img) {
  var screenWidth = window.innerWidth;
  if (screenWidth < 768) {
    img.style.width = '300px';
    img.style.height = '120px';
  } else if (screenWidth >= 768 && screenWidth < 992) {
    img.style.width = '600px';
    img.style.height = '240px';
  } else {
    img.style.width = '100%';
    img.style.height = '400px';
  }
}

function q_random_button_sticky() {
  const button = document.createElement('button');
  button.style.minWidth = '220px';
  button.style.height = '100px';
  button.style.margin = '5px 0 5px 10px';
  button.style.fontSize = '60px';
  button.style.padding = '0 30px';
  button.style.textAlign = 'center';
  button.style.lineHeight = '70px';
  button.style.border = '2px solid black';
  button.style.borderRadius = '10px';
  button.style.backgroundColor = '#eee';
  button.style.cursor = 'pointer';
  button.textContent = 'Spin';

  // Make it sticky to bottom right
  button.style.position = 'fixed';
  button.style.bottom = '20px';
  button.style.right = '20px';
  button.style.zIndex = '1000';

  button.onclick = function () {
    oneRandomNumber();
  };

  return button;
}

