const { useState, useEffect, useRef } = React;

// ---------- Palettes ----------
const PALETTES = {
  "og-green": {
    label: "OG green",
    accent: "#58CC02", soft: "#7FDB2E", deep: "#3CA800", darker: "#2F8500",
    hot: "#6ADE0E", hot2: "#4AB600", rgb: "88,204,2",
    secondary: "#A88DFF", secondaryRgb: "168,141,255",
  },
  "lime-acid": {
    label: "Lime acid",
    accent: "#B8F000", soft: "#D4FF3A", deep: "#86B800", darker: "#5E8A00",
    hot: "#C8FF1A", hot2: "#9ED900", rgb: "184,240,0",
    secondary: "#FF8A3D", secondaryRgb: "255,138,61",
  },
  "deep-teal": {
    label: "Deep teal",
    accent: "#14B8A6", soft: "#5EEAD4", deep: "#0D9488", darker: "#0F766E",
    hot: "#2DD4BF", hot2: "#0F9B8E", rgb: "20,184,166",
    secondary: "#FBBF24", secondaryRgb: "251,191,36",
  },
  "matcha": {
    label: "Matcha",
    accent: "#8BB87A", soft: "#A8CE96", deep: "#6B9558", darker: "#557A44",
    hot: "#9AC687", hot2: "#779E63", rgb: "139,184,122",
    secondary: "#E8B871", secondaryRgb: "232,184,113",
  },
  "chartreuse": {
    label: "Electric chartreuse",
    accent: "#D4FF3A", soft: "#E5FF6B", deep: "#A8D600", darker: "#7FA600",
    hot: "#DEFF55", hot2: "#B8E500", rgb: "212,255,58",
    secondary: "#B794F6", secondaryRgb: "183,148,246",
  },
};

function applyPalette(key) {
  const p = PALETTES[key] || PALETTES["og-green"];
  const r = document.documentElement;
  r.style.setProperty("--accent", p.accent);
  r.style.setProperty("--accent-soft", p.soft);
  r.style.setProperty("--accent-deep", p.deep);
  r.style.setProperty("--accent-darker", p.darker);
  r.style.setProperty("--accent-hot", p.hot);
  r.style.setProperty("--accent-hot2", p.hot2);
  r.style.setProperty("--accent-rgb", p.rgb);
  r.style.setProperty("--secondary", p.secondary);
  r.style.setProperty("--secondary-rgb", p.secondaryRgb);
}

// ---------- Icons ----------
const Icon = {
  Play: (p) => <svg viewBox="0 0 24 24" fill="currentColor" {...p}><path d="M8 5v14l11-7z"/></svg>,
  ArrowRight: (p) => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <path d="M5 12h14M13 6l6 6-6 6"/>
    </svg>
  ),
  Flame: (p) => (
    <svg viewBox="0 0 24 24" fill="currentColor" {...p}>
      <path d="M12 2c1 4 4 5 4 9a4 4 0 1 1-8 0c0-2 1-3 1-5 1 1 2 1 3-4zm-1 13a2 2 0 0 0 2 2 2 2 0 0 0 2-2c0-1-1-2-2-3-1 1-2 2-2 3z"/>
    </svg>
  ),
  Check: (p) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 12l5 5L20 7"/></svg>,
  Lock: (p) => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>
    </svg>
  ),
  Menu: (p) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" {...p}><path d="M4 7h16M4 12h16M4 17h16"/></svg>,
  Close: (p) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" {...p}><path d="M6 6l12 12M18 6L6 18"/></svg>,
  Bolt: (p) => <svg viewBox="0 0 24 24" fill="currentColor" {...p}><path d="M13 2L4 14h6l-1 8 9-12h-6z"/></svg>,
  Trophy: (p) => (
    <svg viewBox="0 0 24 24" fill="currentColor" {...p}>
      <path d="M7 4h10v2h3v3a4 4 0 0 1-4 4v1a4 4 0 0 1-3 3.87V20h3v2H8v-2h3v-2.13A4 4 0 0 1 8 14v-1a4 4 0 0 1-4-4V6h3V4zm0 4H6v1a2 2 0 0 0 1 1.73V8zm10 0v2.73A2 2 0 0 0 18 9V8h-1z"/>
    </svg>
  ),
};

