// ============================================================= // HOME SCREEN — main menu / hub // ============================================================= const { useState: useStateHome, useEffect: useEffectHome } = React; function Home({ state, setState, onOpenPacks, onOpenCollection, onOpenBattles }) { const stats = GameEngine.collectionStats(state); const [countdown, setCountdown] = useStateHome(""); useEffectHome(() => { function tick() { const ms = GameEngine.msUntilRefill(state); setCountdown(ms > 0 ? GameEngine.formatCountdown(ms) : "Reinicio disponible"); } tick(); const id = setInterval(tick, 1000); return () => clearInterval(id); }, [state.lastClaimTs]); // Visual: featured Pokémon (random rare from collection or fallback) const featured = (() => { const owned = Object.keys(state.collection).map(id => DEX_BY_ID[+id]).filter(Boolean); const fancies = owned.filter(p => p.rarity === "legendary" || p.rarity === "holo"); if (fancies.length) return fancies[Math.floor(Math.random()*fancies.length)]; if (owned.length) return owned[0]; return DEX_BY_ID[6]; // Charizard fallback })(); return (
{/* Background grid */}
{/* HEADER */}
● SISTEMA EN LÍNEA · ENTRENADOR //{state.trainerName}
Cartas Pokemon · Amongus
POKÉMON · ADVANCE
{/* Stats panel */}
{/* MAIN GRID */}
{/* Daily packs hero */}
01 / SOBRES DIARIOS

Abre tus sobres del ciclo

Cada 10 horas recibes 6 sobres con 5 cartas: 3 comunes, 1 inusual y 1 con chance de holo o legendaria. Colecciónalas todas.

{/* Pack pips */}
{Array.from({length: GameEngine.PACKS_PER_DAY}).map((_,i) => { const filled = i < state.packsAvailable; return (
{filled ? "OPEN" : "USED"}
); })}
PRÓXIMA RECARGA
{countdown}
{/* Pack 3D preview */}
{/* Featured card */}
02 / DESTACADA HOY
{Object.keys(state.collection).length === 0 ? "Aún sin colección — abre tu primer sobre" : `Tu favorita: ${featured.name}`}
"{featured.flavor}"
{/* ACTION TILES */}
} /> } />
{/* FOOTER */}
CARTAS POKEMON · v1.0.0 · BUILD 2026.05 {POKEDEX.length} POKÉMON · GEN I + GEN II · {TRAINERS.length} ENTRENADORES FANGAME © {new Date().getFullYear()}
); } // ---------- Reusable bits ---------------- function StatTile({ label, value, sub, accent, mono }) { const accentColor = { cyan: "var(--accent-cyan)", lime:"var(--accent-lime)", orange:"var(--accent-orange)"}[accent]; return (
{label}
{value}
{sub}
); } function ActionTile({ number, color, title, subtitle, description, onClick, preview }) { const [hover, setHover] = useStateHome(false); const c = { cyan:"var(--accent-cyan)", orange:"var(--accent-orange)", lime:"var(--accent-lime)" }[color]; const g = { cyan:"var(--accent-cyan-glow)", orange:"var(--accent-orange-glow)", lime:"var(--accent-lime-glow)" }[color]; return (
setHover(true)} onMouseLeave={()=>setHover(false)} style={{ position:"relative", background: "linear-gradient(135deg, #161B22 0%, #0D1117 100%)", border: `1px solid ${hover ? c : "var(--border-hairline)"}`, borderRadius: 4, padding: 24, cursor:"pointer", transition: "all 220ms cubic-bezier(0.16,1,0.3,1)", transform: hover ? "translateY(-2px)" : "none", boxShadow: hover ? `0 0 24px ${g}, var(--elev-offset-1)` : "var(--elev-offset-1)", overflow:"hidden", minHeight: 180, }}>
{number} / {title}

{subtitle}

{description}

ENTRAR → {hover ? "▸▸▸" : "▸"}
{preview}
); } function CollectionMini({ collection }) { const owned = Object.keys(collection).slice(0, 9).map(id => DEX_BY_ID[+id]).filter(Boolean); while (owned.length < 9) owned.push(null); return (
{owned.map((p,i) => (
{p ? {p.name} : ?}
))}
); } function BadgeRow({ badges }) { return (
{TRAINERS.slice(0,8).map((t,i) => { const earned = badges.includes(t.id); return (
{t.avatar}
); })}
); } function PackVisual() { return (
Sobre Pokémon {/* Holo shine overlay */}
); } function btnPrimary(disabled) { return { fontFamily:"var(--font-sans)", fontWeight:800, fontSize:14, letterSpacing:"0.12em", color: disabled ? "var(--fg-4)" : "#0a0d12", background: disabled ? "var(--bg-surface)" : "linear-gradient(180deg, #00F0FF 0%, #00BCC9 100%)", border: `1px solid ${disabled ? "var(--border-solid)" : "#00F0FF"}`, borderRadius: 2, padding: "14px 28px", cursor: disabled ? "not-allowed" : "pointer", boxShadow: disabled ? "none" : "0 0 16px var(--accent-cyan-glow), inset 0 0 0 1px rgba(255,255,255,0.3)", transition: "all 180ms", textTransform: "uppercase", }; } window.Home = Home; window.btnPrimary = btnPrimary;