// TagWave landing — main sections

const { useState: useStateS, useEffect: useEffectS, useRef: useRefS } = React;

/* ──────────────────────── NAV ──────────────────────── */
function NavLangSwitcher() {
  const { lang, setLang } = useLang();
  const langs = [
    { code: "pt", label: "PT" },
    { code: "es", label: "ES" },
    { code: "en", label: "EN" },
  ];
  return (
    <span style={{ display: "flex", gap: 6, alignItems: "center" }}>
      {langs.map((l, i) => (
        <React.Fragment key={l.code}>
          {i > 0 && <span style={{ opacity: 0.2, color: "var(--bone-mid)", fontSize: 11 }}>·</span>}
          <button
            onClick={() => setLang(l.code)}
            style={{
              background: "none", border: "none", cursor: "pointer", padding: 0,
              fontFamily: "'JetBrains Mono', monospace", fontSize: 11,
              color: lang === l.code ? "var(--accent)" : "var(--bone-mid)",
              fontWeight: lang === l.code ? 600 : 400,
              letterSpacing: "0.08em",
              transition: "color .2s",
            }}
          >
            {l.label}
          </button>
        </React.Fragment>
      ))}
    </span>
  );
}

function TopNav() {
  const [scrolled, setScrolled] = useStateS(false);
  const [menuOpen, setMenuOpen] = useStateS(false);
  const { tr } = useLang();

  useEffectS(() => {
    const onS = () => setScrolled(window.scrollY > 16);
    onS();
    window.addEventListener("scroll", onS, { passive: true });
    return () => window.removeEventListener("scroll", onS);
  }, []);

  useEffectS(() => {
    document.body.style.overflow = menuOpen ? "hidden" : "";
    return () => { document.body.style.overflow = ""; };
  }, [menuOpen]);

  const closeMenu = () => setMenuOpen(false);

  const navItems = [
    { href: "#features", label: tr.nav.features, icon: "FEAT" },
    { href: "#workflow", label: tr.nav.workflow, icon: "FLOW" },
    { href: "#integrations", label: tr.nav.integrations, icon: "INT" },
    { href: "#pricing", label: tr.nav.pricing, icon: "PRICE" },
    { href: "#testimonials", label: tr.nav.testimonials, icon: "DEP" },
    { href: "#faq", label: tr.nav.faq, icon: "FAQ" },
  ];

  return (
    <>
      <nav className={`top ${scrolled ? "scrolled" : ""}`}>
        <div className="nav-inner">
          <Logo />
          <div className="nav-links">
            {navItems.map(({ href, label, icon }) => (
              <a key={href} href={href} data-label={label}>
                <span className="nav-icon">{icon}</span>
                <span className="nav-label">{label}</span>
              </a>
            ))}
          </div>
          <div className="nav-desktop-right" style={{ display: "flex", gap: 16, alignItems: "center" }}>
            <a href="/login.html" style={{ color: "var(--bone-dim)", textDecoration: "none", fontSize: 13.5 }}>{tr.nav.signin}</a>
            <a href="/signup.html" style={{
              color: "var(--bone)", textDecoration: "none", fontSize: 13.5,
              padding: "6px 14px", borderRadius: 8,
              border: "1px solid rgba(244,237,228,0.15)",
              transition: "border-color .2s, color .2s",
            }}
              onMouseEnter={e => { e.currentTarget.style.borderColor = "rgba(244,237,228,0.35)"; e.currentTarget.style.color = "#fff"; }}
              onMouseLeave={e => { e.currentTarget.style.borderColor = "rgba(244,237,228,0.15)"; e.currentTarget.style.color = "var(--bone)"; }}
            >{tr.nav.signup}</a>
            <CTAButton as="a" href="#pricing">{tr.nav.download}</CTAButton>
            <NavLangSwitcher />
          </div>
        {/* Hamburger button — visible only on mobile via CSS */}
        <button
          className="nav-hamburger"
          onClick={() => setMenuOpen(o => !o)}
          style={{
            display: "none",
            background: "none", border: "none", cursor: "pointer",
            padding: 8, gap: 5,
            flexDirection: "column", alignItems: "center", justifyContent: "center",
          }}
          aria-label="Menu"
        >
          <span style={{
            display: "block", width: 22, height: 1.5,
            background: menuOpen ? "transparent" : "var(--bone)",
            transition: "background .2s",
          }} />
          <span style={{
            display: "block", width: 22, height: 1.5,
            background: "var(--bone)",
            transform: menuOpen ? "rotate(45deg) translateY(-0px)" : "none",
            marginTop: menuOpen ? -3 : 0,
            transition: "transform .2s",
          }} />
          <span style={{
            display: "block", width: 22, height: 1.5,
            background: "var(--bone)",
            transform: menuOpen ? "rotate(-45deg) translateY(-3px)" : "none",
            transition: "transform .2s",
          }} />
        </button>
        </div>{/* /nav-inner */}
      </nav>

      {/* Mobile drawer */}
      <div className={`mobile-drawer ${menuOpen ? "open" : ""}`} onClick={closeMenu}>
        {navItems.map(({ href, label }) => (
          <a key={href} href={href} onClick={closeMenu}>{label}</a>
        ))}
        <div className="mobile-drawer-cta">
          <CTAButton as="a" href="#pricing" onClick={closeMenu}>{tr.nav.download}</CTAButton>
        </div>
        <div className="mobile-drawer-lang">
          <NavLangSwitcher />
        </div>
      </div>
    </>
  );
}

/* ──────── ANIMATED HERO FLOAT CARDS ──────── */

