/* Ez Runner page */
/* eslint-disable */

const { useState: useS_R, useEffect: useE_R } = React;

const EZ_RUNNER_PLAY_URL = 'https://play.google.com/store/apps/details?id=com.ezvstudio.ezrunner';
const EZ_RUNNER_APPLE_URL = 'https://apps.apple.com/br/app/ez-runner/id6790583358';

/* Tokens */
const ERPC = {
  bg: '#0a0a0b',
  bg2: '#0d0d10',
  bg3: '#111114',
  fg: '#f6f4ef',
  fg2: 'rgba(246,244,239,0.62)',
  fg3: 'rgba(246,244,239,0.4)',
  fg4: 'rgba(246,244,239,0.22)',
  border: 'rgba(255,255,255,0.07)',
  borderHi: 'rgba(255,255,255,0.14)',
  yellow: '#d4ff00',
  yellowSoft: 'rgba(212,255,0,0.12)',
  yellowDim: 'rgba(212,255,0,0.28)',
  orange: '#ff7a1f',
};

function getInitialLangR() {
  try {
    const u = new URL(window.location.href);
    const fromUrl = u.searchParams.get('lang');
    if (fromUrl && ERP[fromUrl]) return fromUrl;
    const fromLs = localStorage.getItem('ezLang');
    if (fromLs && ERP[fromLs]) return fromLs;
  } catch {}
  return 'pt';
}

/* ── Top Nav with EM CONSTRUÇÃO badge ─────────────────── */
function RNav({ lang, setLang, T }) {
  return (
    <nav style={{
      position: 'sticky', top: 0, zIndex: 50,
      background: 'rgba(10,10,11,0.72)',
      backdropFilter: 'blur(18px)',
      WebkitBackdropFilter: 'blur(18px)',
      borderBottom: `1px solid ${ERPC.border}`,
    }}>
      <div style={{
        maxWidth: 1280, margin: '0 auto', padding: '14px 32px',
        display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 16, flexWrap: 'wrap',
      }}>
        <a href={`index.html?lang=${lang}`} style={{
          display: 'inline-flex', alignItems: 'center', gap: 10,
          textDecoration: 'none', color: ERPC.fg2,
          fontFamily: 'Inter, sans-serif', fontSize: 13, fontWeight: 500,
          transition: 'color 0.2s',
        }}
          onMouseEnter={(e) => { e.currentTarget.style.color = ERPC.fg; }}
          onMouseLeave={(e) => { e.currentTarget.style.color = ERPC.fg2; }}
        >
          <span style={{ fontSize: 15, lineHeight: 1 }}>←</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}>
            <span>EZV</span>
            <span style={{ width: 4, height: 4, borderRadius: 999, background: ERPC.yellow, display: 'inline-block' }}/>
            <span>Studio</span>
          </span>
        </a>
        <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
          <span style={{
            display: 'inline-flex', alignItems: 'center', gap: 8,
            padding: '6px 11px', borderRadius: 999,
            background: 'rgba(212,255,0,0.08)',
            border: `1px solid rgba(212,255,0,0.32)`,
            fontFamily: 'JetBrains Mono, monospace', fontSize: 10,
            letterSpacing: '0.22em', textTransform: 'uppercase',
            color: ERPC.yellow,
          }}>
            <span style={{
              width: 5, height: 5, borderRadius: 999,
              background: ERPC.yellow, boxShadow: `0 0 10px ${ERPC.yellow}`,
              animation: 'er-pulse 2s ease-in-out infinite',
            }}/>
            {T.construction}
          </span>
          <a
            href={`suporte.html?lang=${lang}`}
            style={{
              display: 'inline-flex', alignItems: 'center', gap: 6,
              fontSize: 12, fontWeight: 500, color: ERPC.fg2, textDecoration: 'none',
              transition: 'color 0.2s',
            }}
            onMouseEnter={(e) => { e.currentTarget.style.color = ERPC.fg; }}
            onMouseLeave={(e) => { e.currentTarget.style.color = ERPC.fg2; }}
          >
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">
              <circle cx="12" cy="12" r="10"/>
              <path d="M9.5 9a2.5 2.5 0 114.2 1.9c-.7.6-1.7 1-1.7 2.1"/>
              <circle cx="12" cy="17" r="0.5" fill="currentColor" stroke="none"/>
            </svg>
            Suporte
          </a>
          <div style={{ width: 1, height: 14, background: ERPC.border }}/>
          <RLang lang={lang} setLang={setLang} />
        </div>
      </div>
    </nav>
  );
}

