// ─────────────────────────────────────────────────────────────────────────
//  buyer-journey-mobile-mocks.jsx
//
//  Phone-native UI mocks for the mobile buyer journey. Each mock renders
//  as if the buyer is on their phone, Instagram mobile feed, Google
//  mobile SERP, mobile marketplace, YouTube mobile player, mobile chat,
//  mobile e-sign, instead of reusing the desktop mocks (browser chrome,
//  3-col grids, sidebar nav) shrunken into a card.
//
//  Shared frame: each mock sits in a faux phone bezel with a status bar
//  + an app-appropriate top chrome (URL bar / app header). The frame is
//  narrow (full width of the parent card) and tall enough to feel like
//  a real handset slice.
// ─────────────────────────────────────────────────────────────────────────

// Reusable phone status bar.
function MStatusBar({ dark }) {
  return (
    <div
      style={{
        display: "flex", alignItems: "center", justifyContent: "space-between",
        padding: "6px 16px 4px",
        fontSize: 12, fontWeight: 600,
        color: dark ? "#fff" : "#0a0a0c",
        fontVariantNumeric: "tabular-nums",
        letterSpacing: "-0.01em",
      }}
    >
      <span>9:41</span>
      <span style={{ display: "inline-flex", gap: 4, alignItems: "center" }}>
        {/* Cell signal */}
        <svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" aria-hidden="true">
          <rect x="0"  y="6" width="2" height="4" rx="0.5"/>
          <rect x="4"  y="4" width="2" height="6" rx="0.5"/>
          <rect x="8"  y="2" width="2" height="8" rx="0.5"/>
          <rect x="12" y="0" width="2" height="10" rx="0.5"/>
        </svg>
        {/* Wifi */}
        <svg width="14" height="10" viewBox="0 0 24 18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" aria-hidden="true">
          <path d="M2 7c5.5-5 14.5-5 20 0"/>
          <path d="M5.5 10.5c3.5-3 9.5-3 13 0"/>
          <path d="M9 14c2-1.5 4-1.5 6 0"/>
          <circle cx="12" cy="16.5" r="0.8" fill="currentColor"/>
        </svg>
        {/* Battery */}
        <svg width="22" height="10" viewBox="0 0 24 10" aria-hidden="true">
          <rect x="0.5" y="0.5" width="20" height="9" rx="2" fill="none" stroke="currentColor" strokeOpacity=".5"/>
          <rect x="2"   y="2"   width="16" height="6" rx="1" fill="currentColor"/>
          <rect x="21"  y="3.5" width="2"  height="3" rx=".5" fill="currentColor" opacity=".5"/>
        </svg>
      </span>
    </div>
  );
}

// Generic phone-frame wrapper (handle on top + body), visual cue this is
// a phone, not a browser. Keeps things compact (no full bezel) so we
// don't waste vertical space inside the card.
function MPhoneFrame({ children, bg = "#fff", dark = false }) {
  return (
    <div
      style={{
        background: bg, color: dark ? "#fff" : "#0a0a0c",
        borderRadius: 18,
        overflow: "hidden",
        boxShadow:
          "0 30px 60px -20px rgba(0,0,0,.55), 0 12px 24px -8px rgba(0,0,0,.35)",
        border: "1px solid rgba(255,255,255,.08)",
      }}
    >
      <MStatusBar dark={dark} />
      {children}
    </div>
  );
}

