// mavin launch — faithful iPhone frame + V2 (staging) app screens.
// Rebuilt to the Runda World Design System V2: OBSIDIAN surfaces (#07090F),
// parchment text, BRASS (#A27D4B) the single accent, certified green #4A8C5F,
// edge-first corners (radius 3), brand fonts (Futura / Neue Haas / Plex Mono).
// Every screen is a PURE function of a 0..1 progress `p` for frame-accurate export.
// Lifted from mavin-vault@staging: ScoreRing, AgentProgressLoader, VaultCheckReport,
// HomeV2, IdentifyReviewView, BottomDock (v2), v2-tokens.css.

const { clamp, Easing } = window;
const eoc = Easing.easeOutCubic;
const PHOTO = "../assets/photo/watch-rolex-yash.jpg";

const DISP = "var(--font-display)";   // Futura
const BODY = "var(--font-body)";      // Neue Haas
const MONO = "var(--font-mono)";      // IBM Plex Mono

// ── mavin working-v1 monogram (inline, recolorable) ─────────────────
function MavinMark({ size = 26, color = "var(--g-fg)", style }) {
  // Charcoal squircle with bone "m." — matches assets/brand/mavin-app-icon.svg.
  // (Function name kept for compatibility with all existing call sites.)
  return (
    <svg width={size} height={size} viewBox="0 0 64 64"
      style={style} aria-hidden="true">
      <rect width="64" height="64" rx="14" ry="14" fill={color} />
      <text x="32" y="44" fontFamily="'Helvetica Neue','Arial Black',sans-serif" fontSize="40" fontWeight="800" letterSpacing="-1" textAnchor="middle" fill="#F4EFE3">m.</text>
    </svg>
  );
}

// ── icon set ──────────────────────────────────────────────────────
function Icon({ name, size = 18, stroke = 1.5 }) {
  const c = { width: size, height: size, viewBox: "0 0 24 24", fill: "none",
    stroke: "currentColor", strokeWidth: stroke, strokeLinecap: "round", strokeLinejoin: "round" };
  switch (name) {
    case "home": return <svg {...c}><path d="M3 11l9-8 9 8" /><path d="M5 10v10h14V10" /></svg>;
    case "archive": return <svg {...c}><rect x="3" y="4" width="18" height="4" rx="0.5" /><path d="M5 8v12h14V8" /><path d="M10 12h4" /></svg>;
    case "trend": return <svg {...c}><path d="M3 17l6-6 4 4 7-8" /><path d="M17 7h4v4" /></svg>;
    case "print": return <svg {...c}><path d="M4 4h13l3 3v13H4z" /><path d="M8 9h8M8 13h8M8 17h5" /></svg>;
    case "gear": return <svg {...c}><circle cx="12" cy="12" r="3" /><path d="M19 12a7 7 0 0 0-.1-1.2l2-1.5-2-3.4-2.4.9a7 7 0 0 0-2-1.2L14 3h-4l-.5 2.6a7 7 0 0 0-2 1.2L5 5.9 3 9.3l2 1.5A7 7 0 0 0 5 12a7 7 0 0 0 0 1.2L3 14.7l2 3.4 2.5-.9a7 7 0 0 0 2 1.2L10 21h4l.5-2.6a7 7 0 0 0 2-1.2l2.5.9 2-3.4-2-1.5c.07-.4.1-.79.1-1.2z" /></svg>;
    case "x": return <svg {...c}><path d="M6 6l12 12M18 6L6 18" /></svg>;
    case "check": return <svg {...c}><path d="M4 12l5 5L20 6" /></svg>;
    case "eye": return <svg {...c}><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7z" /><circle cx="12" cy="12" r="2.5" /></svg>;
    case "search": return <svg {...c}><circle cx="11" cy="11" r="7" /><path d="M21 21l-4-4" /></svg>;
    case "shield": return <svg {...c}><path d="M12 3l8 3v5c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10V6l8-3z" /></svg>;
    case "file": return <svg {...c}><path d="M14 3H6v18h12V7z" /><path d="M14 3v4h4" /></svg>;
    case "brain": return <svg {...c}><path d="M9 4a3 3 0 0 0-3 3 3 3 0 0 0-1 5 3 3 0 0 0 2 5 3 3 0 0 0 4 1V4z" /><path d="M15 4a3 3 0 0 1 3 3 3 3 0 0 1 1 5 3 3 0 0 1-2 5 3 3 0 0 1-4 1" /></svg>;
    case "scale": return <svg {...c}><path d="M12 4v16M6 20h12" /><path d="M6 7l-3 6h6zM18 7l-3 6h6zM6 7h12" /></svg>;
    case "activity": return <svg {...c}><path d="M3 12h4l3 8 4-16 3 8h4" /></svg>;
    case "globe": return <svg {...c}><circle cx="12" cy="12" r="9" /><path d="M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18" /></svg>;
    case "clock": return <svg {...c}><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></svg>;
    case "timer": return <svg {...c}><circle cx="12" cy="13" r="8" /><path d="M12 13V9M9 2h6" /></svg>;
    case "radar": return <svg {...c}><circle cx="12" cy="12" r="9" /><circle cx="12" cy="12" r="4.5" /><path d="M12 12l6-4" /></svg>;
    case "bolt": return <svg {...c}><path d="M13 2L4 14h7l-1 8 9-12h-7z" /></svg>;
    default: return null;
  }
}

