function ScreenLibrary({ playing = false }) {
  const [t, setT] = useStateFS(0);
  const panelRef = React.useRef(null);

  React.useEffect(() => {
    if (!playing) {
      setT(0);
      return;
    }
    let startTime = performance.now();
    let rafId;
    const loop = (now) => {
      const elapsed = (now - startTime) / 1000;
      setT(elapsed % 9); // 9-second loop
      rafId = requestAnimationFrame(loop);
    };
    rafId = requestAnimationFrame(loop);
    return () => cancelAnimationFrame(rafId);
  }, [playing]);

  // Coordinates mapping for full-width layout. Y values are %s of the
  // FSFrame body (~395px), so source values are picked to land on actual
  // elements rendered in the current layout.
  let cursorX = 85;
  let cursorY = 65;
  let isHoveredAdd = false;
  let isClickedAdd = false;
  let isDropdownOpen = false;
  let isHoveredDate = false;
  let isClickedDate = false;
  let isQuestionAdded = false;

  // Auto-scroll loop showing ALL categories
  let scrollTopAmount = 0;

  if (t < 1.2) {
    const pct = t / 1.2;
    const ease = pct < 0.5 ? 2 * pct * pct : 1 - Math.pow(-2 * pct + 2, 2) / 2;
    cursorX = 85 + (90 - 85) * ease;
    cursorY = 65 + (10 - 65) * ease;
  } else if (t < 1.5) {
    cursorX = 90;
    cursorY = 10;
    isHoveredAdd = true;
  } else if (t < 1.7) {
    cursorX = 90;
    cursorY = 10;
    isHoveredAdd = true;
    isClickedAdd = true;
  } else if (t < 2.0) {
    cursorX = 90;
    cursorY = 10;
    isDropdownOpen = true;
  } else if (t < 3.3) {
    // Scroll Down to show Choice, Rating, Benchmarking
    isDropdownOpen = true;
    cursorX = 92;
    cursorY = 28;
    const pct = (t - 2.0) / 1.3;
    scrollTopAmount = pct * 210;
  } else if (t < 3.8) {
    // Hold at bottom to read Benchmarking / Special
    isDropdownOpen = true;
    cursorX = 92;
    cursorY = 28;
    scrollTopAmount = 210;
  } else if (t < 4.8) {
    // Scroll Up back to Text Questions
    isDropdownOpen = true;
    cursorX = 92;
    cursorY = 28;
    const pct = (t - 3.8) / 1.0;
    scrollTopAmount = 210 * (1 - pct);
  } else if (t < 5.2) {
    // Hover over Date
    isDropdownOpen = true;
    scrollTopAmount = 0;
    const pct = (t - 4.8) / 0.4;
    cursorX = 92 + (87 - 92) * pct;
    cursorY = 28 + (34 - 28) * pct;
    isHoveredDate = true;
  } else if (t < 5.4) {
    // Click Date
    isDropdownOpen = true;
    scrollTopAmount = 0;
    cursorX = 87;
    cursorY = 34;
    isHoveredDate = true;
    isClickedDate = true;
  } else if (t < 5.8) {
    // Dropdown Closes, Question Appended
    isDropdownOpen = false;
    scrollTopAmount = 0;
    cursorX = 87;
    cursorY = 34;
    isQuestionAdded = true;
  } else if (t < 7.5) {
    // Cursor glides back to rest
    isQuestionAdded = true;
    const pct = (t - 5.8) / 1.7;
    const ease = Math.min(1, pct);
    cursorX = 87 + (85 - 87) * ease;
    cursorY = 34 + (65 - 34) * ease;
  } else {
    // Idle state showing appended card
    cursorX = 85;
    cursorY = 65;
    isQuestionAdded = true;
  }

  // Panel auto-scroll progress: scroll down once Q5 is being added, hold, then return to top before the loop restarts.
  let panelScrollProgress = 0;
  if (t >= 5.4 && t < 6.4) {
    const pct = (t - 5.4) / 1.0;
    panelScrollProgress = pct < 0.5 ? 2 * pct * pct : 1 - Math.pow(-2 * pct + 2, 2) / 2;
  } else if (t >= 6.4 && t < 8.2) {
    panelScrollProgress = 1;
  } else if (t >= 8.2 && t < 8.9) {
    const pct = (t - 8.2) / 0.7;
    panelScrollProgress = 1 - (pct < 0.5 ? 2 * pct * pct : 1 - Math.pow(-2 * pct + 2, 2) / 2);
  }

  React.useEffect(() => {
    const el = panelRef.current;
    if (!el) return;
    const max = el.scrollHeight - el.clientHeight;
    el.scrollTop = max * panelScrollProgress;
  }, [panelScrollProgress, isQuestionAdded]);

  // Ripple calculations
  const showRipple = (t >= 1.5 && t < 1.7) || (t >= 5.2 && t < 5.4);
  const rippleX = (t >= 1.5 && t < 1.7) ? 90 : 87;
  const rippleY = (t >= 1.5 && t < 1.7) ? 10 : 34;

  // Horizontal numbers scale 1-10 mockup
  const horizontalScale = (
    <div className="flex gap-1.5 mt-2.5">
      {Array.from({ length: 10 }).map((_, idx) => (
        <span key={idx} className="w-5 h-5 flex items-center justify-center border border-blue-200 text-blue-600 rounded bg-white font-semibold text-[9px] shadow-sm select-none">
          {idx + 1}
        </span>
      ))}
    </div>
  );

  const initialQs = [
    {
      num: 1,
      name: 'Motivation',
      bench: 'MotivationBenchmark',
      title: 'How motivated have you felt about your work in the last month? *',
      mock: horizontalScale
    },
    {
      num: 2,
      name: 'Stress and Workload Benchmark',
      bench: 'StressAndWorkloadBenchmark',
      title: 'How manageable has your workload felt over the past month? *',
      mock: horizontalScale
    },
    {
      num: 3,
      name: 'Work Life Balance Benchmark',
      bench: 'WorkLifeBalanceBenchmark',
      title: 'How satisfied are you with your ability to maintain a healthy work-life balance? *',
      mock: horizontalScale
    },
    {
      num: 4,
      name: 'Wellbeing Benchmark',
      bench: 'OverallWellbeingBenchmark',
      title: 'How would you rate your overall wellbeing at work this month? *',
      mock: horizontalScale
    }
  ];

  return (
    <FSFrame label="Question library · Social housing">
      <div className="relative w-full h-full bg-[#f8fafc] flex overflow-hidden select-none font-sans text-slate-700">
        
        {/* Left builder Panel */}
        <div ref={panelRef} className="w-full p-3.5 flex flex-col gap-3 min-w-0 overflow-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" style={{ pointerEvents: 'none' }}>
          {/* Header Row */}
          <div className="flex items-center justify-between border-b border-slate-200 pb-2.5 shrink-0">
            <div className="flex items-center gap-2">
              <svg className="w-4 h-4 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                <path strokeLinecap="round" strokeLinejoin="round" d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" />
              </svg>
              <div>
                <div className="text-[11px] font-bold text-slate-800">General Questions</div>
                <div className="text-[8px] text-slate-400 font-medium">Main survey questions</div>
              </div>
              <span className="bg-slate-200/75 border border-slate-300/40 text-slate-600 text-[8px] font-bold px-1.5 py-0.5 rounded-full ml-1">
                {isQuestionAdded ? '5 questions' : '4 questions'}
              </span>
            </div>
            
            {/* Header controls & Add Button */}
            <div className="flex items-center gap-1.5 relative">
              <span className="p-1 rounded bg-slate-100 hover:bg-slate-200 border border-slate-200 cursor-pointer">
                <svg className="w-3 h-3 text-slate-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                  <path strokeLinecap="round" strokeLinejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
                </svg>
              </span>
              <span className="p-1 rounded bg-slate-100 hover:bg-slate-200 border border-slate-200 cursor-pointer">
                <svg className="w-3 h-3 text-rose-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                  <path strokeLinecap="round" strokeLinejoin="round" d="M14.74 9l-.346 9m-4.788 0L9 9m-4.788-3.97a9.05 9.05 0 011.666-.39m13.722-1.315a8.96 8.96 0 01-1.07-1.051l-1.066-1.066a2.25 2.25 0 00-1.591-.659h-2.18c-.596 0-1.111.23-1.482.608L10.97 3.3l-1.07 1.052M4.5 18.08l.388-11.35C4.89 6.2 5.3 5.76 5.86 5.76h12.28c.56 0 .97.44.97 1.018l.388 11.35a2.25 2.25 0 01-2.247 2.25H6.747a2.25 2.25 0 01-2.247-2.25z" />
                </svg>
              </span>
              
              <button
                type="button"
                className={`py-1.5 px-2.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-bold text-[10px] flex items-center justify-between gap-1 shadow-sm transition-all duration-200 ${isHoveredAdd ? 'bg-blue-700 scale-[1.02]' : ''} ${isClickedAdd ? 'scale-[0.98]' : ''}`}
              >
                <span>+ Add Question</span>
                <svg className="w-2.5 h-2.5 opacity-80" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5">
                  <path strokeLinecap="round" strokeLinejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
                </svg>
              </button>
              
              {/* Dropdown Menu (Upgraded Categories & Custom Icons matching close-up screenshot) */}
              <div
                className={`absolute right-0 top-[32px] w-[185px] bg-white border border-slate-200 rounded-xl shadow-2xl overflow-hidden transition-all duration-300 origin-top-right flex flex-col z-30 ${isDropdownOpen ? 'opacity-100 scale-100 translate-y-0' : 'opacity-0 scale-95 -translate-y-2 pointer-events-none'}`}
                style={{ maxHeight: '235px' }}
              >
                <div
                  className="flex flex-col"
                  style={{ transform: `translateY(-${scrollTopAmount}px)`, transition: 'none' }}
                >
                  {/* TEXT QUESTIONS */}
                  <div className="bg-[#eff6ff] border-b border-t border-slate-100 text-blue-800 px-2.5 py-1 text-[8px] font-bold tracking-wider uppercase flex items-center gap-1.5">
                    <svg className="w-3 h-3 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                      <path strokeLinecap="round" strokeLinejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
                    </svg>
                    TEXT QUESTIONS
                  </div>
                  <div className="px-1 py-0.5">
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <span className="text-slate-400 font-bold shrink-0 text-center w-4 text-[12px]">I</span>
                      Short Text
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-slate-400 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
                      </svg>
                      Paragraph
                    </div>
                    <div className={`flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium transition-colors cursor-pointer ${isHoveredDate ? 'bg-blue-50 text-blue-700 font-semibold' : 'text-slate-700'}`}>
                      <svg className={`w-4 h-4 shrink-0 ${isHoveredDate ? 'text-blue-600' : 'text-slate-400'}`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
                        <line x1="16" y1="2" x2="16" y2="6" />
                        <line x1="8" y1="2" x2="8" y2="6" />
                        <line x1="3" y1="10" x2="21" y2="10" />
                      </svg>
                      Date
                    </div>
                  </div>

                  {/* CHOICE QUESTIONS */}
                  <div className="bg-[#eff6ff] border-b border-t border-slate-100 text-blue-800 px-2.5 py-1 text-[8px] font-bold tracking-wider uppercase flex items-center gap-1.5">
                    <svg className="w-3 h-3 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                      <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 12h16.5m-16.5 5.25h16.5m-16.5-10.5h16.5" />
                    </svg>
                    CHOICE QUESTIONS
                  </div>
                  <div className="px-1 py-0.5">
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-emerald-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5">
                        <circle cx="12" cy="12" r="8" />
                        <circle cx="12" cy="12" r="3" fill="currentColor" />
                      </svg>
                      Single Choice
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-emerald-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5">
                        <rect x="4" y="4" width="16" height="16" rx="2.5" />
                        <path strokeLinecap="round" strokeLinejoin="round" d="M9 12l2 2 4-4" />
                      </svg>
                      Multiple Choice
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-emerald-500 shrink-0" fill="currentColor" viewBox="0 0 24 24">
                        <path d="M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z" />
                      </svg>
                      Yes/No
                    </div>
                  </div>

                  {/* RATING QUESTIONS */}
                  <div className="bg-[#eff6ff] border-b border-t border-slate-100 text-blue-800 px-2.5 py-1 text-[8px] font-bold tracking-wider uppercase flex items-center gap-1.5">
                    <svg className="w-3 h-3 text-blue-600 shrink-0" fill="currentColor" viewBox="0 0 24 24">
                      <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" />
                    </svg>
                    RATING QUESTIONS
                  </div>
                  <div className="px-1 py-0.5">
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-amber-400 shrink-0" fill="currentColor" viewBox="0 0 24 24">
                        <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" />
                      </svg>
                      Custom Rating
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-amber-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <circle cx="12" cy="8" r="7" />
                        <path d="M8.21 13.89L7 23l5-3 5 3-1.21-9.12" />
                      </svg>
                      5-Point Scale (CSAT)
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-amber-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <path strokeLinecap="round" strokeLinejoin="round" d="M2.25 18L9 11.25l4.5 4.5L21.75 7.5M21.75 7.5V12m0-4.5H17.25" />
                      </svg>
                      NPS Scale (0-10)
                    </div>
                  </div>

                  {/* BENCHMARKING */}
                  <div className="bg-[#eff6ff] border-b border-t border-slate-100 text-blue-800 px-2.5 py-1 text-[8px] font-bold tracking-wider uppercase flex items-center gap-1.5">
                    <svg className="w-3 h-3 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                      <path strokeLinecap="round" strokeLinejoin="round" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
                    </svg>
                    BENCHMARKING
                  </div>
                  <div className="px-1 py-0.5">
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-rose-500 shrink-0" fill="currentColor" viewBox="0 0 24 24">
                        <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
                      </svg>
                      Overall Wellbeing
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-amber-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5">
                        <path strokeLinecap="round" strokeLinejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
                      </svg>
                      Stress & Workload
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-cyan-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <path strokeLinecap="round" strokeLinejoin="round" d="M12 3v17m9-10c0 2.21-4.03 4-9 4s-9-1.79-9-4m9 4v6M3 10L12 6l9 4M6 12l-3 4h6l-3-4zm12 0l-3 4h6l-3-4z" />
                      </svg>
                      Work-Life Balance
                    </div>
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-blue-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <path strokeLinecap="round" strokeLinejoin="round" d="M15.59 14.37a6 6 0 01-5.84 0M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm2.19 12.19L18 18M12 7v5l2.5 1.5" />
                      </svg>
                      Motivation
                    </div>
                  </div>

                  {/* SPECIAL */}
                  <div className="bg-[#eff6ff] border-b border-t border-slate-100 text-blue-800 px-2.5 py-1 text-[8px] font-bold tracking-wider uppercase flex items-center gap-1.5">
                    <svg className="w-3 h-3 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                      <circle cx="12" cy="12" r="10" />
                      <line x1="12" y1="16" x2="12" y2="12" />
                      <line x1="12" y1="8" x2="12.01" y2="8" />
                    </svg>
                    SPECIAL
                  </div>
                  <div className="px-1 py-0.5">
                    <div className="flex items-center gap-2 px-2 py-1 rounded text-[10px] font-medium text-slate-700 hover:bg-slate-50 cursor-pointer">
                      <svg className="w-4 h-4 text-blue-500 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                        <circle cx="12" cy="12" r="10" />
                        <line x1="12" y1="16" x2="12" y2="12" />
                        <line x1="12" y1="8" x2="12.01" y2="8" />
                      </svg>
                      Information Page
                    </div>
                  </div>

                </div>
              </div>
            </div>
          </div>

          {/* Active Question Cards exactly as per screenshot */}
          <div className="flex-1 flex flex-col gap-3 min-h-0">
            {initialQs.map((q, idx) => (
              <div key={idx} className="p-3 border border-slate-200/80 rounded-xl bg-white shadow-card flex items-start gap-3 transition-all shrink-0">
                <span className="h-5 w-5 rounded bg-blue-900 text-white text-[10px] font-bold flex items-center justify-center shrink-0">
                  {q.num}
                </span>
                <div className="flex-1 min-w-0">
                  <div className="flex items-center gap-2 mb-1">
                    <span className="text-[11px] font-bold text-slate-800 truncate">{q.name}</span>
                    <span className="text-[8px] font-medium text-slate-400 bg-slate-100 border border-slate-200/50 px-1 py-0.2 rounded-sm truncate">{q.bench}</span>
                    <span className="text-[7.5px] font-bold bg-rose-500 text-white px-1 py-0.2 rounded-sm select-none shrink-0 uppercase tracking-wider">Required</span>
                  </div>
                  <div className="text-[11px] text-slate-600 font-medium leading-snug">{q.title}</div>
                  {q.mock}
                </div>
              </div>
            ))}

            {/* Q5 - Added dynamically */}
            <div
              className={`p-3 border rounded-xl bg-emerald-50/30 border-emerald-200 shadow-card flex items-start gap-3 shrink-0 transition-all duration-700 origin-bottom ${isQuestionAdded ? 'opacity-100 translate-y-0 scale-100' : 'opacity-0 translate-y-6 scale-95 h-0 overflow-hidden py-0 border-transparent'}`}
            >
              <span className="h-5 w-5 rounded bg-emerald-700 text-white text-[10px] font-bold flex items-center justify-center shrink-0">
                5
              </span>
              <div className="flex-1 min-w-0">
                <div className="flex items-center gap-2 mb-1">
                  <span className="text-[11px] font-bold text-emerald-950">Joining Date</span>
                  <span className="text-[8px] font-medium text-emerald-700 bg-emerald-100 border border-emerald-200/50 px-1 py-0.2 rounded-sm truncate">DateQuestion</span>
                  <span className="text-[7.5px] font-bold bg-rose-500 text-white px-1 py-0.2 rounded-sm select-none shrink-0 uppercase tracking-wider">Required</span>
                </div>
                <div className="text-[11px] text-slate-600 font-medium leading-snug">When did you join the patching team? *</div>
                <div className="mt-2.5 flex items-center justify-between border border-emerald-100 bg-white/90 rounded px-2.5 py-1 text-[9px] text-slate-400 max-w-[150px] shadow-sm">
                  <span>DD / MM / YYYY</span>
                  <svg className="w-3.5 h-3.5 text-emerald-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
                    <rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
                    <line x1="16" y1="2" x2="16" y2="6" />
                    <line x1="8" y1="2" x2="8" y2="6" />
                    <line x1="3" y1="10" x2="21" y2="10" />
                  </svg>
                </div>
              </div>
            </div>
          </div>
        </div>

        {/* Visual Mouse Cursor */}
        <div
          className="absolute pointer-events-none z-50 select-none w-5 h-5 -ml-1 -mt-1"
          style={{
            left: `${cursorX}%`,
            top: `${cursorY}%`,
            transition: 'none',
          }}
        >
          <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M4.5 3V19.5L9.75 14.25H18.75L4.5 3Z"
              fill={isHoveredDate || isHoveredAdd ? "#f8fafc" : "white"}
              stroke="#0f172a"
              strokeWidth="2.5"
              strokeLinejoin="round"
            />
          </svg>
        </div>

        {/* Click Ripple Indicator */}
        {showRipple && (
          <span
            className="absolute pointer-events-none border-2 border-blue-500 rounded-full animate-ping z-40 w-8 h-8 -ml-4 -mt-4"
            style={{
              left: `${rippleX}%`,
              top: `${rippleY}%`,
              transition: 'none',
            }}
          />
        )}

      </div>
    </FSFrame>
  );
}