// ─── Mock 01, Instagram mobile single-post view. One full-bleed yacht
//      photo with the post header above and the engagement row below
//      (likes, sends, reposts), reads as a single high-performing post.
function MMSocial({ active, A, T }) {
  return (
    <MPhoneFrame bg="#fff">
      {/* IG top bar */}
      <div
        style={{
          display: "flex", alignItems: "center", justifyContent: "space-between",
          padding: "10px 14px",
          borderBottom: "1px solid #f0f0f2",
        }}
      >
        <div style={{ fontFamily: "'Pacifico', cursive", fontSize: 22, fontWeight: 400 }}>
          Instagram
        </div>
        <div style={{ display: "flex", gap: 14, color: "#0a0a0c" }}>
          <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
            <path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/>
          </svg>
        </div>
      </div>

      {/* Post header */}
      <div style={{ display: "flex", alignItems: "center", gap: 10, padding: "10px 14px" }}>
        <div
          style={{
            width: 34, height: 34, borderRadius: 17,
            background: `conic-gradient(from 0deg, ${A}, #ff5e8c, #fbbf24, ${A})`,
            padding: 2, boxSizing: "border-box",
          }}
        >
          <div
            style={{
              width: "100%", height: "100%", borderRadius: "50%",
              background: "#fff", padding: 2, boxSizing: "border-box",
            }}
          >
            <div
              style={{
                width: "100%", height: "100%", borderRadius: "50%",
                background: `linear-gradient(135deg, ${A}, #1e3a8a)`,
                display: "flex", alignItems: "center", justifyContent: "center",
                color: "#fff", fontFamily: T.fDisplay, fontWeight: 800, fontSize: 11,
              }}
            >
              YW
            </div>
          </div>
        </div>
        <div style={{ flex: 1, lineHeight: 1.2 }}>
          <div style={{ display: "inline-flex", alignItems: "center", gap: 4, fontSize: 13, fontWeight: 600 }}>
            yachtway
            <svg width="12" height="12" viewBox="0 0 24 24" fill="#1da1f2" aria-hidden="true">
              <path d="M22.5 12.5l-2.3-2.7.3-3.5-3.5-.8-1.8-3-3.2 1.4L8.8 2.5 7 5.5l-3.5.8.3 3.5-2.3 2.7 2.3 2.7-.3 3.5 3.5.8 1.8 3 3.2-1.4 3.2 1.4 1.8-3 3.5-.8-.3-3.5 2.3-2.7zM10 17l-4-4 1.4-1.4L10 14.2l6.6-6.6L18 9l-8 8z"/>
            </svg>
          </div>
          <div style={{ fontSize: 11, color: "#71717a", marginTop: 1 }}>Bahamas</div>
        </div>
        <div style={{ fontSize: 18, color: "#0a0a0c", lineHeight: 1, paddingTop: 2 }}>⋯</div>
      </div>

      {/* The post, single yacht photo */}
      <div
        style={{
          aspectRatio: "16 / 10",
          width: "100%",
          backgroundColor: "#0a0a0c",
          backgroundImage: `url('${(window.__YW_ASSET && window.__YW_ASSET("assets/social-discover.jpg")) || "assets/social-discover.jpg"}')`,
          backgroundSize: "cover",
          backgroundPosition: "center",
          backgroundRepeat: "no-repeat",
        }}
      />

      {/* Action row, IG icons */}
      <div
        style={{
          display: "flex", alignItems: "center", gap: 14,
          padding: "10px 14px 6px",
          color: "#0a0a0c",
        }}
      >
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#ed4956" stroke="#ed4956" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
        </svg>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>
        </svg>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/>
        </svg>
        <svg style={{ marginLeft: "auto" }} width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/>
        </svg>
      </div>

      {/* Engagement counts */}
      <div style={{ padding: "0 14px 6px", fontSize: 13, fontWeight: 600, color: "#0a0a0c" }}>
        110 likes
      </div>
      <div
        style={{
          padding: "0 14px 6px",
          display: "flex", gap: 14,
          fontSize: 12, color: "#71717a",
          fontVariantNumeric: "tabular-nums",
        }}
      >
        <span style={{ display: "inline-flex", alignItems: "center", gap: 4 }}>
          <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
            <path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/>
          </svg>
          Sent <strong style={{ color: "#0a0a0c", fontWeight: 600 }}>42×</strong>
        </span>
        <span style={{ display: "inline-flex", alignItems: "center", gap: 4 }}>
          <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
            <polyline points="17 1 21 5 17 9"/>
            <path d="M3 11V9a4 4 0 0 1 4-4h14"/>
            <polyline points="7 23 3 19 7 15"/>
            <path d="M21 13v2a4 4 0 0 1-4 4H3"/>
          </svg>
          Reposted <strong style={{ color: "#0a0a0c", fontWeight: 600 }}>6×</strong>
        </span>
      </div>

      {/* Caption */}
      <div style={{ padding: "0 14px 14px", fontSize: 13, lineHeight: 1.4 }}>
        <strong>yachtway</strong> Skip the Miami traffic onboard a Skipper. Find it on YachtWay.
      </div>
    </MPhoneFrame>
  );
}