function RLang({ lang, setLang }) {
  const langs = [
    { code: 'pt', Flag: FlagBR },
    { code: 'en', Flag: FlagUS },
    { code: 'es', Flag: FlagES },
  ];
  return (
    <div style={{ display: 'flex', gap: 8 }}>
      {langs.map(({ code, Flag }) => {
        const active = code === lang;
        return (
          <button key={code} onClick={() => setLang(code)} style={{
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            width: 28, height: 28, borderRadius: 999,
            border: `1.5px solid ${active ? ERPC.yellow : ERPC.border}`,
            background: 'transparent', padding: 0, cursor: 'pointer',
            opacity: active ? 1 : 0.55,
            transition: 'opacity 0.15s, border-color 0.15s',
            boxShadow: active ? `0 0 0 2px rgba(212,255,0,0.18)` : 'none',
          }}><Flag size={18} /></button>
        );
      })}
    </div>
  );
}

/* Section helper (mirrors EDPSection but with yellow tokens) */
function RSection({ children, id, padTop = 140, padBottom = 140, style }) {
  return (
    <section id={id} style={{
      padding: `${padTop}px 0 ${padBottom}px`,
      position: 'relative',
      ...style,
    }}>
      <div style={{
        maxWidth: 1280, margin: '0 auto', padding: '0 32px',
        position: 'relative',
      }}>
        {children}
      </div>
    </section>
  );
}

function REyebrow({ children, style }) {
  return (
    <div style={{
      fontFamily: 'JetBrains Mono, monospace',
      fontSize: 11, letterSpacing: '0.24em', textTransform: 'uppercase',
      color: ERPC.yellow,
      ...style,
    }}>{children}</div>
  );
}

const rHeadlineXL = {
  fontFamily: 'Inter, sans-serif',
  fontSize: 'clamp(36px, 5.4vw, 72px)',
  fontWeight: 500, letterSpacing: '-0.035em', lineHeight: 1.0,
  margin: 0, color: ERPC.fg,
};

function RButton({ children, variant = 'primary', href = '#', icon, onClick, target, rel }) {
  const isPrimary = variant === 'primary';
  return (
    <a href={href} onClick={onClick} target={target} rel={rel} style={{
      display: 'inline-flex', alignItems: 'center', gap: 10,
      height: 46, padding: '0 22px', borderRadius: 999,
      fontFamily: 'Inter, sans-serif', fontSize: 14, fontWeight: 500, letterSpacing: '-0.005em',
      textDecoration: 'none',
      background: isPrimary ? ERPC.yellow : 'transparent',
      color: isPrimary ? ERPC.bg : ERPC.fg,
      border: isPrimary ? '1px solid transparent' : `1px solid ${ERPC.borderHi}`,
      transition: 'transform 0.2s, background 0.2s, border-color 0.2s',
      cursor: 'pointer',
    }}
      onMouseEnter={(e) => { e.currentTarget.style.transform = 'translateY(-1px)'; if (!isPrimary) e.currentTarget.style.borderColor = ERPC.yellow; }}
      onMouseLeave={(e) => { e.currentTarget.style.transform = 'translateY(0)'; if (!isPrimary) e.currentTarget.style.borderColor = ERPC.borderHi; }}
    >
      {children}
      {icon && <span aria-hidden style={{ fontSize: 13, opacity: 0.7 }}>{icon}</span>}
    </a>
  );
}

