/* Vito's Wings — AI Lab screen */

function ScreenAI({ lang, openItem }) {
  const [tab, setTab] = useState("pair");

  const tabs = [
    { id: "pair",    k: "ai_pair",    icon: "↔" },
    { id: "combo",   k: "ai_combo",   icon: "▣" },
    { id: "voice",   k: "ai_voice",   icon: "🎙" },
    { id: "predict", k: "ai_loyalty", icon: "★" },
  ];

  return (
    <section style={{ padding: "60px 6vw 100px" }}>
      <SectionHeader kicker={t("ai_title", lang)} title={lang === "es" ? "Un menú que te conoce." : "A menu that knows you."} sub={t("ai_sub", lang)} />

      {/* Tabs */}
      <div style={{ display: "flex", gap: 0, border: "1px solid #0A0A0A", marginBottom: 32, flexWrap: "wrap" }}>
        {tabs.map((tb, i) => (
          <button key={tb.id} onClick={() => setTab(tb.id)} style={{
            flex: "1 1 200px",
            appearance: "none", border: 0,
            borderRight: i < tabs.length - 1 ? "1px solid #0A0A0A" : "none",
            background: tab === tb.id ? "#0A0A0A" : "#F6F4EF",
            color: tab === tb.id ? "#F6F4EF" : "#0A0A0A",
            padding: "20px 18px", cursor: "pointer",
            display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 6,
            textAlign: "left",
          }}>
            <span style={{ fontSize: 24, color: tab === tb.id ? "#E63426" : "#E63426" }}>{tb.icon}</span>
            <span style={{ fontFamily: "'Anton', sans-serif", fontSize: 18, letterSpacing: "0.08em" }}>{t(tb.k, lang).toUpperCase()}</span>
          </button>
        ))}
      </div>

      {tab === "pair" && <PairTab lang={lang} />}
      {tab === "combo" && <ComboTab lang={lang} openItem={openItem} />}
      {tab === "voice" && <VoiceTab lang={lang} />}
      {tab === "predict" && <PredictTab lang={lang} />}
    </section>
  );
}