// ─── Mock 02, Google mobile SERP. Ultra-compact result cards, mobile
//      search bar at top, no sidebar.
function MMSearch({ active, A }) {
  return (
    <MPhoneFrame bg="#fff">
      {/* Mobile Google bar */}
      <div
        style={{
          display: "flex", alignItems: "center", gap: 10,
          padding: "10px 12px",
          borderBottom: "1px solid #ebebeb",
        }}
      >
        <div style={{
          flex: 1,
          display: "flex", alignItems: "center", gap: 8,
          padding: "8px 12px", borderRadius: 22,
          background: "#f1f3f4",
        }}>
          <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#5f6368" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
            <circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/>
          </svg>
          <span style={{ fontSize: 13, color: "#202124" }}>yachts for sale</span>
          <span style={{ marginLeft: "auto", color: "#9aa0a6", fontSize: 16 }}>×</span>
        </div>
      </div>
      {/* Tab strip */}
      <div style={{
        display: "flex", gap: 18, fontSize: 12, color: "#5f6368",
        padding: "0 14px", borderBottom: "1px solid #ebebeb",
      }}>
        {[["All", true], ["Images"], ["Videos"], ["News"], ["Maps"]].map(([t, a], i) => (
          <span key={i} style={{
            padding: "10px 0",
            color: a ? "#1a73e8" : "#5f6368",
            fontWeight: a ? 600 : 400,
            borderBottom: a ? "3px solid #1a73e8" : "3px solid transparent",
            whiteSpace: "nowrap",
          }}>{t}</span>
        ))}
      </div>

      {/* Results */}
      <div style={{ padding: "10px 14px 14px" }}>
        <style>{`
          @keyframes mm-serp-pulse {
            0%, 100% { background: transparent; }
            50%      { background: rgba(124,92,255,.07); }
          }
        `}</style>
        {[
          { yw: false, host: "yachtworld.com", title: "Yachts for Sale - YachtWorld",
            desc: "Find new and used yachts for sale on YachtWorld." },
          { yw: true,  host: "yachtway.com",   title: "Yachts for Sale · 2,900+ listings",
            desc: "The category-leading marketplace for yachts. Filter 2,900+ listings worldwide." },
          { yw: false, host: "iyc.com",        title: "Luxury Yachts for Sale",
            desc: "Over 550 Luxury Yachts and access to all yachts globally." },
        ].map((r, i) => (
          <div
            key={i}
            style={{
              padding: "10px 10px",
              margin: "0 -10px",
              borderRadius: 10,
              animation: r.yw && active ? "mm-serp-pulse 2.4s ease-in-out infinite" : undefined,
            }}
          >
            <div style={{ display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }}>
              <span style={{
                width: 18, height: 18, borderRadius: 9,
                background: r.yw ? A : "#1a73e8",
                color: "#fff", fontSize: 10, fontWeight: 700,
                display: "inline-flex", alignItems: "center", justifyContent: "center",
              }}>
                {r.yw ? "Y" : r.host[0].toUpperCase()}
              </span>
              <div style={{ fontSize: 12, color: "#202124" }}>
                <div style={{ fontWeight: 500 }}>{r.host.split(".")[0]}</div>
                <div style={{ color: "#5f6368", fontSize: 11 }}>{r.host} ›</div>
              </div>
            </div>
            <div style={{
              fontSize: 16, color: "#1a0dab", marginBottom: 4, lineHeight: 1.3,
              fontWeight: r.yw ? 500 : 400,
            }}>
              {r.title}
            </div>
            <div style={{ fontSize: 12, color: "#4d5156", lineHeight: 1.5 }}>{r.desc}</div>
          </div>
        ))}
      </div>
    </MPhoneFrame>
  );
}

