# src/routes/index.tsx

```tsx
import { createFileRoute } from "@tanstack/react-router";
import { useMemo, useState, type FormEvent } from "react";
import {
  Check,
  CircleDot,
  Download,
  ExternalLink,
  Filter,
  Loader2,
  Play,
  Search,
  Store,
  Tags,
  TriangleAlert,
} from "lucide-react";
import { cn } from "#/lib/utils";
import {
  BUILD_PRESETS,
  MARKETPLACE_OPTIONS,
  MARKET_META,
  SORT_OPTIONS,
  planLauncher,
  type Marketplace,
  type SortId,
} from "#/lib/launcher";
import { CouponVault } from "#/components/CouponVault";
import { PartnerComparison } from "#/components/PartnerComparison";
import { PriceComparison } from "#/components/PriceComparison";
import { VerifiedListings } from "#/components/VerifiedListings";
import { CpuComparison } from "#/components/CpuComparison";

export const Route = createFileRoute("/")({ component: Home });

function TerminalSection({
  no,
  title,
  sub,
  children,
}: {
  no: string;
  title: string;
  sub?: string;
  children: React.ReactNode;
}) {
  return (
    <section className="flex flex-col gap-4">
      <div className="flex items-baseline gap-3 border-b border-white/15 pb-2">
        <span className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          [{no} // {title}]
        </span>
        {sub && (
          <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
            {sub}
          </span>
        )}
      </div>
      {children}
    </section>
  );
}

function Home() {
  const [query, setQuery] = useState("");
  const [market, setMarket] = useState<Marketplace>("both");
  const [sortId, setSortId] = useState<SortId>("price-asc");

  const plan = useMemo(
    () => planLauncher(query, market, sortId),
    [query, market, sortId],
  );
  const hasContent = plan.positive.length > 0;

  const onGenerate = (e?: FormEvent) => {
    e?.preventDefault();
    document
      .getElementById("launchers")
      ?.scrollIntoView({ behavior: "smooth", block: "start" });
  };

  return (
    <main className="mx-auto flex w-full max-w-6xl flex-col gap-12 px-4 py-10 sm:px-8 sm:py-16">
      {/* System utility bar */}
      <div className="flex flex-wrap items-center gap-x-3 gap-y-2 justify-between border border-white/15 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
        <span>[ ZEZO.EXE ]</span>
        <span className="hidden sm:inline">ZIAD ALMUTIRI // HARDWARE UNIT</span>
        <a
          href="/zezo-source-export.zip"
          download="zezo-source-export.zip"
          className="inline-flex cursor-pointer items-center gap-1.5 text-[#4AF626] transition hover:text-[#FF2A2A]"
        >
          <Download className="size-3.5" aria-hidden="true" />
          تنزيل كود المصدر (ZIP)
        </a>
      </div>

      {/* Header */}
      <header className="flex flex-col gap-4">
        <div className="flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          <span aria-hidden="true">+</span>
          [ راصد ومنصة صيد صفقات 11.11 ]
          <span aria-hidden="true">+</span>
        </div>
        <h1
          aria-label="Zezo for Premium Price"
          className="font-display text-2xl leading-none text-pretty sm:text-5xl"
        >
          <span className="sm:hidden">Zezo Deals</span>
          <span className="hidden sm:inline">Zezo for Premium Price</span>
        </h1>
        <p className="max-w-2xl font-medium text-label text-(--muted)">
          راصد ومنصة صيد صفقات 11.11
        </p>
        <p className="max-w-2xl text-body leading-relaxed text-(--muted)">
          مطلق بحث ذكي: يولّد كلمات بحث دقيقة مع تصفية الملحقات (كابلات،
          أغطية، أداة تثبيت...) ويفتح أمازون السعودية أو علي إكسبريس بروابط
          بحث جاهزة. لا يعرض أسعاراً وهمية، ولا يخترع عروضاً.
        </p>
      </header>

      {/* Control panel */}
      <section className="crt-frame scanlines flex w-full flex-col">
        <div className="flex items-center justify-between border-b border-white/15 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          <span>[ 01 // QUERY + LAUNCH ]</span>
          <span className="hidden sm:inline">ACCURATE_URLS</span>
        </div>

        <form className="flex flex-col gap-4 p-3 sm:p-5" onSubmit={onGenerate} role="search">
          <label className="flex flex-col gap-2">
            <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
              &gt; اكتب المنتج أو الرمز (مثال: B650, Ryzen 7 9800X3D, iPhone 16)
            </span>
            <div className="relative">
              <Search
                className="pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-(--muted)"
                aria-hidden="true"
              />
              <input
                type="search"
                value={query}
                onChange={(e) => setQuery(e.target.value)}
                placeholder="مثال: Gigabyte B650 Eagle AX"
                className="w-full border border-white/20 bg-[#0D0F12] py-3.5 pe-4 ps-11 text-body text-(--ink) outline-none transition focus-visible:border-[#FF2A2A] focus-visible:ring-1 focus-visible:ring-[#FF2A2A]"
              />
            </div>
          </label>

          {/* Quick-launch presets for Ziyad's build */}
          <div className="flex flex-col gap-2">
            <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
              &gt; اختصارات تشكيل Ziyad
            </span>
            <div className="flex flex-wrap gap-2">
              {BUILD_PRESETS.map((p) => (
                <button
                  key={p.id}
                  type="button"
                  onClick={() => setQuery(p.query)}
                  className="cursor-pointer border border-white/20 bg-[#0D0F12] px-2.5 py-1.5 font-mono text-[11px] uppercase tracking-wide text-(--ink) transition hover:border-[#FF2A2A] hover:text-[#FF2A2A] active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]"
                >
                  {p.label}
                  <span className="ms-2 text-(--muted)">{p.en}</span>
                </button>
              ))}
            </div>
          </div>

          <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
            <div className="flex flex-col gap-2">
              <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
                &gt; السوق
              </span>
              <div className="grid grid-cols-1 gap-2">
                {MARKETPLACE_OPTIONS.map((opt) => {
                  const active = market === opt.value;
                  return (
                    <button
                      key={opt.value}
                      type="button"
                      onClick={() => setMarket(opt.value)}
                      aria-pressed={active}
                      className={cn(
                        "flex cursor-pointer items-center justify-between gap-2 border px-3 py-2.5 text-start transition active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#FF2A2A]",
                        active
                          ? "border-[#FF2A2A] bg-[#FF2A2A]/10"
                          : "border-white/20 bg-[#0D0F12] hover:border-white/40",
                      )}
                    >
                      <span
                        className={cn(
                          "flex items-center gap-1.5 text-label font-medium",
                          active && "text-[#FF2A2A]",
                        )}
                      >
                        {active && (
                          <CircleDot className="size-3" aria-hidden="true" />
                        )}
                        {opt.label}
                      </span>
                      <span className="font-mono text-[10px] uppercase tracking-[0.18em] text-(--muted)">
                        {opt.en}
                      </span>
                    </button>
                  );
                })}
              </div>
            </div>

            <div className="flex flex-col gap-2">
              <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
                &gt; فرز / فلتر (يُطبَّق فقط إن أمكن ترميزه في الرابط)
              </span>
              <div className="flex flex-col gap-2">
                {SORT_OPTIONS.map((s) => {
                  const active = sortId === s.id;
                  return (
                    <button
                      key={s.id}
                      type="button"
                      onClick={() => setSortId(s.id)}
                      aria-pressed={active}
                      className={cn(
                        "flex cursor-pointer items-center justify-between gap-2 border px-3 py-2.5 text-start transition active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#FF2A2A]",
                        active
                          ? "border-[#FF2A2A] bg-[#FF2A2A]/10"
                          : "border-white/20 bg-[#0D0F12] hover:border-white/40",
                      )}
                    >
                      <span className="flex items-center gap-1.5 text-label font-medium">
                        {active && (
                          <CircleDot className="size-3 text-[#FF2A2A]" aria-hidden="true" />
                        )}
                        {s.label}
                      </span>
                      <span className="font-mono text-[10px] uppercase tracking-[0.18em] text-(--muted)">
                        {s.en}
                      </span>
                    </button>
                  );
                })}
              </div>
            </div>
          </div>

          <button
            type="submit"
            className="mt-1 inline-flex cursor-pointer items-center justify-center gap-2 border border-[#FF2A2A] bg-[#FF2A2A] px-6 py-3.5 font-mono text-label font-bold uppercase tracking-[0.15em] text-black shadow-[0_6px_0_-4px_rgba(10,10,10,0.9),0_1px_2px_rgba(0,0,0,0.5)] transition hover:brightness-110 active:translate-y-[1px] active:shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70"
          >
            <Play className="size-4" aria-hidden="true" />
            إنشاء روابط الإطلاق
          </button>
        </form>

        <div className="flex items-start gap-2.5 border-t border-amber-500/30 bg-amber-500/[0.06] px-3 py-3">
          <TriangleAlert className="mt-0.5 size-4 shrink-0 text-amber-400" aria-hidden="true" />
          <p className="font-mono text-[11px] font-medium leading-relaxed text-amber-100/80">
            هذا مطلق بحث فقط: يفتح صفحة بحث في المتجر ولا يعرض أسعاراً. لا يتم
            عرض أسعار أو عروض وهمية، وأي كوبون غير موثّق بمصدر حي يبقى بوسم
            "مثال".
          </p>
        </div>
      </section>

      {/* Keyword intel */}
      <TerminalSection no="02" title="KEYWORD INTEL" sub="الكلمات + استبعاد الملحقات">
        <div className="flex flex-col gap-3">
          <div className="flex items-center gap-2 border border-white/15 bg-white/[0.02] px-3 py-2.5">
            <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-[#FF2A2A]">
              [INTENT]
            </span>
            <span className="text-label font-medium">{plan.intent.label}</span>
            <span className="font-mono text-[10px] uppercase tracking-[0.18em] text-(--muted)">
              / {plan.intent.en}
            </span>
          </div>

          <div className="grid grid-cols-1 gap-3 md:grid-cols-2">
            <div className="flex flex-col gap-2 border border-white/15 bg-white/[0.02] p-3">
              <span className="flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
                <Tags className="size-3" aria-hidden="true" />
                كلمات البحث الموجبة
              </span>
              <div className="flex flex-wrap gap-1.5">
                {plan.positive.length > 0 ? (
                  plan.positive.map((t, i) => (
                    <code
                      key={`${t}-${i}`}
                      className="border border-white/15 bg-black/20 px-2 py-0.5 font-mono text-[11px] text-[#EAEAEA]"
                    >
                      {t}
                    </code>
                  ))
                ) : (
                  <span className="font-mono text-[11px] text-(--muted)">
                    أدخل منتجاً أو اختر اختصاراً
                  </span>
                )}
              </div>
            </div>

            <div className="flex flex-col gap-2 border border-white/15 bg-white/[0.02] p-3">
              <span className="flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
                <Filter className="size-3" aria-hidden="true" />
                كلمات مستبعَدة (ملحقات)
              </span>
              <div className="flex flex-wrap gap-1.5">
                {plan.negative.map((t, i) => (
                  <code
                    key={`${t}-${i}`}
                    className="border border-white/15 bg-black/20 px-2 py-0.5 font-mono text-[11px] text-(--muted) line-through"
                  >
                    -{t}
                  </code>
                ))}
              </div>
              <p className="font-mono text-[10px] leading-relaxed text-amber-100/60">
                هذه المصطلحات تُستبعَد من الاستهداف. لا تدعم أمازون وعلي إكسبريس
                عامل الاستبعاد "-" في الرابط، لذا تُحتسَب لصياغة كلمات موجبة أدق
                ولا تُدَّعى كفلتر مطبَّق.
              </p>
            </div>
          </div>
        </div>
      </TerminalSection>

      {/* Launchers */}
      <section id="launchers" className="flex scroll-mt-24 flex-col gap-4">
        <TerminalSection no="03" title="LAUNCHERS" sub="افتح البحث في المتجر">
          {hasContent ? (
            <div className="grid grid-cols-1 gap-3 md:grid-cols-2">
              {plan.launches.map((l) => (
                <article
                  key={l.key}
                  className="flex flex-col gap-3 border border-white/15 bg-white/[0.02] p-3"
                >
                  <div className="flex items-center justify-between gap-2">
                    <span className="flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.18em] text-[#FF2A2A]">
                      <Store className="size-3.5" aria-hidden="true" />
                      {MARKET_META[l.key].en}
                    </span>
                    {l.applied ? (
                      <span className="inline-flex items-center gap-1 border border-[#4AF626]/50 bg-[#4AF626]/10 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-[#4AF626]">
                        <Check className="size-3" aria-hidden="true" />
                        {l.applied}
                      </span>
                    ) : (
                      <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                        لا فرز مطبَّق
                      </span>
                    )}
                  </div>

                  {l.primeNote && (
                    <p className="font-mono text-[10px] leading-relaxed text-amber-100/60">
                      فلتر Prime غير قابل للترميز في الرابط - فعِّله يدوياً في صفحة
                      أمازون بعد الفتح.
                    </p>
                  )}

                  <code className="break-all border border-white/10 bg-black/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-(--muted)">
                    {l.url}
                  </code>

                  <a
                    href={l.url}
                    target="_blank"
                    rel="noopener noreferrer"
                    className="inline-flex cursor-pointer items-center justify-center gap-2 border border-[#FF2A2A] bg-[#FF2A2A]/10 px-4 py-2.5 font-mono text-label font-bold uppercase tracking-[0.12em] text-[#FF2A2A] transition hover:bg-[#FF2A2A] hover:text-black active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70"
                  >
                    فتح البحث في {MARKET_META[l.key].en}
                    <ExternalLink className="size-4" aria-hidden="true" />
                  </a>
                </article>
              ))}
            </div>
          ) : (
            <div className="flex flex-col items-center gap-3 border border-dashed border-white/15 py-16 text-center">
              <Search className="size-5 text-(--muted)" aria-hidden="true" />
              <p className="max-w-md font-mono text-[13px] text-(--muted)">
                أدخل اسم المنتج أو الرمز، أو اختر اختصاراً من تشكيل Ziyad،
                لتوليد روابط إطلاق بحث دقيقة.
              </p>
            </div>
          )}
        </TerminalSection>
      </section>

      {/* Price comparison (reference + live attempt, never a dead-end) */}
      <PriceComparison query={query} intentId={plan.intent.id} />

      {/* CPU retail prices (boxed vs tray, verified-or-unavailable) */}
      {plan.intent.id === "cpu" && <CpuComparison query={query} />}

      {/* Verified Amazon.sa listings (real observed prices, GPU) */}
      {plan.intent.id === "gpu" && <VerifiedListings />}

      {/* AIB partner editions (GPU only) */}
      {plan.intent.id === "gpu" && (
        <PartnerComparison query={query} intentId={plan.intent.id} />
      )}

      {/* Coupon vault */}
      <CouponVault />
    </main>
  );
}

```

