// main — boot Phaser with the kit's scenes and config.
window.addEventListener('load', () => {
  const config = {
    type: Phaser.AUTO,
    parent: 'game',
    width: window.GAME.WIDTH,
    height: window.GAME.HEIGHT,
    backgroundColor: window.GAME.BG_COLOR,
    // Cap pixelRatio at 1 for locked 60fps (never 2).
    resolution: 1,
    render: { pixelArt: false, antialias: true },
    scale: {
      mode: Phaser.Scale.FIT,
      autoCenter: Phaser.Scale.CENTER_BOTH,
      width: window.GAME.WIDTH,
      height: window.GAME.HEIGHT,
    },
    physics: {
      default: 'arcade',
      arcade: { gravity: { y: 0 }, debug: false },
    },
    scene: [
      window.BootScene,
      window.PreloadScene,
      window.MenuScene,
      window.GameScene,
      window.GameOverScene,
    ],
  };

  // Force devicePixelRatio handling to 1 (no 2x oversampling).
  config.scale.zoom = 1;

  window.__game = new Phaser.Game(config);
});
