class GameHeader extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.render(); // Listen to global state updates document.addEventListener('state-update', () => this.render()); } render() { const isPlaying = state.personaId && !state.gameOver; const persona = PERSONAS[state.personaId]; // Debt warning logic (Behavioral Nudge) const isDebtCritical = isPlaying && state.stats.debt > 50; const criticalClass = isDebtCritical ? 'debt-critical' : ''; // Dual Wallet Logic (Sunita - Woman) const isDualWallet = isPlaying && PERSONAS[state.personaId].special === 'separation_wallets'; this.shadowRoot.innerHTML = `