# src/routes/__root.tsx

```tsx
import { createRootRoute, HeadContent, Scripts } from "@tanstack/react-router";

import appCss from "../styles.css?url";

const SITE_TITLE = "Zezo for Premium Price – راصد ومنصة صيد صفقات 11.11";
const SITE_DESCRIPTION =
  "Zezo for Premium Price - راصد ومنصة صيد صفقات 11.11: يولّد روابط بحث دقيقة على أمازون السعودية وعلي إكسبريس مع تصفية الملحقات وبنك الكوبونات، دون أسعار أو عروض وهمية.";

// milesdobrenski 06/23/2026: DO NOT REMOVE — og:image / twitter:image below need absolute URLs.
// ... Twitter's crawler silently ignores relative og:image paths.
const BASE_URL = process.env.VERCEL_PROJECT_PRODUCTION_URL
  ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
  : "";

export const Route = createRootRoute({
  head: () => ({
    meta: [
      { charSet: "utf-8" },
      {
        name: "viewport",
        content: "width=device-width, initial-scale=1, viewport-fit=cover",
      },
      { name: "robots", content: "noindex, nofollow" },
      { title: SITE_TITLE },
      { name: "description", content: SITE_DESCRIPTION },
      { name: "theme-color", content: "#0A0A0A" },
      { property: "og:title", content: SITE_TITLE },
      { property: "og:description", content: SITE_DESCRIPTION },
      { property: "og:type", content: "website" },
      { property: "og:image", content: `${BASE_URL}/api/og` },
      { property: "og:url", content: BASE_URL || "/" },
      { name: "twitter:card", content: "summary_large_image" },
      { name: "twitter:title", content: SITE_TITLE },
      { name: "twitter:description", content: SITE_DESCRIPTION },
      { name: "twitter:image", content: `${BASE_URL}/api/og` },
    ],
    links: [
      { rel: "stylesheet", href: appCss },
      { rel: "icon", href: "/favicon.svg", type: "image/svg+xml" },
      { rel: "icon", href: "/favicon.ico", sizes: "any" },
    ],
  }),
  shellComponent: RootDocument,
});

function RootDocument({ children }: { children: React.ReactNode }) {
  return (
    <html lang="ar" dir="rtl">
      <head>
        <HeadContent />
      </head>
      <body>
        {children}
        <Scripts />
      </body>
    </html>
  );
}

```

# src/routes/api/og.tsx

```tsx
import { createFileRoute } from "@tanstack/react-router";
import { ImageResponse } from "@vercel/og";

// Dynamic OpenGraph card. EDIT ONLY the constants below (SITE_NAME, SITE_TAGLINE, OG_BG/OG_TEXT/OG_MUTED)
// to match the site — do NOT change the JSX, font sizes, alignment, or centering below; they are tuned for
// a consistent, centered card. While SITE_NAME is still the default, or if the image fails to render, we
// serve the bundled Poke image at /og.jpg directly (HTTP 200, not a redirect) so the live link preview is
// never empty — even on crawlers (iMessage, WhatsApp) that don't follow redirects for og:image.
const SITE_NAME = "Zezo for Premium Price";
const SITE_TAGLINE = "راصد ومنصة صيد صفقات 11.11";

// The building agent sets these to match the site's actual page design.
const OG_BG = "#0A0A0A"; // card background color
const OG_TEXT = "#EAEAEA"; // title color
const OG_MUTED = "#FF2A2A"; // tagline color

// milesdobrenski 06/18/2026: generated sites are edited and redeployed often, so never cache the OG
// image at the CDN — always regenerate it so link previews reflect the site's current state.
const OG_CACHE_CONTROL = "no-cache, no-store, must-revalidate";

let fontsPromise: Promise<[ArrayBuffer, ArrayBuffer]> | null = null;
let fallbackBytesPromise: Promise<ArrayBuffer> | null = null;

async function fetchAsset(url: URL, timeoutMs = 5000): Promise<ArrayBuffer> {
  let lastError: unknown;
  for (let attempt = 0; attempt < 2; attempt++) {
    try {
      const res = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
      if (!res.ok) throw new Error(`${url.pathname} ${res.status}`);
      const buf = await res.arrayBuffer();
      if (buf.byteLength === 0) throw new Error(`${url.pathname} empty`);
      return buf;
    } catch (error) {
      lastError = error;
    }
  }
  throw lastError;
}

function loadFonts(baseUrl: string): Promise<[ArrayBuffer, ArrayBuffer]> {
  if (!fontsPromise) {
    fontsPromise = Promise.all([
      fetchAsset(new URL("/fonts/Exposure-static.ttf", baseUrl)),
      fetchAsset(new URL("/fonts/OpenRunde-Medium.ttf", baseUrl)),
    ]).catch((error) => {
      fontsPromise = null;
      throw error;
    });
  }
  return fontsPromise;
}

function loadFallbackBytes(baseUrl: string): Promise<ArrayBuffer> {
  if (!fallbackBytesPromise) {
    fallbackBytesPromise = fetchAsset(new URL("/og.jpg", baseUrl)).catch(
      (error) => {
        fallbackBytesPromise = null;
        throw error;
      },
    );
  }
  return fallbackBytesPromise;
}

async function serveFallback(baseUrl: string): Promise<Response> {
  try {
    const bytes = await loadFallbackBytes(baseUrl);
    return new Response(bytes, {
      status: 200,
      headers: {
        "content-type": "image/jpeg",
        "cache-control": OG_CACHE_CONTROL,
      },
    });
  } catch {
    return Response.redirect(new URL("/og.jpg", baseUrl).toString(), 302);
  }
}

export const Route = createFileRoute("/api/og")({
  server: {
    handlers: {
      GET: async ({ request }) => {
        if (SITE_NAME === "Poke Site" || !SITE_NAME.trim()) {
          return serveFallback(request.url);
        }

        try {
          const [exposure, openRunde] = await loadFonts(request.url);

          const title =
            SITE_NAME.length > 50 ? `${SITE_NAME.slice(0, 47)}…` : SITE_NAME;

          // milesdobrenski 06/18/2026: override @vercel/og's default immutable 1y cache-control so
          // edited-and-redeployed sites never serve a stale preview (see OG_CACHE_CONTROL).
          return new ImageResponse(
            <div
              style={{
                height: "100%",
                width: "100%",
                display: "flex",
                flexDirection: "column",
                alignItems: "center",
                justifyContent: "center",
                backgroundColor: OG_BG,
                paddingTop: "128px",
                paddingRight: "96px",
                paddingBottom: "64px",
                paddingLeft: "96px",
              }}
            >
              <div
                style={{
                  fontFamily: "Exposure",
                  fontSize: SITE_NAME.length > 30 ? 64 : 84,
                  fontWeight: 400,
                  color: OG_TEXT,
                  lineHeight: 1.15,
                  textAlign: "center",
                  maxWidth: 900,
                }}
              >
                {title}
              </div>
              {SITE_TAGLINE ? (
                <div
                  style={{
                    fontFamily: "OpenRunde",
                    fontSize: 36,
                    color: OG_MUTED,
                    lineHeight: 1.3,
                    textAlign: "center",
                    marginTop: 24,
                    maxWidth: 820,
                  }}
                >
                  {SITE_TAGLINE}
                </div>
              ) : null}
            </div>,
            {
              width: 1200,
              height: 630,
              fonts: [
                {
                  name: "Exposure",
                  data: exposure,
                  style: "normal",
                  weight: 500,
                },
                {
                  name: "OpenRunde",
                  data: openRunde,
                  style: "normal",
                  weight: 500,
                },
              ],
              headers: {
                "cache-control": OG_CACHE_CONTROL,
              },
            },
          );
        } catch {
          return serveFallback(request.url);
        }
      },
    },
  },
});

```

# src/components/AliExpressPromo.tsx

```tsx
import { CircleAlert, ExternalLink, Radar, TriangleAlert } from "lucide-react";
import { ALI_KSA_PROMO } from "#/lib/aliPromo";

export function AliExpressPromo() {
  const s = ALI_KSA_PROMO;

  return (
    <div className="flex flex-col gap-3">
      {/* Honest status */}
      <div className="flex items-start gap-2.5 border border-amber-500/40 bg-amber-500/[0.07] px-3 py-3">
        <TriangleAlert className="mt-0.5 size-4 shrink-0 text-amber-400" aria-hidden="true" />
        <div className="flex flex-col gap-1">
          <p className="font-mono text-[11px] font-bold uppercase tracking-wider text-amber-300">
            حالة أكواد 11.11 السعودية / KSA CODES STATUS
          </p>
          <p className="text-meta font-medium leading-relaxed text-amber-100/90">{s.statusLabel}</p>
          <p className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">{s.en}</p>
        </div>
      </div>

      {/* Official source + checked time */}
      <div className="flex flex-col gap-1.5 border border-white/15 bg-white/[0.02] px-3 py-2.5">
        <p className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
          فحص: {s.checkedAt} · المصدر المعتمد: غير موصول
        </p>
        <a
          href={s.officialUrl}
          target="_blank"
          rel="noopener noreferrer"
          className="inline-flex w-fit cursor-pointer items-center gap-1.5 border border-white/25 bg-[#0D0F12] px-2.5 py-1.5 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#FF2A2A] hover:text-[#FF2A2A]"
        >
          <Radar className="size-3" aria-hidden="true" />
          {s.officialLabel}
          <ExternalLink className="size-3" aria-hidden="true" />
        </a>
        <p className="font-mono text-[10px] leading-relaxed text-(--muted)">{s.providerNote}</p>
      </div>

      {/* Non-copyable forecast */}
      <div className="flex flex-col gap-2 border border-white/12 bg-white/[0.015] px-3 py-3">
        <p className="flex items-start gap-2 font-mono text-[10px] leading-relaxed text-amber-200/80">
          <CircleAlert className="mt-0.5 size-3.5 shrink-0 text-amber-400" aria-hidden="true" />
          {s.forecastIntro}
        </p>
        <div className="flex flex-col">
          {s.forecasts.map((f) => (
            <div
              key={f.thresholdUsd}
              className="flex items-center justify-between gap-2 border-b border-white/8 py-2 last:border-b-0"
            >
              <span className="font-mono text-[11px] text-(--muted)">
                {f.label} ({f.en}) → خصم ${f.discountUsd}
              </span>
              <span className="inline-flex shrink-0 items-center border border-dashed border-amber-500/40 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wider text-amber-300/90">
                {f.note} · لا يُنسخ
              </span>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}

```

# src/components/CopyCodeButton.tsx

```tsx
import { useRef, useState } from "react";
import { Check, Copy } from "lucide-react";
import { cn } from "#/lib/utils";

export async function copyToClipboard(text: string): Promise<boolean> {
  try {
    if (navigator.clipboard && window.isSecureContext) {
      await navigator.clipboard.writeText(text);
      return true;
    }
  } catch {
    /* fall through to legacy path */
  }
  try {
    const ta = document.createElement("textarea");
    ta.value = text;
    ta.setAttribute("readonly", "");
    ta.style.position = "fixed";
    ta.style.opacity = "0";
    document.body.appendChild(ta);
    ta.select();
    const ok = document.execCommand("copy");
    ta.remove();
    return ok;
  } catch {
    return false;
  }
}

type CopyCodeProps = {
  code: string;
  compact?: boolean;
  ghost?: boolean;
  className?: string;
};

export function CopyCodeButton({
  code,
  compact,
  ghost,
  className,
}: CopyCodeProps) {
  const [copied, setCopied] = useState(false);
  const [failed, setFailed] = useState(false);
  const timer = useRef<number>(0);

  const onCopy = async () => {
    window.clearTimeout(timer.current);
    const ok = await copyToClipboard(code);
    if (ok) {
      setCopied(true);
      setFailed(false);
      timer.current = window.setTimeout(() => setCopied(false), 1600);
    } else {
      setFailed(true);
      timer.current = window.setTimeout(() => setFailed(false), 1600);
    }
  };

  return (
    <button
      type="button"
      onClick={onCopy}
      aria-label={`نسخ الكود ${code}`}
      className={cn(
        "group inline-flex items-center gap-1.5 font-mono uppercase transition active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A] motion-safe:duration-150",
        compact ? "px-2 py-1 text-[11px]" : "px-2.5 py-1.5 text-label",
        ghost
          ? "border-s border-white/15 pl-2 text-(--ink) hover:bg-white/[0.04] hover:text-[#FF2A2A]"
          : "border border-[--line] bg-white/[0.03] text-(--ink) hover:border-[#FF2A2A]/70 hover:text-[#FF2A2A]",
        copied && "!text-[#4AF626]",
        failed && "!text-[#FF2A2A]",
        className,
      )}
    >
      {copied ? (
        <Check className="size-3.5" aria-hidden="true" />
      ) : failed ? (
        <span className="text-[11px] font-bold" aria-hidden="true">
          !
        </span>
      ) : (
        <Copy className="size-3.5 shrink-0" aria-hidden="true" />
      )}
      <span className="tracking-wide">
        {copied ? "تم النسخ" : failed ? "تعذّر النسخ" : "نسخ الكود"}
      </span>
      <span className="hidden text-[10px] tracking-[0.2em] opacity-60 sm:inline">
        /{copied ? "COPIED" : failed ? "COPY FAILED" : "COPY"}
      </span>
    </button>
  );
}

```

# src/components/CouponVault.tsx