// ─── Mock 03, YachtWay mobile marketplace. Single-column cards stacked
//      vertically (the desktop 3-col grid doesn't fit on phone).
function MMMarketplace({ active, A, T, tint }) {
  const listings = (window.__YW_ASSETS && window.__YW_ASSETS.listings) || {};
  const yachts = [
    { name: "Westport 130",     price: "$23.7M", year: "2022", loc: "Bahamas",  badge: "live", photo: "westport" },
    { name: "Benetti 125",      price: "$13.8M", year: "2024", loc: "Monaco",   badge: "event", photo: "benetti" },
    { name: "Vanquish VQ70",    price: "$7.8M",  year: "2025", loc: "Antibes",  photo: "vanquish" },
  ];
  return (
    <MPhoneFrame bg="#f7f7f8">
      {/* App header */}
      <div style={{
        display: "flex", alignItems: "center", gap: 10,
        padding: "10px 14px",
        background: "#fff",
        borderBottom: "1px solid #ececef",
      }}>
        <div style={{ fontFamily: T.fDisplay, fontWeight: 700, fontSize: 16 }}>YachtWay</div>
        <div style={{
          marginLeft: "auto",
          display: "flex", alignItems: "center", gap: 6,
          padding: "5px 10px", borderRadius: 999,
          background: "#f4f4f5",
          fontSize: 12, color: "#52525b",
        }}>
          <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
            <circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/>
          </svg>
          Search
        </div>
      </div>
      {/* Filter chips horizontal scroll */}
      <div style={{
        display: "flex", gap: 6, padding: "10px 12px",
        overflowX: "auto", background: "#fff",
        borderBottom: "1px solid #ececef",
      }}>
        <style>{`.mm-mp-chips::-webkit-scrollbar{display:none}`}</style>
        {["All", "60-90ft", "1M+", "2023-25", "Monaco"].map((c, i) => (
          <span
            key={i}
            style={{
              flex: "0 0 auto",
              fontSize: 12, padding: "5px 10px", borderRadius: 999,
              background: i === 0 ? "#0a0a0c" : "#fff",
              color: i === 0 ? "#fff" : "#52525b",
              border: i === 0 ? "1px solid #0a0a0c" : "1px solid #e4e4e7",
              fontWeight: 500,
              whiteSpace: "nowrap",
            }}
          >
            {c}
          </span>
        ))}
      </div>

      {/* Listings */}
      <div style={{ padding: "10px 12px 14px", display: "flex", flexDirection: "column", gap: 10 }}>
        {yachts.map((y, i) => (
          <div
            key={i}
            style={{
              background: "#fff", borderRadius: 12,
              border: "1px solid #e4e4e7", overflow: "hidden",
              boxShadow: i === 0 && active ? `0 0 0 2px ${A}` : "none",
              transition: "box-shadow .3s",
            }}
          >
            <div style={{
              width: "100%",
              height: 160,
              background: "#0a0a0c",
              backgroundImage: `url(${listings[y.photo] || ""})`,
              backgroundSize: "cover",
              backgroundRepeat: "no-repeat",
              backgroundPosition: "center 55%",
              position: "relative",
            }}>
              <div style={{
                position: "absolute", inset: 0,
                background: "linear-gradient(180deg, rgba(0,0,0,.18) 0%, transparent 30%, transparent 70%, rgba(0,0,0,.2) 100%)",
              }}/>
              {y.badge === "live" && (
                <div style={{
                  position: "absolute", top: 8, left: 8,
                  display: "inline-flex", alignItems: "center", gap: 5,
                  fontSize: 10, padding: "3px 7px", borderRadius: 4,
                  background: "#dc2626", color: "#fff", fontWeight: 700,
                  textTransform: "uppercase", letterSpacing: ".08em",
                }}>
                  <span style={{
                    width: 5, height: 5, borderRadius: 3, background: "#fff",
                  }}/>
                  Live
                </div>
              )}
              {y.badge === "event" && (
                <div style={{
                  position: "absolute", top: 8, left: 8,
                  fontSize: 10, padding: "3px 7px", borderRadius: 4,
                  background: "#fff", color: "#0a0a0c", fontWeight: 700,
                  textTransform: "uppercase", letterSpacing: ".08em",
                  border: "1px solid rgba(0,0,0,.08)",
                }}>FLIBS</div>
              )}
              {/* Heart icon */}
              <div style={{
                position: "absolute", top: 8, right: 8,
                width: 28, height: 28, borderRadius: 14,
                background: "rgba(255,255,255,.85)",
                display: "flex", alignItems: "center", justifyContent: "center",
                backdropFilter: "blur(4px)",
              }}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#0a0a0c" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
                  <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
                </svg>
              </div>
            </div>
            <div style={{ padding: "10px 12px 12px" }}>
              {/* Top row, vessel name on the left, price prominent on
                  the right. Both at the same baseline so the eye reads
                  "Westport 130, €21.9M" as a single line. */}
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 8 }}>
                <div style={{ fontSize: 14, fontWeight: 600, color: "#0a0a0c" }}>{y.name}</div>
                <div style={{ fontSize: 15, fontWeight: 700, color: "#0a0a0c", fontFamily: T.fDisplay, whiteSpace: "nowrap" }}>{y.price}</div>
              </div>
              {/* Spec row, year + make/model + location, all in one
                  row with bullet separators. Year and make get extra
                  weight so the spec scans even at small sizes. */}
              <div style={{
                marginTop: 6,
                display: "flex", alignItems: "center", gap: 6,
                fontSize: 11.5, color: "#52525b",
                fontVariantNumeric: "tabular-nums",
              }}>
                <span style={{ fontWeight: 600, color: "#27272a" }}>{y.year}</span>
                <span style={{ color: "#d4d4d8" }}>·</span>
                <span style={{ fontWeight: 500, color: "#27272a" }}>{y.name.split(" ")[0]}</span>
                <span style={{ color: "#d4d4d8" }}>·</span>
                <span style={{ display: "inline-flex", alignItems: "center", gap: 3 }}>
                  <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
                    <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/>
                    <circle cx="12" cy="10" r="3"/>
                  </svg>
                  {y.loc}
                </span>
              </div>
            </div>
          </div>
        ))}
      </div>
    </MPhoneFrame>
  );
}