// ---------- Pairing Assistant ----------
function PairTab({ lang }) {
  const [mood, setMood] = useState("");
  const [loading, setLoading] = useState(false);
  const [result, setResult] = useState(null);

  const prompts = lang === "es"
    ? ["Tengo ganas de algo picante", "Algo dulce y crujiente", "Una orden para 2 con cerveza", "Solo, después del gym, sin guilt", "Para impresionar a alguien"]
    : ["I want something spicy", "Sweet and crispy", "An order for 2 with beer", "Solo, post-gym, no guilt", "Trying to impress a date"];

  async function ask(text) {
    setMood(text);
    setLoading(true);
    setResult(null);
    try {
      const menuSummary = window.VW_MENU.map(c => `${c.en}: ${c.items.map(i => i.en).join(", ")}`).join(". ");
      const sauceList = window.VW_SAUCES.map(s => s.en).join(", ");
      const language = lang === "es" ? "Spanish" : "English";
      const reply = await window.claude.complete({
        messages: [{
          role: "user",
          content: `You are the pairing assistant for Vito's Wings, a wing restaurant in Tegucigalpa, Honduras. The customer says: "${text}". 

Pick ONE main item, ONE sauce, ONE side, and ONE drink from this menu. Sauces: ${sauceList}. Menu: ${menuSummary}.

Reply in ${language}. Be playful and confident. Format as strict JSON only, no markdown:
{"main": "...", "sauce": "...", "side": "...", "drink": "...", "why": "one short sentence in ${language} explaining the vibe"}`
        }]
      });
      // Extract JSON
      const m = reply.match(/\{[\s\S]*\}/);
      if (m) {
        const parsed = JSON.parse(m[0]);
        setResult(parsed);
      } else {
        setResult({ why: reply, main: "—", sauce: "—", side: "—", drink: "—" });
      }
    } catch (e) {
      setResult({
        main: "Wings 9 pcs", sauce: "Lemon Pepper", side: "Truffled Fries", drink: "Mint Lemonade",
        why: lang === "es" ? "(Demo) Una combinación segura y rica." : "(Demo) A safe, delicious combo."
      });
    }
    setLoading(false);
  }

  return (
    <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 32 }} className="vw-2col">
      <div>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426", marginBottom: 12, fontWeight: 700 }}>▌ {lang === "es" ? "DINOS QUÉ SE TE ANTOJA" : "TELL US WHAT YOU'RE CRAVING"}</div>
        <h3 style={{ fontFamily: "'Anton', sans-serif", fontSize: 42, lineHeight: 0.95, margin: 0 }}>{lang === "es" ? "TE ARMAMOS LA ORDEN." : "WE'LL BUILD THE ORDER."}</h3>
        <p style={{ marginTop: 14, fontSize: 14, lineHeight: 1.6, color: "rgba(10,10,10,0.75)" }}>
          {lang === "es"
            ? "Escribe el mood, el hambre o la situación. Sugerimos plato, salsa, acompañamiento y bebida que pegan."
            : "Type the mood, the hunger, or the situation. We suggest a dish, sauce, side, and drink that pair."}
        </p>

        <div style={{ marginTop: 16, display: "flex", flexWrap: "wrap", gap: 8 }}>
          {prompts.map(p => (
            <button key={p} onClick={() => ask(p)} style={{
              appearance: "none", border: "1px solid #0A0A0A", background: "transparent",
              padding: "8px 12px", fontSize: 13, cursor: "pointer", color: "#0A0A0A",
              fontFamily: "'DM Sans', sans-serif",
            }}>{p}</button>
          ))}
        </div>

        <form onSubmit={e => { e.preventDefault(); if (mood.trim()) ask(mood); }} style={{ marginTop: 16, display: "flex", gap: 0 }}>
          <input value={mood} onChange={e => setMood(e.target.value)} placeholder={lang === "es" ? "ej: hambre + lluvia afuera" : "e.g. starving + raining outside"} style={{
            flex: 1, border: "1px solid #0A0A0A", padding: "14px 16px", background: "#F6F4EF",
            fontFamily: "'DM Sans', sans-serif", fontSize: 15, outline: "none",
          }} />
          <button type="submit" disabled={loading} style={{
            appearance: "none", border: 0, background: "#E63426", color: "#F6F4EF",
            padding: "14px 22px", fontFamily: "'Anton', sans-serif", letterSpacing: "0.14em", cursor: "pointer",
            opacity: loading ? 0.5 : 1,
          }}>{loading ? "..." : (lang === "es" ? "PAIRING →" : "PAIR →")}</button>
        </form>
      </div>

      <div style={{ background: "#0A0A0A", color: "#F6F4EF", padding: 28, minHeight: 360, display: "flex", flexDirection: "column" }}>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426" }}>▌ {lang === "es" ? "RECOMENDACIÓN" : "RECOMMENDATION"}</div>

        {loading ? (
          <div style={{ flex: 1, display: "flex", alignItems: "center", justifyContent: "center", flexDirection: "column", gap: 16 }}>
            <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 32, letterSpacing: "0.06em" }}>
              <span style={{ animation: "vwBlink 1s infinite" }}>●</span>
              <span style={{ animation: "vwBlink 1s infinite 0.2s", marginLeft: 6 }}>●</span>
              <span style={{ animation: "vwBlink 1s infinite 0.4s", marginLeft: 6 }}>●</span>
            </div>
            <div style={{ fontSize: 12, letterSpacing: "0.2em", opacity: 0.6 }}>{lang === "es" ? "VITO ESTÁ PENSANDO..." : "VITO IS THINKING..."}</div>
          </div>
        ) : result ? (
          <div style={{ flex: 1, display: "flex", flexDirection: "column", gap: 14, marginTop: 16 }}>
            {[
              { k: lang === "es" ? "PLATO" : "MAIN", v: result.main },
              { k: lang === "es" ? "SALSA" : "SAUCE", v: result.sauce },
              { k: lang === "es" ? "ACOMPAÑAR" : "SIDE", v: result.side },
              { k: lang === "es" ? "BEBIDA" : "DRINK", v: result.drink },
            ].map(r => (
              <div key={r.k} style={{ display: "flex", alignItems: "baseline", gap: 12, paddingBottom: 12, borderBottom: "1px dashed rgba(246,244,239,0.2)" }}>
                <div style={{ fontFamily: "'Anton', sans-serif", letterSpacing: "0.22em", fontSize: 11, color: "rgba(246,244,239,0.6)", width: 100 }}>{r.k}</div>
                <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 22, color: "#E63426", flex: 1 }}>{r.v}</div>
              </div>
            ))}
            <p style={{ marginTop: 8, fontSize: 14, lineHeight: 1.6, fontStyle: "italic", color: "rgba(246,244,239,0.85)" }}>"{result.why}"</p>
          </div>
        ) : (
          <div style={{ flex: 1, display: "flex", alignItems: "center", justifyContent: "center", textAlign: "center", color: "rgba(246,244,239,0.5)", fontSize: 13, letterSpacing: "0.16em" }}>
            {lang === "es" ? "DINOS QUÉ ANTOJO..." : "TELL US YOUR CRAVING..."}
          </div>
        )}
      </div>
    </div>
  );
}