```tsx
import { useState } from "react";
import { CircleAlert, ShieldCheck, Timer, Wallet } from "lucide-react";
import { cn } from "#/lib/utils";
import {
  COUPONS_BY_STORE,
  STORE_META,
  TRENDING_OFFERS,
  type Coupon,
  type CouponKind,
  type CouponStatus,
  type StoreKey,
} from "#/lib/coupons";
import { CopyCodeButton } from "./CopyCodeButton";
import { AliExpressPromo } from "./AliExpressPromo";

const STORE_TABS: { key: StoreKey; label: string; en: string }[] = [
  { key: "amazon", label: "أمازون السعودية", en: "Amazon.sa" },
  { key: "aliexpress", label: "علي إكسبريس", en: "AliExpress" },
];

const KIND_TAG: Record<CouponKind, string> = {
  bank: "BANK OFFER",
  card: "CARD OFFER",
  1111: "11.11 CODE",
};

function StatusPillCoupon({ status }: { status: CouponStatus }) {
  if (status === "verified") {
    return (
      <span className="inline-flex items-center gap-1 border border-[#4AF626]/50 bg-[#4AF626]/10 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-[#4AF626]">
        <ShieldCheck className="size-3" aria-hidden="true" />
        متحقق / Verified
      </span>
    );
  }
  if (status === "unverified") {
    return (
      <span className="inline-flex items-center gap-1 border border-amber-500/50 bg-amber-500/10 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-amber-400">
        <Timer className="size-3" aria-hidden="true" />
        غير متحقق / Unverified
      </span>
    );
  }
  return (
    <span className="inline-flex items-center gap-1 border border-amber-500/40 bg-amber-500/[0.06] px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-amber-400">
      <CircleAlert className="size-3" aria-hidden="true" />
      مثال / Sample
    </span>
  );
}

function CouponCard({ coupon }: { coupon: Coupon }) {
  return (
    <article className="flex flex-col border border-white/15 bg-white/[0.02]">
      <div className="flex items-center justify-between gap-2 border-b border-white/15 px-3 py-2">
        <span className="inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.18em] text-[#FF2A2A]">
          <Wallet className="size-3" aria-hidden="true" />
          [{KIND_TAG[coupon.kind]}] {coupon.issuer}
        </span>
        <StatusPillCoupon status={coupon.status} />
      </div>

      <div className="flex flex-col gap-3 p-3">
        <div>
          <p className="text-body font-medium leading-snug">{coupon.discount}</p>
          <p className="mt-0.5 font-mono text-[11px] uppercase tracking-wide text-(--muted)">
            {coupon.en}
          </p>
        </div>

        <div className="flex items-center justify-between gap-2 border-y border-white/10 py-2.5">
          {coupon.hasCode && coupon.code ? (
            <>
              <code className="truncate font-mono text-lg font-bold tracking-wide text-[#EAEAEA]">
                {coupon.code}
              </code>
              <CopyCodeButton code={coupon.code} compact className="shrink-0" />
            </>
          ) : (
            <span className="font-mono text-[11px] uppercase tracking-wider text-(--muted)">
              NO CODE - APPLIES AT CHECKOUT
            </span>
          )}
        </div>

        <dl className="flex flex-col gap-1.5 font-mono text-[11px] leading-relaxed">
          <div className="flex gap-2">
            <dt className="shrink-0 text-(--muted)">الأهلية</dt>
            <dd className="min-w-0">{coupon.eligibility}</dd>
          </div>
          {coupon.note && (
            <div className="flex gap-2">
              <dt className="shrink-0 text-(--muted)">ملاحظة</dt>
              <dd className="min-w-0">{coupon.note}</dd>
            </div>
          )}
          {coupon.validity && (
            <div className="flex gap-2">
              <dt className="shrink-0 text-(--muted)">الصلاحية</dt>
              <dd className="min-w-0">{coupon.validity}</dd>
            </div>
          )}
          {coupon.exclusions && (
            <div className="flex gap-2">
              <dt className="shrink-0 text-(--muted)">الاستثناءات</dt>
              <dd className="min-w-0">{coupon.exclusions}</dd>
            </div>
          )}
          <div className="flex gap-2">
            <dt className="shrink-0 text-(--muted)">المصدر</dt>
            <dd className="min-w-0">{coupon.source}</dd>
          </div>
        </dl>
      </div>
    </article>
  );
}

function TrendingBar() {
  return (
    <div className="flex flex-col gap-3">
      <div className="flex items-center justify-between">
        <h3 className="font-mono text-[11px] uppercase tracking-[0.2em] text-[#FF2A2A]">
          [ 11.11 &amp; CARD OFFERS ]
        </h3>
        <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          شريط العروض / Trending
        </span>
      </div>
      <div className="flex snap-x gap-2 overflow-x-auto pb-1">
        {TRENDING_OFFERS.map((c) => (
          <article
            key={c.id}
            className="flex w-64 shrink-0 snap-start flex-col gap-2 border border-white/12 bg-white/[0.02] p-3"
          >
            <div className="flex items-center justify-between gap-2">
              <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                {STORE_META[c.store].en}
              </span>
              <span className="font-mono text-[10px] uppercase text-[#FF2A2A]">
                {KIND_TAG[c.kind]}
              </span>
            </div>
            <p className="text-label font-medium leading-snug">{c.discount}</p>
            <StatusPillCoupon status={c.status} />
            <div className="flex items-center justify-between gap-2 border-t border-white/10 pt-2">
              {c.hasCode && c.code ? (
                <>
                  <code className="truncate font-mono text-sm font-bold">
                    {c.code}
                  </code>
                  <CopyCodeButton code={c.code} compact className="shrink-0" />
                </>
              ) : (
                <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                  NO CODE - CHECKOUT
                </span>
              )}
            </div>
          </article>
        ))}
      </div>
    </div>
  );
}

export function CouponVault() {
  const [tab, setTab] = useState<StoreKey>("amazon");
  const active = COUPONS_BY_STORE[tab];

  return (
    <section className="flex flex-col gap-5">
      <div className="flex items-end justify-between gap-4">
        <div>
          <p className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
            [ COUPON VAULT ]
          </p>
          <h2 className="text-3xl font-medium text-pretty sm:text-4xl">
            بنك الكوبونات
          </h2>
          <p className="mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-(--muted)">
            / Coupon &amp; Offer Vault
          </p>
        </div>
      </div>

      <div className="flex items-start gap-2.5 border border-amber-500/30 bg-amber-500/[0.06] px-3 py-2.5">
        <CircleAlert
          className="mt-0.5 size-4 shrink-0 text-amber-400"
          aria-hidden="true"
        />
        <p className="text-meta font-medium leading-relaxed text-amber-100/80">
          لا توجد أكواد محققة/نشطة حالياً لأن التطبيق لا يملك مصدر بيانات حي.
          العروض أدناه أمثلة توضيحية (بوسم "مثال") ولا يُعتد بها كعروض فعلية.
          عروض البنوك تُفَعَّل تلقائياً عند الدفع ولا يوجد لها كود، وأي كود
          يُعرض كأمثلة فقط حتى يربط التطبيق مصدراً يؤكد صلاحيته.
        </p>
      </div>

      <div className="crt-frame flex w-full flex-col">
        <div className="grid grid-cols-2 border-b border-white/15">
          {STORE_TABS.map((t) => {
            const isActive = tab === t.key;
            return (
              <button
                key={t.key}
                type="button"
                onClick={() => setTab(t.key)}
                aria-pressed={isActive}
                className={cn(
                  "flex cursor-pointer flex-col items-center gap-0.5 px-2 py-2.5 text-center transition active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#FF2A2A]",
                  isActive
                    ? "bg-[#FF2A2A]/10 text-[#FF2A2A]"
                    : "text-(--muted) hover:bg-white/[0.02] hover:text-(--ink)",
                )}
              >
                <span className="text-label font-medium">{t.label}</span>
                <span className="font-mono text-[10px] uppercase tracking-[0.18em]">
                  {t.en}
                </span>
              </button>
            );
          })}
        </div>

        <div className="flex flex-col gap-3 p-3 sm:p-4">
          <div className="flex items-center justify-between">
            <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
              {STORE_META[tab].hint}
            </span>
            <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
              {tab === "aliexpress" ? "حالة الحملة" : `${active.length} عرض`}
            </span>
          </div>
          {tab === "aliexpress" ? (
            <AliExpressPromo />
          ) : (
            <div className="grid grid-cols-1 gap-3 md:grid-cols-2">
              {active.map((c) => (
                <CouponCard key={c.id} coupon={c} />
              ))}
            </div>
          )}
        </div>
      </div>

      <TrendingBar />
    </section>
  );
}

```

# src/components/CpuComparison.tsx

```tsx
import { useState } from "react";
import {
  ArrowDownWideNarrow,
  ArrowUpNarrowWide,
  CircleAlert,
  ExternalLink,
  Search,
  ShieldQuestion,
} from "lucide-react";
import { cn } from "#/lib/utils";
import {
  CPU_CHECKED,
  CPU_NO_VERIFIED_AR,
  CPU_NO_VERIFIED_EN,
  CPU_WARRANTY_AR,
  CONDITIONS,
  buildAliSearch,
  buildAmazonSearch,
  conditionTerms,
  findVerified,
  pricedCpus,
  sortByPrice,
  type CpuVerifiedListing,
} from "#/lib/verifiedCpus";

export function CpuComparison({ query }: { query: string }) {
  const model = query.trim().replace(/\s+/g, " ");
  const [dir, setDir] = useState<"asc" | "desc">("asc");

  const verifiedAll = findVerified(model);
  const priced = pricedCpus(verifiedAll);
  const sorted = sortByPrice(verifiedAll, dir);
  const showSort = priced.length > 1;

  return (
    <section className="flex flex-col gap-4">
      <div className="flex items-baseline gap-3 border-b border-white/15 pb-2">
        <span className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          [06 // CPU RETAIL PRICES]
        </span>
        <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          أسعار المعالجات / {model.toUpperCase()}
        </span>
      </div>

      {showSort && (
        <div className="flex items-center justify-end gap-1.5">
          {(["asc", "desc"] as const).map((d) => (
            <button
              key={d}
              type="button"
              onClick={() => setDir(d)}
              aria-pressed={dir === d}
              className={cn(
                "inline-flex cursor-pointer items-center gap-1.5 border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                dir === d
                  ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                  : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
              )}
            >
              {d === "asc" ? (
                <ArrowDownWideNarrow className="size-3.5" aria-hidden="true" />
              ) : (
                <ArrowUpNarrowWide className="size-3.5" aria-hidden="true" />
              )}
              {d === "asc" ? "الأقل" : "الأعلى"}
            </button>
          ))}
        </div>
      )}

      {/* Warranty / condition distinction */}
      <div className="flex items-start gap-2.5 border border-white/15 bg-white/[0.02] px-3 py-2.5">
        <ShieldQuestion className="mt-0.5 size-4 shrink-0 text-(--muted)" aria-hidden="true" />
        <p className="font-mono text-[11px] leading-relaxed text-(--muted)">{CPU_WARRANTY_AR}</p>
      </div>

      {/* Condition rows: boxed vs tray */}
      <div className="flex flex-col gap-3">
        {CONDITIONS.map((cond) => (
          <ConditionCard
            key={cond.id}
            condition={{ ...cond }}
            verified={sorted.filter((l) => l.condition === cond.id)}
            modelTerms={model}
          />
        ))}
      </div>

      <p className="font-mono text-[10px] leading-relaxed text-(--muted)">
        فحص القوائم: {CPU_CHECKED} · لا تُعرض أي أسعار مخترَعة، ولا تُفترض التسعيرات المقترحة كعروض قائمة.
      </p>
    </section>
  );
}

function ConditionCard({
  condition,
  verified,
  modelTerms,
}: {
  condition: { id: "boxed" | "tray"; label: string; en: string; note: string };
  verified: CpuVerifiedListing[];
  modelTerms: string;
}) {
  const listing = verified[0];
  const links = {
    amazon: buildAmazonSearch(conditionTerms(modelTerms, condition.id)),
    aliexpress: buildAliSearch(conditionTerms(modelTerms, condition.id)),
  };

  return (
    <article className="flex flex-col gap-3 border border-white/15 bg-white/[0.02] p-3">
      <div className="flex flex-wrap items-center justify-between gap-2 border-b border-white/10 pb-2">
        <div>
          <p className="text-label font-medium">{condition.label}</p>
          <p className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
            {condition.en} - {condition.note}
          </p>
        </div>
        <span className="inline-flex items-center gap-1 border border-white/20 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
          {condition.id === "boxed" ? "تصنيف: تجزئة" : "تصنيف: خام/OEM"}
        </span>
      </div>

      {listing && listing.price != null ? (
        <VerifiedPrice listing={listing} />
      ) : (
        <div className="flex flex-col gap-2.5">
          <p className="flex items-start gap-2 font-mono text-[12px] leading-relaxed text-amber-100/85">
            <CircleAlert className="mt-0.5 size-4 shrink-0 text-amber-400" aria-hidden="true" />
            {CPU_NO_VERIFIED_AR}
          </p>
          <p className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
            {CPU_NO_VERIFIED_EN}
          </p>
          <div className="flex flex-wrap items-center gap-2">
            <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
              فتح بحث المتجر ({condition.label}):
            </span>
            <StoreLink href={links.amazon} label="Amzn.sa" />
            <StoreLink href={links.aliexpress} label="AliExpress" />
          </div>
        </div>
      )}
    </article>
  );
}

function VerifiedPrice({ listing }: { listing: CpuVerifiedListing }) {
  return (
    <div className="flex flex-col gap-2">
      <div className="flex flex-wrap items-end justify-between gap-3">
        <div>
          <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
            السعر الحالي ({listing.retailer})
          </span>
          <p className="font-mono text-3xl font-bold tabular-nums text-[#4AF626]">
            {(listing.price as number).toLocaleString("en-US", {
              minimumFractionDigits: 2,
              maximumFractionDigits: 2,
            })}{" "}
            ر.س
          </p>
        </div>
        <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
          فُحص {listing.checkedAt}
        </span>
      </div>
      {(listing.stock || listing.delivery) && (
        <p className="font-mono text-[11px] text-(--muted)">
          {listing.stock && <span>المخزون: {listing.stock} · </span>}
          {listing.delivery && <span>التوصيل: {listing.delivery}</span>}
        </p>
      )}
      <div className="flex items-center gap-2">
        <span className="font-mono text-[9px] uppercase tracking-wider text-(--muted)">
          {listing.source}
        </span>
        <a
          href={listing.url}
          target="_blank"
          rel="noopener noreferrer"
          className="inline-flex cursor-pointer items-center gap-1.5 border border-white/25 bg-[#0D0F12] px-2.5 py-1.5 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#4AF626] hover:text-[#4AF626]"
        >
          {listing.urlExact ? "القائمة" : "بحث أمازون"}
          <ExternalLink className="size-3" aria-hidden="true" />
        </a>
      </div>
    </div>
  );
}

function StoreLink({ href, label }: { href: string; label: string }) {
  return (
    <a
      href={href}
      target="_blank"
      rel="noopener noreferrer"
      className="inline-flex cursor-pointer items-center gap-1.5 border border-white/25 bg-[#0D0F12] px-2.5 py-1.5 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#FF2A2A] hover:text-[#FF2A2A]"
    >
      <Search className="size-3" aria-hidden="true" />
      {label}
      <ExternalLink className="size-3" aria-hidden="true" />
    </a>
  );
}

```

# src/components/PartnerComparison.tsx

