Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+ const createRoomBtn = document.querySelector('.create-room');
+ const joinRoomBtn = document.querySelector('.join-room');
+ const roomDialog = document.querySelector('.room-dialog');
+ const closeDialog = document.querySelector('.close-dialog');
+ const gameSetup = document.querySelector('.game-setup');
+ const gameBoard = document.querySelector('.game-board');
+
+ // Mobile menu toggle
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Room creation
+ createRoomBtn.addEventListener('click', () => {
+ const roomCode = generateRoomCode();
+ initializeGame(roomCode);
+ });
+
+ // Join room dialog
+ joinRoomBtn.addEventListener('click', () => {
+ roomDialog.showModal();
+ });
+
+ closeDialog.addEventListener('click', () => {
+ roomDialog.close();
+ });
+
+ // Handle room joining
+ roomDialog.querySelector('form').addEventListener('submit', (e) => {
+ e.preventDefault();
+ const roomCode = e.target.querySelector('input[type="text"]').value;
+ const playerName = e.target.querySelector('input[type="text"]:last-of-type').value;
+ joinGame(roomCode, playerName);
+ roomDialog.close();
+ });
+
+ function generateRoomCode() {
+ return Math.random().toString(36).substring(2, 8).toUpperCase();
+ }
+
+ function initializeGame(roomCode) {
+ gameSetup.classList.add('hidden');
+ gameBoard.classList.remove('hidden');
+ // Initialize game state here
+ }
+
+ function joinGame(roomCode, playerName) {
+ gameSetup.classList.add('hidden');
+ gameBoard.classList.remove('hidden');
+ // Handle player joining logic here
+ }
+
+ // Card dealing animation
+ function dealCards() {
+ // Add card dealing animation logic
+ }
+
+ // Game state management
+ class GameState {
+ constructor() {
+ this.players = [];
+ this.currentTrick = [];
+ this.scores = {
+ team1: 0,
+ team2: 0
+ };
+ }
+
+ // Add game logic methods here
+ }
+
+ // Initialize game state
+ const gameState = new GameState();
+ });