// CarisExpressions.jsx — Character expression sheet for Caris.
// One default-export React component renders a 5×2 grid of 10 standalone SVG poses.
// Same silhouette across all poses: chibi pony, oversized head, rose-palette body,
// meadow-green iris, flower-in-mane, small triangular ears. Only emotion + body language change.

/* ============================================================
   SHARED SVG HELPERS (each pose self-contains its <defs> so the
   resulting SVG is extractable as a standalone file).
   ============================================================ */

const CarisDefs = ({ id }) => (
  <defs>
    <radialGradient id={`${id}-body`} cx="38%" cy="30%" r="82%">
      <stop offset="0%" stopColor="#FFF4F8" />
      <stop offset="55%" stopColor="#FBCBDD" />
      <stop offset="100%" stopColor="#BD5D82" />
    </radialGradient>
    <linearGradient id={`${id}-mane1`} x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" stopColor="#FDE2EC" />
      <stop offset="100%" stopColor="#C2658A" />
    </linearGradient>
    <linearGradient id={`${id}-mane2`} x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" stopColor="#C5DCB6" />
      <stop offset="100%" stopColor="#5C8C52" />
    </linearGradient>
    <radialGradient id={`${id}-flower`} cx="40%" cy="40%">
      <stop offset="0%" stopColor="#FFE7EE" />
      <stop offset="100%" stopColor="#E07AA0" />
    </radialGradient>
    <radialGradient id={`${id}-cheek`} cx="50%" cy="50%" r="50%">
      <stop offset="0%" stopColor="#FF5C8F" stopOpacity="0.65" />
      <stop offset="100%" stopColor="#FF5C8F" stopOpacity="0" />
    </radialGradient>
    <linearGradient id={`${id}-rim`} x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" stopColor="#FFFFFF" stopOpacity="0.6" />
      <stop offset="100%" stopColor="#FFFFFF" stopOpacity="0" />
    </linearGradient>
    <filter id={`${id}-blur`} x="-30%" y="-30%" width="160%" height="160%">
      <feGaussianBlur stdDeviation="4" />
    </filter>
  </defs>
);

const Shadow = ({ id, rx = 56, cy = 206, op = 0.22 }) => (
  <ellipse cx="100" cy={cy} rx={rx} ry="6" fill="#2C2B36" opacity={op} filter={`url(#${id}-blur)`} />
);

const ManeBack = ({ id }) => (
  <g>
    <path d="M40 102 Q22 78 32 50 Q44 36 56 56 Q46 72 58 86 Q44 94 54 112 Q38 126 56 142 Z" fill={`url(#${id}-mane1)`} />
    <path d="M48 60 Q50 40 70 36 Q66 56 70 70 Z" fill={`url(#${id}-mane2)`} />
    <path d="M36 118 Q28 134 50 144 Q42 126 50 112 Z" fill={`url(#${id}-mane2)`} />
    <path d="M148 96 Q166 84 162 60 Q150 50 144 70 Q150 80 140 90 Z" fill={`url(#${id}-mane1)`} />
    <path d="M156 76 Q166 64 158 50 Q150 60 152 74 Z" fill={`url(#${id}-mane2)`} />
  </g>
);

const Body = ({ id, transform }) => (
  <g transform={transform}>
    <ellipse cx="100" cy="178" rx="46" ry="32" fill={`url(#${id}-body)`} />
    <ellipse cx="100" cy="184" rx="28" ry="18" fill="#FFF4F8" opacity="0.75" />
  </g>
);

const Hoof = ({ cx, cy = 202 }) => (
  <g>
    <ellipse cx={cx} cy={cy} rx="10" ry="6" fill="#BD5D82" />
    <ellipse cx={cx} cy={cy} rx="7" ry="2.5" fill="#FBD8E3" opacity="0.65" />
  </g>
);

const HeadBase = ({ id, transform, headY = 108 }) => (
  <g transform={transform}>
    <ellipse cx="100" cy={headY} rx="64" ry="62" fill={`url(#${id}-body)`} />
    <ellipse cx="72" cy={headY - 34} rx="32" ry="18" fill={`url(#${id}-rim)`} />
    {/* forelock */}
    <path d="M62 64 Q52 40 78 36 Q72 56 92 60 Q78 70 62 64 Z" fill={`url(#${id}-mane1)`} />
    <path d="M86 56 Q88 32 104 32 Q102 48 112 60 Q92 64 86 56 Z" fill={`url(#${id}-mane2)`} />
    <path d="M110 56 Q120 36 138 46 Q128 62 130 72 Q114 68 110 56 Z" fill={`url(#${id}-mane1)`} />
    <circle cx="78" cy="48" r="8" fill="#FDE2EC" />
    <circle cx="124" cy="46" r="7" fill="#C5DCB6" />
    {/* flower */}
    <g transform="translate(100 46)">
      <ellipse cx="0" cy="-9" rx="6" ry="9" fill={`url(#${id}-flower)`} />
      <ellipse cx="0" cy="-9" rx="6" ry="9" fill={`url(#${id}-flower)`} transform="rotate(72)" />
      <ellipse cx="0" cy="-9" rx="6" ry="9" fill={`url(#${id}-flower)`} transform="rotate(144)" />
      <ellipse cx="0" cy="-9" rx="6" ry="9" fill={`url(#${id}-flower)`} transform="rotate(216)" />
      <ellipse cx="0" cy="-9" rx="6" ry="9" fill={`url(#${id}-flower)`} transform="rotate(288)" />
      <circle cx="0" cy="0" r="4.5" fill="#E8B651" />
      <circle cx="-1" cy="-1" r="2" fill="#FBEACA" />
      <path d="M6 4 Q14 6 16 0 Q10 -2 6 4 Z" fill="#7AA66F" />
    </g>
  </g>
);