// ---------- Logo ----------
function Logo({ size = 28 }) {
  return (
    <div className="flex items-center gap-2">
      <svg width={size} height={size} viewBox="0 0 32 32" className="shrink-0">
        <defs>
          <linearGradient id="lg1" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0%" stopColor="var(--accent-soft)"/>
            <stop offset="100%" stopColor="var(--accent-deep)"/>
          </linearGradient>
        </defs>
        <rect x="2" y="2" width="28" height="28" rx="8" fill="url(#lg1)"/>
        <path d="M10 22 L16 10 L22 22 M12.5 18 H19.5" stroke="#0B0F14" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" fill="none"/>
      </svg>
      <span className="font-display text-[20px] font-bold tracking-tight text-white">arcai</span>
    </div>
  );
}

// ---------- Nav ----------
function Nav() {
  const [scrolled, setScrolled] = useState(false);
  const [open, setOpen] = useState(false);
  useEffect(() => {
    const on = () => setScrolled(window.scrollY > 10);
    on();
    window.addEventListener("scroll", on, { passive: true });
    return () => window.removeEventListener("scroll", on);
  }, []);
  const links = [
    { label: "Produk", href: "#produk" },
    { label: "Path", href: "#path" },
    { label: "Demo", href: "/mobile/" },
    { label: "Harga", href: "#harga" },
    { label: "FAQ", href: "#faq" },
  ];
  return (
    <header className={`sticky top-0 z-40 transition-all duration-300 ${scrolled ? "backdrop-blur-xl bg-[#0B0F14]/70 border-b border-white/5" : "backdrop-blur-md bg-transparent"}`}>
      <div className="max-w-[1280px] mx-auto px-5 md:px-8 h-[68px] flex items-center justify-between">
        <Logo />
        <nav className="hidden md:flex items-center gap-1">
          {links.map((l) => (
            <a key={l.label} href={l.href} className="px-4 py-2 text-[14px] text-white/70 hover:text-white rounded-lg transition-colors">{l.label}</a>
          ))}
        </nav>
        <div className="flex items-center gap-3">
          <a href="#" className="hidden sm:block text-[14px] text-white/70 hover:text-white transition-colors">Masuk</a>
          <a href="#waitlist" className="inline-flex items-center gap-1.5 font-semibold text-[14px] px-4 py-2 rounded-[10px] transition-all"
             style={{background:"var(--accent)", color:"#0B0F14", boxShadow:"0 2px 0 0 var(--accent-darker)"}}>
            Daftar Gratis
          </a>
          <button onClick={() => setOpen(!open)} className="md:hidden text-white/80 p-1" aria-label="menu">
            {open ? <Icon.Close width="22" height="22"/> : <Icon.Menu width="22" height="22"/>}
          </button>
        </div>
      </div>
      {open && (
        <div className="md:hidden border-t border-white/5 bg-[#0B0F14]/95 backdrop-blur-xl">
          <div className="px-5 py-3 flex flex-col">
            {links.map((l) => (
              <a key={l.label} href={l.href} onClick={() => setOpen(false)} className="py-3 text-[15px] text-white/80 border-b border-white/5 last:border-0">{l.label}</a>
            ))}
          </div>
        </div>
      )}
    </header>
  );
}

// ---------- Mascot ----------
function MascotOrb() {
  return (
    <svg viewBox="0 0 80 80" width="72" height="72">
      <defs>
        <radialGradient id="mg" cx="0.3" cy="0.3" r="0.9">
          <stop offset="0%" stopColor="var(--accent-soft)"/>
          <stop offset="100%" stopColor="var(--accent-deep)"/>
        </radialGradient>
      </defs>
      <ellipse cx="40" cy="72" rx="20" ry="3" fill="#000" opacity="0.25"/>
      <path d="M18 42c0-14 10-24 22-24s22 10 22 24c0 8-4 16-10 20-3 2-7 3-12 3s-9-1-12-3c-6-4-10-12-10-20z" fill="url(#mg)"/>
      <ellipse cx="32" cy="42" rx="4" ry="5" fill="#0B0F14"/>
      <ellipse cx="48" cy="42" rx="4" ry="5" fill="#0B0F14"/>
      <circle cx="33" cy="40" r="1.4" fill="#fff"/>
      <circle cx="49" cy="40" r="1.4" fill="#fff"/>
      <path d="M34 54c2 2 4 3 6 3s4-1 6-3" stroke="#0B0F14" strokeWidth="2.5" strokeLinecap="round" fill="none"/>
      <circle cx="26" cy="52" r="2" fill="#FF9AA2" opacity="0.7"/>
      <circle cx="54" cy="52" r="2" fill="#FF9AA2" opacity="0.7"/>
    </svg>
  );
}