/* ── HERO with brand cover ────────────────────────────── */
function RHero({ T, lang }) {
  return (
    <RSection padTop={80} padBottom={120} style={{ overflow: 'hidden' }}>
      {/* Background glow */}
      <div aria-hidden style={{
        position: 'absolute', top: -200, left: '50%', transform: 'translateX(-50%)',
        width: 1200, height: 800,
        background: 'radial-gradient(50% 50% at 50% 50%, rgba(212,255,0,0.18) 0%, rgba(212,255,0,0) 70%)',
        filter: 'blur(40px)', pointerEvents: 'none',
      }}/>
      <Reveal style={{ position: 'relative', zIndex: 1 }}>
        <REyebrow style={{ marginBottom: 28 }}>{T.hero.eyebrow}</REyebrow>
      </Reveal>
      <div className="er-hero-grid" style={{
        display: 'grid', gridTemplateColumns: '1.05fr 1fr',
        gap: 60, alignItems: 'center', position: 'relative', zIndex: 1,
      }}>
        <div>
          <Reveal delay={80}>
            <h1 style={{
              fontFamily: 'Inter, sans-serif',
              fontSize: 'clamp(56px, 9vw, 124px)',
              fontWeight: 500, letterSpacing: '-0.045em', lineHeight: 0.92,
              margin: 0, color: ERPC.fg,
            }}>
              {T.hero.titleA}<br/>
              <span style={{ color: ERPC.yellow, fontStyle: 'italic', fontWeight: 400 }}>{T.hero.titleB}</span>
            </h1>
          </Reveal>
          <Reveal delay={180}>
            <p style={{
              fontFamily: 'Inter, sans-serif',
              fontSize: 'clamp(20px, 1.8vw, 26px)',
              lineHeight: 1.3, color: ERPC.fg,
              margin: '36px 0 18px', maxWidth: 540, fontWeight: 400, letterSpacing: '-0.01em',
            }}>{T.hero.tagline}</p>
          </Reveal>
          <Reveal delay={260}>
            <p style={{ fontSize: 15, lineHeight: 1.7, color: ERPC.fg2, margin: '0 0 36px', maxWidth: 520 }}>
              {T.hero.desc}
            </p>
          </Reveal>
          <Reveal delay={340} style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
            <RButton variant="primary" href={EZ_RUNNER_PLAY_URL} target="_blank" rel="noopener noreferrer" icon="↗">{T.hero.cta}</RButton>
            <RButton variant="primary" href={EZ_RUNNER_APPLE_URL} target="_blank" rel="noopener noreferrer" icon="↗">{T.hero.ctaApple}</RButton>
            <RButton variant="ghost" href="#screens" icon="↓">{T.hero.cta2}</RButton>
          </Reveal>
          <Reveal delay={420} style={{ marginTop: 30, display: 'flex', flexWrap: 'wrap', gap: 8 }}>
            <RPill>{T.hero.tag1}</RPill>
            <RPill>{T.hero.tag2}</RPill>
            <RPill yellow>NEW</RPill>
          </Reveal>
        </div>
        {/* Brand cover artwork */}
        <Reveal delay={420} style={{ position: 'relative', display: 'flex', justifyContent: 'center' }}>
          <div aria-hidden style={{
            position: 'absolute', inset: -30,
            background: 'radial-gradient(50% 50% at 50% 50%, rgba(212,255,0,0.22), transparent 60%)',
            filter: 'blur(40px)', pointerEvents: 'none',
          }}/>
          <div style={{
            position: 'relative', width: '100%', maxWidth: 440,
            aspectRatio: '9 / 18',
            borderRadius: 28, overflow: 'hidden',
            border: `1px solid ${ERPC.border}`,
            boxShadow: '0 50px 100px -30px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04) inset',
          }}>
            <img
              src="assets/ez-runner-cover.png"
              alt="Ez Runner cover"
              style={{ width: '100%', height: '100%', display: 'block', objectFit: 'cover' }}
            />
            <div aria-hidden style={{
              position: 'absolute', inset: 0,
              background: 'linear-gradient(180deg, transparent 60%, rgba(10,10,11,0.45) 100%)',
              pointerEvents: 'none',
            }}/>
          </div>
        </Reveal>
      </div>
    </RSection>
  );
}

function RPill({ children, yellow }) {
  return (
    <span style={{
      display: 'inline-flex', alignItems: 'center', gap: 6,
      height: 26, padding: '0 11px', borderRadius: 999,
      border: `1px solid ${yellow ? 'rgba(212,255,0,0.32)' : ERPC.border}`,
      background: yellow ? 'rgba(212,255,0,0.05)' : 'rgba(255,255,255,0.02)',
      fontFamily: 'JetBrains Mono, monospace',
      fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase',
      color: yellow ? ERPC.yellow : ERPC.fg2,
    }}>
      {yellow && <span style={{ width: 4, height: 4, borderRadius: 999, background: ERPC.yellow, boxShadow: `0 0 6px ${ERPC.yellow}` }}/>}
      {children}
    </span>
  );
}