```tsx
import { useState } from "react";
import {
  ArrowDownWideNarrow,
  ArrowUpNarrowWide,
  CircleAlert,
  ExternalLink,
  Store,
  Wallet,
} from "lucide-react";
import { cn } from "#/lib/utils";
import {
  analyzePartner,
  buildPartnerLink,
  partnerVendors,
  sortEditions,
  type Edition,
} from "#/lib/partners";

export function PartnerComparison({
  query,
  intentId,
}: {
  query: string;
  intentId: string;
}) {
  const [vendor, setVendor] = useState<string>("all");
  const [dir, setDir] = useState<"asc" | "desc">("asc");

  const data = analyzePartner(query, intentId);
  if (!data) return null;

  const vendors = partnerVendors(data.editions);
  const sorted = sortEditions(data.editions, dir, vendor);

  return (
    <section className="flex flex-col gap-4">
      <div className="flex items-baseline gap-3 border-b border-white/15 pb-2">
        <span className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          [07 // PARTNER COMPARISON]
        </span>
        <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          مقارنة نسخ الشركات المصنعة / {data.model}
        </span>
      </div>

      <div className="flex items-start gap-2.5 border border-amber-500/30 bg-amber-500/[0.06] px-3 py-2.5">
        <CircleAlert className="mt-0.5 size-4 shrink-0 text-amber-400" aria-hidden="true" />
        <p className="text-meta font-medium leading-relaxed text-amber-100/80">
          لم يُربط أي خلاصة أسعار حية، لذا لا تُعرض أسعار مرصودة. الترتيب أدناه
          تقدير هرمي بين الإصدارات (حسب فئة المبرد/النسخة) وليس سعراً فعلياً،
          ولا يُعرض سعر MSRP لأنه غير موثَّق. افتح روابط البحث للمتاجر لمعرفة
          الأسعار الرسمية. {data.note}
        </p>
      </div>

      {/* Controls */}
      <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
        <div className="flex flex-wrap items-center gap-1.5">
          <button
            type="button"
            onClick={() => setVendor("all")}
            className={cn(
              "cursor-pointer border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
              vendor === "all"
                ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
            )}
          >
            الكل
          </button>
          {vendors.map((v) => (
            <button
              key={v}
              type="button"
              onClick={() => setVendor(v)}
              className={cn(
                "cursor-pointer border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                vendor === v
                  ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                  : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
              )}
            >
              {v}
            </button>
          ))}
        </div>

        <div className="flex items-center gap-1.5">
          {(["asc", "desc"] as const).map((d) => (
            <button
              key={d}
              type="button"
              onClick={() => setDir(d)}
              aria-pressed={dir === d}
              className={cn(
                "inline-flex cursor-pointer items-center gap-1.5 border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                dir === d
                  ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                  : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
              )}
            >
              {d === "asc" ? (
                <ArrowDownWideNarrow className="size-3.5" aria-hidden="true" />
              ) : (
                <ArrowUpNarrowWide className="size-3.5" aria-hidden="true" />
              )}
              {d === "asc" ? "من الأقل للأعلى" : "من الأعلى للأقل"}
            </button>
          ))}
        </div>
      </div>

      {/* Edition list */}
      <div className="flex flex-col border border-white/15">
        {sorted.map((e) => (
          <EditionRow key={e.id} edition={e} />
        ))}
      </div>

      <p className="font-mono text-[10px] leading-relaxed text-(--muted)">
        الترتيب حسب "رتبة تقديرية" بين الإصدارات (أساسها فئة المبرد/النسخة داخل
        العائلة) وليس سعراً مرصوداً. أي بيانات مواصفات (تردد Boost/مروحة) لن
        تُعرض إلا بدعم من مصدر بيانات.
      </p>
    </section>
  );
}

function EditionRow({ edition }: { edition: Edition }) {
  const est = edition.price.estimate;
  const verifiedPrice = edition.price.live;
  const msrp = edition.price.msrp;

  return (
    <div className="flex flex-col gap-3 border-b border-white/12 px-3 py-3.5 last:border-b-0">
      <div className="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
        <div className="flex min-w-0 items-center gap-3">
          <span className="shrink-0 font-mono text-lg font-bold text-[#FF2A2A] tabular-nums">
            {est ? (est.maxRank - est.rank + 1) : "—"}
          </span>
          <div className="min-w-0">
            <p className="flex flex-wrap items-center gap-2 text-label font-medium">
              <span className="font-mono uppercase tracking-wide text-(--muted)">
                {edition.brand}
              </span>
              {edition.edition}
            </p>
            <p className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
              {edition.tier}
            </p>
          </div>
        </div>

        <div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 md:shrink-0">
          <EditionPrice edition={edition} />
          <div className="flex items-center gap-1.5">
            <LaunchBtn market="amazon" terms={edition.linkTerms} />
            <LaunchBtn market="aliexpress" terms={edition.linkTerms} />
          </div>
        </div>
      </div>

      {(edition.boostClock || edition.cooling) ? (
        <p className="font-mono text-[10px] leading-relaxed text-(--muted)">
          {edition.boostClock && <span>Boost: {edition.boostClock} · </span>}
          {edition.cooling && <span>التبريد: {edition.cooling}</span>}
        </p>
      ) : (
        <p className="font-mono text-[10px] text-(--muted)/70">
          المواصفات (تردد Boost / تبريد): غير مؤكدة من مصدر حي.
        </p>
      )}

      {/* explicit live / MSRP status, always shown so the distinction is visible */}
      <p className="flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
        {verifiedPrice ? (
          <span className="text-[#4AF626]">
            سعر حي متحقّق · {verifiedPrice.amount} {verifiedPrice.currency} · {verifiedPrice.source} · {verifiedPrice.updatedAt}
          </span>
        ) : (
          <span className="text-amber-400/80">سعر حي: غير متصل / لا مصدر</span>
        )}
        {msrp ? (
          <span className="text-[#EAEAEA]">MSRP: {msrp.amount} {msrp.currency} · {msrp.source}</span>
        ) : (
          <span className="text-(--muted)/70">MSRP: غير موثَّق / لا مصدر</span>
        )}
      </p>
    </div>
  );
}

function EditionPrice({ edition }: { edition: Edition }) {
  const est = edition.price.estimate;
  return (
    <div className="flex flex-col">
      <span className="font-mono text-[9px] uppercase tracking-[0.18em] text-(--muted)">
        تقدير السعر
      </span>
      {est ? (
        <span className="inline-flex items-center gap-1.5 border border-amber-500/40 bg-amber-500/[0.06] px-1.5 py-0.5 font-mono text-[11px] font-bold text-amber-400">
          <Wallet className="size-3" aria-hidden="true" />
          {est.band} · {est.rank}/{est.maxRank}
        </span>
      ) : (
        <span className="font-mono text-[11px] text-(--muted)">
          تقدير غير متاح
        </span>
      )}
    </div>
  );
}

function LaunchBtn({ market, terms }: { market: "amazon" | "aliexpress"; terms: string }) {
  const url = buildPartnerLink(market, terms);
  return (
    <a
      href={url}
      target="_blank"
      rel="noopener noreferrer"
      aria-label={`فتح بحث ${market === "amazon" ? "أمازون" : "علي إكسبريس"} عن ${terms}`}
      className="inline-flex cursor-pointer items-center gap-1.5 border border-white/20 bg-[#0D0F12] px-2 py-1.5 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#FF2A2A] hover:text-[#FF2A2A] active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]"
    >
      <Store className="size-3" aria-hidden="true" />
      {market === "amazon" ? "Amzn.sa" : "AliExpress"}
      <ExternalLink className="size-3" aria-hidden="true" />
    </a>
  );
}

```

# src/components/PriceComparison.tsx

```tsx
import { useMemo, useState } from "react";
import {
  ArrowDownWideNarrow,
  ArrowUpNarrowWide,
  CircleAlert,
  ExternalLink,
  Loader2,
  Radar,
  Search,
  Store,
} from "lucide-react";
import { cn } from "#/lib/utils";
import {
  NO_VERIFIED_AR,
  NO_VERIFIED_EN,
  PARTNER_EDITIONS,
  REFERENCE_FAMILIES,
  buildModelLink,
  sortFamilies,
} from "#/lib/referencePrices";
import {
  LOADING_AR,
  groupByBrand,
  sortItems,
  type LiveScanResult,
} from "#/lib/livePricesShared";
import { queryLivePrices } from "#/lib/livePrices";

export type LiveFetcher = (q: string) => Promise<LiveScanResult>;

const USD = (n: number) => `$${n.toLocaleString("en-US")}`;

function retailerLinks(query: string) {
  const q = encodeURIComponent(query.trim());
  return {
    amazon: `https://www.amazon.sa/s?k=${q}`,
    aliexpress: `https://www.aliexpress.com/wholesale?SearchText=${q}`,
  };
}

