// Initialize Telegram WebApp
let tg = window.Telegram.WebApp;
tg.expand(); // Expand the app to full screen
tg.MainButton.setText("Play Now").show();

// Function to handle the "Spin" button click
function handleSpin() {
  const bet = document.getElementById('bet-amount').value;
  const clientSeed = generateClientSeed(); // Generate a random client seed

  // Send the bet request to your backend
  fetch('/api/spin', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ clientSeed, bet })
  })
  .then(response => response.json())
  .then(data => {
    // Animate the slot result based on data.outcome
    // Update the user's balance on screen with data.currentBalance
  });
}