const EarsRelaxed = ({ id }) => (
  <g>
    <path d="M58 76 Q54 58 70 66 Q68 76 60 78 Z" fill={`url(#${id}-body)`} />
    <path d="M142 76 Q146 58 130 66 Q132 76 140 78 Z" fill={`url(#${id}-body)`} />
    <path d="M62 74 Q62 64 68 70 Q66 74 62 74 Z" fill="#E29CB6" />
    <path d="M138 74 Q138 64 132 70 Q134 74 138 74 Z" fill="#E29CB6" />
  </g>
);

const Cheeks = ({ id, lx = 60, rx = 140, cy = 142, r = 13 }) => (
  <g>
    <circle cx={lx} cy={cy} r={r} fill={`url(#${id}-cheek)`} />
    <circle cx={rx} cy={cy} r={r} fill={`url(#${id}-cheek)`} />
  </g>
);

const Nose = ({ cx = 100, cy = 150, rx = 4.5, ry = 3 }) => (
  <ellipse cx={cx} cy={cy} rx={rx} ry={ry} fill="#A04060" />
);

/* ============================================================
   EYE VARIANTS
   ============================================================ */

// Standard sparkly eye — used for idle/encouraging
const EyeOpen = ({ cx, cy, irisDx = 0, irisDy = 2, pupilDx = 0, pupilDy = 4 }) => (
  <g>
    <ellipse cx={cx} cy={cy} rx="13" ry="16" fill="#2C2B36" />
    <ellipse cx={cx + irisDx} cy={cy + irisDy} rx="8" ry="9" fill="#7AA66F" />
    <ellipse cx={cx + irisDx} cy={cy + irisDy - 2} rx="7" ry="5.5" fill="#9DC489" opacity="0.6" />
    <ellipse cx={cx + pupilDx} cy={cy + pupilDy} rx="3" ry="4" fill="#2C2B36" />
    <ellipse cx={cx + 4} cy={cy - 6} rx="4.5" ry="5.5" fill="#FFFFFF" />
    <circle cx={cx - 5} cy={cy + 4} r="1.6" fill="#FFFFFF" />
  </g>
);

// Wide eye (surprised)
const EyeWide = ({ cx, cy }) => (
  <g>
    <ellipse cx={cx} cy={cy} rx="14" ry="18" fill="#2C2B36" />
    <ellipse cx={cx} cy={cy + 1} rx="9" ry="11" fill="#7AA66F" />
    <ellipse cx={cx} cy={cy + 2} rx="3.4" ry="4.5" fill="#2C2B36" />
    <ellipse cx={cx + 5} cy={cy - 7} rx="5" ry="6" fill="#FFFFFF" />
    <circle cx={cx - 5} cy={cy + 5} r="1.8" fill="#FFFFFF" />
  </g>
);

// Squinted happy ^^
const EyeSquint = ({ cx, cy, dir = 1 }) => (
  // dir 1 = right eye (curves down-right), -1 = left eye
  <path
    d={`M${cx - 11} ${cy + 2} Q${cx} ${cy - 12} ${cx + 11} ${cy + 2}`}
    stroke="#2C2B36"
    strokeWidth="3.4"
    strokeLinecap="round"
    fill="none"
  />
);

// Half-closed sleepy (lid drawn over top, iris still visible)
const EyeSleepy = ({ cx, cy }) => (
  <g>
    {/* lower lashes shape */}
    <path d={`M${cx - 12} ${cy + 1} Q${cx} ${cy + 10} ${cx + 12} ${cy + 1}`} stroke="#2C2B36" strokeWidth="2.4" fill="none" strokeLinecap="round" />
    {/* upper lid drawn over */}
    <path
      d={`M${cx - 13} ${cy + 1} Q${cx - 12} ${cy - 4} ${cx} ${cy - 5} Q${cx + 12} ${cy - 4} ${cx + 13} ${cy + 1} Z`}
      fill="#2C2B36"
    />
    {/* tiny iris peeking */}
    <ellipse cx={cx} cy={cy + 1} rx="4" ry="2" fill="#7AA66F" opacity="0.85" />
  </g>
);

// Half-closed smug (proud / mischievous)
const EyeSmug = ({ cx, cy, dir = 1 }) => (
  <g>
    {/* lid path - curving */}
    <path
      d={`M${cx - 13} ${cy - 2} Q${cx} ${cy - 8} ${cx + 13} ${cy - 2} Q${cx + 12} ${cy + 3} ${cx} ${cy + 4} Q${cx - 12} ${cy + 3} ${cx - 13} ${cy - 2} Z`}
      fill="#2C2B36"
    />
    {/* iris */}
    <ellipse cx={cx + dir * 2} cy={cy} rx="5" ry="3" fill="#7AA66F" />
    <ellipse cx={cx + dir * 2} cy={cy + 1} rx="2" ry="1.6" fill="#2C2B36" />
    {/* highlight */}
    <circle cx={cx + dir * 2 + 1.5} cy={cy - 1} r="1.2" fill="#FFFFFF" />
  </g>
);