// ─── Mock 04, Mobile broker chat (single conversation full-bleed,
//      no sidebar). The desktop version had a 3-pane layout; on phone
//      messaging apps show ONE conversation at a time.
function MMBroker({ active, A, T, tint }) {
  return (
    <MPhoneFrame bg="#fff">
      {/* Chat header */}
      <div
        style={{
          display: "flex", alignItems: "center", gap: 10,
          padding: "10px 12px",
          borderBottom: "1px solid #ececef",
        }}
      >
        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#52525b" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M15 18l-6-6 6-6"/>
        </svg>
        <div
          style={{
            width: 30, height: 30, borderRadius: 15,
            background: `linear-gradient(135deg, ${A}, #ff5e8c)`,
            display: "flex", alignItems: "center", justifyContent: "center",
            fontSize: 12, fontWeight: 700, color: "#fff",
          }}
        >
          JW
        </div>
        <div style={{ flex: 1 }}>
          <div style={{ fontSize: 13, fontWeight: 600 }}>James Whitmore</div>
          <div style={{ fontSize: 11, color: "#22c55e" }}>● Online</div>
        </div>
        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#52525b" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
        </svg>
      </div>

      {/* Messages */}
      <div
        style={{
          padding: "12px 12px",
          display: "flex", flexDirection: "column", gap: 8,
          background: "#fafafa",
          minHeight: 280,
        }}
      >
        <div style={{ alignSelf: "center", fontSize: 11, color: "#a1a1aa", margin: "4px 0" }}>
          Today · 11:24
        </div>

        <div
          style={{
            alignSelf: "flex-start", maxWidth: "78%",
            background: "#fff", padding: "8px 12px", borderRadius: "16px 16px 16px 4px",
            fontSize: 13, lineHeight: 1.4, color: "#0a0a0c",
            border: "1px solid #ececef",
          }}
        >
          Hi - saw the walkthrough on YouTube last night. Sent a request for viewing.
        </div>

        <div
          style={{
            alignSelf: "flex-start", maxWidth: "78%",
            background: "#fff", padding: "8px 12px", borderRadius: "16px 16px 16px 4px",
            fontSize: 13, lineHeight: 1.4, color: "#0a0a0c",
            border: "1px solid #ececef",
          }}
        >
          Princess Y85, Monaco. Saturday work?
        </div>

        <div style={{ alignSelf: "flex-end", maxWidth: "78%" }}>
          <div
            style={{
              background: A, color: "#fff",
              padding: "8px 12px", borderRadius: "16px 16px 4px 16px",
              fontSize: 13, lineHeight: 1.4,
            }}
          >
            Yes - confirmed. See you Saturday 11AM.
          </div>
          <div style={{ fontSize: 10, color: "#a1a1aa", textAlign: "right", marginTop: 3 }}>
            Read · 11:25
          </div>
        </div>

        <style>{`
          @keyframes mm-typing {
            0%, 60%, 100% { transform: translateY(0); opacity: .4; }
            30% { transform: translateY(-3px); opacity: 1; }
          }
        `}</style>
        {active && (
          <div
            style={{
              alignSelf: "flex-start",
              display: "flex", gap: 4, padding: "8px 12px",
              background: "#fff", borderRadius: "16px 16px 16px 4px",
              border: "1px solid #ececef",
              marginTop: 4,
            }}
          >
            {[0, 1, 2].map((i) => (
              <span
                key={i}
                style={{
                  width: 5, height: 5, borderRadius: "50%",
                  background: "#71717a",
                  animation: "mm-typing 1.2s ease-in-out infinite",
                  animationDelay: `${i * 0.15}s`,
                }}
              />
            ))}
          </div>
        )}
      </div>

      {/* Input */}
      <div
        style={{
          display: "flex", alignItems: "center", gap: 8,
          padding: "10px 12px",
          borderTop: "1px solid #ececef",
        }}
      >
        <button
          style={{
            width: 30, height: 30, borderRadius: 15,
            border: "none", background: "#f4f4f5",
            display: "flex", alignItems: "center", justifyContent: "center",
            color: "#52525b", flexShrink: 0,
          }}
          aria-label="Attach"
        >
          +
        </button>
        <div
          style={{
            flex: 1, height: 32, borderRadius: 16,
            background: "#f4f4f5",
            padding: "0 14px",
            display: "flex", alignItems: "center",
            fontSize: 12, color: "#a1a1aa",
          }}
        >
          Reply…
        </div>
        <button
          style={{
            width: 30, height: 30, borderRadius: 15,
            border: "none", background: A, color: "#fff",
            display: "flex", alignItems: "center", justifyContent: "center",
            flexShrink: 0,
          }}
          aria-label="Send"
        >
          <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
            <path d="M22 2L11 13" /><path d="M22 2l-7 20-4-9-9-4 20-7z" />
          </svg>
        </button>
      </div>
    </MPhoneFrame>
  );
}