/* ── About ────────────────────────────────────────────── */
function RAbout({ T }) {
  const a = T.about;
  return (
    <RSection id="about">
      <div className="er-about-head" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80, marginBottom: 0 }}>
        <div>
          <Reveal><REyebrow style={{ marginBottom: 20 }}>{a.label}</REyebrow></Reveal>
          <Reveal delay={80}>
            <h2 style={rHeadlineXL}>
              <span style={{ color: ERPC.fg2 }}>{a.titleA}</span><br/>{a.titleB}
            </h2>
          </Reveal>
        </div>
        <Reveal delay={120} style={{ display: 'flex', flexDirection: 'column', gap: 18, paddingTop: 8 }}>
          {a.body.map((p, i) => (
            <p key={i} style={{ fontSize: 16, color: ERPC.fg2, lineHeight: 1.7, margin: 0 }}>{p}</p>
          ))}
        </Reveal>
      </div>
    </RSection>
  );
}

/* ── Features (planned) ───────────────────────────────── */
function RFeatures({ T }) {
  const f = T.features;
  return (
    <RSection id="features" style={{ background: `linear-gradient(180deg, ${ERPC.bg} 0%, ${ERPC.bg2} 50%, ${ERPC.bg} 100%)` }}>
      <Reveal><REyebrow style={{ marginBottom: 20 }}>{f.label}</REyebrow></Reveal>
      <Reveal delay={80}>
        <h2 style={rHeadlineXL}>
          <span style={{ color: ERPC.fg2 }}>{f.titleA}</span><br/>{f.titleB}
        </h2>
      </Reveal>
      <Reveal delay={160}>
        <p style={{ fontSize: 16, color: ERPC.fg2, lineHeight: 1.7, margin: '24px 0 48px', maxWidth: 620 }}>{f.sub}</p>
      </Reveal>
      <div style={{
        display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))',
        gap: 1, background: ERPC.border,
        border: `1px solid ${ERPC.border}`, borderRadius: 20, overflow: 'hidden',
      }}>
        {f.items.map(([t, d], i) => (
          <Reveal key={i} delay={Math.min(i * 40, 240)}>
            <div style={{
              background: ERPC.bg, padding: '24px 24px',
              height: '100%', display: 'flex', flexDirection: 'column', gap: 10,
              transition: 'background 0.2s',
            }}
              onMouseEnter={(e) => { e.currentTarget.style.background = ERPC.bg3; }}
              onMouseLeave={(e) => { e.currentTarget.style.background = ERPC.bg; }}
            >
              <div style={{
                width: 8, height: 8, borderRadius: 999, background: ERPC.yellow,
                boxShadow: `0 0 10px ${ERPC.yellow}`, marginBottom: 6,
              }}/>
              <div style={{ fontSize: 15, fontWeight: 500, color: ERPC.fg, letterSpacing: '-0.005em' }}>{t}</div>
              <div style={{ fontSize: 13, color: ERPC.fg2, lineHeight: 1.55 }}>{d}</div>
            </div>
          </Reveal>
        ))}
      </div>
    </RSection>
  );
}