// Narrowed focused (determined) — thinner ellipse, V-shaped brow drawn separately
const EyeFocused = ({ cx, cy }) => (
  <g>
    <ellipse cx={cx} cy={cy + 1} rx="11" ry="9" fill="#2C2B36" />
    <ellipse cx={cx} cy={cy + 2} rx="6" ry="5" fill="#7AA66F" />
    <ellipse cx={cx} cy={cy + 3} rx="2.5" ry="3" fill="#2C2B36" />
    <ellipse cx={cx + 4} cy={cy - 3} rx="3.5" ry="3.5" fill="#FFFFFF" />
  </g>
);

// Looking-up eye (thinking) — iris offset up
const EyeLookUp = ({ cx, cy }) => (
  <g>
    <ellipse cx={cx} cy={cy} rx="13" ry="16" fill="#2C2B36" />
    <ellipse cx={cx} cy={cy - 4} rx="8" ry="9" fill="#7AA66F" />
    <ellipse cx={cx} cy={cy - 4} rx="7" ry="5.5" fill="#9DC489" opacity="0.6" />
    <ellipse cx={cx} cy={cy - 4} rx="3" ry="4" fill="#2C2B36" />
    <ellipse cx={cx + 4} cy={cy - 9} rx="4.5" ry="5" fill="#FFFFFF" />
  </g>
);

// Lashes around an eye (top fan)
const Lashes = ({ cx, cy }) => (
  <g stroke="#2C2B36" strokeWidth="1.8" strokeLinecap="round" fill="none">
    <path d={`M${cx - 10} ${cy - 10} L${cx - 14} ${cy - 15}`} />
    <path d={`M${cx - 5} ${cy - 14} L${cx - 4} ${cy - 20}`} />
    <path d={`M${cx + 10} ${cy - 10} L${cx + 14} ${cy - 15}`} />
    <path d={`M${cx + 5} ${cy - 14} L${cx + 4} ${cy - 20}`} />
  </g>
);

/* ============================================================
   MOUTH VARIANTS
   ============================================================ */

const MouthSmile = () => (
  <g>
    <path d="M100 153 Q95 158 90 155" stroke="#2C2B36" strokeWidth="1.8" fill="none" strokeLinecap="round" />
    <path d="M100 153 Q105 158 110 155" stroke="#2C2B36" strokeWidth="1.8" fill="none" strokeLinecap="round" />
  </g>
);

const MouthOpenSmile = () => (
  <g>
    <path d="M88 154 Q100 168 112 154 Q108 156 100 156 Q92 156 88 154 Z" fill="#8C3A5C" />
    <path d="M92 156 Q100 162 108 156" stroke="#5C1E3A" strokeWidth="0.8" fill="none" />
    {/* tongue */}
    <ellipse cx="100" cy="161" rx="4" ry="2.5" fill="#E07AA0" />
  </g>
);

const MouthO = ({ cy = 156, ry = 4 }) => (
  <ellipse cx="100" cy={cy} rx="3.5" ry={ry} fill="#5C1E3A" />
);

const MouthYawn = () => (
  <g>
    <ellipse cx="100" cy="158" rx="5" ry="6.5" fill="#5C1E3A" />
    <ellipse cx="100" cy="161" rx="3" ry="2" fill="#E07AA0" />
  </g>
);

const MouthSly = () => (
  <g>
    {/* asymmetric — left corner up higher */}
    <path d="M88 154 Q94 152 100 154 Q108 158 112 153" stroke="#2C2B36" strokeWidth="2" fill="none" strokeLinecap="round" />
    {/* small fang glint */}
    <rect x="105" y="154" width="2" height="2.5" rx="0.5" fill="#FFFFFF" />
  </g>
);

const MouthSet = () => (
  /* determined — small straight set line */
  <path d="M93 156 Q100 157 107 156" stroke="#2C2B36" strokeWidth="2" fill="none" strokeLinecap="round" />
);

const MouthGentleSmile = () => (
  <path d="M91 154 Q100 161 109 154" stroke="#2C2B36" strokeWidth="1.8" fill="none" strokeLinecap="round" />
);

/* ============================================================
   BROW VARIANTS
   ============================================================ */

const BrowNeutral = () => null;

const BrowFurrowed = () => (
  <g stroke="#8C3A5C" strokeWidth="2.5" strokeLinecap="round" fill="none">
    <path d="M68 90 Q76 88 86 92" />
    <path d="M132 90 Q124 88 114 92" />
  </g>
);

// V-shaped angry/determined
const BrowDetermined = () => (
  <g stroke="#5C1E3A" strokeWidth="2.6" strokeLinecap="round" fill="none">
    <path d="M66 94 L88 90" />
    <path d="M134 94 L112 90" />
  </g>
);

// One raised (mischievous)
const BrowMisch = () => (
  <g stroke="#5C1E3A" strokeWidth="2.4" strokeLinecap="round" fill="none">
    <path d="M68 92 Q76 90 86 92" />
    <path d="M130 84 Q124 80 114 86" />
  </g>
);

