const historyContainer = document.getElementById('history-container'); let history = []; function renderHistory() { if (!historyContainer) return; if (history.length === 0) { historyContainer.innerHTML = ''; return; } historyContainer.innerHTML = '
' + '

History

' + '
'; } async function loadHistory() { try { const res = await fetch('/api/history'); if (res.ok) { history = await res.json(); renderHistory(); } } catch (e) {} }