// ---------- Combo Builder ----------
function ComboTab({ lang, openItem }) {
  const [pax, setPax] = useState(2);
  const [budget, setBudget] = useState(600);
  const [vibe, setVibe] = useState("share");

  // build a combo from constraints
  const combo = useMemo(() => {
    const wings = window.VW_MENU[0].items[0]; // alitas
    const boneless = window.VW_MENU[0].items[1];
    const burger = window.VW_MENU.find(c => c.id === "burgers").items[1]; // vitos
    const fries = window.VW_MENU[1].items[1]; // papas
    const loaded = window.VW_MENU[1].items[2];
    const sangria = window.VW_MENU.find(c => c.id === "drinks").items.find(i => i.id === "sang");
    const lim = window.VW_MENU.find(c => c.id === "drinks").items.find(i => i.id === "lim");

    let lines = [];
    if (vibe === "share") {
      const wingSize = pax >= 4 ? 12 : pax >= 2 ? 9 : 6;
      const s = wings.sizes.find(s => +s.k === wingSize);
      lines.push({ name: `${wings[lang]} ${s.k}`, price: s.p });
      if (budget >= 350 && pax >= 2) lines.push({ name: loaded[lang], price: loaded.price });
      else lines.push({ name: fries[lang], price: fries.price });
      for (let i = 0; i < Math.min(pax, 4); i++) lines.push({ name: lim[lang], price: lim.price });
    } else if (vibe === "burger") {
      for (let i = 0; i < pax; i++) lines.push({ name: burger[lang], price: burger.price });
      lines.push({ name: fries[lang], price: fries.price });
      const tendSize = pax <= 1 ? 4 : 6;
      const t = window.VW_MENU[0].items[2].sizes.find(s => +s.k === tendSize);
      if (budget >= 500) lines.push({ name: `Tenders ${t.k}`, price: t.p });
    } else { // saucy tour
      const al = wings.sizes[1];
      const bn = boneless.sizes[0];
      lines.push({ name: `${wings[lang]} ${al.k}`, price: al.p });
      lines.push({ name: `${boneless[lang]} ${bn.k}`, price: bn.p });
      if (budget >= 700) lines.push({ name: sangria[lang], price: sangria.price });
      lines.push({ name: lim[lang], price: lim.price });
    }
    const total = lines.reduce((s, l) => s + l.price, 0);
    return { lines, total };
  }, [pax, budget, vibe, lang]);

  return (
    <div style={{ display: "grid", gridTemplateColumns: "1fr 1.1fr", gap: 32 }} className="vw-2col">
      <div>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426", marginBottom: 12 }}>▌ {lang === "es" ? "DINOS EL ESCENARIO" : "TELL US THE SCENE"}</div>

        <div style={{ marginBottom: 24 }}>
          <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.2em", marginBottom: 10 }}>{lang === "es" ? "PERSONAS" : "GUESTS"}</div>
          <div style={{ display: "flex", gap: 8 }}>
            {[1, 2, 4, 6].map(n => (
              <button key={n} onClick={() => setPax(n)} style={{
                flex: 1, appearance: "none",
                border: pax === n ? "2px solid #E63426" : "1px solid #0A0A0A",
                background: pax === n ? "#E63426" : "transparent",
                color: pax === n ? "#F6F4EF" : "#0A0A0A",
                padding: "16px", cursor: "pointer",
                fontFamily: "'Anton', sans-serif", fontSize: 28, lineHeight: 1,
              }}>{n}</button>
            ))}
          </div>
        </div>

        <div style={{ marginBottom: 24 }}>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 10 }}>
            <span style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.2em" }}>{lang === "es" ? "PRESUPUESTO" : "BUDGET"}</span>
            <span style={{ fontFamily: "'Anton', sans-serif", fontSize: 26, color: "#E63426" }}>{fmtL(budget)}</span>
          </div>
          <input type="range" min="250" max="1500" step="50" value={budget} onChange={e => setBudget(parseInt(e.target.value, 10))} style={{ width: "100%", accentColor: "#E63426" }} />
        </div>

        <div>
          <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.2em", marginBottom: 10 }}>{lang === "es" ? "VIBE" : "VIBE"}</div>
          <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
            {[
              { id: "share",  en: "Wings to share", es: "Alitas para compartir" },
              { id: "burger", en: "Burgers + sides", es: "Burgers + acompañar" },
              { id: "tour",   en: "Saucy tour (try multiple sauces)", es: "Tour de salsas (probar varias)" },
            ].map(v => (
              <button key={v.id} onClick={() => setVibe(v.id)} style={{
                appearance: "none", textAlign: "left",
                border: vibe === v.id ? "2px solid #E63426" : "1px solid #0A0A0A",
                background: vibe === v.id ? "rgba(230,52,38,0.06)" : "transparent",
                padding: "12px 16px", cursor: "pointer", fontSize: 14, fontFamily: "'DM Sans', sans-serif", color: "#0A0A0A",
              }}>{v[lang]}</button>
            ))}
          </div>
        </div>
      </div>

      <div style={{ background: "#F1ECDD", border: "1px solid #0A0A0A", padding: 28 }}>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426" }}>▌ {lang === "es" ? "TU COMBO" : "YOUR COMBO"}</div>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 56, lineHeight: 0.9, letterSpacing: "-0.01em", marginTop: 8 }}>
          {fmtL(combo.total)}
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 8, marginTop: 4 }}>
          <div style={{ fontSize: 12, letterSpacing: "0.18em", color: combo.total <= budget ? "#0A0A0A" : "#E63426" }}>
            {combo.total <= budget
              ? (lang === "es" ? `↓ ${fmtL(budget - combo.total)} BAJO PRESUPUESTO` : `↓ ${fmtL(budget - combo.total)} UNDER BUDGET`)
              : (lang === "es" ? `↑ ${fmtL(combo.total - budget)} SOBRE PRESUPUESTO` : `↑ ${fmtL(combo.total - budget)} OVER BUDGET`)}
          </div>
        </div>

        <div style={{ marginTop: 22, display: "flex", flexDirection: "column", gap: 0 }}>
          {combo.lines.map((l, i) => (
            <div key={i} style={{ display: "flex", justifyContent: "space-between", padding: "12px 0", borderBottom: i < combo.lines.length - 1 ? "1px dashed rgba(10,10,10,0.25)" : "none", fontSize: 14 }}>
              <span>{l.name}</span>
              <span style={{ fontFamily: "'Anton', sans-serif", color: "#E63426" }}>{fmtL(l.price)}</span>
            </div>
          ))}
        </div>

        <div style={{ marginTop: 18 }}>
          <PrimaryBtn full big onClick={() => alert(lang === "es" ? "Combo agregado al pedido (demo)" : "Combo added to cart (demo)")}>{lang === "es" ? "AGREGAR COMBO AL PEDIDO" : "ADD COMBO TO ORDER"} →</PrimaryBtn>
        </div>
      </div>
    </div>
  );
}