// ---------- Phone screen ----------
function PhoneScreen({ showMascot }) {
  const paths = [
    { name: "AI Fundamentals", pct: 100, done: true },
    { name: "Prompt Engineering", pct: 64, current: true },
    { name: "Agents & MCP", pct: 0, locked: true },
  ];
  return (
    <div className="relative w-full h-full rounded-[40px] bg-gradient-to-b from-[#0E141B] to-[#0B0F14] overflow-hidden font-body">
      <div className="flex justify-between items-center px-7 pt-3 pb-1 text-[11px] text-white/80 font-semibold">
        <span>9:41</span>
        <div className="flex items-center gap-1">
          <svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor"><rect x="0" y="6" width="2" height="4" rx="0.5"/><rect x="3.5" y="4" width="2" height="6" rx="0.5"/><rect x="7" y="2" width="2" height="8" rx="0.5"/><rect x="10.5" y="0" width="2" height="10" rx="0.5"/></svg>
          <svg width="20" height="10" viewBox="0 0 20 10" fill="none" stroke="currentColor" strokeWidth="1"><rect x="0.5" y="0.5" width="16" height="9" rx="2"/><rect x="2" y="2" width="13" height="6" rx="1" fill="currentColor"/><rect x="17" y="3" width="1.5" height="4" rx="0.5" fill="currentColor"/></svg>
        </div>
      </div>
      <div className="px-5 pt-3 pb-4 flex items-center justify-between">
        <div>
          <div className="text-[10px] uppercase tracking-[0.14em] text-white/40">Selamat pagi</div>
          <div className="text-[17px] font-semibold text-white">Rizky 👋</div>
        </div>
        <div className="flex items-center gap-2">
          <div className="flex items-center gap-1 rounded-full px-2.5 py-1" style={{background:"rgba(255,107,26,0.15)", border:"1px solid rgba(255,107,26,0.3)"}}>
            <Icon.Flame width="12" height="12" className="text-[#FF8A3D]"/>
            <span className="text-[12px] font-bold text-[#FF8A3D]">12</span>
          </div>
          <div className="flex items-center gap-1 rounded-full px-2.5 py-1" style={{background:"rgba(var(--accent-rgb),0.15)", border:"1px solid rgba(var(--accent-rgb),0.3)"}}>
            <Icon.Bolt width="11" height="11" style={{color:"var(--accent-soft)"}}/>
            <span className="text-[12px] font-bold" style={{color:"var(--accent-soft)"}}>2,430</span>
          </div>
        </div>
      </div>
      <div className="mx-5 mb-4 rounded-2xl p-4 bg-gradient-to-br from-[#1A2430] to-[#11161D] border border-white/5 relative overflow-hidden">
        <div className="absolute -right-4 -top-4 w-24 h-24 rounded-full blur-2xl" style={{background:"rgba(var(--accent-rgb),0.2)"}}/>
        <div className="flex items-center justify-between mb-3">
          <span className="text-[10px] uppercase tracking-wider font-bold" style={{color:"var(--accent-soft)"}}>Pelajaran hari ini</span>
          <span className="text-[10px] text-white/40">Unit 3 · 8/12</span>
        </div>
        <div className="text-[15px] font-semibold text-white leading-snug mb-1">Few-shot prompting</div>
        <div className="text-[11px] text-white/50 mb-3">Kasih contoh biar AI nurut. 10 menit.</div>
        <div className="flex items-center gap-2">
          <div className="flex-1 h-1.5 bg-white/10 rounded-full overflow-hidden">
            <div className="h-full rounded-full" style={{width:"64%", background:"linear-gradient(to right, var(--accent), var(--accent-soft))"}}/>
          </div>
          <span className="text-[10px] font-semibold text-white/60">64%</span>
        </div>
      </div>
      <div className="px-5 space-y-2">
        <div className="text-[10px] uppercase tracking-[0.14em] text-white/40 px-1 mb-1">Learning path</div>
        {paths.map((p, i) => (
          <div key={i} className="flex items-center gap-3 rounded-xl px-3 py-2.5 border"
               style={p.current ? {background:"rgba(var(--accent-rgb),0.1)", borderColor:"rgba(var(--accent-rgb),0.3)"} : {background:"rgba(255,255,255,0.03)", borderColor:"rgba(255,255,255,0.05)"}}>
            <div className="w-8 h-8 rounded-full flex items-center justify-center shrink-0 text-[12px] font-bold"
                 style={p.done ? {background:"var(--accent)", color:"#0B0F14"} : p.current ? {background:"rgba(255,255,255,0.1)", color:"#fff"} : {background:"rgba(255,255,255,0.05)", color:"rgba(255,255,255,0.3)"}}>
              {p.done ? <Icon.Check width="14" height="14"/> : p.locked ? <Icon.Lock width="12" height="12"/> : i + 1}
            </div>
            <div className="flex-1 min-w-0">
              <div className={`text-[12px] font-semibold ${p.locked ? "text-white/40" : "text-white"}`}>{p.name}</div>
              <div className="text-[10px] text-white/40">{p.locked ? "Terkunci" : `${p.pct}% selesai`}</div>
            </div>
            {!p.locked && (
              <div className="w-10 h-1 bg-white/10 rounded-full overflow-hidden">
                <div className="h-full rounded-full" style={{width: `${p.pct}%`, background:"var(--accent)"}}/>
              </div>
            )}
          </div>
        ))}
      </div>
      {showMascot && (
        <div className="absolute bottom-6 left-1/2 -translate-x-1/2 flex items-end gap-2">
          <MascotOrb/>
          <div className="mb-4 bg-white/95 text-[#0B0F14] text-[11px] font-medium px-3 py-2 rounded-xl rounded-bl-sm max-w-[140px] shadow-xl">
            Ayo streak ke-13! Cuma 10 menit hari ini ✨
          </div>
        </div>
      )}
    </div>
  );
}

