{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dice-discount-popup",
  "title": "Dice Discount Popup",
  "description": "A gamified discount popup, roll two animated 3D dice for a reward tier (with a doubles bonus), copy the code, and track rolls left across a session. Inline or corner-widget popup with manual, delay or scroll triggers.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/dice-discount-popup/dice-discount-popup.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\ninterface RewardTier {\n  max: number;\n  label: string;\n  code: string;\n}\n\ninterface Reward {\n  label: string;\n  code: string;\n}\n\ninterface ThemeConfig {\n  name: string;\n  title: string;\n  subtitle: string;\n  buttonText: string;\n  triggerText: string;\n  glow: string;\n  background: string;\n  rewards: RewardTier[];\n  doublesReward: Reward;\n}\n\nconst THEMES: Record<string, ThemeConfig> = {\n  ecommerce: {\n    name: \"E-Commerce\",\n    title: \"Roll for a Discount\",\n    subtitle: \"3 free rolls, real savings\",\n    buttonText: \"Roll Dice\",\n    triggerText: \"Roll for a Discount\",\n    glow: \"rgba(255,255,255,0.16)\",\n    background: \"linear-gradient(160deg, #07080b 0%, #101319 100%)\",\n    rewards: [\n      { max: 4, label: \"5% off\", code: \"DICE5\" },\n      { max: 6, label: \"10% off\", code: \"DICE10\" },\n      { max: 8, label: \"15% off\", code: \"DICE15\" },\n      { max: 10, label: \"20% off\", code: \"DICE20\" },\n      { max: 12, label: \"25% off\", code: \"DICE25\" },\n    ],\n    doublesReward: { label: \"Free Shipping\", code: \"DOUBLES\" },\n  },\n  campaign: {\n    name: \"Campaign / Sale\",\n    title: \"Roll Before It's Gone\",\n    subtitle: \"Limited-time drop, roll now\",\n    buttonText: \"Roll for Deal\",\n    triggerText: \"Roll for a Deal\",\n    glow: \"rgba(248,113,113,0.22)\",\n    background: \"linear-gradient(160deg, #0c0505 0%, #1a0808 100%)\",\n    rewards: [\n      { max: 4, label: \"10% off\", code: \"SALE10\" },\n      { max: 6, label: \"20% off\", code: \"SALE20\" },\n      { max: 8, label: \"30% off\", code: \"SALE30\" },\n      { max: 10, label: \"40% off\", code: \"SALE40\" },\n      { max: 12, label: \"50% off\", code: \"SALE50\" },\n    ],\n    doublesReward: { label: \"Stack Extra 10%\", code: \"SALEDOUBLE\" },\n  },\n  saas: {\n    name: \"SaaS / Freemium\",\n    title: \"Roll for a Plan Discount\",\n    subtitle: \"One roll per new account\",\n    buttonText: \"Roll Dice\",\n    triggerText: \"Roll for a Discount\",\n    glow: \"rgba(129,140,248,0.22)\",\n    background: \"linear-gradient(160deg, #06050c 0%, #100a1c 100%)\",\n    rewards: [\n      { max: 4, label: \"10% off\", code: \"SAAS10\" },\n      { max: 6, label: \"20% off\", code: \"SAAS20\" },\n      { max: 8, label: \"1 Month Free\", code: \"SAAS-MONTH\" },\n      { max: 10, label: \"30% off\", code: \"SAAS30\" },\n      { max: 12, label: \"50% off\", code: \"SAAS50\" },\n    ],\n    doublesReward: { label: \"3 Months Free\", code: \"SAAS-3MO\" },\n  },\n};\n\nconst faceRotations: Record<number, { rotateX: number; rotateY: number }> = {\n  1: { rotateX: 0, rotateY: 0 },\n  2: { rotateX: 0, rotateY: 180 },\n  3: { rotateX: 0, rotateY: -90 },\n  4: { rotateX: 0, rotateY: 90 },\n  5: { rotateX: -90, rotateY: 0 },\n  6: { rotateX: 90, rotateY: 0 },\n};\n\nconst PIP_LAYOUTS: Record<number, number[]> = {\n  1: [5],\n  2: [1, 9],\n  3: [1, 5, 9],\n  4: [1, 3, 7, 9],\n  5: [1, 3, 5, 7, 9],\n  6: [1, 3, 4, 6, 7, 9],\n};\n\nfunction Pips({ number }: { number: number }) {\n  const active = PIP_LAYOUTS[number] || [];\n  return (\n    <div className=\"grid h-[65%] w-[65%] grid-cols-3 grid-rows-3\">\n      {Array.from({ length: 9 }).map((_, i) => (\n        <div key={i} className=\"flex items-center justify-center\">\n          {active.includes(i + 1) && (\n            <div\n              className=\"h-[11px] w-[11px] rounded-full\"\n              style={{ background: \"radial-gradient(circle at 32% 28%, #4b4b52 0%, #16161a 55%, #000000 100%)\", boxShadow: \"inset 0 1px 1.5px rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.5)\" }}\n            />\n          )}\n        </div>\n      ))}\n    </div>\n  );\n}\n\nfunction GiftIcon() {\n  return (\n    <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n      <defs>\n        <linearGradient id=\"dice-gift-gold\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">\n          <stop offset=\"0%\" stopColor=\"#ffe27a\" />\n          <stop offset=\"45%\" stopColor=\"#ffc93c\" />\n          <stop offset=\"100%\" stopColor=\"#e6a600\" />\n        </linearGradient>\n      </defs>\n      <rect x=\"3.5\" y=\"10\" width=\"17\" height=\"9.5\" rx=\"1.5\" fill=\"url(#dice-gift-gold)\" />\n      <rect x=\"2.5\" y=\"7\" width=\"19\" height=\"4\" rx=\"1\" fill=\"url(#dice-gift-gold)\" />\n      <rect x=\"10.4\" y=\"7\" width=\"3.2\" height=\"12.5\" fill=\"#fffceb\" />\n      <path d=\"M12 7c-1.6 0-3-1-3.6-2.1C7.6 3.2 8.5 2 9.8 2c1.3 0 2.2 1.4 2.2 3 0-1.6.9-3 2.2-3 1.3 0 2.2 1.2 1.4 2.9C15 6 13.6 7 12 7z\" fill=\"#fffceb\" />\n    </svg>\n  );\n}\n\nconst DICE_FACES = [\n  { face: 1, transform: \"rotateY(0deg) translateZ(42px) scale(1.08)\" },\n  { face: 2, transform: \"rotateY(180deg) translateZ(42px) scale(1.08)\" },\n  { face: 3, transform: \"rotateY(90deg) translateZ(42px) scale(1.08)\" },\n  { face: 4, transform: \"rotateY(-90deg) translateZ(42px) scale(1.08)\" },\n  { face: 5, transform: \"rotateX(90deg) translateZ(42px) scale(1.08)\" },\n  { face: 6, transform: \"rotateX(-90deg) translateZ(42px) scale(1.08)\" },\n];\n\nfunction Dice3D({ value, delay = 0, isRolling }: { value: number; delay?: number; isRolling: boolean }) {\n  const final = faceRotations[value];\n  return (\n    <div style={{ width: 84, height: 84, perspective: 700 }}>\n      <motion.div\n        animate={\n          isRolling\n            ? { rotateX: [0, 480, 960, 1440, final.rotateX], rotateY: [0, -360, 720, -1080, final.rotateY], rotateZ: [0, 180, 360, 540, 0], y: [0, -45, -10, 6, 0] }\n            : { rotateX: final.rotateX, rotateY: final.rotateY, rotateZ: 0, y: 0 }\n        }\n        transition={isRolling ? { duration: 1.7, ease: [0.22, 0.8, 0.2, 1], delay } : { duration: 0.45, ease: \"easeOut\", delay: delay * 0.5 }}\n        className=\"relative h-full w-full\"\n        style={{ transformStyle: \"preserve-3d\" }}\n      >\n        {DICE_FACES.map((item) => (\n          <div\n            key={item.face}\n            className=\"absolute flex h-[84px] w-[84px] items-center justify-center rounded-[9px] border border-black/5\"\n            style={{\n              background: \"linear-gradient(150deg, #ffffff 0%, #f4f5f7 55%, #e3e5e9 100%)\",\n              backfaceVisibility: \"hidden\",\n              transform: item.transform,\n              boxShadow: \"inset 0 1.5px 2px rgba(255,255,255,0.9), inset 0 -4px 8px rgba(0,0,0,0.08), 0 10px 22px rgba(0,0,0,0.35)\",\n            }}\n          >\n            <Pips number={item.face} />\n          </div>\n        ))}\n      </motion.div>\n    </div>\n  );\n}\n\nexport interface DiceDiscountPopupProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  accentColor?: string;\n  theme?: \"ecommerce\" | \"campaign\" | \"saas\";\n  asPopup?: boolean;\n  trigger?: \"manual\" | \"delay\" | \"scroll\";\n  delaySeconds?: number;\n  widgetPosition?: \"bottom-right\" | \"bottom-left\";\n  /** Namespaces the free-rolls/rewards persisted in localStorage — only needed if you place more than one instance on the same page. */\n  storageKey?: string;\n}\n\nexport function DiceDiscountPopup({\n  accentColor = \"#ffffff\",\n  theme = \"ecommerce\",\n  asPopup = false,\n  trigger = \"manual\",\n  delaySeconds = 4,\n  widgetPosition = \"bottom-right\",\n  storageKey = \"\",\n  className,\n  style,\n  ...props\n}: DiceDiscountPopupProps) {\n  const uid = React.useId();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const popupCardRef = React.useRef<HTMLDivElement>(null);\n  const rewardModalRef = React.useRef<HTMLDivElement>(null);\n  const widgetTriggerRef = React.useRef<HTMLButtonElement>(null);\n  const rollTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const settleTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const copyTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n  const [dice1, setDice1] = React.useState(1);\n  const [dice2, setDice2] = React.useState(1);\n  const [isRolling, setIsRolling] = React.useState(false);\n  const [total, setTotal] = React.useState<number | null>(null);\n  const [currentReward, setCurrentReward] = React.useState<Reward | null>(null);\n  const [showReward, setShowReward] = React.useState(false);\n  const [rewards, setRewards] = React.useState<Reward[]>([]);\n  const [rollsLeft, setRollsLeft] = React.useState(3);\n  const [message, setMessage] = React.useState(\"You have 3 free rolls\");\n  const [copiedCode, setCopiedCode] = React.useState<string | null>(null);\n  const [popupOpen, setPopupOpen] = React.useState(!asPopup);\n  const [scrollTriggered, setScrollTriggered] = React.useState(false);\n\n  const activeTheme = THEMES[theme] || THEMES.ecommerce;\n  const widgetGlowStrong = activeTheme.glow.replace(/,\\s*[\\d.]+\\)$/, \", 0.85)\");\n\n  const suffix = storageKey.trim() ? `-${storageKey.trim()}` : \"\";\n  const rollsKey = `dice-rolls-left${suffix}`;\n  const rewardsKey = `dice-rewards${suffix}`;\n\n  // Persist rolls-left/rewards across reloads so refreshing the page can't\n  // be used to farm unlimited free rolls.\n  React.useEffect(() => {\n    const savedRolls = localStorage.getItem(rollsKey);\n    const savedRewards = localStorage.getItem(rewardsKey);\n    // Restored after mount on purpose: reading storage during render would not match the\n    // server-rendered HTML.\n    // eslint-disable-next-line react-hooks/set-state-in-effect\n    if (savedRolls !== null) setRollsLeft(parseInt(savedRolls, 10));\n    if (savedRewards) {\n      try {\n        setRewards(JSON.parse(savedRewards));\n      } catch {\n        setRewards([]);\n      }\n    }\n    if (savedRolls === \"0\") setMessage(\"All rolls used\");\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  React.useEffect(() => () => {\n    clearTimeout(rollTimerRef.current);\n    clearTimeout(settleTimerRef.current);\n    clearTimeout(copyTimerRef.current);\n  }, []);\n\n  // Move focus into the popup dialog when it opens, and back to the widget\n  // trigger when it closes — keyboard/screen-reader users shouldn't be left\n  // behind on a background page they can't see. Skips the first render so\n  // mounting doesn't steal focus.\n  const wasPopupOpenRef = React.useRef(false);\n  React.useEffect(() => {\n    if (!asPopup) return;\n    if (popupOpen) {\n      popupCardRef.current?.focus();\n    } else if (wasPopupOpenRef.current) {\n      widgetTriggerRef.current?.focus();\n    }\n    wasPopupOpenRef.current = popupOpen;\n  }, [asPopup, popupOpen]);\n\n  // Same for the \"You won\" reward dialog\n  React.useEffect(() => {\n    if (!showReward) return;\n    rewardModalRef.current?.focus();\n  }, [showReward]);\n\n  // Follow asPopup changes during render instead of in an effect (no extra render pass).\n  const [prevAsPopup, setPrevAsPopup] = React.useState(asPopup);\n  if (asPopup !== prevAsPopup) {\n    setPrevAsPopup(asPopup);\n    setPopupOpen(!asPopup);\n  }\n\n  React.useEffect(() => {\n    if (!asPopup || trigger !== \"delay\") return;\n    const t = setTimeout(() => setPopupOpen(true), delaySeconds * 1000);\n    return () => clearTimeout(t);\n  }, [asPopup, trigger, delaySeconds]);\n\n  React.useEffect(() => {\n    if (!asPopup || trigger !== \"scroll\" || !rootRef.current) return;\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(rootRef.current);\n    return () => observer.disconnect();\n  }, [asPopup, trigger, scrollTriggered]);\n\n  const getReward = (sum: number, isDoubles: boolean): Reward => {\n    if (isDoubles) return activeTheme.doublesReward;\n    const tier = activeTheme.rewards.find((t) => sum <= t.max);\n    return tier || activeTheme.rewards[activeTheme.rewards.length - 1];\n  };\n\n  const rollDice = () => {\n    if (rollsLeft <= 0 || isRolling) return;\n    setIsRolling(true);\n    setTotal(null);\n    setMessage(\"Rolling...\");\n    clearTimeout(rollTimerRef.current);\n    clearTimeout(settleTimerRef.current);\n\n    rollTimerRef.current = setTimeout(() => {\n      const side1 = Math.floor(Math.random() * 6) + 1;\n      const side2 = Math.floor(Math.random() * 6) + 1;\n      const sum = side1 + side2;\n      const won = getReward(sum, side1 === side2);\n\n      setDice1(side1);\n      setDice2(side2);\n      setTotal(sum);\n      setCurrentReward(won);\n      setIsRolling(false);\n\n      const newRewards = [...rewards, won];\n      const newRollsLeft = rollsLeft - 1;\n      setRewards(newRewards);\n      setRollsLeft(newRollsLeft);\n      localStorage.setItem(rewardsKey, JSON.stringify(newRewards));\n      localStorage.setItem(rollsKey, newRollsLeft.toString());\n      setMessage(newRollsLeft === 0 ? \"All rolls used\" : `${newRollsLeft} roll${newRollsLeft > 1 ? \"s\" : \"\"} left`);\n      settleTimerRef.current = setTimeout(() => setShowReward(true), 600);\n    }, 1800);\n  };\n\n  const copyCode = (code: string) => {\n    navigator.clipboard.writeText(code).catch(() => {});\n    setCopiedCode(code);\n    clearTimeout(copyTimerRef.current);\n    copyTimerRef.current = setTimeout(() => setCopiedCode(null), 1500);\n  };\n\n  const gameCard = (\n    <div\n      className=\"relative flex w-full flex-col items-center overflow-hidden rounded-[22px] border border-white/8 px-6.5 py-8\"\n      style={{ background: activeTheme.background, fontFamily: \"'Helvetica Neue', Helvetica, Arial, sans-serif\" }}\n    >\n      <div className=\"relative z-10 mb-5.5 text-center\">\n        <h2 id={`${uid}-title`} className=\"m-0 text-[25px] leading-[1.15] font-normal tracking-tight text-white\" style={{ fontFamily: \"Georgia, 'Times New Roman', serif\" }}>\n          {activeTheme.title}\n        </h2>\n        <div className=\"mx-auto my-3 h-px w-8 bg-white/30\" />\n        <div className=\"text-[10px] font-semibold tracking-[0.18em] text-white/40 uppercase\">{activeTheme.subtitle}</div>\n      </div>\n\n      <div className=\"relative z-10 mb-5.5 flex justify-center gap-6\" style={{ perspective: 800 }} aria-hidden=\"true\">\n        <Dice3D value={dice1} delay={0} isRolling={isRolling} />\n        <Dice3D value={dice2} delay={0.1} isRolling={isRolling} />\n      </div>\n\n      <div className=\"relative z-10 mb-2.5 w-full max-w-[260px] rounded-[14px] border border-white/12 bg-white/6 px-4 py-3 text-center backdrop-blur-md\">\n        <div className=\"text-[10px] font-bold tracking-[0.2em] text-white/40 uppercase\">Result</div>\n        <div className=\"text-[34px] font-normal text-white\" style={{ fontFamily: \"Georgia, 'Times New Roman', serif\" }} aria-live=\"polite\">\n          {total !== null ? total : \"-\"}\n        </div>\n      </div>\n\n      <div className=\"relative z-10 mb-4.5 text-center text-xs font-semibold tracking-wide text-white/45 uppercase\" aria-live=\"polite\">\n        {message}\n      </div>\n\n      <motion.button\n        onClick={rollDice}\n        whileHover={{ scale: rollsLeft <= 0 || isRolling ? 1 : 1.03 }}\n        whileTap={{ scale: rollsLeft <= 0 || isRolling ? 1 : 0.97 }}\n        disabled={rollsLeft <= 0 || isRolling}\n        className=\"relative z-10 mb-6.5 rounded-full px-7.5 py-3.5 text-xs font-bold tracking-[0.1em] text-[#0a0a0f] uppercase disabled:cursor-not-allowed\"\n        style={{ background: accentColor, opacity: rollsLeft <= 0 || isRolling ? 0.4 : 1 }}\n      >\n        {isRolling ? \"Rolling...\" : rollsLeft <= 0 ? \"No Rolls Left\" : `${activeTheme.buttonText} · ${rollsLeft} left`}\n      </motion.button>\n\n      {rewards.length > 0 && (\n        <div className=\"relative z-10 mt-1.5 w-full max-w-[340px]\">\n          <div className=\"mb-3 text-center text-[10px] font-bold tracking-[0.2em] text-white/40 uppercase\">Your Rewards</div>\n          <div className=\"flex flex-col gap-2\">\n            {rewards.map((r, i) => {\n              const isCopied = copiedCode === r.code;\n              return (\n                <div key={i} className=\"flex items-center justify-between rounded-xl border border-white/10 bg-white/6 px-4 py-3 backdrop-blur-md\">\n                  <div>\n                    <div className=\"text-sm font-semibold text-white\">{r.label}</div>\n                    <div className=\"mt-0.5 text-[11px] font-semibold tracking-wide text-white/45\">{r.code}</div>\n                  </div>\n                  <button onClick={() => copyCode(r.code)} className=\"flex items-center justify-center rounded-lg p-1.5\" title=\"Copy code\" aria-label=\"Copy code\">\n                    {isCopied ? (\n                      <span className=\"text-sm font-bold text-white\">✓</span>\n                    ) : (\n                      <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"rgba(255,255,255,0.6)\" strokeWidth=\"2\">\n                        <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n                        <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n                      </svg>\n                    )}\n                  </button>\n                </div>\n              );\n            })}\n          </div>\n        </div>\n      )}\n\n      <AnimatePresence>\n        {showReward && currentReward && (\n          <motion.div\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0, transition: { duration: 0.12 } }}\n            className=\"absolute inset-0 z-50 flex items-center justify-center rounded-[22px] p-4\"\n            style={{ background: \"rgba(4,4,6,0.86)\", backdropFilter: \"blur(6px)\" }}\n          >\n            <motion.div\n              ref={rewardModalRef}\n              initial={{ opacity: 0, scale: 0.96 }}\n              animate={{ opacity: 1, scale: 1 }}\n              exit={{ opacity: 0, scale: 0.98 }}\n              transition={{ duration: 0.35, ease: [0.16, 1, 0.3, 1] }}\n              role=\"dialog\"\n              aria-modal=\"true\"\n              aria-labelledby={`${uid}-reward-title`}\n              tabIndex={-1}\n              onKeyDown={(e) => {\n                if (e.key === \"Escape\") setShowReward(false);\n              }}\n              className=\"w-full max-w-[300px] rounded-[18px] border border-white/16 bg-white/6 px-6.5 py-7.5 text-center shadow-[0_20px_50px_rgba(0,0,0,0.5)] backdrop-blur-2xl\"\n            >\n              <motion.h3\n                id={`${uid}-reward-title`}\n                initial={{ opacity: 0, y: 14 }}\n                animate={{ opacity: 1, y: 0 }}\n                transition={{ delay: 0.15, duration: 0.4 }}\n                className=\"m-0 text-2xl font-normal text-white\"\n                style={{ fontFamily: \"Georgia, 'Times New Roman', serif\" }}\n              >\n                You won\n              </motion.h3>\n              <motion.div initial={{ scaleX: 0 }} animate={{ scaleX: 1 }} transition={{ delay: 0.25, duration: 0.4 }} className=\"mx-auto my-3.5 h-px w-7 bg-white/30\" style={{ transformOrigin: \"center\" }} />\n              <motion.p initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.3, duration: 0.4 }} className=\"mb-4.5 text-[15px] text-white/70\">\n                {currentReward.label}\n              </motion.p>\n              <motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.35, duration: 0.4 }} className=\"mb-5 rounded-[10px] border border-dashed border-white/30 bg-white/4 p-3\">\n                <span className=\"text-base font-bold tracking-wide text-white\">{currentReward.code}</span>\n              </motion.div>\n              <motion.button\n                initial={{ opacity: 0, y: 10 }}\n                animate={{ opacity: 1, y: 0 }}\n                transition={{ delay: 0.4, duration: 0.4 }}\n                onClick={() => setShowReward(false)}\n                className=\"w-full cursor-pointer rounded-full py-3.5 text-xs font-bold tracking-[0.1em] text-[#0a0a0f] uppercase\"\n                style={{ background: accentColor }}\n              >\n                Continue\n              </motion.button>\n            </motion.div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n\n  if (!asPopup) {\n    return (\n      <div ref={rootRef} className={className} style={style} {...props}>\n        {gameCard}\n      </div>\n    );\n  }\n\n  return (\n    <div ref={rootRef} className={className} style={style} {...props}>\n      <div className={cn(\"fixed bottom-6 z-[9998] flex items-center\", widgetPosition === \"bottom-left\" ? \"left-6\" : \"right-6\")}>\n        <motion.button\n          ref={widgetTriggerRef}\n          onClick={() => setPopupOpen(true)}\n          whileHover={{ scale: 1.04 }}\n          whileTap={{ scale: 0.97 }}\n          aria-label={activeTheme.triggerText}\n          // Keep the icon nearest whichever screen edge the widget is\n          // anchored to, with the label extending back toward the page.\n          className={cn(\n            \"flex h-14 items-center gap-3 rounded-full border border-black/8 bg-white py-1.5 backdrop-blur-md\",\n            widgetPosition === \"bottom-left\" ? \"flex-row-reverse pr-1.5 pl-5\" : \"pr-5 pl-1.5\",\n          )}\n          style={{ boxShadow: `0 8px 30px ${activeTheme.glow}, 0 4px 16px rgba(0,0,0,0.4)`, fontFamily: \"'Helvetica Neue', Helvetica, Arial, sans-serif\" }}\n        >\n          <span className=\"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-white/10 bg-[#121212]\">\n            <GiftIcon />\n          </span>\n          <span className=\"flex flex-col gap-0.5\">\n            <span className=\"text-[9px] font-bold tracking-[0.1em] whitespace-nowrap text-black/40 uppercase\">{activeTheme.triggerText}</span>\n            <motion.span\n              className=\"text-[13px] font-bold tracking-wide 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              Win a Prize\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            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              ref={popupCardRef}\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              tabIndex={-1}\n              onKeyDown={(e) => {\n                if (e.key === \"Escape\") setPopupOpen(false);\n              }}\n              className=\"relative w-full max-w-[420px]\"\n              style={{ maxHeight: \"90vh\" }}\n            >\n              {gameCard}\n              <button\n                onClick={() => setPopupOpen(false)}\n                aria-label=\"Close\"\n                className=\"absolute -top-3.5 -right-3.5 z-[100] flex h-8 w-8 items-center justify-center rounded-full border border-white/16 text-[17px] text-white shadow-[0_4px_16px_rgba(0,0,0,0.5)]\"\n                style={{ background: \"rgba(10,10,15,0.95)\" }}\n              >\n                ×\n              </button>\n            </motion.div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}