                addMessage(event.data, 'server');
                    } else {
                        addMessage(event.data, 'server');
                    }
                };

                ws.onclose = function () {
                    addMessage('‚ùå Connection closed. Attempting to reconnect in 3 seconds...', 'system');
                    updateStatus(false);
                    setTimeout(connect, 3000);
                };

                ws.onerror = function () {
                    addMess