diff --git a/client/src/components/chat-v2/thread/mcp-apps-renderer.tsx b/client/src/components/chat-v2/thread/mcp-apps-renderer.tsx index 1c3ee93bb..3ee0011a6 100644 --- a/client/src/components/chat-v2/thread/mcp-apps-renderer.tsx +++ b/client/src/components/chat-v2/thread/mcp-apps-renderer.tsx @@ -887,22 +887,38 @@ export function MCPAppsRenderer({ const isPip = effectiveDisplayMode === "pip"; const isFullscreen = effectiveDisplayMode === "fullscreen"; + const isMobilePlaygroundMode = + isPlaygroundActive && playgroundDeviceType === "mobile"; + const isContainedFullscreenMode = + isPlaygroundActive && + (playgroundDeviceType === "mobile" || playgroundDeviceType === "tablet"); + + const containerClassName = (() => { + if (isFullscreen) { + if (isContainedFullscreenMode) { + return "absolute inset-0 z-10 w-full h-full bg-background flex flex-col"; + } + return "fixed inset-0 z-40 w-full h-full bg-background flex flex-col"; + } - let containerClassName = "mt-3 space-y-2 relative group"; - if (isFullscreen) { - containerClassName = - "fixed inset-0 z-50 w-full h-full bg-background flex flex-col"; - } else if (isPip) { - containerClassName = [ - "fixed top-4 inset-x-0 z-40 w-full max-w-4xl mx-auto space-y-2", - "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", - "shadow-xl border border-border/60 rounded-xl p-3", - ].join(" "); - } + if (isPip) { + if (isMobilePlaygroundMode) { + return "absolute inset-0 z-10 w-full h-full bg-background flex flex-col"; + } + return [ + "fixed top-4 inset-x-0 z-40 w-full max-w-4xl mx-auto space-y-2", + "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", + "shadow-xl border border-border/60 rounded-xl p-3", + ].join(" "); + } + + return "mt-3 space-y-2 relative group"; + })(); return (