age('üö® Connection error occurred', 'error');
                };

            } catch (error) {
                addMessage('‚ùå Failed to connect: ' + error.message, 'error');
                setTimeout(connect, 5000);
            }
        }

        function sendMessage() {
            if (ws && ws.readyState === WebSocket.OPEN && input.value.trim()) {
                const message = input.value.trim();
                ws.send(message);
                addMessage('You: ' + message, 'user');
   