// ── shared bits ────────────────────────────────────────────────────
function Eyebrow({ children, lower = true, style }) {
  return <span style={{ fontFamily: DISP, fontWeight: 600, fontSize: 11.5, letterSpacing: "0.16em",
    color: "var(--g-brass)", textTransform: lower ? "lowercase" : "uppercase", ...style }}>{children}</span>;
}
function MonoCap({ children, style }) {
  return <span style={{ fontFamily: MONO, fontSize: 10, letterSpacing: "0.18em", textTransform: "uppercase",
    color: "var(--g-fg-3)", ...style }}>{children}</span>;
}
function Flag({ children, brass }) {
  return <span style={{ fontFamily: MONO, fontSize: 10, letterSpacing: "0.08em",
    color: brass ? "var(--g-brass)" : "var(--g-fg-2)", border: `1px solid ${brass ? "var(--g-brass)" : "var(--g-line-strong)"}`,
    padding: "5px 9px", borderRadius: 3, whiteSpace: "nowrap" }}>{children}</span>;
}
function Pill({ tone = "green", children, style }) {
  const t = {
    green: { bg: "rgba(74,140,95,0.12)", fg: "var(--g-green)", bd: "rgba(74,140,95,0.36)" },
    gold: { bg: "rgba(162,125,75,0.10)", fg: "var(--g-brass)", bd: "rgba(162,125,75,0.42)" },
    ember: { bg: "rgba(181,58,45,0.10)", fg: "var(--g-ember)", bd: "rgba(181,58,45,0.34)" },
  }[tone];
  return (
    <span style={{ display: "inline-flex", alignItems: "center", gap: 6, padding: "6px 13px", borderRadius: 999,
      border: `1px solid ${t.bd}`, background: t.bg, color: t.fg, fontFamily: MONO, fontSize: 10.5,
      fontWeight: 500, letterSpacing: "0.14em", textTransform: "uppercase", whiteSpace: "nowrap", ...style }}>
      <span style={{ width: 6, height: 6, borderRadius: 999, background: "currentColor" }} aria-hidden="true" />
      {children}
    </span>
  );
}

// ── status bar (parchment on obsidian) ────────────────────────────
function StatusBar() {
  const col = "var(--g-fg)";
  return (
    <div style={{ position: "absolute", top: 0, left: 0, right: 0, height: 54, zIndex: 40,
      display: "flex", alignItems: "center", justifyContent: "space-between", padding: "0 30px", fontFamily: BODY }}>
      <span style={{ color: col, fontSize: 15, fontWeight: 600, letterSpacing: "0.02em" }}>9:41</span>
      <div style={{ display: "flex", alignItems: "center", gap: 7 }}>
        <svg width="18" height="12" viewBox="0 0 18 12" fill="currentColor" style={{ color: col }}><rect x="0" y="8" width="3" height="4" rx="1"/><rect x="5" y="5" width="3" height="7" rx="1"/><rect x="10" y="2.5" width="3" height="9.5" rx="1"/><rect x="15" y="0" width="3" height="12" rx="1"/></svg>
        <svg width="17" height="12" viewBox="0 0 17 12" fill="none" stroke="currentColor" strokeWidth="1.6" style={{ color: col }}><path d="M1 4.2C3.2 2.4 5.7 1.4 8.5 1.4S13.8 2.4 16 4.2"/><path d="M3.5 6.8C5 5.6 6.7 5 8.5 5s3.5.6 5 1.8"/><path d="M6 9.3c.7-.6 1.6-.9 2.5-.9s1.8.3 2.5.9"/></svg>
        <svg width="26" height="13" viewBox="0 0 26 13" fill="none" style={{ color: col }}><rect x="0.5" y="0.5" width="22" height="12" rx="3.2" stroke="currentColor" strokeOpacity="0.4"/><rect x="2.2" y="2.2" width="16" height="8.6" rx="1.8" fill="currentColor"/><rect x="24" y="4" width="1.8" height="5" rx="0.9" fill="currentColor" fillOpacity="0.4"/></svg>
      </div>
    </div>
  );
}