// ─── Mock 05, Mobile e-sign. Document above, signature pad below
//      (the desktop 1fr/240px split would be unusable on phone).
function MMClose({ active, A, T, tint }) {
  const [signed, setSigned] = React.useState(false);
  React.useEffect(() => {
    if (!active) { setSigned(false); return; }
    const id = setTimeout(() => setSigned(true), 1400);
    return () => clearTimeout(id);
  }, [active]);
  return (
    <MPhoneFrame bg="#fff">
      {/* Top bar with X + title */}
      <div
        style={{
          display: "flex", alignItems: "center", gap: 10,
          padding: "10px 14px",
          borderBottom: "1px solid #ececef",
        }}
      >
        <span style={{ fontSize: 18, color: "#52525b", lineHeight: 1 }}>×</span>
        <div style={{ flex: 1, textAlign: "center" }}>
          <div style={{ fontSize: 13, fontWeight: 600 }}>Purchase Agreement</div>
          <div style={{ fontSize: 11, color: "#a1a1aa", fontVariantNumeric: "tabular-nums" }}>SP-2841</div>
        </div>
        <span style={{ fontSize: 11, color: A, fontWeight: 600 }}>EasySign</span>
      </div>

      {/* Document preview */}
      <div
        style={{
          background: "#fafafa",
          padding: "14px 16px 12px",
          borderBottom: "1px solid #ececef",
        }}
      >
        <div style={{ fontFamily: T.fDisplay, fontSize: 14, fontWeight: 700, marginBottom: 8 }}>
          Princess Y85 · 2024
        </div>
        {[100, 92, 96, 70, 100, 88].map((w, i) => (
          <div
            key={i}
            style={{
              height: 4, width: `${w}%`,
              background: i % 3 === 0 ? "#d4d4d8" : "#e4e4e7",
              borderRadius: 2, marginBottom: 6,
            }}
          />
        ))}
      </div>

      {/* Signature blocks stacked */}
      <div style={{ padding: "14px 16px 14px", display: "flex", flexDirection: "column", gap: 12 }}>
        {[
          { who: "BUYER",  name: "James Whitmore", font: "'Mrs Saint Delafield', 'Allura', cursive", fs: 24, rot: -2, signed: signed },
          { who: "BROKER", name: "S. Marchetti",   font: "'Homemade Apple', 'Caveat', cursive",       fs: 16, rot: -1, signed: true   },
        ].map((b, i) => (
          <div key={i}>
            <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 5 }}>
              <div style={{ fontSize: 11, color: "#71717a", fontWeight: 700, letterSpacing: ".08em" }}>{b.who}</div>
              {b.signed && (
                <div style={{
                  display: "inline-flex", alignItems: "center", gap: 4,
                  fontSize: 10, color: A, fontWeight: 700,
                }}>
                  <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
                    <path d="M20 6L9 17l-5-5"/>
                  </svg>
                  Signed
                </div>
              )}
            </div>
            <div
              style={{
                border: `1.5px dashed ${b.signed ? A : "#d4d4d8"}`,
                borderRadius: 8,
                padding: "8px 12px",
                height: 50,
                display: "flex", alignItems: "center",
                background: b.signed ? tint(.05) : "#fafafa",
                overflow: "hidden",
                transition: "all .4s",
              }}
            >
              <div
                style={{
                  fontFamily: b.font,
                  fontSize: b.fs, lineHeight: 1,
                  color: b.signed ? A : "transparent",
                  whiteSpace: "nowrap",
                  clipPath: b.signed ? "inset(-20% 0 -20% 0)" : "inset(-20% 100% -20% 0)",
                  transition: "clip-path 1.6s cubic-bezier(.65,.05,.36,1), color .2s",
                  transform: `rotate(${b.rot}deg)`,
                  transformOrigin: "left center",
                }}
              >
                {b.name}
              </div>
            </div>
          </div>
        ))}

        <button
          style={{
            marginTop: 4,
            width: "100%", padding: "12px 14px",
            border: "none", borderRadius: 10,
            background: signed ? "#22c55e" : A,
            color: "#fff", fontSize: 14, fontWeight: 700,
            display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 8,
            transition: "background .3s",
          }}
        >
          {signed ? (
            <>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
                <path d="M20 6L9 17l-5-5"/>
              </svg>
              Closed
            </>
          ) : "Sign with DocuSign"}
        </button>
      </div>
    </MPhoneFrame>
  );
}