export function PriceComparison({
  query,
  intentId,
  fetcher = queryLivePrices,
}: {
  query: string;
  intentId: string;
  fetcher?: LiveFetcher;
}) {
  const [loading, setLoading] = useState(false);
  const [live, setLive] = useState<LiveScanResult | null>(null);
  const [liveNote, setLiveNote] = useState<string | null>(null);
  const [dir, setDir] = useState<"asc" | "desc">("asc");
  const [liveDir, setLiveDir] = useState<"asc" | "desc">("asc");

  const isGpu = intentId === "gpu";
  const families = useMemo(
    () => sortFamilies(REFERENCE_FAMILIES, dir),
    [dir],
  );
  const links = useMemo(() => retailerLinks(query), [query]);
  const canScan = query.trim().length > 0;

  const onScan = async () => {
    if (!canScan || loading) return;
    setLoading(true);
    setLive(null);
    setLiveNote(null);
    try {
      const res = await fetcher(query);
      if (res.items.length > 0) {
        setLive(res);
      } else if (res.status === "no_provider") {
        setLiveNote(
          "لا يوجد مصدر أسعار حية مُعرّف بمفتاح موفر معتمد - تُعرض البيانات المرجعية وروابط المتجر (وليس سعراً مُخترَعاً).",
        );
      } else {
        setLiveNote(
          "لم يرجع مصدر الأسعار الحية نتائج معتمدة حاليًا - تُعرض البيانات المرجعية وروابط المتجر.",
        );
      }
    } finally {
      setLoading(false);
    }
  };

  const liveGrouped = useMemo(
    () => groupByBrand(sortItems(live?.items ?? [], liveDir)),
    [live, liveDir],
  );

  return (
    <section className="flex flex-col gap-4">
      <div className="flex items-baseline gap-3 border-b border-white/15 pb-2">
        <span className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          [05 // PRICE COMPARISON]
        </span>
        <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          مقارنة الأسعار المرجعية {isGpu ? "/ GPU" : ""}
        </span>
      </div>

      <div className="flex items-start gap-2.5 border border-amber-500/30 bg-amber-500/[0.06] px-3 py-2.5">
        <CircleAlert className="mt-0.5 size-4 shrink-0 text-amber-400" aria-hidden="true" />
        <p className="text-meta font-medium leading-relaxed text-amber-100/80">
          {isGpu
            ? "الأسعار المعروضة هنا مرجعية بوضوح: MSRP رسمي عند الإطلاق (تاريخي وليس سعر السوق الحالي) مع مصدره. لا يُعرض أي سعر سوق حالي إلا من موفّر معتمد، وبدونه يظهر «لا يوجد سعر موثّق» مع روابط المتاجر."
            : "لا توجد بيانات مرجعية موثقة لهذا النوع في الخصائص المرجعية. استخدم روابط المتاجر، ولا يُفترض سعر موثّق."}
        </p>
      </div>

      {/* Actions */}
      <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
        <div className="flex items-center gap-1.5">
          {(["asc", "desc"] as const).map((d) => (
            <button
              key={d}
              type="button"
              onClick={() => setDir(d)}
              aria-pressed={dir === d}
              className={cn(
                "inline-flex cursor-pointer items-center gap-1.5 border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                dir === d
                  ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                  : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
              )}
            >
              {d === "asc" ? (
                <ArrowDownWideNarrow className="size-3.5" aria-hidden="true" />
              ) : (
                <ArrowUpNarrowWide className="size-3.5" aria-hidden="true" />
              )}
              {d === "asc" ? "الأقل" : "الأعلى"}
            </button>
          ))}
          <span className="ms-1 font-mono text-[9px] uppercase tracking-wider text-(--muted)">
            فرز حسب MSRP
          </span>
        </div>

        <button
          type="button"
          onClick={onScan}
          disabled={!canScan || loading}
          className="inline-flex cursor-pointer items-center justify-center gap-2 border border-[#4AF626]/60 bg-[#4AF626]/10 px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.12em] text-[#4AF626] transition hover:bg-[#4AF626] hover:text-black active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60 disabled:cursor-not-allowed disabled:opacity-40"
        >
          {loading ? (
            <Loader2 className="size-4 animate-spin" aria-hidden="true" />
          ) : (
            <Radar className="size-4" aria-hidden="true" />
          )}
          {loading ? "جارٍ الفحص..." : "فحص الأسعار الحية"}
        </button>
      </div>

      {loading && (
        <div className="flex items-center gap-2.5 border border-[#4AF626]/40 bg-[#4AF626]/[0.05] px-3 py-3">
          <Loader2 className="size-4 shrink-0 animate-spin text-[#4AF626]" aria-hidden="true" />
          <p className="font-mono text-[12px] font-medium leading-relaxed text-[#EAEAEA]">
            {LOADING_AR}
          </p>
        </div>
      )}
      {liveNote && (
        <p className="font-mono text-[11px] leading-relaxed text-amber-100/75">
          ملاحظة: {liveNote}
        </p>
      )}

      {/* Live items (only when a permitted source returned them) */}
      {live && live.items.length > 0 && (
        <div className="flex flex-col gap-3">
          <div className="flex items-center justify-between gap-2">
            <span className="font-mono text-[10px] uppercase tracking-wider text-[#4AF626]">
              نتائج حية من مصدر معتمد · فُحص {live.checkedAt}
            </span>
            <div className="flex items-center gap-1.5">
              {(["asc", "desc"] as const).map((d) => (
                <button
                  key={`live-${d}`}
                  type="button"
                  onClick={() => setLiveDir(d)}
                  aria-pressed={liveDir === d}
                  className={cn(
                    "inline-flex cursor-pointer items-center gap-1 border px-2 py-0.5 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                    liveDir === d
                      ? "border-[#4AF626] bg-[#4AF626]/10 text-[#4AF626]"
                      : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
                  )}
                >
                  {d === "asc" ? "الأقل" : "الأعلى"}
                </button>
              ))}
            </div>
          </div>
          <div className="flex flex-col border border-white/15">
            {liveGrouped.map((g) => (
              <div key={g.brand} className="flex flex-col border-b border-white/10 last:border-b-0">
                <div className="border-b border-white/10 bg-white/[0.02] px-3 py-2 font-mono text-[11px] uppercase tracking-[0.18em] text-[#FF2A2A]">
                  [{g.brand}]
                </div>
                {g.items.map((it) => (
                  <div key={it.id} className="flex flex-wrap items-center justify-between gap-3 px-3 py-2.5">
                    <div className="min-w-0 flex-1">
                      <p className="text-label font-medium leading-snug">{it.title}</p>
                      {it.seller && (
                        <p className="font-mono text-[10px] uppercase text-(--muted)">البائع: {it.seller}</p>
                      )}
                    </div>
                    <div className="flex shrink-0 items-center gap-3">
                      {it.price && (
                        <span className="font-mono text-label font-bold tabular-nums text-[#4AF626]">
                          {it.price.amount.toLocaleString()} {it.price.currency}
                        </span>
                      )}
                      {it.url && (
                        <a
                          href={it.url}
                          target="_blank"
                          rel="noopener noreferrer"
                          className="inline-flex cursor-pointer items-center gap-1 border border-white/20 px-2 py-1 font-mono text-[10px] uppercase tracking-wider text-(--ink) hover:border-[#4AF626] hover:text-[#4AF626]"
                        >
                          فتح
                          <ExternalLink className="size-3" aria-hidden="true" />
                        </a>
                      )}
                    </div>
                  </div>
                ))}
              </div>
            ))}
          </div>
        </div>
      )}

      {/* Reference cards (GPU) or generic fallback */}
      {isGpu ? (
        <div className="grid grid-cols-1 gap-3 md:grid-cols-2">
          {families.map((f) => (
            <article key={f.id} className="flex flex-col border border-white/15 bg-white/[0.02] p-3">
              <div className="flex flex-wrap items-center justify-between gap-2 border-b border-white/10 pb-2">
                <span className="font-mono text-label font-bold uppercase tracking-wide text-[#EAEAEA]">
                  {f.model}
                </span>
                {f.msrp ? (
                  <span className="inline-flex items-center gap-1 border border-amber-500/50 bg-amber-500/10 px-1.5 py-0.5 font-mono text-[10px] font-bold uppercase tracking-wider text-amber-400">
                    MSRP: {USD(f.msrp.amount)}
                  </span>
                ) : (
                  <span className="inline-flex items-center gap-1 border border-white/20 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                    لا يوجد سعر موثّق
                  </span>
                )}
              </div>

              <dl className="flex flex-col gap-1 py-2 font-mono text-[10px] leading-relaxed">
                <div className="flex gap-2">
                  <dt className="shrink-0 text-(--muted)">النوع</dt>
                  <dd>MSRP عند الإطلاق (تاريخي - ليس سعر السوق الحالي)</dd>
                </div>
                <div className="flex gap-2">
                  <dt className="shrink-0 text-(--muted)">العملة</dt>
                  <dd>USD سعر الإطلاق الأمريكي - دون تحويل موثوق</dd>
                </div>
                {f.msrp && (
                  <div className="flex gap-2">
                    <dt className="shrink-0 text-(--muted)">المصدر</dt>
                    <dd>{f.msrp.source}</dd>
                  </div>
                )}
                <div className="flex gap-2">
                  <dt className="shrink-0 text-(--muted)">السعر الحالي</dt>
                  <dd className="text-amber-100/70">
                    {NO_VERIFIED_AR}
                  </dd>
                </div>
              </dl>

              {/* AIB / partner editions */}
              <div className="flex flex-col gap-1.5 border-t border-white/10 pt-2">
                {PARTNER_EDITIONS.map((p) => {
                  const terms = `${f.search} ${p.brand} ${p.edition}`;
                  return (
                    <div key={`${f.id}-${p.brand}-${p.edition}`} className="flex items-center justify-between gap-2">
                      <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                        {p.brand} {p.edition}
                      </span>
                      <span className="flex items-center gap-1.5">
                        <MarketBtn market="amazon" terms={terms} />
                        <MarketBtn market="aliexpress" terms={terms} />
                      </span>
                    </div>
                  );
                })}
              </div>

              <div className="mt-2 flex flex-wrap items-center gap-2 border-t border-white/10 pt-2">
                <span className="font-mono text-[9px] uppercase tracking-wider text-(--muted)">
                  بحث الطراز:
                </span>
                <MarketBtn market="amazon" terms={f.search} />
                <MarketBtn market="aliexpress" terms={f.search} />
              </div>
            </article>
          ))}
        </div>
      ) : (
        <div className="flex flex-col gap-3 border border-dashed border-white/15 px-4 py-6">
          <p className="font-mono text-[12px] leading-relaxed text-(--muted)">
            {NO_VERIFIED_AR}
          </p>
          {canScan && (
            <div className="flex flex-wrap items-center gap-2">
              <span className="font-mono text-[10px] uppercase tracking-wider text-(--muted)">
                افتح بحث المتجر:
              </span>
              <MarketBtn market="amazon" terms={query} />
              <MarketBtn market="aliexpress" terms={query} />
            </div>
          )}
        </div>
      )}
    </section>
  );
}

function MarketBtn({ market, terms }: { market: "amazon" | "aliexpress"; terms: string }) {
  const url = buildModelLink(market, terms);
  return (
    <a
      href={url}
      target="_blank"
      rel="noopener noreferrer"
      aria-label={`بحث ${market === "amazon" ? "أمازون" : "علي إكسبريس"}: ${terms}`}
      className="inline-flex cursor-pointer items-center gap-1 border border-white/20 bg-[#0D0F12] px-2 py-1 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#FF2A2A] hover:text-[#FF2A2A] active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]"
    >
      <Store className="size-3" aria-hidden="true" />
      {market === "amazon" ? "Amzn.sa" : "AliExpress"}
      <Search className="size-3" aria-hidden="true" />
    </a>
  );
}

```

# src/components/VerifiedListings.tsx

```tsx
import { useState } from "react";
import {
  ArrowDownWideNarrow,
  ArrowUpNarrowWide,
  CircleAlert,
  ExternalLink,
  Search,
  Truck,
} from "lucide-react";
import { cn } from "#/lib/utils";
import {
  VERIFIED_LISTINGS,
  formatSAR,
  outOfStockListings,
  sortByPrice,
  type VerifiedListing,
} from "#/lib/verifiedListings";

const SNAPSHOT_AR =
  "لقطات أسعار موثّقة من قوائم Amazon.sa بتاريخ فحص 2026-10-29. الأسعار قابلة للتغيّر، والبيانات تُعرض كما رُصدت دون اعتبار أي سعر «متوسط سوق».";
const SNAPSHOT_EN =
  "Verified price snapshots from Amazon.sa listings, checked 2026-10-29. Prices change; shown as observed, never called a market average.";

export function VerifiedListings() {
  const [dir, setDir] = useState<"asc" | "desc">("asc");
  const priced = sortByPrice(VERIFIED_LISTINGS, dir);
  const unavailable = outOfStockListings(VERIFIED_LISTINGS);

  return (
    <section className="flex flex-col gap-4">
      <div className="flex items-baseline gap-3 border-b border-white/15 pb-2">
        <span className="font-mono text-[11px] uppercase tracking-[0.25em] text-[#FF2A2A]">
          [06 // VERIFIED AMAZON KSA LISTINGS]
        </span>
        <span className="font-mono text-[10px] uppercase tracking-[0.2em] text-(--muted)">
          قوائم موثّقة بأسعار فعلية من Amazon.sa
        </span>
      </div>

      <div className="flex items-start gap-2.5 border border-[#4AF626]/30 bg-[#4AF626]/[0.05] px-3 py-2.5">
        <CircleAlert className="mt-0.5 size-4 shrink-0 text-[#4AF626]" aria-hidden="true" />
        <p className="text-meta font-medium leading-relaxed text-emerald-100/85">
          {SNAPSHOT_AR}
        </p>
      </div>

      {/* Priced, sorted numerically */}
      <div className="flex flex-col gap-3">
        <div className="flex flex-wrap items-center justify-between gap-3">
          <span className="font-mono text-[11px] uppercase tracking-[0.18em] text-(--muted)">
            بأسعار معلومة ({priced.length})
          </span>
          <div className="flex items-center gap-1.5">
            {(["asc", "desc"] as const).map((d) => (
              <button
                key={d}
                type="button"
                onClick={() => setDir(d)}
                aria-pressed={dir === d}
                className={cn(
                  "inline-flex cursor-pointer items-center gap-1.5 border px-2.5 py-1 font-mono text-[10px] uppercase tracking-wider transition active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#FF2A2A]",
                  dir === d
                    ? "border-[#FF2A2A] bg-[#FF2A2A]/10 text-[#FF2A2A]"
                    : "border-white/20 bg-[#0D0F12] text-(--muted) hover:border-white/40",
                )}
              >
                {d === "asc" ? (
                  <ArrowDownWideNarrow className="size-3.5" aria-hidden="true" />
                ) : (
                  <ArrowUpNarrowWide className="size-3.5" aria-hidden="true" />
                )}
                {d === "asc" ? "الأقل" : "الأعلى"}
              </button>
            ))}
          </div>
        </div>

        <div className="flex flex-col border border-white/15">
          {priced.map((l) => (
            <ListingRow key={l.id} listing={l} />
          ))}
        </div>
      </div>

      {/* Out of stock / unavailable - separate, no price, NOT sorted with prices */}
      {unavailable.length > 0 && (
        <div className="flex flex-col gap-2">
          <span className="font-mono text-[11px] uppercase tracking-[0.18em] text-(--muted)">
            غير متوفر حالياً (بدون سعر) - آخر فحص
          </span>
          <div className="flex flex-col border border-white/12 bg-white/[0.015]">
            {unavailable.map((l) => (
              <UnavailableRow key={l.id} listing={l} />
            ))}
          </div>
        </div>
      )}

      <p className="font-mono text-[10px] leading-relaxed text-(--muted)">
        ملاحظة: بعض نتائج البحث (مثل Acer Nitro RX 7800 XT بسعر شاذ منخفض، وعروض حرّاج المستعملة)
        لم تُعرض لأنها غير مؤكدة كقوائم متاجر جديدة.
      </p>
    </section>
  );
}

function ListingRow({ listing }: { listing: VerifiedListing }) {
  return (
    <div className="flex flex-col gap-2 border-b border-white/10 px-3 py-3 last:border-b-0">
      <div className="flex flex-col gap-2 md:flex-row md:items-center md:justify-between">
        <div className="min-w-0 flex-1">
          <p className="flex flex-wrap items-center gap-2 text-label font-medium">
            <span className="font-mono uppercase tracking-wide text-(--muted)">
              {listing.brand} {listing.model}
            </span>
            {listing.variant}
          </p>
          <p className="mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
            <span>Amazon.sa</span>
            {listing.availability === "observed" && listing.caveat && (
              <span className="text-amber-400">{listing.caveat}</span>
            )}
            {listing.rating != null && (
              <span>
                {listing.rating.toFixed(1)}★{listing.reviews != null ? ` (${listing.reviews})` : ""}
              </span>
            )}
            {listing.stock && <span className="text-amber-300">المخزون: {listing.stock}</span>}
            {listing.delivery && <span className="text-(--muted)">{listing.delivery}</span>}
            {listing.freeShipping && (
              <span className="inline-flex items-center gap-1 text-[#4AF626]">
                <Truck className="size-3" aria-hidden="true" /> شحن مجاني
              </span>
            )}
          </p>
          <p className="mt-1 font-mono text-[9px] uppercase tracking-wider text-(--muted)">
            فُحص {listing.checkedAt} · {listing.source}
          </p>
        </div>

        <div className="flex shrink-0 items-center gap-3">
          <span className="font-mono text-lg font-bold tabular-nums text-[#4AF626]">
            {listing.price != null ? formatSAR(listing.price) : "—"}
          </span>
          {listing.url && (
            <a
              href={listing.url}
              target="_blank"
              rel="noopener noreferrer"
              aria-label={`فتح القائمة: ${listing.brand} ${listing.model}`}
              className="inline-flex cursor-pointer items-center gap-1.5 border border-white/25 bg-[#0D0F12] px-2.5 py-1.5 font-mono text-[10px] uppercase tracking-wider text-(--ink) transition hover:border-[#4AF626] hover:text-[#4AF626]"
            >
              {listing.urlExact ? "القائمة" : "بحث أمازون"}
              <ExternalLink className="size-3" aria-hidden="true" />
            </a>
          )}
        </div>
      </div>
    </div>
  );
}

function UnavailableRow({ listing }: { listing: VerifiedListing }) {
  return (
    <div className="flex flex-col gap-2 border-b border-white/8 px-3 py-3 last:border-b-0 md:flex-row md:items-center md:justify-between">
      <div className="min-w-0 flex-1">
        <p className="text-label font-medium text-(--muted)">
          <span className="font-mono uppercase tracking-wide">{listing.brand}</span>{" "}
          {listing.model} {listing.variant}
        </p>
        {listing.specs && (
          <p className="mt-0.5 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
            {listing.specs.join(" · ")}
          </p>
        )}
        <p className="mt-1 font-mono text-[9px] uppercase tracking-wider text-(--muted)">
          فُحص {listing.checkedAt} · {listing.source}
        </p>
      </div>
      <div className="flex shrink-0 items-center gap-3">
        <span className="inline-flex items-center gap-1 border border-white/20 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-(--muted)">
          <CircleAlert className="size-3" aria-hidden="true" />
          غير متوفر - لا يوجد سعر
        </span>
        {listing.url && (
          <a
            href={listing.url}
            target="_blank"
            rel="noopener noreferrer"
            className="inline-flex cursor-pointer items-center gap-1 border border-white/20 bg-[#0D0F12] px-2 py-1 font-mono text-[10px] uppercase tracking-wider text-(--muted) hover:text-[#FF2A2A]"
          >
            <Search className="size-3" aria-hidden="true" />
            القائمة
            <ExternalLink className="size-3" aria-hidden="true" />
          </a>
        )}
      </div>
    </div>
  );
}

```

# src/lib/aliPromo.ts

```ts
export type AliForecast = {
  label: string;
  en: string;
  thresholdUsd: number;
  discountUsd: number;
  note: string;
};

export type AliPromoState = {
  statusLabel: string;
  en: string;
  checkedAt: string;
  officialUrl: string;
  officialLabel: string;
  providerConnected: boolean;
  providerNote: string;
  forecastIntro: string;
  forecasts: AliForecast[];
};

/**
 * Honest AliExpress KSA 11.11 promo state. As of the checked date there is NO
 * official/current source confirming any Saudi 11.11 code as active. The USD
 * thresholds below are the user's PROPOSED forecast tiers for a future campaign
 * only - they are NOT confirmed, NOT copyable, and NOT presented as working.
 */
export const ALI_KSA_PROMO: AliPromoState = {
  statusLabel:
    "لم تُعلن / لم يتم التحقق من أكواد 11.11 للسعودية بعد (حتى تاريخ الفحص). لا تُعرض أكواد قديمة أو مكررة أو من دول أخرى ككواد سارية.",
  en: "No announced or verified KSA 11.11 codes yet (as of the checked date). Stale, duplicated, or non-KSA codes are not shown as active.",
  checkedAt: "2026-10-29",
  officialUrl: "https://www.aliexpress.com/",
  officialLabel: "صفحة علي إكسبريس الرسمية (اختر المنطقة السعودية)",
  providerConnected: false,
  providerNote:
    "تحديث الأكواد يتطلب مصدراً معتمداً (حملة رسمية/API أو تحقق من إتمام الدفع). خلية الأكواد الحية غير موصولة حالياً، لذا لا يُدَّعى رصد تلقائي.",
  forecastIntro:
    "إطار توقعي غير مؤكد (نطاقات إنفاق مقترحة لحملة مستقبلية) - عرض توعوي فقط، وليس كوداً سارياً ولا يُنسخ ولا يُعتد به كعرض. القيم بالدولار الإطارية دون تحويل موثوق للريال.",
  forecasts: [
    { label: "إنفاق 39 دولار", en: "spend $39", thresholdUsd: 39, discountUsd: 5, note: "غير مؤكد / للتوقع فقط" },
    { label: "إنفاق 79 دولار", en: "spend $79", thresholdUsd: 79, discountUsd: 10, note: "غير مؤكد / للتوقع فقط" },
    { label: "إنفاق 119 دولار", en: "spend $119", thresholdUsd: 119, discountUsd: 15, note: "غير مؤكد / للتوقع فقط" },
    { label: "إنفاق 229 دولار", en: "spend $229", thresholdUsd: 229, discountUsd: 30, note: "غير مؤكد / للتوقع فقط" },
    { label: "إنفاق 349 دولار", en: "spend $349", thresholdUsd: 349, discountUsd: 50, note: "غير مؤكد / للتوقع فقط" },
  ],
};

```

# src/lib/coupons.ts

```ts
export type StoreKey = "amazon" | "aliexpress";

export type CouponKind = "bank" | "card" | "1111";

export type CouponStatus = "verified" | "unverified" | "sample";

export type Coupon = {
  id: string;
  store: StoreKey;
  kind: CouponKind;
  issuer: string;
  en: string;
  code?: string; // literal promo code (only present when hasCode is true)
  hasCode: boolean;
  discount: string;
  eligibility: string;
  validity?: string;
  exclusions?: string;
  /** Honesty note about how the offer applies (e.g. bank = at checkout, no code). */
  note?: string;
  source: string;
  status: CouponStatus;
  verified: boolean;
};

export const STORE_META: Record<StoreKey, { label: string; en: string; hint: string }> = {
  amazon: { label: "أمازون السعودية", en: "Amazon.sa", hint: "عروض البنوك عند الدفع" },
  aliexpress: { label: "علي إكسبريس", en: "AliExpress", hint: "حالة حملة 11.11 (أكواد غير محققة)" },
};

export const COUPONS_BY_STORE: Record<StoreKey, Coupon[]> = {
  amazon: [
    {
      id: "am-rajhi",
      store: "amazon",
      kind: "bank",
      issuer: "الراجحي / Al Rajhi",
      en: "Al Rajhi card offer at checkout",
      hasCode: false,
      discount: "خصم 20% لغاية 150 ر.س لبطاقة الراجحي الائتمانية",
      eligibility: "حامل بطاقة الراجحي الائتمانية",
      validity: "خلال حملة 11.11",
      note: "عرض يُفَعَّل تلقائياً من خيار الدفع على أمازون - لا يوجد كود لإدخاله.",
      source: "مثال - ليس من مصدر حي",
      status: "sample",
      verified: false,
    },
    {
      id: "am-snb",
      store: "amazon",
      kind: "bank",
      issuer: "البنك الأهلي / SNB",
      en: "SNB card offer at checkout",
      hasCode: false,
      discount: "خصم 15% لغاية 100 ر.س لبطاقات سنب الائتمانية",
      eligibility: "بطاقات سنب الائتمانية",
      validity: "حتى نهاية فعالية 11.11",
      note: "عرض يُفَعَّل تلقائياً عند الدفع - لا يوجد كود لإدخاله.",
      source: "مثال - ليس من مصدر حي",
      status: "sample",
      verified: false,
    },
    {
      id: "am-alinma",
      store: "amazon",
      kind: "bank",
      issuer: "مصرف الإنماء / Alinma",
      en: "Alinma card offer at checkout",
      hasCode: false,
      discount: "خصم 10% لبطاقة الإنماء الائتمانية على طلبات مختارة",
      eligibility: "حامل بطاقة الإنماء الائتمانية",
      validity: "خلال حملة 11.11",
      note: "عرض يُفَعَّل تلقائياً عند الدفع - لا يوجد كود لإدخاله.",
      source: "مثال - ليس من مصدر حي",
      status: "sample",
      verified: false,
    },
    {
      id: "am-qitaf",
      store: "amazon",
      kind: "card",
      issuer: "قيتاف / Qitaf",
      en: "Qitaf rewards at checkout",
      hasCode: false,
      discount: "إمكانية استخدام نقاط قيتاف للخصم أو استرداد عند الدفع",
      eligibility: "حساب قيتاف مفعّل مع بطاقة مؤهلة",
      validity: "حسب العروض الحالية",
      note: "يُستخدم من خانة قيتاف أثناء الدفع - لا يوجد كود لإدخاله.",
      source: "مثال - ليس من مصدر حي",
      status: "sample",
      verified: false,
    },
  ],
  // AliExpress: NO fabricated codes. KSA 11.11 codes are not confirmed/verified,
  // so the store exposes zero copyable codes. See src/lib/aliPromo.ts for the
  // honest campaign status + non-copyable forecast and the dedicated UI.
  aliexpress: [],
};

export const ALL_COUPONS: Coupon[] = [
  ...COUPONS_BY_STORE.amazon,
  ...COUPONS_BY_STORE.aliexpress,
];

export const TRENDING_OFFERS: Coupon[] = [
  COUPONS_BY_STORE.amazon[0],
  COUPONS_BY_STORE.amazon[1],
  COUPONS_BY_STORE.amazon[3],
  COUPONS_BY_STORE.amazon[2],
];

```

# src/lib/launcher.ts

```ts
export type Marketplace = "amazon" | "aliexpress" | "both";
export type MarketKey = "amazon" | "aliexpress";
export type SortId = "price-asc" | "price-desc" | "rating" | "orders";

export type ProductIntent = {
  id: string;
  label: string;
  en: string;
  positive: string[];
  negative: string[];
};

export const MARKETPLACE_OPTIONS: {
  value: Marketplace;
  label: string;
  en: string;
}[] = [
  { value: "amazon", label: "أمازون السعودية", en: "Amazon.sa" },
  { value: "aliexpress", label: "علي إكسبريس", en: "AliExpress" },
  { value: "both", label: "الاثنان معاً", en: "Amazon + AliExpress" },
];

export const MARKET_META: Record<MarketKey, { label: string; en: string }> = {
  amazon: { label: "أمازون السعودية", en: "Amazon.sa" },
  aliexpress: { label: "علي إكسبريس", en: "AliExpress" },
};

// Filters that the destination search URL can actually encode. A marketplace
// with no value for a given filter simply does not offer it (never claimed).
export const SORT_OPTIONS: {
  id: SortId;
  label: string;
  en: string;
  amazon?: string;
  aliexpress?: string;
}[] = [
  {
    id: "price-asc",
    label: "السعر: من الأقل للأعلى",
    en: "Price: low to high",
    amazon: "s=price-asc-rank",
    aliexpress: "SortType=priceAsc",
  },
  {
    id: "price-desc",
    label: "السعر: من الأعلى للأقل",
    en: "Price: high to low",
    amazon: "s=price-desc-rank",
    aliexpress: "SortType=priceDesc",
  },
  {
    id: "rating",
    label: "الأعلى تقييماً",
    en: "Highest rating",
    amazon: "s=review-rank",
    aliexpress: undefined,
  },
  {
    id: "orders",
    label: "الأكثر طلباً",
    en: "Most ordered",
    amazon: undefined,
    aliexpress: "SortType=salesDesc",
  },
];

const DEFAULT_ACCESSORY_NEGATIVES = [
  "cable",
  "cables",
  "cover",
  "adapter",
  "adapters",
  "keychain",
  "keychains",
  "sticker",
  "stickers",
  "bracket",
];

const INTENTS: ProductIntent[] = [
  {
    id: "motherboard",
    label: "لوحة أم",
    en: "Motherboard",
    positive: ["Motherboard", "AMD AM5", "Socket AM5"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "stand", "screw", "riser", "frame"],
  },
  {
    id: "cpu",
    label: "معالج",
    en: "CPU",
    positive: ["CPU", "Processor", "Desktop"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "cooler", "case", "tray", "holder"],
  },
  {
    id: "ram",
    label: "ذاكرة RAM",
    en: "RAM",
    positive: ["DDR5", "RAM", "Memory", "Desktop"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "cooler", "case", "heatspreader", "rgb"],
  },
  {
    id: "cooler",
    label: "مبرد معالج",
    en: "CPU Cooler",
    positive: ["CPU Cooler", "Air Cooler"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "liquid", "pump", "water block", "mount"],
  },
  {
    id: "psu",
    label: "مزود طاقة",
    en: "PSU",
    positive: ["Power Supply", "PSU"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "sleeve", "extension", "tester", "mount"],
  },
  {
    id: "gpu",
    label: "كرت شاشة",
    en: "Graphics Card",
    positive: ["Graphics Card", "GPU"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "riser", "vertical mount", "backplate", "miner"],
  },
  {
    id: "ssd",
    label: "قرص تخزين",
    en: "SSD / NVMe",
    positive: ["NVMe", "SSD", "M.2"],
    negative: [...DEFAULT_ACCESSORY_NEGATIVES, "enclosure", "usb", "external", "caddy"],
  },
  {
    id: "phone",
    label: "هاتف / جوال",
    en: "Phone",
    positive: [],
    negative: [
      "case",
      "cover",
      "tempered glass",
      "screen protector",
      "film",
      "cable",
      "cables",
      "charger",
      "charging cable",
      "stand",
      "pop socket",
      "keychain",
    ],
  },
  {
    id: "laptop",
    label: "لابتوب",
    en: "Laptop",
    positive: ["Laptop"],
    negative: [
      "case",
      "sleeve",
      "bag",
      "cover",
      "stand",
      "battery",
      "charging cable",
      "adapter",
      "screen protector",
    ],
  },
  {
    id: "generic",
    label: "عام",
    en: "Generic",
    positive: [],
    negative: DEFAULT_ACCESSORY_NEGATIVES,
  },
];

function detectByRegex(query: string): ProductIntent | null {
  const q = ` ${query.toLowerCase()} `;
  // Unicode-aware word boundaries (ASCI \b does not work around Arabic chars).
  const L = "(?<![a-z0-9\\u0600-\\u06ff])";
  const R = "(?![a-z0-9\\u0600-\\u06ff])";
  const rx = (body: string) => new RegExp(`${L}(${body})${R}`, "");
  const rules: [RegExp, string][] = [
    [rx("rtx ?\\d+|rtx|rx ?\\d+|gpu|graphics card|كرت شاشة|بطاقة رسومات"), "gpu"],
    [rx("b\\d{3,4}|x\\d{2,3}e?|am5|mobo|motherboard|ماذربورد|لوحة أم|لوحة ام|بورد"), "motherboard"],
    [
      rx(
        "ryzen|[0-9]+x3d|core i\\d+|intel core|cpu|processor|معالج|7(?:6|7|8)00x?|5[67]00x?|9(?:6|7|9)00x?",
      ),
      "cpu",
    ],
    [rx("ddr5|ddr4|hynix|trident|ram|ذاكرة|تخزين وصول"), "ram"],
    [rx("ps120|peerless assassin|pa120|thermalright|aio|air cooler|مبرد|برج تبريد"), "cooler"],
    [rx("psu|power supply|مزود طاقة|titan|seasonic|corsair rmx|rm\\d+x"), "psu"],
    [rx("nvme|ssd|\\d+tb|\\d+gb|تخزين|قرص صلب"), "ssd"],
    [
      rx(
        "iphone|أيفون|ايفون|samsung galaxy|سامسونج|s[0-9]{2}|redmi|xiaomi|poco|realme|honor|phone|جوال|هاتف|موبايل",
      ),
      "phone",
    ],
    [rx("laptop|notebook|لابتوب|لابتوبات"), "laptop"],
  ];
  for (const [re, id] of rules) {
    if (re.test(q)) {
      return INTENTS.find((i) => i.id === id) ?? null;
    }
  }
  return null;
}

export function detectIntent(query: string): ProductIntent {
  const trimmed = query.trim();
  if (!trimmed) return INTENTS.find((i) => i.id === "generic")!;
  return detectByRegex(trimmed) ?? INTENTS.find((i) => i.id === "generic")!;
}

export function buildPositiveTerms(query: string, intent: ProductIntent): string[] {
  const base = query
    .trim()
    .split(/\s+/)
    .filter((t) => t.length > 0);
  const seen = new Set<string>();
  const out: string[] = [];
  for (const term of [...base, ...intent.positive]) {
    const key = term.toLowerCase();
    if (seen.has(key)) continue;
    seen.add(key);
    out.push(term);
  }
  return out;
}

export type LaunchUrl = {
  url: string;
  applied: string | null;
  primeNote?: boolean;
};

export function buildLaunchUrl(
  market: MarketKey,
  positive: string[], // already encoded terms (safe: encode at build)
  negative: string[],
  sortId: SortId,
): LaunchUrl {
  const encode = encodeURIComponent(positive.join(" "));
  const sort = SORT_OPTIONS.find((s) => s.id === sortId);
  const sortParam = sort ? sort[market] : undefined;

  if (market === "amazon") {
    const base = `https://www.amazon.sa/s?k=${encode}`;
    return {
      url: sortParam ? `${base}&${sortParam}` : base,
      applied: sortParam ? (sort ? sort.label : null) : null,
      primeNote: true, // Prime cannot be encoded in the URL; must be toggled in store UI.
    };
  }

  const base = `https://www.aliexpress.com/wholesale?SearchText=${encode}`;
  return {
    url: sortParam ? `${base}&${sortParam}` : base,
    applied: sortParam ? (sort ? sort.label : null) : null,
  };
}

export type LauncherPlan = {
  intent: ProductIntent;
  positive: string[];
  negative: string[];
  launches: { key: MarketKey; url: string; applied: string | null; primeNote?: boolean }[];
};

export function planLauncher(
  query: string,
  market: Marketplace,
  sortId: SortId | null,
): LauncherPlan {
  const intent = detectIntent(query);
  const positive = buildPositiveTerms(query, intent);
  const keys: MarketKey[] =
    market === "both" ? ["amazon", "aliexpress"] : [market];
  const launches = keys.map((key) => {
    const u = buildLaunchUrl(key, positive, intent.negative, sortId ?? "price-asc");
    return { key, url: u.url, applied: u.applied, primeNote: u.primeNote };
  });
  return { intent, positive, negative: intent.negative, launches };
}

export const BUILD_PRESETS: { id: string; label: string; en: string; query: string }[] = [
  { id: "cpu", label: "Ryzen 7 9800X3D", en: "CPU", query: "Ryzen 7 9800X3D" },
  { id: "mobo", label: "Gigabyte B650 Eagle AX", en: "Motherboard", query: "Gigabyte B650 Eagle AX" },
  { id: "ram", label: "32GB Hynix A-die 6000MHz CL30", en: "RAM", query: "32GB Hynix A-die 6000MHz CL30" },
  { id: "cooler", label: "Thermalright PS120 / PA120SE", en: "Cooler", query: "Thermalright Peerless Assassin 120 SE" },
  { id: "psu", label: "Lian Li / Majesty Titan PSU", en: "PSU", query: "Lian Li PSU" },
  { id: "ssd", label: "1TB / 2TB NVMe", en: "SSD", query: "2TB NVMe M.2 SSD" },
];

```

# src/lib/livePrices.ts

```ts
import { createServerFn } from "@tanstack/react-start";
import { providerConfigured, NO_PROVIDER_AR, NO_PROVIDER_EN } from "./livePricesShared";
import type { LiveScanResult } from "./livePricesShared";

/**
 * Queries an authorized retailer price provider. Credentials are read ONLY on
 * the server (never sent to the browser). If no authorized provider/key is
 * configured, we return a transparent "no provider" result and NEVER fabricate
 * listings or pretend live scanning succeeded.
 */
export const queryLivePrices = createServerFn({
  method: "POST",
})
  .validator((d: { query: string; market: string }) => d)
  .handler(async ({ data }): Promise<LiveScanResult> => {
    const provider = process.env.PRICE_PROVIDER;
    const key = process.env.PRICE_PROVIDER_KEY;
    const checkedAt = new Date().toISOString();

    if (!providerConfigured(provider, key)) {
      return {
        ok: false,
        status: "no_provider",
        items: [],
        checkedAt,
        message: {
          code: "no_provider",
          ar: NO_PROVIDER_AR,
          en: NO_PROVIDER_EN,
        },
      };
    }

    // A working, permitted integration would live here. Because no authorized
    // source is integrated, we return an honest error instead of mock data.
    return {
      ok: false,
      status: "error",
      items: [],
      checkedAt,
      message: {
        code: "error",
        ar: "موفّر الأسعار الموجود في بيئة التشغيل غير مدعوم في هذه النسخة، لذا لا تُعرض بيانات مُنشأة ولا أسعار مزيّفة.",
        en: "The configured provider is not an integrated, permitted source in this build; no data is fabricated or shown.",
      },
    };
  });

```

# src/lib/livePricesShared.ts

```ts
export type Market = "amazon" | "aliexpress";

export type LiveItem = {
  id: string;
  title: string;
  market: Market;
  price: { amount: number; currency: string } | null;
  seller?: string;
  rating?: number;
  reviews?: number;
  delivery?: string;
  checkedAt: string;
  url?: string;
  brand?: string;
};

export type LiveScanStatus = "ok" | "no_provider" | "error" | "empty";

export type LiveScanResult = {
  ok: boolean;
  status: LiveScanStatus;
  items: LiveItem[];
  checkedAt: string;
  message: ProviderMessage;
};

export type ProviderMessage = {
  code: "loading" | "no_provider" | "error" | "empty" | "ok";
  ar: string;
  en: string;
};

export const LOADING_AR = "جاري رصد وفحص الأسعار الحية من المتاجر...";
export const LOADING_EN = "Scanning live retailer prices...";

export const NO_PROVIDER_AR =
  "لا يمكن عرض أسعار حية حالياً: ميزة رصد الأسعار تتطلب مفتاح موفر/API معتمد (مثل Amazon PA-API أو مزود أسعار مرخّص) بأهلية صحيحة. لم يُربط أي مصدر، لذا لا تُعرض أسعار مخترَعة أو مقدَّرة كأنها حقيقية. استخدم أزرار البحث أدناه للاطلاع على الأسعار الرسمية في المتاجر.";
export const NO_PROVIDER_EN =
  "No real prices can be shown: live price scanning needs an authorized provider/API key (e.g. Amazon PA-API or a licensed price source). No source is connected, so no fabricated or estimated prices are presented as real. Use the store search links below for official prices.";

export function providerConfigured(
  provider?: string,
  key?: string,
): boolean {
  return Boolean(provider && key && provider.length > 0 && key.length > 0);
}

export function groupByBrand(
  items: LiveItem[],
): { brand: string; items: LiveItem[] }[] {
  const map = new Map<string, LiveItem[]>();
  for (const it of items) {
    const brand = it.brand && it.brand.trim() ? it.brand.trim() : "غير مصنف";
    const arr = map.get(brand) ?? [];
    arr.push(it);
    map.set(brand, arr);
  }
  return Array.from(map.entries()).map(([brand, its]) => ({ brand, items: its }));
}

export function sortItems(items: LiveItem[], dir: "asc" | "desc"): LiveItem[] {
  const withPrice = items.filter((i) => i.price && i.price.amount != null);
  const noPrice = items.filter((i) => !(i.price && i.price.amount != null));
  const sorted = [...withPrice].sort((a, b) => {
    const d = a.price!.amount - b.price!.amount;
    return dir === "asc" ? d : -d;
  });
  return [...sorted, ...noPrice];
}

```

# src/lib/partners.ts

```ts
export type PriceKind = "live" | "estimate" | "msrp" | "none";

export type LivePrice = {
  amount: string;
  currency: string;
  source: string;
  updatedAt: string;
};

export type Estimate = {
  band: string;
  basis: string;
  rank: number;
  maxRank: number;
};

export type EditionPrice = {
  kind: PriceKind;
  live?: LivePrice; // source-verified, only ever set from a real feed/API
  estimate?: Estimate; // clearly labeled target/estimate, never an observed price
  msrp?: { amount: string; currency: string; source: string }; // official launch MSRP, only when sourced
};

export type Edition = {
  id: string;
  brand: string;
  edition: string;
  tier: string; // qualitative build/cooler tier (structural identity, not a measured spec)
  linkTerms: string;
  /** Populated only when a real data source supports it; otherwise undefined. */
  boostClock?: string;
  cooling?: string;
  price: EditionPrice;
  verified: boolean; // true ONLY when price.kind === "live"
};

export type VendorEditionTemplate = {
  brand: string;
  editions: { edition: string; tier: string; tierKey: "basic" | "mid" | "premium" }[];
};

const TIER_BAND: Record<"basic" | "mid" | "premium", { band: string; rank: number }> = {
  basic: { band: "فئة الدخول (مبرد هواء أساسي)", rank: 1 },
  mid: { band: "فئة متوسطة (مبرد هواء أكبر)", rank: 2 },
  premium: { band: "فئة متميزة (مبرد هواء/سائل)", rank: 3 },
};

const GPU_PARTNERS: VendorEditionTemplate[] = [
  {
    brand: "ASUS",
    editions: [
      { edition: "TUF Gaming", tier: "مبرد هواء كبير", tierKey: "mid" },
      { edition: "ROG Strix", tier: "مبرد هواء متميز", tierKey: "premium" },
      { edition: "Prime", tier: "مبرد هواء أساسي", tierKey: "basic" },
    ],
  },
  {
    brand: "ASRock",
    editions: [
      { edition: "Phantom Gaming", tier: "مبرد هواء متميز", tierKey: "premium" },
      { edition: "Steel Legend", tier: "مبرد هواء كبير", tierKey: "mid" },
      { edition: "Challenger", tier: "مبرد هواء أساسي", tierKey: "basic" },
    ],
  },
  {
    brand: "XFX",
    editions: [
      { edition: "Speedster MERC", tier: "مبرد هواء متميز", tierKey: "premium" },
      { edition: "Speedster QICK", tier: "مبرد هواء كبير", tierKey: "mid" },
      { edition: "Speedster SWFT", tier: "مبرد هواء أساسي", tierKey: "basic" },
    ],
  },
  {
    brand: "Sapphire",
    editions: [
      { edition: "Nitro+", tier: "مبرد هواء متميز", tierKey: "premium" },
      { edition: "Pure", tier: "مبرد هواء كبير", tierKey: "mid" },
      { edition: "Pulse", tier: "مبرد هواء أساسي", tierKey: "basic" },
    ],
  },
  {
    brand: "Gigabyte",
    editions: [
      { edition: "Gaming OC", tier: "مبرد هواء متميز", tierKey: "premium" },
      { edition: "Windforce", tier: "مبرد هواء كبير", tierKey: "mid" },
      { edition: "Eagle", tier: "مبرد هواء أساسي", tierKey: "basic" },
    ],
  },
];

const CPU_EDITIONS: { edition: string; tier: string; tierKey: "basic" | "mid" }[] = [
  { edition: "Boxed (تجزئة)", tier: "نسخة التجزئة الصندوقية", tierKey: "mid" },
  { edition: "OEM / Tray (خام)", tier: "نسخة خام بدون علبة تبريد", tierKey: "basic" },
];

const ESTIMATE_BASIS =
  "تقدير هرمي حسب فئة المبرد/النسخة داخل العائلة وليس سعراً مرصوداً ولا MSP موثقاً";

function estimateFor(tierKey: "basic" | "mid" | "premium", maxRank: number): Estimate {
  const base = TIER_BAND[tierKey];
  return { band: base.band, basis: ESTIMATE_BASIS, rank: base.rank, maxRank };
}

function normalizeModel(query: string): string {
  return query.trim().replace(/\s+/g, " ").toUpperCase();
}

export function buildPartnerLink(market: "amazon" | "aliexpress", terms: string): string {
  const encoded = encodeURIComponent(terms);
  return market === "amazon"
    ? `https://www.amazon.sa/s?k=${encoded}`
    : `https://www.aliexpress.com/wholesale?SearchText=${encoded}`;
}

export function analyzePartner(
  query: string,
  intentId: string,
): { isCpu: boolean; model: string; modelTerms: string; editions: Edition[]; note: string } | null {
  if (intentId !== "gpu" && intentId !== "cpu") return null;
  if (!query.trim()) return null;

  const isCpu = intentId === "cpu";
  const modelTerms = query.trim().replace(/\s+/g, " ");
  const model = normalizeModel(query);

  const editions: Edition[] = [];

  if (isCpu) {
    for (const ed of CPU_EDITIONS) {
      const maxRank = 2;
      editions.push({
        id: `cpu-${ed.edition}`,
        brand: "AMD",
        edition: ed.edition,
        tier: ed.tier,
        linkTerms: `${modelTerms} ${ed.edition}`,
        price: { kind: "estimate", estimate: estimateFor(ed.tierKey, maxRank) },
        verified: false,
      });
    }
  } else {
    for (const vendor of GPU_PARTNERS) {
      for (const ed of vendor.editions) {
        editions.push({
          id: `${vendor.brand}-${ed.edition}`,
          brand: vendor.brand,
          edition: ed.edition,
          tier: ed.tier,
          linkTerms: `${modelTerms} ${vendor.brand} ${ed.edition}`,
          price: { kind: "estimate", estimate: estimateFor(ed.tierKey, 3) },
          verified: false,
        });
      }
    }
  }

  return {
    isCpu,
    model,
    modelTerms,
    editions,
    note: isCpu
      ? "نسخ المعالج: التجزئة (Boxed) مقابل الخام (OEM/Tray)."
      : "نسخ المصنعين (AIB): توزيع كل شريك على إصداراته من الشركة المصنعة فقط.",
  };
}

export function sortEditions(
  editions: Edition[],
  dir: "asc" | "desc",
  vendor: string,
): Edition[] {
  const filtered = vendor === "all" ? editions : editions.filter((e) => e.brand === vendor);
  const rank = (e: Edition): number => e.price.estimate?.rank ?? 0;
  return [...filtered].sort((a, b) => (dir === "asc" ? rank(a) - rank(b) : rank(b) - rank(a)));
}

export function partnerVendors(editions: Edition[]): string[] {
  return Array.from(new Set(editions.map((e) => e.brand)));
}

```

# src/lib/referencePrices.ts

```ts
export type Provenance =
  | "verified_live" // only ever set from a working, permitted live source
  | "historical_msrp" // documented official launch MSRP
  | "estimate" // clearly labeled, defensible estimate/range
  | "none"; // no verified price available

export type MsrpReference = {
  amount: number;
  currency: "USD"; // kept in USD; no reliable SAR conversion asserted
  label: string;
  source: string;
  provenance: "historical_msrp";
};

export type RefFamily = {
  id: string;
  model: string;
  search: string; // canonical search terms (model)
  msrp?: MsrpReference; // undefined => "no verified price available"
};

// Official US launch MSRPs (widely documented AMD / NVIDIA launch prices).
// These are HISTORICAL references, explicitly NOT current market prices.
const MSRP_SOURCE =
  "سعر الإطلاق الأمريكي الرسمي الموثق (AMD/NVIDIA) - مرجع تاريخي وليس سعر السوق الحالي";

const msrp = (amount: number, label: string): MsrpReference => ({
  amount,
  currency: "USD",
  label,
  source: MSRP_SOURCE,
  provenance: "historical_msrp",
});

export const REFERENCE_FAMILIES: RefFamily[] = [
  { id: "rx6800xt", model: "RX 6800 XT", search: "RX 6800 XT", msrp: msrp(649, "RX 6800 XT") },
  { id: "rx7800xt", model: "RX 7800 XT", search: "RX 7800 XT", msrp: msrp(499, "RX 7800 XT") },
  { id: "rx7900xt", model: "RX 7900 XT", search: "RX 7900 XT", msrp: msrp(899, "RX 7900 XT") },
  { id: "rx7900xtx", model: "RX 7900 XTX", search: "RX 7900 XTX", msrp: msrp(999, "RX 7900 XTX") },
  { id: "rtx4070super", model: "RTX 4070 SUPER", search: "RTX 4070 Super", msrp: msrp(599, "RTX 4070 SUPER") },
  { id: "rtx4070tisuper", model: "RTX 4070 Ti SUPER", search: "RTX 4070 Ti Super", msrp: msrp(799, "RTX 4070 Ti SUPER") },
  { id: "rtx4080super", model: "RTX 4080 SUPER", search: "RTX 4080 Super", msrp: msrp(999, "RTX 4080 SUPER") },
  { id: "rtx4090", model: "RTX 4090", search: "RTX 4090", msrp: msrp(1599, "RTX 4090") },
];

/** AIB / board-partner editions shown per GPU family (real product lines, for search/linking). */
export const PARTNER_EDITIONS: { brand: string; edition: string }[] = [
  { brand: "ASUS", edition: "TUF Gaming" },
  { brand: "ASRock", edition: "Steel Legend" },
  { brand: "XFX", edition: "Speedster QICK" },
  { brand: "XFX", edition: "Speedster MERC" },
  { brand: "Sapphire", edition: "Nitro+" },
  { brand: "Gigabyte", edition: "Gaming OC" },
];

export const NO_VERIFIED_AR =
  "لا يوجد سعر موثّق متاح: بيانات السوق الحالية لا تصل عبر مصدر معتمد. استخدم روابط البحث أدناه لسعر المتجر الرسمي.";
export const NO_VERIFIED_EN =
  "No verified price available: current market data is not reached through an authorized source. Use the search links below for the store's official price.";

export function sortFamilies(families: RefFamily[], dir: "asc" | "desc"): RefFamily[] {
  const withMsrp = families.filter((f) => f.msrp);
  const noMsrp = families.filter((f) => !f.msrp);
  const sorted = [...withMsrp].sort((a, b) => {
    const d = a.msrp!.amount - b.msrp!.amount;
    return dir === "asc" ? d : -d;
  });
  return [...sorted, ...noMsrp];
}

export function buildModelLink(market: "amazon" | "aliexpress", terms: string): string {
  const encoded = encodeURIComponent(terms);
  return market === "amazon"
    ? `https://www.amazon.sa/s?k=${encoded}`
    : `https://www.aliexpress.com/wholesale?SearchText=${encoded}`;
}

```

# src/lib/utils.ts

```ts
export function cn(
  ...classes: Array<string | false | null | undefined>
): string {
  return classes.filter(Boolean).join(" ");
}

```

# src/lib/verifiedCpus.ts

```ts
export type CpuCondition = "boxed" | "tray";

export type CpuVerifiedListing = {
  id: string;
  model: string;
  condition: CpuCondition;
  price: number | null; // null => no verified price (none are confirmed in this run)
  currency: "SAR";
  retailer: string;
  boxed: boolean; // true = retail boxed; false = OEM/Tray
  url: string;
  urlExact: boolean;
  stock?: string;
  delivery?: string;
  checkedAt: string;
  source: string;
};

export const CPU_CHECKED = "2026-10-29";

export const CPU_NO_VERIFIED_AR =
  "السعر الحالي غير متاح من مصدر موثوق: لم تُعِد حسابات القوائم برقم سعر مؤكد لهذا المعالج في الفحص الحالي.";
export const CPU_NO_VERIFIED_EN =
  "Current price unavailable from a reliable source: this run did not return a confirmed price for this CPU.";

export const CPU_WARRANTY_AR =
  "النسخة الصندوقية (Boxed) قد تحمل ضمان البائع/الوكيل؛ النسخة الخام (OEM/Tray) عادةً بدون تغليف المستهلك وقد لا تحمل نفس الضمان - لا يُفترض التكافؤ.";

export const CONDITIONS: { id: CpuCondition; label: string; en: string; note: string }[] = [
  {
    id: "boxed",
    label: "Boxed / تجزئة",
    en: "Boxed retail",
    note: "نسخة التجزئة الصندوقية بتغليف رسمي للمستهلك.",
  },
  {
    id: "tray",
    label: "OEM / Tray (خام)",
    en: "OEM / Tray",
    note: "نسخة خام/علبة خشب بدون تغليف المستهلك.",
  },
];

// No confirmed current SAR price for the named CPUs was found in this run, so
// VERIFIED_CPUS intentionally holds zero entries. We never invent prices here.
export const VERIFIED_CPUS: CpuVerifiedListing[] = [];

export function buildAmazonSearch(terms: string): string {
  return `https://www.amazon.sa/s?k=${encodeURIComponent(terms)}`;
}

export function buildAliSearch(terms: string): string {
  return `https://www.aliexpress.com/wholesale?SearchText=${encodeURIComponent(terms)}`;
}

export function conditionTerms(model: string, condition: CpuCondition): string {
  return condition === "boxed"
    ? `${model} Boxed`
    : `${model} OEM Tray`;
}

export function findVerified(model: string): CpuVerifiedListing[] {
  const n = model.trim().toLowerCase().replace(/\s+/g, "");
  return VERIFIED_CPUS.filter((c) =>
    c.model.toLowerCase().replace(/\s+/g, "").includes(n),
  );
}

export function pricedCpus(listings: CpuVerifiedListing[]): CpuVerifiedListing[] {
  return listings.filter((l) => l.price != null);
}

export function sortByPrice(
  listings: CpuVerifiedListing[],
  dir: "asc" | "desc",
): CpuVerifiedListing[] {
  const priced = pricedCpus(listings);
  return [...priced].sort((a, b) => {
    const d = (a.price as number) - (b.price as number);
    return dir === "asc" ? d : -d;
  });
}

```

# src/lib/verifiedListings.ts

```ts
export type ListingAvailability = "in_stock" | "out_of_stock" | "observed";

export type VerifiedListing = {
  id: string;
  model: string;
  brand: string;
  variant: string;
  price: number | null; // null => no verified price (e.g. out of stock). Never fabricated.
  currency: "SAR";
  retailer: string;
  availability: ListingAvailability;
  url: string;
  urlExact: boolean; // true = validated exact product URL; false = retailer search link (observed)
  freeShipping?: boolean;
  stock?: string;
  delivery?: string;
  rating?: number;
  reviews?: number;
  specs?: string[];
  caveat?: string; // e.g. single observed listing, not market average
  source: string;
  checkedAt: string;
};

const CHECKED = "2026-10-29";

function amazonSearch(terms: string): string {
  return `https://www.amazon.sa/s?k=${encodeURIComponent(terms)}`;
}

// Verified, confirmed current in-stock listings from Amazon.sa (checked 2026-10-29).
const IN_STOCK: VerifiedListing[] = [
  {
    id: "sapphire-7900xt",
    model: "RX 7900 XT",
    brand: "Sapphire",
    variant: "21323-01-20G AMD Radeon RX 7900 XT 20GB GDDR6",
    price: 4145.61,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "in_stock",
    url: "https://www.amazon.sa/-/en/Sapphire-21323-01-20G-Radeon-Graphics/dp/B0BQNCSW3X",
    urlExact: true,
    freeShipping: true,
    rating: 4.4,
    reviews: 64,
    source: "Amazon.sa قائمة موثقة (نفس صفحة المنتج)",
    checkedAt: CHECKED,
  },
  {
    id: "asrock-9070xt-steellegend",
    model: "RX 9070 XT",
    brand: "ASRock",
    variant: "Steel Legend 16GB",
    price: 4449.95,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "in_stock",
    url: amazonSearch("ASRock RX 9070 XT Steel Legend 16GB"),
    urlExact: false,
    freeShipping: true,
    stock: "2 متبقي",
    delivery: "توصيل السبت 31 أكتوبر",
    rating: 4.6,
    reviews: 469,
    source: "رصد قائمة Amazon.sa عبر بحث (لا يوجد رابط مباشر موثق)",
    checkedAt: CHECKED,
  },
  {
    id: "asus-9070xt-prime",
    model: "RX 9070 XT",
    brand: "ASUS",
    variant: "Prime Radeon RX 9070 XT White OC",
    price: 4642.0,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "in_stock",
    url: amazonSearch("ASUS Prime Radeon RX 9070 XT White OC"),
    urlExact: false,
    freeShipping: true,
    stock: "3 متبقي",
    rating: 4.6,
    reviews: 68,
    source: "رصد قائمة Amazon.sa عبر بحث (لا يوجد رابط مباشر موثق)",
    checkedAt: CHECKED,
  },
  {
    id: "powercolor-9070xt-hellhound",
    model: "RX 9070 XT",
    brand: "PowerColor",
    variant: "Hellhound Reva",
    price: 4436.61,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "in_stock",
    url: amazonSearch("PowerColor Hellhound RX 9070 XT"),
    urlExact: false,
    freeShipping: true,
    stock: "3 متبقي",
    delivery: "توصيل 8-10 نوفمبر",
    rating: 4.6,
    reviews: 30,
    source: "رصد قائمة Amazon.sa عبر بحث (لا يوجد رابط مباشر موثق)",
    checkedAt: CHECKED,
  },
  {
    id: "gigabyte-9060xt-ice",
    model: "RX 9060 XT",
    brand: "Gigabyte",
    variant: "Gaming OC Ice 16GB",
    price: 3618.8,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "in_stock",
    url: amazonSearch("Gigabyte RX 9060 XT Gaming OC Ice 16GB"),
    urlExact: false,
    freeShipping: true,
    delivery: "يُشحن خلال 13-14 يوم",
    rating: 4.6,
    reviews: 150,
    source: "رصد قائمة Amazon.sa عبر بحث (لا يوجد رابط مباشر موثق)",
    checkedAt: CHECKED,
  },
];

// A single observed listing price - NOT a market average.
const OBSERVED: VerifiedListing[] = [
  {
    id: "powercolor-7900xtx-hellhound",
    model: "RX 7900 XTX",
    brand: "PowerColor",
    variant: "Hellhound",
    price: 9172.51,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "observed",
    url: amazonSearch("PowerColor Hellhound RX 7900 XTX"),
    urlExact: false,
    caveat: "رصد قائمة واحدة فقط - وليس متوسط السوق",
    source: "رصد قائمة Amazon.sa (سعر مرتفع لقائمة واحدة)",
    checkedAt: CHECKED,
  },
];

// Out of stock / unavailable - kept separate, NO price, not sorted with prices.
const OUT_OF_STOCK: VerifiedListing[] = [
  {
    id: "asrock-7900xt-phantom-white",
    model: "RX 7900 XT",
    brand: "ASRock",
    variant: "Phantom Gaming White 20GB OC",
    price: null,
    currency: "SAR",
    retailer: "Amazon.sa",
    availability: "out_of_stock",
    url: "https://www.amazon.sa/-/en/Asrock-Radeon-Phantom-Gaming-White/dp/B0CST1D8CD",
    urlExact: true,
    rating: 4.3,
    reviews: 72,
    specs: ["Boost 2.45GHz", "3 مراوح", "2x8-pin"],
    source: "Amazon.sa قائمة موثقة (غير متوفر حالياً)",
    checkedAt: CHECKED,
  },
];

export const VERIFIED_LISTINGS: VerifiedListing[] = [
  ...IN_STOCK,
  ...OBSERVED,
  ...OUT_OF_STOCK,
];

/** Only listings that actually have a price (in-stock + single observed). */
export function pricedListings(listings: VerifiedListing[]): VerifiedListing[] {
  return listings.filter((l) => l.price != null);
}

export function outOfStockListings(listings: VerifiedListing[]): VerifiedListing[] {
  return listings.filter((l) => l.availability === "out_of_stock");
}

/** Numeric sort over known prices only; null-price listings are never included. */
export function sortByPrice(
  listings: VerifiedListing[],
  dir: "asc" | "desc",
): VerifiedListing[] {
  const priced = pricedListings(listings);
  return [...priced].sort((a, b) => {
    const d = (a.price as number) - (b.price as number);
    return dir === "asc" ? d : -d;
  });
}

export function formatSAR(amount: number): string {
  return `${amount.toLocaleString("en-US", {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2,
  })} ر.س`;
}

```

# src/styles.css

```css
@import "./poke-defaults.css";

@import "tailwindcss";

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
}


/* Poke page anchor — keep LAST in this file so it wins over the token block above. */
:root, .dark {
  --background: var(--surface);
  --foreground: var(--ink);
}

/* ===== Cyberpunk tactical substrate (single-page tool: forced dark) ===== */
:root {
  color-scheme: dark;
  --surface: #0B0D10;
  --ink: #EAEAEA;
  --muted: #9AA0A6;
  --line: rgba(234, 234, 234, 0.16);
  --background: #0B0D10;
  --foreground: #EAEAEA;
}
html {
  background: #0A0A0A;
}
body {
  background: #0A0A0A;
  color: var(--ink);
}

/* CRT scanlines for telemetry panels */
.scanlines {
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.22) 2px,
    rgba(0, 0, 0, 0.22) 4px
  );
}

