/* === Kids Kingdom — App.jsx === */
const { useState, useEffect, useRef } = React;

/* ---------- Tiny inline SVG icon set (no external deps) ---------- */
const Icon = {
  Shield: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 2L4 5v7c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V5l-8-3z"/>
      <path d="M9 12l2 2 4-4"/>
    </svg>
  ),
  Crown: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M3 7l4 4 5-7 5 7 4-4-1 12H4z"/>
      <circle cx="3" cy="7" r="1.4" fill={c} stroke="none"/>
      <circle cx="21" cy="7" r="1.4" fill={c} stroke="none"/>
      <circle cx="12" cy="4" r="1.4" fill={c} stroke="none"/>
    </svg>
  ),
  Arrow: ({ size = 16, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <path d="M5 12h14M13 6l6 6-6 6"/>
    </svg>
  ),
  Play: ({ size = 14, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M6 4l14 8-14 8z"/></svg>
  ),
  Star: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M12 2l2.9 6.9L22 10l-5.5 4.8L18.2 22 12 18.3 5.8 22 7.5 14.8 2 10l7.1-1.1z"/></svg>
  ),
  Heart: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M12 21s-7-4.5-9.5-9C.8 8.5 3 4 7 4c2 0 3.7 1.3 5 3 1.3-1.7 3-3 5-3 4 0 6.2 4.5 4.5 8C19 16.5 12 21 12 21z"/></svg>
  ),
  Sparkle: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M12 2l1.6 6.4L20 10l-6.4 1.6L12 18l-1.6-6.4L4 10l6.4-1.6z"/></svg>
  ),
  Book: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 4h7a3 3 0 013 3v13a2 2 0 00-2-2H4z"/>
      <path d="M20 4h-7a3 3 0 00-3 3v13a2 2 0 012-2h8z"/>
    </svg>
  ),
  Brush: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M14 3l7 7-9 9H5v-7z"/><path d="M14 7l3 3"/>
    </svg>
  ),
  Compass: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="9"/><path d="M16 8l-2 6-6 2 2-6z"/>
    </svg>
  ),
  Bulb: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M9 18h6M10 22h4M12 2a6 6 0 00-4 10c1.4 1.4 2 2 2 4h4c0-2 .6-2.6 2-4a6 6 0 00-4-10z"/>
    </svg>
  ),
  Tree: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M12 2l5 7h-3l4 6h-3l3 4H6l3-4H6l4-6H7z"/><rect x="11" y="19" width="2" height="3"/></svg>
  ),
  Puzzle: ({ size = 22, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M10 3h4a1 1 0 011 1v3a2 2 0 002 2h3a1 1 0 011 1v4a1 1 0 01-1 1h-3a2 2 0 100 4h3a1 1 0 011 1v0a1 1 0 01-1 1h-4a1 1 0 01-1-1v-3a2 2 0 00-2-2H8a1 1 0 00-1 1v3a1 1 0 01-1 1H3a1 1 0 01-1-1v-4a1 1 0 011-1h3a2 2 0 100-4H3a1 1 0 01-1-1V8a1 1 0 011-1h3a2 2 0 002-2V4a1 1 0 011-1z"/>
    </svg>
  ),
  Phone: ({ size = 20, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M22 16.9v3a2 2 0 01-2.2 2A19 19 0 012.1 4.2 2 2 0 014.1 2h3a2 2 0 012 1.7 12 12 0 00.7 2.6 2 2 0 01-.4 2.1L8.1 9.7a16 16 0 006 6l1.3-1.3a2 2 0 012.1-.4 12 12 0 002.6.7 2 2 0 011.7 2.1z"/>
    </svg>
  ),
  Mail: ({ size = 20, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <rect x="2" y="4" width="20" height="16" rx="3"/><path d="M2 6l10 7L22 6"/>
    </svg>
  ),
  Pin: ({ size = 20, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 22s8-7 8-13a8 8 0 10-16 0c0 6 8 13 8 13z"/><circle cx="12" cy="9" r="3"/>
    </svg>
  ),
  Whats: ({ size = 18, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M20.5 3.5A11 11 0 003.6 17l-1.6 5 5.2-1.4A11 11 0 1020.5 3.5zm-8.4 17a9 9 0 01-4.6-1.2l-.3-.2-3.1.8.8-3-.2-.3a9 9 0 1112.4-1l-1 1c1.7 1.2 1.8 1.5 1.4 2.4l-.6 1.4c-.4.6-1.7.6-1.7.6-1 0-2-.4-3-1.2-2-1.6-3.2-3.6-3.3-3.8-.1-.2-.7-1-.7-1.9 0-.9.5-1.3.6-1.5.2-.2.4-.2.5-.2h.4c.1 0 .3 0 .5.4l.7 1.7c0 .1.1.3 0 .5l-.3.4-.4.5c-.1.1-.2.3 0 .5l1 1.6c.7.7 1.3 1 1.6 1.2.2 0 .4.1.5 0l1-1.4c.2-.3.4-.3.6-.2l1.5.7c.3.1.4.2.5.3.1.2.1.7-.1 1.4-.2.7-1 1.3-1.7 1.3z"/></svg>
  ),
  Insta: ({ size = 18, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="3" width="18" height="18" rx="5"/><circle cx="12" cy="12" r="4"/><circle cx="17.5" cy="6.5" r="1" fill={c}/>
    </svg>
  ),
  Fb: ({ size = 18, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={c}><path d="M13 22v-8h3l1-4h-4V7c0-1.2.4-2 2.1-2H17V1.4c-.3 0-1.4-.1-2.7-.1-2.7 0-4.3 1.6-4.3 4.5V10H7v4h3v8z"/></svg>
  ),
  Menu: ({ size = 20, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
  ),
  X: ({ size = 20, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>
  ),
  Check: ({ size = 32, c = "currentColor" }) => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><path d="M4 12l5 5L20 6"/></svg>
  ),
};

Object.assign(window, { Icon });