/* ============================================================
   POSE 01 — IDLE
   ============================================================ */

const PoseIdle = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — idle">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    <Hoof cx={80} />
    <Hoof cx={120} />
    <HeadBase id={id} />
    <EarsRelaxed id={id} />
    <EyeOpen cx={78} cy={116} />
    <EyeOpen cx={122} cy={116} />
    <Lashes cx={78} cy={116} />
    <Lashes cx={122} cy={116} />
    <Cheeks id={id} />
    <Nose />
    <MouthSmile />
  </svg>
);

/* ============================================================
   POSE 02 — CURIOUS  (head tilt, one ear perked, head turned slightly)
   ============================================================ */

const PoseCurious = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — curious">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    <Hoof cx={80} />
    <Hoof cx={120} />
    {/* tilted head wraps base + ears + face features */}
    <g transform="rotate(-12 100 130)">
      <HeadBase id={id} />
      {/* RIGHT ear perked tall (the kid's left from viewer angle becomes perked on rotated head) */}
      <g>
        {/* left ear normal */}
        <path d="M58 76 Q54 58 70 66 Q68 76 60 78 Z" fill={`url(#${id}-body)`} />
        <path d="M62 74 Q62 64 68 70 Q66 74 62 74 Z" fill="#E29CB6" />
        {/* right ear PERKED tall */}
        <path d="M138 70 Q138 38 148 42 Q150 60 144 76 Z" fill={`url(#${id}-body)`} />
        <path d="M141 64 Q141 46 146 50 Q146 62 143 70 Z" fill="#E29CB6" />
      </g>
      {/* Wide eyes looking up-right */}
      <g>
        <ellipse cx="78" cy="118" rx="13" ry="16" fill="#2C2B36" />
        <ellipse cx="122" cy="118" rx="13" ry="16" fill="#2C2B36" />
        <ellipse cx="82" cy="118" rx="8" ry="9" fill="#7AA66F" />
        <ellipse cx="126" cy="118" rx="8" ry="9" fill="#7AA66F" />
        <ellipse cx="82" cy="118" rx="3" ry="4" fill="#2C2B36" />
        <ellipse cx="126" cy="118" rx="3" ry="4" fill="#2C2B36" />
        <ellipse cx="85" cy="112" rx="4.5" ry="5.5" fill="#FFFFFF" />
        <ellipse cx="129" cy="112" rx="4.5" ry="5.5" fill="#FFFFFF" />
        <circle cx="74" cy="120" r="1.5" fill="#FFFFFF" />
        <circle cx="118" cy="120" r="1.5" fill="#FFFFFF" />
      </g>
      <Lashes cx={78} cy={116} />
      <Lashes cx={122} cy={116} />
      <Cheeks id={id} />
      <Nose />
      <MouthO cy={155} ry={3.5} />
    </g>
    {/* curious "?" sparkle */}
    <g transform="translate(168 42)" className="anim-shimmer-soft">
      <circle cx="0" cy="0" r="11" fill="#FFF4F8" stroke="#D87093" strokeWidth="2" />
      <text x="0" y="5" textAnchor="middle" fontFamily="Fredoka, sans-serif" fontWeight="700" fontSize="14" fill="#8C3A5C">?</text>
    </g>
  </svg>
);

/* ============================================================
   POSE 03 — THINKING  (hoof to chin, looking up, slight furrow)
   ============================================================ */

const PoseThinking = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — thinking">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    <Hoof cx={80} />
    {/* RIGHT hoof raised to chin */}
    <g>
      <ellipse cx="116" cy="172" rx="5" ry="8" fill="#BD5D82" transform="rotate(-30 116 172)" />
      <ellipse cx="110" cy="160" rx="7" ry="5" fill="#BD5D82" />
      <ellipse cx="110" cy="160" rx="5" ry="2.5" fill="#FBD8E3" opacity="0.65" />
    </g>
    <HeadBase id={id} />
    <EarsRelaxed id={id} />
    {/* Eyes looking up */}
    <EyeLookUp cx={78} cy={116} />
    <EyeLookUp cx={122} cy={116} />
    <Lashes cx={78} cy={116} />
    <Lashes cx={122} cy={116} />
    {/* gentle furrow brow */}
    <BrowFurrowed />
    <Cheeks id={id} />
    <Nose />
    {/* small pursed mouth */}
    <path d="M93 156 Q100 160 107 156" stroke="#2C2B36" strokeWidth="1.8" fill="none" strokeLinecap="round" />
    {/* thought dots above */}
    <g fill="#D87093" opacity="0.85">
      <circle cx="156" cy="46" r="2.5" />
      <circle cx="164" cy="36" r="4" />
      <circle cx="176" cy="22" r="6" />
    </g>
  </svg>
);

/* ============================================================
   POSE 04 — ENCOURAGING  (leaning forward, hoof extended, warm smile)
   ============================================================ */