/* ── Screens preview ─────────────────────────────────── */
function RScreens({ T }) {
  const s = T.screens;
  const screens = [
    { name: s.items[0].name, desc: s.items[0].desc, src: 'assets/ez-runner-train.jpg' },
    { name: s.items[1].name, desc: s.items[1].desc, src: 'assets/ez-runner-profile-dark.jpg' },
    { name: s.items[2].name, desc: s.items[2].desc, src: 'assets/ez-runner-home.jpg' },
  ];
  return (
    <RSection id="screens">
      <Reveal><REyebrow style={{ marginBottom: 20 }}>{s.label}</REyebrow></Reveal>
      <Reveal delay={80}>
        <h2 style={rHeadlineXL}>
          <span style={{ color: ERPC.fg2 }}>{s.titleA}</span> {s.titleB}
        </h2>
      </Reveal>
      <Reveal delay={160}>
        <p style={{ fontSize: 16, color: ERPC.fg2, lineHeight: 1.7, margin: '24px 0 60px', maxWidth: 620 }}>{s.sub}</p>
      </Reveal>
      <div className="er-screens-grid" style={{
        display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24,
        alignItems: 'flex-start',
      }}>
        {screens.map((sc, i) => (
          <Reveal key={i} delay={Math.min(i * 100, 240)}>
            <div style={{
              display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 22,
              padding: '40px 20px',
              background: ERPC.bg2,
              border: `1px solid ${ERPC.border}`,
              borderRadius: 22,
              transition: 'border-color 0.25s, transform 0.25s',
              position: 'relative', overflow: 'hidden',
            }}
              onMouseEnter={(e) => { e.currentTarget.style.borderColor = 'rgba(212,255,0,0.28)'; e.currentTarget.style.transform = 'translateY(-3px)'; }}
              onMouseLeave={(e) => { e.currentTarget.style.borderColor = ERPC.border; e.currentTarget.style.transform = 'translateY(0)'; }}
            >
              <div aria-hidden style={{
                position: 'absolute', top: '-30%', left: '-20%', width: '140%', height: '60%',
                background: 'radial-gradient(50% 50% at 50% 50%, rgba(212,255,0,0.08), transparent 70%)',
                filter: 'blur(30px)', pointerEvents: 'none',
              }}/>
              <PhoneFrame width={220} height={460} rotate={i === 1 ? 0 : (i === 0 ? -3 : 3)} chromeless>
                <img
                  src={sc.src}
                  alt={sc.name}
                  style={{
                    position: 'absolute', inset: 0,
                    width: '100%', height: '100%',
                    objectFit: 'cover', objectPosition: 'top center',
                    display: 'block',
                  }}
                />
              </PhoneFrame>
              <div style={{ textAlign: 'center', position: 'relative', zIndex: 1 }}>
                <div style={{ fontSize: 18, fontWeight: 500, color: ERPC.fg, letterSpacing: '-0.01em' }}>{sc.name}</div>
                <div style={{ fontSize: 12, color: ERPC.fg2, marginTop: 6, lineHeight: 1.5, maxWidth: 260, marginInline: 'auto' }}>{sc.desc}</div>
              </div>
            </div>
          </Reveal>
        ))}
      </div>
    </RSection>
  );
}

/* ── Vision ───────────────────────────────────────────── */
function RVision({ T }) {
  const v = T.vision;
  return (
    <RSection id="vision">
      <div style={{ maxWidth: 900, margin: '0 auto', textAlign: 'left' }}>
        <Reveal><REyebrow style={{ marginBottom: 36 }}>{v.label}</REyebrow></Reveal>
        <Reveal delay={80}>
          <p style={{
            fontFamily: 'Inter, sans-serif',
            fontSize: 'clamp(24px, 2.6vw, 36px)',
            lineHeight: 1.35, color: ERPC.fg,
            margin: '0 0 28px', letterSpacing: '-0.02em', fontWeight: 400,
          }}>{v.bodyA}</p>
        </Reveal>
        <Reveal delay={160}>
          <p style={{
            fontFamily: 'Inter, sans-serif',
            fontSize: 'clamp(20px, 2vw, 28px)',
            lineHeight: 1.45, color: ERPC.fg2,
            margin: 0, letterSpacing: '-0.015em', fontWeight: 400,
          }}>{v.bodyB}</p>
        </Reveal>
      </div>
    </RSection>
  );
}

