/* Product scenes — photo-realistic SVG illustrations.
   Each scene: industrial product with material textures, lighting, shadows,
   and a believable defect. bbox is in % of the camera viewport. */

const PRODUCT_SCENES = [
  /* ──────────────────────────────────────────────────────────────────────
     1. PCB — green FR4 with realistic solder bridge between IC pins
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'pcb', industry: 'Electronics', name: 'PCB · 4-layer FR4',
    sku: 'PCB-4L-A12', detector: 'pcb-solder-v3',
    defectName: 'solder bridge', defectScore: 0.91,
    defectTag: 'solder-bridge · 0.91', verdict: 'DEFECT',
    bbox: { x: 39, y: 25, w: 9, h: 9 },
    heatmap: { x: 43.5, y: 29.5, intensity: 1 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="pcb-bg" cx="40%" cy="35%" r="85%">
            <stop offset="0%" stopColor="#1e6a3e" />
            <stop offset="50%" stopColor="#0f4326" />
            <stop offset="100%" stopColor="#062013" />
          </radialGradient>
          <radialGradient id="solder-pad" cx="35%" cy="30%" r="70%">
            <stop offset="0%" stopColor="#fff5d8" />
            <stop offset="40%" stopColor="#d4c08a" />
            <stop offset="100%" stopColor="#7a6a3a" />
          </radialGradient>
          <radialGradient id="solder-blob" cx="35%" cy="30%" r="70%">
            <stop offset="0%" stopColor="#ffffff" />
            <stop offset="30%" stopColor="#e8e4d0" />
            <stop offset="70%" stopColor="#a89870" />
            <stop offset="100%" stopColor="#3a3220" />
          </radialGradient>
          <linearGradient id="ic-body" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#3a3a3a" />
            <stop offset="50%" stopColor="#1a1a1a" />
            <stop offset="100%" stopColor="#0a0a0a" />
          </linearGradient>
          <linearGradient id="pin-grad" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#f0f0f0" />
            <stop offset="50%" stopColor="#a8a8a8" />
            <stop offset="100%" stopColor="#5a5a5a" />
          </linearGradient>
          <linearGradient id="cap-cer" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#d8a868" />
            <stop offset="100%" stopColor="#7a5828" />
          </linearGradient>
          <linearGradient id="ind-grad" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stopColor="#3a3a3a" />
            <stop offset="100%" stopColor="#0a0a0a" />
          </linearGradient>
          <radialGradient id="cap-elec" cx="50%" cy="40%" r="70%">
            <stop offset="0%" stopColor="#3a3a5a" />
            <stop offset="60%" stopColor="#15152a" />
            <stop offset="100%" stopColor="#080814" />
          </radialGradient>
          <radialGradient id="cap-tant" cx="35%" cy="30%" r="80%">
            <stop offset="0%" stopColor="#f4d878" />
            <stop offset="50%" stopColor="#c8902a" />
            <stop offset="100%" stopColor="#5a3a08" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#pcb-bg)" />
        {/* PCB substrate weave texture */}
        <g opacity="0.06">
          {Array.from({length: 80}).map((_,i)=>(
            <rect key={'h'+i} x="0" y={i*5} width="600" height="0.6" fill="#fff" />
          ))}
          {Array.from({length: 120}).map((_,i)=>(
            <rect key={'v'+i} x={i*5} y="0" width="0.4" height="380" fill="#000" />
          ))}
        </g>
        {/* solder mask irregularity blobs */}
        {Array.from({length:24}).map((_,i)=>{
          const x = (i*73 + 17) % 600;
          const y = (i*131 + 37) % 380;
          return <ellipse key={i} cx={x} cy={y} rx={4 + (i%4)} ry={3 + (i%3)}
                          fill="#0c5230" opacity="0.35" />;
        })}

        {/* GROUND PLANE FILL — dotted pattern (typical PCB ground hatch) */}
        <g opacity="0.18" fill="#0a3320">
          {Array.from({length: 30}).map((_,r) =>
            Array.from({length: 50}).map((_,c) => (
              <circle key={`g${r}-${c}`} cx={c*12+6} cy={r*12+6} r="1" />
            ))
          )}
        </g>

        {/* Dense copper trace network — multi-layer feel */}
        <g stroke="#c89c5a" strokeWidth="1.6" fill="none" opacity="0.82" strokeLinecap="round">
          {/* horizontal bus traces */}
          <path d="M 20 60 L 200 60 L 218 78 L 420 78 L 438 60 L 580 60" />
          <path d="M 20 72 L 180 72 L 198 90 L 240 90" />
          <path d="M 360 90 L 410 90 L 430 72 L 580 72" />
          <path d="M 20 320 L 220 320 L 240 302 L 360 302 L 380 320 L 580 320" />
          <path d="M 20 332 L 580 332" opacity="0.6" />
          {/* left side fan-out */}
          <path d="M 40 110 L 130 110 L 148 128 L 220 128" />
          <path d="M 40 128 L 110 128 L 128 146 L 220 146" />
          <path d="M 40 146 L 90 146 L 108 164 L 220 164" />
          <path d="M 40 164 L 70 164 L 88 182 L 220 182" />
          <path d="M 40 182 L 60 182 L 78 200 L 220 200" />
          <path d="M 40 200 L 80 200 L 98 218 L 220 218" />
          <path d="M 40 218 L 100 218 L 118 236 L 220 236" />
          <path d="M 40 236 L 120 236 L 138 254 L 220 254" />
          {/* right side fan-out */}
          <path d="M 580 110 L 480 110 L 462 128 L 380 128" />
          <path d="M 580 128 L 500 128 L 482 146 L 380 146" />
          <path d="M 580 146 L 520 146 L 502 164 L 380 164" />
          <path d="M 580 164 L 540 164 L 522 182 L 380 182" />
          <path d="M 580 182 L 560 182 L 542 200 L 380 200" />
          <path d="M 580 200 L 540 200 L 522 218 L 380 218" />
          <path d="M 580 218 L 520 218 L 502 236 L 380 236" />
          <path d="M 580 236 L 480 236 L 462 254 L 380 254" />
          {/* bottom IC fan-out into BGA grid below */}
          <path d="M 250 280 L 250 305 L 280 305" />
          <path d="M 270 280 L 270 295 L 320 295" />
          <path d="M 290 280 L 290 310 L 360 310" />
          <path d="M 310 280 L 310 290 L 380 290" />
          <path d="M 330 280 L 330 305 L 410 305" />
          <path d="M 350 280 L 350 298 L 440 298" />
          {/* serpentine length-matched pair */}
          <path d="M 100 350 L 130 350 L 130 340 L 160 340 L 160 350 L 190 350 L 190 340 L 220 340" strokeWidth="1.2" />
          <path d="M 100 360 L 130 360 L 130 370 L 160 370 L 160 360 L 190 360 L 190 370 L 220 370" strokeWidth="1.2" />
          {/* curved RF traces */}
          <path d="M 470 350 Q 510 340 540 360 Q 560 372 580 365" strokeWidth="1.1" />
          <path d="M 470 360 Q 512 352 540 372 Q 560 380 580 375" strokeWidth="1.1" />
        </g>

        {/* trace shadow micro-offset for depth */}
        <g stroke="#7a5018" strokeWidth="0.5" fill="none" opacity="0.5">
          <path d="M 20 61 L 200 61 L 218 79 L 420 79 L 438 61 L 580 61" />
          <path d="M 40 111 L 130 111 L 148 129 L 220 129" />
          <path d="M 580 111 L 480 111 L 462 129 L 380 129" />
          <path d="M 20 321 L 220 321 L 240 303 L 360 303 L 380 321 L 580 321" />
        </g>

        {/* VIAS — via-tenting pads scattered along traces */}
        {[
          [200,60],[218,78],[420,78],[438,60],[180,72],[410,90],[430,72],
          [148,128],[128,146],[108,164],[88,182],[78,200],[98,218],[118,236],[138,254],
          [462,128],[482,146],[502,164],[522,182],[542,200],[522,218],[502,236],[462,254],
          [240,302],[360,302],[220,320],[380,320],
          [130,340],[160,340],[190,340],[160,370],
          [350,40],[450,40],[150,42],[260,40],
          [60,300],[540,300],[60,180],[540,180]
        ].map((p,i)=>(
          <g key={'via'+i}>
            <circle cx={p[0]} cy={p[1]} r="2.6" fill="#7a5418" />
            <circle cx={p[0]} cy={p[1]} r="1.4" fill="#0a2a18" />
            <circle cx={p[0]-0.5} cy={p[1]-0.5} r="0.6" fill="#fff" opacity="0.4" />
          </g>
        ))}

        {/* MOUNTING HOLES — corners */}
        {[[28,28],[572,28],[28,352],[572,352]].map((p,i)=>(
          <g key={'mnt'+i}>
            <circle cx={p[0]} cy={p[1]} r="9" fill="#7a5418" />
            <circle cx={p[0]} cy={p[1]} r="6" fill="#0a1c10" />
            <circle cx={p[0]-1} cy={p[1]-1} r="2" fill="#fff" opacity="0.25" />
          </g>
        ))}

        {/* MAIN IC — QFP package, dense pin count */}
        <g>
          <rect x="222" y="118" width="160" height="160" rx="3" fill="#000" opacity="0.5" />
          <rect x="220" y="116" width="160" height="160" rx="3" fill="url(#ic-body)" />
          <rect x="220" y="116" width="160" height="2.5" fill="#5a5a5a" />
          <rect x="220" y="116" width="2.5" height="160" fill="#3a3a3a" />
          <rect x="377.5" y="116" width="2.5" height="160" fill="#0a0a0a" />
          <rect x="220" y="273.5" width="160" height="2.5" fill="#0a0a0a" />
          {/* pin-1 dimple */}
          <circle cx="232" cy="128" r="3.5" fill="#0a0a0a" />
          <circle cx="232" cy="128" r="2" fill="#1a1a1a" />
          <text x="300" y="186" textAnchor="middle" fill="#d8d8d8"
                fontFamily="monospace" fontSize="11" fontWeight="700"
                letterSpacing="1.2">VIAI-MCU</text>
          <text x="300" y="200" textAnchor="middle" fill="#888"
                fontFamily="monospace" fontSize="6.5" letterSpacing="0.6">QFP128 · ARMv8</text>
          <text x="300" y="212" textAnchor="middle" fill="#666"
                fontFamily="monospace" fontSize="5.5" letterSpacing="0.4">JTX0-22-A · LOT 2613</text>
          {/* faint datecode mark */}
          <text x="300" y="230" textAnchor="middle" fill="#444"
                fontFamily="monospace" fontSize="4.5" opacity="0.7">26W17·CN</text>
          {/* package surface speckle */}
          {Array.from({length:30}).map((_,i)=>{
            const x = 226 + (i*43)%148;
            const y = 130 + (i*29)%140;
            return <circle key={i} cx={x} cy={y} r="0.4" fill="#fff" opacity="0.06" />;
          })}
        </g>

        {/* QFP pins — 32 per side */}
        {Array.from({length: 32}).map((_,i) => {
          const x = 224 + i * 4.85;
          return (
            <g key={'pt'+i}>
              <rect x={x} y="106" width="3" height="12" fill="url(#pin-grad)" />
              <rect x={x} y="106" width="3" height="1.5" fill="#fff" opacity="0.5" />
              <ellipse cx={x+1.5} cy="106" rx="2.6" ry="1.6" fill="url(#solder-pad)" />
              {/* bottom */}
              <rect x={x} y="276" width="3" height="12" fill="url(#pin-grad)" />
              <rect x={x} y="286" width="3" height="1.5" fill="#fff" opacity="0.4" />
              <ellipse cx={x+1.5} cy="288" rx="2.6" ry="1.6" fill="url(#solder-pad)" />
            </g>
          );
        })}
        {Array.from({length: 32}).map((_,i) => {
          const y = 124 + i * 4.85;
          return (
            <g key={'lr'+i}>
              <rect x="208" y={y} width="12" height="3" fill="url(#pin-grad)" />
              <rect x="208" y={y} width="1.5" height="3" fill="#fff" opacity="0.5" />
              <ellipse cx="208" cy={y+1.5} rx="1.6" ry="2.6" fill="url(#solder-pad)" />
              <rect x="380" y={y} width="12" height="3" fill="url(#pin-grad)" />
              <rect x="390" y={y} width="1.5" height="3" fill="#fff" opacity="0.4" />
              <ellipse cx="392" cy={y+1.5} rx="1.6" ry="2.6" fill="url(#solder-pad)" />
            </g>
          );
        })}

        {/* THE SOLDER BRIDGE DEFECT — between pins 5 & 6 on top edge */}
        <g>
          {/* base shadow */}
          <ellipse cx="251" cy="106" rx="13" ry="4" fill="#000" opacity="0.6" />
          {/* main blob spanning two pins */}
          <ellipse cx="251" cy="103" rx="12" ry="4.5" fill="url(#solder-blob)" />
          {/* metallic specular */}
          <ellipse cx="248" cy="100" rx="5.5" ry="1.4" fill="#fff" opacity="0.85" />
          <ellipse cx="254" cy="102" rx="2" ry="0.7" fill="#fff" opacity="0.6" />
          {/* drip onto pin pad */}
          <ellipse cx="251" cy="111" rx="9" ry="2" fill="#a89870" opacity="0.7" />
          {/* tarnish edge */}
          <ellipse cx="251" cy="103" rx="12" ry="4.5" fill="none"
                   stroke="#c8b878" strokeWidth="0.4" opacity="0.7" />
          {/* tiny solder flux residue around */}
          <circle cx="263" cy="108" r="1" fill="#d8c890" opacity="0.5" />
          <circle cx="241" cy="109" r="0.8" fill="#d8c890" opacity="0.5" />
        </g>

        {/* SECONDARY IC — small SOIC8 package */}
        <g>
          <rect x="58" y="278" width="60" height="34" rx="1.5" fill="#000" opacity="0.5" />
          <rect x="56" y="276" width="60" height="34" rx="1.5" fill="url(#ic-body)" />
          <circle cx="62" cy="282" r="1.6" fill="#0a0a0a" />
          <text x="86" y="297" textAnchor="middle" fill="#aaa"
                fontFamily="monospace" fontSize="6" letterSpacing="0.4">PMIC-22</text>
          {Array.from({length:4}).map((_,i)=>(
            <g key={'soic-l'+i}>
              <rect x="50" y={282+i*7} width="6" height="2.5" fill="url(#pin-grad)" />
              <rect x="116" y={282+i*7} width="6" height="2.5" fill="url(#pin-grad)" />
            </g>
          ))}
        </g>

        {/* THIRD IC — small QFN */}
        <g>
          <rect x="464" y="278" width="56" height="42" rx="2" fill="#000" opacity="0.5" />
          <rect x="462" y="276" width="56" height="42" rx="2" fill="url(#ic-body)" />
          <circle cx="468" cy="282" r="1.6" fill="#0a0a0a" />
          <text x="490" y="299" textAnchor="middle" fill="#aaa"
                fontFamily="monospace" fontSize="5.5" letterSpacing="0.4">USB-PD</text>
          <text x="490" y="307" textAnchor="middle" fill="#666"
                fontFamily="monospace" fontSize="4.5">CC1-22</text>
          {Array.from({length:6}).map((_,i)=>(
            <g key={'qfn-h'+i}>
              <rect x={466+i*8} y="272" width="3" height="4" fill="url(#pin-grad)" />
              <rect x={466+i*8} y="320" width="3" height="4" fill="url(#pin-grad)" />
            </g>
          ))}
        </g>

        {/* SMD PASSIVES — dense scatter of resistors and ceramic caps */}
        {[
          // [x, y, w, h, color, label]
          [62, 100, 14, 7, '#1a1a1a', '10K'],
          [82, 100, 14, 7, '#1a1a1a', '4K7'],
          [102, 100, 14, 7, '#1a1a1a', '1K2'],
          [62, 116, 10, 5, '#5a3010', ''], // 0402 cap
          [78, 116, 10, 5, '#5a3010', ''],
          [94, 116, 10, 5, '#5a3010', ''],
          [110, 116, 10, 5, '#5a3010', ''],
          [126, 116, 10, 5, '#5a3010', ''],
          [142, 116, 10, 5, '#5a3010', ''],
          [62, 252, 14, 7, '#1a1a1a', '47K'],
          [82, 252, 14, 7, '#1a1a1a', '100'],
          [102, 252, 14, 7, '#1a1a1a', '22K'],
          [122, 252, 14, 7, '#1a1a1a', '4R7'],
          [488, 100, 14, 7, '#1a1a1a', '0R0'],
          [468, 100, 14, 7, '#1a1a1a', '10K'],
          [448, 100, 14, 7, '#5a3010', ''],
          [488, 116, 10, 5, '#5a3010', ''],
          [504, 116, 10, 5, '#5a3010', ''],
          [520, 116, 10, 5, '#5a3010', ''],
          [488, 252, 14, 7, '#1a1a1a', '2K2'],
          [468, 252, 14, 7, '#1a1a1a', '15K'],
          [448, 252, 14, 7, '#1a1a1a', '6K8'],
          [428, 252, 14, 7, '#5a3010', ''],
          [240, 100, 14, 5, '#5a3010', ''],
          [258, 100, 14, 5, '#5a3010', ''],
          [276, 100, 14, 5, '#5a3010', ''],
          [332, 100, 14, 5, '#5a3010', ''],
          [350, 100, 14, 5, '#5a3010', ''],
          [240, 290, 14, 5, '#5a3010', ''],
          [258, 290, 14, 5, '#5a3010', ''],
          [330, 290, 14, 5, '#5a3010', ''],
          [350, 290, 14, 5, '#5a3010', ''],
          [62, 60, 14, 7, '#1a1a1a', '22R'],
          [488, 60, 14, 7, '#1a1a1a', '22R'],
        ].map((p,i)=>{
          const [x,y,w,h,c,l] = p;
          return (
            <g key={'pas'+i}>
              <rect x={x} y={y+1} width={w} height={h} fill="#000" opacity="0.5" />
              <rect x={x} y={y} width={w} height={h} fill={c} rx="0.4" />
              <rect x={x} y={y} width={Math.max(2, w*0.18)} height={h} fill="#bcbcbc" />
              <rect x={x+w-Math.max(2, w*0.18)} y={y} width={Math.max(2, w*0.18)} height={h} fill="#bcbcbc" />
              <rect x={x} y={y} width={w} height={h*0.3} fill="#fff" opacity="0.18" />
              {l && <text x={x+w/2} y={y+h-1.5} textAnchor="middle" fill="#fff"
                          fontFamily="monospace" fontSize="3" opacity="0.75">{l}</text>}
            </g>
          );
        })}

        {/* ELECTROLYTIC CAPS — large cylindrical */}
        {[[88, 55, 16], [512, 55, 16]].map((p,i)=>{
          const [cx,cy,r] = p;
          return (
            <g key={'el'+i}>
              <ellipse cx={cx+1} cy={cy+r+1} rx={r} ry="3" fill="#000" opacity="0.5" />
              <circle cx={cx} cy={cy} r={r} fill="url(#cap-elec)" />
              <circle cx={cx} cy={cy} r={r} fill="none" stroke="#0a0a1a" strokeWidth="0.8" />
              <circle cx={cx} cy={cy} r={r*0.78} fill="#0a0a1a" />
              <circle cx={cx} cy={cy} r={r*0.78} fill="none" stroke="#3a3a5a" strokeWidth="0.4" />
              {/* pressure relief X */}
              <path d={`M ${cx-r*0.6} ${cy} L ${cx+r*0.6} ${cy}
                        M ${cx} ${cy-r*0.6} L ${cx} ${cy+r*0.6}`}
                    stroke="#3a3a5a" strokeWidth="0.5" />
              <text x={cx} y={cy+1} textAnchor="middle" fill="#a8a8c8"
                    fontFamily="monospace" fontSize="3.5" fontWeight="700">100µF</text>
              <text x={cx} y={cy+5} textAnchor="middle" fill="#a8a8c8"
                    fontFamily="monospace" fontSize="2.8">25V</text>
              {/* highlight stripe (silver band) */}
              <path d={`M ${cx-r*0.4} ${cy-r*0.95} A ${r} ${r} 0 0 1 ${cx+r*0.4} ${cy-r*0.95}`}
                    stroke="#fff" strokeWidth="2.5" fill="none" opacity="0.25" />
            </g>
          );
        })}

        {/* TANTALUM CAPS — yellow polarized rectangles */}
        {[[160, 350], [440, 350]].map((p,i)=>{
          const [x,y] = p;
          return (
            <g key={'tnt'+i}>
              <rect x={x+1} y={y+1} width="20" height="11" fill="#000" opacity="0.5" />
              <rect x={x} y={y} width="20" height="11" fill="url(#cap-tant)" rx="0.6" />
              <rect x={x} y={y} width="6" height="11" fill="#3a2808" opacity="0.6" />
              <rect x={x} y={y} width="20" height="3" fill="#fff" opacity="0.3" />
              <text x={x+13} y={y+8} textAnchor="middle" fill="#3a1a08"
                    fontFamily="monospace" fontSize="4.5" fontWeight="700">10µF</text>
            </g>
          );
        })}

        {/* INDUCTORS — square ferrite-core SMD */}
        {[[300, 56], [142, 304], [424, 304]].map((p,i)=>{
          const [cx,cy] = p;
          return (
            <g key={'ind'+i}>
              <rect x={cx-9} y={cy-7} width="18" height="14" fill="#000" opacity="0.5" />
              <rect x={cx-10} y={cy-8} width="20" height="16" fill="url(#ind-grad)" rx="1.5" />
              {/* visible copper wire underside */}
              <rect x={cx-10} y={cy-2} width="20" height="3" fill="#a86028" opacity="0.7" />
              <rect x={cx-10} y={cy+1} width="20" height="0.5" fill="#000" opacity="0.6" />
              <text x={cx} y={cy+0.5} textAnchor="middle" fill="#fff"
                    fontFamily="monospace" fontSize="4" opacity="0.5">2R2</text>
              <text x={cx} y={cy+5} textAnchor="middle" fill="#fff"
                    fontFamily="monospace" fontSize="3" opacity="0.4">3A</text>
              <rect x={cx-10} y={cy-8} width="20" height="2" fill="#fff" opacity="0.18" />
            </g>
          );
        })}

        {/* CRYSTAL OSCILLATOR — silver can */}
        <g>
          <rect x="416" y="46" width="44" height="20" fill="#000" opacity="0.5" />
          <rect x="414" y="44" width="44" height="20" rx="2.5" fill="#c8c8d0" />
          <rect x="414" y="44" width="44" height="6" fill="#fff" opacity="0.45" />
          <rect x="414" y="58" width="44" height="6" fill="#000" opacity="0.25" />
          <rect x="414" y="44" width="44" height="20" rx="2.5"
                fill="none" stroke="#5a5a62" strokeWidth="0.6" />
          <text x="436" y="55" textAnchor="middle" fill="#3a3a42"
                fontFamily="monospace" fontSize="6" fontWeight="700">25.000</text>
          <text x="436" y="61" textAnchor="middle" fill="#3a3a42"
                fontFamily="monospace" fontSize="3.5">MHz</text>
        </g>

        {/* CONNECTOR — USB-C right edge */}
        <g>
          <rect x="540" y="160" width="38" height="60" fill="#000" opacity="0.5" />
          <rect x="538" y="158" width="38" height="60" rx="3" fill="#1a1a1a" />
          <rect x="538" y="158" width="38" height="3" fill="#5a5a5a" />
          <rect x="544" y="170" width="26" height="36" rx="3" fill="#0a0a0a" />
          <rect x="546" y="172" width="22" height="3" fill="#888" />
          <rect x="546" y="201" width="22" height="3" fill="#888" />
          {/* shield tabs */}
          <rect x="538" y="166" width="3" height="6" fill="url(#pin-grad)" />
          <rect x="538" y="206" width="3" height="6" fill="url(#pin-grad)" />
          <rect x="573" y="166" width="3" height="6" fill="url(#pin-grad)" />
          <rect x="573" y="206" width="3" height="6" fill="url(#pin-grad)" />
        </g>

        {/* CONNECTOR — pin header left edge */}
        <g>
          <rect x="2" y="180" width="22" height="44" fill="#000" opacity="0.5" />
          <rect x="0" y="178" width="22" height="44" fill="#1a1a1a" />
          {Array.from({length:6}).map((_,i)=>(
            <g key={'hdr'+i}>
              <rect x="6" y={184+i*6.5} width="10" height="3" fill="url(#pin-grad)" />
              <rect x="6" y={184+i*6.5} width="10" height="0.7" fill="#fff" opacity="0.5" />
            </g>
          ))}
          <text x="11" y="234" textAnchor="middle" fill="#a8d8a8"
                fontFamily="monospace" fontSize="4">J1</text>
        </g>

        {/* test point pads */}
        {[[170, 70, 'TP1'],[200, 70, 'TP2'],[400, 70, 'TP3'],[430, 70, 'TP4'],
          [170, 318, 'TP5'],[430, 318, 'TP6']].map((p,i)=>(
          <g key={'tp'+i}>
            <circle cx={p[0]} cy={p[1]} r="3.5" fill="url(#solder-pad)" />
            <circle cx={p[0]} cy={p[1]} r="1.5" fill="#0a2a18" />
            <text x={p[0]} y={p[1]+9} textAnchor="middle" fill="#a8d8a8"
                  fontFamily="monospace" fontSize="3.5">{p[2]}</text>
          </g>
        ))}

        {/* LEDs */}
        {[[270, 332, '#a8ff60'],[310, 332, '#ffa860']].map((p,i)=>(
          <g key={'led'+i}>
            <rect x={p[0]-5} y={p[1]} width="10" height="5" fill={p[2]} opacity="0.5" />
            <rect x={p[0]-5} y={p[1]} width="10" height="5" fill="#fff" opacity="0.4" />
            <rect x={p[0]-5} y={p[1]} width="10" height="5" fill="none" stroke="#222" strokeWidth="0.4" />
          </g>
        ))}

        {/* SILKSCREEN — component refs and labels */}
        <g fill="#e8f0e0" fontFamily="monospace" opacity="0.78">
          <text x="220" y="113" fontSize="6">U1</text>
          <text x="56" y="273" fontSize="5">U2</text>
          <text x="462" y="273" fontSize="5">U3</text>
          <text x="408" y="42" fontSize="4">Y1</text>
          <text x="78" y="32" fontSize="4">C1</text>
          <text x="502" y="32" fontSize="4">C2</text>
          <text x="290" y="50" fontSize="4">L1</text>
          <text x="132" y="298" fontSize="4">L2</text>
          <text x="414" y="298" fontSize="4">L3</text>
          <text x="155" y="346" fontSize="4">CT1</text>
          <text x="435" y="346" fontSize="4">CT2</text>
          <text x="540" y="156" fontSize="5">J2</text>
          <text x="263" y="328" fontSize="3.5">PWR</text>
          <text x="303" y="328" fontSize="3.5">ACT</text>
          {/* trace direction marks */}
          <text x="100" y="56" fontSize="3" opacity="0.7">VBUS</text>
          <text x="486" y="56" fontSize="3" opacity="0.7">3V3</text>
          <text x="248" y="58" fontSize="3" opacity="0.7">CLK</text>
          <text x="338" y="58" fontSize="3" opacity="0.7">RST</text>
        </g>

        {/* board edge silkscreen */}
        <text x="40" y="20" fill="#e8f0e0" fontFamily="monospace" fontSize="9"
              opacity="0.85" letterSpacing="1">VIAI · MAINBOARD REV 1.4</text>
        <text x="430" y="20" fill="#e8f0e0" fontFamily="monospace" fontSize="9"
              opacity="0.85" letterSpacing="1">JTX-0421-A</text>
        <text x="40" y="375" fill="#e8f0e0" fontFamily="monospace" fontSize="6"
              opacity="0.7" letterSpacing="0.6">© 2026 VIAI · ASSEMBLED IN TW · ROHS</text>

        {/* board edge highlight */}
        <rect x="0" y="0" width="600" height="380" fill="none"
              stroke="#1a4a2a" strokeWidth="2" opacity="0.6" />
        <rect x="0" y="0" width="600" height="2" fill="#fff" opacity="0.12" />
        <rect x="0" y="378" width="600" height="2" fill="#000" opacity="0.5" />

        {/* macro lens vignette */}
        <radialGradient id="pcb-vig" cx="50%" cy="50%" r="75%">
          <stop offset="60%" stopColor="#000" stopOpacity="0" />
          <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
        </radialGradient>
        <rect width="600" height="380" fill="url(#pcb-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     2. BEARING — steel ball bearing with realistic scratch
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'bearing', industry: 'Automotive', name: 'Steel ball bearing · 6204-2RS',
    sku: 'BRG-6204', detector: 'bearing-surface-v2',
    defectName: 'surface scratch', defectScore: 0.87,
    defectTag: 'scratch · 0.87', verdict: 'DEFECT',
    bbox: { x: 61, y: 13, w: 14, h: 35 },
    heatmap: { x: 68, y: 30, intensity: 0.9 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="brg-bg" cx="35%" cy="20%" r="100%">
            <stop offset="0%" stopColor="#4a4d54" />
            <stop offset="50%" stopColor="#1a1d22" />
            <stop offset="100%" stopColor="#050608" />
          </radialGradient>
          <radialGradient id="outer-race" cx="35%" cy="25%" r="90%">
            <stop offset="0%" stopColor="#fcfcfe" />
            <stop offset="18%" stopColor="#d8dbdf" />
            <stop offset="45%" stopColor="#8a8d92" />
            <stop offset="75%" stopColor="#3a3d42" />
            <stop offset="92%" stopColor="#15171b" />
            <stop offset="100%" stopColor="#050608" />
          </radialGradient>
          <radialGradient id="outer-race-rim" cx="35%" cy="20%" r="100%">
            <stop offset="0%" stopColor="#9a9da4" />
            <stop offset="60%" stopColor="#3a3d42" />
            <stop offset="100%" stopColor="#0a0c10" />
          </radialGradient>
          <radialGradient id="inner-race" cx="40%" cy="30%" r="80%">
            <stop offset="0%" stopColor="#a8acb2" />
            <stop offset="55%" stopColor="#4a4d52" />
            <stop offset="100%" stopColor="#0a0c10" />
          </radialGradient>
          <radialGradient id="ball" cx="32%" cy="28%" r="72%">
            <stop offset="0%" stopColor="#ffffff" />
            <stop offset="20%" stopColor="#e4e8ec" />
            <stop offset="55%" stopColor="#7a7d82" />
            <stop offset="85%" stopColor="#1a1d22" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="cage-grad" cx="35%" cy="25%" r="80%">
            <stop offset="0" stopColor="#d8a058" />
            <stop offset="60%" stopColor="#7a4818" />
            <stop offset="100%" stopColor="#2a1808" />
          </radialGradient>
          <linearGradient id="oil-sheen" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0%" stopColor="#88aaff" stopOpacity="0.12" />
            <stop offset="50%" stopColor="#ff88cc" stopOpacity="0.08" />
            <stop offset="100%" stopColor="#88ffaa" stopOpacity="0.10" />
          </linearGradient>
        </defs>
        <rect width="600" height="380" fill="url(#brg-bg)" />

        {/* inspection mat surface — dark rubber with grain */}
        <g opacity="0.4">
          {Array.from({length: 80}).map((_,i) => (
            <circle key={i} cx={(i*37+13)%600} cy={(i*61+7)%380}
                    r={0.4 + (i%3)*0.3} fill="#fff" opacity="0.04" />
          ))}
        </g>
        {/* graduation marks (calipers/measuring grid faint background) */}
        <g stroke="#fff" strokeWidth="0.4" opacity="0.10">
          {Array.from({length: 12}).map((_,i) => (
            <g key={i}>
              <line x1="20" y1={20+i*30} x2="40" y2={20+i*30} />
              <line x1={20+i*60} y1="20" x2={20+i*60} y2="40" />
            </g>
          ))}
          <text x="44" y="24" fill="#fff" fontFamily="monospace" fontSize="6"
                opacity="0.45">0</text>
          <text x="44" y="84" fill="#fff" fontFamily="monospace" fontSize="6"
                opacity="0.45">20</text>
          <text x="44" y="144" fill="#fff" fontFamily="monospace" fontSize="6"
                opacity="0.45">40</text>
        </g>

        {/* hard ground shadow */}
        <ellipse cx="306" cy="350" rx="195" ry="14" fill="#000" opacity="0.85" />
        <ellipse cx="306" cy="354" rx="180" ry="8" fill="#000" opacity="0.6" />

        {/* outer race rim shadow */}
        <circle cx="300" cy="190" r="166" fill="#000" opacity="0.55" />

        {/* OUTER RACE */}
        <circle cx="300" cy="190" r="160" fill="url(#outer-race)" />
        <circle cx="300" cy="190" r="160" fill="url(#oil-sheen)" />

        {/* outer race inner edge bevel */}
        <circle cx="300" cy="190" r="160" fill="none" stroke="#0a0c10" strokeWidth="2" opacity="0.7" />
        <circle cx="300" cy="190" r="158" fill="none" stroke="#fff" strokeWidth="0.5" opacity="0.4" />

        {/* outer race groove (where balls sit) — deeper inset */}
        <circle cx="300" cy="190" r="138" fill="none" stroke="#1a1d22" strokeWidth="3" opacity="0.85" />
        <circle cx="300" cy="190" r="138" fill="none" stroke="#fff" strokeWidth="0.5" opacity="0.35" />
        <circle cx="300" cy="190" r="135" fill="none" stroke="#0a0c10" strokeWidth="1" />

        {/* fine machining circular grooves */}
        <g fill="none" stroke="#fff" strokeWidth="0.25" opacity="0.18">
          {Array.from({length: 28}).map((_, i) => (
            <circle key={i} cx="300" cy="190" r={102 + i * 2.2} />
          ))}
        </g>
        <g fill="none" stroke="#000" strokeWidth="0.2" opacity="0.35">
          {Array.from({length: 28}).map((_, i) => (
            <circle key={i} cx="300" cy="190" r={103 + i * 2.2} />
          ))}
        </g>

        {/* light wear/scuff patches on outer race */}
        <g opacity="0.55">
          <ellipse cx="160" cy="140" rx="32" ry="12" fill="#fff" opacity="0.18"
                   transform="rotate(-30 160 140)" />
          <ellipse cx="220" cy="280" rx="40" ry="10" fill="#000" opacity="0.32"
                   transform="rotate(40 220 280)" />
          <ellipse cx="430" cy="280" rx="28" ry="8" fill="#000" opacity="0.28"
                   transform="rotate(-35 430 280)" />
        </g>

        {/* INNER RACE WELL */}
        <circle cx="300" cy="190" r="80" fill="url(#inner-race)" />
        {/* inner race rim */}
        <circle cx="300" cy="190" r="80" fill="none" stroke="#0a0c10" strokeWidth="1.5" />
        <circle cx="300" cy="190" r="78" fill="none" stroke="#fff" strokeWidth="0.4" opacity="0.4" />
        {/* inner race ball groove */}
        <circle cx="300" cy="190" r="68" fill="none" stroke="#1a1d22" strokeWidth="2" opacity="0.7" />
        <circle cx="300" cy="190" r="68" fill="none" stroke="#fff" strokeWidth="0.3" opacity="0.3" />
        {/* center bore — through-shaft hole */}
        <circle cx="300" cy="190" r="56" fill="#000" />
        <circle cx="300" cy="190" r="56" fill="none" stroke="#1a1d22" strokeWidth="1.5" />
        <circle cx="300" cy="190" r="54" fill="none" stroke="#fff" strokeWidth="0.4" opacity="0.5" />
        {/* faint depth glow inside bore */}
        <circle cx="296" cy="186" r="40" fill="#3a3d42" opacity="0.3" />

        {/* BRASS RETAINER CAGE — visible bridge segments between balls */}
        {Array.from({length: 8}).map((_, i) => {
          const a = (i / 8) * Math.PI * 2 - Math.PI / 2;
          const a2 = a + Math.PI / 8;
          const cx = 300 + Math.cos(a2) * 108;
          const cy = 190 + Math.sin(a2) * 108;
          return (
            <g key={'cage'+i}>
              <ellipse cx={cx + 0.5} cy={cy + 0.5} rx="9" ry="6"
                       fill="#000" opacity="0.55"
                       transform={`rotate(${a2*180/Math.PI+90} ${cx} ${cy})`} />
              <ellipse cx={cx} cy={cy} rx="9" ry="6"
                       fill="url(#cage-grad)"
                       transform={`rotate(${a2*180/Math.PI+90} ${cx} ${cy})`} />
              <ellipse cx={cx} cy={cy} rx="9" ry="6"
                       fill="none" stroke="#1a0c04" strokeWidth="0.5"
                       transform={`rotate(${a2*180/Math.PI+90} ${cx} ${cy})`} />
              <circle cx={cx} cy={cy} r="1.3" fill="#0a0c10" />
            </g>
          );
        })}

        {/* steel balls visible in cage — bigger, more reflective */}
        {Array.from({length: 8}).map((_, i) => {
          const a = (i / 8) * Math.PI * 2 - Math.PI / 2;
          const r = 108;
          const cx = 300 + Math.cos(a) * r;
          const cy = 190 + Math.sin(a) * r;
          return (
            <g key={i}>
              {/* contact shadow */}
              <ellipse cx={cx} cy={cy + 2} rx="14" ry="3.5" fill="#000" opacity="0.7" />
              {/* ball */}
              <circle cx={cx} cy={cy} r="14" fill="url(#ball)" />
              {/* reflection of overhead light */}
              <circle cx={cx - 4} cy={cy - 5} r="3.2" fill="#fff" opacity="0.95" />
              <circle cx={cx + 5} cy={cy + 4} r="1.4" fill="#fff" opacity="0.55" />
              {/* environment ring reflection */}
              <ellipse cx={cx} cy={cy + 2} rx="9" ry="2" fill="#5a5d62" opacity="0.45" />
            </g>
          );
        })}

        {/* grease residue at ball-cage contact */}
        {Array.from({length: 8}).map((_, i) => {
          const a = (i / 8) * Math.PI * 2 - Math.PI / 2 + Math.PI / 16;
          const cx = 300 + Math.cos(a) * 108;
          const cy = 190 + Math.sin(a) * 108;
          return (
            <ellipse key={'gr'+i} cx={cx} cy={cy} rx="3" ry="1.2"
                     fill="#d8a058" opacity="0.28" />
          );
        })}

        {/* THE DEFECT — deep gouge across outer race with displaced metal */}
        <g>
          {/* dark gouge channel */}
          <path d="M 376 56 Q 404 84 422 122 Q 436 150 442 174"
                stroke="#0a0c10" strokeWidth="5.5" fill="none"
                strokeLinecap="round" />
          <path d="M 378 58 Q 406 86 424 124 Q 438 152 444 176"
                stroke="#3a2018" strokeWidth="2.2" fill="none"
                strokeLinecap="round" opacity="0.85" />
          {/* highlight on raised lip */}
          <path d="M 374 54 Q 402 82 420 120"
                stroke="#fff" strokeWidth="0.7" fill="none"
                strokeLinecap="round" opacity="0.55" />
          <path d="M 380 60 Q 408 88 426 128 Q 440 156 446 178"
                stroke="#fff" strokeWidth="0.5" fill="none"
                strokeLinecap="round" opacity="0.4" />
          {/* metal chips/flakes near scratch */}
          <circle cx="386" cy="68" r="1.8" fill="#0a0c10" />
          <circle cx="412" cy="110" r="1.5" fill="#0a0c10" />
          <circle cx="430" cy="148" r="1.2" fill="#0a0c10" />
          <circle cx="395" cy="78" r="0.9" fill="#fff" opacity="0.7" />
          <circle cx="418" cy="118" r="0.7" fill="#fff" opacity="0.7" />
          {/* secondary parallel stress crack */}
          <path d="M 394 70 Q 416 96 432 130"
                stroke="#1a1d22" strokeWidth="0.8" fill="none"
                strokeLinecap="round" opacity="0.7" />
        </g>

        {/* ETCHED PART NUMBER on inner race */}
        <text x="300" y="185" textAnchor="middle" fill="#7a7d82"
              fontFamily="monospace" fontSize="11" opacity="0.55"
              letterSpacing="1.5" fontWeight="700">6204-2RS</text>
        <text x="300" y="200" textAnchor="middle" fill="#7a7d82"
              fontFamily="monospace" fontSize="6.5" opacity="0.5"
              letterSpacing="1.2">SKF · MADE IN DE</text>
        <text x="300" y="212" textAnchor="middle" fill="#7a7d82"
              fontFamily="monospace" fontSize="5" opacity="0.4">P/N 9821 · LOT 26B12</text>

        {/* lens vignette */}
        <radialGradient id="brg-vig" cx="50%" cy="50%" r="70%">
          <stop offset="55%" stopColor="#000" stopOpacity="0" />
          <stop offset="100%" stopColor="#000" stopOpacity="0.6" />
        </radialGradient>
        <rect width="600" height="380" fill="url(#brg-vig)" />

        {/* measurement annotation overlay (top-left calipers reading) */}
        <g opacity="0.7">
          <text x="20" y="368" fill="#a8d8a8" fontFamily="monospace" fontSize="8"
                letterSpacing="0.6">⌀ 47.000mm  ID 20.000mm  W 14.000mm</text>
        </g>
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     3. BEVERAGE — bottles on conveyor with low-fill detection
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'beverage', industry: 'Food & Bev', name: 'Glass bottle · 330ml amber',
    sku: 'BTL-330-AMB', detector: 'fill-level-v4',
    defectName: 'low fill level', defectScore: 0.78,
    defectTag: 'fill-low · 78mm short', verdict: 'DEFECT',
    bbox: { x: 43, y: 21, w: 14, h: 18 },
    heatmap: { x: 50, y: 30, intensity: 0.85 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <linearGradient id="bev-bg" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#1a1d24" />
            <stop offset="0.4" stopColor="#0e1014" />
            <stop offset="1" stopColor="#05060a" />
          </linearGradient>
          <radialGradient id="bev-spot" cx="50%" cy="20%" r="80%">
            <stop offset="0%" stopColor="#6a7080" stopOpacity="0.45" />
            <stop offset="55%" stopColor="#2a2d34" stopOpacity="0.15" />
            <stop offset="100%" stopColor="#000" stopOpacity="0" />
          </radialGradient>
          <linearGradient id="conv" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#3a3d42" />
            <stop offset="0.4" stopColor="#252830" />
            <stop offset="1" stopColor="#0e1014" />
          </linearGradient>
          <linearGradient id="conv-rail" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#9a9ea4" />
            <stop offset="0.5" stopColor="#5a5d62" />
            <stop offset="1" stopColor="#1a1d22" />
          </linearGradient>
          <linearGradient id="btl-glass" x1="0" y1="0" x2="1" y2="0">
            <stop offset="0" stopColor="#1a0a02" />
            <stop offset="0.10" stopColor="#3a1808" />
            <stop offset="0.30" stopColor="#7a3818" />
            <stop offset="0.50" stopColor="#9a4820" />
            <stop offset="0.70" stopColor="#7a3818" />
            <stop offset="0.90" stopColor="#3a1808" />
            <stop offset="1" stopColor="#0a0402" />
          </linearGradient>
          <linearGradient id="btl-liquid" x1="0" y1="0" x2="1" y2="0">
            <stop offset="0" stopColor="#2a1004" />
            <stop offset="0.5" stopColor="#a85820" />
            <stop offset="1" stopColor="#1a0802" />
          </linearGradient>
          <linearGradient id="btl-liquid-deep" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#fff" stopOpacity="0.0" />
            <stop offset="1" stopColor="#000" stopOpacity="0.5" />
          </linearGradient>
          <linearGradient id="cap-grad" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#c8ccd2" />
            <stop offset="0.3" stopColor="#7a7d82" />
            <stop offset="0.55" stopColor="#3a3d42" />
            <stop offset="1" stopColor="#15171b" />
          </linearGradient>
          <linearGradient id="cap-emboss" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#d8b048" />
            <stop offset="1" stopColor="#7a5018" />
          </linearGradient>
          <linearGradient id="label-paper" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#f0e0b8" />
            <stop offset="0.5" stopColor="#e0d0a8" />
            <stop offset="1" stopColor="#b8a880" />
          </linearGradient>
          <radialGradient id="bev-vig" cx="50%" cy="50%" r="65%">
            <stop offset="60%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#bev-bg)" />
        <rect width="600" height="380" fill="url(#bev-spot)" />

        {/* factory ceiling — bay lights and trusses far back */}
        <g opacity="0.4">
          <rect x="0" y="0" width="600" height="32" fill="#0a0c10" />
          {/* truss bars */}
          {Array.from({length: 10}).map((_, i) => (
            <line key={i} x1={i*65} y1="0" x2={i*65 + 30} y2="32"
                  stroke="#3a3d42" strokeWidth="1" />
          ))}
          {/* hanging bay lights */}
          {[100, 300, 500].map((x, i) => (
            <g key={i}>
              <line x1={x} y1="0" x2={x} y2="22" stroke="#3a3d42" strokeWidth="1.2" />
              <ellipse cx={x} cy="26" rx="14" ry="4" fill="#fff" opacity="0.7" />
              <ellipse cx={x} cy="28" rx="20" ry="2" fill="#fff" opacity="0.25" />
            </g>
          ))}
        </g>

        {/* far wall — tile pattern */}
        <g opacity="0.5">
          {Array.from({length: 8}).map((_, r) => (
            Array.from({length: 12}).map((_, c) => (
              <rect key={`${r}-${c}`} x={c*52 - 5 + (r%2)*26} y={32 + r*22}
                    width="50" height="20"
                    fill="#1a1d22" stroke="#0e1014" strokeWidth="0.6" />
            ))
          ))}
        </g>
        <rect width="600" height="220" fill="url(#bev-bg)" opacity="0.55" />

        {/* spec fill-line — drawn before bottles so it's behind glass */}
        <g stroke="#80a0c8" strokeWidth="0.7" strokeDasharray="4 3" opacity="0.65">
          <line x1="20" y1="100" x2="580" y2="100" />
        </g>
        <text x="28" y="94" fill="#80a0c8" fontFamily="monospace" fontSize="8.5"
              opacity="0.85" letterSpacing="0.6">SPEC FILL LINE · 78mm FROM CAP · ±2mm</text>
        <text x="540" y="94" fill="#80a0c8" fontFamily="monospace" fontSize="7"
              opacity="0.7" textAnchor="end">REF</text>

        {/* CONVEYOR — deeper construction */}
        {/* steel side rail far */}
        <rect x="0" y="298" width="600" height="6" fill="url(#conv-rail)" opacity="0.85" />
        {/* belt body */}
        <rect x="0" y="304" width="600" height="68" fill="url(#conv)" />
        {/* belt cleats — perspective */}
        {Array.from({length: 24}).map((_, i) => (
          <g key={i}>
            <rect x={i*28 - 4} y="304" width="3" height="68" fill="#0a0c10" opacity="0.85" />
            <rect x={i*28 - 1} y="304" width="1" height="68" fill="#fff" opacity="0.10" />
          </g>
        ))}
        {/* belt seam highlight */}
        <rect x="0" y="306" width="600" height="2" fill="#fff" opacity="0.18" />
        <rect x="0" y="370" width="600" height="2" fill="#000" opacity="0.85" />
        {/* drip pan / front edge */}
        <rect x="0" y="372" width="600" height="8" fill="#1a1d22" />

        {/* condensation puddle on belt */}
        <ellipse cx="300" cy="332" rx="240" ry="6" fill="#88aacc" opacity="0.05" />
        {/* small water droplets on belt */}
        {Array.from({length: 18}).map((_,i) => (
          <ellipse key={i} cx={20+i*32} cy={320+(i%3)*14} rx="1.2" ry="0.6"
                   fill="#aaccee" opacity="0.5" />
        ))}

        {/* THREE BOTTLES — middle one underfilled */}
        {[140, 300, 460].map((cx, i) => {
          const fillTop = i === 1 ? 135 : 100;
          return (
            <g key={cx}>
              {/* deep contact shadow */}
              <ellipse cx={cx} cy="313" rx="42" ry="5.5" fill="#000" opacity="0.85" />
              <ellipse cx={cx} cy="316" rx="36" ry="3" fill="#000" opacity="0.5" />

              {/* BOTTLE BODY */}
              <path d={`
                M ${cx - 14} 38
                L ${cx + 14} 38
                L ${cx + 14} 58
                L ${cx + 18} 64
                Q ${cx + 18} 80 ${cx + 26} 95
                Q ${cx + 34} 115 ${cx + 34} 130
                L ${cx + 34} 295
                Q ${cx + 34} 310 ${cx + 22} 310
                L ${cx - 22} 310
                Q ${cx - 34} 310 ${cx - 34} 295
                L ${cx - 34} 130
                Q ${cx - 34} 115 ${cx - 26} 95
                Q ${cx - 18} 80 ${cx - 18} 64
                L ${cx - 14} 58 Z`}
                fill="url(#btl-glass)" stroke="#0a0402" strokeWidth="1.2" />

              {/* glass interior depth shading */}
              <path d={`
                M ${cx - 30} 130 L ${cx - 30} 295 Q ${cx - 30} 306 ${cx - 22} 306
                L ${cx + 22} 306 Q ${cx + 30} 306 ${cx + 30} 295 L ${cx + 30} 130 Z`}
                fill="#000" opacity="0.25" />

              {/* LIQUID FILL with clip */}
              <clipPath id={`btl-clip-${i}`}>
                <path d={`
                  M ${cx - 32} ${fillTop}
                  L ${cx + 32} ${fillTop}
                  L ${cx + 32} 295
                  Q ${cx + 32} 308 ${cx + 22} 308
                  L ${cx - 22} 308
                  Q ${cx - 32} 308 ${cx - 32} 295 Z`} />
              </clipPath>
              <rect x={cx - 36} y={fillTop} width="72" height="180"
                    fill="url(#btl-liquid)" clipPath={`url(#btl-clip-${i})`} />
              <rect x={cx - 36} y={fillTop} width="72" height="180"
                    fill="url(#btl-liquid-deep)" clipPath={`url(#btl-clip-${i})`} />

              {/* meniscus + foam ring */}
              <ellipse cx={cx} cy={fillTop} rx="32" ry="3.5" fill="#3a1808" opacity="0.85" />
              <ellipse cx={cx} cy={fillTop - 0.5} rx="32" ry="2.8" fill="#e8c890" opacity="0.55" />
              <ellipse cx={cx} cy={fillTop - 1.5} rx="30" ry="1.5" fill="#fff" opacity="0.4" />
              {/* tiny bubbles in foam */}
              {Array.from({length: 9}).map((_, j) => (
                <circle key={j} cx={cx - 24 + j * 6} cy={fillTop - 1 - (j%2)*1.5}
                        r={0.6 + (j%3)*0.3} fill="#fff" opacity="0.6" />
              ))}
              {/* condensation droplets ON glass — only on non-empty section */}
              {Array.from({length: 14}).map((_, j) => {
                const dy = fillTop + 6 + j*15;
                const dx = cx - 28 + ((j*17)%56);
                if (dy > 295) return null;
                return (
                  <g key={j}>
                    <ellipse cx={dx} cy={dy} rx="1.4" ry="2" fill="#fff" opacity="0.35" />
                    <circle cx={dx - 0.4} cy={dy - 0.6} r="0.5" fill="#fff" opacity="0.9" />
                  </g>
                );
              })}

              {/* GLASS HIGHLIGHTS — left specular + right rim */}
              <path d={`M ${cx - 30} 80 Q ${cx - 32} 200 ${cx - 28} 295`}
                    stroke="#fff" strokeWidth="2.5" fill="none" opacity="0.32" />
              <path d={`M ${cx - 28} 100 Q ${cx - 30} 220 ${cx - 26} 290`}
                    stroke="#fff" strokeWidth="0.8" fill="none" opacity="0.55" />
              <path d={`M ${cx + 28} 110 Q ${cx + 30} 220 ${cx + 26} 285`}
                    stroke="#fff" strokeWidth="1" fill="none" opacity="0.25" />
              {/* shoulder highlight */}
              <path d={`M ${cx - 16} 70 Q ${cx - 22} 88 ${cx - 30} 110`}
                    stroke="#fff" strokeWidth="1" fill="none" opacity="0.35" />

              {/* PAPER LABEL — premium look */}
              <rect x={cx - 28} y="178" width="56" height="92" fill="url(#label-paper)"
                    stroke="#5a4020" strokeWidth="0.4" />
              {/* label corners darkened (curving around bottle) */}
              <rect x={cx - 28} y="178" width="6" height="92" fill="#000" opacity="0.18" />
              <rect x={cx + 22} y="178" width="6" height="92" fill="#000" opacity="0.22" />
              {/* top + bottom decorative bars */}
              <rect x={cx - 28} y="178" width="56" height="3.5" fill="#7a2010" />
              <rect x={cx - 28} y="266.5" width="56" height="3.5" fill="#7a2010" />
              <rect x={cx - 28} y="183" width="56" height="0.6" fill="#d8a058" />
              <rect x={cx - 28} y="265" width="56" height="0.6" fill="#d8a058" />
              {/* decorative crest medallion */}
              <circle cx={cx} cy="195" r="6.5" fill="none" stroke="#7a2010" strokeWidth="0.5" />
              <circle cx={cx} cy="195" r="4.5" fill="none" stroke="#7a2010" strokeWidth="0.4" />
              <text x={cx} y="198" textAnchor="middle" fill="#7a2010"
                    fontFamily="serif" fontSize="6" fontWeight="700">★</text>
              {/* brand */}
              <text x={cx} y="218" textAnchor="middle" fill="#3a1808"
                    fontFamily="serif" fontSize="11.5" fontWeight="700"
                    letterSpacing="1.2">CRAFT</text>
              <text x={cx} y="227" textAnchor="middle" fill="#5a3018"
                    fontFamily="serif" fontSize="5" letterSpacing="2.5">— EST 1987 —</text>
              <line x1={cx-18} y1="232" x2={cx+18} y2="232" stroke="#7a2010" strokeWidth="0.3" />
              <text x={cx} y="244" textAnchor="middle" fill="#3a1808"
                    fontFamily="serif" fontSize="7" fontStyle="italic"
                    letterSpacing="0.8">Pale Ale</text>
              <text x={cx} y="254" textAnchor="middle" fill="#5a3018"
                    fontFamily="monospace" fontSize="5.5">5.2% ABV · 330ml</text>
              <text x={cx} y="262" textAnchor="middle" fill="#7a4030"
                    fontFamily="monospace" fontSize="4">L26 · 04·08·26</text>

              {/* CAP — embossed crown */}
              <rect x={cx - 14} y="38" width="28" height="22" fill="url(#cap-grad)" rx="1" />
              {/* crown crinkle teeth — 21 fine ridges */}
              {Array.from({length: 14}).map((_, j) => (
                <g key={j}>
                  <line x1={cx - 14 + j * 2} y1="38" x2={cx - 14 + j * 2} y2="60"
                        stroke="#000" strokeWidth="0.3" opacity="0.65" />
                  <line x1={cx - 13 + j * 2} y1="38" x2={cx - 13 + j * 2} y2="60"
                        stroke="#fff" strokeWidth="0.2" opacity="0.35" />
                </g>
              ))}
              <rect x={cx - 14} y="38" width="28" height="2" fill="#fff" opacity="0.55" />
              <rect x={cx - 14} y="58" width="28" height="2" fill="#000" opacity="0.7" />
              {/* embossed center logo on cap */}
              <circle cx={cx} cy="49" r="5" fill="url(#cap-emboss)" opacity="0.85" />
              <text x={cx} y="52" textAnchor="middle" fill="#3a2008"
                    fontFamily="serif" fontSize="6" fontWeight="700">C</text>

              {/* cap top reflection */}
              <rect x={cx - 12} y="39" width="6" height="1.5" fill="#fff" opacity="0.6" />
            </g>
          );
        })}

        {/* DEFECT — delta arrow on the low bottle */}
        <g>
          <line x1="358" y1="102" x2="358" y2="133"
                stroke="#ea4335" strokeWidth="1.6" />
          <path d="M 354 100 L 358 92 L 362 100 Z" fill="#ea4335" />
          <path d="M 354 135 L 358 143 L 362 135 Z" fill="#ea4335" />
          <rect x="364" y="110" width="48" height="14" fill="#ea4335" opacity="0.95" rx="2" />
          <text x="388" y="120" textAnchor="middle" fill="#fff" fontFamily="monospace"
                fontSize="9" fontWeight="700">−14mm</text>
        </g>

        {/* INSPECTION CAMERA HOUSING — top right peek */}
        <g opacity="0.85">
          <rect x="498" y="0" width="80" height="22" fill="#1a1d22" />
          <rect x="510" y="6" width="56" height="14" fill="#0a0c10" stroke="#3a3d42" strokeWidth="0.5" rx="2" />
          <circle cx="538" cy="13" r="3" fill="#0a0c10" stroke="#5a5d62" strokeWidth="0.5" />
          <circle cx="538" cy="13" r="1.5" fill="#3a3d42" />
          <circle cx="538" cy="13" r="0.8" fill="#88aaff" opacity="0.8" />
          <text x="498" y="18" fill="#5a5d62" fontFamily="monospace" fontSize="5">CAM-04</text>
        </g>

        {/* light strobe ring at top — illumination cone */}
        <g opacity="0.18">
          <path d="M 200 0 L 400 0 L 360 90 L 240 90 Z" fill="url(#bev-spot)" />
        </g>

        <rect width="600" height="380" fill="url(#bev-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     4. PHARMA — blister pack with empty well
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'pharma', industry: 'Pharma', name: 'Blister pack · 10×capsule',
    sku: 'BLI-10-CAP', detector: 'blister-void-v2',
    defectName: 'missing capsule', defectScore: 0.95,
    defectTag: 'void · 0.95', verdict: 'DEFECT',
    bbox: { x: 44, y: 49, w: 12, h: 20 },
    heatmap: { x: 50, y: 59, intensity: 1 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="pharma-bg" cx="50%" cy="40%" r="80%">
            <stop offset="0%" stopColor="#4a4d54" />
            <stop offset="55%" stopColor="#252830" />
            <stop offset="100%" stopColor="#0a0c10" />
          </radialGradient>
          <linearGradient id="foil" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#fafafe" />
            <stop offset="0.25" stopColor="#dde0e6" />
            <stop offset="0.55" stopColor="#aaadb4" />
            <stop offset="0.85" stopColor="#7a7d82" />
            <stop offset="1" stopColor="#3a3d42" />
          </linearGradient>
          <linearGradient id="foil-shine" x1="0" y1="0" x2="1" y2="0">
            <stop offset="0" stopColor="#fff" stopOpacity="0" />
            <stop offset="0.18" stopColor="#fff" stopOpacity="0.45" />
            <stop offset="0.32" stopColor="#fff" stopOpacity="0.05" />
            <stop offset="0.55" stopColor="#88aaff" stopOpacity="0.18" />
            <stop offset="0.78" stopColor="#fff" stopOpacity="0.30" />
            <stop offset="1" stopColor="#fff" stopOpacity="0" />
          </linearGradient>
          <linearGradient id="foil-grain" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#fff" stopOpacity="0.08" />
            <stop offset="0.5" stopColor="#000" stopOpacity="0.06" />
            <stop offset="1" stopColor="#fff" stopOpacity="0.05" />
          </linearGradient>
          <radialGradient id="cap-red" cx="32%" cy="28%" r="75%">
            <stop offset="0" stopColor="#ffaa9a" />
            <stop offset="35%" stopColor="#e85040" />
            <stop offset="75%" stopColor="#9a2018" />
            <stop offset="100%" stopColor="#3a0804" />
          </radialGradient>
          <radialGradient id="cap-cream" cx="32%" cy="28%" r="75%">
            <stop offset="0" stopColor="#fff4d8" />
            <stop offset="40%" stopColor="#dec898" />
            <stop offset="80%" stopColor="#8a6838" />
            <stop offset="100%" stopColor="#2a1a08" />
          </radialGradient>
          <radialGradient id="well-dome" cx="35%" cy="28%" r="75%">
            <stop offset="0" stopColor="#f8f8fc" />
            <stop offset="55%" stopColor="#aaadb2" />
            <stop offset="100%" stopColor="#3a3d42" />
          </radialGradient>
          <radialGradient id="empty-well" cx="40%" cy="32%" r="75%">
            <stop offset="0" stopColor="#5a5d62" />
            <stop offset="35%" stopColor="#252830" />
            <stop offset="80%" stopColor="#0a0c10" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="pharma-vig" cx="50%" cy="50%" r="65%">
            <stop offset="55%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#pharma-bg)" />

        {/* dark inspection mat with fine texture */}
        <g opacity="0.6">
          {Array.from({length: 60}).map((_,i) => (
            <circle key={i} cx={(i*43+13)%600} cy={(i*71+7)%380}
                    r={0.5} fill="#fff" opacity="0.04" />
          ))}
        </g>

        {/* mat grid lines */}
        <g stroke="#fff" strokeWidth="0.3" opacity="0.06">
          {Array.from({length: 13}).map((_,i) => (
            <line key={'v'+i} x1={i*50} y1="0" x2={i*50} y2="380" />
          ))}
          {Array.from({length: 9}).map((_,i) => (
            <line key={'h'+i} x1="0" y1={i*45} x2="600" y2={i*45} />
          ))}
        </g>

        {/* DROP SHADOW — soft + hard */}
        <rect x="84" y="98" width="436" height="222" rx="10" fill="#000" opacity="0.7" />
        <rect x="88" y="104" width="428" height="218" rx="10" fill="#000" opacity="0.4" />

        {/* FOIL BACKING — base */}
        <rect x="80" y="80" width="440" height="220" rx="10" fill="url(#foil)" />
        <rect x="80" y="80" width="440" height="220" rx="10" fill="url(#foil-grain)" />
        <rect x="80" y="80" width="440" height="220" rx="10" fill="url(#foil-shine)" />

        {/* foil edge bevels */}
        <rect x="80" y="80" width="440" height="220" rx="10"
              fill="none" stroke="#fff" strokeWidth="1" opacity="0.55" />
        <rect x="82" y="82" width="436" height="216" rx="9"
              fill="none" stroke="#000" strokeWidth="0.5" opacity="0.4" />

        {/* perforated tear-strip on left side */}
        <g opacity="0.7">
          {Array.from({length: 11}).map((_,i) => (
            <circle key={i} cx="92" cy={92 + i*20} r="1" fill="#5a5d62" />
          ))}
          <line x1="92" y1="84" x2="92" y2="296" stroke="#5a5d62" strokeWidth="0.4" strokeDasharray="1.5 2" opacity="0.7" />
        </g>

        {/* embossed brand strip across top of foil */}
        <text x="300" y="100" textAnchor="middle" fill="#5a5d62"
              fontFamily="monospace" fontSize="8" letterSpacing="3" fontWeight="700">
          AMOXICILLIN · 500mg
        </text>
        <text x="300" y="296" textAnchor="middle" fill="#5a5d62"
              fontFamily="monospace" fontSize="6" letterSpacing="2.5">
          ◆ KEEP DRY · 15–25°C ◆
        </text>

        {/* 5×2 capsule wells */}
        {[0, 1, 2, 3, 4].map(c => [0, 1].map(r => {
          const cx = 132 + c * 84;
          const cy = 152 + r * 72;
          const missing = (c === 2 && r === 1);
          return (
            <g key={`${c}-${r}`}>
              {missing ? (
                <g>
                  {/* deep cratered void */}
                  <ellipse cx={cx + 1.5} cy={cy + 2} rx="30" ry="36"
                           fill="#000" opacity="0.85" />
                  <ellipse cx={cx} cy={cy} rx="29" ry="35" fill="url(#empty-well)" />
                  {/* dark inner */}
                  <ellipse cx={cx} cy={cy + 4} rx="22" ry="28" fill="#0a0c10" />
                  {/* rim of dome (stretched but empty) */}
                  <ellipse cx={cx} cy={cy} rx="29" ry="35" fill="none"
                           stroke="#0a0c10" strokeWidth="1.5" />
                  <ellipse cx={cx} cy={cy} rx="29" ry="35" fill="none"
                           stroke="#fff" strokeWidth="0.5" opacity="0.45" />
                  <ellipse cx={cx - 8} cy={cy - 10} rx="6" ry="9"
                           fill="#fff" opacity="0.10" />
                  {/* powder crumbs at bottom */}
                  <circle cx={cx - 5} cy={cy + 18} r="1.4" fill="#dec898" opacity="0.7" />
                  <circle cx={cx + 7} cy={cy + 14} r="1" fill="#dec898" opacity="0.6" />
                  <circle cx={cx - 9} cy={cy + 10} r="0.6" fill="#dec898" opacity="0.5" />
                  <circle cx={cx + 2} cy={cy + 22} r="0.7" fill="#dec898" opacity="0.5" />
                  {/* white powder dust trail */}
                  {Array.from({length: 8}).map((_,k) => (
                    <circle key={k} cx={cx - 12 + k*3.5} cy={cy + 24 + (k%2)*2}
                            r="0.4" fill="#fff" opacity="0.3" />
                  ))}
                </g>
              ) : (
                <g>
                  {/* dome shadow */}
                  <ellipse cx={cx + 1.5} cy={cy + 2} rx="30" ry="36"
                           fill="#000" opacity="0.55" />
                  {/* well dome (transparent thermoform plastic) */}
                  <ellipse cx={cx} cy={cy} rx="29" ry="35" fill="url(#well-dome)" opacity="0.7" />
                  {/* dome rim */}
                  <ellipse cx={cx} cy={cy} rx="29" ry="35" fill="none"
                           stroke="#3a3d42" strokeWidth="0.7" opacity="0.7" />
                  {/* dome highlight */}
                  <ellipse cx={cx - 9} cy={cy - 14} rx="9" ry="13"
                           fill="#fff" opacity="0.55" />
                  <ellipse cx={cx - 11} cy={cy - 17} rx="3" ry="5"
                           fill="#fff" opacity="0.85" />

                  {/* CAPSULE — two-tone gelatin */}
                  {/* shadow under capsule */}
                  <rect x={cx - 8} y={cy - 24} width="18" height="52" rx="9"
                        fill="#000" opacity="0.45" />
                  {/* red end (top) */}
                  <rect x={cx - 9} y={cy - 26} width="18" height="28" rx="9"
                        fill="url(#cap-red)" />
                  {/* cream end (bottom) */}
                  <rect x={cx - 9} y={cy - 4} width="18" height="30" rx="9"
                        fill="url(#cap-cream)" />
                  {/* overlap join — red wraps over cream */}
                  <rect x={cx - 9} y={cy - 6} width="18" height="5" fill="url(#cap-red)" />
                  <line x1={cx - 9} y1={cy - 1} x2={cx + 9} y2={cy - 1}
                        stroke="#3a0804" strokeWidth="0.5" opacity="0.7" />
                  {/* specular highlights on capsule */}
                  <ellipse cx={cx - 4} cy={cy - 18} rx="2" ry="6.5" fill="#fff" opacity="0.7" />
                  <ellipse cx={cx - 4} cy={cy + 12} rx="2" ry="7" fill="#fff" opacity="0.65" />
                  <ellipse cx={cx + 5} cy={cy + 16} rx="0.8" ry="3" fill="#fff" opacity="0.45" />
                  {/* dose imprint */}
                  <text x={cx} y={cy + 4} textAnchor="middle" fill="#3a0804"
                        fontFamily="monospace" fontSize="3.5" fontWeight="700"
                        opacity="0.85">500</text>
                </g>
              )}
            </g>
          );
        }))}

        {/* DEFECT CALLOUT BADGE — small inline marker on the missing well */}
        <g>
          <line x1="300" y1="252" x2="300" y2="270" stroke="#ea4335" strokeWidth="1.4" />
          <circle cx="300" cy="270" r="3.5" fill="#ea4335" />
          <circle cx="300" cy="270" r="1.3" fill="#fff" />
        </g>

        {/* batch info bar */}
        <rect x="86" y="332" width="428" height="22" rx="3" fill="#1a1d22" opacity="0.85" />
        <text x="92" y="346" fill="#c8ccd2" fontFamily="monospace" fontSize="9"
              letterSpacing="1">LOT 24A917 · MFG 2026-03 · EXP 2028-03 · NDC 50580-449</text>
        <text x="510" y="346" fill="#ea4335" fontFamily="monospace" fontSize="9"
              fontWeight="700" textAnchor="end" letterSpacing="0.8">RX-ONLY</text>

        {/* GS1 datamatrix square */}
        <g transform="translate(450 88)">
          <rect width="32" height="32" fill="#fff" />
          {Array.from({length: 12}).map((_,r) => (
            Array.from({length: 12}).map((_,c) => {
              const on = ((r*c + r + c*3) % 3) === 0 || (r === 0 && c % 2 === 0) || (c === 11 && r % 2 === 0);
              if (!on) return null;
              return <rect key={`${r}-${c}`} x={2 + c*2.4} y={2 + r*2.4}
                           width="2.4" height="2.4" fill="#0a0c10" />;
            })
          ))}
        </g>

        <rect width="600" height="380" fill="url(#pharma-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     5. ALUMINUM CASTING — gas porosity defect
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'casting', industry: 'Metal Fab', name: 'Aluminum casting · pump housing',
    sku: 'CST-AL-9821', detector: 'casting-porosity-v3',
    defectName: 'gas porosity cluster', defectScore: 0.83,
    defectTag: 'porosity · 0.83', verdict: 'DEFECT',
    bbox: { x: 33, y: 46, w: 12, h: 12 },
    heatmap: { x: 39, y: 52, intensity: 0.9 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="cst-bg" cx="50%" cy="20%" r="100%">
            <stop offset="0" stopColor="#3a3d44" />
            <stop offset="50%" stopColor="#15171b" />
            <stop offset="100%" stopColor="#05060a" />
          </radialGradient>
          <linearGradient id="alu" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#f4f6f8" />
            <stop offset="0.20" stopColor="#c4cad0" />
            <stop offset="0.55" stopColor="#7a7e84" />
            <stop offset="0.85" stopColor="#3a3d42" />
            <stop offset="1" stopColor="#1a1d22" />
          </linearGradient>
          <linearGradient id="alu-side" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#5a5d62" />
            <stop offset="0.5" stopColor="#3a3d42" />
            <stop offset="1" stopColor="#1a1d22" />
          </linearGradient>
          <linearGradient id="alu-warm" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#d8b888" stopOpacity="0.18" />
            <stop offset="0.5" stopColor="#a8d8e8" stopOpacity="0.10" />
            <stop offset="1" stopColor="#88aaff" stopOpacity="0.12" />
          </linearGradient>
          <radialGradient id="hole" cx="50%" cy="40%" r="60%">
            <stop offset="0" stopColor="#3a3d42" />
            <stop offset="40%" stopColor="#0a0c10" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="bore" cx="42%" cy="32%" r="80%">
            <stop offset="0" stopColor="#5a5d62" />
            <stop offset="35%" stopColor="#1a1d22" />
            <stop offset="80%" stopColor="#0a0c10" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="bore-machined" cx="40%" cy="40%" r="70%">
            <stop offset="0" stopColor="#dadde2" />
            <stop offset="60%" stopColor="#7a7e84" />
            <stop offset="100%" stopColor="#3a3d42" />
          </radialGradient>
          <radialGradient id="cst-vig" cx="50%" cy="50%" r="65%">
            <stop offset="60%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#cst-bg)" />

        {/* steel inspection bench surface */}
        <rect x="0" y="200" width="600" height="180" fill="#1a1d22" />
        {/* bench grating pattern */}
        <g opacity="0.4">
          {Array.from({length: 24}).map((_,i) => (
            <line key={'v'+i} x1={i*26} y1="200" x2={i*26+30} y2="380"
                  stroke="#000" strokeWidth="1" />
          ))}
          {Array.from({length: 9}).map((_,i) => (
            <line key={'h'+i} x1="0" y1={210+i*22} x2="600" y2={210+i*22}
                  stroke="#0a0c10" strokeWidth="0.8" />
          ))}
        </g>
        <rect x="0" y="200" width="600" height="2" fill="#5a5d62" opacity="0.5" />

        {/* SCALE RULER bottom */}
        <g opacity="0.85">
          <rect x="20" y="354" width="220" height="14" fill="#f4d040" />
          <rect x="20" y="354" width="220" height="14" fill="none" stroke="#1a1d22" strokeWidth="0.6" />
          {Array.from({length: 11}).map((_,i) => (
            <g key={i}>
              <line x1={20 + i*22} y1="354" x2={20 + i*22} y2={i%5===0 ? 366 : 362}
                    stroke="#0a0c10" strokeWidth={i%5===0 ? 0.8 : 0.5} />
              {i%5===0 && (
                <text x={20+i*22} y="376" fill="#0a0c10" fontFamily="monospace"
                      fontSize="6" textAnchor="middle">{i*10}mm</text>
              )}
            </g>
          ))}
        </g>

        {/* DEEP DROP SHADOW — soft + hard */}
        <path d="M 138 96 L 476 96 L 508 144 L 508 296 L 142 300 L 106 248 L 108 140 Z"
              fill="#000" opacity="0.85" />
        <path d="M 142 100 L 472 100 L 502 146 L 502 290 L 146 294 L 112 244 L 112 142 Z"
              fill="#000" opacity="0.5" />

        {/* CASTING BODY — hexagonal pump housing */}
        <path d="M 130 84 L 470 84 L 500 132 L 500 288 L 132 292 L 100 240 L 100 130 Z"
              fill="url(#alu)" stroke="#0a0c10" strokeWidth="1.5" />
        {/* warm tint overlay */}
        <path d="M 130 84 L 470 84 L 500 132 L 500 288 L 132 292 L 100 240 L 100 130 Z"
              fill="url(#alu-warm)" />

        {/* LEFT BEVEL — chamfer face shadow */}
        <path d="M 100 130 L 130 84 L 130 132 Z" fill="url(#alu-side)" opacity="0.85" />
        {/* RIGHT BEVEL — chamfer face shadow */}
        <path d="M 470 84 L 500 132 L 500 132 L 470 132 Z" fill="url(#alu-side)" opacity="0.7" />
        {/* TOP HIGHLIGHT */}
        <path d="M 130 84 L 470 84 L 500 132 L 130 132 Z" fill="#fff" opacity="0.12" />
        <line x1="130" y1="84" x2="470" y2="84" stroke="#fff" strokeWidth="1.2" opacity="0.5" />

        {/* PARTING LINE — horizontal seam from sand mold */}
        <line x1="100" y1="190" x2="500" y2="190" stroke="#000" strokeWidth="0.5" opacity="0.4" />
        <line x1="100" y1="191" x2="500" y2="191" stroke="#fff" strokeWidth="0.3" opacity="0.25" />
        {/* small flash bumps on parting line */}
        {[150, 220, 340, 410, 470].map((x,i) => (
          <ellipse key={i} cx={x} cy="190" rx="3" ry="0.6"
                   fill="#000" opacity="0.5" />
        ))}

        {/* SAND-CAST PEBBLE TEXTURE — fine grain across face */}
        <g opacity="0.55">
          {Array.from({length: 200}).map((_, i) => {
            const x = 110 + (i*37)%380;
            const y = 90 + (i*61)%200;
            return <circle key={i} cx={x} cy={y} r={0.4 + (i%3)*0.25}
                           fill={i%2 ? '#000' : '#fff'} opacity={0.18} />;
          })}
        </g>

        {/* MACHINING SWIRL marks at top — broader */}
        <g stroke="#fff" strokeWidth="0.3" opacity="0.18">
          {Array.from({length: 32}).map((_, i) => (
            <line key={i} x1="118" y1={88 + i * 6} x2="490" y2={92 + i * 6} />
          ))}
        </g>
        <g stroke="#000" strokeWidth="0.2" opacity="0.25">
          {Array.from({length: 32}).map((_, i) => (
            <line key={i} x1="118" y1={90 + i * 6} x2="490" y2={94 + i * 6} />
          ))}
        </g>

        {/* RIBS / structural cross-bracing */}
        <g opacity="0.5">
          <path d="M 100 156 L 500 156" stroke="#000" strokeWidth="1.5" opacity="0.4" />
          <path d="M 100 158 L 500 158" stroke="#fff" strokeWidth="0.5" opacity="0.3" />
          <path d="M 100 224 L 500 224" stroke="#000" strokeWidth="1.5" opacity="0.4" />
          <path d="M 100 226 L 500 226" stroke="#fff" strokeWidth="0.5" opacity="0.3" />
        </g>

        {/* GATING REMNANT — small bump on top edge (where sprue was cut) */}
        <g>
          <ellipse cx="300" cy="84" rx="14" ry="3" fill="#1a1d22" opacity="0.6" />
          <ellipse cx="300" cy="84" rx="14" ry="2" fill="#7a7e84" />
          <ellipse cx="300" cy="83" rx="14" ry="0.8" fill="#fff" opacity="0.5" />
          {/* tiny bevel marks */}
          {Array.from({length: 7}).map((_,i) => (
            <line key={i} x1={290+i*3.3} y1="82" x2={290+i*3.3} y2="86"
                  stroke="#000" strokeWidth="0.3" opacity="0.6" />
          ))}
        </g>

        {/* MOUNTING BOLT-HOLES — 6 of them, more dimensional */}
        {[170, 300, 430].map(cx => (
          <g key={cx}>
            {/* upper row */}
            <ellipse cx={cx + 0.6} cy="121" rx="20" ry="11" fill="#000" opacity="0.7" />
            <ellipse cx={cx} cy="120" rx="20" ry="11" fill="url(#hole)" />
            <ellipse cx={cx} cy="120" rx="20" ry="11" fill="none"
                     stroke="#0a0c10" strokeWidth="0.8" />
            <ellipse cx={cx} cy="118" rx="20" ry="11" fill="none"
                     stroke="#fff" strokeWidth="0.5" opacity="0.55" />
            {/* counterbore inner ring */}
            <ellipse cx={cx} cy="121" rx="14" ry="8" fill="#000" />
            <ellipse cx={cx} cy="121" rx="14" ry="8" fill="none"
                     stroke="#fff" strokeWidth="0.3" opacity="0.4" />
            {/* tap thread highlight */}
            <ellipse cx={cx} cy="121" rx="9" ry="5" fill="#1a1d22" />
            {Array.from({length: 6}).map((_,i) => (
              <ellipse key={i} cx={cx} cy="121" rx={9-i*1.5} ry={5-i*0.8}
                       fill="none" stroke="#fff" strokeWidth="0.2" opacity="0.18" />
            ))}

            {/* lower row */}
            <ellipse cx={cx + 0.6} cy="253" rx="20" ry="11" fill="#000" opacity="0.7" />
            <ellipse cx={cx} cy="252" rx="20" ry="11" fill="url(#hole)" />
            <ellipse cx={cx} cy="252" rx="20" ry="11" fill="none"
                     stroke="#0a0c10" strokeWidth="0.8" />
            <ellipse cx={cx} cy="250" rx="20" ry="11" fill="none"
                     stroke="#fff" strokeWidth="0.5" opacity="0.55" />
            <ellipse cx={cx} cy="253" rx="14" ry="8" fill="#000" />
            <ellipse cx={cx} cy="253" rx="9" ry="5" fill="#1a1d22" />
            {Array.from({length: 6}).map((_,i) => (
              <ellipse key={i} cx={cx} cy="253" rx={9-i*1.5} ry={5-i*0.8}
                       fill="none" stroke="#fff" strokeWidth="0.2" opacity="0.18" />
            ))}
          </g>
        ))}

        {/* CENTER BORE — machined precisely */}
        <ellipse cx="300" cy="187" rx="60" ry="40" fill="#000" opacity="0.85" />
        <ellipse cx="300" cy="186" rx="58" ry="38" fill="url(#bore)" />
        {/* machined bore ring (precision turned) */}
        <ellipse cx="300" cy="186" rx="58" ry="38" fill="none"
                 stroke="#0a0c10" strokeWidth="1.2" />
        <ellipse cx="300" cy="184" rx="58" ry="38" fill="none"
                 stroke="#fff" strokeWidth="0.8" opacity="0.55" />
        <ellipse cx="300" cy="188" rx="58" ry="38" fill="none"
                 stroke="#000" strokeWidth="0.6" opacity="0.5" />
        {/* concentric machining grooves inside bore */}
        <g fill="none" stroke="#5a5d62" strokeWidth="0.3" opacity="0.4">
          {Array.from({length: 6}).map((_,i) => (
            <ellipse key={i} cx="300" cy="188" rx={50-i*7} ry={32-i*5} />
          ))}
        </g>
        {/* keyway slot */}
        <rect x="296" y="146" width="8" height="14" fill="#000" />
        <rect x="296" y="146" width="8" height="14" fill="none"
              stroke="#fff" strokeWidth="0.4" opacity="0.6" />
        <rect x="296" y="146" width="2" height="14" fill="#fff" opacity="0.3" />

        {/* DATUM TARGETS / GD&T marks on body */}
        <g opacity="0.65">
          <g transform="translate(140 175)">
            <circle r="6" fill="none" stroke="#0a0c10" strokeWidth="0.6" />
            <line x1="-6" y1="0" x2="6" y2="0" stroke="#0a0c10" strokeWidth="0.4" />
            <text y="2" textAnchor="middle" fill="#0a0c10" fontFamily="monospace"
                  fontSize="6" fontWeight="700">A1</text>
          </g>
          <g transform="translate(450 215)">
            <circle r="6" fill="none" stroke="#0a0c10" strokeWidth="0.6" />
            <line x1="-6" y1="0" x2="6" y2="0" stroke="#0a0c10" strokeWidth="0.4" />
            <text y="2" textAnchor="middle" fill="#0a0c10" fontFamily="monospace"
                  fontSize="6" fontWeight="700">B2</text>
          </g>
        </g>

        {/* THE DEFECT — porosity cluster (left of bore) — much denser */}
        <g>
          {/* discoloration halo */}
          <ellipse cx="232" cy="200" rx="42" ry="32" fill="#1a1d22" opacity="0.55" />
          <ellipse cx="232" cy="200" rx="34" ry="26" fill="#0a0c10" opacity="0.35" />
          {/* faint gas streak around cluster */}
          <ellipse cx="232" cy="200" rx="48" ry="3" fill="#000" opacity="0.3"
                   transform="rotate(-12 232 200)" />
          {[
            [216, 196, 4.5], [228, 188, 3.0], [240, 200, 4.2], [248, 192, 3.4],
            [220, 208, 3.8], [212, 200, 2.6], [256, 204, 2.8], [232, 212, 4.0],
            [244, 212, 3.2], [262, 196, 2.4], [200, 196, 2.2], [222, 184, 2.4],
            [252, 184, 2.6], [208, 212, 2.8], [236, 178, 1.8], [266, 188, 1.6],
            [196, 204, 1.8], [240, 184, 2.0], [228, 220, 2.2], [216, 220, 1.8]
          ].map(([cx, cy, r], i) => (
            <g key={i}>
              {/* dark void */}
              <ellipse cx={cx + 0.5} cy={cy + 0.7} rx={r * 1.1} ry={r * 0.95}
                       fill="#000" opacity="0.85" />
              <ellipse cx={cx} cy={cy} rx={r} ry={r * 0.85}
                       fill="url(#hole)" />
              {/* highlight ring on rim */}
              <ellipse cx={cx} cy={cy - r*0.6} rx={r*0.85} ry={r*0.18}
                       fill="#fff" opacity="0.25" />
              <ellipse cx={cx - r*0.3} cy={cy - r*0.3} rx={r*0.3} ry={r*0.22}
                       fill="#fff" opacity="0.2" />
            </g>
          ))}
        </g>

        {/* DIE STAMP — embossed part marking */}
        <g>
          <rect x="370" y="266" width="120" height="22" fill="#000" opacity="0.4" rx="1" />
          <text x="380" y="279" fill="#5a5d62" fontFamily="monospace" fontSize="8"
                opacity="0.95" letterSpacing="1.2" fontWeight="700">P/N 9821-04</text>
          <text x="380" y="287" fill="#5a5d62" fontFamily="monospace" fontSize="6"
                opacity="0.85" letterSpacing="1">LOT 26B12 · DIE 03</text>
        </g>

        {/* Foundry stamp — small triangle logo */}
        <g transform="translate(120 268)" opacity="0.7">
          <polygon points="0,0 14,0 7,14" fill="none" stroke="#0a0c10" strokeWidth="0.7" />
          <text x="7" y="9" textAnchor="middle" fill="#0a0c10" fontFamily="monospace"
                fontSize="6" fontWeight="700">F</text>
          <text x="22" y="10" fill="#5a5d62" fontFamily="monospace" fontSize="6"
                letterSpacing="0.5">AlSi9Cu3 · T6</text>
        </g>

        <rect width="600" height="380" fill="url(#cst-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     6. PLASTIC CAPS — flash defect on edge
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'plastic', industry: 'Injection Mold', name: 'Plastic cap · screw-top 28mm',
    sku: 'CAP-INJ-28', detector: 'mold-flash-v1',
    defectName: 'mold flash on rim', defectScore: 0.74,
    defectTag: 'flash · 0.74', verdict: 'DEFECT',
    bbox: { x: 80, y: 32, w: 9, h: 12 },
    heatmap: { x: 84.5, y: 38, intensity: 0.75 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="cap-bg" cx="50%" cy="20%" r="100%">
            <stop offset="0" stopColor="#3a3d42" />
            <stop offset="60%" stopColor="#15171b" />
            <stop offset="100%" stopColor="#05060a" />
          </radialGradient>
          <linearGradient id="cap-tray" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#2a2d32" />
            <stop offset="0.5" stopColor="#1a1d22" />
            <stop offset="1" stopColor="#0a0c10" />
          </linearGradient>
          <radialGradient id="cap-pocket" cx="50%" cy="35%" r="70%">
            <stop offset="0" stopColor="#1a1d22" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="cap-blue" cx="32%" cy="28%" r="80%">
            <stop offset="0" stopColor="#a8d4ff" />
            <stop offset="22%" stopColor="#5a98ff" />
            <stop offset="55%" stopColor="#1e54c8" />
            <stop offset="85%" stopColor="#0a2a78" />
            <stop offset="100%" stopColor="#020c2a" />
          </radialGradient>
          <radialGradient id="cap-blue-recess" cx="40%" cy="40%" r="80%">
            <stop offset="0" stopColor="#5a98ff" />
            <stop offset="55%" stopColor="#1a4ab0" />
            <stop offset="100%" stopColor="#06184a" />
          </radialGradient>
          <linearGradient id="cap-rim-shine" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#fff" stopOpacity="0.5" />
            <stop offset="0.5" stopColor="#fff" stopOpacity="0" />
            <stop offset="1" stopColor="#fff" stopOpacity="0.3" />
          </linearGradient>
          <radialGradient id="cap-vig" cx="50%" cy="50%" r="65%">
            <stop offset="60%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#cap-bg)" />

        {/* fine factory grid background */}
        <g stroke="#fff" strokeWidth="0.3" opacity="0.04">
          {Array.from({length: 13}).map((_,i) => (
            <line key={'v'+i} x1={i*50} y1="0" x2={i*50} y2="380" />
          ))}
          {Array.from({length: 9}).map((_,i) => (
            <line key={'h'+i} x1="0" y1={i*45} x2="600" y2={i*45} />
          ))}
        </g>

        {/* parts TRAY — molded with bevel */}
        <rect x="34" y="74" width="532" height="252" rx="12" fill="#000" opacity="0.7" />
        <rect x="36" y="76" width="528" height="248" rx="10" fill="url(#cap-tray)" />
        {/* tray top highlight + bottom shadow */}
        <rect x="36" y="76" width="528" height="3" fill="#fff" opacity="0.2" />
        <rect x="36" y="321" width="528" height="3" fill="#000" opacity="0.7" />
        <rect x="36" y="76" width="3" height="248" fill="#fff" opacity="0.12" />
        <rect x="561" y="76" width="3" height="248" fill="#000" opacity="0.5" />

        {/* tray pockets — 6 wells where caps sit */}
        {[0, 1, 2].map(c => [0, 1].map(r => {
          const cx = 118 + c * 164;
          const cy = 150 + r * 90;
          return (
            <g key={`pkt-${c}-${r}`}>
              <ellipse cx={cx} cy={cy + 14} rx="58" ry="14"
                       fill="url(#cap-pocket)" opacity="0.85" />
              <ellipse cx={cx} cy={cy + 14} rx="58" ry="14" fill="none"
                       stroke="#0a0c10" strokeWidth="1.2" />
              <ellipse cx={cx} cy={cy + 13} rx="58" ry="14" fill="none"
                       stroke="#fff" strokeWidth="0.4" opacity="0.25" />
            </g>
          );
        }))}

        {/* tray dividers — horizontal rib */}
        <rect x="40" y="200" width="520" height="2" fill="#0a0c10" />
        <rect x="40" y="202" width="520" height="0.6" fill="#fff" opacity="0.15" />
        {/* tray label strip */}
        <rect x="60" y="84" width="120" height="14" fill="#5a5d62" rx="2" />
        <text x="68" y="94" fill="#0a0c10" fontFamily="monospace" fontSize="8"
              fontWeight="700" letterSpacing="1">TRAY · A04 · 28mm</text>
        <rect x="430" y="84" width="100" height="14" fill="#5a5d62" rx="2" />
        <text x="438" y="94" fill="#0a0c10" fontFamily="monospace" fontSize="8"
              fontWeight="700" letterSpacing="1">QC · 04·08·26</text>

        {/* 6 CAPS — far more detailed */}
        {[0, 1, 2].map(c => [0, 1].map(r => {
          const cx = 118 + c * 164;
          const cy = 150 + r * 90;
          const defect = (c === 2 && r === 0);
          return (
            <g key={`${c}-${r}`}>
              {/* deep contact shadow */}
              <ellipse cx={cx + 1} cy={cy + 8} rx="50" ry="11"
                       fill="#000" opacity="0.85" />
              <ellipse cx={cx + 1} cy={cy + 11} rx="42" ry="5"
                       fill="#000" opacity="0.5" />

              {/* OUTER CAP body */}
              <circle cx={cx} cy={cy} r="46" fill="url(#cap-blue)" />
              {/* glossy rim shine ring */}
              <circle cx={cx} cy={cy} r="46" fill="url(#cap-rim-shine)" opacity="0.6" />

              {/* KNURL ring — finer (96 ribs) and 3D */}
              {Array.from({ length: 96 }).map((_, i) => {
                const a = (i / 96) * Math.PI * 2;
                const x1 = cx + Math.cos(a) * 38;
                const y1 = cy + Math.sin(a) * 38;
                const x2 = cx + Math.cos(a) * 46;
                const y2 = cy + Math.sin(a) * 46;
                const top = Math.sin(a) < -0.1;
                return (
                  <line key={i} x1={x1} y1={y1} x2={x2} y2={y2}
                        stroke={top ? "#fff" : "#020c2a"}
                        strokeWidth="0.4" opacity={top ? 0.5 : 0.85} />
                );
              })}
              {/* knurl ring outer line */}
              <circle cx={cx} cy={cy} r="46" fill="none" stroke="#020c2a" strokeWidth="0.8" />
              <circle cx={cx} cy={cy} r="38" fill="none" stroke="#020c2a" strokeWidth="0.6" />
              <circle cx={cx} cy={cy} r="38" fill="none" stroke="#fff" strokeWidth="0.3" opacity="0.35" />

              {/* INNER TOP RECESS — pressed concave */}
              <circle cx={cx} cy={cy} r="34" fill="#000" opacity="0.5" />
              <circle cx={cx} cy={cy} r="33" fill="url(#cap-blue-recess)" />
              <circle cx={cx} cy={cy} r="33" fill="none" stroke="#020c2a" strokeWidth="0.8" />
              <circle cx={cx} cy={cy} r="32" fill="none" stroke="#fff" strokeWidth="0.4" opacity="0.4" />

              {/* concentric pressing rings */}
              <circle cx={cx} cy={cy} r="26" fill="none" stroke="#020c2a" strokeWidth="0.4" opacity="0.6" />
              <circle cx={cx} cy={cy} r="20" fill="none" stroke="#020c2a" strokeWidth="0.4" opacity="0.5" />

              {/* embossed brand circle */}
              <circle cx={cx} cy={cy} r="14" fill="none" stroke="#020c2a" strokeWidth="0.3" opacity="0.7" />

              {/* embossed brand */}
              <text x={cx} y={cy + 4} textAnchor="middle" fill="#020c2a"
                    fontFamily="monospace" fontSize="11" fontWeight="700"
                    opacity="0.85" letterSpacing="1">VIAI</text>
              <text x={cx} y={cy + 4} textAnchor="middle" fill="#fff"
                    fontFamily="monospace" fontSize="11" fontWeight="700"
                    opacity="0.18" letterSpacing="1"
                    transform={`translate(${-0.5} ${-0.5})`}>VIAI</text>

              {/* primary specular highlight */}
              <ellipse cx={cx - 14} cy={cy - 22} rx="16" ry="9"
                       fill="#fff" opacity="0.45" />
              <ellipse cx={cx - 18} cy={cy - 26} rx="6" ry="3"
                       fill="#fff" opacity="0.85" />
              {/* secondary highlight on opposite rim */}
              <ellipse cx={cx + 22} cy={cy + 18} rx="10" ry="4"
                       fill="#fff" opacity="0.18" />

              {/* injection-mold gate mark — small dot */}
              <circle cx={cx + 32} cy={cy - 18} r="0.8" fill="#020c2a" opacity="0.85" />

              {/* MOLD CAVITY ID stamp */}
              <text x={cx} y={cy + 20} textAnchor="middle" fill="#020c2a"
                    fontFamily="monospace" fontSize="4.5" opacity="0.7"
                    letterSpacing="0.5">CAV-{c*2 + r + 1}</text>

              {/* part number tiny */}
              <text x={cx} y={cy + 26} textAnchor="middle" fill="#020c2a"
                    fontFamily="monospace" fontSize="3.5" opacity="0.55">28-PCO</text>

              {/* DEFECT — flash spike on right rim */}
              {defect && (
                <g>
                  {/* shadow under flash */}
                  <path d={`M ${cx + 44} ${cy - 16}
                            L ${cx + 66} ${cy - 24}
                            L ${cx + 73} ${cy - 8}
                            L ${cx + 56} ${cy - 2} Z`}
                        fill="#000" opacity="0.7" transform="translate(2 2)" />
                  {/* the flash itself */}
                  <path d={`M ${cx + 44} ${cy - 16}
                            L ${cx + 66} ${cy - 24}
                            L ${cx + 73} ${cy - 8}
                            L ${cx + 56} ${cy - 2} Z`}
                        fill="url(#cap-blue)" stroke="#020c2a" strokeWidth="0.8" />
                  {/* surface highlight on flash */}
                  <path d={`M ${cx + 46} ${cy - 16} L ${cx + 64} ${cy - 22}`}
                        stroke="#fff" strokeWidth="0.6" opacity="0.45" fill="none" />
                  {/* secondary tear */}
                  <path d={`M ${cx + 56} ${cy - 2} Q ${cx + 62} ${cy + 6} ${cx + 58} ${cy + 12}`}
                        stroke="#020c2a" strokeWidth="1" fill="none" />
                  <path d={`M ${cx + 56} ${cy - 2} Q ${cx + 62} ${cy + 6} ${cx + 58} ${cy + 12}`}
                        stroke="#fff" strokeWidth="0.4" opacity="0.3" fill="none" />
                  {/* tiny stress whitening */}
                  <ellipse cx={cx + 55} cy={cy - 6} rx="3" ry="1.5"
                           fill="#fff" opacity="0.35" transform={`rotate(-25 ${cx+55} ${cy-6})`} />
                </g>
              )}
            </g>
          );
        }))}

        {/* a few stray plastic crumbs in the tray */}
        <g opacity="0.6">
          <circle cx="80" cy="305" r="0.8" fill="#1a4ab0" />
          <circle cx="240" cy="312" r="0.6" fill="#1a4ab0" />
          <circle cx="408" cy="306" r="1" fill="#1a4ab0" />
          <circle cx="510" cy="316" r="0.7" fill="#1a4ab0" />
        </g>

        {/* spec callout micrometer reading — bottom */}
        <g opacity="0.85">
          <rect x="20" y="346" width="180" height="20" rx="2" fill="#0a0c10" stroke="#3a3d42" strokeWidth="0.5" />
          <text x="28" y="359" fill="#a8d8a8" fontFamily="monospace" fontSize="8"
                letterSpacing="0.6">⌀ 28.012mm   H 14.000mm   ✓</text>
        </g>
        <g opacity="0.85">
          <rect x="400" y="346" width="180" height="20" rx="2" fill="#0a0c10" stroke="#ea4335" strokeWidth="0.6" />
          <text x="408" y="359" fill="#ea4335" fontFamily="monospace" fontSize="8"
                fontWeight="700" letterSpacing="0.6">FLASH +0.42mm · CAV-5 · REJ</text>
        </g>

        <rect width="600" height="380" fill="url(#cap-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     7. TEXTILE — cotton weave with snag
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'textile', industry: 'Textiles', name: 'Cotton weave · 320 GSM',
    sku: 'TX-COT-320', detector: 'fabric-snag-v2',
    defectName: 'pulled thread / snag', defectScore: 0.69,
    defectTag: 'snag · 0.69', verdict: 'WARN',
    bbox: { x: 42, y: 38, w: 17, h: 19 },
    heatmap: { x: 50, y: 47, intensity: 0.6 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          {/* warp = vertical, weft = horizontal — proper plain weave pattern */}
          <pattern id="weave" patternUnits="userSpaceOnUse" width="20" height="20">
            <rect width="20" height="20" fill="#c8b890" />
            {/* warp threads going up — varying tones */}
            <rect x="0" y="0" width="4" height="20" fill="#a08560" />
            <rect x="6" y="0" width="4" height="20" fill="#9a7d58" />
            <rect x="12" y="0" width="4" height="20" fill="#a48865" />
            <rect x="18" y="0" width="4" height="20" fill="#a08560" />
            {/* weft threads going across */}
            <rect x="0" y="0" width="20" height="4" fill="#b89a70" />
            <rect x="0" y="6" width="20" height="4" fill="#ac8e64" />
            <rect x="0" y="12" width="20" height="4" fill="#b89a70" />
            {/* over/under pattern — weft passes over warp at alternating cells */}
            <rect x="0" y="0" width="4" height="4" fill="#7a6440" />
            <rect x="6" y="6" width="4" height="4" fill="#7a6440" />
            <rect x="12" y="12" width="4" height="4" fill="#7a6440" />
            <rect x="0" y="12" width="4" height="4" fill="#9a8060" />
            <rect x="6" y="0" width="4" height="4" fill="#9a8060" />
            <rect x="12" y="6" width="4" height="4" fill="#9a8060" />
            {/* highlights on top of each thread */}
            <rect x="0" y="0" width="20" height="0.6" fill="#fff" opacity="0.25" />
            <rect x="0" y="6" width="20" height="0.6" fill="#fff" opacity="0.18" />
            <rect x="0" y="12" width="20" height="0.6" fill="#fff" opacity="0.20" />
            <rect x="0" y="0" width="0.5" height="20" fill="#fff" opacity="0.18" />
            <rect x="6" y="0" width="0.5" height="20" fill="#fff" opacity="0.16" />
            <rect x="12" y="0" width="0.5" height="20" fill="#fff" opacity="0.18" />
            {/* tiny fiber strays */}
            <line x1="2" y1="14" x2="5" y2="18" stroke="#7a6440" strokeWidth="0.3" opacity="0.6" />
            <line x1="14" y1="2" x2="17" y2="6" stroke="#7a6440" strokeWidth="0.3" opacity="0.6" />
          </pattern>
          {/* secondary fuzzy fiber overlay */}
          <pattern id="fuzz" patternUnits="userSpaceOnUse" width="40" height="40">
            <line x1="3" y1="5" x2="8" y2="11" stroke="#7a6440" strokeWidth="0.3" opacity="0.5" />
            <line x1="22" y1="14" x2="28" y2="20" stroke="#9a8060" strokeWidth="0.25" opacity="0.5" />
            <line x1="32" y1="2" x2="34" y2="8" stroke="#7a6440" strokeWidth="0.25" opacity="0.4" />
            <line x1="14" y1="28" x2="20" y2="34" stroke="#9a8060" strokeWidth="0.3" opacity="0.5" />
            <line x1="6" y1="32" x2="11" y2="36" stroke="#7a6440" strokeWidth="0.25" opacity="0.45" />
            <line x1="35" y1="22" x2="38" y2="28" stroke="#9a8060" strokeWidth="0.25" opacity="0.45" />
          </pattern>
          <radialGradient id="tx-light" cx="35%" cy="30%" r="100%">
            <stop offset="0" stopColor="#fff" stopOpacity="0.35" />
            <stop offset="55%" stopColor="#fff" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
          <radialGradient id="tx-vig" cx="50%" cy="50%" r="65%">
            <stop offset="55%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.4" />
          </radialGradient>
        </defs>

        {/* base weave */}
        <rect width="600" height="380" fill="#a89570" />
        <rect width="600" height="380" fill="url(#weave)" />
        <rect width="600" height="380" fill="url(#fuzz)" />

        {/* fabric drape — slight shadow waves */}
        <g opacity="0.4">
          <ellipse cx="120" cy="130" rx="180" ry="40" fill="#000" opacity="0.18" />
          <ellipse cx="500" cy="280" rx="180" ry="40" fill="#000" opacity="0.18" />
          <ellipse cx="320" cy="50" rx="220" ry="20" fill="#fff" opacity="0.10" />
        </g>

        {/* light/vignette */}
        <rect width="600" height="380" fill="url(#tx-light)" />

        {/* fabric edge curl top + bottom */}
        <path d="M 0 0 L 600 0 L 600 26 Q 300 38 0 26 Z"
              fill="#000" opacity="0.30" />
        <path d="M 0 354 L 600 354 Q 300 366 0 366 Z"
              fill="#000" opacity="0.26" />

        {/* THE SNAG — much more detail */}
        <g transform="translate(300, 175)">
          {/* missing-weave halo (where threads have been pulled out) */}
          <ellipse cx="0" cy="0" rx="56" ry="36" fill="#000" opacity="0.32" />
          <ellipse cx="0" cy="0" rx="48" ry="30" fill="#7a6440" opacity="0.5" />
          <ellipse cx="0" cy="0" rx="42" ry="24" fill="#5a4828" opacity="0.4" />

          {/* exposed warp threads under the gap (shows through to dark backing) */}
          {[-30, -22, -14, -6, 2, 10, 18, 26].map((x,i) => (
            <line key={i} x1={x} y1="-22" x2={x+1} y2="22"
                  stroke="#7a6440" strokeWidth="1.5" opacity="0.45" />
          ))}

          {/* the PULLED LOOP — cable-like, shaded */}
          {/* outer dark stroke */}
          <path d="M -32 6 Q -22 -34 -4 -14 Q 8 -38 24 -4 Q 32 16 16 22 Q -2 26 -18 22 Q -32 18 -32 6 Z"
                fill="none" stroke="#3a2810" strokeWidth="5" strokeLinecap="round" />
          {/* main thread */}
          <path d="M -32 6 Q -22 -34 -4 -14 Q 8 -38 24 -4 Q 32 16 16 22 Q -2 26 -18 22 Q -32 18 -32 6 Z"
                fill="none" stroke="#a08560" strokeWidth="3.5" strokeLinecap="round" />
          {/* highlight on top of thread */}
          <path d="M -30 6 Q -22 -32 -4 -14 Q 6 -36 22 -6"
                fill="none" stroke="#dec898" strokeWidth="1" strokeLinecap="round" opacity="0.85" />
          <path d="M -28 4 Q -20 -30 -4 -12"
                fill="none" stroke="#fff" strokeWidth="0.5" strokeLinecap="round" opacity="0.6" />
          {/* twisted yarn texture — small chevrons */}
          {Array.from({length: 18}).map((_,i) => {
            const t = i/17;
            const x = -32 + t*64;
            const y = -10 + Math.sin(t*Math.PI*2.2)*16;
            return <line key={i} x1={x-1} y1={y-1.5} x2={x+1} y2={y+1.5}
                         stroke="#3a2810" strokeWidth="0.4" opacity="0.6" />;
          })}

          {/* loose fiber strays */}
          <path d="M 24 -4 Q 34 4 30 16 Q 26 26 38 32"
                fill="none" stroke="#a08560" strokeWidth="1.2"
                strokeLinecap="round" opacity="0.85" />
          <path d="M 24 -4 Q 34 4 30 16"
                fill="none" stroke="#dec898" strokeWidth="0.4"
                strokeLinecap="round" opacity="0.55" />
          <path d="M -18 22 Q -24 32 -38 34"
                fill="none" stroke="#a08560" strokeWidth="1"
                strokeLinecap="round" opacity="0.75" />
          <path d="M -4 -14 Q -10 -28 -2 -36"
                fill="none" stroke="#a08560" strokeWidth="0.9"
                strokeLinecap="round" opacity="0.7" />
          <path d="M 16 22 Q 22 30 18 38"
                fill="none" stroke="#a08560" strokeWidth="0.8"
                strokeLinecap="round" opacity="0.65" />

          {/* tiny fiber halos / lint puffs */}
          {Array.from({length: 22}).map((_,i) => {
            const a = (i/22)*Math.PI*2;
            const r = 30 + (i%3)*8;
            const x = Math.cos(a)*r;
            const y = Math.sin(a)*r*0.65;
            return <circle key={i} cx={x} cy={y} r={0.4 + (i%2)*0.3}
                           fill="#dec898" opacity="0.55" />;
          })}

          {/* knot point */}
          <circle cx="-4" cy="-14" r="3" fill="#3a2810" opacity="0.7" />
          <circle cx="-4" cy="-14" r="2" fill="#a08560" />
          <circle cx="-5" cy="-15" r="0.6" fill="#fff" opacity="0.7" />
        </g>

        {/* SELVEDGE EDGE — sewn binding */}
        <g>
          <rect x="0" y="0" width="600" height="6" fill="#3a2810" />
          <rect x="0" y="3" width="600" height="0.6" fill="#fff" opacity="0.25" />
          {/* stitch perforations */}
          {Array.from({length: 50}).map((_,i) => (
            <line key={i} x1={i*12+4} y1="2" x2={i*12+10} y2="5"
                  stroke="#7a5028" strokeWidth="0.6" />
          ))}
          <rect x="0" y="374" width="600" height="6" fill="#3a2810" />
          {Array.from({length: 50}).map((_,i) => (
            <line key={i} x1={i*12+4} y1="376" x2={i*12+10} y2="379"
                  stroke="#7a5028" strokeWidth="0.6" />
          ))}
        </g>

        {/* MAGNIFICATION RULER bottom-left */}
        <g opacity="0.85">
          <rect x="20" y="334" width="160" height="20" rx="2" fill="#1a1408" stroke="#3a2810" strokeWidth="0.5" />
          {Array.from({length: 11}).map((_,i) => (
            <line key={i} x1={28+i*15} y1="334" x2={28+i*15} y2={i%5===0 ? 350 : 346}
                  stroke="#dec898" strokeWidth={i%5===0 ? 0.8 : 0.4} />
          ))}
          <text x="28" y="351" fill="#dec898" fontFamily="monospace" fontSize="6">0</text>
          <text x="100" y="351" fill="#dec898" fontFamily="monospace" fontSize="6"
                textAnchor="middle">5mm</text>
          <text x="170" y="351" fill="#dec898" fontFamily="monospace" fontSize="6"
                textAnchor="end">10mm</text>
        </g>

        {/* FABRIC SPEC plate */}
        <g opacity="0.85">
          <rect x="420" y="334" width="160" height="20" rx="2" fill="#1a1408" stroke="#3a2810" strokeWidth="0.5" />
          <text x="428" y="348" fill="#dec898" fontFamily="monospace" fontSize="8"
                letterSpacing="0.6">100% COT · 320 GSM · 60×40</text>
        </g>

        <rect width="600" height="380" fill="url(#tx-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     8. SEMICONDUCTOR WAFER — particle contamination
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'wafer', industry: 'Semiconductor', name: 'Silicon wafer · 200mm',
    sku: 'WFR-200-A', detector: 'wafer-particle-v1',
    defectName: 'particle contamination', defectScore: 0.81,
    defectTag: 'particle · 0.81', verdict: 'DEFECT',
    bbox: { x: 58, y: 33, w: 8, h: 10 },
    heatmap: { x: 62, y: 38, intensity: 0.85 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="wfr-bg" cx="50%" cy="40%" r="100%">
            <stop offset="0" stopColor="#1a2238" />
            <stop offset="55%" stopColor="#0a0e18" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <radialGradient id="wfr-surf" cx="32%" cy="22%" r="95%">
            <stop offset="0" stopColor="#fff8e8" />
            <stop offset="10%" stopColor="#f0d8a8" />
            <stop offset="28%" stopColor="#c89870" />
            <stop offset="50%" stopColor="#7a5838" />
            <stop offset="78%" stopColor="#3a2818" />
            <stop offset="100%" stopColor="#0a0608" />
          </radialGradient>
          <linearGradient id="wfr-iridescent" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#9070ff" stopOpacity="0.22" />
            <stop offset="0.25" stopColor="#50a0ff" stopOpacity="0.28" />
            <stop offset="0.50" stopColor="#50ffd0" stopOpacity="0.22" />
            <stop offset="0.75" stopColor="#ffe060" stopOpacity="0.18" />
            <stop offset="1" stopColor="#ff8060" stopOpacity="0.18" />
          </linearGradient>
          <radialGradient id="wfr-rim-shadow" cx="50%" cy="50%" r="50%">
            <stop offset="92%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.85" />
          </radialGradient>
          <radialGradient id="die-color" cx="40%" cy="35%" r="80%">
            <stop offset="0" stopColor="#88c8ff" stopOpacity="0.55" />
            <stop offset="50%" stopColor="#5a90ff" stopOpacity="0.35" />
            <stop offset="100%" stopColor="#2a4a8a" stopOpacity="0.2" />
          </radialGradient>
          <radialGradient id="wfr-vig" cx="50%" cy="50%" r="65%">
            <stop offset="55%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.65" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#wfr-bg)" />

        {/* CLEANROOM VINYL FLOOR — back surface */}
        <g opacity="0.4">
          {Array.from({length: 13}).map((_,i) => (
            <line key={'v'+i} x1={i*50} y1="0" x2={i*50} y2="380"
                  stroke="#3a4258" strokeWidth="0.4" opacity="0.3" />
          ))}
          {Array.from({length: 9}).map((_,i) => (
            <line key={'h'+i} x1="0" y1={i*45} x2="600" y2={i*45}
                  stroke="#3a4258" strokeWidth="0.4" opacity="0.3" />
          ))}
        </g>

        {/* hard ground shadow */}
        <ellipse cx="305" cy="356" rx="180" ry="10" fill="#000" opacity="0.85" />
        <ellipse cx="305" cy="358" rx="160" ry="6" fill="#000" opacity="0.55" />

        {/* WAFER DISC — base */}
        <circle cx="300" cy="190" r="160" fill="#000" opacity="0.85" />
        <circle cx="300" cy="190" r="158" fill="url(#wfr-surf)" />
        {/* iridescent oil-slick sheen overlay */}
        <circle cx="300" cy="190" r="158" fill="url(#wfr-iridescent)" />
        {/* rim shadow */}
        <circle cx="300" cy="190" r="158" fill="url(#wfr-rim-shadow)" />
        {/* outer rim highlight */}
        <circle cx="300" cy="190" r="158" fill="none" stroke="#fff" strokeWidth="0.6" opacity="0.45" />
        <circle cx="300" cy="190" r="156" fill="none" stroke="#0a0608" strokeWidth="0.5" />

        {/* exclusion zone (edge bevel ring where die isn't printed) */}
        <circle cx="300" cy="190" r="148" fill="none" stroke="#0a0608" strokeWidth="0.4" opacity="0.6" />
        <circle cx="300" cy="190" r="146" fill="none" stroke="#fff" strokeWidth="0.3" opacity="0.25" />

        {/* notch (orientation flat) — small v-notch top */}
        <path d="M 290 32 L 310 32 L 300 52 Z" fill="#000" />
        <path d="M 290 32 L 310 32 L 300 52 Z" fill="none" stroke="#fff" strokeWidth="0.4" opacity="0.5" />

        {/* DIE GRID — clipped to wafer */}
        <clipPath id="wfr-clip">
          <circle cx="300" cy="190" r="146" />
        </clipPath>
        <g clipPath="url(#wfr-clip)">
          {/* individual dies — denser grid */}
          {Array.from({length: 24}).map((_, r) =>
            Array.from({length: 24}).map((_, c) => {
              const x = 156 + c * 12;
              const y = 46 + r * 12;
              const dx = x + 6 - 300;
              const dy = y + 6 - 190;
              const dist = Math.sqrt(dx*dx + dy*dy);
              if (dist > 144) return null;
              const isBad = (r === 8 && c === 16) || (r === 9 && c === 17) ||
                            (r === 8 && c === 17) || (r === 18 && c === 6);
              return (
                <g key={`${r}-${c}`}>
                  <rect x={x} y={y} width="11" height="11"
                        fill={isBad ? '#3a0808' : 'none'}
                        stroke={isBad ? '#ea4335' : '#88c8ff'}
                        strokeWidth="0.3"
                        opacity={isBad ? 0.85 : 0.45} />
                  {/* internal die circuitry — 3 horizontal traces */}
                  <line x1={x+1.5} y1={y+3} x2={x+9.5} y2={y+3}
                        stroke={isBad ? '#ea4335' : '#88c8ff'}
                        strokeWidth="0.2" opacity={isBad ? 0.7 : 0.35} />
                  <line x1={x+1.5} y1={y+5.5} x2={x+9.5} y2={y+5.5}
                        stroke={isBad ? '#ea4335' : '#88c8ff'}
                        strokeWidth="0.2" opacity={isBad ? 0.7 : 0.35} />
                  <line x1={x+1.5} y1={y+8} x2={x+9.5} y2={y+8}
                        stroke={isBad ? '#ea4335' : '#88c8ff'}
                        strokeWidth="0.2" opacity={isBad ? 0.7 : 0.35} />
                  {/* corner pad */}
                  {((r+c)%4 === 0) && (
                    <rect x={x+1} y={y+1} width="2" height="2"
                          fill="#fff" opacity={isBad ? 0.4 : 0.55} />
                  )}
                </g>
              );
            })
          )}
        </g>

        {/* CIRCULAR LITHOGRAPHY HALO RINGS — interference patterns from polishing */}
        <g clipPath="url(#wfr-clip)" opacity="0.18">
          {Array.from({length: 14}).map((_,i) => (
            <circle key={i} cx="300" cy="190" r={20 + i * 10}
                    fill="none" stroke="#88c8ff" strokeWidth="0.4" />
          ))}
          {Array.from({length: 14}).map((_,i) => (
            <circle key={i} cx="300" cy="190" r={20 + i * 10}
                    fill="none" stroke="#ff80c0" strokeWidth="0.3" opacity="0.6" />
          ))}
        </g>

        {/* SPECULAR HIGHLIGHT BAND across wafer */}
        <g clipPath="url(#wfr-clip)">
          <ellipse cx="220" cy="100" rx="100" ry="50" fill="#fff" opacity="0.18" />
          <ellipse cx="240" cy="80" rx="60" ry="20" fill="#fff" opacity="0.22" />
        </g>

        {/* tweezer / handling tool peeking from bottom-right */}
        <g opacity="0.85">
          <rect x="495" y="295" width="105" height="6" fill="#5a5d62" rx="1"
                transform="rotate(-15 547 298)" />
          <rect x="495" y="295" width="105" height="2" fill="#fff" opacity="0.45" rx="1"
                transform="rotate(-15 547 298)" />
          <rect x="490" y="293" width="20" height="10" fill="#3a3d42"
                transform="rotate(-15 500 298)" />
        </g>

        {/* THE DEFECT — particle (fiber + speck) — much more detailed */}
        <g>
          {/* darker contamination halo */}
          <ellipse cx="378" cy="138" rx="22" ry="14" fill="#000" opacity="0.55" />
          <ellipse cx="378" cy="138" rx="14" ry="9" fill="#1a0808" opacity="0.55" />
          {/* fiber strand — multi-segment */}
          <path d="M 354 130 Q 364 134 370 138 Q 378 142 384 145 Q 390 148 392 152"
                stroke="#0a0608" strokeWidth="2" fill="none"
                strokeLinecap="round" opacity="0.85" />
          <path d="M 354 130 Q 364 134 370 138 Q 378 142 384 145 Q 390 148 392 152"
                stroke="#e8d8b0" strokeWidth="1.2" fill="none"
                strokeLinecap="round" opacity="0.95" />
          <path d="M 356 130 Q 366 134 372 138"
                stroke="#fff" strokeWidth="0.4" fill="none"
                strokeLinecap="round" opacity="0.85" />
          {/* tiny barbs on fiber */}
          <line x1="368" y1="137" x2="370" y2="134" stroke="#a08560" strokeWidth="0.4" />
          <line x1="380" y1="143" x2="383" y2="140" stroke="#a08560" strokeWidth="0.4" />
          {/* main speck */}
          <ellipse cx="368" cy="138" rx="4.5" ry="3.5" fill="#000" opacity="0.5" />
          <ellipse cx="368" cy="138" rx="4" ry="3" fill="#fff" opacity="0.95" />
          <ellipse cx="367" cy="137" rx="2" ry="1.4" fill="#fff" />
          {/* secondary specks */}
          <circle cx="376" cy="146" r="1.4" fill="#fff" opacity="0.85" />
          <circle cx="386" cy="142" r="0.9" fill="#fff" opacity="0.7" />
          <circle cx="362" cy="144" r="0.7" fill="#fff" opacity="0.6" />
        </g>

        {/* SECONDARY (benign) specks elsewhere */}
        <circle cx="240" cy="240" r="1.4" fill="#fff" opacity="0.4" />
        <circle cx="320" cy="280" r="1" fill="#fff" opacity="0.4" />
        <circle cx="200" cy="180" r="0.8" fill="#fff" opacity="0.35" />
        <circle cx="380" cy="240" r="0.7" fill="#fff" opacity="0.3" />
        <circle cx="280" cy="100" r="0.6" fill="#fff" opacity="0.3" />

        {/* WAFER ID stamp — small etched marking */}
        <text x="80" y="356" fill="#88c8ff" fontFamily="monospace" fontSize="10"
              opacity="0.85" letterSpacing="0.8" fontWeight="700">
          SLOT 12 · LOT W2406-A · 200mm · 130nm
        </text>
        <text x="80" y="368" fill="#88c8ff" fontFamily="monospace" fontSize="7"
              opacity="0.55" letterSpacing="0.5">FOUP 03 · OP-1820 · KLA-T01</text>

        {/* coordinate crosshair on the defect die */}
        <g stroke="#ea4335" strokeWidth="0.7" opacity="0.85">
          <line x1="368" y1="120" x2="368" y2="160" />
          <line x1="350" y1="138" x2="386" y2="138" />
        </g>
        <text x="392" y="125" fill="#ea4335" fontFamily="monospace"
              fontSize="8" fontWeight="700" letterSpacing="0.6">X+24, Y-12</text>

        <rect width="600" height="380" fill="url(#wfr-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     9. WELD — MIG seam with undercut
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'weld', industry: 'Metal Fab', name: 'MIG weld seam · S235 steel',
    sku: 'WLD-MIG-S235', detector: 'weld-quality-v2',
    defectName: 'undercut groove', defectScore: 0.79,
    defectTag: 'undercut · 0.79', verdict: 'DEFECT',
    bbox: { x: 37, y: 43, w: 24, h: 9 },
    heatmap: { x: 49, y: 47, intensity: 0.85 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <linearGradient id="weld-bg" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#0a0c10" />
            <stop offset="1" stopColor="#000" />
          </linearGradient>
          <linearGradient id="steel-top" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#9a9da4" />
            <stop offset="0.3" stopColor="#6a6d72" />
            <stop offset="0.7" stopColor="#3a3d42" />
            <stop offset="1" stopColor="#1a1d22" />
          </linearGradient>
          <linearGradient id="steel-bot" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#1a1d22" />
            <stop offset="0.3" stopColor="#3a3d42" />
            <stop offset="0.7" stopColor="#6a6d72" />
            <stop offset="1" stopColor="#3a3d42" />
          </linearGradient>
          <linearGradient id="bead" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#f0d088" />
            <stop offset="0.20" stopColor="#d8a868" />
            <stop offset="0.45" stopColor="#9a7050" />
            <stop offset="0.75" stopColor="#5a4030" />
            <stop offset="1" stopColor="#1a1008" />
          </linearGradient>
          <linearGradient id="haz" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#5a3018" stopOpacity="0" />
            <stop offset="0.2" stopColor="#a85838" stopOpacity="0.6" />
            <stop offset="0.4" stopColor="#d88058" stopOpacity="0.85" />
            <stop offset="0.55" stopColor="#7a98c8" stopOpacity="0.65" />
            <stop offset="0.7" stopColor="#5878a8" stopOpacity="0.5" />
            <stop offset="1" stopColor="#3a3d42" stopOpacity="0" />
          </linearGradient>
          <linearGradient id="haz-blue" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#5a78a8" stopOpacity="0" />
            <stop offset="0.5" stopColor="#88a8d8" stopOpacity="0.55" />
            <stop offset="1" stopColor="#5a78a8" stopOpacity="0" />
          </linearGradient>
          <radialGradient id="weld-vig" cx="50%" cy="50%" r="65%">
            <stop offset="55%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.55" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#weld-bg)" />

        {/* shop floor surface — distant */}
        <rect x="0" y="0" width="600" height="60" fill="#1a1d22" opacity="0.6" />
        <rect x="0" y="320" width="600" height="60" fill="#1a1d22" opacity="0.6" />

        {/* UPPER STEEL PLATE */}
        <rect x="0" y="60" width="600" height="120" fill="url(#steel-top)" />
        {/* mill scale + grain */}
        <g opacity="0.5">
          {Array.from({length: 80}).map((_,i) => (
            <line key={i} x1={(i*53)%600} y1={62 + (i*41)%116}
                  x2={(i*53)%600 + 8} y2={62 + (i*41)%116}
                  stroke="#000" strokeWidth="0.3" opacity="0.4" />
          ))}
          {Array.from({length: 50}).map((_,i) => (
            <ellipse key={'sp'+i} cx={(i*73)%600} cy={70 + (i*23)%108}
                     rx={0.5+(i%3)*0.3} ry={0.4} fill="#000" opacity="0.45" />
          ))}
        </g>
        {/* upper plate top edge highlight */}
        <rect x="0" y="60" width="600" height="3" fill="#fff" opacity="0.35" />
        {/* upper plate bottom edge — bevel showing into weld */}
        <rect x="0" y="178" width="600" height="2" fill="#000" opacity="0.85" />
        {/* surface grind bands */}
        <g opacity="0.3">
          {Array.from({length: 10}).map((_,i) => (
            <line key={i} x1="0" y1={64 + i*12} x2="600" y2={64 + i*12}
                  stroke="#fff" strokeWidth="0.3" opacity="0.4" />
          ))}
        </g>

        {/* LOWER STEEL PLATE */}
        <rect x="0" y="200" width="600" height="120" fill="url(#steel-bot)" />
        <rect x="0" y="200" width="600" height="2" fill="#000" opacity="0.85" />
        <rect x="0" y="316" width="600" height="3" fill="#000" opacity="0.7" />
        <g opacity="0.5">
          {Array.from({length: 80}).map((_,i) => (
            <line key={i} x1={(i*53)%600} y1={204 + (i*41)%112}
                  x2={(i*53)%600 + 8} y2={204 + (i*41)%112}
                  stroke="#000" strokeWidth="0.3" opacity="0.4" />
          ))}
          {Array.from({length: 50}).map((_,i) => (
            <ellipse key={'sp'+i} cx={(i*73)%600} cy={210 + (i*23)%106}
                     rx={0.5+(i%3)*0.3} ry={0.4} fill="#000" opacity="0.45" />
          ))}
        </g>
        <g opacity="0.3">
          {Array.from({length: 10}).map((_,i) => (
            <line key={i} x1="0" y1={206 + i*12} x2="600" y2={206 + i*12}
                  stroke="#fff" strokeWidth="0.3" opacity="0.4" />
          ))}
        </g>

        {/* HEAT-AFFECTED ZONE — full color rainbow tempering */}
        <rect x="0" y="148" width="600" height="32" fill="url(#haz)" />
        <rect x="0" y="200" width="600" height="32" fill="url(#haz)"
              transform="scale(1 -1) translate(0 -432)" />
        {/* secondary blue band further out */}
        <rect x="0" y="138" width="600" height="14" fill="url(#haz-blue)" opacity="0.6" />
        <rect x="0" y="228" width="600" height="14" fill="url(#haz-blue)" opacity="0.6" />

        {/* WELD BEAD shadow underneath */}
        <ellipse cx="300" cy="200" rx="295" ry="18" fill="#000" opacity="0.85" />

        {/* WELD BEAD body */}
        <rect x="0" y="178" width="600" height="26" fill="url(#bead)" />
        {/* bead top highlight */}
        <ellipse cx="300" cy="180" rx="295" ry="6" fill="#fff" opacity="0.3" />
        {/* bead bottom shadow */}
        <ellipse cx="300" cy="202" rx="295" ry="3" fill="#000" opacity="0.45" />
        {/* bead toe highlights — top and bottom edges */}
        <line x1="0" y1="178" x2="600" y2="178" stroke="#fff" strokeWidth="0.6" opacity="0.65" />
        <line x1="0" y1="204" x2="600" y2="204" stroke="#000" strokeWidth="1.2" opacity="0.85" />
        <line x1="0" y1="206" x2="600" y2="206" stroke="#fff" strokeWidth="0.4" opacity="0.4" />

        {/* RIPPLE PATTERN — much denser, each with full 3D shading */}
        {Array.from({ length: 50 }).map((_, i) => {
          const cx = 12 + i * 12;
          return (
            <g key={i}>
              {/* dark ripple shadow */}
              <ellipse cx={cx + 1} cy="191" rx="6.5" ry="13"
                       fill="#000" opacity="0.6" />
              {/* main ripple ring */}
              <ellipse cx={cx} cy="191" rx="6.5" ry="13"
                       fill="none" stroke="#1a1008" strokeWidth="1.5" opacity="0.9" />
              {/* highlight on leading edge */}
              <ellipse cx={cx - 2.5} cy="187" rx="3" ry="3"
                       fill="#fff" opacity="0.45" />
              <ellipse cx={cx - 3} cy="186" rx="1.2" ry="1"
                       fill="#fff" opacity="0.85" />
              {/* trailing shadow */}
              <ellipse cx={cx + 3} cy="195" rx="2.5" ry="3"
                       fill="#000" opacity="0.5" />
              {/* color heat-tint shimmer on each ripple */}
              <ellipse cx={cx} cy="184" rx="5" ry="1"
                       fill="#88a8d8" opacity={0.18 + (i%3)*0.05} />
            </g>
          );
        })}

        {/* THE DEFECT — undercut groove on top edge of bead */}
        <g>
          {/* deep groove — much more pronounced */}
          <path d="M 220 178 Q 264 162 322 170 Q 368 174 372 184 Q 280 184 220 188 Z"
                fill="#000" opacity="0.95" />
          {/* dark interior */}
          <path d="M 230 178 Q 264 164 320 170 Q 360 172 360 182 Q 280 182 230 184 Z"
                fill="#1a0c08" opacity="0.95" />
          {/* very dark inner shadow line */}
          <path d="M 240 178 Q 270 168 318 172 Q 350 174 350 180"
                stroke="#000" strokeWidth="2.5" fill="none" opacity="0.85" />
          {/* highlight on the lip ABOVE the groove (parent metal eaten) */}
          <path d="M 220 176 Q 280 160 360 170"
                stroke="#fff" strokeWidth="0.9" fill="none" opacity="0.85" />
          <path d="M 220 178 Q 280 162 360 172"
                stroke="#fff" strokeWidth="0.4" fill="none" opacity="0.55" />
          {/* secondary undercut cracks */}
          <line x1="248" y1="170" x2="252" y2="178" stroke="#000" strokeWidth="0.5" opacity="0.7" />
          <line x1="290" y1="166" x2="294" y2="178" stroke="#000" strokeWidth="0.5" opacity="0.7" />
          <line x1="330" y1="170" x2="334" y2="178" stroke="#000" strokeWidth="0.5" opacity="0.7" />
        </g>

        {/* SPATTER — many droplets */}
        {[
          [420, 168, 2.4], [440, 142, 1.6], [185, 156, 2],
          [165, 230, 2.4], [460, 232, 1.8], [388, 134, 1.4],
          [510, 158, 1.2], [534, 170, 0.9], [122, 144, 1.6],
          [98, 224, 2], [502, 218, 1.4], [374, 248, 1.1],
          [258, 252, 0.9], [578, 188, 1.2], [44, 160, 1.4],
          [60, 252, 1.0], [150, 270, 0.7]
        ].map(([x, y, r], i) => (
          <g key={i}>
            <ellipse cx={x} cy={y + 1.5} rx={r * 1.4} ry={r * 0.55}
                     fill="#000" opacity="0.7" />
            <circle cx={x} cy={y} r={r} fill="#5a4030" />
            <circle cx={x} cy={y} r={r} fill="none" stroke="#1a1008" strokeWidth="0.3" />
            <circle cx={x - r * 0.35} cy={y - r * 0.35} r={r * 0.35} fill="#fff" opacity="0.7" />
          </g>
        ))}

        {/* slag islands — small dark glassy bits */}
        <g>
          <ellipse cx="80" cy="190" rx="4" ry="2" fill="#0a0608" />
          <ellipse cx="80" cy="189" rx="4" ry="2" fill="#fff" opacity="0.25" />
          <ellipse cx="540" cy="194" rx="3" ry="1.5" fill="#0a0608" />
          <ellipse cx="540" cy="193" rx="3" ry="1.5" fill="#fff" opacity="0.2" />
        </g>

        {/* SPEC LABEL plate */}
        <g opacity="0.85">
          <rect x="20" y="338" width="240" height="22" rx="2" fill="#0a0c10" stroke="#3a3d42" strokeWidth="0.5" />
          <text x="28" y="352" fill="#88a8d8" fontFamily="monospace" fontSize="9"
                letterSpacing="0.6">MIG · ER70S-6 · 1.0mm · 24V/220A</text>
        </g>
        <g opacity="0.85">
          <rect x="370" y="338" width="210" height="22" rx="2" fill="#0a0c10" stroke="#ea4335" strokeWidth="0.6" />
          <text x="378" y="352" fill="#ea4335" fontFamily="monospace" fontSize="9"
                fontWeight="700" letterSpacing="0.6">UNDERCUT 0.9mm · ISO 5817 D</text>
        </g>

        <rect width="600" height="380" fill="url(#weld-vig)" />
      </svg>
    ),
  },

  /* ──────────────────────────────────────────────────────────────────────
     10. GLASS PANEL — hairline crack
     ────────────────────────────────────────────────────────────────────── */
  {
    id: 'glass', industry: 'Display Glass', name: 'Cover glass · 7" panel',
    sku: 'GLS-CVR-7', detector: 'glass-crack-v1',
    defectName: 'hairline crack', defectScore: 0.88,
    defectTag: 'crack · 0.88', verdict: 'DEFECT',
    bbox: { x: 34, y: 24, w: 24, h: 51 },
    heatmap: { x: 46, y: 47, intensity: 0.85 },
    render: () => (
      <svg viewBox="0 0 600 380" preserveAspectRatio="xMidYMid slice"
           width="100%" height="100%" style={{ position: 'absolute', inset: 0 }}>
        <defs>
          <radialGradient id="gls-bg" cx="50%" cy="40%" r="90%">
            <stop offset="0" stopColor="#1a2238" />
            <stop offset="55%" stopColor="#0a0e18" />
            <stop offset="100%" stopColor="#000" />
          </radialGradient>
          <linearGradient id="gls-bezel" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#2a2d32" />
            <stop offset="0.05" stopColor="#3a3d42" />
            <stop offset="0.5" stopColor="#1a1d22" />
            <stop offset="0.95" stopColor="#2a2d32" />
            <stop offset="1" stopColor="#0a0c10" />
          </linearGradient>
          <linearGradient id="gls-panel" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#0a1018" />
            <stop offset="0.5" stopColor="#162028" />
            <stop offset="1" stopColor="#080c14" />
          </linearGradient>
          <linearGradient id="gls-shine" x1="0" y1="0" x2="1" y2="1">
            <stop offset="0" stopColor="#a8c4e8" stopOpacity="0.5" />
            <stop offset="0.25" stopColor="#a8c4e8" stopOpacity="0.08" />
            <stop offset="0.6" stopColor="#a8c4e8" stopOpacity="0" />
            <stop offset="0.85" stopColor="#a8c4e8" stopOpacity="0.22" />
            <stop offset="1" stopColor="#a8c4e8" stopOpacity="0.04" />
          </linearGradient>
          <linearGradient id="gls-shine2" x1="0" y1="1" x2="1" y2="0">
            <stop offset="0" stopColor="#fff" stopOpacity="0" />
            <stop offset="0.45" stopColor="#fff" stopOpacity="0" />
            <stop offset="0.5" stopColor="#fff" stopOpacity="0.18" />
            <stop offset="0.55" stopColor="#fff" stopOpacity="0" />
            <stop offset="1" stopColor="#fff" stopOpacity="0" />
          </linearGradient>
          <radialGradient id="gls-vig" cx="50%" cy="50%" r="65%">
            <stop offset="55%" stopColor="#000" stopOpacity="0" />
            <stop offset="100%" stopColor="#000" stopOpacity="0.65" />
          </radialGradient>
          <radialGradient id="gls-impact-glow" cx="50%" cy="50%" r="50%">
            <stop offset="0" stopColor="#ffffff" stopOpacity="0.6" />
            <stop offset="0.4" stopColor="#a8c4e8" stopOpacity="0.25" />
            <stop offset="1" stopColor="#a8c4e8" stopOpacity="0" />
          </radialGradient>
        </defs>
        <rect width="600" height="380" fill="url(#gls-bg)" />

        {/* room ambient — subtle grid behind glass for reflection feel */}
        <g opacity="0.25">
          {Array.from({length: 16}).map((_,i) => (
            <line key={'gv'+i} x1={i*40} y1="0" x2={i*40} y2="380"
                  stroke="#3a4258" strokeWidth="0.3" opacity="0.4" />
          ))}
          {Array.from({length: 10}).map((_,i) => (
            <line key={'gh'+i} x1="0" y1={i*40} x2="600" y2={i*40}
                  stroke="#3a4258" strokeWidth="0.3" opacity="0.4" />
          ))}
        </g>

        {/* drop shadow — softer, multi-layer */}
        <rect x="74" y="60" width="452" height="292" rx="18" fill="#000" opacity="0.5" />
        <rect x="78" y="64" width="448" height="288" rx="18" fill="#000" opacity="0.4" />

        {/* OUTER BEZEL — 3D feel */}
        <rect x="68" y="48" width="464" height="296" rx="20" fill="url(#gls-bezel)" />
        {/* top highlight */}
        <rect x="68" y="48" width="464" height="2" rx="2" fill="#88909a" opacity="0.7" />
        {/* bottom shadow */}
        <rect x="68" y="342" width="464" height="2" rx="2" fill="#000" opacity="0.85" />
        {/* side highlights */}
        <rect x="68" y="48" width="2" height="296" fill="#5a5d62" opacity="0.5" />
        <rect x="530" y="48" width="2" height="296" fill="#000" opacity="0.85" />

        {/* bezel inner step (recessed glass) */}
        <rect x="78" y="58" width="444" height="276" rx="14"
              fill="none" stroke="#000" strokeWidth="1" opacity="0.85" />
        <rect x="80" y="60" width="440" height="272" rx="13"
              fill="none" stroke="#5a5d62" strokeWidth="0.5" opacity="0.45" />

        {/* speaker grille / camera dot at top of bezel */}
        <rect x="270" y="51" width="60" height="2" rx="1" fill="#0a0c10" />
        <circle cx="500" cy="52" r="2" fill="#0a0c10" />
        <circle cx="500" cy="52" r="1" fill="#1a3a6a" />
        {/* brand etch */}
        <text x="300" y="338" textAnchor="middle" fill="#3a3d42"
              fontFamily="monospace" fontSize="6" letterSpacing="2">VIAI</text>

        {/* GLASS / DISPLAY surface */}
        <rect x="86" y="66" width="428" height="260" rx="11"
              fill="url(#gls-panel)" />

        {/* AOD-style minimal UI under the glass — clock + status */}
        <g opacity="0.85">
          <text x="300" y="138" textAnchor="middle" fill="#a8c4e8"
                fontFamily="monospace" fontSize="44" fontWeight="200"
                letterSpacing="1">14:32</text>
          <text x="300" y="158" textAnchor="middle" fill="#5a78a8"
                fontFamily="monospace" fontSize="9"
                letterSpacing="2.5" opacity="0.9">TUE · 04 NOV · 22°C</text>
        </g>
        {/* status bar */}
        <g opacity="0.55">
          <rect x="100" y="78" width="3" height="3" fill="#a8c4e8" rx="0.5" />
          <rect x="106" y="78" width="3" height="3" fill="#a8c4e8" rx="0.5" />
          <rect x="112" y="78" width="3" height="3" fill="#a8c4e8" rx="0.5" />
          <rect x="118" y="78" width="3" height="3" fill="#5a78a8" rx="0.5" />
          <rect x="487" y="77" width="13" height="6" rx="1" fill="none" stroke="#a8c4e8" strokeWidth="0.5" />
          <rect x="488" y="78" width="9" height="4" fill="#a8c4e8" />
          <text x="478" y="83" textAnchor="end" fill="#a8c4e8"
                fontFamily="monospace" fontSize="6">82%</text>
        </g>
        {/* notification cards */}
        <g opacity="0.4">
          <rect x="120" y="190" width="360" height="34" rx="6" fill="#162845" />
          <circle cx="138" cy="207" r="6" fill="#5a78c8" />
          <rect x="152" y="200" width="100" height="3" rx="1" fill="#a8c4e8" />
          <rect x="152" y="208" width="180" height="2" rx="1" fill="#5a78a8" />
          <rect x="152" y="214" width="140" height="2" rx="1" fill="#5a78a8" />
          <text x="468" y="206" textAnchor="end" fill="#5a78a8"
                fontFamily="monospace" fontSize="6">14:28</text>

          <rect x="120" y="232" width="360" height="34" rx="6" fill="#1a2840" />
          <circle cx="138" cy="249" r="6" fill="#88a8d8" />
          <rect x="152" y="242" width="120" height="3" rx="1" fill="#a8c4e8" />
          <rect x="152" y="250" width="200" height="2" rx="1" fill="#5a78a8" />
          <rect x="152" y="256" width="160" height="2" rx="1" fill="#5a78a8" />
          <text x="468" y="248" textAnchor="end" fill="#5a78a8"
                fontFamily="monospace" fontSize="6">14:15</text>
        </g>
        {/* dock indicators bottom */}
        <g opacity="0.5">
          <circle cx="270" cy="298" r="3" fill="#a8c4e8" />
          <circle cx="285" cy="298" r="3" fill="#5a78a8" />
          <circle cx="300" cy="298" r="3" fill="#5a78a8" />
          <circle cx="315" cy="298" r="3" fill="#5a78a8" />
          <circle cx="330" cy="298" r="3" fill="#5a78a8" />
        </g>
        {/* home indicator */}
        <rect x="260" y="316" width="80" height="3" rx="1.5"
              fill="#a8c4e8" opacity="0.5" />

        {/* GLOSSY REFLECTIONS — multi layer */}
        <rect x="86" y="66" width="428" height="260" rx="11" fill="url(#gls-shine)" />
        <rect x="86" y="66" width="428" height="260" rx="11" fill="url(#gls-shine2)" opacity="0.85" />
        {/* corner light spot */}
        <ellipse cx="130" cy="90" rx="55" ry="22" fill="#a8c4e8" opacity="0.18" />
        <ellipse cx="120" cy="82" rx="22" ry="6" fill="#fff" opacity="0.35" />
        {/* fingerprint smudge — small, oily */}
        <ellipse cx="430" cy="280" rx="20" ry="14" fill="#a8c4e8" opacity="0.07" />
        <ellipse cx="430" cy="280" rx="14" ry="9" fill="#a8c4e8" opacity="0.06" />

        {/* glass edge highlight */}
        <rect x="86" y="66" width="428" height="260" rx="11"
              fill="none" stroke="#3a4858" strokeWidth="1" />
        <rect x="87" y="67" width="426" height="258" rx="10"
              fill="none" stroke="#a8c4e8" strokeWidth="0.4" opacity="0.35" />

        {/* IMPACT POINT GLOW — bloom under crack origin */}
        <circle cx="220" cy="100" r="38" fill="url(#gls-impact-glow)" />

        {/* THE CRACK — much more elaborate, fractal star pattern */}
        <g stroke="#cce0f8" fill="none" strokeLinecap="round">
          {/* main spine with kinks */}
          <path d="M 220 100 L 234 122 L 250 138 L 262 152 L 270 178 L 278 198 L 286 215 L 292 232 L 296 248 L 302 268"
                strokeWidth="1.4" opacity="0.95" />
          {/* dark inner shadow on main crack */}
          <path d="M 220 100 L 234 122 L 250 138 L 262 152 L 270 178 L 278 198 L 286 215 L 292 232 L 296 248 L 302 268"
                stroke="#000" strokeWidth="0.4" opacity="0.85" />

          {/* major branches */}
          <path d="M 250 138 L 226 158 L 210 178 L 198 200" strokeWidth="1" opacity="0.9" />
          <path d="M 250 138 L 280 142 L 308 144 L 336 146" strokeWidth="0.95" opacity="0.9" />
          <path d="M 270 178 L 240 200 L 220 220 L 204 240" strokeWidth="0.9" opacity="0.85" />
          <path d="M 270 178 L 300 184 L 326 188 L 348 188" strokeWidth="0.85" opacity="0.85" />
          <path d="M 286 215 L 322 226 L 354 232 L 384 234" strokeWidth="0.8" opacity="0.8" />
          <path d="M 286 215 L 264 240 L 248 264" strokeWidth="0.7" opacity="0.75" />
          <path d="M 296 248 L 274 274 L 258 296" strokeWidth="0.65" opacity="0.7" />
          <path d="M 296 248 L 326 268 L 354 282" strokeWidth="0.6" opacity="0.65" />
          <path d="M 302 268 L 282 296 L 268 314" strokeWidth="0.55" opacity="0.6" />
          <path d="M 302 268 L 332 290" strokeWidth="0.5" opacity="0.55" />

          {/* secondary tertiary cracks */}
          <path d="M 226 158 L 214 152" strokeWidth="0.4" opacity="0.55" />
          <path d="M 280 142 L 286 130" strokeWidth="0.4" opacity="0.55" />
          <path d="M 326 188 L 340 200" strokeWidth="0.4" opacity="0.55" />
          <path d="M 240 200 L 232 212" strokeWidth="0.4" opacity="0.55" />
          <path d="M 264 240 L 258 256" strokeWidth="0.4" opacity="0.5" />
          <path d="M 322 226 L 332 238" strokeWidth="0.4" opacity="0.5" />
          <path d="M 308 144 L 316 134" strokeWidth="0.35" opacity="0.45" />
          <path d="M 354 232 L 366 222" strokeWidth="0.35" opacity="0.45" />
          <path d="M 198 200 L 188 204" strokeWidth="0.35" opacity="0.45" />
          <path d="M 220 220 L 210 226" strokeWidth="0.35" opacity="0.45" />

          {/* concentric arc cracks (impact zone) */}
          <path d="M 200 118 Q 220 112 240 122" strokeWidth="0.5" opacity="0.55" />
          <path d="M 196 130 Q 224 124 254 138" strokeWidth="0.45" opacity="0.45" />
          <path d="M 192 144 Q 230 138 264 154" strokeWidth="0.4" opacity="0.4" />
        </g>

        {/* white-hot specular crack glints — sparkle highlights along main crack */}
        <g fill="#fff">
          <circle cx="234" cy="122" r="0.8" opacity="0.9" />
          <circle cx="262" cy="152" r="0.7" opacity="0.85" />
          <circle cx="278" cy="198" r="0.7" opacity="0.85" />
          <circle cx="292" cy="232" r="0.6" opacity="0.8" />
          <circle cx="280" cy="142" r="0.6" opacity="0.75" />
          <circle cx="240" cy="200" r="0.6" opacity="0.7" />
        </g>

        {/* IMPACT CRATER — much more detailed */}
        <g>
          {/* outer fracture rings */}
          <circle cx="220" cy="100" r="22" fill="none"
                  stroke="#a8c4e8" strokeWidth="0.3" opacity="0.25" />
          <circle cx="220" cy="100" r="16" fill="none"
                  stroke="#a8c4e8" strokeWidth="0.4" opacity="0.4" />
          <circle cx="220" cy="100" r="11" fill="none"
                  stroke="#cce0f8" strokeWidth="0.5" opacity="0.6" />

          {/* radial micro-cracks at impact — many */}
          {Array.from({length: 16}).map((_, i) => {
            const a = (i / 16) * Math.PI * 2;
            const len = 4 + (i%3) * 3;
            return (
              <line key={i}
                    x1={220 + Math.cos(a) * 5} y1={100 + Math.sin(a) * 5}
                    x2={220 + Math.cos(a) * (5 + len)} y2={100 + Math.sin(a) * (5 + len)}
                    stroke="#a8c4e8" strokeWidth="0.4" opacity="0.65" />
            );
          })}

          {/* crater walls — chips */}
          <circle cx="220" cy="100" r="7" fill="#000" opacity="0.85" />
          <circle cx="220" cy="100" r="5.5" fill="#0a0e18" />
          <path d="M 215 96 L 217 95 L 220 94 L 224 95 L 226 97 L 225 100 L 224 103 L 221 105 L 217 105 L 215 103 L 214 100 Z"
                fill="#1a2838" stroke="#000" strokeWidth="0.3" />
          {/* central dust/chip */}
          <circle cx="220" cy="100" r="2.5" fill="#cce0f8" opacity="0.95" />
          <circle cx="219" cy="99" r="1.2" fill="#fff" opacity="0.95" />
          {/* tiny glass dust around impact */}
          <circle cx="212" cy="94" r="0.5" fill="#fff" opacity="0.7" />
          <circle cx="228" cy="96" r="0.5" fill="#fff" opacity="0.7" />
          <circle cx="226" cy="108" r="0.4" fill="#fff" opacity="0.6" />
          <circle cx="214" cy="108" r="0.4" fill="#fff" opacity="0.6" />
          <circle cx="232" cy="102" r="0.3" fill="#fff" opacity="0.55" />
        </g>

        {/* model label — etched into bezel feel */}
        <g opacity="0.85">
          <text x="298" y="368" textAnchor="middle" fill="#5a78a8"
                fontFamily="monospace" fontSize="9"
                letterSpacing="1.5" fontWeight="700">VIAI-DISP-7 · GG VICTUS · 0.55mm</text>
        </g>

        <rect width="600" height="380" fill="url(#gls-vig)" />
      </svg>
    ),
  },
];

Object.assign(window, { PRODUCT_SCENES });