// ---------- Voice Ordering ----------
function VoiceTab({ lang }) {
  const [recording, setRecording] = useState(false);
  const [transcript, setTranscript] = useState("");
  const [parsed, setParsed] = useState(null);

  const samples = lang === "es"
    ? ["nueve alitas, lemon pepper, papas, limonada", "vito's burger con tocino extra, sin cebolla", "para dos: 14 alitas mitad bbq mitad hot honey, sangría"]
    : ["nine wings, lemon pepper, fries, lemonade", "vito's burger with extra bacon, no onion", "para dos: 14 wings half bbq half hot honey, sangria"];

  function simulate(text) {
    setRecording(true);
    setTranscript("");
    setParsed(null);
    let i = 0;
    const id = setInterval(() => {
      i += Math.max(1, Math.floor(Math.random() * 3));
      setTranscript(text.slice(0, i));
      if (i >= text.length) {
        clearInterval(id);
        setTimeout(() => {
          setRecording(false);
          // basic parse
          const items = [];
          const lower = text.toLowerCase();
          if (lower.match(/9|nine|nueve/)) items.push({ name: lang === "es" ? "Alitas (9 und)" : "Wings (9 pcs)", price: 280 });
          if (lower.match(/14/)) items.push({ name: lang === "es" ? "Vito's Para Dos" : "Vito's Para Dos", price: 540 });
          if (lower.match(/burger/)) items.push({ name: "Vito's Burger", price: 280 });
          if (lower.match(/lemon pepper/)) items.push({ name: "+ Lemon Pepper", price: 0 });
          if (lower.match(/bbq/)) items.push({ name: "+ BBQ", price: 0 });
          if (lower.match(/hot honey/)) items.push({ name: "+ Hot Honey", price: 0 });
          if (lower.match(/papas|fries/)) items.push({ name: lang === "es" ? "Papas Fritas" : "Fries", price: 160 });
          if (lower.match(/limonada|lemonade/)) items.push({ name: lang === "es" ? "Limonada" : "Lemonade", price: 65 });
          if (lower.match(/sangr[ií]a/)) items.push({ name: lang === "es" ? "Sangría" : "Sangria", price: 145 });
          if (items.length === 0) items.push({ name: "—", price: 0 });
          setParsed({ items, total: items.reduce((s, i) => s + i.price, 0) });
        }, 400);
      }
    }, 60);
  }

  return (
    <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 32 }} className="vw-2col">
      <div>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426", marginBottom: 12 }}>▌ {lang === "es" ? "ORDENA EN VOZ ALTA" : "ORDER OUT LOUD"}</div>
        <h3 style={{ fontFamily: "'Anton', sans-serif", fontSize: 42, lineHeight: 0.95, margin: 0 }}>{lang === "es" ? "MANOS SUCIAS? HABLA." : "GREASY HANDS? JUST SAY IT."}</h3>
        <p style={{ marginTop: 14, fontSize: 14, lineHeight: 1.6, color: "rgba(10,10,10,0.75)" }}>
          {lang === "es"
            ? "El asistente entiende mezcla de español e inglés (porque así pedimos en Tegus). Toca una frase de ejemplo para verlo en acción."
            : "The assistant understands Spanglish (because that's how we order in Tegus). Tap a sample phrase to see it run."}
        </p>

        <div style={{ marginTop: 24, display: "flex", justifyContent: "center" }}>
          <button onClick={() => simulate(samples[0])} disabled={recording} style={{
            width: 140, height: 140, borderRadius: "50%",
            appearance: "none", border: "3px solid #0A0A0A",
            background: recording ? "#E63426" : "#F6F4EF",
            color: recording ? "#F6F4EF" : "#0A0A0A",
            cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center",
            fontSize: 56, transition: "all 0.2s",
            boxShadow: recording ? "0 0 0 12px rgba(230,52,38,0.2)" : "none",
            animation: recording ? "vwPulse 1.4s ease-in-out infinite" : "none",
          }}>🎙</button>
        </div>

        <div style={{ marginTop: 20, display: "flex", flexWrap: "wrap", gap: 8 }}>
          {samples.map((s, i) => (
            <button key={i} onClick={() => simulate(s)} disabled={recording} style={{
              appearance: "none", border: "1px solid #0A0A0A", background: "transparent",
              padding: "8px 12px", fontSize: 12, cursor: "pointer", color: "#0A0A0A", fontFamily: "'DM Sans', sans-serif",
              fontStyle: "italic",
            }}>"{s.slice(0, 40)}{s.length > 40 ? "..." : ""}"</button>
          ))}
        </div>
      </div>

      <div style={{ background: "#0A0A0A", color: "#F6F4EF", padding: 28, minHeight: 360 }}>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426" }}>▌ {lang === "es" ? "TRANSCRIPCIÓN" : "TRANSCRIPT"}</div>
        <div style={{ marginTop: 12, minHeight: 70, fontFamily: "ui-monospace, monospace", fontSize: 16, lineHeight: 1.6 }}>
          {transcript || <span style={{ color: "rgba(246,244,239,0.4)" }}>{lang === "es" ? "esperando voz..." : "waiting for voice..."}</span>}
          {recording && <span style={{ animation: "vwBlink 0.7s infinite" }}>|</span>}
        </div>

        {parsed && (
          <div style={{ marginTop: 24 }}>
            <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426" }}>▌ {lang === "es" ? "ENTENDIMOS" : "WE HEARD"}</div>
            <div style={{ marginTop: 12 }}>
              {parsed.items.map((it, i) => (
                <div key={i} style={{ display: "flex", justifyContent: "space-between", padding: "8px 0", borderBottom: "1px dashed rgba(246,244,239,0.15)", fontSize: 14 }}>
                  <span>{it.name}</span>
                  <span style={{ fontFamily: "'Anton', sans-serif", color: "#E63426" }}>{it.price ? fmtL(it.price) : "—"}</span>
                </div>
              ))}
              <div style={{ display: "flex", justifyContent: "space-between", marginTop: 12, fontFamily: "'Anton', sans-serif", fontSize: 22 }}>
                <span>{t("total", lang).toUpperCase()}</span><span style={{ color: "#E63426" }}>{fmtL(parsed.total)}</span>
              </div>
              <button style={{ marginTop: 16, width: "100%", appearance: "none", border: 0, background: "#E63426", color: "#F6F4EF", padding: "14px", fontFamily: "'Anton', sans-serif", letterSpacing: "0.14em", cursor: "pointer" }}>
                {lang === "es" ? "CONFIRMAR PEDIDO" : "CONFIRM ORDER"} →
              </button>
            </div>
          </div>
        )}
      </div>
    </div>
  );
}