/* ── Final CTA ────────────────────────────────────────── */
function RFinal({ T, lang }) {
  const c = T.cta;
  return (
    <RSection padTop={140} padBottom={160} style={{
      borderTop: `1px solid ${ERPC.border}`,
      background: `radial-gradient(60% 60% at 50% 100%, rgba(212,255,0,0.16), transparent 70%), ${ERPC.bg}`,
      overflow: 'hidden',
    }}>
      <div style={{
        display: 'flex', flexDirection: 'column', alignItems: 'center',
        textAlign: 'center', position: 'relative',
      }}>
        <Reveal style={{ marginBottom: 28 }}>
          <div style={{
            width: 84, height: 84, borderRadius: 22, overflow: 'hidden',
            border: `1px solid ${ERPC.borderHi}`,
            boxShadow: `0 24px 50px -12px rgba(0,0,0,0.7), 0 0 60px -10px rgba(212,255,0,0.42)`,
          }}>
            <img src="assets/ez-runner.png" alt="Ez Runner" style={{ width: '100%', height: '100%', display: 'block' }}/>
          </div>
        </Reveal>
        <Reveal delay={120}><REyebrow style={{ marginBottom: 22 }}>{c.eyebrow}</REyebrow></Reveal>
        <Reveal delay={200}>
          <h2 style={{
            fontFamily: 'Inter, sans-serif',
            fontSize: 'clamp(48px, 7vw, 96px)',
            fontWeight: 500, letterSpacing: '-0.04em', lineHeight: 0.95,
            margin: 0, color: ERPC.fg, maxWidth: 980,
          }}>
            {c.titleA}<br/>
            <span style={{ color: ERPC.yellow, fontStyle: 'italic', fontWeight: 400 }}>{c.titleB}</span>
          </h2>
        </Reveal>
        <Reveal delay={300}>
          <p style={{ fontSize: 15, color: ERPC.fg2, marginTop: 22, maxWidth: 480 }}>{c.sub}</p>
        </Reveal>
        <Reveal delay={360} style={{ marginTop: 36, display: 'flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center' }}>
          <RButton variant="primary" href={EZ_RUNNER_PLAY_URL} target="_blank" rel="noopener noreferrer" icon="↗">{c.button}</RButton>
          <RButton variant="primary" href={EZ_RUNNER_APPLE_URL} target="_blank" rel="noopener noreferrer" icon="↗">{c.buttonApple}</RButton>
          <RButton variant="ghost" href={`index.html?lang=${lang}`}>{c.buttonBack}</RButton>
        </Reveal>
      </div>
    </RSection>
  );
}

function RFooter({ lang }) {
  return (
    <footer style={{
      borderTop: `1px solid ${ERPC.border}`,
      padding: '36px 32px',
      maxWidth: 1280, margin: '0 auto',
      display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 12, flexWrap: 'wrap',
      fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
      color: ERPC.fg3, letterSpacing: '0.06em',
    }}>
      <span>© 2026 EZV Studio · Ez Runner</span>
      <a
        href="https://www.instagram.com/ezvstudio/"
        target="_blank"
        rel="noopener noreferrer"
        style={{ color: ERPC.fg3, display: 'flex', alignItems: 'center', gap: 6, textDecoration: 'none', transition: 'color 0.2s', fontSize: 11, letterSpacing: '0.06em' }}
        onMouseEnter={(e) => { e.currentTarget.style.color = ERPC.fg2; }}
        onMouseLeave={(e) => { e.currentTarget.style.color = ERPC.fg3; }}
      >
        <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
          <rect x="2" y="2" width="20" height="20" rx="5"/>
          <circle cx="12" cy="12" r="4"/>
          <circle cx="17.5" cy="6.5" r="1.5" fill="currentColor" stroke="none"/>
        </svg>
        @ezvstudio
      </a>
      <a
        href={`suporte.html?lang=${lang}`}
        style={{ color: ERPC.fg3, textDecoration: 'none', transition: 'color 0.2s', fontSize: 11, letterSpacing: '0.06em' }}
        onMouseEnter={(e) => { e.currentTarget.style.color = ERPC.fg2; }}
        onMouseLeave={(e) => { e.currentTarget.style.color = ERPC.fg3; }}
      >
        Suporte
      </a>
    </footer>
  );
}

/* ── App entry ────────────────────────────────────────── */
function ERApp() {
  const [lang, setLang] = useS_R(getInitialLangR());
  useE_R(() => {
    try {
      localStorage.setItem('ezLang', lang);
      const u = new URL(window.location.href);
      u.searchParams.set('lang', lang);
      window.history.replaceState({}, '', u);
    } catch {}
  }, [lang]);
  const T = ERP[lang] || ERP.pt;

  return (
    <div style={{
      background: ERPC.bg, color: ERPC.fg,
      fontFamily: 'Inter, sans-serif',
      minHeight: '100vh',
    }}>
      <RNav lang={lang} setLang={setLang} T={T} />
      <main>
        <RHero T={T} lang={lang} />
        <RAbout T={T} />
        <RFeatures T={T} />
        <RScreens T={T} />
        <RVision T={T} />
        <RFinal T={T} lang={lang} />
      </main>
      <RFooter lang={lang} />
    </div>
  );
}

const erRoot = ReactDOM.createRoot(document.getElementById('root'));
erRoot.render(<ERApp />);
