{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pong-game",
  "title": "Pong Game",
  "description": "A canvas Pong against a bot opponent, three difficulty levels, multi-round progression with a color shift and speed increase each round, keyboard and touch-drag paddle control.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/pong-game/pong-game.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type PongTheme = \"arcade\" | \"neon\" | \"tournament\" | \"classic\";\nexport type PongDifficulty = \"easy\" | \"medium\" | \"hard\";\nexport type PongTrigger = \"manual\" | \"delay\" | \"scroll\";\nexport type PongWidgetPosition = \"bottom-right\" | \"bottom-left\";\n\ninterface ThemeConfig {\n  title: string;\n  subtitle: string;\n  buttonText: string;\n  triggerText: string;\n  glow: string;\n  background: string;\n  lightBackground: string;\n  courtDark: string;\n  courtLight: string;\n}\n\nconst THEMES: Record<PongTheme, ThemeConfig> = {\n  arcade: {\n    title: \"Pong\",\n    subtitle: \"First to the table wins\",\n    buttonText: \"New Game\",\n    triggerText: \"Play Pong\",\n    glow: \"rgba(255,255,255,0.16)\",\n    background: \"linear-gradient(160deg, #07080b 0%, #101319 100%)\",\n    lightBackground: \"linear-gradient(160deg, #f4f6fa 0%, #dfe6f0 100%)\",\n    courtDark: \"#0c0d11\",\n    courtLight: \"#dce2ea\",\n  },\n  neon: {\n    title: \"Night Match\",\n    subtitle: \"Keep the rally alive\",\n    buttonText: \"New Match\",\n    triggerText: \"Open Court\",\n    glow: \"rgba(129,140,248,0.22)\",\n    background: \"linear-gradient(160deg, #06050c 0%, #100a1c 100%)\",\n    lightBackground: \"linear-gradient(160deg, #eef2ff 0%, #e0e7ff 100%)\",\n    courtDark: \"#0a0714\",\n    courtLight: \"#dde3ff\",\n  },\n  tournament: {\n    title: \"Championship\",\n    subtitle: \"Ten rounds. One winner.\",\n    buttonText: \"Restart Bracket\",\n    triggerText: \"Enter Court\",\n    glow: \"rgba(251,191,36,0.20)\",\n    background: \"linear-gradient(160deg, #0c0904 0%, #1a1206 100%)\",\n    lightBackground: \"linear-gradient(160deg, #fff7ed 0%, #fde8cf 100%)\",\n    courtDark: \"#120e08\",\n    courtLight: \"#f3e6d2\",\n  },\n  classic: {\n    title: \"Table Tennis\",\n    subtitle: \"Arrow keys or drag to play\",\n    buttonText: \"New Game\",\n    triggerText: \"Play a Round\",\n    glow: \"rgba(45,212,191,0.20)\",\n    background: \"linear-gradient(160deg, #04080a 0%, #081619 100%)\",\n    lightBackground: \"linear-gradient(160deg, #ecfeff 0%, #cffafe 100%)\",\n    courtDark: \"#071114\",\n    courtLight: \"#d7f4f6\",\n  },\n};\n\nconst DIFFICULTY: Record<PongDifficulty, { botSpeed: number; ballSpeedX: number; ballSpeedY: number; playerSpeed: number; label: string }> = {\n  easy: { botSpeed: 4.2, ballSpeedX: 5.5, ballSpeedY: 3.8, playerSpeed: 7.5, label: \"Easy\" },\n  medium: { botSpeed: 5.4, ballSpeedX: 6.8, ballSpeedY: 4.6, playerSpeed: 7.2, label: \"Medium\" },\n  hard: { botSpeed: 6.8, ballSpeedX: 8.2, ballSpeedY: 5.6, playerSpeed: 7.0, label: \"Hard\" },\n};\n\nconst ROUNDS = [5, 5, 5, 4, 4, 4, 3, 3, 3, 1];\nconst COURT_W = 800;\nconst COURT_H = 500;\nconst PADDLE_H = 90;\n\nfunction PaddleIcon() {\n  return (\n    <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n      <rect x=\"4\" y=\"5\" width=\"3.2\" height=\"14\" rx=\"1.4\" fill=\"#fffceb\" />\n      <circle cx=\"15.5\" cy=\"12\" r=\"5.2\" fill=\"#ffc93c\" />\n      <circle cx=\"15.5\" cy=\"12\" r=\"1.6\" fill=\"#fffceb\" />\n    </svg>\n  );\n}\n\nexport interface PongGameProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  theme?: PongTheme;\n  lightMode?: boolean;\n  accentColor?: string;\n  asPopup?: boolean;\n  trigger?: PongTrigger;\n  delaySeconds?: number;\n  widgetPosition?: PongWidgetPosition;\n  widgetIcon?: string;\n}\n\nexport function PongGame({\n  theme = \"arcade\",\n  lightMode = false,\n  accentColor = \"#ffffff\",\n  asPopup = false,\n  trigger = \"manual\",\n  delaySeconds = 4,\n  widgetPosition = \"bottom-right\",\n  widgetIcon,\n  className,\n  style,\n  ...props\n}: PongGameProps) {\n  const uid = React.useId();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const gameRootRef = React.useRef<HTMLDivElement>(null);\n  const widgetTriggerRef = React.useRef<HTMLButtonElement>(null);\n  const canvasRef = React.useRef<HTMLCanvasElement>(null);\n  const delayTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const statusTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const rafRef = React.useRef<number | null>(null);\n  const isVisibleRef = React.useRef(true);\n  const playerMoveRef = React.useRef(0);\n  const paddleTargetRef = React.useRef<number | null>(null);\n  const startGameRef = React.useRef<(() => void) | null>(null);\n  const wasPopupOpenRef = React.useRef(false);\n\n  const [scoreA, setScoreA] = React.useState(0);\n  const [scoreB, setScoreB] = React.useState(0);\n  const [round, setRound] = React.useState(1);\n  const [status, setStatus] = React.useState(\"Click the court to start\");\n  const [difficulty, setDifficulty] = React.useState<PongDifficulty>(\"medium\");\n  const [gameKey, setGameKey] = React.useState(0);\n  const [isCoarsePointer, setIsCoarsePointer] = React.useState(false);\n  const [popupOpen, setPopupOpen] = React.useState(!asPopup);\n  const [scrollTriggered, setScrollTriggered] = React.useState(false);\n  const [prevAsPopup, setPrevAsPopup] = React.useState(asPopup);\n\n  if (asPopup !== prevAsPopup) {\n    setPrevAsPopup(asPopup);\n    setPopupOpen(!asPopup);\n  }\n\n  const activeTheme = THEMES[theme];\n  const widgetOnRight = widgetPosition !== \"bottom-left\";\n  const widgetGlowStrong = activeTheme.glow.replace(/,\\s*[\\d.]+\\)$/, \", 0.85)\");\n  const resolvedAccent = accentColor || \"#ffffff\";\n  const neededPoints = ROUNDS[round - 1] || 1;\n\n  const mode = lightMode\n    ? {\n        ink: \"#171a21\",\n        inkSoft: \"rgba(23,26,33,0.7)\",\n        inkMuted: \"rgba(23,26,33,0.5)\",\n        inkFaint: \"rgba(23,26,33,0.4)\",\n        divider: \"rgba(23,26,33,0.18)\",\n        surface: \"rgba(255,255,255,0.65)\",\n        surfaceBorder: \"rgba(23,26,33,0.1)\",\n        cardBorder: \"rgba(23,26,33,0.08)\",\n        overlayBg: \"rgba(255,255,255,0.82)\",\n        chromeBg: \"#ffffff\",\n        chromeBorder: \"rgba(23,26,33,0.1)\",\n        net: \"rgba(23,26,33,0.28)\",\n        paddle: \"#171a21\",\n        focusRing: \"0 0 0 2px rgba(23,26,33,0.35)\",\n      }\n    : {\n        ink: \"#ffffff\",\n        inkSoft: \"rgba(255,255,255,0.7)\",\n        inkMuted: \"rgba(255,255,255,0.45)\",\n        inkFaint: \"rgba(255,255,255,0.4)\",\n        divider: \"rgba(255,255,255,0.3)\",\n        surface: \"rgba(255,255,255,0.06)\",\n        surfaceBorder: \"rgba(255,255,255,0.12)\",\n        cardBorder: \"rgba(255,255,255,0.08)\",\n        overlayBg: \"rgba(4,4,6,0.78)\",\n        chromeBg: \"rgba(10,10,15,0.92)\",\n        chromeBorder: \"rgba(255,255,255,0.16)\",\n        net: \"rgba(255,255,255,0.28)\",\n        paddle: \"#ffffff\",\n        focusRing: \"0 0 0 2px rgba(255,255,255,0.45)\",\n      };\n\n  const [focused, setFocused] = React.useState(false);\n\n  React.useEffect(() => {\n    return () => {\n      clearTimeout(delayTimerRef.current);\n      clearTimeout(statusTimerRef.current);\n      if (rafRef.current !== null) {\n        cancelAnimationFrame(rafRef.current);\n        rafRef.current = null;\n      }\n    };\n  }, []);\n\n  React.useEffect(() => {\n    if (typeof window === \"undefined\") return;\n    const mq = window.matchMedia(\"(pointer: coarse)\");\n    const apply = () => setIsCoarsePointer(mq.matches);\n    apply();\n    if (typeof mq.addEventListener === \"function\") {\n      mq.addEventListener(\"change\", apply);\n      return () => mq.removeEventListener(\"change\", apply);\n    }\n    return undefined;\n  }, []);\n\n  React.useEffect(() => {\n    if (!asPopup || trigger !== \"delay\") return;\n    clearTimeout(delayTimerRef.current);\n    delayTimerRef.current = setTimeout(() => setPopupOpen(true), delaySeconds * 1000);\n    return () => clearTimeout(delayTimerRef.current);\n  }, [asPopup, trigger, delaySeconds]);\n\n  React.useEffect(() => {\n    if (!asPopup || trigger !== \"scroll\" || !rootRef.current) return;\n    const el = rootRef.current;\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (entry.isIntersecting && !scrollTriggered) {\n          setScrollTriggered(true);\n          setPopupOpen(true);\n        }\n      },\n      { threshold: 0.4 },\n    );\n    observer.observe(el);\n    return () => observer.disconnect();\n  }, [asPopup, trigger, scrollTriggered]);\n\n  React.useEffect(() => {\n    if (!gameRootRef.current) return;\n    const observer = new IntersectionObserver(([entry]) => {\n      isVisibleRef.current = entry.isIntersecting;\n    }, { threshold: 0 });\n    observer.observe(gameRootRef.current);\n    return () => observer.disconnect();\n  }, []);\n\n  React.useEffect(() => {\n    if (!asPopup) return;\n    if (popupOpen) gameRootRef.current?.focus();\n    else if (wasPopupOpenRef.current) widgetTriggerRef.current?.focus();\n    wasPopupOpenRef.current = popupOpen;\n  }, [asPopup, popupOpen, gameKey]);\n\n  React.useEffect(() => {\n    const canvas = canvasRef.current;\n    if (!canvas) return;\n    const ctx = canvas.getContext(\"2d\");\n    if (!ctx) return;\n\n    canvas.width = COURT_W;\n    canvas.height = COURT_H;\n\n    const settings = DIFFICULTY[difficulty];\n    const court = lightMode ? activeTheme.courtLight : activeTheme.courtDark;\n    let running = false;\n    let gameOver = false;\n    let currentRound = 0;\n    let timer = 0;\n    let playerTurn: \"player\" | \"bot\" | null = null;\n    let cancelled = false;\n\n    const player = { x: 40, y: COURT_H / 2 - PADDLE_H / 2, w: 14, h: PADDLE_H, speed: settings.playerSpeed, score: 0 };\n    const bot = { x: COURT_W - 54, y: COURT_H / 2 - PADDLE_H / 2, w: 14, h: PADDLE_H, speed: settings.botSpeed, score: 0 };\n    const ball = { x: COURT_W / 2, y: COURT_H / 2, size: 14, speedX: settings.ballSpeedX, speedY: settings.ballSpeedY, dirX: 0, dirY: 0 };\n\n    const clampPaddle = (y: number) => {\n      if (y < 0) return 0;\n      if (y + PADDLE_H > COURT_H) return COURT_H - PADDLE_H;\n      return y;\n    };\n\n    const resetBall = () => {\n      ball.x = COURT_W / 2;\n      ball.y = COURT_H / 2;\n      ball.dirX = 0;\n      ball.dirY = 0;\n    };\n\n    const serve = () => {\n      const dir = playerTurn === \"player\" ? 1 : -1;\n      ball.dirX = dir;\n      ball.dirY = Math.random() > 0.5 ? 1 : -1;\n      ball.y = (playerTurn === \"player\" ? player.y : bot.y) + 45;\n      playerTurn = null;\n    };\n\n    const levelUp = () => {\n      currentRound++;\n      setRound(currentRound + 1);\n      player.score = 0;\n      bot.score = 0;\n      setScoreA(0);\n      setScoreB(0);\n      player.speed += 0.2;\n      bot.speed += 0.15;\n      ball.speedX += 0.22;\n      ball.speedY += 0.18;\n    };\n\n    const update = () => {\n      if (paddleTargetRef.current !== null) {\n        player.y = clampPaddle(paddleTargetRef.current);\n        paddleTargetRef.current = null;\n      } else {\n        player.y = clampPaddle(player.y + playerMoveRef.current * player.speed);\n      }\n\n      const target = ball.y - bot.h / 2;\n      if (bot.y < target - 3) bot.y += bot.speed;\n      else if (bot.y > target + 3) bot.y -= bot.speed;\n      bot.y = clampPaddle(bot.y);\n\n      if (ball.dirX !== 0) {\n        ball.x += ball.dirX * ball.speedX;\n        ball.y += ball.dirY * ball.speedY;\n      }\n\n      if (ball.y <= 0 || ball.y + ball.size >= COURT_H) ball.dirY *= -1;\n\n      const hitPaddle = (p: typeof player) => ball.x < p.x + p.w && ball.x + ball.size > p.x && ball.y < p.y + p.h && ball.y + ball.size > p.y;\n\n      if (hitPaddle(player)) {\n        ball.dirX = 1;\n        ball.x = player.x + player.w;\n      }\n      if (hitPaddle(bot)) {\n        ball.dirX = -1;\n        ball.x = bot.x - ball.size;\n      }\n\n      if (ball.x + ball.size < 0) {\n        bot.score++;\n        setScoreB(bot.score);\n        playerTurn = \"player\";\n        resetBall();\n        timer = performance.now();\n      }\n      if (ball.x > COURT_W) {\n        player.score++;\n        setScoreA(player.score);\n        playerTurn = \"bot\";\n        resetBall();\n        timer = performance.now();\n      }\n\n      if (playerTurn && performance.now() - timer > 900) serve();\n\n      const needed = ROUNDS[currentRound] || 1;\n      if (player.score >= needed) {\n        if (currentRound >= ROUNDS.length - 1) {\n          gameOver = true;\n          setStatus(\"You win\");\n          running = false;\n        } else {\n          levelUp();\n          setStatus(`Round ${currentRound + 1}`);\n          clearTimeout(statusTimerRef.current);\n          statusTimerRef.current = setTimeout(() => {\n            if (!cancelled) setStatus(\"\");\n          }, 1100);\n        }\n      } else if (bot.score >= needed) {\n        gameOver = true;\n        setStatus(\"Game over\");\n        running = false;\n      }\n    };\n\n    const draw = () => {\n      ctx.fillStyle = court;\n      ctx.fillRect(0, 0, COURT_W, COURT_H);\n      ctx.setLineDash([6, 12]);\n      ctx.beginPath();\n      ctx.moveTo(COURT_W / 2, 30);\n      ctx.lineTo(COURT_W / 2, COURT_H - 30);\n      ctx.lineWidth = 4;\n      ctx.strokeStyle = mode.net;\n      ctx.stroke();\n      ctx.setLineDash([]);\n      ctx.fillStyle = mode.paddle;\n      ctx.fillRect(player.x, player.y, player.w, player.h);\n      ctx.fillRect(bot.x, bot.y, bot.w, bot.h);\n      if (ball.dirX !== 0 || !playerTurn) {\n        ctx.beginPath();\n        ctx.arc(ball.x + ball.size / 2, ball.y + ball.size / 2, ball.size / 2, 0, Math.PI * 2);\n        ctx.fill();\n      }\n    };\n\n    const loop = () => {\n      if (cancelled || !running || gameOver) return;\n      if (isVisibleRef.current) {\n        update();\n        draw();\n      }\n      rafRef.current = requestAnimationFrame(loop);\n    };\n\n    const startGame = () => {\n      if (running || gameOver) return;\n      running = true;\n      setStatus(\"\");\n      playerTurn = \"bot\";\n      timer = performance.now();\n      rafRef.current = requestAnimationFrame(loop);\n    };\n\n    startGameRef.current = startGame;\n    playerMoveRef.current = 0;\n    paddleTargetRef.current = null;\n    draw();\n\n    return () => {\n      cancelled = true;\n      running = false;\n      startGameRef.current = null;\n      if (rafRef.current !== null) {\n        cancelAnimationFrame(rafRef.current);\n        rafRef.current = null;\n      }\n      clearTimeout(statusTimerRef.current);\n    };\n  }, [difficulty, gameKey, lightMode, activeTheme, mode.net, mode.paddle]);\n\n  const beginPlay = () => {\n    startGameRef.current?.();\n  };\n\n  const setPaddleFromClientY = (clientY: number) => {\n    const canvas = canvasRef.current;\n    if (!canvas) return;\n    const rect = canvas.getBoundingClientRect();\n    if (rect.height <= 0) return;\n    const scaleY = COURT_H / rect.height;\n    paddleTargetRef.current = (clientY - rect.top) * scaleY - PADDLE_H / 2;\n  };\n\n  const onCardKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    if (e.key === \"Escape\" && asPopup) {\n      setPopupOpen(false);\n      return;\n    }\n    if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\" || e.key === \" \") e.preventDefault();\n    beginPlay();\n    if (e.key === \"w\" || e.key === \"W\" || e.key === \"ArrowUp\") playerMoveRef.current = -1;\n    if (e.key === \"s\" || e.key === \"S\" || e.key === \"ArrowDown\") playerMoveRef.current = 1;\n  };\n\n  const onCardKeyUp = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    if ([\"w\", \"W\", \"s\", \"S\", \"ArrowUp\", \"ArrowDown\"].includes(e.key)) playerMoveRef.current = 0;\n  };\n\n  const onCourtPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {\n    beginPlay();\n    setPaddleFromClientY(e.clientY);\n    e.currentTarget.setPointerCapture?.(e.pointerId);\n  };\n\n  const onCourtPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {\n    if (e.buttons === 0 && e.pointerType !== \"touch\") return;\n    setPaddleFromClientY(e.clientY);\n  };\n\n  const changeDifficulty = (level: PongDifficulty) => {\n    setDifficulty(level);\n    setScoreA(0);\n    setScoreB(0);\n    setRound(1);\n    setStatus(\"Click the court to start\");\n    setGameKey((k) => k + 1);\n  };\n\n  const restart = React.useCallback(() => {\n    playerMoveRef.current = 0;\n    paddleTargetRef.current = null;\n    setScoreA(0);\n    setScoreB(0);\n    setRound(1);\n    setStatus(isCoarsePointer ? \"Tap the court to start\" : \"Click the court to start\");\n    setGameKey((k) => k + 1);\n  }, [isCoarsePointer]);\n\n  const gameCard = (\n    <div\n      ref={gameRootRef}\n      tabIndex={0}\n      role=\"application\"\n      aria-label={`${activeTheme.title} table tennis game`}\n      onKeyDown={onCardKeyDown}\n      onKeyUp={onCardKeyUp}\n      onPointerDown={() => gameRootRef.current?.focus()}\n      onFocus={() => setFocused(true)}\n      onBlur={() => setFocused(false)}\n      className=\"relative box-border flex w-full flex-col items-center overflow-hidden rounded-[22px] px-6.5 py-8 font-sans outline-none select-none\"\n      style={{ background: lightMode ? activeTheme.lightBackground : activeTheme.background, border: `1px solid ${mode.cardBorder}`, boxShadow: focused ? mode.focusRing : \"none\" }}\n    >\n      <header className=\"mb-4.5 w-full text-center\">\n        <h2 id={`${uid}-title`} className=\"m-0 font-serif text-[25px] font-normal tracking-[-0.02em]\" style={{ color: mode.ink }}>\n          {activeTheme.title}\n        </h2>\n        <div className=\"mx-auto my-3 h-px w-8\" style={{ background: mode.divider }} />\n        <p className=\"m-0 text-[10px] font-semibold tracking-[0.18em] uppercase\" style={{ color: mode.inkFaint }}>\n          {activeTheme.subtitle}\n        </p>\n      </header>\n\n      <div className=\"mb-3.5 flex w-full max-w-[340px] gap-2.5\" aria-live=\"polite\">\n        <div className=\"flex-1 rounded-[14px] px-3 py-2.5 text-center backdrop-blur-[8px]\" style={{ background: mode.surface, border: `1px solid ${mode.surfaceBorder}` }}>\n          <div className=\"text-[10px] font-bold tracking-[0.2em] uppercase\" style={{ color: mode.inkFaint }}>\n            You\n          </div>\n          <div className=\"font-serif text-[28px] font-normal\" style={{ color: mode.ink }}>\n            {scoreA}\n          </div>\n        </div>\n        <div className=\"flex-1 rounded-[14px] px-3 py-2.5 text-center backdrop-blur-[8px]\" style={{ background: mode.surface, border: `1px solid ${mode.surfaceBorder}` }}>\n          <div className=\"text-[10px] font-bold tracking-[0.2em] uppercase\" style={{ color: mode.inkFaint }}>\n            Bot\n          </div>\n          <div className=\"font-serif text-[28px] font-normal\" style={{ color: mode.ink }}>\n            {scoreB}\n          </div>\n        </div>\n      </div>\n\n      <div role=\"radiogroup\" aria-label=\"Difficulty\" className=\"mb-2.5 flex flex-wrap justify-center gap-2\">\n        {([\"easy\", \"medium\", \"hard\"] as PongDifficulty[]).map((level) => {\n          const on = difficulty === level;\n          return (\n            <button\n              key={level}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={on}\n              onClick={() => changeDifficulty(level)}\n              className=\"cursor-pointer rounded-full px-3.5 py-2 text-[10px] font-bold tracking-[0.12em] uppercase transition-[transform,opacity]\"\n              style={{ color: on ? \"#0a0a0f\" : mode.inkSoft, background: on ? resolvedAccent : mode.surface, border: `1px solid ${on ? \"transparent\" : mode.surfaceBorder}` }}\n            >\n              {DIFFICULTY[level].label}\n            </button>\n          );\n        })}\n      </div>\n\n      <p className=\"m-0 mb-3.5 text-center text-[10px] font-bold tracking-[0.16em] uppercase\" style={{ color: mode.inkMuted }}>\n        Round {round} · First to {neededPoints}\n      </p>\n\n      <div\n        className=\"relative w-full max-w-[460px] cursor-pointer touch-none overflow-hidden rounded-[14px] border border-[rgba(255,255,255,0.08)]\"\n        style={{ aspectRatio: \"16 / 10\" }}\n        onPointerDown={onCourtPointerDown}\n        onPointerMove={onCourtPointerMove}\n      >\n        <canvas ref={canvasRef} aria-label=\"Pong court. Left paddle is you, right paddle is the bot.\" className=\"block h-full w-full touch-none\" style={{ pointerEvents: \"none\" }} />\n        {status ? (\n          <div\n            className=\"absolute inset-0 flex cursor-pointer items-center justify-center p-4 backdrop-blur-[6px]\"\n            style={{ background: mode.overlayBg }}\n            onPointerDown={(e) => {\n              e.stopPropagation();\n              beginPlay();\n              gameRootRef.current?.focus();\n            }}\n          >\n            <p role=\"status\" className=\"m-0 text-center font-serif text-[22px] font-normal\" style={{ color: mode.ink }}>\n              {status}\n            </p>\n          </div>\n        ) : null}\n      </div>\n\n      <motion.button\n        type=\"button\"\n        onClick={restart}\n        whileHover={{ scale: 1.03 }}\n        whileTap={{ scale: 0.97 }}\n        className=\"mt-4.5 rounded-full border-none px-7.5 py-3.5 text-xs font-bold tracking-[0.1em] text-[#0a0a0f] uppercase\"\n        style={{ background: resolvedAccent }}\n      >\n        {activeTheme.buttonText}\n      </motion.button>\n\n      <p className=\"mt-3.5 mb-0 text-center text-[10px] font-semibold tracking-[0.12em] uppercase\" style={{ color: mode.inkFaint }}>\n        {isCoarsePointer ? \"Drag on the court to move your paddle\" : \"Click the court, then use W / S or arrow keys\"}\n      </p>\n    </div>\n  );\n\n  if (!asPopup) {\n    return (\n      <div ref={rootRef} className={cn(\"w-full\", className)} style={style} {...props}>\n        {gameCard}\n      </div>\n    );\n  }\n\n  return (\n    <div ref={rootRef} className={cn(\"relative w-full\", className)} style={style} {...props}>\n      <div className={cn(\"flex\", widgetOnRight ? \"justify-end\" : \"justify-start\")}>\n        <motion.button\n          ref={widgetTriggerRef}\n          type=\"button\"\n          onClick={() => setPopupOpen(true)}\n          whileHover={{ scale: 1.04 }}\n          whileTap={{ scale: 0.97 }}\n          aria-label={activeTheme.triggerText}\n          className=\"flex items-center gap-3 rounded-full border-none bg-white py-1.5 pr-5 pl-1.5\"\n          style={{ boxShadow: `0 8px 30px ${activeTheme.glow}, 0 4px 16px rgba(0,0,0,0.4)` }}\n        >\n          <span className=\"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border\" style={{ background: \"#121212\", borderColor: \"rgba(255,255,255,0.1)\" }}>\n            {widgetIcon ? (\n              // eslint-disable-next-line @next/next/no-img-element\n              <img src={widgetIcon} alt=\"\" className=\"h-6 w-6 rounded-full object-cover\" />\n            ) : (\n              <PaddleIcon />\n            )}\n          </span>\n          <span className=\"flex flex-col gap-0.5 text-left\">\n            <span className=\"text-[9px] font-bold tracking-[0.1em] whitespace-nowrap uppercase\" style={{ color: \"rgba(23,26,33,0.4)\" }}>\n              {activeTheme.triggerText}\n            </span>\n            <motion.span\n              className=\"text-[13px] font-bold tracking-[0.02em] whitespace-nowrap text-[#171a21] uppercase\"\n              animate={{ textShadow: [`0 0 3px ${widgetGlowStrong}`, `0 0 10px ${widgetGlowStrong}`, `0 0 3px ${widgetGlowStrong}`] }}\n              transition={{ duration: 2, repeat: Infinity, ease: \"easeInOut\" }}\n            >\n              Play Now\n            </motion.span>\n          </span>\n        </motion.button>\n      </div>\n\n      <AnimatePresence>\n        {popupOpen && (\n          <motion.div\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            onClick={(e) => {\n              if (e.target === e.currentTarget) setPopupOpen(false);\n            }}\n            className=\"fixed inset-0 z-[9999] flex items-center justify-center p-5\"\n            style={{ background: \"rgba(0,0,0,0.7)\", backdropFilter: \"blur(4px)\" }}\n          >\n            <motion.div\n              initial={{ scale: 0.94, y: 16 }}\n              animate={{ scale: 1, y: 0 }}\n              exit={{ scale: 0.96, opacity: 0 }}\n              transition={{ duration: 0.35, ease: [0.16, 1, 0.3, 1] }}\n              role=\"dialog\"\n              aria-modal=\"true\"\n              aria-labelledby={`${uid}-title`}\n              onKeyDown={(e) => {\n                if (e.key === \"Escape\") setPopupOpen(false);\n              }}\n              className=\"relative w-full max-w-[480px]\"\n            >\n              {gameCard}\n              <button\n                type=\"button\"\n                onClick={() => setPopupOpen(false)}\n                aria-label=\"Close game\"\n                className=\"absolute -top-3.5 -right-3.5 z-[100] flex h-8 w-8 items-center justify-center rounded-full border text-[17px] leading-[30px]\"\n                style={{ background: mode.chromeBg, borderColor: mode.chromeBorder, color: mode.ink }}\n              >\n                ×\n              </button>\n            </motion.div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}