const PoseEncouraging = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — encouraging">
    <CarisDefs id={id} />
    <Shadow id={id} rx={62} />
    <ManeBack id={id} />
    {/* slight forward body tilt */}
    <g transform="rotate(4 100 178)">
      <Body id={id} />
    </g>
    <Hoof cx={84} />
    {/* RIGHT hoof extended outward */}
    <g>
      <ellipse cx="142" cy="180" rx="7" ry="5" fill="#BD5D82" transform="rotate(20 142 180)" />
      <ellipse cx="152" cy="182" rx="9" ry="6" fill="#BD5D82" />
      <ellipse cx="152" cy="182" rx="6" ry="2.8" fill="#FBD8E3" opacity="0.7" />
      {/* hoof "you got this" wave lines */}
      <path d="M164 178 L170 175" stroke="#D87093" strokeWidth="1.6" strokeLinecap="round" opacity="0.7" />
      <path d="M165 184 L172 186" stroke="#D87093" strokeWidth="1.6" strokeLinecap="round" opacity="0.7" />
    </g>
    {/* head leans slightly forward */}
    <g transform="rotate(3 100 108)">
      <HeadBase id={id} />
      <EarsRelaxed id={id} />
      <EyeOpen cx={78} cy={116} />
      <EyeOpen cx={122} cy={116} />
      <Lashes cx={78} cy={116} />
      <Lashes cx={122} cy={116} />
      <Cheeks id={id} />
      <Nose />
      <MouthGentleSmile />
      {/* tiny tooth */}
      <rect x="98.5" y="156" width="3" height="3" rx="0.6" fill="#FFFFFF" />
    </g>
    {/* warm sparkle near extended hoof */}
    <g fill="#E8B651">
      <path d="M174 168 L175 171 L178 172 L175 173 L174 176 L173 173 L170 172 L173 171 Z" />
    </g>
  </svg>
);

/* ============================================================
   POSE 05 — CHEERING  (bouncing, both arms up, eyes squinted joy)
   ============================================================ */

const PoseCheering = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — cheering">
    <CarisDefs id={id} />
    {/* dust motion at base */}
    <Shadow id={id} rx={40} cy={210} op={0.16} />
    {/* dust puffs */}
    <g fill="#FFFFFF" opacity="0.6">
      <ellipse cx="64" cy="208" rx="6" ry="2" />
      <ellipse cx="136" cy="208" rx="6" ry="2" />
    </g>
    <g transform="translate(0 -10)">
      <ManeBack id={id} />
      <Body id={id} />
      {/* hooves up high */}
      <g>
        {/* arm L raised */}
        <path d="M62 162 Q52 130 50 116 Q56 112 64 130 Q72 152 70 168 Z" fill={`url(#${id}-body)`} />
        <ellipse cx="50" cy="114" rx="9" ry="6" fill="#BD5D82" />
        <ellipse cx="50" cy="114" rx="6" ry="2.8" fill="#FBD8E3" opacity="0.7" />
        {/* arm R raised */}
        <path d="M138 162 Q148 130 150 116 Q144 112 136 130 Q128 152 130 168 Z" fill={`url(#${id}-body)`} />
        <ellipse cx="150" cy="114" rx="9" ry="6" fill="#BD5D82" />
        <ellipse cx="150" cy="114" rx="6" ry="2.8" fill="#FBD8E3" opacity="0.7" />
      </g>
      {/* tucked legs (bouncing) */}
      <ellipse cx="82" cy="206" rx="9" ry="5" fill="#BD5D82" />
      <ellipse cx="118" cy="206" rx="9" ry="5" fill="#BD5D82" />
      <HeadBase id={id} />
      <EarsRelaxed id={id} />
      {/* eyes squinted ^^ */}
      <EyeSquint cx={78} cy={118} />
      <EyeSquint cx={122} cy={118} />
      <Cheeks id={id} lx={56} rx={144} cy={138} r={14} />
      <Nose />
      <MouthOpenSmile />
    </g>
    {/* floating hearts + sparkles */}
    <g>
      <path d="M30 56 Q26 50 30 46 Q34 44 34 49 Q34 44 38 46 Q42 50 38 56 Q34 60 30 56 Z" fill="#E29CB6" />
      <path d="M170 60 Q166 54 170 50 Q174 48 174 53 Q174 48 178 50 Q182 54 178 60 Q174 64 170 60 Z" fill="#7AA66F" opacity="0.85" />
    </g>
    <g fill="#E8B651">
      <path d="M22 30 L23 34 L27 35 L23 36 L22 40 L21 36 L17 35 L21 34 Z" />
      <path d="M178 32 L179 36 L183 37 L179 38 L178 42 L177 38 L173 37 L177 36 Z" />
      <path d="M100 18 L101 22 L105 23 L101 24 L100 28 L99 24 L95 23 L99 22 Z" />
    </g>
  </svg>
);

/* ============================================================
   POSE 06 — SURPRISED  (ears straight up, eyes very wide, mouth O)
   ============================================================ */

