// ============================================================================= // SHARED COMPONENTS // ============================================================================= const { useState, useEffect, useMemo, useRef, useCallback } = React; const { CardArt } = window; const { PROVIDERS, RARITIES, STATS, CARDS, MYTHIC_CARDS, CHAMPIONS, COLLECTIONS, getCard } = window.GAME_DATA; // Format helpers function fmtStat(key, val) { if (key === 'rtp') return val.toFixed(1) + '%'; if (key === 'maxwin') return val >= 1000 ? (val / 1000).toFixed(val >= 10000 ? 0 : 1) + 'k' : val; if (key === 'hits') return val + '%'; return val; } function statForCompare(key, val) { // RTP is in 90-99 range — normalize by subtracting 90 if (key === 'rtp') return (val - 90) * 10; if (key === 'maxwin') return Math.log10(val) * 12; // log scale → 0–60 return val; } function normalizedPercent(key, val) { if (key === 'rtp') return Math.min(100, (val - 90) * 10); if (key === 'maxwin') return Math.min(100, Math.log10(val) * 12); if (key === 'volatility') return val; if (key === 'hits') return val; if (key === 'fame') return val; return val; } // ============================================================================= // PROVIDER CHIP // ============================================================================= function ProvChip({ providerId }) { const p = PROVIDERS[providerId]; const accentClass = { cyan: 'cyan', lime: 'lime', orange: 'orange', violet: 'violet', red: 'red', }[p.accent] || 'cyan'; return {p.code}; } // ============================================================================= // TOP TRUMPS CARD // ============================================================================= function TopTrumpsCard({ card, locked = false, selected = false, inDeck = false, onClick, highlightStat, size = 'md', onStatClick }) { if (!card) return null; const rarity = RARITIES[card.rarity]; const provider = PROVIDERS[card.provider]; const cls = `tt-card rarity-${card.rarity}${locked?' locked':''}${selected?' selected':''}${inDeck?' in-deck':''} size-${size}`; return (