// ---------- Predict / Loyalty preview ----------
function PredictTab({ lang }) {
  return (
    <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 32 }} className="vw-2col">
      <div>
        <div style={{ fontFamily: "'Anton', sans-serif", fontSize: 14, letterSpacing: "0.22em", color: "#E63426", marginBottom: 12 }}>▌ {lang === "es" ? "VITO'S CLUB" : "VITO'S CLUB"}</div>
        <h3 style={{ fontFamily: "'Anton', sans-serif", fontSize: 42, lineHeight: 0.95, margin: 0 }}>{lang === "es" ? "CADA ORDEN NOS ENSEÑA." : "EVERY ORDER TEACHES US."}</h3>
        <p style={{ marginTop: 14, fontSize: 14, lineHeight: 1.6 }}>
          {lang === "es"
            ? "Tu carta de fidelidad aprende qué te gusta, cuándo pides, qué evitas. Las recompensas no son genéricas — son tuyas."
            : "Your loyalty card learns what you like, when you order, what you skip. Rewards aren't generic — they're yours."}
        </p>
      </div>
      <div style={{ background: "#F1ECDD", border: "1px solid #0A0A0A", padding: 24 }}>
        <div style={{ fontSize: 11, letterSpacing: "0.22em", color: "rgba(10,10,10,0.6)" }}>{lang === "es" ? "MODELO PERSONAL · 92% CONFIANZA" : "PERSONAL MODEL · 92% CONFIDENCE"}</div>
        <div style={{ marginTop: 12, fontFamily: "'Anton', sans-serif", fontSize: 22, letterSpacing: "0.04em" }}>{lang === "es" ? "TU PRÓXIMA ORDEN" : "YOUR NEXT ORDER"}</div>
        <div style={{ marginTop: 16, display: "flex", flexDirection: "column", gap: 10 }}>
          {[
            { en: "6 Boneless", es: "6 Boneless", w: 92 },
            { en: "Hot Honey", es: "Hot Honey", w: 88 },
            { en: "Truffled Fries", es: "Truffled Fries", w: 71 },
            { en: "Mojito", es: "Mojito", w: 64 },
          ].map(p => (
            <div key={p.en}>
              <div style={{ display: "flex", justifyContent: "space-between", fontSize: 13, marginBottom: 4 }}>
                <span>{p[lang]}</span><span style={{ fontFamily: "'Anton', sans-serif", color: "#E63426" }}>{p.w}%</span>
              </div>
              <div style={{ height: 6, background: "rgba(10,10,10,0.1)", overflow: "hidden" }}>
                <div style={{ height: "100%", width: p.w + "%", background: "#E63426", transition: "width 1s" }} />
              </div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}

window.ScreenAI = ScreenAI;