function PhoneMockup({ showMascot }) {
  return (
    <div className="relative w-[300px] h-[600px] md:w-[340px] md:h-[680px]" style={{
      transform: "perspective(1600px) rotateY(-8deg) rotateX(3deg) rotateZ(-1deg)",
      transformStyle: "preserve-3d",
    }}>
      <div className="absolute inset-0 rounded-[52px] bg-black/60 blur-3xl scale-90 translate-y-10 -z-10"/>
      <div className="relative w-full h-full rounded-[52px] bg-gradient-to-b from-[#2A3441] via-[#1A2028] to-[#0E131A] p-[3px]"
           style={{boxShadow:"0 50px 100px -20px rgba(0,0,0,0.9),0 30px 60px -30px rgba(var(--accent-rgb),0.25),inset 0 0 0 1px rgba(255,255,255,0.08)"}}>
        <div className="w-full h-full rounded-[49px] bg-[#0B0F14] overflow-hidden relative">
          <div className="absolute top-2 left-1/2 -translate-x-1/2 w-[100px] h-[26px] bg-black rounded-full z-20 flex items-center justify-end pr-3">
            <div className="w-2 h-2 rounded-full bg-[#1A2028] border border-white/5"/>
          </div>
          <PhoneScreen showMascot={showMascot}/>
        </div>
      </div>
    </div>
  );
}

// ---------- Floating cards ----------
function XPToast() {
  return (
    <div className="bg-[#11161D] rounded-xl px-3 py-2.5 flex items-center gap-2.5 backdrop-blur-xl"
         style={{border:"1px solid rgba(var(--accent-rgb),0.3)", boxShadow:"0 20px 50px -10px rgba(0,0,0,0.6), 0 0 30px -10px rgba(var(--accent-rgb),0.4)"}}>
      <div className="w-8 h-8 rounded-lg flex items-center justify-center" style={{background:"linear-gradient(to bottom right, var(--accent), var(--accent-deep))"}}>
        <Icon.Bolt width="16" height="16" className="text-[#0B0F14]"/>
      </div>
      <div>
        <div className="text-[13px] font-bold text-white leading-tight">+50 XP</div>
        <div className="text-[10px] text-white/50">Lesson selesai</div>
      </div>
    </div>
  );
}
function StreakChip() {
  return (
    <div className="bg-[#11161D] rounded-full pl-2 pr-3 py-1.5 flex items-center gap-2 backdrop-blur-xl"
         style={{border:"1px solid rgba(255,107,26,0.3)", boxShadow:"0 20px 50px -10px rgba(0,0,0,0.6), 0 0 30px -15px rgba(255,107,26,0.5)"}}>
      <div className="w-6 h-6 rounded-full bg-[#FF6B1A]/20 flex items-center justify-center">
        <Icon.Flame width="13" height="13" className="text-[#FF8A3D]"/>
      </div>
      <span className="text-[12px] font-bold text-white">Streak 12</span>
    </div>
  );
}
function BadgeCard() {
  return (
    <div className="bg-[#11161D]/95 border border-white/10 rounded-2xl p-3 shadow-[0_20px_50px_-10px_rgba(0,0,0,0.7)] backdrop-blur-xl w-[180px]">
      <div className="flex items-center gap-2 mb-2">
        <div className="w-9 h-9 rounded-xl flex items-center justify-center"
             style={{background:"linear-gradient(to bottom right, var(--secondary), rgba(var(--secondary-rgb),0.5))"}}>
          <Icon.Trophy width="17" height="17" className="text-white"/>
        </div>
        <div>
          <div className="text-[9px] uppercase tracking-wider font-bold" style={{color:"var(--secondary)"}}>Badge baru</div>
          <div className="text-[12px] font-semibold text-white leading-tight">Prompt Pro</div>
        </div>
      </div>
      <div className="text-[10px] text-white/50 leading-snug">Selesaikan 20 prompt engineering drills</div>
    </div>
  );
}