// ── bottom dock (V2: midnight bar, brand mark, edge-first tabs) ────
function Dock({ active = "vault" }) {
  const items = [
    { id: "home", label: "Home", icon: "home" },
    { id: "vault", label: "Vault", icon: "archive" },
    { id: "market", label: "Market", icon: "trend" },
    { id: "print", label: "Print", icon: "print" },
    { id: "account", label: "Account", icon: "gear" },
  ];
  return (
    <div style={{ position: "absolute", left: 0, right: 0, bottom: 0, zIndex: 35,
      background: "var(--g-bg-recess)", borderTop: "1px solid var(--g-line)", padding: "9px 12px 24px" }}>
      <div style={{ display: "flex", justifyContent: "center", marginBottom: 7 }}>
        <img src="../assets/brand/mavin-wordmark--bone.png" alt="mavin" style={{ height: 11, opacity: 0.5 }} />
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(5,1fr)", gap: 4 }}>
        {items.map((it) => {
          const on = it.id === active;
          return (
            <div key={it.id} style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 4,
              padding: "5px 4px", borderRadius: 3,
              background: on ? "rgba(244,239,230,0.08)" : "transparent",
              border: on ? "1px solid rgba(162,125,75,0.36)" : "1px solid transparent",
              color: on ? "var(--g-dock-active)" : "var(--g-dock-fg)" }}>
              <Icon name={it.icon} size={18} stroke={1.5} />
              <span style={{ fontFamily: MONO, fontSize: 9, fontWeight: 500, letterSpacing: "0.14em", textTransform: "uppercase" }}>{it.label}</span>
            </div>
          );
        })}
      </div>
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 1 · VAULT CHECK — camera viewfinder → identification review
// ════════════════════════════════════════════════════════════════
function ScreenCamera({ p }) {
  const flash = p > 0.42 && p < 0.5 ? (1 - Math.abs(p - 0.46) / 0.04) : 0;
  const scanY = 14 + ((p * 1.7) % 1) * 70;
  const reticle = clamp((p - 0.05) / 0.25, 0, 1);
  const brk = 1 - reticle;
  const rev = clamp((p - 0.5) / 0.42, 0, 1);  // review view rises
  const revE = eoc(rev);
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      {/* viewfinder photo */}
      <div style={{ position: "absolute", top: 0, left: 0, right: 0, height: rev > 0 ? "46%" : "100%", overflow: "hidden",
        transition: "none" }}>
        <img src={PHOTO} alt="" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover",
          transform: `scale(${1.12 - p * 0.07})`, filter: `brightness(${rev > 0 ? 0.7 : 0.86}) contrast(1.04)` }} />
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg,rgba(7,9,15,0.1),rgba(7,9,15,0.55))" }} />
        {rev > 0 && <div style={{ position: "absolute", left: 14, top: 60, fontFamily: MONO, fontSize: 9.5, letterSpacing: "0.18em",
          color: "var(--g-fg)", background: "rgba(7,9,15,0.6)", padding: "5px 9px", border: "1px solid var(--g-brass)", borderRadius: 3 }}>PL. 01 · IDENTIFIED</div>}
        {rev > 0 && <div style={{ position: "absolute", right: 14, top: 60, fontFamily: MONO, fontSize: 9.5, letterSpacing: "0.16em", color: "var(--g-fg-2)" }}>HIGH CONFIDENCE</div>}
      </div>
      <div style={{ position: "absolute", inset: 0, background: "#fff", opacity: flash * 0.8, pointerEvents: "none" }} />
      <StatusBar />

      {/* capture chrome (before review) */}
      {rev < 0.3 && (
        <React.Fragment>
          <div style={{ position: "absolute", top: 60, left: 22, right: 22, display: "flex", justifyContent: "space-between", alignItems: "center", zIndex: 20, opacity: 1 - rev / 0.3 }}>
            <span style={{ fontFamily: DISP, fontWeight: 600, fontSize: 16, color: "var(--g-fg)", textTransform: "lowercase", letterSpacing: "-0.01em" }}>vault check</span>
            <span style={{ color: "var(--g-fg-2)" }}><Icon name="x" size={19} /></span>
          </div>
          <div style={{ position: "absolute", left: "50%", top: "42%", width: 208, height: 208, transform: `translate(-50%,-50%) scale(${1 + brk * 0.22})`, opacity: (0.5 + reticle * 0.5) * (1 - rev / 0.3) }}>
            {["tl", "tr", "bl", "br"].map((cc) => {
              const base = { position: "absolute", width: 32, height: 32, borderColor: "var(--g-brass)", borderStyle: "solid", borderWidth: 0 };
              const m = { tl: { top: 0, left: 0, borderTopWidth: 2, borderLeftWidth: 2 }, tr: { top: 0, right: 0, borderTopWidth: 2, borderRightWidth: 2 },
                bl: { bottom: 0, left: 0, borderBottomWidth: 2, borderLeftWidth: 2 }, br: { bottom: 0, right: 0, borderBottomWidth: 2, borderRightWidth: 2 } }[cc];
              return <div key={cc} style={{ ...base, ...m }} />;
            })}
            {p < 0.5 && <div style={{ position: "absolute", left: 4, right: 4, top: scanY + "%", height: 2, background: "linear-gradient(90deg,transparent,var(--g-brass),transparent)", boxShadow: "0 0 12px var(--g-brass)" }} />}
          </div>
        </React.Fragment>
      )}

      {/* identification review (rises) */}
      {rev > 0 && (
        <div style={{ position: "absolute", left: 0, right: 0, top: "46%", bottom: 0, background: "var(--g-bg)", padding: "18px 20px 0",
          transform: `translateY(${(1 - revE) * 40}px)`, opacity: clamp(rev / 0.3, 0, 1), overflow: "hidden" }}>
          <Eyebrow>identification · provisional</Eyebrow>
          <h1 style={{ fontFamily: DISP, fontWeight: 600, fontSize: 27, letterSpacing: "-0.025em", color: "var(--g-fg)", textTransform: "lowercase", margin: "11px 0 0", lineHeight: 1.02 }}>rolex datejust 41</h1>
          <div style={{ display: "flex", gap: 6, flexWrap: "wrap", marginTop: 14 }}>
            <Flag brass>watches</Flag><Flag>Rolex</Flag><Flag>confidence · high</Flag><Flag>identity · 86%</Flag>
          </div>
          <div style={{ marginTop: 16 }}>
            {[["reference", "126334"], ["movement", "automatic · 3235"], ["case", "steel & yellow gold"]].map(([k, v]) => (
              <div key={k} style={{ display: "flex", justifyContent: "space-between", gap: 16, padding: "11px 0", borderBottom: "1px solid var(--g-line)" }}>
                <MonoCap>{k}</MonoCap>
                <span style={{ color: "var(--g-fg)", fontFamily: BODY, fontSize: 14 }}>{v}</span>
              </div>
            ))}
          </div>
          <div style={{ marginTop: 18, height: 48, borderRadius: 3, background: "var(--g-brass)", display: "flex", alignItems: "center", justifyContent: "center", gap: 9 }}>
            <span style={{ color: "#F4EFE6" }}><Icon name="bolt" size={15} stroke={2} /></span>
            <span style={{ fontFamily: DISP, fontSize: 15, fontWeight: 600, color: "#F4EFE6", textTransform: "lowercase", letterSpacing: "0.01em" }}>continue · examine</span>
          </div>
        </div>
      )}
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 2 · AGENTS — V2 live scan panel + findings + agent grid
// ════════════════════════════════════════════════════════════════
const AGENTS = [
  { k: "A0", icon: "eye" }, { k: "A1", icon: "search" }, { k: "A2", icon: "shield" },
  { k: "A3", icon: "file" }, { k: "A4", icon: "trend" }, { k: "A5", icon: "brain" },
  { k: "V1", icon: "scale" }, { k: "V2", icon: "activity" }, { k: "V3", icon: "globe" },
  { k: "V4", icon: "clock" }, { k: "V5", icon: "timer" }, { k: "V6", icon: "radar" },
];
const PHASES = [
  { label: "Identifying", sub: "Tri-model consensus recognition" },
  { label: "Authenticating", sub: "Forensic scan, provenance & market" },
  { label: "Valuing", sub: "6 specialist agents pricing in parallel" },
];
const FINDINGS = [
  "Inspecting forensic markers",
  "Cross-checking provenance signals",
  "Searching realized comparables",
];
const ZONES = [
  { l: 9, t: 14, w: 34, h: 28 }, { l: 56, t: 12, w: 33, h: 24 }, { l: 13, t: 47, w: 32, h: 36 },
  { l: 52, t: 44, w: 38, h: 30 }, { l: 30, t: 25, w: 40, h: 40 }, { l: 20, t: 70, w: 60, h: 18 },
];
function ScreenAgents({ p }) {
  const done = Math.floor(eoc(p) * AGENTS.length);
  const pct = Math.round(clamp(eoc(p), 0, 0.99) * 100);
  const phaseIdx = p < 0.18 ? 0 : p < 0.6 ? 1 : 2;
  const ph = PHASES[phaseIdx];
  const scanY = 8 + ((p * 1.5) % 1) * 84;
  const zone = ZONES[(done + phaseIdx) % ZONES.length];
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      <StatusBar />
      {/* header */}
      <div style={{ position: "absolute", top: 64, left: 20, right: 20 }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: 9 }}>
          <div>
            <div style={{ fontFamily: MONO, fontSize: 10, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--g-fg-3)", fontWeight: 600 }}>{ph.label}</div>
            <div style={{ fontFamily: BODY, fontSize: 12, color: "var(--g-fg-2)", marginTop: 3 }}>{ph.sub}</div>
          </div>
          <span style={{ fontFamily: MONO, fontSize: 14, fontWeight: 700, color: "var(--g-brass)" }} className="tabnum">{pct}%</span>
        </div>
        <div style={{ height: 3, borderRadius: 2, background: "rgba(243,239,230,0.05)", overflow: "hidden" }}>
          <div style={{ height: "100%", width: pct + "%", background: "linear-gradient(90deg,var(--g-brass-lo),var(--g-brass))", boxShadow: "0 0 14px rgba(162,125,75,0.4)" }} />
        </div>
      </div>
      {/* scan panel */}
      <div style={{ position: "absolute", top: 132, left: 20, right: 20, height: 224, borderRadius: 10, overflow: "hidden", border: "1px solid var(--g-line)", background: "#04060c" }}>
        <img src={PHOTO} alt="" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", opacity: 0.5 }} />
        <div style={{ position: "absolute", inset: 0, background: "radial-gradient(circle at 45% 35%,rgba(162,125,75,0.16),transparent 40%),linear-gradient(180deg,rgba(0,0,0,0.1),rgba(0,0,0,0.78))" }} />
        {/* grid */}
        <div style={{ position: "absolute", inset: 0, opacity: 0.14, backgroundImage: "linear-gradient(rgba(162,125,75,0.4) 1px,transparent 1px),linear-gradient(90deg,rgba(162,125,75,0.4) 1px,transparent 1px)", backgroundSize: "20% 20%" }} />
        {/* scan line */}
        <div style={{ position: "absolute", left: 0, right: 0, top: scanY + "%", height: 2, background: "linear-gradient(90deg,transparent,var(--g-brass),transparent)", boxShadow: "0 0 22px rgba(162,125,75,0.5)" }} />
        {/* active reticle zone */}
        <div style={{ position: "absolute", left: zone.l + "%", top: zone.t + "%", width: zone.w + "%", height: zone.h + "%", border: "1px solid rgba(162,125,75,0.6)", background: "rgba(162,125,75,0.06)", borderRadius: 3 }}>
          {["tl", "tr", "bl", "br"].map((cc) => {
            const base = { position: "absolute", width: 9, height: 9, borderColor: "var(--g-brass)", borderStyle: "solid", borderWidth: 0 };
            const m = { tl: { top: -1, left: -1, borderTopWidth: 2, borderLeftWidth: 2 }, tr: { top: -1, right: -1, borderTopWidth: 2, borderRightWidth: 2 },
              bl: { bottom: -1, left: -1, borderBottomWidth: 2, borderLeftWidth: 2 }, br: { bottom: -1, right: -1, borderBottomWidth: 2, borderRightWidth: 2 } }[cc];
            return <div key={cc} style={{ ...base, ...m }} />;
          })}
        </div>
        {/* live pill */}
        <div style={{ position: "absolute", left: 12, top: 12, display: "flex", alignItems: "center", gap: 7, padding: "5px 11px", borderRadius: 999, border: "1px solid var(--g-line)", background: "rgba(0,0,0,0.55)" }}>
          <span style={{ width: 6, height: 6, borderRadius: 999, background: "var(--g-brass)", opacity: 0.5 + 0.5 * Math.abs(Math.sin(p * 12)) }} />
          <span style={{ fontFamily: MONO, fontSize: 9.5, fontWeight: 600, letterSpacing: "0.12em", textTransform: "uppercase", color: "rgba(244,239,230,0.7)" }}>Live Analysis</span>
        </div>
        {/* findings */}
        <div style={{ position: "absolute", left: 12, right: 12, bottom: 12, borderRadius: 6, border: "1px solid var(--g-line)", background: "rgba(0,0,0,0.55)", padding: 11 }}>
          <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 7 }}>
            <span style={{ fontFamily: MONO, fontSize: 9.5, fontWeight: 600, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--g-fg-3)" }}>Agent Findings</span>
            <span style={{ fontFamily: MONO, fontSize: 10, fontWeight: 600, color: "var(--g-brass)" }} className="tabnum">{done}/12</span>
          </div>
          {FINDINGS.map((f, i) => (
            <div key={f} style={{ display: "flex", alignItems: "center", gap: 8, marginTop: i ? 5 : 0, opacity: i === Math.min(phaseIdx, 2) ? 1 : 0.4 }}>
              <span style={{ width: 4, height: 4, borderRadius: 999, background: i === Math.min(phaseIdx, 2) ? "var(--g-brass)" : "rgba(244,239,230,0.25)" }} />
              <span style={{ fontFamily: MONO, fontSize: 11, letterSpacing: "0.01em", color: "rgba(244,239,230,0.75)" }}>{f}</span>
            </div>
          ))}
        </div>
      </div>
      {/* phase pills */}
      <div style={{ position: "absolute", left: 20, right: 20, top: 372, display: "flex", justifyContent: "center", gap: 6 }}>
        {PHASES.map((pp, i) => {
          const d = i < phaseIdx, a = i === phaseIdx;
          return (
            <React.Fragment key={i}>
              {i > 0 && <div style={{ width: 16, height: 1, alignSelf: "center", background: d ? "rgba(162,125,75,0.5)" : "var(--g-line)" }} />}
              <div style={{ height: 28, padding: "0 11px", borderRadius: 999, display: "flex", alignItems: "center", gap: 6,
                background: d ? "rgba(162,125,75,0.2)" : a ? "rgba(243,239,230,0.06)" : "rgba(243,239,230,0.03)",
                border: `1px solid ${d ? "rgba(162,125,75,0.4)" : a ? "rgba(162,125,75,0.5)" : "var(--g-line)"}`,
                transform: a ? "scale(1.05)" : "scale(1)" }}>
                {d ? <span style={{ color: "var(--g-brass)" }}><Icon name="check" size={11} stroke={3} /></span> : <span style={{ fontFamily: MONO, fontSize: 10, fontWeight: 700, color: a ? "var(--g-brass)" : "var(--g-fg-4)" }}>{i + 1}</span>}
                <span style={{ fontFamily: MONO, fontSize: 9.5, fontWeight: 600, letterSpacing: "0.1em", textTransform: "uppercase", color: d || a ? "rgba(244,239,230,0.75)" : "var(--g-fg-4)" }}>{pp.label}</span>
              </div>
            </React.Fragment>
          );
        })}
      </div>
      {/* central phase heading — fills the space the real component uses */}
      <div style={{ position: "absolute", left: 28, right: 28, top: 454, textAlign: "center" }}>
        <div style={{ fontFamily: DISP, fontSize: 21, fontWeight: 600, color: "var(--g-fg)", letterSpacing: "-0.02em", textTransform: "lowercase" }}>{ph.label.toLowerCase()}</div>
        <div style={{ fontFamily: BODY, fontSize: 13, color: "var(--g-fg-2)", marginTop: 7 }}>{ph.sub}</div>
        <div style={{ marginTop: 16, fontFamily: MONO, fontSize: 10, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--g-brass)" }}>{done} of 12 agents reporting</div>
      </div>
      {/* agent grid 6-col */}
      <div style={{ position: "absolute", left: 18, right: 18, bottom: 26, display: "grid", gridTemplateColumns: "repeat(6,1fr)", gap: 6 }}>
        {AGENTS.map((a, i) => {
          const d = i < done, act = i === done;
          return (
            <div key={a.k} style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 5, padding: "9px 2px", borderRadius: 3,
              background: d ? "rgba(162,125,75,0.06)" : act ? "rgba(243,239,230,0.06)" : "rgba(243,239,230,0.02)",
              border: `1px solid ${d ? "rgba(162,125,75,0.12)" : act ? "rgba(162,125,75,0.22)" : "var(--g-line-2)"}`,
              opacity: d ? 0.7 : act ? 1 : 0.32, transform: act ? "scale(1.04)" : "scale(1)" }}>
              <span style={{ color: d ? "var(--g-brass)" : act ? "var(--g-brass)" : "var(--g-fg-4)" }}>
                {d ? <Icon name="check" size={13} stroke={3} /> : <Icon name={a.icon} size={13} />}
              </span>
              <span style={{ fontFamily: MONO, fontSize: 8.5, fontWeight: 600, letterSpacing: "0.06em", color: d ? "rgba(162,125,75,0.7)" : act ? "rgba(244,239,230,0.7)" : "var(--g-fg-4)" }}>{a.k}</span>
            </div>
          );
        })}
      </div>
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 3 · VERDICT — V2 ScoreRing (butt cap, glow) + verdict pill
// ════════════════════════════════════════════════════════════════
const SCORE = 812;
function VaultRing({ p, size = 184 }) {
  const sw = Math.round(size / 10), r = (size - sw) / 2, circ = 2 * Math.PI * r;
  const e = eoc(clamp(p / 0.62, 0, 1));
  const score = Math.round(SCORE * e);
  const offset = circ * (1 - (SCORE / 1000) * e);
  const green = score >= 700;
  const color = green ? "var(--g-green)" : "var(--g-brass)";
  const glow = green ? "34,209,122" : "200,162,75";
  return (
    <div style={{ position: "relative", width: size, height: size }}>
      <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
        <defs>
          <radialGradient id="vc-glow">
            <stop offset="0%" stopColor={`rgb(${glow})`} stopOpacity="0.26" />
            <stop offset="65%" stopColor={`rgb(${glow})`} stopOpacity="0.05" />
            <stop offset="100%" stopColor={`rgb(${glow})`} stopOpacity="0" />
          </radialGradient>
        </defs>
        <circle cx={size / 2} cy={size / 2} r={size / 2} fill="url(#vc-glow)" />
        <circle cx={size / 2} cy={size / 2} r={r} fill="none" stroke="var(--g-line)" strokeWidth={sw} />
        <circle cx={size / 2} cy={size / 2} r={r} fill="none" stroke={color} strokeWidth={sw} strokeLinecap="butt"
          strokeDasharray={circ} strokeDashoffset={offset} transform={`rotate(-90 ${size / 2} ${size / 2})`} />
      </svg>
      <div style={{ position: "absolute", inset: 0, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 4 }}>
        <span className="tabnum" style={{ fontFamily: DISP, fontSize: Math.round(size * 0.32), fontWeight: 600, letterSpacing: "-0.025em", color: "var(--g-fg)", lineHeight: 1 }}>{score}</span>
        <span style={{ fontFamily: MONO, fontSize: Math.round(size * 0.065), letterSpacing: "0.2em", textTransform: "uppercase", color: "var(--g-fg-3)", fontWeight: 500 }}>Vault Score</span>
      </div>
    </div>
  );
}
function ScreenScore({ p }) {
  const verdict = clamp((p - 0.6) / 0.18, 0, 1);
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      <StatusBar />
      <div style={{ position: "absolute", top: 64, left: 0, right: 0, textAlign: "center" }}>
        <MonoCap>vault record · 00271</MonoCap>
        <div style={{ fontFamily: DISP, fontSize: 22, fontWeight: 600, color: "var(--g-fg)", marginTop: 6, letterSpacing: "-0.02em", textTransform: "lowercase" }}>rolex datejust 41</div>
      </div>
      <div style={{ position: "absolute", left: "50%", top: "41%", transform: "translate(-50%,-50%)" }}>
        <VaultRing p={p} />
      </div>
      <div style={{ position: "absolute", left: 0, right: 0, top: "62%", display: "flex", flexDirection: "column", alignItems: "center", gap: 13 }}>
        {verdict > 0 && (
          <div style={{ opacity: verdict, transform: `translateY(${(1 - verdict) * 8}px)` }}>
            <Pill tone="green" style={{ fontSize: 11, padding: "8px 16px", letterSpacing: "0.16em" }}>mavin · CERTIFIED</Pill>
          </div>
        )}
        {p > 0.74 && (
          <div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 8, opacity: clamp((p - 0.74) / 0.12, 0, 1) }}>
            <span style={{ fontFamily: DISP, fontSize: 17, fontWeight: 500, color: "var(--g-fg)", textTransform: "lowercase", letterSpacing: "-0.01em" }}>likely genuine.</span>
            <MonoCap style={{ fontSize: 9.5 }}>evidence consistent · exceptional confidence</MonoCap>
          </div>
        )}
      </div>
      <Dock active="vault" />
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 4 · VALUE — consensus valuation + range + market
// ════════════════════════════════════════════════════════════════
function ScreenValuation({ p }) {
  const e = eoc(clamp(p / 0.5, 0, 1));
  const nav = Math.round(24500 * e);
  const fmt = (n) => "$" + n.toLocaleString();
  const navPct = 6 + eoc(clamp((p - 0.2) / 0.5, 0, 1)) * 40;
  const shimmer = clamp((p - 0.45) / 0.3, 0, 1);
  const spark = clamp((p - 0.3) / 0.5, 0, 1);
  const pts = [22, 26, 21, 30, 28, 36, 33, 42, 39, 48, 52, 60];
  const W = 280, H = 50, mx = 64;
  const path = pts.map((v, i) => `${(i / (pts.length - 1)) * W},${H - (v / mx) * H}`).slice(0, Math.max(2, Math.ceil(spark * pts.length))).join(" ");
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      <StatusBar />
      <div style={{ position: "absolute", top: 64, left: 0, right: 0, textAlign: "center" }}>
        <MonoCap>vault record · 00271</MonoCap>
        <div style={{ fontFamily: DISP, fontSize: 22, fontWeight: 600, color: "var(--g-fg)", marginTop: 6, letterSpacing: "-0.02em", textTransform: "lowercase" }}>rolex datejust 41</div>
      </div>
      {/* value block — edge-first, rule-led */}
      <div style={{ position: "absolute", left: 20, right: 20, top: 138, display: "flex", flexDirection: "column", alignItems: "flex-start" }}>
        <Eyebrow style={{ display: "block" }}>consensus valuation</Eyebrow>
        <div style={{ position: "relative", display: "inline-block", overflow: "hidden", marginTop: 12 }}>
          <span className="tabnum" style={{ display: "block", fontFamily: DISP, fontSize: 50, fontWeight: 600, color: "var(--g-fg)", letterSpacing: "-0.03em", lineHeight: 1 }}>{fmt(nav)}</span>
          <span style={{ position: "absolute", top: 0, bottom: 0, left: `${-40 + shimmer * 180}%`, width: "40%", background: "linear-gradient(90deg,transparent,rgba(162,125,75,0.5),transparent)", transform: "skewX(-12deg)", opacity: shimmer > 0 && shimmer < 1 ? 0.9 : 0 }} />
        </div>
        <div style={{ marginTop: 12, display: "flex", alignItems: "center", gap: 8 }}>
          <Pill tone="green" style={{ fontSize: 9.5, padding: "5px 11px" }}>82% confidence</Pill>
          <MonoCap style={{ fontSize: 10 }}>grade a</MonoCap>
        </div>
        {/* range */}
        <div style={{ marginTop: 22, paddingTop: 18, borderTop: "1px solid var(--g-line)", alignSelf: "stretch" }}>
          <div style={{ display: "flex", justifyContent: "space-between", marginBottom: 10 }}>
            <span className="tabnum" style={{ fontFamily: MONO, fontSize: 11, color: "var(--g-fg-3)" }}>$19,200</span>
            <span className="tabnum" style={{ fontFamily: MONO, fontSize: 11, color: "var(--g-fg-3)" }}>$31,000</span>
          </div>
          <div style={{ position: "relative", height: 3, background: "var(--g-line)" }}>
            <div style={{ position: "absolute", inset: 0, background: "linear-gradient(90deg,rgba(162,125,75,0.3),rgba(162,125,75,0.6))" }} />
            <div style={{ position: "absolute", top: "50%", left: navPct + "%", width: 14, height: 14, transform: "translate(-50%,-50%)", borderRadius: 999, background: "var(--g-brass)", border: "3px solid var(--g-bg)", boxShadow: "0 0 12px rgba(162,125,75,0.5)" }} />
          </div>
        </div>
      </div>
      {/* market */}
      <div style={{ position: "absolute", left: 20, right: 20, top: 348 }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 12 }}>
          <MonoCap>market · 12 mo</MonoCap>
          <span style={{ fontFamily: MONO, fontSize: 13, fontWeight: 700, color: "var(--g-green)" }}>▲ 18.4%</span>
        </div>
        <svg width="100%" height={H} viewBox={`0 0 ${W} ${H}`} preserveAspectRatio="none" style={{ display: "block" }}>
          <polyline points={path} fill="none" stroke="var(--g-brass)" strokeWidth="2" vectorEffect="non-scaling-stroke" style={{ filter: "drop-shadow(0 0 5px rgba(162,125,75,0.4))" }} />
        </svg>
        <div style={{ display: "flex", gap: 6, marginTop: 16, opacity: clamp((p - 0.5) / 0.2, 0, 1) }}>
          <Flag brass>14 comparables</Flag><Flag>live market</Flag>
        </div>
      </div>
      <Dock active="vault" />
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 5 · THE VAULT — objects populating (V2 edge-first grid)
// ════════════════════════════════════════════════════════════════
const VAULT_ITEMS = [
  { name: "Rolex Datejust 41", cat: "watches", score: 812, img: "../assets/photo/watch-rolex-yash.jpg", nav: 24500, tone: "em" },
  { name: "1972 Porsche 911 S", cat: "collector cars", score: 742, img: "../assets/photo/porsche-green.jpg", nav: 225000, tone: "gd" },
  { name: "Bonnes-Mares 2017", cat: "wine", score: 688, img: "../assets/photo/wine-cellar.jpg", nav: 4800, tone: "gd" },
  { name: "Cartier Tank Solo", cat: "watches", score: 705, img: "../assets/photo/cartier.jpg", nav: 8200, tone: "em" },
  { name: "Hermès Birkin 35", cat: "handbags", score: 631, img: "../assets/photo/chesterfield.jpg", nav: 18000, tone: "gd" },
  { name: "Basquiat on canvas", cat: "fine art", score: 756, img: "../assets/photo/library.jpg", nav: 45000, tone: "em" },
  { name: "F1 Helmet 1976", cat: "memorabilia", score: 693, img: "../assets/photo/f1-paddock.jpg", nav: 32000, tone: "gd" },
  { name: "Mickey Mantle 1952", cat: "trading cards", score: 580, img: "../assets/photo/watch-bezel.jpg", nav: 95000, tone: "gd" },
];
function ScreenVault({ p }) {
  const totalNav = VAULT_ITEMS.reduce((s, it) => s + it.nav, 0);
  const fmtK = (n) => n >= 1000000 ? "$" + (n/1000000).toFixed(1) + "M" : "$" + Math.round(n/1000) + "K";
  const fmtFull = (n) => "$" + n.toLocaleString();
  const portE = eoc(clamp(p / 0.4, 0, 1));
  const portVal = Math.round(totalNav * portE);
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      <StatusBar />
      {/* VAULT HEADER — faithful to VaultV1 */}
      <div style={{ position: "absolute", top: 0, left: 0, right: 0, padding: "56px 20px 12px",
        background: "rgba(7,9,15,0.72)", backdropFilter: "blur(22px)", WebkitBackdropFilter: "blur(22px)",
        borderBottom: "1px solid var(--g-line)", zIndex: 20 }}>
        <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 9 }}>
            <img src="../assets/brand/mavin-wordmark--bone.png" alt="mavin" style={{ height: 16 }} />
          </div>
          <div style={{ width: 34, height: 34, borderRadius: 999, background: "var(--g-brass)",
            display: "grid", placeItems: "center", color: "var(--g-bg)" }}>
            <Icon name="plus" size={16} stroke={2.4} />
          </div>
        </div>
      </div>
      {/* CONTENT */}
      <div style={{ position: "absolute", top: 108, left: 0, right: 0, bottom: 96, overflowY: "hidden" }}>
        {/* Portfolio value card */}
        <div style={{ margin: "14px 16px 12px", padding: "16px 18px",
          background: "rgba(14,18,28,0.88)", border: "1px solid var(--g-line)", borderRadius: 6,
          opacity: portE, transform: `translateY(${(1-portE)*10}px)` }}>
          <div style={{ fontFamily: MONO, fontSize: 9.5, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--g-fg-3)", marginBottom: 8 }}>Portfolio Value</div>
          <div style={{ display: "flex", alignItems: "flex-end", justifyContent: "space-between" }}>
            <span className="tabnum" style={{ fontFamily: DISP, fontSize: 34, fontWeight: 600, color: "var(--g-fg)", letterSpacing: "-0.03em", lineHeight: 1 }}>{fmtK(portVal)}</span>
            <span style={{ display: "inline-flex", alignItems: "center", gap: 5, padding: "5px 11px", borderRadius: 999,
              background: "rgba(74,140,95,0.14)", border: "1px solid rgba(74,140,95,0.3)", color: "var(--g-green)",
              fontFamily: MONO, fontSize: 11, fontWeight: 600 }}>▲ +3.2%</span>
          </div>
          <div style={{ marginTop: 8, fontFamily: BODY, fontSize: 13, color: "var(--g-fg-3)" }}>{VAULT_ITEMS.length} assets in vault</div>
        </div>
        <div style={{ padding: "0 20px 8px", fontFamily: MONO, fontSize: 9.5, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--g-fg-4)" }}>Assets</div>
        {/* List rows — VaultV1 SwipeableRow style */}
        <div style={{ padding: "0 16px", display: "flex", flexDirection: "column", gap: 6 }}>
          {VAULT_ITEMS.slice(0, 6).map((it, i) => {
            const local = clamp((p - i * 0.08) / 0.3, 0, 1);
            const e = eoc(local);
            if (local <= 0) return null;
            const green = it.score >= 700;
            const amber = it.score >= 400 && !green;
            const scoreBg = green ? "rgba(74,140,95,0.14)" : amber ? "rgba(162,125,75,0.14)" : "rgba(181,58,45,0.14)";
            const scoreBd = green ? "rgba(74,140,95,0.3)" : amber ? "rgba(162,125,75,0.3)" : "rgba(181,58,45,0.3)";
            const scoreCol = green ? "var(--g-green)" : amber ? "var(--g-brass)" : "var(--g-ember)";
            return (
              <div key={it.name} style={{ display: "flex", gap: 12, padding: 12,
                background: "rgba(14,18,28,0.6)", border: "1px solid var(--g-line)", borderRadius: 6,
                opacity: e, transform: `translateY(${(1-e)*14}px)`, alignItems: "center" }}>
                <div style={{ width: 58, height: 58, borderRadius: 6, overflow: "hidden", flexShrink: 0, border: "1px solid var(--g-line)" }}>
                  <img src={it.img} alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
                </div>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }}>
                    <div style={{ minWidth: 0 }}>
                      <div style={{ fontFamily: MONO, fontSize: 9.5, letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--g-brass)", marginBottom: 2 }}>{it.cat}</div>
                      <div style={{ fontFamily: BODY, fontSize: 14.5, fontWeight: 500, color: "var(--g-fg)", letterSpacing: "-0.01em", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{it.name}</div>
                    </div>
                    <span style={{ color: "var(--g-fg-4)", flexShrink: 0, marginTop: 2 }}><Icon name="trend" size={13} /></span>
                  </div>
                  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginTop: 7 }}>
                    <span className="tabnum" style={{ fontFamily: MONO, fontSize: 10, fontWeight: 600, padding: "3px 8px", borderRadius: 4,
                      background: scoreBg, border: `1px solid ${scoreBd}`, color: scoreCol }}>{it.score}</span>
                    <span className="tabnum" style={{ fontFamily: BODY, fontSize: 14, fontWeight: 600, color: "var(--g-fg)", letterSpacing: "-0.01em" }}>{fmtFull(it.nav)}</span>
                  </div>
                </div>
              </div>
            );
          })}
        </div>
      </div>
      <Dock active="vault" />
    </div>
  );
}