// ── Widget 1: MiniPlayer — recorte fiel do player horizontal do app
function HeroNowPlayingCard() {
  const { tr } = useLang();
  const tracks = [
    { title: "Midnight Geometry", artist: "Helios Drift", bpm: "128", key: "8A",
      wave: [.3,.5,.8,.6,.9,.7,.4,.6,.8,1,.7,.5,.4,.7,.9,.6,.3,.5,.8,.6,.9,.7,.4,.6,.8,1,.5,.4,.7,.6,.8,.9,.5,.3,.6,.7,.8,.5,.4,.6] },
    { title: "Crimson Hours",     artist: "Nuit Bleue",   bpm: "126", key: "9A",
      wave: [.4,.6,.5,.8,.7,.9,.5,.3,.6,.8,1,.7,.4,.5,.8,.6,.4,.7,.9,.5,.3,.6,.8,.7,.9,.5,.4,.6,.8,1,.7,.5,.4,.6,.9,.7,.3,.5,.8,.6] },
    { title: "Floor of Glass",    artist: "Astra",        bpm: "124", key: "5A",
      wave: [.5,.7,.9,.6,.4,.8,.6,.5,.7,.9,.5,.3,.6,.8,1,.7,.4,.5,.9,.6,.3,.7,.8,.5,.4,.6,.9,.7,.5,.8,.6,.4,.7,.9,.5,.3,.6,.8,.7,.5] },
  ];
  const [idx, setIdx] = useStateS(0);
  const [vis, setVis] = useStateS(true);
  const [pct, setPct] = useStateS(32);

  useEffectS(() => {
    const prog = setInterval(() => setPct(p => p >= 85 ? 15 : p + 0.4), 120);
    const swap = setInterval(() => {
      setVis(false); setPct(15);
      setTimeout(() => { setIdx(i => (i + 1) % tracks.length); setVis(true); }, 350);
    }, 5000);
    return () => { clearInterval(prog); clearInterval(swap); };
  }, []);

  const t = tracks[idx];
  const W = 160, H = 32, bw = W / t.wave.length;

  return (
    <FloatCard style={{ left: "-72px", top: "22%", width: 260, padding: 0, overflow: "hidden", background: "#0E0D0C" }}>
      {/* Linha de progresso — igual ao topo do MiniPlayer real */}
      <div style={{ height: 2, background: "#23201E" }}>
        <div style={{ height: "100%", background: "#D95340", width: `${pct}%`, transition: "width 0.12s linear" }} />
      </div>
      <div style={{ display: "flex", alignItems: "center", height: 56, padding: "0 14px", gap: 0 }}>
        {/* Zona 1: indicador + capa + info */}
        <div style={{ display: "flex", alignItems: "center", gap: 8, width: 120, flexShrink: 0, paddingRight: 10 }}>
          <span style={{ width: 5, height: 5, borderRadius: "50%", background: "#D95340", flexShrink: 0 }} />
          <div style={{ width: 26, height: 26, borderRadius: 4, background: "#23201E", border: "1px solid rgba(255,255,255,0.05)", flexShrink: 0, display: "flex", alignItems: "center", justifyContent: "center" }}>
            <svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="#373331" strokeWidth="1.1" strokeLinecap="round">
              <circle cx="5" cy="4.5" r="2"/><path d="M1 9.5c0-2.21 1.79-4 4-4s4 1.79 4 4"/>
            </svg>
          </div>
          <div style={{ minWidth: 0, flex: 1, opacity: vis ? 1 : 0, transform: vis ? "translateY(0)" : "translateY(3px)", transition: "opacity 0.3s, transform 0.3s" }}>
            <div style={{ fontSize: 11, fontWeight: 600, color: "#DCDAD8", letterSpacing: "-0.01em", lineHeight: 1.2, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{t.title}</div>
            <div style={{ fontSize: 9, color: "#8F8883", marginTop: 2, textTransform: "uppercase", letterSpacing: "0.06em" }}>{t.artist}</div>
          </div>
        </div>
        {/* Separador */}
        <div style={{ width: 1, height: 24, background: "#23201E", flexShrink: 0 }} />
        {/* Zona 2: botão play */}
        <div style={{ padding: "0 12px", flexShrink: 0 }}>
          <div style={{ width: 28, height: 28, borderRadius: "50%", background: "#D95340", boxShadow: "0 0 12px rgba(217,83,64,0.35)", display: "flex", alignItems: "center", justifyContent: "center" }}>
            <svg width="7" height="8" viewBox="0 0 8 9" fill="white">
              <rect x="0.5" y="0.5" width="2.5" height="8" rx="0.5"/>
              <rect x="5" y="0.5" width="2.5" height="8" rx="0.5"/>
            </svg>
          </div>
        </div>
        {/* Separador */}
        <div style={{ width: 1, height: 24, background: "#23201E", flexShrink: 0 }} />
        {/* Zona 3: waveform */}
        <div style={{ flex: 1, padding: "0 10px", position: "relative", height: H }}>
          <svg width="100%" height={H} viewBox={`0 0 ${W} ${H}`} preserveAspectRatio="none">
            {t.wave.map((amp, i) => {
              const barH = Math.max(2, amp * (H - 4));
              const y = (H - barH) / 2;
              const barPct = i / t.wave.length * 100;
              const played = barPct < pct;
              return (
                <rect key={i} x={i * bw + bw * 0.15} y={y} width={bw * 0.7} height={barH} rx={0.5}
                  fill="#D95340" opacity={played ? 0.55 + amp * 0.45 : 0.05 + amp * 0.12} />
              );
            })}
          </svg>
        </div>
        {/* Separador */}
        <div style={{ width: 1, height: 24, background: "#23201E", flexShrink: 0 }} />
        {/* Zona 4: BPM + Tom */}
        <div style={{ paddingLeft: 10, flexShrink: 0, opacity: vis ? 1 : 0, transition: "opacity 0.3s" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 3 }}>
            <span style={{ fontSize: 10, fontFamily: "'JetBrains Mono', monospace", color: "#C97B40", fontWeight: 600 }}>{t.bpm}</span>
            <span style={{ fontSize: 8, color: "#605A55", textTransform: "uppercase", letterSpacing: "0.1em" }}>{tr.software.widget_bpm_label}</span>
          </div>
          <span style={{ fontSize: 9, fontFamily: "'JetBrains Mono', monospace", fontWeight: 700, color: "#8F8883" }}>{t.key}</span>
        </div>
      </div>
    </FloatCard>
  );
}

// ── Widget 2: Inspector fields — recorte fiel do painel direito
function HeroMetadataCard() {
  const { tr } = useLang();
  const [phase, setPhase] = useStateS(0); // 0=messy · 1=fixing · 2=saved

  useEffectS(() => {
    const durations = [2600, 900, 3400];
    let timer;
    const tick = (p) => { timer = setTimeout(() => { const n = (p + 1) % 3; setPhase(n); tick(n); }, durations[p]); };
    tick(0);
    return () => clearTimeout(timer);
  }, []);

  const fields = [
    { label: tr.software.widget_title,  before: "03_FINAL2_helios-drift_v3", after: "Midnight Geometry" },
    { label: tr.software.widget_artist, before: "Unknown Artist",            after: "Helios Drift"       },
    { label: tr.software.widget_album,  before: "—",                        after: "Submerged EP"        },
  ];

  return (
    <FloatCard animClass="alt" style={{ right: "-46px", top: "10%", width: 210, padding: "14px 14px 12px", background: "#0E0D0C" }}>
      {fields.map((f, i) => (
        <div key={i} style={{ marginBottom: i < fields.length - 1 ? 10 : 0 }}>
          {/* Label — igual ao Inspector real: text-[10px] font-semibold text-[#8F8883] uppercase tracking-widest */}
          <div style={{ fontSize: 10, fontWeight: 600, color: "#8F8883", textTransform: "uppercase", letterSpacing: "0.18em", fontFamily: "'Geist', sans-serif", marginBottom: 4 }}>{f.label}</div>
          {/* Input — bg-white/5 border-white/10, focus state com border-[#D95340] */}
          <div style={{
            padding: "6px 10px", borderRadius: 6,
            background: "rgba(255,255,255,0.05)",
            border: `1px solid ${phase === 2 && i === 0 ? "#D95340" : "rgba(255,255,255,0.1)"}`,
            fontSize: 12, color: phase === 0 ? "#4C4743" : "#C2BEBC",
            fontFamily: "'Geist', sans-serif",
            overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap",
            transition: "border-color 0.4s, color 0.4s",
          }}>
            {phase === 0 ? f.before : f.after}
          </div>
        </div>
      ))}
      <div style={{ marginTop: 10, display: "flex", alignItems: "center", gap: 6, opacity: phase === 2 ? 1 : 0, transition: "opacity 0.5s" }}>
        <span style={{ width: 5, height: 5, borderRadius: "50%", background: "#D95340" }} />
        <span style={{ fontSize: 10, color: "#D95340", fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.06em" }}>{tr.software.widget_saved}</span>
      </div>
    </FloatCard>
  );
}

// ── Widget 3: LibraryStats — recorte fiel do painel de biblioteca
function HeroScanCard() {
  const { tr } = useLang();
  const TARGET = 4128;
  const [count, setCount] = useStateS(3501);
  const [done, setDone] = useStateS(false);

  useEffectS(() => {
    if (done) { const t = setTimeout(() => { setCount(3501); setDone(false); }, 3000); return () => clearTimeout(t); }
    const id = setInterval(() => {
      setCount(c => { const n = c + Math.floor(Math.random() * 7) + 3; if (n >= TARGET) { setDone(true); return TARGET; } return n; });
    }, 60);
    return () => clearInterval(id);
  }, [done]);

  const barData = () => [
    { label: tr.software.widget_bpm,     pct: 100 },
    { label: tr.software.widget_key,     pct: 87  },
    { label: tr.software.widget_genre,   pct: 94  },
    { label: tr.software.widget_artwork, pct: 72  },
    { label: tr.software.widget_rating,  pct: 38  },
  ];

  return (
    <FloatCard animClass="alt" style={{ left: "-40px", bottom: "-20px", width: 204, padding: "14px", background: "#0E0D0C" }}>
      {/* Header — texto exato do LibraryStats real */}
      <div style={{ paddingBottom: 10, borderBottom: "1px solid rgba(255,255,255,0.05)", marginBottom: 10 }}>
        <div style={{ fontSize: 9, fontWeight: 700, color: "#8F8883", textTransform: "uppercase", letterSpacing: "0.25em", fontFamily: "'Geist', sans-serif", marginBottom: 3 }}>{tr.software.widget_library}</div>
        <div style={{ fontSize: 13, fontWeight: 600, color: "#F5F5F4", letterSpacing: "-0.02em" }}>{count.toLocaleString("pt-BR")} {tr.software.widget_tracks}</div>
        <div style={{ fontSize: 11, color: "#8F8883", marginTop: 2, fontFamily: "'Geist', sans-serif" }}>
          {(count * 0.0082).toFixed(1)} GB · {Math.floor(count * 0.0072)}h
        </div>
      </div>
      {/* Cobertura */}
      <div style={{ fontSize: 9, fontWeight: 700, color: "#8F8883", textTransform: "uppercase", letterSpacing: "0.25em", fontFamily: "'Geist', sans-serif", marginBottom: 8 }}>{tr.software.widget_coverage}</div>
      {barData().map((b) => {
        const curPct = Math.round(Math.min(count, TARGET) / TARGET * b.pct);
        const n = Math.round(curPct / 100 * TARGET);
        return (
          <div key={b.label} style={{ marginBottom: 8 }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }}>
              <span style={{ fontSize: 11, color: "#8F8883", fontFamily: "'Geist', sans-serif" }}>{b.label}</span>
              <span style={{ fontSize: 11, fontFamily: "'JetBrains Mono', monospace", color: "#8F8883" }}>
                {n.toLocaleString("pt-BR")}/{TARGET.toLocaleString("pt-BR")} <span style={{ color: "rgba(217,83,64,0.7)" }}>{curPct}%</span>
              </span>
            </div>
            {/* Bar — h-1 bg-white/[0.06] fill bg-[#D95340]/60 — igual ao app */}
            <div style={{ height: 4, borderRadius: 999, background: "rgba(255,255,255,0.06)", overflow: "hidden" }}>
              <div style={{ height: "100%", borderRadius: 999, width: `${curPct}%`, background: "rgba(217,83,64,0.6)", transition: "width 0.06s linear" }} />
            </div>
          </div>
        );
      })}
    </FloatCard>
  );
}
/* ──────────────────────── HERO ──────────────────────── */
function Hero() {
  const { tr } = useLang();
  const stageRef = useRefS(null);
  useEffectS(() => {
    const el = stageRef.current;
    if (!el) return;
    const onMove = (e) => {
      const r = el.getBoundingClientRect();
      const x = (e.clientX - r.left) / r.width - 0.5;
      const y = (e.clientY - r.top) / r.height - 0.5;
      el.style.setProperty("--px", x.toFixed(3));
      el.style.setProperty("--py", y.toFixed(3));
    };
    el.addEventListener("mousemove", onMove);
    return () => el.removeEventListener("mousemove", onMove);
  }, []);

  return (
    <section id="top" data-screen-label="01 Hero" style={{ position: "relative", paddingTop: 120, paddingBottom: 100, overflow: "hidden" }}>
      <div className="glow" style={{ width: 700, height: 700, background: "var(--accent)", top: -200, right: -150, opacity: 0.18 }}></div>
      <div className="glow" style={{ width: 500, height: 500, background: "var(--copper)", bottom: -100, left: -120, opacity: 0.18 }}></div>

      <div className="container">
        <div className="hero-meta-bar" style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 80 }}>
          <div className="eyebrow">{tr.hero.version}</div>
          <div className="eyebrow" style={{ display: "flex", gap: 28 }}>
            <span>{tr.hero.macos}</span>
            <span>{tr.hero.windows}</span>
            <span style={{ color: "var(--accent)" }}>{tr.hero.online}</span>
          </div>
        </div>

        <div className="hero-grid" style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.15fr) minmax(0, 0.95fr)", gap: 64, alignItems: "center" }}>
          <div>
            <Reveal>
              <div className="eyebrow" style={{ marginBottom: 28 }}>
                <span style={{ color: "var(--accent)" }}>◆</span> &nbsp; {tr.hero.eyebrow}
              </div>
            </Reveal>
            <Reveal delay={80}>
              <h1 className="editorial-h1" style={{ margin: 0 }}>
                {tr.hero.h1_l1}<br/>
                {tr.hero.h1_l2pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{tr.hero.h1_italic}</span><br/>
                {tr.hero.h1_l3}
              </h1>
            </Reveal>
            <Reveal delay={180}>
              <p style={{ fontSize: 17, lineHeight: 1.55, color: "var(--bone-dim)", maxWidth: "46ch", marginTop: 36 }}>
                {tr.hero.body}
              </p>
            </Reveal>
            <Reveal delay={260}>
              <div style={{ display: "flex", gap: 14, marginTop: 40, flexWrap: "wrap" }}>
                <CTAButton as="a" href="#pricing">{tr.hero.cta_trial}</CTAButton>
                <CTAButton as="a" href="#workflow" variant="ghost">{tr.hero.cta_see}</CTAButton>
              </div>
            </Reveal>
            <Reveal delay={340}>
              <div style={{ display: "flex", gap: 36, marginTop: 56, flexWrap: "wrap" }}>
                <Stat label={tr.hero.stat1} value="412M" />
                <Stat label={tr.hero.stat2} value="3.4s/file" />
                <Stat label={tr.hero.stat3} value="48k DJs" />
              </div>
            </Reveal>
          </div>

          <div className="hero-image-col" ref={stageRef} style={{ position: "relative", transform: "translate(calc(var(--px,0) * -8px), calc(var(--py,0) * -8px))", transition: "transform .3s ease-out" }}>
            <Reveal delay={120}>
              <div className="hero-stage" style={{ boxShadow: "0 80px 140px -40px rgba(0,0,0,0.8), 0 0 100px -30px var(--accent)" }}>
                <img className="hero-img" src="assets/hero-model.png" alt="" />
                <div className="hero-vignette"></div>
                <div style={{
                  position: "absolute", left: 0, right: 0, top: "62%", height: 2,
                  background: "linear-gradient(90deg, transparent, var(--accent-bright), transparent)",
                  boxShadow: "0 0 18px var(--accent)",
                  animation: "scanWave 5.4s ease-in-out infinite",
                  mixBlendMode: "screen", opacity: 0.85
                }}></div>
                <Brackets />
                <div style={{ position: "absolute", top: 18, left: 18, display: "flex", gap: 10 }}>
                  <Chip>● live · 128.04 BPM</Chip>
                </div>
                <div style={{ position: "absolute", bottom: 18, left: 18, right: 18, display: "flex", justifyContent: "space-between", alignItems: "end", fontFamily: "'JetBrains Mono', monospace", fontSize: 10, letterSpacing: "0.16em", textTransform: "uppercase", color: "var(--bone-dim)" }}>
                  <span>SUBJECT&nbsp;/ LISTENER.04</span>
                  <span>F2.8 — 1/250 — ISO 400</span>
                </div>
              </div>
            </Reveal>

            <HeroNowPlayingCard />
            <HeroMetadataCard />

            <FloatCard animClass="slow" style={{ right: "-30px", bottom: "8%", width: 220, padding: 14 }}>
              <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 10 }}>
                <span className="mono" style={{ fontSize: 10, letterSpacing: "0.16em", textTransform: "uppercase", color: "var(--bone-mid)" }}>set · 25 may</span>
                <span className="mono" style={{ fontSize: 10, color: "var(--accent-bright)" }}>READY</span>
              </div>
              <KV k="TRACKS" v="38" />
              <KV k="RUNTIME" v="2h 14m" />
              <KV k="KEY RANGE" v="6A → 11A" accent />
              <KV k="EXPORT" v="Rekordbox" />
            </FloatCard>

            <HeroScanCard />
          </div>
        </div>

        {/* Scroll indicator */}
        <div className="scroll-hint" onClick={() => document.getElementById('features')?.scrollIntoView({ behavior: 'smooth' })}>
          <div className="scroll-hint-mouse">
            <div className="scroll-hint-wheel"></div>
          </div>
          <span className="scroll-hint-label">scroll</span>
        </div>
      </div>

    </section>
  );
}

