/** * TradeMate Content Script * Displays translation results on the page via a floating tooltip. */ chrome.runtime.onMessage.addListener((request) => { if (request.action === 'showTranslation') { showTooltip(request.original, request.translated); } }); function showTooltip(original, translated) { const existing = document.getElementById('trademate-tooltip'); if (existing) existing.remove(); const tooltip = document.createElement('div'); tooltip.id = 'trademate-tooltip'; tooltip.style.cssText = ` position: fixed; top: 20px; right: 20px; z-index: 999999; max-width: 400px; padding: 16px; background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.6; color: #333; animation: slideIn 0.3s ease; `; tooltip.innerHTML = `