// ---------- Avatars ----------
function Avatars() {
  const palette = [["#FF8A3D", "RA"], ["var(--accent)", "BP"], ["#6BA4FF", "SI"], ["var(--secondary)", "DW"]];
  return (
    <div className="flex -space-x-2">
      {palette.map(([c, t], i) => (
        <div key={i} className="w-8 h-8 rounded-full ring-2 ring-[#0B0F14] flex items-center justify-center text-[10px] font-bold text-[#0B0F14]"
             style={{ background: c }}>{t}</div>
      ))}
    </div>
  );
}

// ---------- Hero ----------
function Hero({ glow, showMascot }) {
  return (
    <section className="relative overflow-hidden">
      <div className="pointer-events-none absolute top-[10%] right-[5%] rounded-full blur-[120px]"
           style={{width:"700px", height:"700px", background:`rgba(var(--accent-rgb),${0.15*glow})`}}/>
      <div className="pointer-events-none absolute top-[40%] left-[-10%] rounded-full blur-[120px]"
           style={{width:"500px", height:"500px", background:`rgba(var(--secondary-rgb),${0.08*glow})`}}/>

      <div className="max-w-[1280px] mx-auto px-5 md:px-8 pt-12 md:pt-20 pb-16 md:pb-24">
        <div className="grid grid-cols-1 lg:grid-cols-[1.4fr_1fr] gap-12 lg:gap-8 items-center">
          <div className="relative z-10">
            <div className="inline-flex items-center gap-2 bg-white/[0.04] border border-white/10 rounded-full pl-1 pr-3 py-1 mb-7 backdrop-blur">
              <span className="inline-flex items-center gap-1 text-[11px] font-bold px-2 py-0.5 rounded-full"
                    style={{background:"rgba(var(--accent-rgb),0.15)", color:"var(--accent-soft)"}}>
                <span className="w-1.5 h-1.5 rounded-full animate-pulse" style={{background:"var(--accent)"}}/>
                BETA
              </span>
              <span className="text-[12px] text-white/70 font-medium">Launch Juli 2026 — 423 di waiting list</span>
            </div>

            <h1 className="font-display font-bold text-white tracking-[-0.025em] leading-[1.02] text-[44px] sm:text-[52px] lg:text-[68px]">
              Belajar AI{" "}
              <span className="relative inline-block">
                <span className="relative z-10" style={{color:"var(--accent-soft)"}}>10 menit sehari</span>
                <span className="absolute left-0 right-0 bottom-[0.08em] h-[0.18em] -skew-x-6 z-0" style={{background:"rgba(var(--accent-rgb),0.25)"}}/>
              </span>
              .<br/>
              Dari ChatGPT sampai bikin <span className="italic font-light text-white/90">agent</span> sendiri.
            </h1>

            <p className="mt-6 text-[16px] md:text-[18px] leading-[1.6] text-white/65 max-w-[560px]">
              Platform micro-learning gaya game — dalam Bahasa Indonesia. 5 path belajar, streak harian, tantangan nyata yang langsung bisa lu terapin di kerjaan.
            </p>

            <div className="mt-8 flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
              <a href="#waitlist" className="group relative inline-flex items-center justify-center gap-2 font-bold text-[15px] px-6 h-[54px] rounded-2xl transition-all duration-100"
                 style={{background:"linear-gradient(to bottom, var(--accent-hot), var(--accent-hot2))", color:"#0B0F14",
                         boxShadow:"0 3px 0 0 var(--accent-darker), 0 8px 24px -8px rgba(var(--accent-rgb),0.6), inset 0 1px 0 rgba(255,255,255,0.4)"}}>
                Gabung Waiting List
                <Icon.ArrowRight width="18" height="18" className="group-hover:translate-x-0.5 transition-transform"/>
              </a>
              <a href="/mobile/" className="group inline-flex items-center justify-center gap-2 text-white/80 hover:text-white font-medium text-[15px] px-5 h-[54px] rounded-2xl border border-white/10 hover:border-white/20 hover:bg-white/[0.03] transition-all">
                <span className="w-7 h-7 rounded-full bg-white/10 group-hover:bg-white/15 flex items-center justify-center transition-colors">
                  <Icon.Play width="10" height="10" className="translate-x-[1px]"/>
                </span>
                Liat demo app
              </a>
            </div>

            <div className="mt-8 flex items-center gap-3">
              <Avatars/>
              <div className="text-[13px] text-white/55 leading-[1.45]">
                <span className="text-white/80 font-medium">423 profesional</span> udah gabung dari<br className="hidden sm:block"/>
                <span className="text-white/70">Telkomsel · Tokopedia · Mandiri · Gojek</span>
              </div>
            </div>
          </div>

          <div className="relative flex items-center justify-center lg:justify-end min-h-[620px] lg:min-h-[720px]">
            <div className="relative">
              <PhoneMockup showMascot={showMascot}/>
              <div className="absolute -left-16 top-24 hidden sm:block animate-[float_6s_ease-in-out_infinite]"><XPToast/></div>
              <div className="absolute -right-8 top-[30%] hidden sm:block animate-[float_7s_ease-in-out_infinite]" style={{animationDelay:"-2s"}}><StreakChip/></div>
              <div className="absolute -left-12 bottom-24 hidden md:block animate-[float_8s_ease-in-out_infinite]" style={{animationDelay:"-4s"}}><BadgeCard/></div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Trusted ----------
function TrustedStrip() {
  const companies = ["NUSANET", "ARTAJAYA", "KAWANKU", "RIMBATECH", "SAWALA", "GRANTRA"];
  return (
    <section className="border-y border-white/5 bg-white/[0.015]">
      <div className="max-w-[1280px] mx-auto px-5 md:px-8 py-8">
        <div className="flex flex-col md:flex-row items-center gap-6 md:gap-10">
          <div className="text-[11px] uppercase tracking-[0.2em] text-white/40 shrink-0 text-center md:text-left">Dipercaya oleh tim di</div>
          <div className="flex flex-wrap items-center justify-center gap-x-8 gap-y-4 md:gap-x-10">
            {companies.map((c, i) => (
              <div key={i} className="text-white/40 hover:text-white/70 transition-colors font-display font-bold text-[14px] tracking-[0.15em]">{c}</div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Problems ----------
function Problems() {
  const items = [
    { emoji: "😵‍💫", title: "Overwhelmed sama AI jargon", body: "RAG, MCP, fine-tuning, embedding — pusing duluan sebelum mulai." },
    { emoji: "📚", title: "Bootcamp 3 bulan kelamaan", body: "Kerjaan udah nunggu. Lu butuh skill yang bisa dipake minggu depan." },
    { emoji: "🌊", title: "YouTube tutorial acak", body: "Loncat-loncat topik, nggak ada progress nyata, lupa besoknya." },
  ];
  return (
    <section className="relative py-20 md:py-28">
      <div className="max-w-[1280px] mx-auto px-5 md:px-8">
        <div className="max-w-[720px] mb-12 md:mb-16">
          <div className="text-[11px] uppercase tracking-[0.2em] font-semibold mb-4" style={{color:"var(--accent-soft)"}}>Masalahnya</div>
          <h2 className="font-display font-bold text-white text-[36px] md:text-[48px] leading-[1.05] tracking-[-0.02em]">
            Belajar AI sekarang rasanya kayak<br/>
            <span className="text-white/40">minum dari selang pemadam.</span>
          </h2>
        </div>
        <div className="grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-5">
          {items.map((it, i) => (
            <div key={i} className="group relative rounded-2xl p-6 md:p-7 bg-gradient-to-b from-white/[0.04] to-white/[0.015] border border-white/5 hover:border-white/10 transition-colors">
              <div className="text-[42px] mb-4 leading-none">{it.emoji}</div>
              <div className="font-display font-bold text-white text-[19px] leading-tight mb-2">{it.title}</div>
              <div className="text-[14px] text-white/55 leading-[1.55]">{it.body}</div>
              <div className="absolute top-5 right-5 text-[11px] font-mono text-white/25">0{i+1}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Stat ----------
function StatStrip({ glow }) {
  return (
    <section className="relative py-20 md:py-28 border-t border-white/5">
      <div className="absolute inset-0 pointer-events-none">
        <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full blur-[120px]"
             style={{width:"900px", height:"500px", background:`rgba(var(--accent-rgb),${0.05*glow})`}}/>
      </div>
      <div className="relative max-w-[1100px] mx-auto px-5 md:px-8 text-center">
        <div className="text-[11px] uppercase tracking-[0.2em] font-semibold mb-6" style={{color:"var(--accent-soft)"}}>The gap</div>
        <p className="font-display font-bold text-white text-[32px] md:text-[52px] leading-[1.1] tracking-[-0.02em]">
          <span style={{color:"var(--accent-soft)"}}>92%</span> knowledge worker Indonesia udah pakai GenAI.<br className="hidden md:block"/>
          Cuma <span className="text-white">18%</span> yang tau cara pakai <span className="italic font-light">MCP</span> atau <span className="italic font-light">agent</span>.
        </p>
        <div className="mt-8 inline-flex items-center gap-2 rounded-full px-5 py-2"
             style={{background:"rgba(var(--accent-rgb),0.1)", border:"1px solid rgba(var(--accent-rgb),0.25)"}}>
          <span className="w-1.5 h-1.5 rounded-full" style={{background:"var(--accent)"}}/>
          <span className="text-[13px] font-semibold" style={{color:"var(--accent-soft)"}}>Arcai close that gap.</span>
        </div>
        <div className="mt-14 grid grid-cols-3 gap-4 md:gap-8 max-w-[720px] mx-auto">
          {[["10", "menit/hari"], ["5", "learning paths"], ["90+", "real challenges"]].map(([n, l], i) => (
            <div key={i} className="text-center">
              <div className="font-display font-bold text-white text-[40px] md:text-[56px] leading-none tracking-[-0.02em]">{n}</div>
              <div className="text-[11px] uppercase tracking-[0.15em] text-white/45 mt-2">{l}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Footer CTA ----------
function FooterCTA({ glow }) {
  const [email, setEmail] = useState("");
  const [submitted, setSubmitted] = useState(false);
  return (
    <section id="waitlist" className="relative py-24 md:py-32 border-t border-white/5">
      <div className="absolute inset-0 pointer-events-none overflow-hidden">
        <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full blur-[140px]"
             style={{width:"1000px", height:"600px", background:`rgba(var(--accent-rgb),${0.1*glow})`}}/>
      </div>
      <div className="relative max-w-[760px] mx-auto px-5 md:px-8 text-center">
        <h2 className="font-display font-bold text-white text-[40px] md:text-[64px] leading-[1.02] tracking-[-0.025em]">
          Siap jadi <span style={{color:"var(--accent-soft)"}}>top 18%</span>?
        </h2>
        <p className="mt-5 text-[16px] md:text-[18px] text-white/60 max-w-[520px] mx-auto leading-[1.55]">
          Daftar waiting list. Dapet early access Juli 2026 + 3 bulan Pro gratis buat 500 pertama.
        </p>
        {!submitted ? (
          <form onSubmit={(e) => { e.preventDefault(); if (email) setSubmitted(true); }}
                className="mt-8 flex flex-col sm:flex-row gap-3 max-w-[480px] mx-auto">
            <input type="email" required value={email} onChange={(e) => setEmail(e.target.value)} placeholder="email@kamu.id"
                   className="flex-1 h-[54px] px-5 rounded-2xl bg-white/[0.04] border border-white/10 text-white placeholder:text-white/30 text-[15px] focus:outline-none transition-colors"
                   style={{"--tw-border-opacity":1}}/>
            <button type="submit" className="h-[54px] inline-flex items-center justify-center gap-2 font-bold text-[15px] px-6 rounded-2xl transition-all duration-100"
                    style={{background:"linear-gradient(to bottom, var(--accent-hot), var(--accent-hot2))", color:"#0B0F14",
                            boxShadow:"0 3px 0 0 var(--accent-darker), 0 8px 24px -8px rgba(var(--accent-rgb),0.6), inset 0 1px 0 rgba(255,255,255,0.4)"}}>
              Gabung <Icon.ArrowRight width="18" height="18"/>
            </button>
          </form>
        ) : (
          <div className="mt-8 inline-flex items-center gap-3 rounded-2xl px-5 py-4 max-w-[480px] mx-auto"
               style={{background:"rgba(var(--accent-rgb),0.1)", border:"1px solid rgba(var(--accent-rgb),0.3)"}}>
            <div className="w-8 h-8 rounded-full flex items-center justify-center" style={{background:"var(--accent)"}}>
              <Icon.Check width="16" height="16" className="text-[#0B0F14]"/>
            </div>
            <div className="text-left">
              <div className="text-[14px] font-semibold text-white">Sampai ketemu di Juli!</div>
              <div className="text-[12px] text-white/50">Cek email buat konfirmasi.</div>
            </div>
          </div>
        )}
        <div className="mt-6 text-[12px] text-white/40">Gratis selamanya · No credit card · Unsubscribe kapan aja</div>
      </div>
    </section>
  );
}

// ---------- Footer ----------
function Footer() {
  return (
    <footer className="border-t border-white/5 py-10">
      <div className="max-w-[1280px] mx-auto px-5 md:px-8 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
        <Logo size={24}/>
        <div className="flex flex-wrap gap-x-6 gap-y-2 text-[13px] text-white/50">
          <a href="#" className="hover:text-white/80">Privacy</a>
          <a href="#" className="hover:text-white/80">Terms</a>
          <a href="#" className="hover:text-white/80">Contact</a>
          <a href="#" className="hover:text-white/80">Jakarta, ID</a>
        </div>
        <div className="text-[12px] text-white/30">© 2026 arcai</div>
      </div>
    </footer>
  );
}

// ---------- App ----------
function App() {
  const [t, setTweak] = useTweaks(window.TWEAK_DEFAULTS);

  useEffect(() => { applyPalette(t.palette); }, [t.palette]);

  return (
    <div className="min-h-screen bg-[#0B0F14] text-white font-body relative">
      {t.grid && (
        <div className="pointer-events-none fixed inset-0 opacity-[0.08] z-0" style={{
          backgroundImage: `linear-gradient(to right, #fff 1px, transparent 1px), linear-gradient(to bottom, #fff 1px, transparent 1px)`,
          backgroundSize: "56px 56px",
          maskImage: "radial-gradient(ellipse at center, black 40%, transparent 85%)",
          WebkitMaskImage: "radial-gradient(ellipse at center, black 40%, transparent 85%)",
        }}/>
      )}
      <div className="pointer-events-none fixed inset-0 opacity-[0.035] z-0 mix-blend-overlay" style={{
        backgroundImage: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")`,
      }}/>

      <div className="relative z-10">
        <Nav/>
        <Hero glow={t.glow} showMascot={t.mascot}/>
        <TrustedStrip/>
        <Problems/>
        <StatStrip glow={t.glow}/>
        <FooterCTA glow={t.glow}/>
        <Footer/>
      </div>

      <TweaksPanel title="Tweaks">
        <TweakSection label="Palette"/>
        <TweakRadio
          label="Accent"
          value={t.palette}
          options={[
            { value: "og-green", label: "OG green" },
            { value: "lime-acid", label: "Lime acid" },
            { value: "deep-teal", label: "Deep teal" },
            { value: "matcha", label: "Matcha" },
            { value: "chartreuse", label: "Chartreuse" },
          ]}
          onChange={(v) => setTweak("palette", v)}
        />
        <TweakSection label="Atmosphere"/>
        <TweakSlider label="Glow intensity" value={t.glow} min={0} max={2} step={0.1} onChange={(v) => setTweak("glow", v)}/>
        <TweakToggle label="Grid background" value={t.grid} onChange={(v) => setTweak("grid", v)}/>
        <TweakToggle label="Mascot on phone" value={t.mascot} onChange={(v) => setTweak("mascot", v)}/>
      </TweaksPanel>
    </div>
  );
}

// Expose TWEAK_DEFAULTS from inline script to this scope
window.TWEAK_DEFAULTS = window.TWEAK_DEFAULTS || {palette:"lime-acid", glow:1, grid:true, mascot:true};
// init palette immediately so first paint matches
applyPalette(window.TWEAK_DEFAULTS.palette);

ReactDOM.createRoot(document.getElementById("root")).render(<App/>);