// ════════════════════════════════════════════════════════════════
// SCREEN 6 · INTELLIGENCE — PrintV1 morning brief
// ════════════════════════════════════════════════════════════════
const INTEL_ITEMS = [
  { color: "#4ade80", title: "Rolex Datejust 41 — valuation revised upward.", body: "Comparable sales from Geneva moved the consensus range to $24,500–$31,000.", time: "2h ago" },
  { color: "var(--g-brass)", title: "Comparable sale · 1971 Porsche 911 S", body: "Sold at $218,000 at Gooding & Company. Strong indication for your 1972 example.", time: "yesterday" },
  { color: "#a78bfa", title: "Market Pulse · vintage watches", body: "Rolex sports references up 8.4% over 30 days. Datejust models following the move.", time: "2d ago" },
];
function ScreenIntelligence({ p }) {
  const headerE = eoc(clamp(p / 0.3, 0, 1));
  const briefE  = eoc(clamp((p - 0.12) / 0.35, 0, 1));
  return (
    <div style={{ position: "absolute", inset: 0, background: "var(--g-bg)", overflow: "hidden" }}>
      <StatusBar />
      {/* PRINT HEADER */}
      <div style={{ position: "absolute", top: 0, left: 0, right: 0, padding: "56px 20px 14px",
        background: "rgba(7,9,15,0.72)", backdropFilter: "blur(22px)", WebkitBackdropFilter: "blur(22px)",
        borderBottom: "1px solid var(--g-line)", zIndex: 20, opacity: headerE,
        transform: `translateY(${(1-headerE)*8}px)` }}>
        <div style={{ fontFamily: DISP, fontSize: 22, fontWeight: 600, color: "var(--g-fg)", letterSpacing: "-0.02em", textTransform: "lowercase" }}>good evening.</div>
        <div style={{ fontFamily: MONO, fontSize: 10, letterSpacing: "0.14em", color: "var(--g-fg-4)", marginTop: 4 }}>FRIDAY, 30 MAY · YOUR BRIEF</div>
      </div>
      {/* CONTENT */}
      <div style={{ position: "absolute", top: 118, left: 16, right: 16, bottom: 96, display: "flex", flexDirection: "column", gap: 9, overflowY: "hidden" }}>
        {/* Morning briefing — amber card, faithful to PrintV1 */}
        <div style={{ position: "relative", overflow: "hidden", borderRadius: 6, padding: "16px",
          background: "linear-gradient(135deg,rgba(251,191,36,0.07),rgba(251,191,36,0.03),transparent)",
          border: "1px solid rgba(251,191,36,0.12)",
          opacity: briefE, transform: `translateY(${(1-briefE)*10}px)` }}>
          <div style={{ position: "absolute", top: -32, right: -32, width: 120, height: 120,
            background: "rgba(251,191,36,0.04)", borderRadius: "50%", filter: "blur(28px)", pointerEvents: "none" }} />
          <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 11 }}>
            <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#FBBF24" strokeWidth="2" strokeLinecap="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg>
            <span style={{ fontFamily: MONO, fontSize: 9, fontWeight: 600, letterSpacing: "0.2em", textTransform: "uppercase", color: "rgba(251,191,36,0.6)" }}>Your Briefing</span>
          </div>
          <p style={{ fontFamily: BODY, fontSize: 13, lineHeight: 1.72, color: "rgba(243,239,230,0.85)", fontWeight: 350, margin: 0 }}>Three of your seven objects moved this week. Your Rolex leads the vault by confidence. Two items would benefit from additional evidence — add service records and purchase provenance to improve your vault score.</p>
        </div>
        {/* Section label */}
        <div style={{ display: "flex", alignItems: "center", gap: 10, opacity: clamp((p-0.35)/0.15,0,1) }}>
          <div style={{ width: 2, height: 13, borderRadius: 999, background: "var(--g-brass)" }} />
          <span style={{ fontFamily: MONO, fontSize: 9, fontWeight: 600, letterSpacing: "0.18em", textTransform: "uppercase", color: "var(--g-fg-4)" }}>Your Collection</span>
        </div>
        {/* Intelligence items */}
        {INTEL_ITEMS.map((item, i) => {
          const e = eoc(clamp((p - 0.42 - i*0.12) / 0.28, 0, 1));
          if (e <= 0) return null;
          return (
            <div key={i} style={{ borderRadius: 6, padding: "12px 13px",
              background: "rgba(14,18,28,0.5)",
              border: "1px solid var(--g-line)",
              borderLeft: `2px solid ${item.color}55`,
              opacity: e, transform: `translateY(${(1-e)*8}px)`, position: "relative" }}>
              <div style={{ width: 6, height: 6, borderRadius: 999, background: item.color, position: "absolute", top: 13, right: 13 }} />
              <div style={{ fontFamily: BODY, fontSize: 13, fontWeight: 500, color: "rgba(243,239,230,0.9)", marginBottom: 5, paddingRight: 16, lineHeight: 1.35 }}>{item.title}</div>
              <div style={{ fontFamily: BODY, fontSize: 11.5, lineHeight: 1.58, color: "rgba(243,239,230,0.44)" }}>{item.body}</div>
              <div style={{ marginTop: 7, fontFamily: MONO, fontSize: 9, color: "rgba(243,239,230,0.18)" }}>{item.time}</div>
            </div>
          );
        })}
      </div>
      <Dock active="print" />
    </div>
  );
}

Object.assign(window, {
  MavinMark, Icon, StatusBar, Dock, Eyebrow, MonoCap, Flag, Pill,
  ScreenCamera, ScreenAgents, ScreenScore, ScreenValuation, ScreenVault, ScreenIntelligence,
});