function Brackets() {
  const b = { position: "absolute", width: 18, height: 18, borderColor: "var(--bone)", opacity: 0.7, mixBlendMode: "screen" };
  return (
    <>
      <span style={{ ...b, top: 12, left: 12, borderTop: "1px solid", borderLeft: "1px solid" }}></span>
      <span style={{ ...b, top: 12, right: 12, borderTop: "1px solid", borderRight: "1px solid" }}></span>
      <span style={{ ...b, bottom: 12, left: 12, borderBottom: "1px solid", borderLeft: "1px solid" }}></span>
      <span style={{ ...b, bottom: 12, right: 12, borderBottom: "1px solid", borderRight: "1px solid" }}></span>
    </>
  );
}

function Stat({ label, value }) {
  return (
    <div>
      <div className="mono" style={{ fontSize: 10, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--bone-mid)", marginBottom: 6 }}>{label}</div>
      <div style={{ fontSize: 26, fontWeight: 500, letterSpacing: "-0.025em" }}>{value}</div>
    </div>
  );
}

/* ──────────────────────── LOGO STRIP ──────────────────────── */
function LogoStrip() {
  const { tr } = useLang();
  const names = ["Rekordbox", "Serato", "Spotify", "Last.fm", "Beatport", "Apple Music", "Traktor"];
  return (
    <section style={{ padding: "60px 0 40px", borderTop: "1px solid rgba(244,237,228,0.05)", borderBottom: "1px solid rgba(244,237,228,0.05)" }}>
      <div className="container">
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 20 }}>
          <div className="eyebrow">{tr.logostrip.label}</div>
          <div style={{ display: "flex", gap: 48, flexWrap: "wrap", alignItems: "center", color: "var(--bone-dim)" }}>
            {names.map((n) => (
              <span key={n} style={{ fontSize: 17, letterSpacing: "-0.02em", fontWeight: 400, opacity: 0.7 }}>{n}</span>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── PROBLEM ──────────────────────── */
function Problem() {
  const { tr } = useLang();
  const messy = [
    "03_FINAL2_helios-drift_v3.mp3", "track1.mp3",
    "Helios_Drift- Midnight Geometry (official audio) [128bpm].mp3",
    "Unknown Artist — 08.aiff",
    "[FREE DL] HELIOS DRIFT - MIDNIGHT GEOMETRY (CLUB MIX).wav",
    "Helios Drift -midnight geometry- (Master 2.1).flac",
    "midnight_geom_FX_loop.wav",
    "Helios Drift - Midnight Geometry (Original Mix).mp3",
  ];

  // Real app track data — same visual language as the TagWave interface
  const cleanTracks = [
    { title: "Midnight Geometry", artist: "Helios Drift", genre: "DEEP·MELODIC", gc: "#2A1E40", key: "8A", kc: "#4A3A8C", bpm: "128.04", len: "6:42", cover: "linear-gradient(135deg,#2a1e40,#0e0d0c)" },
    { title: "Floor of Glass",    artist: "Astra",        genre: "PROGRESSIVE",  gc: "#2E1A0E", key: "5A", kc: "#8C5A20", bpm: "124.00", len: "7:18", cover: "linear-gradient(135deg,#2e1a0e,#0e0d0c)" },
    { title: "Crimson Hours",     artist: "Nuit Bleue",   genre: "HOUSE",        gc: "#1A2E1E", key: "9A", kc: "#2E7D4F", bpm: "126.50", len: "5:54", cover: "linear-gradient(135deg,#1a2e1e,#0e0d0c)" },
    { title: "Long Way Down",     artist: "Vermil",       genre: "INDIE DANCE",  gc: "#1E1A2E", key: "11A",kc: "#5B4A8C", bpm: "122.00", len: "4:48", cover: "linear-gradient(135deg,#1e1a2e,#0e0d0c)" },
    { title: "Saudade",           artist: "Okra Sessions",genre: "DOWNTEMPO",    gc: "#2E2A1A", key: "4A", kc: "#7D6A2E", bpm: "118.00", len: "8:02", cover: "linear-gradient(135deg,#2e2a1a,#0e0d0c)" },
    { title: "Phaseout",          artist: "Maxine Field", genre: "TECH HOUSE",   gc: "#1A2A2E", key: "10A",kc: "#2E6A7D", bpm: "130.20", len: "6:08", cover: "linear-gradient(135deg,#1a2a2e,#0e0d0c)" },
    { title: "Reach North",       artist: "Halocene",     genre: "MELODIC TECHNO",gc:"#2A1A1E", key: "7A", kc: "#8C3A5A", bpm: "127.50", len: "7:30", cover: "linear-gradient(135deg,#2a1a1e,#0e0d0c)" },
    { title: "Submerged (Edit)",  artist: "Helios Drift", genre: "DEEP·MELODIC", gc: "#2A1E40", key: "8A", kc: "#4A3A8C", bpm: "128.00", len: "6:12", cover: "linear-gradient(135deg,#2a1e40,#0e0d0c)" },
  ];

  return (
    <section data-screen-label="02 Problem" style={{ padding: "140px 0 100px" }}>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 40 }}>
            <span className="num">02</span> · {tr.problem.section}
          </div>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1.2fr)", gap: 80, alignItems: "start" }}>
          <Reveal>
            <h2 className="editorial-h2">
              {tr.problem.h2_pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{tr.problem.h2_italic1}</span>.<br/>
              {tr.problem.h2_mid}<span className="serif" style={{ fontWeight: 400 }}>{tr.problem.h2_italic2}</span>{tr.problem.h2_end}
            </h2>
            <p style={{ fontSize: 16, color: "var(--bone-dim)", maxWidth: "44ch", marginTop: 28, lineHeight: 1.55 }}>
              {tr.problem.body} <span className="mono" style={{ background: "rgba(244,237,228,0.06)", padding: "1px 6px", borderRadius: 4 }}>Electronic / Deep / House / Other</span>.
            </p>
          </Reveal>

          <Reveal delay={120}>
            <div className="compare">
              {/* ANTES — raw filenames */}
              <div className="messy">
                <h4><span style={{ width: 6, height: 6, borderRadius: "50%", background: "var(--magenta)" }}></span> {tr.problem.before}</h4>
                {messy.map((f, i) => (
                  <div className="filename" key={i}>
                    <span className="ix">{String(i + 1).padStart(2, "0")}</span>
                    <span>{f}</span>
                  </div>
                ))}
              </div>

              {/* DEPOIS — recorte real da interface TagWave */}
              <div className="clean" style={{ padding: 0, overflow: "hidden", borderRadius: 10 }}>
                {/* Mini toolbar — igual ao app */}
                <div style={{
                  background: "#23201E", padding: "7px 12px",
                  display: "flex", alignItems: "center", justifyContent: "space-between",
                  borderBottom: "1px solid rgba(244,237,228,0.05)",
                }}>
                  <div style={{ display: "flex", alignItems: "center", gap: 6 }}>
                    <svg width="14" height="14" viewBox="0 0 100 100">
                      <circle cx="50" cy="50" r="46" fill="#D95340"/>
                      <circle cx="50" cy="50" r="27" fill="#23201E"/>
                    </svg>
                    <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8.5, letterSpacing: "0.18em", textTransform: "uppercase", color: "#605A55" }}>tagwave</span>
                  </div>
                  <div style={{ display: "flex", gap: 4, alignItems: "center" }}>
                    <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, color: "#4C4743" }}>76 faixas</span>
                    <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, padding: "1px 5px", borderRadius: 3, background: "rgba(217,83,64,0.18)", color: "#D95340", border: "1px solid rgba(217,83,64,0.25)" }}>TODAS</span>
                    <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, padding: "1px 5px", borderRadius: 3, background: "transparent", color: "#605A55", border: "1px solid rgba(244,237,228,0.07)" }}>✓ 72</span>
                  </div>
                </div>
                {/* Column headers */}
                <div style={{
                  display: "grid", gridTemplateColumns: "22px 1fr 56px 36px 40px",
                  padding: "4px 12px", background: "#0E0D0C",
                  borderBottom: "1px solid rgba(244,237,228,0.05)",
                }}>
                  {["","TÍTULO","BPM","TOM","DUR"].map((h, i) => (
                    <div key={i} style={{ fontSize: 7.5, color: "#4C4743", fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.1em", padding: "3px 0" }}>{h}</div>
                  ))}
                </div>
                {/* Track rows */}
                {cleanTracks.map((t, i) => (
                  <div key={i} style={{
                    display: "grid", gridTemplateColumns: "22px 1fr 56px 36px 40px",
                    padding: "0 12px", alignItems: "center",
                    height: 33, background: i % 2 === 0 ? "rgba(244,237,228,0.015)" : "transparent",
                    borderBottom: "1px solid rgba(244,237,228,0.03)",
                  }}>
                    {/* Cover thumbnail */}
                    <div style={{ width: 16, height: 16, borderRadius: 3, background: t.cover, border: "1px solid rgba(244,237,228,0.06)", flexShrink: 0 }} />
                    {/* Title + artist + genre tag */}
                    <div style={{ overflow: "hidden", paddingRight: 6 }}>
                      <div style={{ display: "flex", alignItems: "center", gap: 5 }}>
                        <span style={{ fontSize: 9.5, fontWeight: 600, color: "#F5F5F4", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", letterSpacing: "-0.01em" }}>{t.title}</span>
                        <span style={{ fontSize: 7, padding: "1px 4px", borderRadius: 3, background: `${t.gc}80`, color: "#F5F5F4", fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.03em", whiteSpace: "nowrap", flexShrink: 0, opacity: 0.85 }}>{t.genre}</span>
                      </div>
                      <div style={{ fontSize: 8.5, color: "#8F8883", marginTop: 0 }}>{t.artist}</div>
                    </div>
                    {/* BPM */}
                    <div style={{ fontSize: 9.5, color: "#D95340", fontFamily: "'JetBrains Mono', monospace" }}>{t.bpm}</div>
                    {/* Key circle */}
                    <div style={{ width: 20, height: 20, borderRadius: 4, background: t.kc, display: "flex", alignItems: "center", justifyContent: "center" }}>
                      <span style={{ fontSize: 7.5, color: "#fff", fontFamily: "'JetBrains Mono', monospace", fontWeight: 700 }}>{t.key}</span>
                    </div>
                    {/* Duration */}
                    <div style={{ fontSize: 8.5, color: "#605A55", fontFamily: "'JetBrains Mono', monospace" }}>{t.len}</div>
                  </div>
                ))}
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── SOFTWARE UI ──────────────────────── */
function SoftwareUI() {
  const { tr } = useLang();
  const [active, setActive] = useStateS(2);
  const tracks = [
    { title: "Helios Drift — Midnight Geometry", artist: "Submerged EP", genre: "Deep / Melodic", key: "8A", bpm: "128.04", len: "6:42", wave: [.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.4,.6] },
    { title: "Astra — Floor of Glass", artist: "Pale Horizon", genre: "Progressive", key: "5A", bpm: "124.00", len: "7:18", wave: [.4,.6,.8,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1] },
    { title: "Nuit Bleue — Crimson Hours", artist: "Single", genre: "House", key: "9A", bpm: "126.50", len: "5:54", wave: [.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.4,.6,.8] },
    { title: "Vermil — Long Way Down", artist: "Long Way Down", genre: "Indie Dance", key: "11A", bpm: "122.00", len: "4:48", wave: [.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8], warn: true },
    { title: "Okra Sessions — Saudade", artist: "Tide Volumes", genre: "Downtempo", key: "4A", bpm: "118.00", len: "8:02", wave: [.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.4,.6] },
    { title: "Maxine Field — Phaseout", artist: "Phaseout EP", genre: "Tech House", key: "10A", bpm: "130.20", len: "6:08", wave: [.4,.6,.8,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1] },
    { title: "Halocene — Reach North", artist: "Reach", genre: "Melodic Techno", key: "7A", bpm: "127.50", len: "7:30", wave: [.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.3,.5,.7,.9,.6,.4,.6,.8,1,.7,.5,.4,.6,.8] },
  ];
  const active_t = tracks[active];

  return (
    <section data-screen-label="03 Software" style={{ padding: "120px 0 140px", position: "relative" }}>
      <div className="glow" style={{ width: 600, height: 600, background: "var(--accent)", top: "20%", right: "-200px", opacity: 0.12 }}></div>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 24 }}>
            <span className="num">03</span> · {tr.software.section}
          </div>
        </Reveal>
        <Reveal delay={80}>
          <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.1fr) minmax(0, 1fr)", gap: 60, alignItems: "end", marginBottom: 60 }}>
            <h2 className="editorial-h2" style={{ margin: 0 }}>
              {tr.software.h2_l1}<br/>
              <span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{tr.software.h2_italic}</span>{tr.software.h2_l2}
            </h2>
            <p style={{ fontSize: 16, color: "var(--bone-dim)", maxWidth: "46ch", lineHeight: 1.6 }}>
              {tr.software.body}
            </p>
          </div>
        </Reveal>

        <Reveal delay={120}>
          <div className="app-window">

            {/* ── TOOLBAR (bg mais escuro, como no app real #23201E) ── */}
            <div style={{
              background: "#23201E", borderBottom: "1px solid rgba(244,237,228,0.05)",
              display: "flex", alignItems: "center", gap: 4, padding: "6px 10px",
              flexShrink: 0, overflow: "hidden",
            }}>
              {/* Traffic lights */}
              <div style={{ display: "flex", gap: 5, marginRight: 8, flexShrink: 0 }}>
                <span style={{ width: 10, height: 10, borderRadius: "50%", background: "#FF5F57", display: "block" }} />
                <span style={{ width: 10, height: 10, borderRadius: "50%", background: "#FFBD2E", display: "block" }} />
                <span style={{ width: 10, height: 10, borderRadius: "50%", background: "#28C840", display: "block" }} />
              </div>
              {/* Logo ring */}
              <svg width="18" height="18" viewBox="0 0 100 100" style={{ flexShrink: 0, marginRight: 2 }}>
                <circle cx="50" cy="50" r="46" fill="#D95340"/>
                <circle cx="50" cy="50" r="27" fill="#1A0D0B"/>
              </svg>
              {/* Sidebar toggle */}
              <div style={{ width: 26, height: 26, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 5, flexShrink: 0 }}>
                <svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="#605A55" strokeWidth="1.3" strokeLinecap="round">
                  <rect x="1" y="1" width="11" height="11" rx="1.5"/>
                  <path d="M4.5 1v11"/>
                </svg>
              </div>
              {/* Folder open button (coral) */}
              <div style={{ width: 28, height: 28, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 6, background: "#D95340", flexShrink: 0, marginRight: 4 }}>
                <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="white" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <path d="M2 5.5C2 4.67 2.67 4 3.5 4H6L7 5H12.5C13.33 5 14 5.67 14 6.5V11.5C14 12.33 13.33 13 12.5 13H3.5C2.67 13 2 12.33 2 11.5V5.5Z"/>
                  <line x1="8" y1="7.5" x2="8" y2="11"/>
                  <line x1="6.25" y1="9.25" x2="9.75" y2="9.25"/>
                </svg>
              </div>
              {/* Action buttons - text style like real app */}
              {[
                { label: tr.software.app_btn_restore, icon: "M2 5.5A3.5 3.5 0 108.5 2.5L7 4 M2 2.5v3h3" },
                { label: tr.software.app_btn_bpm,     icon: "M1 8l2-4 2 2.5 2-5 2 3 1-2" },
                { label: tr.software.app_btn_enrich,  icon: "M5.5 3.5v2l1.5 1 M5.5 1.5a4 4 0 100 8 4 4 0 000-8z" },
                { label: tr.software.app_btn_normalize, icon: "M1 3h9M3 5.5h5M4.5 8h2" },
                { label: tr.software.app_btn_export,  icon: "M5.5 1v6M3 4l2.5-3 2.5 3 M2 8v1.5h7V8" },
              ].map((btn, i) => (
                <div key={i} style={{
                  display: "flex", alignItems: "center", gap: 5,
                  padding: "4px 8px", borderRadius: 5, cursor: "default", flexShrink: 0,
                  color: "#605A55",
                }}>
                  <svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round">
                    {btn.icon.split(" M").map((d, j) => <path key={j} d={j === 0 ? d : "M" + d} />)}
                  </svg>
                  <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10, fontWeight: 600, whiteSpace: "nowrap" }}>{btn.label}</span>
                </div>
              ))}
              {/* Track count */}
              <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 10, color: "#605A55", marginLeft: 4, flexShrink: 0, whiteSpace: "nowrap" }}>76 {tr.software.app_tracks_unit}</span>
              {/* Filter chips */}
              <div style={{ display: "flex", gap: 2, marginLeft: 4, flexShrink: 0 }}>
                {[
                  { label: tr.software.app_tab_all, active: true },
                  { label: "+ 73", active: false },
                  { label: "★ 0", active: false },
                  { label: "⚠ 4", active: false },
                  { label: "✓ 72", active: false },
                ].map((tab, i) => (
                  <span key={i} style={{
                    fontFamily: "'JetBrains Mono', monospace", fontSize: 9, fontWeight: 600,
                    padding: "3px 8px", borderRadius: 5, cursor: "default", whiteSpace: "nowrap",
                    background: tab.active ? "rgba(217,83,64,0.2)" : "transparent",
                    color: tab.active ? "#D95340" : "#605A55",
                    border: tab.active ? "1px solid rgba(217,83,64,0.25)" : "1px solid transparent",
                  }}>{tab.label}</span>
                ))}
              </div>
              {/* Right side */}
              <div style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 8, flexShrink: 0 }}>
                <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 9, color: "#605A55" }}>Trial · 13d</span>
                <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 9, fontWeight: 700, padding: "2px 7px", borderRadius: 4, background: "#D95340", color: "#fff" }}>Upgrade</span>
                <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 9, color: "#4C4743" }}>v0.4.3</span>
              </div>
            </div>

            {/* ── BODY ── */}
            <div className="app-body" style={{ flex: 1, overflow: "hidden" }}>

              {/* SIDEBAR */}
              <div style={{
                width: 160, minWidth: 160, display: "flex", flexDirection: "column",
                borderRight: "1px solid rgba(244,237,228,0.05)", background: "#0E0D0C", overflow: "hidden",
              }}>
                {/* Tab bar — Recentes / Favoritos / Playlists */}
                <div style={{ display: "flex", padding: "0 6px", paddingTop: 6, borderBottom: "1px solid rgba(244,237,228,0.05)", flexShrink: 0 }}>
                  {[
                    { label: tr.software.app_tab_recent, count: 3 },
                    { label: tr.software.app_tab_fav,    count: 0 },
                    { label: tr.software.app_tab_playlist, count: 0 },
                  ].map((tab, i) => (
                    <div key={i} style={{
                      display: "flex", alignItems: "center", gap: 3,
                      padding: "5px 4px 5px", marginBottom: -1,
                      fontFamily: "'Geist', sans-serif", fontSize: 9.5, fontWeight: 600,
                      color: i === 0 ? "#F5F5F4" : "#605A55",
                      borderBottom: i === 0 ? "1.5px solid #D95340" : "1.5px solid transparent",
                      cursor: "default", whiteSpace: "nowrap",
                    }}>
                      {tab.label}
                      {tab.count > 0 && (
                        <span style={{
                          fontSize: 8, fontFamily: "'JetBrains Mono', monospace",
                          padding: "0 3px", borderRadius: 3,
                          background: i === 0 ? "rgba(217,83,64,0.2)" : "rgba(244,237,228,0.05)",
                          color: i === 0 ? "#D95340" : "#605A55",
                        }}>{tab.count}</span>
                      )}
                    </div>
                  ))}
                </div>
                {/* Folder list */}
                <div style={{ flex: 1, overflowY: "hidden", padding: "4px 0" }}>
                  {[
                    { name: "Reggae",    active: false },
                    { name: "Pop",       active: true  },
                    { name: "Old",       active: false },
                    { name: "Funk",      active: false },
                    { name: "Hip Hop",   active: false },
                  ].map((f, i) => (
                    <div key={i} style={{
                      display: "flex", alignItems: "center", gap: 0,
                      cursor: "default",
                    }}>
                      {/* chevron */}
                      <div style={{ width: 18, height: 24, display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }}>
                        <svg width="7" height="7" viewBox="0 0 8 8" fill="#4C4743">
                          <path d="M2 1l4 3-4 3V1z"/>
                        </svg>
                      </div>
                      <div style={{
                        flex: 1, display: "flex", alignItems: "center", gap: 5,
                        padding: "4px 6px 4px 0", borderRadius: 5, marginRight: 4,
                        background: f.active ? "rgba(217,83,64,0.15)" : "transparent",
                        border: f.active ? "1px solid rgba(217,83,64,0.2)" : "1px solid transparent",
                      }}>
                        <svg width="11" height="11" viewBox="0 0 11 11" fill={f.active ? "#D95340" : "#605A55"} style={{ flexShrink: 0, opacity: 0.6 }}>
                          <path d="M1 2.5A1.5 1.5 0 012.5 1h1.586a1 1 0 01.707.293L5.5 2H9a1.5 1.5 0 011.5 1.5v5A1.5 1.5 0 019 10H2a1.5 1.5 0 01-1.5-1.5v-6z"/>
                        </svg>
                        <span style={{ fontSize: 10.5, fontFamily: "'Geist', sans-serif", fontWeight: f.active ? 500 : 400, color: f.active ? "#F5F5F4" : "#8F8883", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{f.name}</span>
                      </div>
                    </div>
                  ))}
                </div>
                {/* Dispositivos */}
                <div style={{ borderTop: "1px solid rgba(244,237,228,0.05)", padding: "8px 10px 6px", flexShrink: 0 }}>
                  <div style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, letterSpacing: "0.18em", textTransform: "uppercase", color: "#4C4743", fontWeight: 700, marginBottom: 6 }}>{tr.software.app_devices}</div>
                  {["Dados", "Macintosh HD", "Musicas", "SSD Interno", "UTM"].map((d, i) => (
                    <div key={i} style={{ display: "flex", alignItems: "center", gap: 6, padding: "4px 4px", borderRadius: 5, cursor: "default" }}>
                      <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="#605A55" strokeWidth="1.3" strokeLinecap="round" style={{ flexShrink: 0 }}>
                        <rect x="1" y="3" width="10" height="7" rx="1.5"/>
                        <path d="M4 3V2a1 1 0 011-1h2a1 1 0 011 1v1"/>
                        <circle cx="9" cy="6.5" r=".8" fill="#605A55" stroke="none"/>
                      </svg>
                      <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10.5, color: "#8F8883" }}>{d}</span>
                    </div>
                  ))}
                </div>
                {/* Footer stats */}
                <div style={{ borderTop: "1px solid rgba(244,237,228,0.05)", padding: "8px 12px", flexShrink: 0 }}>
                  <div style={{ fontSize: 10.5, color: "#8F8883", fontFamily: "'Geist', sans-serif" }}>76 {tr.software.app_tracks_unit}</div>
                  <div style={{ fontSize: 10, color: "#605A55", fontFamily: "'JetBrains Mono', monospace" }}>0.36 GB · 5h 6min</div>
                </div>
              </div>

              {/* MAIN AREA */}
              <div style={{ flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }}>

                {/* Áudio / Vídeo sub-tabs (centered, inside main area) */}
                <div style={{ display: "flex", justifyContent: "center", gap: 8, padding: "8px 0", borderBottom: "1px solid rgba(244,237,228,0.05)", flexShrink: 0 }}>
                  <div style={{ display: "flex", alignItems: "center", gap: 5, padding: "4px 12px", borderRadius: 6, background: "#D95340", cursor: "default" }}>
                    <span style={{ width: 6, height: 6, borderRadius: "50%", background: "#fff", opacity: 0.8 }} />
                    <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10, fontWeight: 600, color: "#fff" }}>{tr.software.app_media_audio} 76</span>
                  </div>
                  <div style={{ display: "flex", alignItems: "center", gap: 5, padding: "4px 12px", borderRadius: 6, background: "rgba(244,237,228,0.05)", cursor: "default" }}>
                    <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10, color: "#605A55" }}>{tr.software.app_media_video}</span>
                  </div>
                </div>

                {/* Warning banner */}
                <div style={{
                  display: "flex", alignItems: "center", gap: 8,
                  padding: "7px 12px", background: "rgba(217,83,64,0.07)",
                  borderBottom: "1px solid rgba(217,83,64,0.15)", flexShrink: 0,
                }}>
                  <span style={{ width: 7, height: 7, borderRadius: "50%", background: "#D95340", flexShrink: 0 }} />
                  <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10, color: "#D95340", flex: 1 }}>{tr.software.app_warning}</span>
                  <span style={{ fontFamily: "'Geist', sans-serif", fontSize: 10, color: "#D95340", fontWeight: 600, cursor: "default" }}>{tr.software.app_review}</span>
                  <span style={{ color: "#605A55", fontSize: 12, cursor: "default" }}>×</span>
                </div>

                {/* Track table */}
                <div style={{ flex: 1, overflow: "hidden", display: "flex", flexDirection: "column" }}>
                  {/* Column headers */}
                  <div style={{
                    display: "grid",
                    gridTemplateColumns: "28px 18px 18px 34px 1fr 70px 44px 52px 44px 38px",
                    padding: "0 10px", height: 28, alignItems: "center",
                    borderBottom: "1px solid rgba(244,237,228,0.05)",
                    background: "rgba(244,237,228,0.015)",
                  }}>
                    {["#", "", "★", tr.software.app_col_cover, tr.software.app_col_title, tr.software.app_col_genre_h, tr.software.app_col_key, tr.software.app_col_bpm, tr.software.app_col_len, tr.software.app_col_wave].map((h, i) => (
                      <div key={i} style={{ fontSize: 8.5, color: "#4C4743", fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.1em", textTransform: "uppercase", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
                        {i === 1 ? (
                          <span style={{ display: "flex", alignItems: "center", gap: 2 }}>
                            <span style={{ width: 6, height: 6, borderRadius: "50%", background: "#4C4743", display: "inline-block" }} />
                            <svg width="7" height="7" viewBox="0 0 8 8" fill="#4C4743"><path d="M4 1l1 2.5 2.5.5-1.8 1.8.4 2.7L4 7l-2.1 1.5.4-2.7L.5 4l2.5-.5L4 1z"/></svg>
                          </span>
                        ) : h}
                      </div>
                    ))}
                  </div>
                  {/* Track rows */}
                  {[
                    { n:"27", title:"3 Doors Down",                  artist:"3 Doors Down",     genre:"ROCK",       gc:"#3A5A7A", key:"D", kc:"#7B3F9E", bpm:"100.00", len:"4:18", warn:true  },
                    { n:"28", title:"The Kill",                       artist:"30 Seconds To Mars",genre:"ROCK",      gc:"#3A5A7A", key:"A", kc:"#2E7D4F", bpm:"128.50", len:"3:53", warn:false },
                    { n:"29", title:"Zombie",                         artist:"Cranberries",       genre:"ROCK",      gc:"#3A5A7A", key:"B", kc:"#B34435", bpm:"84.00",  len:"5:06", warn:false },
                    { n:"30", title:"I Hear You Call",                artist:"Bliss",             genre:"POP",       gc:"#6A3A7A", key:"E", kc:"#4A7A3A", bpm:"120.00", len:"3:44", warn:false },
                    { n:"31", title:"I Still Haven't Found What I'm Looking For", artist:"U2", genre:"ROCK",        gc:"#3A5A7A", key:"G", kc:"#C4872A", bpm:"103.00", len:"4:37", warn:false },
                    { n:"32", title:"Track-01",                       artist:"3 Days Grace",      genre:"OTHER",     gc:"#4A4A5A", key:"C", kc:"#1A6A7A", bpm:"—",      len:"3:51", warn:false },
                    { n:"33", title:"for you",                        artist:"the calling",       genre:"ROCK",      gc:"#3A5A7A", key:"F", kc:"#3A7A6A", bpm:"93.50",  len:"3:58", warn:false },
                  ].map((t, i) => (
                    <div key={i} onClick={() => setActive(i)} style={{
                      display: "grid",
                      gridTemplateColumns: "28px 18px 18px 34px 1fr 70px 44px 52px 44px 38px",
                      padding: "0 10px", height: 32,
                      borderBottom: "1px solid rgba(244,237,228,0.03)",
                      alignItems: "center",
                      background: i === active ? "rgba(244,237,228,0.04)" : "transparent",
                      cursor: "pointer",
                    }}>
                      <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 10, color: "#605A55" }}>{t.n}</span>
                      <span style={{ width: 8, height: 8, borderRadius: "50%", background: t.warn ? "#D95340" : "#2ECC71", display: "inline-block" }} />
                      <span style={{ fontSize: 10, color: "#2a2522" }}>★★★★★</span>
                      {/* Cover thumbnail */}
                      <div style={{ width: 22, height: 22, borderRadius: 3, overflow: "hidden", background: "linear-gradient(135deg, #2a1f1c, #1a1512)", border: "1px solid rgba(244,237,228,0.07)", flexShrink: 0 }}>
                        {i % 3 !== 2 && (
                          <div style={{ width: "100%", height: "100%", background: `linear-gradient(135deg, ${t.kc}44, ${t.gc}66)` }} />
                        )}
                      </div>
                      <div style={{ overflow: "hidden", paddingLeft: 4 }}>
                        <div style={{ fontSize: 10.5, color: "#F5F5F4", fontWeight: 500, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{t.title}</div>
                        <div style={{ fontSize: 9.5, color: "#8F8883", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{t.artist}</div>
                      </div>
                      <div style={{ overflow: "hidden" }}>
                        <span style={{ fontSize: 9, padding: "2px 5px", borderRadius: 3, background: `${t.gc}30`, color: t.gc, fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.04em", whiteSpace: "nowrap" }}>{t.genre}</span>
                      </div>
                      <div style={{ display: "flex", alignItems: "center" }}>
                        <div style={{ width: 22, height: 22, borderRadius: 4, background: t.kc, display: "flex", alignItems: "center", justifyContent: "center", fontFamily: "'JetBrains Mono', monospace", fontSize: 10, fontWeight: 700, color: "#fff", flexShrink: 0 }}>{t.key}</div>
                      </div>
                      <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 10, color: t.bpm === "—" ? "#4C4743" : "var(--accent)" }}>{t.bpm}</span>
                      <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 10, color: "#8F8883" }}>{t.len}</span>
                      <MiniWave pattern={tracks[i % tracks.length].wave} />
                    </div>
                  ))}
                </div>
              </div>

              {/* RIGHT INSPECTOR */}
              <div style={{
                width: 190, minWidth: 190, borderLeft: "1px solid rgba(244,237,228,0.05)",
                background: "#0E0D0C", display: "flex", flexDirection: "column", overflow: "hidden",
              }}>
                {/* Panel tabs: Selecionado / Biblioteca */}
                <div style={{ display: "flex", borderBottom: "1px solid rgba(244,237,228,0.05)", flexShrink: 0, padding: "0 8px" }}>
                  {[tr.software.app_insp_selected, tr.software.app_insp_library].map((tab, i) => (
                    <div key={i} style={{
                      flex: 1, padding: "8px 4px", textAlign: "center",
                      fontFamily: "'Geist', sans-serif", fontSize: 10, fontWeight: 600,
                      color: i === 1 ? "#F5F5F4" : "#605A55",
                      borderBottom: i === 1 ? "1.5px solid #D95340" : "1.5px solid transparent",
                      marginBottom: -1, cursor: "default",
                    }}>{tab}</div>
                  ))}
                  <div style={{ display: "flex", alignItems: "center", paddingBottom: 4, color: "#605A55", fontSize: 14, cursor: "default" }}>×</div>
                </div>
                {/* Library content */}
                <div style={{ flex: 1, overflow: "hidden", padding: "12px 14px", display: "flex", flexDirection: "column", gap: 0 }}>
                  <div style={{ fontSize: 22, fontWeight: 500, letterSpacing: "-0.025em", color: "#F5F5F4" }}>76 <span style={{ fontSize: 13, color: "#8F8883", fontWeight: 400 }}>{tr.software.app_tracks_unit}</span></div>
                  <div style={{ fontSize: 10, color: "#605A55", fontFamily: "'JetBrains Mono', monospace", marginTop: 2, marginBottom: 14 }}>0.4 GB · 5h 6min</div>
                  {/* Coverage */}
                  <div style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, letterSpacing: "0.18em", textTransform: "uppercase", color: "#4C4743", fontWeight: 700, marginBottom: 8 }}>{tr.software.app_coverage}</div>
                  {[
                    { label: "BPM",                       val: 76, total: 76, pct: 100 },
                    { label: tr.software.app_col_key,     val: 11, total: 76, pct: 14  },
                    { label: tr.software.app_col_genre_h, val: 75, total: 76, pct: 99  },
                    { label: tr.software.app_col_cover,   val: 72, total: 76, pct: 95  },
                    { label: "Rating",                    val: 0,  total: 76, pct: 0   },
                  ].map((bar, i) => (
                    <div key={i} style={{ marginBottom: 9 }}>
                      <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 3 }}>
                        <span style={{ fontSize: 10, color: "#8F8883", fontFamily: "'Geist', sans-serif" }}>{bar.label}</span>
                        <span style={{ fontSize: 9, fontFamily: "'JetBrains Mono', monospace", color: bar.pct === 100 ? "var(--accent-bright)" : bar.pct === 0 ? "#4C4743" : "#8F8883" }}>
                          {bar.val}/{bar.total} <span style={{ color: bar.pct === 100 ? "var(--accent-bright)" : bar.pct === 0 ? "#4C4743" : "#FFBD2E" }}>{bar.pct}%</span>
                        </span>
                      </div>
                      <div style={{ height: 3, background: "rgba(244,237,228,0.06)", borderRadius: 2 }}>
                        <div style={{ width: `${bar.pct}%`, height: "100%", borderRadius: 2, background: bar.pct === 100 ? "#D95340" : bar.pct === 0 ? "transparent" : "#FFBD2E" }} />
                      </div>
                    </div>
                  ))}
                  {/* Problems */}
                  <div style={{ padding: "7px 10px", borderRadius: 6, background: "rgba(217,83,64,0.08)", border: "1px solid rgba(217,83,64,0.2)", fontSize: 9.5, color: "#D95340", fontFamily: "'Geist', sans-serif", fontWeight: 500, display: "flex", alignItems: "center", gap: 6, marginBottom: 12 }}>
                    <span style={{ width: 7, height: 7, borderRadius: "50%", background: "#D95340", flexShrink: 0 }} />
                    {tr.software.app_problems_n}
                  </div>
                  {/* Top Genres */}
                  <div style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 8, letterSpacing: "0.18em", textTransform: "uppercase", color: "#4C4743", fontWeight: 700, marginBottom: 8 }}>{tr.software.app_top_genres}</div>
                  {[["Rock",22],["Pop",19],["Alternative",7],["Other",5],["Blues",4]].map(([g,n], i) => (
                    <div key={i} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "3px 0" }}>
                      <span style={{ fontSize: 10.5, color: "#8F8883", fontFamily: "'Geist', sans-serif" }}>{g}</span>
                      <span style={{ fontFamily: "'JetBrains Mono', monospace", fontSize: 10, color: "#605A55" }}>{n}</span>
                    </div>
                  ))}
                </div>
                {/* AI Assistant button */}
                <div style={{ display: "flex", justifyContent: "flex-end", padding: "10px 12px", flexShrink: 0 }}>
                  <div style={{ width: 34, height: 34, borderRadius: "50%", background: "#1e1c1a", border: "2px solid rgba(217,83,64,0.45)", display: "flex", alignItems: "center", justifyContent: "center" }}>
                    <svg width="14" height="14" viewBox="0 0 100 100">
                      <circle cx="50" cy="50" r="46" fill="#D95340"/>
                      <circle cx="50" cy="50" r="27" fill="#1A0D0B"/>
                    </svg>
                  </div>
                </div>
              </div>

            </div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

