/* the turn - per-species fish silhouettes (extends the kit's Icons.jsx set).
   Same idiom as the existing four: 2px line profiles, head-left / tail-right,
   distinct by body DEPTH + TAIL shape + one identifying mark. Not clipart.
   Covers all 13 Field-Guide species + a generic fallback.

   Marking vocabulary that carries recognition at chip size (~18px):
     fan / deep-fork / shallow-fork / rounded / filled tail
     spiky dorsal · spots · vertical bars · lateral stripe · blunt big head
*/
function FishIcon({ species, size = 22, color = 'currentColor', strokeWidth = 1.9 }) {
  const P = { fill: 'none', stroke: color, strokeWidth, strokeLinecap: 'round', strokeLinejoin: 'round' };
  const thin = { ...P, strokeWidth: 1.3 };
  const dot = { fill: color, stroke: 'none' };

  const FISH = {
    /* slender, fan tail, faint gill - the original kob profile */
    kob: <g {...P}>
      <path d="M2.5,12 C4.5,10.4 8,9.4 12,9.4 C15.5,9.4 18,11 19.4,12 C18,13 15.5,14.6 12,14.6 C8,14.6 4.5,13.6 2.5,12 Z" />
      <path d="M19.4,12 L22.6,9.4 L21,12 L22.6,14.6 Z" />
      <path d="M6,10.6 C5.3,11.4 5.3,12.6 6,13.4" {...thin} />
      <circle cx="4.7" cy="11.7" r="0.75" {...dot} />
    </g>,

    /* torpedo, deep-forked tail - predatory leervis */
    garrick: <g {...P}>
      <path d="M2,12 C5,11 9,10.4 12.6,10.4 C15.6,10.4 18,11.3 19,12 C18,12.7 15.6,13.6 12.6,13.6 C9,13.6 5,13 2,12 Z" />
      <path d="M19,12 L23,8.9 L21.2,12 L23,15.1 Z" />
      <path d="M2,12 L4,12.7" {...thin} />
      <circle cx="4.4" cy="11.8" r="0.65" {...dot} />
    </g>,

    /* deep body, spiky dorsal, spotted flank */
    grunter: <g {...P}>
      <path d="M3,12 C4.8,8.8 8,7.4 12,7.4 C15.3,7.4 18,9.6 19,12 C18,14.4 15.3,16.6 12,16.6 C8,16.6 4.8,15.2 3,12 Z" />
      <path d="M8,7.9 L9,6.4 L10,7.6 L11,6.3 L12,7.5" {...thin} />
      <path d="M19,12 L21.9,10 L21,12 L21.9,14 Z" />
      <circle cx="6.1" cy="11" r="0.75" {...dot} />
      <circle cx="11" cy="11" r="0.6" {...dot} />
      <circle cx="13.2" cy="13" r="0.6" {...dot} />
      <circle cx="9.4" cy="13.4" r="0.6" {...dot} />
    </g>,

    /* round disc, blunt - the national fish */
    galjoen: <g {...P}>
      <path d="M4.5,12 C4.5,7.8 7.8,5.8 11.5,5.8 C15,5.8 17.8,8.4 18.3,12 C17.8,15.6 15,18.2 11.5,18.2 C7.8,18.2 4.5,16.2 4.5,12 Z" />
      <path d="M18.3,12 L20.9,10.5 L20.1,12 L20.9,13.5 Z" />
      <circle cx="7.3" cy="10.7" r="0.75" {...dot} />
    </g>,

    /* slender-deep, pointed snout, forked tail, faint bars */
    steenbras: <g {...P}>
      <path d="M2.4,12 C5,9.8 9,8.9 12.4,8.9 C15.6,8.9 18,10.2 19,12 C18,13.8 15.6,15.1 12.4,15.1 C9,15.1 5,14.2 2.4,12 Z" />
      <path d="M19,12 L22.9,9.2 L21.3,12 L22.9,14.8 Z" />
      <path d="M8.5,10 L8.5,14" {...thin} />
      <path d="M11.5,9.6 L11.5,14.4" {...thin} />
      <circle cx="4.7" cy="11.8" r="0.65" {...dot} />
    </g>,

    /* streamlined, jutting jaw, single dorsal, forked tail - shad/elf */
    elf: <g {...P}>
      <path d="M2.6,11.6 C5,10.1 9,9.4 12.5,9.4 C15.8,9.4 18.2,10.6 19.2,12 C18.2,13.4 15.8,14.6 12.5,14.6 C9,14.6 5,13.8 2.8,12.6" />
      <path d="M2.6,11.6 L5.4,12.4 L2.8,12.6" {...thin} />
      <path d="M9,9.5 L10.1,8.2 L11.3,9.5" {...thin} />
      <path d="M19.2,12 L22.9,9.3 L21.3,12 L22.9,14.7 Z" />
      <circle cx="5.2" cy="11.4" r="0.65" {...dot} />
    </g>,

    /* deep oval, small blunt snout, forked tail - white stumpnose */
    stumpnose: <g {...P}>
      <path d="M3.2,12 C3.6,8.6 7,7 11.4,7 C14.8,7 17.6,9.2 18.6,12 C17.6,14.8 14.8,17 11.4,17 C7,17 3.6,15.4 3.2,12 Z" />
      <path d="M18.6,12 L22,9.6 L20.6,12 L22,14.4 Z" />
      <path d="M3.2,12 L5,12.5" {...thin} />
      <circle cx="6.5" cy="10.6" r="0.75" {...dot} />
    </g>,

    /* oval, lateral stripe, forked tail - cape stumpnose */
    capestumpnose: <g {...P}>
      <path d="M3,12 C4,8.8 7.6,7.4 11.6,7.4 C15,7.4 17.8,9.4 18.8,12 C17.8,14.6 15,16.6 11.6,16.6 C7.6,16.6 4,15.2 3,12 Z" />
      <path d="M6,12 L16,12" {...thin} />
      <path d="M18.8,12 L22,9.7 L20.7,12 L22,14.3 Z" />
      <circle cx="6.3" cy="10.7" r="0.7" {...dot} />
    </g>,

    /* deep oval, FILLED dark wedge tail - the namesake blacktail */
    blacktail: <g {...P}>
      <path d="M3,12 C3.6,8.7 7,7.2 11.2,7.2 C14.6,7.2 17.4,9.3 18.4,12 C17.4,14.7 14.6,16.8 11.2,16.8 C7,16.8 3.6,15.3 3,12 Z" />
      <path d="M18.4,12 L22,9.4 L22,14.6 Z" fill={color} stroke={color} strokeLinejoin="round" />
      <circle cx="6.3" cy="10.6" r="0.75" {...dot} />
    </g>,

    /* oval, blunt rounded head, ROUNDED paddle tail - hottentot */
    hottentot: <g {...P}>
      <path d="M3.4,12 C3.4,8.8 7,7.4 11,7.4 C14.4,7.4 17.2,9.4 18.2,12 C17.2,14.6 14.4,16.6 11,16.6 C7,16.6 3.4,15.2 3.4,12 Z" />
      <path d="M18.2,12 C20,10.9 21.4,11 22,11.3 C21.4,11.8 21.4,12.2 22,12.7 C21.4,13 20,13.1 18.2,12 Z" />
      <circle cx="6.7" cy="10.8" r="0.75" {...dot} />
    </g>,

    /* deep body, VERTICAL BARS, forked tail - zebra */
    zebra: <g {...P}>
      <path d="M3,12 C3.6,8.4 7,6.8 11.2,6.8 C14.8,6.8 17.6,9 18.6,12 C17.6,15 14.8,17.2 11.2,17.2 C7,17.2 3.6,15.6 3,12 Z" />
      <path d="M8,8 L8,16" {...thin} />
      <path d="M11,7.2 L11,16.8" {...thin} />
      <path d="M14,7.8 L14,16.2" {...thin} />
      <path d="M18.6,12 L22,9.4 L20.6,12 L22,14.6 Z" />
      <circle cx="5.9" cy="10.5" r="0.65" {...dot} />
    </g>,

    /* deep round body, shallow tail - bronze bream */
    bronze: <g {...P}>
      <path d="M3.2,12 C3.4,8.5 7,6.9 11.3,6.9 C14.9,6.9 17.7,9.1 18.6,12 C17.7,14.9 14.9,17.1 11.3,17.1 C7,17.1 3.4,15.5 3.2,12 Z" />
      <path d="M18.6,12 L22,10 L21,12 L22,14 Z" />
      <path d="M6,9.6 C5.4,10.6 5.4,13.4 6,14.4" {...thin} />
      <circle cx="6.6" cy="10.6" r="0.75" {...dot} />
    </g>,

    /* robust, big blunt head + thick lips, forked tail - white musselcracker */
    musselcracker: <g {...P}>
      <path d="M2.8,12 C2.8,8.4 6.4,6.8 10.8,6.8 C14.6,6.8 17.6,9 18.8,12 C17.6,15 14.6,17.2 10.8,17.2 C6.4,17.2 2.8,15.6 2.8,12 Z" />
      <path d="M2.8,12 L5.4,12.9" {...thin} />
      <path d="M3.4,11 L5.6,11.5" {...thin} />
      <path d="M18.8,12 L22.4,9.2 L20.9,12 L22.4,14.8 Z" />
      <circle cx="6.8" cy="10.3" r="0.85" {...dot} />
    </g>,

    /* generic fallback */
    other: <g {...P}>
      <path d="M3,12 C5,9.6 9,8.6 12.5,8.6 C16,8.6 18.5,10.5 20,12 C18.5,13.5 16,15.4 12.5,15.4 C9,15.4 5,14.4 3,12 Z" />
      <path d="M20,12 L23,9.5 L21.5,12 L23,14.5 Z" />
      <circle cx="5.3" cy="11.4" r="0.7" {...dot} />
    </g>,
  };

  // Compound regulation slugs ('leervis-garrick', 'dusky-kob', 'elf-shad')
  // contain the short key the FISH map keys on. Try the full slug first,
  // then each hyphen-split part, then fall back.
  const tryKey = (k) => k && FISH[k];
  const resolved =
    tryKey(species) ||
    (typeof species === 'string' && species.split('-').reduce((acc, part) => acc || tryKey(part), null)) ||
    FISH.other;

  return (
    <svg width={size} height={size} viewBox="0 0 24 24" aria-hidden="true" style={{ display: 'block', overflow: 'visible' }}>
      {resolved}
    </svg>
  );
}