/* Hairline technical frame used for section compartments */
.crt-frame {
  border: 1px solid rgba(234, 234, 234, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

```

# src/poke-defaults.css

```css
/* Poke default style: Exposure display + OpenRunde text + Poke backgrounds. Keep this file. */
@font-face {
  font-family: "Exposure";
  src: url("/fonts/Exposure-205TF-VAR.woff2") format("woff2");
  font-style: normal;
}
@font-face {
  font-family: "Exposure";
  src: url("/fonts/Exposure-205TF-VAR-Italic.woff2") format("woff2");
  font-style: italic;
}
@font-face {
  font-family: "OpenRunde";
  src: url("/fonts/OpenRunde-Regular.woff2") format("woff2");
  font-weight: 400;
}
@font-face {
  font-family: "OpenRunde";
  src: url("/fonts/OpenRunde-Medium.woff2") format("woff2");
  font-weight: 500;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Variable.woff2") format("woff2");
  font-weight: 100 800;
}
:root {
  color-scheme: light dark;
  --surface: #FFFDFA;
  --ink: #171717;
  --muted: #737373;
  --line: rgba(23, 23, 23, 0.14);
  --accent: #3b6ea5;
}
.dark {
  --surface: #0E0E11;
  --ink: #f5f5f5;
  --muted: #9a9a9a;
  --line: rgba(255, 255, 255, 0.16);
  --accent: #7aa7d6;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --surface: #0E0E11;
    --ink: #f5f5f5;
    --muted: #9a9a9a;
    --line: rgba(255, 255, 255, 0.16);
    --accent: #7aa7d6;
  }
}
/* Type scale + font families — use these instead of ad-hoc text-[..px]/font-[..] values. */
@theme {
  --font-sans: "OpenRunde", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --text-eyebrow: 13px;
  --text-eyebrow--line-height: 1.5;
  --text-meta: 12px;
  --text-meta--line-height: 1.2;
  --text-label: 15px;
  --text-label--line-height: 1.2;
  --text-body: 15px;
  --text-body--line-height: 1.6;
  --text-heading: 18px;
  --text-heading--line-height: 1.4;
  --text-name: 24px;
  --text-name--line-height: 1.3;
}
html {
  font-family: "OpenRunde", system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
  overscroll-behavior: none;
}
h1 {
  font-family: "Exposure", "OpenRunde", sans-serif;
  font-weight: 500;
  font-variation-settings: "EXPO" -10;
  line-height: 1.2;
  text-wrap: pretty;
}
h2, h3 {
  font-family: "OpenRunde", system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: pretty;
}
/* Display face for non-heading display text (stat numbers, pull quotes). Use only at >= 24px / text-name. */
.font-display {
  font-family: "Exposure", "OpenRunde", sans-serif;
  font-weight: 500;
  font-variation-settings: "EXPO" -10;
}
h4, h5, h6 {
  font-family: "OpenRunde", system-ui, sans-serif;
  font-weight: 500;
  text-wrap: pretty;
}
a[href],
button:not(:disabled),
[role="button"]:not(:disabled),
[role="link"],
label[for],
select:not(:disabled),
summary {
  cursor: pointer;
}
code, pre, kbd, samp {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

```

# src/router.tsx

```tsx
import { createRouter as createTanStackRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";

export function getRouter() {
  const router = createTanStackRouter({
    routeTree,
    scrollRestoration: true,
    defaultPreload: "intent",
    defaultPreloadStaleTime: 0,
  });

  return router;
}

declare module "@tanstack/react-router" {
  interface Register {
    router: ReturnType<typeof getRouter>;
  }
}

```