/* ──────────────────────── FEATURES ──────────────────────── */
function Features() {
  const { tr } = useLang();
  const f = tr.features;
  return (
    <section id="features" data-screen-label="04 Features" style={{ padding: "120px 0" }}>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 28 }}>
            <span className="num">04</span> · {f.section}
          </div>
        </Reveal>
        <Reveal delay={80}>
          <h2 className="editorial-h2" style={{ marginBottom: 80, maxWidth: "16ch" }}>
            {f.h2_l1}<br/>
            <span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{f.h2_l2}</span>
          </h2>
        </Reveal>

        <div className="features-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: 20 }}>
          <Reveal delay={0} style={{ height: "100%" }}>
            <div className="feature">
              <div>
                <div className="eyebrow" style={{ marginBottom: 18 }}>{f.f1_label}</div>
                <h3>{f.f1_title}</h3>
                <p>{f.f1_body}</p>
              </div>
              <div>
                <div className="mono" style={{ fontSize: 10, color: "var(--bone-mid)", marginBottom: 6, letterSpacing: "0.16em", textTransform: "uppercase" }}>{f.f1_last}</div>
                <div style={{ display: "flex", gap: 4, flexWrap: "wrap" }}>
                  {[128.04, 124.00, 126.5, 122.0, 118.0, 130.2, 127.5, 124.1, 132.0, 119.9, 126.0, 128.0].map((n, i) => (
                    <span key={i} className="mono" style={{ fontSize: 10, padding: "3px 6px", borderRadius: 4, background: "rgba(244,237,228,0.05)", color: i === 0 ? "var(--accent-bright)" : "var(--bone-dim)" }}>{n}</span>
                  ))}
                </div>
              </div>
            </div>
          </Reveal>

          <Reveal delay={80} style={{ height: "100%" }}>
            <div className="feature">
              <div>
                <div className="eyebrow" style={{ marginBottom: 18 }}>{f.f2_label}</div>
                <h3>{f.f2_title}</h3>
                <p>{f.f2_body}</p>
              </div>
              <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
                <KV k="ARTIST" v="Helios Drift" accent />
                <KV k="ALBUM" v="Submerged EP" accent />
                <KV k="ARTWORK" v="1500 × 1500" accent />
              </div>
            </div>
          </Reveal>

          <Reveal delay={160} style={{ height: "100%" }}>
            <div className="feature">
              <div>
                <div className="eyebrow" style={{ marginBottom: 18 }}>{f.f3_label}</div>
                <h3>{f.f3_title}</h3>
                <p>{f.f3_body}</p>
              </div>
              <div className="mono" style={{ fontSize: 11, color: "var(--bone-dim)", lineHeight: 1.6 }}>
                <div>{f.f3_c1} <span style={{ color: "var(--accent-bright)" }}>FLAC</span></div>
                <div>{f.f3_c2} <span style={{ color: "var(--accent-bright)" }}>320 kbps</span></div>
                <div>{f.f3_c3} <span style={{ color: "var(--accent-bright)" }}>WAV</span></div>
              </div>
            </div>
          </Reveal>

          <Reveal delay={0} style={{ height: "100%" }}>
            <div className="feature">
              <div>
                <div className="eyebrow" style={{ marginBottom: 18 }}>{f.f4_label}</div>
                <h3>{f.f4_title}</h3>
                <p>{f.f4_body}</p>
              </div>
              <div className="mono" style={{ fontSize: 11, padding: 10, borderRadius: 6, background: "rgba(0,0,0,0.4)", color: "var(--bone-dim)", border: "1px solid rgba(244,237,228,0.06)" }}>
                <span style={{ color: "var(--bone-mid)" }}>$ </span>
                {"{artist} — {title} [{key} · {bpm}]"}
              </div>
            </div>
          </Reveal>

          <Reveal delay={80} style={{ height: "100%" }}>
            <div className="feature">
              <div>
                <div className="eyebrow" style={{ marginBottom: 18 }}>{f.f5_label}</div>
                <h3>{f.f5_title}</h3>
                <p>{f.f5_body}</p>
              </div>
              <div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
                <Chip>● Rekordbox 6.8</Chip>
                <Chip>● Serato 3.2</Chip>
                <Chip>● Traktor 4</Chip>
              </div>
            </div>
          </Reveal>

          <Reveal delay={160} style={{ height: "100%" }}>
            <div className="feature" style={{ background: "linear-gradient(180deg, color-mix(in oklab, var(--accent) 14%, #1c1817), #0b0908)", borderColor: "color-mix(in oklab, var(--accent) 32%, transparent)" }}>
              <div>
                <div className="eyebrow" style={{ marginBottom: 18, color: "var(--accent-bright)" }}>{f.f6_label}</div>
                <h3>{f.f6_title}</h3>
                <p>{f.f6_body}</p>
              </div>
              <div className="mono" style={{ fontSize: 11, color: "var(--bone)", display: "flex", justifyContent: "space-between" }}>
                <span>{f.f6_offline}</span>
                <span style={{ color: "var(--accent-bright)" }}>● 0 KB uploaded</span>
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── HOW IT WORKS ──────────────────────── */
function HowItWorks() {
  const { tr } = useLang();
  const w = tr.workflow;
  const steps = [
    { n: "01", title: w.step1_title, body: w.step1_body, img: "assets/curtain.jpg" },
    { n: "02", title: w.step2_title, body: w.step2_body, img: "assets/wave-orb.jpg" },
    { n: "03", title: w.step3_title, body: w.step3_body, img: "assets/visor.jpg" },
  ];
  return (
    <section id="workflow" data-screen-label="05 Workflow" style={{ padding: "120px 0", background: "linear-gradient(180deg, transparent, #0a0807 30%, #0a0807 70%, transparent)" }}>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 28 }}>
            <span className="num">05</span> · {w.section}
          </div>
        </Reveal>
        <Reveal delay={80}>
          <h2 className="editorial-h2" style={{ marginBottom: 80, maxWidth: "20ch" }}>
            {w.h2_l1}<br/>
            {w.h2_pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{w.h2_italic}</span>{w.h2_end}
          </h2>
        </Reveal>
        <div className="workflow-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: 28 }}>
          {steps.map((s, i) => (
            <Reveal key={i} delay={i * 100}>
              <div>
                <div style={{ position: "relative", aspectRatio: "4/5", overflow: "hidden", borderRadius: 10, marginBottom: 24, background: "#0a0807" }}>
                  <img src={s.img} alt="" style={{ width: "100%", height: "100%", objectFit: "cover", filter: "contrast(1.05) saturate(1.05)" }} />
                  <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, transparent 50%, rgba(10,8,7,0.9))" }}></div>
                  <div style={{ position: "absolute", top: 18, left: 18, fontSize: 14 }} className="mono accent-text">{s.n}</div>
                  <Brackets />
                </div>
                <h3 style={{ fontSize: 28, letterSpacing: "-0.025em", fontWeight: 500, margin: "0 0 10px", maxWidth: "16ch" }}>{s.title}</h3>
                <p style={{ fontSize: 14.5, color: "var(--bone-dim)", lineHeight: 1.55, maxWidth: "36ch" }}>{s.body}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── BIG STAT BREAK ──────────────────────── */
function StatBreak() {
  const { tr } = useLang();
  return (
    <section style={{ padding: "100px 0", position: "relative", overflow: "hidden" }}>
      <div className="glow" style={{ width: 700, height: 700, background: "var(--accent)", top: "-30%", left: "30%", opacity: 0.18 }}></div>
      <div className="container stat-break-inner" style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.1fr) minmax(0, 1fr)", gap: 60, alignItems: "center" }}>
        <Reveal>
          <div>
            <div className="section-label" style={{ marginBottom: 24 }}><span className="num">—</span> {tr.statbreak.section}</div>
            <div className="stat-num">42<span style={{ color: "var(--accent)" }}>h</span></div>
            <p style={{ fontSize: 17, color: "var(--bone-dim)", maxWidth: "40ch", marginTop: 12, lineHeight: 1.55 }}>
              {tr.statbreak.body}
            </p>
          </div>
        </Reveal>
        <Reveal delay={120}>
          <div style={{ position: "relative", aspectRatio: "16/10", overflow: "hidden", borderRadius: 10 }}>
            <img src="assets/crowd.jpg" alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
            <div style={{ position: "absolute", inset: 0, background: "linear-gradient(135deg, transparent 40%, rgba(10,8,7,0.6))" }}></div>
            <div style={{ position: "absolute", bottom: 22, left: 22, right: 22, display: "flex", justifyContent: "space-between", alignItems: "end", fontFamily: "'JetBrains Mono', monospace", fontSize: 11, color: "var(--bone-dim)" }}>
              <span>FIELD&nbsp;NOTE&nbsp;/&nbsp;02:43&nbsp;AM</span>
              <span>KLUB ECHO — LIS</span>
            </div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

/* ──────────────────────── INTEGRATIONS ──────────────────────── */
function Integrations() {
  const { tr } = useLang();
  const items = ["Rekordbox", "✦", "Serato", "✦", "Spotify", "✦", "Last.fm", "✦", "Apple Music", "✦", "Beatport", "✦", "Traktor", "✦", "MusicBrainz", "✦", "Discogs"];
  const doubled = [...items, ...items];
  return (
    <section id="integrations" data-screen-label="06 Integrations" style={{ padding: "120px 0", borderTop: "1px solid rgba(244,237,228,0.05)", borderBottom: "1px solid rgba(244,237,228,0.05)" }}>
      <div className="container">
        <Reveal>
          <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)", gap: 60, alignItems: "end", marginBottom: 56 }}>
            <div>
              <div className="section-label" style={{ marginBottom: 24 }}><span className="num">06</span> · {tr.integrations.section}</div>
              <h2 className="editorial-h2" style={{ margin: 0, maxWidth: "14ch" }}>
                {tr.integrations.h2_pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{tr.integrations.h2_italic}</span>{tr.integrations.h2_end}
              </h2>
            </div>
            <p style={{ fontSize: 16, color: "var(--bone-dim)", lineHeight: 1.6, maxWidth: "44ch" }}>
              {tr.integrations.body}
            </p>
          </div>
        </Reveal>
        <div style={{ overflow: "hidden", margin: "0 -40px" }}>
          <div className="marquee-track">
            {doubled.map((s, i) => (
              <span className="item" key={i} style={{ color: s === "✦" ? "var(--accent)" : undefined, fontSize: s === "✦" ? 18 : 28 }}>{s}</span>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── PRICING ──────────────────────── */
function Pricing() {
  const { tr } = useLang();
  const p = tr.pricing;
  return (
    <section id="pricing" data-screen-label="07 Pricing" style={{ padding: "140px 0" }}>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 28 }}><span className="num">07</span> · {p.section}</div>
        </Reveal>
        <Reveal delay={80}>
          <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.2fr) minmax(0, 1fr)", gap: 60, alignItems: "end", marginBottom: 60 }}>
            <h2 className="editorial-h2" style={{ margin: 0 }}>
              {p.h2_l1}<br/>
              <span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{p.h2_italic}</span>{p.h2_end}
            </h2>
            <p style={{ fontSize: 16, color: "var(--bone-dim)", lineHeight: 1.6, maxWidth: "40ch" }}>
              {p.body}
            </p>
          </div>
        </Reveal>

        <div className="pricing-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: 20 }}>
          <Reveal delay={0}>
            <div className="price-card">
              <div>
                <div className="eyebrow" style={{ marginBottom: 14 }}>{p.trial_label}</div>
                <div className="price">$0</div>
                <div className="mono" style={{ fontSize: 11, color: "var(--bone-mid)", marginTop: 6 }}>{p.trial_sub}</div>
              </div>
              <ul>
                <li>{p.trial_f1}</li><li>{p.trial_f2}</li>
                <li>{p.trial_f3}</li><li>{p.trial_f4}</li>
              </ul>
              <CTAButton variant="ghost" as="a" href="#">{p.trial_cta}</CTAButton>
            </div>
          </Reveal>
          <Reveal delay={80}>
            <div className="price-card feature-price">
              <div>
                <div className="eyebrow" style={{ marginBottom: 14, color: "var(--accent-bright)" }}>{p.lifetime_label}</div>
                <div className="price">$129</div>
                <div className="mono" style={{ fontSize: 11, color: "var(--bone-dim)", marginTop: 6 }}>{p.lifetime_sub}</div>
              </div>
              <ul>
                <li>{p.lifetime_f1}</li><li>{p.lifetime_f2}</li>
                <li>{p.lifetime_f3}</li><li>{p.lifetime_f4}</li>
                <li>{p.lifetime_f5}</li><li>{p.lifetime_f6}</li>
              </ul>
              <CTAButton as="a" href="#">{p.lifetime_cta}</CTAButton>
            </div>
          </Reveal>
          <Reveal delay={160}>
            <div className="price-card">
              <div>
                <div className="eyebrow" style={{ marginBottom: 14 }}>{p.studio_label}</div>
                <div className="price">$229</div>
                <div className="mono" style={{ fontSize: 11, color: "var(--bone-mid)", marginTop: 6 }}>{p.studio_sub}</div>
              </div>
              <ul>
                <li>{p.studio_f1}</li><li>{p.studio_f2}</li>
                <li>{p.studio_f3}</li><li>{p.studio_f4}</li>
                <li>{p.studio_f5}</li>
              </ul>
              <CTAButton variant="ghost" as="a" href="#">{p.studio_cta}</CTAButton>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── TESTIMONIALS ──────────────────────── */
function Testimonials() {
  const { tr } = useLang();
  const t = tr.testimonials;

  const avatarColors = [
    { bg: "rgba(217,83,64,0.15)", border: "rgba(217,83,64,0.4)", text: "var(--accent)" },
    { bg: "rgba(91,160,85,0.12)", border: "rgba(91,160,85,0.35)", text: "#5BA055" },
    { bg: "rgba(139,42,66,0.18)", border: "rgba(139,42,66,0.4)", text: "#C99BA6" },
    { bg: "rgba(217,83,64,0.10)", border: "rgba(217,83,64,0.3)", text: "var(--accent)" },
  ];

  return (
    <section id="testimonials" data-screen-label="08 Testimonials" style={{ padding: "140px 0", borderTop: "1px solid rgba(244,237,228,0.05)" }}>
      <div className="container">
        <Reveal>
          <div className="eyebrow" style={{ marginBottom: 20 }}>{t.section}</div>
        </Reveal>
        <Reveal delay={60}>
          <h2 className="editorial-h2" style={{ margin: "0 0 80px", maxWidth: "18ch" }}>
            {t.h2_pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{t.h2_italic}</span>{t.h2_end}
          </h2>
        </Reveal>

        <div className="testimonials-grid" style={{ display: "grid", gridTemplateColumns: "repeat(4, minmax(0, 1fr))", gap: 20 }}>
          {t.items.map((item, i) => {
            const col = avatarColors[i % avatarColors.length];
            return (
              <Reveal key={i} delay={i * 60}>
                <div style={{
                  background: "linear-gradient(135deg, rgba(20,16,14,0.6), rgba(10,8,7,0.4))",
                  border: "1px solid rgba(244,237,228,0.07)",
                  borderRadius: 12,
                  padding: "28px 24px 24px",
                  display: "flex",
                  flexDirection: "column",
                  gap: 24,
                  height: "100%",
                  backdropFilter: "blur(12px)",
                  transition: "border-color .2s",
                }}
                  onMouseEnter={e => e.currentTarget.style.borderColor = "rgba(244,237,228,0.14)"}
                  onMouseLeave={e => e.currentTarget.style.borderColor = "rgba(244,237,228,0.07)"}
                >
                  {/* Quote mark */}
                  <div style={{ fontFamily: "Georgia, serif", fontSize: 48, lineHeight: 1, color: "var(--accent)", opacity: 0.5, marginTop: -8 }}>&ldquo;</div>

                  {/* Quote text */}
                  <p style={{ fontSize: 14, lineHeight: 1.65, color: "var(--bone-dim)", margin: 0, flex: 1 }}>
                    {item.quote}
                  </p>

                  {/* Author */}
                  <div style={{ display: "flex", alignItems: "center", gap: 12, paddingTop: 16, borderTop: "1px solid rgba(244,237,228,0.06)" }}>
                    <div style={{
                      width: 40, height: 40, borderRadius: "50%",
                      background: col.bg,
                      border: `1px solid ${col.border}`,
                      display: "flex", alignItems: "center", justifyContent: "center",
                      fontFamily: "'JetBrains Mono', monospace",
                      fontSize: 11, fontWeight: 600, letterSpacing: "0.04em",
                      color: col.text,
                      flexShrink: 0,
                    }}>
                      {item.avatar}
                    </div>
                    <div>
                      <div style={{ fontSize: 13, fontWeight: 500, color: "var(--bone)", letterSpacing: "-0.01em" }}>{item.name}</div>
                      <div style={{ fontSize: 11, color: "var(--bone-mid)", marginTop: 2, fontFamily: "'JetBrains Mono', monospace", letterSpacing: "0.04em" }}>{item.role}</div>
                    </div>
                  </div>
                </div>
              </Reveal>
            );
          })}
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── FAQ ──────────────────────── */
function FAQ() {
  const { tr } = useLang();
  const f = tr.faq;
  const items = [
    { q: f.q1, a: f.a1 }, { q: f.q2, a: f.a2 },
    { q: f.q3, a: f.a3 }, { q: f.q4, a: f.a4 },
    { q: f.q5, a: f.a5 }, { q: f.q6, a: f.a6 },
  ];
  return (
    <section id="faq" data-screen-label="08 FAQ" style={{ padding: "120px 0" }}>
      <div className="container">
        <Reveal>
          <div className="section-label" style={{ marginBottom: 28 }}><span className="num">08</span> · {f.section}</div>
        </Reveal>
        <Reveal delay={80}>
          <h2 className="editorial-h2" style={{ marginBottom: 60, maxWidth: "16ch" }}>
            {f.h2_pre}<span className="serif" style={{ color: "var(--accent)", fontWeight: 400 }}>{f.h2_italic}</span>{f.h2_end}
          </h2>
        </Reveal>
        <div style={{ maxWidth: 920 }}>
          {items.map((it, i) => (
            <Reveal key={i} delay={i * 40}>
              <details className="faq">
                <summary>
                  <span>{it.q}</span>
                  <span className="plus">+</span>
                </summary>
                <p>{it.a}</p>
              </details>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ──────────────────────── FOOTER ──────────────────────── */
function Footer() {
  const { lang, setLang, tr } = useLang();
  const f = tr.footer;
  const langs = [
    { code: "pt", label: "PT" },
    { code: "es", label: "ES" },
    { code: "en", label: "EN" },
  ];
  return (
    <footer className="bottom">
      <div className="glow" style={{ width: 800, height: 400, background: "var(--accent)", bottom: -200, left: "30%", opacity: 0.2 }}></div>
      <div className="container">
        <div className="footer-grid" style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.4fr) repeat(4, minmax(0, 1fr))", gap: 40, marginBottom: 40 }}>
          <div>
            <Logo />
            <p style={{ fontSize: 13.5, color: "var(--bone-mid)", marginTop: 16, maxWidth: "30ch", lineHeight: 1.55 }}>
              {f.tagline}
            </p>
          </div>
          <FooterCol title={f.col_product} links={f.links_product} />
          <FooterCol title={f.col_resources} links={f.links_resources} />
          <FooterCol title={f.col_company} links={f.links_company} />
          <FooterCol title={f.col_legal} links={f.links_legal} />
        </div>

        <div className="footer-wordmark">TagWave.</div>

        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", fontFamily: "'JetBrains Mono', monospace", fontSize: 11, color: "var(--bone-mid)", paddingTop: 30, borderTop: "1px solid rgba(244,237,228,0.06)" }}>
          <span>{f.copyright}</span>
          <span>{f.build} <span style={{ color: "var(--accent)" }}>{f.build_color}</span>.</span>
          <span style={{ display: "flex", gap: 10, alignItems: "center" }}>
            {langs.map((l, i) => (
              <React.Fragment key={l.code}>
                {i > 0 && <span style={{ opacity: 0.3 }}>·</span>}
                <button
                  onClick={() => setLang(l.code)}
                  style={{
                    background: "none", border: "none", cursor: "pointer", padding: 0,
                    fontFamily: "'JetBrains Mono', monospace", fontSize: 11,
                    color: lang === l.code ? "var(--accent)" : "var(--bone-mid)",
                    fontWeight: lang === l.code ? 600 : 400,
                    letterSpacing: "0.08em",
                    transition: "color .2s",
                  }}
                >
                  {l.label}
                </button>
              </React.Fragment>
            ))}
          </span>
        </div>
      </div>
    </footer>
  );
}

function FooterCol({ title, links }) {
  return (
    <div>
      <div className="mono" style={{ fontSize: 10, color: "var(--bone-mid)", letterSpacing: "0.18em", textTransform: "uppercase", marginBottom: 14 }}>{title}</div>
      <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
        {links.map((l) => {
          const label = typeof l === "string" ? l : l.label;
          const href = typeof l === "string" ? "#" : l.href;
          return <a key={label} href={href} style={{ color: "var(--bone-dim)", textDecoration: "none", fontSize: 13.5 }}>{label}</a>;
        })}
      </div>
    </div>
  );
}

Object.assign(window, { TopNav, Hero, LogoStrip, Problem, SoftwareUI, Features, HowItWorks, StatBreak, Integrations, Pricing, Testimonials, FAQ, Footer });