// ─── Mock 04, Phone-native YachtWay LIVE. Tall hero with the broadcast
//      frame on top (REC pill, viewer count, scrolling Q&A), bottom rail
//      with the listing CTA. Same idiom as desktop MockLive but stacked.
function MMLive({ active, A, T, tint }) {
  const [viewers, setViewers] = React.useState(127);
  const [chatIdx, setChatIdx] = React.useState(0);
  React.useEffect(() => {
    if (!active) return;
    const v = setInterval(() => {
      setViewers((c) => Math.max(80, Math.min(220, c + (Math.random() < 0.55 ? 1 : -1) * Math.ceil(Math.random() * 3))));
    }, 800);
    const c = setInterval(() => setChatIdx((i) => i + 1), 2000);
    return () => { clearInterval(v); clearInterval(c); };
  }, [active]);

  const CHAT = [
    { who: "Marcus T.", msg: "What's the cruising range?", role: "buyer" },
    { who: "Sofia R.",  msg: "Show me the engine room?",   role: "buyer" },
    { who: "YachtWay",  msg: "Heading down now, full tour next.", role: "host" },
    { who: "Kenji M.",  msg: "Trim tabs standard?",        role: "buyer" },
  ];
  const visible = [];
  for (let i = 0; i < 3; i++) visible.push(CHAT[(chatIdx + i) % CHAT.length]);

  return (
    <MPhoneFrame bg="#0a0a0c" dark>
      <div style={{
        display: "flex", flexDirection: "column", height: "100%",
        color: "#fff", fontFamily: T.fBody,
      }}>
        {/* ── Broadcast hero ── */}
        <div style={{
          position: "relative",
          height: 180, flex: "none",
          background: `radial-gradient(ellipse 100% 60% at 50% 100%, rgba(124,92,255,.20), transparent 60%), linear-gradient(180deg, #1c2738 0%, #0a1726 100%)`,
          overflow: "hidden",
        }}>
          {/* horizon line */}
          <div aria-hidden="true" style={{
            position: "absolute", left: 0, right: 0, bottom: "32%",
            height: 1, background: "rgba(255,255,255,.10)",
          }}/>
          {/* yacht */}
          <div aria-hidden="true" style={{
            position: "absolute", left: "50%", bottom: "28%",
            transform: "translateX(-50%)", width: "60%", maxWidth: 240,
          }}>
            <svg viewBox="0 0 200 80" width="100%" height="auto" style={{ display: "block" }}>
              <path d="M 12 56 Q 100 70 188 56 L 178 70 Q 100 80 22 70 Z" fill="rgba(255,255,255,.16)"/>
              <path d="M 38 56 L 162 56 L 152 38 L 48 38 Z" fill="rgba(255,255,255,.10)"/>
              <path d="M 70 38 L 130 38 L 124 22 L 76 22 Z" fill="rgba(255,255,255,.07)"/>
              <rect x="56"  y="42" width="14" height="6" fill="rgba(255,210,140,.55)"/>
              <rect x="78"  y="42" width="14" height="6" fill="rgba(255,210,140,.55)"/>
              <rect x="100" y="42" width="14" height="6" fill="rgba(255,210,140,.55)"/>
              <rect x="122" y="42" width="14" height="6" fill="rgba(255,210,140,.55)"/>
              <line x1="100" y1="22" x2="100" y2="2" stroke="rgba(255,255,255,.25)" strokeWidth="1"/>
            </svg>
          </div>
          {/* REC pill */}
          <div style={{
            position: "absolute", top: 10, left: 10,
            display: "inline-flex", alignItems: "center", gap: 6,
            padding: "4px 9px", borderRadius: 999,
            background: "rgba(0,0,0,.55)", backdropFilter: "blur(6px)",
            fontSize: 9, fontWeight: 700, letterSpacing: ".18em", textTransform: "uppercase",
          }}>
            <span style={{
              width: 6, height: 6, borderRadius: 3, background: "#ff2d55",
              animation: active ? "pulse-dot 1.2s ease-in-out infinite" : "none",
            }}/>
            LIVE
          </div>
          {/* Viewer count */}
          <div style={{
            position: "absolute", top: 10, right: 10,
            display: "inline-flex", alignItems: "center", gap: 5,
            padding: "4px 8px", borderRadius: 999,
            background: "rgba(0,0,0,.55)", backdropFilter: "blur(6px)",
            fontSize: 10, fontWeight: 600, fontVariantNumeric: "tabular-nums",
          }}>
            <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4"><circle cx="12" cy="12" r="3"/><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/></svg>
            {viewers}
          </div>
          {/* Listing strap */}
          <div style={{
            position: "absolute", left: 0, right: 0, bottom: 0,
            padding: "10px 12px",
            background: "linear-gradient(180deg, transparent, rgba(0,0,0,.65))",
            display: "flex", alignItems: "center", gap: 8,
          }}>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{
                fontSize: 8, fontWeight: 700, letterSpacing: ".14em", textTransform: "uppercase",
                color: "rgba(255,255,255,.55)", marginBottom: 1,
              }}>Now showing</div>
              <div style={{
                fontFamily: T.fDisplay, fontSize: 12, fontWeight: 600,
                letterSpacing: "-0.01em", color: "#fff", lineHeight: 1.2,
                whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis",
              }}>Princess Y85 · €5.2M</div>
            </div>
            <button style={{
              appearance: "none", border: "none",
              padding: "5px 9px", borderRadius: 999,
              background: "#fff", color: "#0a0a0c",
              fontSize: 9, fontWeight: 700, cursor: "pointer", flex: "none",
              letterSpacing: "-0.005em",
            }}>Schedule</button>
          </div>
        </div>

        {/* ── Q&A ── */}
        <div style={{
          flex: 1,
          padding: "10px 12px",
          background: "#111114",
          display: "flex", flexDirection: "column", gap: 8,
          fontSize: 11, lineHeight: 1.4, overflow: "hidden",
        }}>
          <div style={{
            fontSize: 9, fontWeight: 700, letterSpacing: ".14em",
            color: "rgba(255,255,255,.55)", textTransform: "uppercase",
          }}>Live Q&amp;A · {viewers} buyers</div>
          {visible.map((m, i) => {
            const isHost = m.role === "host";
            const initials = m.who.split(" ").map(p => p[0]).join("").slice(0, 2);
            return (
              <div key={chatIdx + "-" + i} style={{
                display: "flex", gap: 7, alignItems: "flex-start",
                opacity: 1 - (i * 0.20),
                transition: "opacity .35s ease",
              }}>
                <div style={{
                  width: 18, height: 18, borderRadius: 9, flex: "none",
                  background: isHost ? A : "rgba(255,255,255,.10)",
                  color: "#fff",
                  display: "flex", alignItems: "center", justifyContent: "center",
                  fontSize: 8, fontWeight: 700,
                }}>{initials}</div>
                <div style={{ minWidth: 0, flex: 1 }}>
                  <div style={{
                    fontSize: 9, fontWeight: 700,
                    color: isHost ? A : "#fff",
                  }}>{m.who}{isHost && <span style={{
                    marginLeft: 5, fontSize: 7, padding: "1px 4px",
                    borderRadius: 3, background: tint(.20), color: A,
                    letterSpacing: ".08em", textTransform: "uppercase",
                  }}>Host</span>}</div>
                  <div style={{ color: "rgba(255,255,255,.78)" }}>{m.msg}</div>
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </MPhoneFrame>
  );
}

// Dispatcher, picks the right mobile mock per stage kind.
function BuyerJourneyMobileMock({ kind, T, A, tint, active }) {
  switch (kind) {
    case "social":      return <MMSocial      active={active} A={A} T={T}/>;
    case "search":      return <MMSearch      active={active} A={A}/>;
    case "marketplace": return <MMMarketplace active={active} A={A} T={T} tint={tint}/>;
    case "live":        return <MMLive        active={active} A={A} T={T} tint={tint}/>;
    case "broker":      return <MMBroker      active={active} A={A} T={T} tint={tint}/>;
    case "close":       return <MMClose       active={active} A={A} T={T} tint={tint}/>;
    // "watch" isn't currently in the stages array, but cover it anyway as broker fallback
    case "watch":       return <MMSocial      active={active} A={A} T={T}/>;
    default:            return null;
  }
}

Object.assign(window, { BuyerJourneyMobileMock });