const PoseSurprised = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — surprised">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    {/* hooves up at chest level */}
    <g>
      <ellipse cx="64" cy="160" rx="8" ry="5" fill="#BD5D82" transform="rotate(-10 64 160)" />
      <ellipse cx="64" cy="160" rx="5" ry="2.5" fill="#FBD8E3" opacity="0.7" />
      <ellipse cx="136" cy="160" rx="8" ry="5" fill="#BD5D82" transform="rotate(10 136 160)" />
      <ellipse cx="136" cy="160" rx="5" ry="2.5" fill="#FBD8E3" opacity="0.7" />
    </g>
    <Hoof cx={84} cy={206} />
    <Hoof cx={116} cy={206} />
    <HeadBase id={id} />
    {/* EARS STRAIGHT UP */}
    <g>
      <path d="M58 70 Q54 36 64 32 Q72 48 70 76 Z" fill={`url(#${id}-body)`} />
      <path d="M142 70 Q146 36 136 32 Q128 48 130 76 Z" fill={`url(#${id}-body)`} />
      <path d="M61 64 Q60 42 65 40 Q68 52 66 70 Z" fill="#E29CB6" />
      <path d="M139 64 Q140 42 135 40 Q132 52 134 70 Z" fill="#E29CB6" />
    </g>
    {/* WIDE eyes */}
    <EyeWide cx={78} cy={116} />
    <EyeWide cx={122} cy={116} />
    <Lashes cx={78} cy={116} />
    <Lashes cx={122} cy={116} />
    {/* small raised brow */}
    <g stroke="#5C1E3A" strokeWidth="2.4" strokeLinecap="round" fill="none">
      <path d="M66 88 Q76 84 86 88" />
      <path d="M134 88 Q124 84 114 88" />
    </g>
    <Cheeks id={id} />
    <Nose />
    {/* mouth small O */}
    <ellipse cx="100" cy="156" rx="3.5" ry="4.5" fill="#5C1E3A" />
    {/* surprise "!" sparkle */}
    <g transform="translate(168 40)" className="anim-shimmer-soft">
      <path d="M0 0 L2 14 L-2 14 Z" fill="#E8B651" />
      <circle cx="0" cy="18" r="2" fill="#E8B651" />
    </g>
    {/* burst marks */}
    <g stroke="#D87093" strokeWidth="2" strokeLinecap="round" fill="none">
      <path d="M40 36 L46 42" />
      <path d="M26 60 L34 60" />
      <path d="M154 40 L148 46" />
    </g>
  </svg>
);

/* ============================================================
   POSE 07 — PROUD  (chest up, hooves on hips/sides, confident smile)
   ============================================================ */

const PoseProud = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — proud">
    <CarisDefs id={id} />
    <Shadow id={id} rx={60} />
    <ManeBack id={id} />
    {/* body — chest puffed slightly back */}
    <g transform="rotate(-3 100 178)">
      <Body id={id} />
    </g>
    {/* hooves on hips — angled inward */}
    <g>
      {/* L arm bent on hip */}
      <path d="M58 156 Q52 168 58 184 Q64 178 68 168 Q66 162 60 156 Z" fill={`url(#${id}-body)`} />
      <ellipse cx="58" cy="184" rx="7" ry="4.5" fill="#BD5D82" />
      <ellipse cx="58" cy="184" rx="4.5" ry="2.2" fill="#FBD8E3" opacity="0.7" />
      {/* R arm bent on hip */}
      <path d="M142 156 Q148 168 142 184 Q136 178 132 168 Q134 162 140 156 Z" fill={`url(#${id}-body)`} />
      <ellipse cx="142" cy="184" rx="7" ry="4.5" fill="#BD5D82" />
      <ellipse cx="142" cy="184" rx="4.5" ry="2.2" fill="#FBD8E3" opacity="0.7" />
    </g>
    <Hoof cx={82} cy={206} />
    <Hoof cx={118} cy={206} />
    {/* head leaning slightly back */}
    <g transform="rotate(-5 100 108)">
      <HeadBase id={id} />
      <EarsRelaxed id={id} />
      {/* smug half-closed eyes */}
      <EyeSmug cx={78} cy={117} />
      <EyeSmug cx={122} cy={117} />
      <Cheeks id={id} />
      <Nose />
      {/* confident closed smile */}
      <path d="M91 155 Q100 161 109 155" stroke="#2C2B36" strokeWidth="2" fill="none" strokeLinecap="round" />
    </g>
    {/* tiny medal sparkle */}
    <g transform="translate(36 50)">
      <circle cx="0" cy="0" r="9" fill="#E8B651" stroke="#8E6722" strokeWidth="1.2" />
      <circle cx="0" cy="0" r="5" fill="#FBEACA" />
      <text x="0" y="3" textAnchor="middle" fontFamily="Fredoka, sans-serif" fontWeight="700" fontSize="9" fill="#8E6722">★</text>
      <path d="M-5 8 L-7 16 L0 13 L7 16 L5 8" fill="#D87093" />
    </g>
  </svg>
);

/* ============================================================
   POSE 08 — SLEEPY  (head drooped, half eyes, yawn, hoof to mouth)
   ============================================================ */

const PoseSleepy = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — sleepy">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    <Hoof cx={80} />
    {/* hoof to mouth */}
    <g>
      <path d="M118 158 Q124 144 130 134 Q136 138 132 148 Q128 158 122 168 Z" fill={`url(#${id}-body)`} />
      <ellipse cx="128" cy="138" rx="7" ry="5" fill="#BD5D82" transform="rotate(-25 128 138)" />
      <ellipse cx="128" cy="138" rx="4.5" ry="2.5" fill="#FBD8E3" opacity="0.7" transform="rotate(-25 128 138)" />
    </g>
    {/* head slightly drooped */}
    <g transform="translate(0 4) rotate(5 100 112)">
      <HeadBase id={id} headY={108} />
      {/* ears drooped slightly */}
      <g>
        <path d="M58 78 Q56 92 70 92 Q70 82 62 78 Z" fill={`url(#${id}-body)`} />
        <path d="M142 78 Q144 92 130 92 Q130 82 138 78 Z" fill={`url(#${id}-body)`} />
        <path d="M62 82 Q62 88 68 88 Q66 84 62 82 Z" fill="#E29CB6" />
        <path d="M138 82 Q138 88 132 88 Q134 84 138 82 Z" fill="#E29CB6" />
      </g>
      <EyeSleepy cx={78} cy={118} />
      <EyeSleepy cx={122} cy={118} />
      <Cheeks id={id} />
      <Nose />
      <MouthYawn />
    </g>
    {/* floating Zs */}
    <g fill="#7AA66F" opacity="0.85" fontFamily="Fredoka, sans-serif" fontWeight="700">
      <text x="158" y="64" fontSize="22" fill="#D87093">Z</text>
      <text x="178" y="46" fontSize="16" fill="#D87093" opacity="0.7">Z</text>
      <text x="190" y="32" fontSize="11" fill="#D87093" opacity="0.5">z</text>
    </g>
  </svg>
);

/* ============================================================
   POSE 09 — DETERMINED  (focused eyes, V brow, fist hoof, slight lean)
   ============================================================ */

const PoseDetermined = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — determined">
    <CarisDefs id={id} />
    <Shadow id={id} rx={58} />
    <ManeBack id={id} />
    {/* slight forward lean */}
    <g transform="rotate(3 100 178)">
      <Body id={id} />
    </g>
    <Hoof cx={80} />
    {/* RIGHT hoof in raised fist */}
    <g>
      <path d="M120 168 Q126 154 128 142 Q134 144 132 156 Q130 166 128 174 Z" fill={`url(#${id}-body)`} />
      {/* fist */}
      <circle cx="128" cy="138" r="8" fill="#BD5D82" />
      <circle cx="128" cy="138" r="5.5" fill="#FBD8E3" opacity="0.55" />
      {/* knuckle line */}
      <path d="M124 134 L132 134" stroke="#8C3A5C" strokeWidth="1" opacity="0.6" />
    </g>
    <HeadBase id={id} />
    <EarsRelaxed id={id} />
    <EyeFocused cx={78} cy={118} />
    <EyeFocused cx={122} cy={118} />
    <BrowDetermined />
    <Cheeks id={id} />
    <Nose />
    <MouthSet />
    {/* aura sparks */}
    <g stroke="#D87093" strokeWidth="2" strokeLinecap="round" fill="none">
      <path d="M22 90 L30 88" />
      <path d="M24 110 L32 110" />
      <path d="M22 130 L30 132" />
      <path d="M178 90 L170 88" />
      <path d="M176 110 L168 110" />
      <path d="M178 130 L170 132" />
    </g>
  </svg>
);

/* ============================================================
   POSE 10 — MISCHIEVOUS  (sly grin, raised brow, eye glint)
   ============================================================ */

const PoseMischievous = ({ id }) => (
  <svg viewBox="0 0 200 220" className="w-full h-full block" aria-label="Caris — mischievous">
    <CarisDefs id={id} />
    <Shadow id={id} />
    <ManeBack id={id} />
    <Body id={id} />
    <Hoof cx={80} />
    {/* casual hoof to side */}
    <g>
      <ellipse cx="128" cy="184" rx="8" ry="5" fill="#BD5D82" transform="rotate(15 128 184)" />
      <ellipse cx="128" cy="184" rx="5" ry="2.5" fill="#FBD8E3" opacity="0.7" transform="rotate(15 128 184)" />
    </g>
    <Hoof cx={120} />
    {/* slight head tilt for sass */}
    <g transform="rotate(-6 100 108)">
      <HeadBase id={id} />
      <EarsRelaxed id={id} />
      {/* one half-closed (smug), one open with star glint */}
      <EyeSmug cx={78} cy={117} dir={1} />
      {/* RIGHT eye open + sparkle glint */}
      <g>
        <ellipse cx="122" cy="116" rx="13" ry="16" fill="#2C2B36" />
        <ellipse cx="122" cy="118" rx="8" ry="9" fill="#7AA66F" />
        <ellipse cx="122" cy="118" rx="7" ry="5.5" fill="#9DC489" opacity="0.6" />
        <ellipse cx="122" cy="120" rx="3" ry="4" fill="#2C2B36" />
        {/* star highlight instead of round */}
        <g transform="translate(126 110)">
          <path d="M0 -5 L1.5 -1.5 L5 0 L1.5 1.5 L0 5 L-1.5 1.5 L-5 0 L-1.5 -1.5 Z" fill="#FFFFFF" />
        </g>
        <circle cx="117" cy="120" r="1.4" fill="#FFFFFF" />
      </g>
      <Lashes cx={122} cy={116} />
      <BrowMisch />
      <Cheeks id={id} />
      <Nose />
      <MouthSly />
    </g>
    {/* glint star outside */}
    <g fill="#E8B651" className="anim-shimmer-soft">
      <path d="M158 92 L160 96 L164 97 L160 98 L158 102 L156 98 L152 97 L156 96 Z" />
    </g>
  </svg>
);

/* ============================================================
   GRID + WRAPPER COMPONENT (default export)
   ============================================================ */

const POSES = [
  { id: "idle",        name: "Idle",        caption: "Default home / lobby pose",       Pose: PoseIdle },
  { id: "curious",     name: "Curious",     caption: "Use when a new prompt appears",   Pose: PoseCurious },
  { id: "thinking",    name: "Thinking",    caption: "Use during answer-pending",       Pose: PoseThinking },
  { id: "encouraging", name: "Encouraging", caption: "Use on wrong answer / retry",     Pose: PoseEncouraging },
  { id: "cheering",    name: "Cheering",    caption: "Use on correct answer",           Pose: PoseCheering },
  { id: "surprised",   name: "Surprised",   caption: "Use on streak-3 reveal",          Pose: PoseSurprised },
  { id: "proud",       name: "Proud",       caption: "Use on level-up",                 Pose: PoseProud },
  { id: "sleepy",      name: "Sleepy",      caption: "Use on app idle / come-back",     Pose: PoseSleepy },
  { id: "determined",  name: "Determined",  caption: "Use on hard problem intro",       Pose: PoseDetermined },
  { id: "mischievous", name: "Mischievous", caption: "Use on unlock / easter egg",      Pose: PoseMischievous },
];

function CarisExpressions() {
  return (
    <div className="min-h-screen px-4 sm:px-8 lg:px-12 py-8 sm:py-12 max-w-[1320px] mx-auto">
      <header className="mb-8 sm:mb-12">
        <div className="flex items-start gap-2 text-[11px] uppercase tracking-[0.22em] font-semibold text-copper">
          <span className="inline-block w-6 h-px bg-copper mt-2" />
          <span>Character expression sheet</span>
        </div>
        <h1 className="font-display text-walnut mt-3 leading-[0.95] text-[40px] sm:text-[60px] lg:text-[72px] tracking-tight max-w-[16ch]">
          <span className="italic font-medium">Caris,</span>{" "}
          <span className="font-semibold">in ten moods.</span>
        </h1>
        <p className="font-display italic text-walnut-2 text-[15px] sm:text-[19px] mt-4 max-w-[60ch] leading-snug">
          Same silhouette, ears, eye color, nose, and hoof style throughout &mdash; only emotion and
          body language change. Drop these into any of Caris&rsquo;s Kindergarten games as reaction art.
        </p>
        <div className="flex flex-wrap gap-2 mt-5">
          <span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-caris-bg ring-1 ring-caris-rose/30 text-[11px] font-semibold text-caris-deep">
            <span className="w-1.5 h-1.5 rounded-full bg-caris-rose" />
            Kindergarten · age 5
          </span>
          <span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-cream ring-1 ring-walnut/15 text-[11px] font-semibold text-walnut-2">
            Meadow Bloom palette
          </span>
          <span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-cream ring-1 ring-walnut/15 text-[11px] font-semibold text-walnut-2">
            10 / 10 poses
          </span>
        </div>
      </header>

      <div className="grid grid-cols-2 lg:grid-cols-5 gap-3 sm:gap-4">
        {POSES.map((p, i) => (
          <article
            key={p.id}
            className="rounded-[18px] bg-cream paper-grain ring-1 ring-walnut/15 shadow-lift overflow-hidden flex flex-col"
          >
            <div className="relative">
              <div className="aspect-square p-2 sm:p-3">
                <p.Pose id={`c-${p.id}`} />
              </div>
              <div className="absolute top-2 left-2 inline-flex items-center justify-center w-6 h-6 rounded-full bg-walnut text-cream text-[10px] font-semibold font-kid tracking-wider">
                {String(i + 1).padStart(2, "0")}
              </div>
            </div>
            <div className="px-3 sm:px-4 pb-3 sm:pb-4 pt-2 sm:pt-3 border-t border-walnut/10">
              <div className="font-display italic font-semibold text-walnut text-[18px] sm:text-[20px] leading-tight">
                {p.name}
              </div>
              <div className="font-kid text-[11px] sm:text-[12px] text-walnut-3 mt-1 leading-snug">
                {p.caption}
              </div>
            </div>
          </article>
        ))}
      </div>

      <footer className="mt-12 pt-6 border-t border-walnut/10 flex flex-wrap items-baseline justify-between gap-4 text-[12px] font-medium text-walnut-3">
        <p className="font-display italic text-walnut-2 text-[14px]">
          &ldquo;Curiosity beats correctness &mdash; every time.&rdquo;
        </p>
        <span>Cammy &amp; Caris Learning Club &middot; Caris expression sheet</span>
      </footer>
    </div>
  );
}

// Expose for the inline render in Caris Expressions.html
window.CarisExpressions = CarisExpressions;

// === HUSSL drop-in: expose every pose as named component on window ===
window.CarisPoses = {
  idle:        PoseIdle,
  curious:     PoseCurious,
  thinking:    PoseThinking,
  encouraging: PoseEncouraging,
  cheering:    PoseCheering,
  surprised:   PoseSurprised,
  proud:       PoseProud,
  sleepy:      PoseSleepy,
  determined:  PoseDetermined,
  mischievous: PoseMischievous,
};
