import { define } from '@because/forge'
import { theme } from '../themes'
import { openModal, closeModal } from './modal'
import { update } from '../update'

type Category = 'People' | 'Gestures' | 'Animals' | 'Food' | 'Activities' | 'Travel' | 'Objects' | 'Symbols' | 'Nature'

const CATEGORY_ICONS: Record<Category, string> = {
  'People': '😀',
  'Gestures': '👋',
  'Animals': '🐶',
  'Food': '🍎',
  'Activities': '⚽',
  'Travel': '🚗',
  'Objects': '💡',
  'Symbols': '❤️',
  'Nature': '🌸',
}

// Keywords for searching emojis
const EMOJI_KEYWORDS: Record<string, string[]> = {
  // People
  '😀': ['smile', 'happy', 'grin', 'face'],
  '😃': ['smile', 'happy', 'grin', 'face', 'open'],
  '😄': ['smile', 'happy', 'grin', 'face', 'eyes'],
  '😁': ['smile', 'happy', 'grin', 'teeth'],
  '😆': ['laugh', 'happy', 'haha', 'xd'],
  '😅': ['sweat', 'nervous', 'laugh', 'awkward'],
  '🤣': ['rofl', 'laugh', 'lol', 'rolling'],
  '😂': ['laugh', 'cry', 'tears', 'joy', 'lol', 'funny'],
  '🙂': ['smile', 'slight', 'okay'],
  '🙃': ['upside', 'sarcasm', 'irony'],
  '😉': ['wink', 'flirt'],
  '😊': ['blush', 'smile', 'happy', 'shy'],
  '😇': ['angel', 'innocent', 'halo'],
  '🥰': ['love', 'hearts', 'adore', 'crush'],
  '😍': ['love', 'heart', 'eyes', 'crush', 'adore'],
  '🤩': ['star', 'eyes', 'excited', 'wow', 'amazing'],
  '😘': ['kiss', 'love', 'blow'],
  '😗': ['kiss', 'whistle'],
  '😚': ['kiss', 'blush'],
  '😙': ['kiss', 'smile'],
  '🥲': ['tear', 'smile', 'sad', 'bittersweet'],
  '😋': ['yum', 'delicious', 'tongue', 'tasty'],
  '😛': ['tongue', 'playful', 'silly'],
  '😜': ['wink', 'tongue', 'crazy', 'silly'],
  '🤪': ['crazy', 'wild', 'zany', 'silly'],
  '😝': ['tongue', 'squint', 'playful'],
  '🤑': ['money', 'rich', 'dollar', 'greed'],
  '🤗': ['hug', 'hands', 'embrace'],
  '🤭': ['oops', 'giggle', 'hand', 'mouth'],
  '🤫': ['shush', 'quiet', 'secret', 'ssh'],
  '🤔': ['think', 'hmm', 'wonder', 'curious'],
  '🤐': ['zip', 'mouth', 'quiet', 'secret'],
  '🤨': ['eyebrow', 'skeptical', 'doubt'],
  '😐': ['neutral', 'meh', 'blank'],
  '😑': ['expressionless', 'annoyed', 'meh'],
  '😶': ['silent', 'speechless', 'no mouth'],
  '😏': ['smirk', 'smug', 'flirt'],
  '😒': ['unamused', 'bored', 'meh'],
  '🙄': ['eyeroll', 'annoyed', 'whatever'],
  '😬': ['grimace', 'awkward', 'nervous', 'teeth'],
  '🤥': ['lie', 'pinocchio', 'nose'],
  '😌': ['relieved', 'peaceful', 'calm'],
  '😔': ['sad', 'down', 'pensive'],
  '😪': ['sleepy', 'tired', 'snot'],
  '🤤': ['drool', 'hungry', 'want'],
  '😴': ['sleep', 'zzz', 'tired', 'snore'],
  '😷': ['sick', 'mask', 'covid', 'ill'],
  '🤒': ['sick', 'fever', 'thermometer', 'ill'],
  '🤕': ['hurt', 'injured', 'bandage', 'head'],
  '🤢': ['nausea', 'sick', 'gross', 'green'],
  '🤮': ['vomit', 'puke', 'sick', 'throw up'],
  '🤧': ['sneeze', 'sick', 'tissue', 'achoo'],
  '🥵': ['hot', 'heat', 'sweat', 'fever'],
  '🥶': ['cold', 'freeze', 'ice', 'frozen'],
  '🥴': ['woozy', 'drunk', 'dizzy', 'tipsy'],
  '😵': ['dizzy', 'dead', 'knocked out'],
  '🤯': ['mind blown', 'explode', 'shocked', 'wow'],
  '🤠': ['cowboy', 'yeehaw', 'western', 'hat'],
  '🥳': ['party', 'celebrate', 'birthday', 'hat'],
  '🥸': ['disguise', 'glasses', 'nose', 'incognito'],
  '😎': ['cool', 'sunglasses', 'awesome'],
  '🤓': ['nerd', 'geek', 'glasses', 'smart'],
  '🧐': ['monocle', 'fancy', 'inspect', 'curious'],
  '😕': ['confused', 'unsure', 'worried'],
  '😟': ['worried', 'concerned', 'anxious'],
  '🙁': ['sad', 'frown', 'unhappy'],
  '😮': ['wow', 'surprised', 'open mouth'],
  '😯': ['surprised', 'hushed', 'wow'],
  '😲': ['astonished', 'shocked', 'wow'],
  '😳': ['flushed', 'embarrassed', 'blush'],
  '🥺': ['pleading', 'puppy eyes', 'please', 'uwu'],
  '😦': ['frown', 'open mouth', 'worried'],
  '😧': ['anguished', 'worried', 'shocked'],
  '😨': ['fearful', 'scared', 'afraid'],
  '😰': ['anxious', 'sweat', 'worried', 'nervous'],
  '😥': ['sad', 'disappointed', 'relieved'],
  '😢': ['cry', 'sad', 'tear'],
  '😭': ['sob', 'cry', 'tears', 'sad', 'bawling'],
  '😱': ['scream', 'scared', 'horror', 'fear'],
  '😖': ['confounded', 'frustrated'],
  '😣': ['persevere', 'struggle', 'frustrated'],
  '😞': ['disappointed', 'sad', 'let down'],
  '😓': ['sweat', 'tired', 'stressed'],
  '😩': ['weary', 'tired', 'frustrated'],
  '😫': ['tired', 'exhausted', 'frustrated'],
  '🥱': ['yawn', 'tired', 'bored', 'sleepy'],
  '😤': ['angry', 'huff', 'frustrated', 'steam'],
  '😡': ['angry', 'mad', 'rage', 'red'],
  '😠': ['angry', 'mad', 'annoyed'],
  '🤬': ['swear', 'curse', 'angry', 'symbols'],
  '😈': ['devil', 'evil', 'mischief', 'purple'],
  '👿': ['devil', 'angry', 'evil', 'imp'],
  '💀': ['skull', 'dead', 'death', 'skeleton'],
  '☠️': ['skull', 'crossbones', 'death', 'danger', 'poison'],
  '💩': ['poop', 'poo', 'shit', 'crap'],
  '🤡': ['clown', 'circus', 'fool'],
  '👹': ['ogre', 'monster', 'demon', 'japanese'],
  '👺': ['goblin', 'tengu', 'monster', 'japanese'],
  '👻': ['ghost', 'boo', 'spooky', 'halloween'],
  '👽': ['alien', 'ufo', 'extraterrestrial', 'space'],
  '👾': ['alien', 'monster', 'game', 'space invader'],
  '🤖': ['robot', 'bot', 'android', 'machine'],

  // Gestures
  '👋': ['wave', 'hello', 'bye', 'hand'],
  '🤚': ['raised', 'hand', 'stop', 'back'],
  '🖐️': ['hand', 'five', 'fingers', 'spread'],
  '✋': ['hand', 'stop', 'high five'],
  '🖖': ['vulcan', 'spock', 'star trek', 'hand'],
  '👌': ['ok', 'okay', 'perfect', 'hand'],
  '🤌': ['pinched', 'italian', 'chef', 'fingers'],
  '🤏': ['pinch', 'small', 'tiny', 'little'],
  '✌️': ['peace', 'victory', 'two', 'fingers'],
  '🤞': ['crossed', 'fingers', 'luck', 'hope'],
  '🤟': ['love', 'rock', 'hand', 'ily'],
  '🤘': ['rock', 'metal', 'horns', 'hand'],
  '🤙': ['call', 'shaka', 'hang loose', 'phone'],
  '👈': ['left', 'point', 'finger'],
  '👉': ['right', 'point', 'finger'],
  '👆': ['up', 'point', 'finger'],
  '🖕': ['middle finger', 'fuck', 'flip off'],
  '👇': ['down', 'point', 'finger'],
  '☝️': ['up', 'point', 'finger', 'one'],
  '👍': ['thumbs up', 'like', 'yes', 'good', 'ok'],
  '👎': ['thumbs down', 'dislike', 'no', 'bad'],
  '✊': ['fist', 'power', 'punch', 'solidarity'],
  '👊': ['fist bump', 'punch', 'bro'],
  '🤛': ['fist', 'left', 'bump'],
  '🤜': ['fist', 'right', 'bump'],
  '👏': ['clap', 'applause', 'hands', 'bravo'],
  '🙌': ['hands', 'raise', 'celebrate', 'praise'],
  '👐': ['hands', 'open', 'hug'],
  '🤲': ['palms', 'up', 'hands', 'prayer'],
  '🤝': ['handshake', 'deal', 'agree', 'meet'],
  '🙏': ['pray', 'please', 'thanks', 'namaste', 'hands'],
  '✍️': ['write', 'hand', 'pen', 'sign'],
  '💅': ['nails', 'polish', 'manicure', 'sassy'],
  '🤳': ['selfie', 'phone', 'camera'],
  '💪': ['muscle', 'strong', 'flex', 'arm', 'bicep'],
  '🦾': ['robot', 'arm', 'prosthetic', 'mechanical'],
  '🦿': ['leg', 'prosthetic', 'mechanical'],
  '🦵': ['leg', 'kick', 'limb'],
  '🦶': ['foot', 'kick', 'stomp'],
  '👂': ['ear', 'listen', 'hear'],
  '🦻': ['ear', 'hearing aid', 'deaf'],
  '👃': ['nose', 'smell', 'sniff'],
  '🧠': ['brain', 'smart', 'think', 'mind'],
  '🫀': ['heart', 'organ', 'anatomical'],
  '🫁': ['lungs', 'breathe', 'organ'],
  '🦷': ['tooth', 'teeth', 'dental'],
  '🦴': ['bone', 'skeleton', 'dog'],
  '👀': ['eyes', 'look', 'see', 'watch'],
  '👁️': ['eye', 'see', 'look', 'watch'],
  '👅': ['tongue', 'lick', 'taste'],
  '👄': ['lips', 'mouth', 'kiss'],

  // Animals
  '🐶': ['dog', 'puppy', 'pet', 'woof'],
  '🐱': ['cat', 'kitty', 'pet', 'meow'],
  '🐭': ['mouse', 'rat', 'rodent'],
  '🐹': ['hamster', 'pet', 'rodent'],
  '🐰': ['rabbit', 'bunny', 'pet'],
  '🦊': ['fox', 'animal', 'cute'],
  '🐻': ['bear', 'teddy', 'animal'],
  '🐼': ['panda', 'bear', 'china'],
  '🐻‍❄️': ['polar bear', 'arctic', 'white'],
  '🐨': ['koala', 'australia', 'bear'],
  '🐯': ['tiger', 'cat', 'stripes'],
  '🦁': ['lion', 'king', 'cat', 'mane'],
  '🐮': ['cow', 'moo', 'farm'],
  '🐷': ['pig', 'oink', 'farm'],
  '🐸': ['frog', 'toad', 'ribbit', 'kermit'],
  '🐵': ['monkey', 'ape', 'chimp'],
  '🙈': ['monkey', 'see no evil', 'hide'],
  '🙉': ['monkey', 'hear no evil'],
  '🙊': ['monkey', 'speak no evil'],
  '🐒': ['monkey', 'ape', 'primate'],
  '🐔': ['chicken', 'hen', 'bird', 'farm'],
  '🐧': ['penguin', 'bird', 'cold', 'arctic'],
  '🐦': ['bird', 'tweet', 'fly'],
  '🐤': ['chick', 'bird', 'baby', 'chicken'],
  '🐣': ['chick', 'hatching', 'egg', 'bird'],
  '🐥': ['chick', 'bird', 'baby'],
  '🦆': ['duck', 'bird', 'quack'],
  '🦅': ['eagle', 'bird', 'america', 'fly'],
  '🦉': ['owl', 'bird', 'night', 'wise'],
  '🦇': ['bat', 'vampire', 'night', 'fly'],
  '🐺': ['wolf', 'howl', 'dog'],
  '🐗': ['boar', 'pig', 'wild'],
  '🐴': ['horse', 'pony', 'neigh'],
  '🦄': ['unicorn', 'horse', 'magic', 'rainbow'],
  '🐝': ['bee', 'honey', 'buzz', 'insect'],
  '🪱': ['worm', 'bug', 'insect'],
  '🐛': ['bug', 'caterpillar', 'insect'],
  '🦋': ['butterfly', 'insect', 'pretty'],
  '🐌': ['snail', 'slow', 'slug'],
  '🐞': ['ladybug', 'insect', 'bug'],
  '🐜': ['ant', 'insect', 'bug'],
  '🪰': ['fly', 'insect', 'bug'],
  '🪲': ['beetle', 'bug', 'insect'],
  '🪳': ['cockroach', 'bug', 'insect', 'roach'],
  '🦟': ['mosquito', 'bug', 'insect', 'bite'],
  '🦗': ['cricket', 'bug', 'insect'],
  '🕷️': ['spider', 'bug', 'web', 'creepy'],
  '🦂': ['scorpion', 'bug', 'sting'],
  '🐢': ['turtle', 'slow', 'shell', 'tortoise'],
  '🐍': ['snake', 'reptile', 'hiss'],
  '🦎': ['lizard', 'reptile', 'gecko'],
  '🦖': ['dinosaur', 't-rex', 'tyrannosaurus'],
  '🦕': ['dinosaur', 'brontosaurus', 'sauropod'],
  '🐙': ['octopus', 'sea', 'tentacles'],
  '🦑': ['squid', 'sea', 'tentacles'],
  '🦐': ['shrimp', 'seafood', 'prawn'],
  '🦞': ['lobster', 'seafood', 'crab'],
  '🦀': ['crab', 'seafood', 'beach'],
  '🐡': ['blowfish', 'puffer', 'fish'],
  '🐠': ['fish', 'tropical', 'sea'],
  '🐟': ['fish', 'sea', 'swim'],
  '🐬': ['dolphin', 'sea', 'swim', 'flipper'],
  '🐳': ['whale', 'sea', 'spout'],
  '🐋': ['whale', 'sea', 'humpback'],
  '🦈': ['shark', 'fish', 'sea', 'jaws'],
  '🐊': ['crocodile', 'alligator', 'reptile'],
  '🐅': ['tiger', 'cat', 'stripes'],
  '🐆': ['leopard', 'cat', 'spots'],
  '🦓': ['zebra', 'stripes', 'horse'],
  '🦍': ['gorilla', 'ape', 'monkey'],
  '🦧': ['orangutan', 'ape', 'monkey'],
  '🦣': ['mammoth', 'elephant', 'ice age'],
  '🐘': ['elephant', 'trunk', 'big'],
  '🦛': ['hippo', 'hippopotamus'],
  '🦏': ['rhino', 'rhinoceros', 'horn'],
  '🐪': ['camel', 'desert', 'hump'],
  '🐫': ['camel', 'desert', 'humps', 'bactrian'],
  '🦒': ['giraffe', 'tall', 'spots'],
  '🦘': ['kangaroo', 'australia', 'hop'],
  '🦬': ['bison', 'buffalo'],
  '🐃': ['water buffalo', 'ox'],
  '🐂': ['ox', 'bull'],
  '🐄': ['cow', 'farm', 'moo'],
  '🐎': ['horse', 'race', 'gallop'],
  '🐖': ['pig', 'farm', 'oink'],
  '🐏': ['ram', 'sheep'],
  '🐑': ['sheep', 'lamb', 'wool', 'baa'],
  '🦙': ['llama', 'alpaca'],
  '🐐': ['goat', 'farm'],
  '🦌': ['deer', 'buck', 'antlers'],
  '🐕': ['dog', 'pet', 'woof'],
  '🐩': ['poodle', 'dog', 'fancy'],
  '🦮': ['guide dog', 'service', 'blind'],
  '🐕‍🦺': ['service dog', 'vest'],
  '🐈': ['cat', 'pet', 'meow'],
  '🐈‍⬛': ['black cat', 'pet', 'halloween'],
  '🪶': ['feather', 'bird', 'light'],
  '🐓': ['rooster', 'chicken', 'cock', 'farm'],
  '🦃': ['turkey', 'bird', 'thanksgiving'],
  '🦤': ['dodo', 'bird', 'extinct'],
  '🦚': ['peacock', 'bird', 'feathers'],
  '🦜': ['parrot', 'bird', 'tropical'],
  '🦢': ['swan', 'bird', 'elegant'],
  '🦩': ['flamingo', 'bird', 'pink'],
  '🕊️': ['dove', 'peace', 'bird'],
  '🐇': ['rabbit', 'bunny', 'hop'],
  '🦝': ['raccoon', 'animal', 'trash panda'],
  '🦨': ['skunk', 'animal', 'smell'],
  '🦡': ['badger', 'animal'],
  '🦫': ['beaver', 'animal', 'dam'],
  '🦦': ['otter', 'animal', 'cute'],
  '🦥': ['sloth', 'animal', 'slow', 'lazy'],
  '🐁': ['mouse', 'rodent'],
  '🐀': ['rat', 'rodent'],
  '🐿️': ['squirrel', 'chipmunk', 'nut'],
  '🦔': ['hedgehog', 'spiky', 'sonic'],

  // Food
  '🍎': ['apple', 'red', 'fruit'],
  '🍐': ['pear', 'fruit', 'green'],
  '🍊': ['orange', 'fruit', 'citrus'],
  '🍋': ['lemon', 'fruit', 'citrus', 'sour'],
  '🍌': ['banana', 'fruit', 'yellow'],
  '🍉': ['watermelon', 'fruit', 'summer'],
  '🍇': ['grapes', 'fruit', 'wine'],
  '🍓': ['strawberry', 'fruit', 'berry'],
  '🫐': ['blueberry', 'fruit', 'berry'],
  '🍈': ['melon', 'fruit'],
  '🍒': ['cherry', 'fruit', 'red'],
  '🍑': ['peach', 'fruit', 'butt'],
  '🥭': ['mango', 'fruit', 'tropical'],
  '🍍': ['pineapple', 'fruit', 'tropical'],
  '🥥': ['coconut', 'fruit', 'tropical'],
  '🥝': ['kiwi', 'fruit'],
  '🍅': ['tomato', 'vegetable', 'red'],
  '🍆': ['eggplant', 'aubergine', 'vegetable'],
  '🥑': ['avocado', 'vegetable', 'guac'],
  '🥦': ['broccoli', 'vegetable', 'green'],
  '🥬': ['lettuce', 'vegetable', 'leafy'],
  '🥒': ['cucumber', 'vegetable', 'pickle'],
  '🌶️': ['pepper', 'hot', 'spicy', 'chili'],
  '🫑': ['pepper', 'bell', 'vegetable'],
  '🌽': ['corn', 'vegetable', 'maize'],
  '🥕': ['carrot', 'vegetable', 'orange'],
  '🫒': ['olive', 'vegetable'],
  '🧄': ['garlic', 'vegetable', 'vampire'],
  '🧅': ['onion', 'vegetable', 'cry'],
  '🥔': ['potato', 'vegetable'],
  '🍠': ['sweet potato', 'vegetable'],
  '🥐': ['croissant', 'bread', 'french', 'pastry'],
  '🥯': ['bagel', 'bread', 'breakfast'],
  '🍞': ['bread', 'loaf', 'toast'],
  '🥖': ['baguette', 'bread', 'french'],
  '🥨': ['pretzel', 'bread', 'snack'],
  '🧀': ['cheese', 'dairy'],
  '🥚': ['egg', 'breakfast'],
  '🍳': ['egg', 'frying', 'breakfast', 'cooking'],
  '🧈': ['butter', 'dairy'],
  '🥞': ['pancakes', 'breakfast', 'stack'],
  '🧇': ['waffle', 'breakfast'],
  '🥓': ['bacon', 'breakfast', 'meat'],
  '🥩': ['steak', 'meat', 'beef'],
  '🍗': ['chicken', 'leg', 'drumstick', 'meat'],
  '🍖': ['meat', 'bone', 'rib'],
  '🌭': ['hot dog', 'sausage', 'fast food'],
  '🍔': ['burger', 'hamburger', 'fast food'],
  '🍟': ['fries', 'french fries', 'chips', 'fast food'],
  '🍕': ['pizza', 'slice', 'fast food'],
  '🫓': ['flatbread', 'pita', 'bread'],
  '🥪': ['sandwich', 'sub', 'lunch'],
  '🥙': ['pita', 'falafel', 'wrap'],
  '🧆': ['falafel', 'food'],
  '🌮': ['taco', 'mexican', 'food'],
  '🌯': ['burrito', 'mexican', 'wrap'],
  '🫔': ['tamale', 'mexican', 'food'],
  '🥗': ['salad', 'healthy', 'greens'],
  '🥘': ['paella', 'pan', 'food'],
  '🫕': ['fondue', 'cheese', 'food'],
  '🥫': ['can', 'canned', 'food'],
  '🍝': ['spaghetti', 'pasta', 'italian'],
  '🍜': ['noodles', 'ramen', 'soup', 'asian'],
  '🍲': ['stew', 'pot', 'soup'],
  '🍛': ['curry', 'rice', 'indian'],
  '🍣': ['sushi', 'japanese', 'fish'],
  '🍱': ['bento', 'box', 'japanese', 'lunch'],
  '🥟': ['dumpling', 'asian', 'food'],
  '🦪': ['oyster', 'seafood', 'shell'],
  '🍤': ['shrimp', 'prawn', 'tempura', 'seafood'],
  '🍙': ['rice ball', 'onigiri', 'japanese'],
  '🍚': ['rice', 'bowl', 'asian'],
  '🍘': ['rice cracker', 'japanese', 'snack'],
  '🍥': ['fish cake', 'narutomaki', 'japanese'],
  '🥠': ['fortune cookie', 'chinese'],
  '🥮': ['mooncake', 'chinese', 'festival'],
  '🍢': ['oden', 'skewer', 'japanese'],
  '🍡': ['dango', 'japanese', 'dessert'],
  '🍧': ['shaved ice', 'dessert', 'cold'],
  '🍨': ['ice cream', 'dessert', 'cold'],
  '🍦': ['ice cream', 'cone', 'dessert', 'soft serve'],
  '🥧': ['pie', 'dessert', 'thanksgiving'],
  '🧁': ['cupcake', 'dessert', 'cake'],
  '🍰': ['cake', 'slice', 'dessert'],
  '🎂': ['birthday', 'cake', 'candles', 'party'],
  '🍮': ['pudding', 'flan', 'dessert'],
  '🍭': ['lollipop', 'candy', 'sweet'],
  '🍬': ['candy', 'sweet', 'wrapper'],
  '🍫': ['chocolate', 'bar', 'candy', 'sweet'],
  '🍿': ['popcorn', 'movies', 'snack'],
  '🍩': ['donut', 'doughnut', 'dessert'],
  '🍪': ['cookie', 'biscuit', 'dessert'],
  '🌰': ['chestnut', 'nut'],
  '🥜': ['peanut', 'nut'],
  '🍯': ['honey', 'jar', 'bee'],
  '🥛': ['milk', 'glass', 'dairy'],
  '🍼': ['bottle', 'baby', 'milk'],
  '🫖': ['teapot', 'tea', 'drink'],
  '☕': ['coffee', 'tea', 'hot', 'drink', 'cafe'],
  '🍵': ['tea', 'green', 'cup', 'matcha'],
  '🧃': ['juice', 'box', 'drink'],
  '🥤': ['cup', 'soda', 'drink', 'straw'],
  '🧋': ['boba', 'bubble tea', 'drink', 'tapioca'],
  '🍶': ['sake', 'japanese', 'alcohol'],
  '🍺': ['beer', 'mug', 'drink', 'alcohol'],
  '🍻': ['beers', 'cheers', 'drink', 'alcohol'],
  '🥂': ['champagne', 'cheers', 'toast', 'celebrate'],
  '🍷': ['wine', 'red', 'glass', 'alcohol'],
  '🥃': ['whiskey', 'tumbler', 'drink', 'alcohol'],
  '🍸': ['cocktail', 'martini', 'drink', 'alcohol'],
  '🍹': ['tropical', 'cocktail', 'drink', 'alcohol'],
  '🧉': ['mate', 'drink'],
  '🍾': ['champagne', 'bottle', 'celebrate', 'pop'],
  '🧊': ['ice', 'cube', 'cold'],

  // Activities
  '⚽': ['soccer', 'football', 'ball', 'sport'],
  '🏀': ['basketball', 'ball', 'sport', 'nba'],
  '🏈': ['football', 'american', 'ball', 'sport', 'nfl'],
  '⚾': ['baseball', 'ball', 'sport', 'mlb'],
  '🥎': ['softball', 'ball', 'sport'],
  '🎾': ['tennis', 'ball', 'sport', 'racket'],
  '🏐': ['volleyball', 'ball', 'sport'],
  '🏉': ['rugby', 'ball', 'sport'],
  '🥏': ['frisbee', 'disc', 'ultimate'],
  '🎱': ['pool', 'billiards', '8ball', 'ball'],
  '🪀': ['yoyo', 'toy', 'play'],
  '🏓': ['ping pong', 'table tennis', 'paddle'],
  '🏸': ['badminton', 'shuttlecock', 'racket'],
  '🏒': ['hockey', 'ice', 'stick', 'puck'],
  '🏑': ['field hockey', 'stick'],
  '🥍': ['lacrosse', 'stick'],
  '🏏': ['cricket', 'bat', 'sport'],
  '🪃': ['boomerang', 'throw'],
  '🥅': ['goal', 'net', 'sport'],
  '⛳': ['golf', 'flag', 'hole'],
  '🪁': ['kite', 'fly', 'wind'],
  '🏹': ['archery', 'bow', 'arrow'],
  '🎣': ['fishing', 'rod', 'fish'],
  '🤿': ['diving', 'snorkel', 'mask'],
  '🥊': ['boxing', 'glove', 'fight'],
  '🥋': ['martial arts', 'karate', 'judo'],
  '🎽': ['running', 'shirt', 'jersey'],
  '🛹': ['skateboard', 'skate'],
  '🛼': ['roller skate', 'skating'],
  '🛷': ['sled', 'snow', 'winter'],
  '⛸️': ['ice skate', 'skating', 'winter'],
  '🥌': ['curling', 'stone', 'winter'],
  '🎿': ['ski', 'skiing', 'winter', 'snow'],
  '⛷️': ['skiing', 'skier', 'winter', 'snow'],
  '🏂': ['snowboard', 'winter', 'snow'],
  '🪂': ['parachute', 'skydiving'],
  '🏋️': ['weightlifting', 'gym', 'workout'],
  '🤼': ['wrestling', 'fight', 'sport'],
  '🤸': ['gymnastics', 'cartwheel', 'flip'],
  '⛹️': ['basketball', 'dribble', 'sport'],
  '🤺': ['fencing', 'sword', 'sport'],
  '🤾': ['handball', 'sport'],
  '🏌️': ['golf', 'swing', 'sport'],
  '🏇': ['horse racing', 'jockey'],
  '🧘': ['yoga', 'meditation', 'zen'],
  '🏄': ['surfing', 'surf', 'wave', 'beach'],
  '🏊': ['swimming', 'swim', 'pool'],
  '🤽': ['water polo', 'swim', 'sport'],
  '🚣': ['rowing', 'boat', 'canoe'],
  '🧗': ['climbing', 'rock', 'mountain'],
  '🚵': ['mountain biking', 'bike', 'cycling'],
  '🚴': ['cycling', 'bike', 'bicycle'],
  '🏆': ['trophy', 'winner', 'award', 'champion'],
  '🥇': ['gold', 'medal', 'first', 'winner'],
  '🥈': ['silver', 'medal', 'second'],
  '🥉': ['bronze', 'medal', 'third'],
  '🏅': ['medal', 'sports', 'award'],
  '🎖️': ['medal', 'military', 'award'],
  '🏵️': ['rosette', 'award', 'flower'],
  '🎗️': ['ribbon', 'awareness'],
  '🎫': ['ticket', 'admission', 'event'],
  '🎟️': ['ticket', 'admission', 'event'],
  '🎪': ['circus', 'tent', 'carnival'],
  '🎭': ['theater', 'drama', 'masks', 'performing arts'],
  '🎨': ['art', 'paint', 'palette', 'artist'],
  '🎬': ['movie', 'film', 'clapperboard', 'cinema', 'action'],
  '🎤': ['microphone', 'sing', 'karaoke', 'music'],
  '🎧': ['headphones', 'music', 'listen', 'audio'],
  '🎼': ['music', 'notes', 'score', 'sheet'],
  '🎹': ['piano', 'keyboard', 'music', 'keys'],
  '🥁': ['drum', 'music', 'percussion', 'beat'],
  '🪘': ['drum', 'djembe', 'music'],
  '🎷': ['saxophone', 'sax', 'music', 'jazz'],
  '🎺': ['trumpet', 'music', 'brass', 'horn'],
  '🪗': ['accordion', 'music'],
  '🎸': ['guitar', 'music', 'rock'],
  '🪕': ['banjo', 'music', 'country'],
  '🎻': ['violin', 'music', 'fiddle', 'classical'],
  '🎲': ['dice', 'game', 'roll', 'gambling', 'random', 'chance'],
  '♟️': ['chess', 'pawn', 'game', 'strategy'],
  '🎯': ['target', 'dart', 'bullseye', 'goal'],
  '🎳': ['bowling', 'pins', 'ball', 'strike'],
  '🎮': ['video game', 'controller', 'gaming', 'play'],
  '🎰': ['slot machine', 'casino', 'gambling', 'jackpot'],
  '🧩': ['puzzle', 'piece', 'jigsaw', 'game'],
  '🎈': ['balloon', 'party', 'birthday'],
  '🎉': ['party', 'popper', 'celebrate', 'tada', 'congratulations'],
  '🎊': ['confetti', 'ball', 'celebrate'],
  '🎃': ['jack-o-lantern', 'pumpkin', 'halloween'],
  '🎄': ['christmas', 'tree', 'holiday', 'xmas'],
  '🎋': ['tanabata', 'tree', 'japanese', 'wish'],
  '🎍': ['pine', 'decoration', 'japanese', 'new year'],
  '🎎': ['japanese dolls', 'hinamatsuri'],
  '🎏': ['carp streamer', 'japanese', 'koinobori'],
  '🎐': ['wind chime', 'japanese'],
  '🎑': ['moon viewing', 'tsukimi', 'japanese'],
  '🧧': ['red envelope', 'lucky', 'chinese'],
  '🏮': ['lantern', 'red', 'japanese', 'festival'],
  '🎁': ['gift', 'present', 'birthday', 'christmas', 'wrapped'],
  '🎀': ['ribbon', 'bow', 'gift', 'decoration'],

  // Travel
  '🚗': ['car', 'vehicle', 'drive', 'automobile'],
  '🚕': ['taxi', 'cab', 'car', 'yellow'],
  '🚙': ['suv', 'car', 'vehicle'],
  '🚌': ['bus', 'vehicle', 'transit'],
  '🚎': ['trolleybus', 'bus', 'transit'],
  '🏎️': ['race car', 'fast', 'racing', 'f1'],
  '🚓': ['police', 'car', 'cop'],
  '🚑': ['ambulance', 'emergency', 'medical'],
  '🚒': ['fire truck', 'emergency', 'firefighter'],
  '🚐': ['minibus', 'van', 'vehicle'],
  '🛻': ['pickup', 'truck', 'vehicle'],
  '🚚': ['truck', 'delivery', 'moving'],
  '🚛': ['truck', 'semi', 'trailer'],
  '🚜': ['tractor', 'farm', 'vehicle'],
  '🦯': ['cane', 'blind', 'walking'],
  '🦽': ['wheelchair', 'manual', 'accessibility'],
  '🦼': ['wheelchair', 'motorized', 'accessibility'],
  '🛴': ['scooter', 'kick', 'vehicle'],
  '🚲': ['bike', 'bicycle', 'cycling'],
  '🛵': ['scooter', 'motor', 'vespa'],
  '🏍️': ['motorcycle', 'bike', 'vehicle'],
  '🛺': ['rickshaw', 'auto', 'tuk tuk'],
  '🚨': ['siren', 'police', 'emergency', 'light'],
  '🚔': ['police', 'car', 'oncoming'],
  '🚍': ['bus', 'oncoming', 'transit'],
  '🚘': ['car', 'oncoming', 'vehicle'],
  '🚖': ['taxi', 'oncoming', 'cab'],
  '🚡': ['cable car', 'gondola', 'aerial'],
  '🚠': ['cable car', 'mountain'],
  '🚟': ['suspension railway', 'monorail'],
  '🚃': ['train', 'railway', 'car'],
  '🚋': ['tram', 'streetcar', 'trolley'],
  '🚞': ['train', 'mountain', 'railway'],
  '🚝': ['monorail', 'train'],
  '🚄': ['train', 'bullet', 'high speed', 'shinkansen'],
  '🚅': ['train', 'bullet', 'shinkansen'],
  '🚈': ['train', 'light rail'],
  '🚂': ['train', 'locomotive', 'steam', 'engine'],
  '🚆': ['train', 'railway'],
  '🚇': ['metro', 'subway', 'underground'],
  '🚊': ['tram', 'streetcar'],
  '🚉': ['station', 'train', 'platform'],
  '✈️': ['airplane', 'plane', 'flight', 'travel'],
  '🛫': ['airplane', 'departure', 'takeoff', 'flight'],
  '🛬': ['airplane', 'arrival', 'landing', 'flight'],
  '🛩️': ['airplane', 'small', 'plane'],
  '💺': ['seat', 'airplane', 'chair'],
  '🛰️': ['satellite', 'space', 'orbit'],
  '🚀': ['rocket', 'space', 'launch', 'ship'],
  '🛸': ['ufo', 'flying saucer', 'alien', 'space'],
  '🚁': ['helicopter', 'chopper', 'fly'],
  '🛶': ['canoe', 'boat', 'paddle', 'kayak'],
  '⛵': ['sailboat', 'boat', 'sailing'],
  '🚤': ['speedboat', 'boat', 'fast'],
  '🛥️': ['boat', 'motor', 'yacht'],
  '🛳️': ['cruise', 'ship', 'boat'],
  '⛴️': ['ferry', 'boat', 'ship'],
  '🚢': ['ship', 'boat', 'cruise'],
  '⚓': ['anchor', 'boat', 'ship', 'nautical'],
  '🪝': ['hook', 'fishing'],
  '⛽': ['gas', 'fuel', 'pump', 'station'],
  '🚧': ['construction', 'barrier', 'road'],
  '🚦': ['traffic light', 'signal', 'road'],
  '🚥': ['traffic light', 'horizontal', 'signal'],
  '🚏': ['bus stop', 'station'],
  '🗺️': ['map', 'world', 'travel'],
  '🗿': ['moai', 'easter island', 'statue'],
  '🗽': ['statue of liberty', 'new york', 'usa'],
  '🗼': ['tokyo tower', 'japan', 'landmark'],
  '🏰': ['castle', 'european', 'fairy tale'],
  '🏯': ['castle', 'japanese', 'palace'],
  '🏟️': ['stadium', 'sports', 'arena'],
  '🎡': ['ferris wheel', 'carnival', 'amusement'],
  '🎢': ['roller coaster', 'amusement', 'theme park'],
  '🎠': ['carousel', 'merry-go-round', 'horse'],
  '⛲': ['fountain', 'water', 'park'],
  '⛱️': ['umbrella', 'beach', 'sun'],
  '🏖️': ['beach', 'sand', 'vacation'],
  '🏝️': ['island', 'tropical', 'desert'],
  '🏜️': ['desert', 'sand', 'dry'],
  '🌋': ['volcano', 'mountain', 'eruption'],
  '⛰️': ['mountain', 'rock'],
  '🏔️': ['mountain', 'snow', 'peak'],
  '🗻': ['mount fuji', 'japan', 'mountain'],
  '🏕️': ['camping', 'tent', 'outdoor'],
  '⛺': ['tent', 'camping', 'outdoor'],
  '🛖': ['hut', 'house'],
  '🏠': ['house', 'home', 'building'],
  '🏡': ['house', 'garden', 'home'],
  '🏘️': ['houses', 'neighborhood'],
  '🏚️': ['house', 'abandoned', 'derelict'],
  '🏗️': ['construction', 'building', 'crane'],
  '🏭': ['factory', 'industry', 'building'],
  '🏢': ['office', 'building', 'business'],
  '🏬': ['department store', 'mall', 'shopping'],
  '🏣': ['post office', 'japanese', 'building'],
  '🏤': ['post office', 'european', 'building'],
  '🏥': ['hospital', 'medical', 'building'],
  '🏦': ['bank', 'money', 'building'],
  '🏨': ['hotel', 'building', 'lodging'],
  '🏪': ['store', 'convenience', 'shop'],
  '🏫': ['school', 'education', 'building'],
  '🏩': ['love hotel', 'building'],
  '💒': ['wedding', 'chapel', 'church'],
  '🏛️': ['classical', 'building', 'museum'],
  '⛪': ['church', 'christian', 'religion'],
  '🕌': ['mosque', 'islam', 'religion'],
  '🕍': ['synagogue', 'jewish', 'religion'],
  '🛕': ['temple', 'hindu', 'religion'],
  '🕋': ['kaaba', 'mecca', 'islam'],
  '⛩️': ['shrine', 'shinto', 'japanese', 'torii'],

  // Objects
  '⌚': ['watch', 'time', 'wrist'],
  '📱': ['phone', 'mobile', 'smartphone', 'iphone', 'cell'],
  '📲': ['phone', 'mobile', 'arrow', 'call'],
  '💻': ['laptop', 'computer', 'mac', 'macbook'],
  '⌨️': ['keyboard', 'type', 'computer'],
  '🖥️': ['computer', 'desktop', 'monitor', 'screen'],
  '🖨️': ['printer', 'print', 'paper'],
  '🖱️': ['mouse', 'computer', 'click'],
  '🖲️': ['trackball', 'computer'],
  '🕹️': ['joystick', 'game', 'arcade'],
  '🗜️': ['clamp', 'compress', 'tool'],
  '💽': ['minidisc', 'disk', 'computer'],
  '💾': ['floppy', 'disk', 'save', 'computer'],
  '💿': ['cd', 'disc', 'dvd'],
  '📀': ['dvd', 'disc', 'movie'],
  '📼': ['vhs', 'tape', 'video', 'cassette'],
  '📷': ['camera', 'photo', 'picture'],
  '📸': ['camera', 'flash', 'photo'],
  '📹': ['video camera', 'camcorder', 'record'],
  '🎥': ['movie camera', 'film', 'cinema'],
  '📽️': ['projector', 'film', 'movie'],
  '🎞️': ['film', 'frames', 'movie'],
  '📞': ['phone', 'telephone', 'receiver'],
  '☎️': ['phone', 'telephone', 'landline'],
  '📟': ['pager', 'beeper'],
  '📠': ['fax', 'machine', 'document'],
  '📺': ['tv', 'television', 'screen'],
  '📻': ['radio', 'music', 'broadcast'],
  '🎙️': ['microphone', 'studio', 'podcast', 'record'],
  '🎚️': ['slider', 'level', 'audio'],
  '🎛️': ['knobs', 'dials', 'control'],
  '🧭': ['compass', 'navigation', 'direction'],
  '⏱️': ['stopwatch', 'timer', 'time'],
  '⏲️': ['timer', 'clock', 'kitchen'],
  '⏰': ['alarm', 'clock', 'wake'],
  '🕰️': ['clock', 'mantelpiece', 'time'],
  '⌛': ['hourglass', 'time', 'sand'],
  '⏳': ['hourglass', 'time', 'sand', 'flowing'],
  '📡': ['satellite', 'dish', 'antenna', 'signal'],
  '🔋': ['battery', 'power', 'charge'],
  '🔌': ['plug', 'electric', 'power', 'outlet'],
  '💡': ['light bulb', 'idea', 'bright'],
  '🔦': ['flashlight', 'torch', 'light'],
  '🕯️': ['candle', 'light', 'flame'],
  '🪔': ['lamp', 'diya', 'oil'],
  '🧯': ['fire extinguisher', 'safety'],
  '🛢️': ['oil', 'drum', 'barrel'],
  '💸': ['money', 'flying', 'cash', 'dollar'],
  '💵': ['money', 'dollar', 'cash', 'bill'],
  '💴': ['money', 'yen', 'japanese'],
  '💶': ['money', 'euro', 'european'],
  '💷': ['money', 'pound', 'british'],
  '🪙': ['coin', 'money', 'gold'],
  '💰': ['money', 'bag', 'rich', 'cash'],
  '💳': ['credit card', 'payment', 'bank'],
  '💎': ['diamond', 'gem', 'jewel', 'precious'],
  '⚖️': ['scale', 'balance', 'justice', 'law'],
  '🪜': ['ladder', 'climb', 'steps'],
  '🧰': ['toolbox', 'tools', 'repair'],
  '🪛': ['screwdriver', 'tool', 'repair'],
  '🔧': ['wrench', 'tool', 'repair', 'spanner'],
  '🔨': ['hammer', 'tool', 'build'],
  '⚒️': ['hammer', 'pick', 'tools'],
  '🛠️': ['tools', 'hammer', 'wrench', 'repair'],
  '⛏️': ['pick', 'mining', 'tool'],
  '🪚': ['saw', 'tool', 'carpentry'],
  '🔩': ['nut', 'bolt', 'screw', 'hardware'],
  '⚙️': ['gear', 'cog', 'settings', 'mechanical'],
  '🪤': ['trap', 'mouse', 'catch'],
  '🧱': ['brick', 'wall', 'build'],
  '⛓️': ['chain', 'link', 'metal'],
  '🧲': ['magnet', 'attract', 'magnetic'],
  '🔫': ['gun', 'pistol', 'water', 'weapon'],
  '💣': ['bomb', 'explosive', 'danger'],
  '🧨': ['firecracker', 'dynamite', 'explosive'],
  '🪓': ['axe', 'chop', 'tool'],
  '🔪': ['knife', 'cut', 'kitchen', 'blade'],
  '🗡️': ['dagger', 'sword', 'knife', 'blade'],
  '⚔️': ['swords', 'crossed', 'battle', 'fight'],
  '🛡️': ['shield', 'defense', 'protection'],
  '🚬': ['cigarette', 'smoke', 'smoking'],
  '⚰️': ['coffin', 'death', 'funeral'],
  '🪦': ['headstone', 'grave', 'rip'],
  '⚱️': ['urn', 'funeral', 'ashes'],
  '🏺': ['amphora', 'vase', 'jar'],
  '🔮': ['crystal ball', 'fortune', 'magic', 'predict'],
  '📿': ['beads', 'prayer', 'rosary'],
  '🧿': ['evil eye', 'nazar', 'protection'],
  '💈': ['barber', 'pole', 'haircut'],
  '⚗️': ['alembic', 'chemistry', 'science'],
  '🔭': ['telescope', 'astronomy', 'space', 'stars'],
  '🔬': ['microscope', 'science', 'biology'],
  '🕳️': ['hole', 'black', 'pit'],
  '🩹': ['bandage', 'adhesive', 'medical'],
  '🩺': ['stethoscope', 'doctor', 'medical'],
  '💊': ['pill', 'medicine', 'drug', 'capsule'],
  '💉': ['syringe', 'needle', 'injection', 'vaccine'],
  '🩸': ['blood', 'drop', 'donate'],
  '🧬': ['dna', 'gene', 'biology', 'science'],
  '🦠': ['microbe', 'germ', 'bacteria', 'virus'],
  '🧫': ['petri dish', 'bacteria', 'science'],
  '🧪': ['test tube', 'science', 'chemistry', 'experiment'],
  '📝': ['memo', 'note', 'pencil', 'write'],
  '✏️': ['pencil', 'write', 'edit'],
  '🖊️': ['pen', 'write', 'ballpoint'],
  '🖋️': ['fountain pen', 'write', 'ink'],
  '🖍️': ['crayon', 'draw', 'color'],
  '📖': ['book', 'open', 'read'],
  '📗': ['book', 'green', 'read'],
  '📘': ['book', 'blue', 'read'],
  '📙': ['book', 'orange', 'read'],
  '📕': ['book', 'red', 'closed', 'read'],
  '📓': ['notebook', 'write'],
  '📔': ['notebook', 'decorative'],
  '📒': ['ledger', 'notebook', 'yellow'],
  '📚': ['books', 'stack', 'read', 'library'],
  '📰': ['newspaper', 'news', 'paper', 'press'],
  '🗞️': ['newspaper', 'rolled', 'news'],
  '📜': ['scroll', 'document', 'ancient', 'paper'],
  '📃': ['page', 'curl', 'document'],
  '📄': ['page', 'document', 'paper'],
  '📑': ['bookmark', 'tabs', 'document'],
  '📊': ['bar chart', 'graph', 'statistics', 'data'],
  '📈': ['chart', 'increasing', 'trending up', 'stock'],
  '📉': ['chart', 'decreasing', 'trending down', 'stock'],
  '📆': ['calendar', 'date', 'schedule'],
  '📅': ['calendar', 'date'],
  '🗓️': ['spiral calendar', 'date', 'schedule'],
  '📇': ['card index', 'rolodex'],
  '🗃️': ['card file box', 'organize'],
  '🗳️': ['ballot box', 'vote', 'election'],
  '🗄️': ['file cabinet', 'storage', 'office'],
  '📋': ['clipboard', 'paste', 'list'],
  '📌': ['pushpin', 'pin', 'location'],
  '📍': ['round pushpin', 'pin', 'location'],
  '📎': ['paperclip', 'clip', 'attach'],
  '🖇️': ['linked paperclips', 'attach'],
  '📏': ['straight ruler', 'measure'],
  '📐': ['triangular ruler', 'measure', 'geometry'],
  '✂️': ['scissors', 'cut', 'snip'],
  '🗂️': ['card index dividers', 'organize', 'tabs'],
  '🗑️': ['wastebasket', 'trash', 'delete', 'bin', 'garbage'],
  '✉️': ['envelope', 'mail', 'letter', 'email'],
  '📧': ['email', 'mail', 'letter', 'at'],
  '📨': ['incoming envelope', 'mail', 'receive'],
  '📩': ['envelope', 'arrow', 'mail', 'send'],
  '📤': ['outbox', 'sent', 'mail'],
  '📥': ['inbox', 'receive', 'mail'],
  '📦': ['package', 'box', 'delivery', 'shipping'],
  '📫': ['mailbox', 'mail', 'closed', 'flag'],
  '📪': ['mailbox', 'empty', 'closed'],
  '📬': ['mailbox', 'mail', 'open', 'flag'],
  '📭': ['mailbox', 'open', 'empty'],
  '📮': ['postbox', 'mail', 'red'],
  '🔒': ['lock', 'locked', 'secure', 'closed'],
  '🔓': ['unlock', 'open', 'unlocked'],
  '🔏': ['lock', 'pen', 'privacy'],
  '🔐': ['lock', 'key', 'secure'],
  '🔑': ['key', 'lock', 'password', 'access'],
  '🗝️': ['old key', 'vintage', 'antique'],
  '🪞': ['mirror', 'reflection'],
  '🪟': ['window', 'glass', 'frame'],
  '🛋️': ['couch', 'sofa', 'furniture'],
  '🪑': ['chair', 'seat', 'furniture'],
  '🚪': ['door', 'entrance', 'exit'],
  '🛏️': ['bed', 'sleep', 'bedroom'],
  '🧸': ['teddy bear', 'toy', 'stuffed'],
  '🪆': ['nesting dolls', 'matryoshka', 'russian'],
  '🖼️': ['frame', 'picture', 'painting', 'art'],
  '🛒': ['shopping cart', 'grocery', 'buy'],
  '🛍️': ['shopping bags', 'buy', 'retail'],
  '🏷️': ['label', 'tag', 'price', 'sale'],
  '🧴': ['lotion', 'bottle', 'sunscreen'],
  '🧷': ['safety pin', 'diaper'],
  '🧹': ['broom', 'sweep', 'clean'],
  '🧺': ['basket', 'laundry'],
  '🧻': ['toilet paper', 'roll', 'bathroom'],
  '🪣': ['bucket', 'pail', 'water'],
  '🧼': ['soap', 'wash', 'clean'],
  '🧽': ['sponge', 'clean', 'wash'],
  '🪥': ['toothbrush', 'dental', 'brush'],
  '🪒': ['razor', 'shave'],
  '🪄': ['magic wand', 'wizard', 'spell'],
  '👑': ['crown', 'king', 'queen', 'royal'],
  '👒': ['hat', 'woman', 'sun'],
  '🎩': ['top hat', 'formal', 'gentleman', 'magic'],
  '🎓': ['graduation', 'cap', 'school', 'diploma'],
  '🧢': ['cap', 'hat', 'baseball'],
  '⛑️': ['rescue helmet', 'safety', 'hard hat'],
  '👓': ['glasses', 'eyeglasses', 'spectacles'],
  '🕶️': ['sunglasses', 'cool', 'dark'],
  '🥽': ['goggles', 'swim', 'lab', 'safety'],
  '💼': ['briefcase', 'business', 'work'],
  '👜': ['handbag', 'purse', 'bag'],
  '👛': ['purse', 'wallet', 'money'],
  '👝': ['clutch bag', 'pouch'],
  '🎒': ['backpack', 'school', 'bag'],
  '🧳': ['luggage', 'suitcase', 'travel'],
  '👞': ['shoe', 'man', 'dress'],
  '👟': ['sneaker', 'running', 'shoe', 'athletic'],
  '🥾': ['hiking boot', 'shoe', 'outdoor'],
  '🥿': ['flat shoe', 'ballet'],
  '👠': ['high heel', 'shoe', 'woman'],
  '👡': ['sandal', 'shoe', 'woman'],
  '🩰': ['ballet shoes', 'dance'],
  '👢': ['boot', 'woman', 'shoe'],
  '👗': ['dress', 'woman', 'fashion'],
  '👔': ['necktie', 'tie', 'formal', 'business'],
  '👕': ['t-shirt', 'shirt', 'clothes'],
  '👖': ['jeans', 'pants', 'denim'],
  '🧣': ['scarf', 'winter', 'warm'],
  '🧤': ['gloves', 'winter', 'hands'],
  '🧥': ['coat', 'jacket', 'winter'],
  '🧦': ['socks', 'feet', 'warm'],
  '👙': ['bikini', 'swim', 'beach'],
  '👘': ['kimono', 'japanese', 'clothes'],
  '🥻': ['sari', 'indian', 'clothes'],
  '🩱': ['swimsuit', 'one piece'],
  '🩲': ['swim briefs', 'underwear'],
  '🩳': ['shorts', 'pants'],
  '💄': ['lipstick', 'makeup', 'cosmetic'],
  '💍': ['ring', 'diamond', 'wedding', 'engagement'],

  // Symbols
  '❤️': ['heart', 'love', 'red'],
  '🧡': ['heart', 'orange', 'love'],
  '💛': ['heart', 'yellow', 'love'],
  '💚': ['heart', 'green', 'love'],
  '💙': ['heart', 'blue', 'love'],
  '💜': ['heart', 'purple', 'love'],
  '🖤': ['heart', 'black', 'love'],
  '🤍': ['heart', 'white', 'love'],
  '🤎': ['heart', 'brown', 'love'],
  '💔': ['heart', 'broken', 'sad'],
  '❣️': ['heart', 'exclamation', 'love'],
  '💕': ['hearts', 'two', 'love'],
  '💞': ['hearts', 'revolving', 'love'],
  '💓': ['heart', 'beating', 'love'],
  '💗': ['heart', 'growing', 'love'],
  '💖': ['heart', 'sparkle', 'love'],
  '💘': ['heart', 'arrow', 'cupid', 'love'],
  '💝': ['heart', 'ribbon', 'gift', 'love'],
  '💟': ['heart', 'decoration', 'love'],
  '☮️': ['peace', 'symbol', 'sign'],
  '✝️': ['cross', 'christian', 'religion'],
  '☪️': ['islam', 'crescent', 'moon', 'star'],
  '🕉️': ['om', 'hindu', 'religion'],
  '☸️': ['dharma', 'wheel', 'buddhist'],
  '✡️': ['star of david', 'jewish', 'religion'],
  '🔯': ['star of david', 'hexagram'],
  '🕎': ['menorah', 'jewish', 'hanukkah'],
  '☯️': ['yin yang', 'balance', 'taoism'],
  '☦️': ['orthodox cross', 'christian'],
  '🛐': ['place of worship', 'pray', 'religion'],
  '⛎': ['ophiuchus', 'zodiac'],
  '♈': ['aries', 'zodiac', 'astrology'],
  '♉': ['taurus', 'zodiac', 'astrology'],
  '♊': ['gemini', 'zodiac', 'astrology'],
  '♋': ['cancer', 'zodiac', 'astrology'],
  '♌': ['leo', 'zodiac', 'astrology'],
  '♍': ['virgo', 'zodiac', 'astrology'],
  '♎': ['libra', 'zodiac', 'astrology'],
  '♏': ['scorpio', 'zodiac', 'astrology'],
  '♐': ['sagittarius', 'zodiac', 'astrology'],
  '♑': ['capricorn', 'zodiac', 'astrology'],
  '♒': ['aquarius', 'zodiac', 'astrology'],
  '♓': ['pisces', 'zodiac', 'astrology'],
  '🆔': ['id', 'identity', 'badge'],
  '⚛️': ['atom', 'science', 'nuclear'],
  '🉑': ['accept', 'chinese', 'kanji'],
  '☢️': ['radioactive', 'nuclear', 'hazard'],
  '☣️': ['biohazard', 'danger', 'toxic'],
  '📴': ['phone off', 'mobile', 'silent'],
  '📳': ['vibration', 'phone', 'mobile'],
  '🈶': ['have', 'japanese', 'kanji'],
  '🈚': ['free', 'japanese', 'kanji'],
  '🈸': ['apply', 'japanese', 'kanji'],
  '🈺': ['open', 'japanese', 'kanji'],
  '🈷️': ['monthly', 'japanese', 'kanji'],
  '✴️': ['star', 'eight pointed'],
  '🆚': ['vs', 'versus', 'against'],
  '💮': ['flower', 'white', 'japanese'],
  '🉐': ['bargain', 'japanese', 'kanji'],
  '㊙️': ['secret', 'japanese', 'kanji'],
  '㊗️': ['congratulations', 'japanese', 'kanji'],
  '🈴': ['passing', 'japanese', 'kanji'],
  '🈵': ['full', 'japanese', 'kanji'],
  '🈹': ['discount', 'japanese', 'kanji'],
  '🈲': ['prohibited', 'japanese', 'kanji'],
  '🅰️': ['a', 'blood type', 'letter'],
  '🅱️': ['b', 'blood type', 'letter'],
  '🆎': ['ab', 'blood type'],
  '🆑': ['cl', 'clear'],
  '🅾️': ['o', 'blood type', 'letter'],
  '🆘': ['sos', 'help', 'emergency'],
  '❌': ['x', 'cross', 'no', 'wrong', 'delete'],
  '⭕': ['circle', 'o', 'ring'],
  '🛑': ['stop', 'sign', 'octagon'],
  '⛔': ['no entry', 'prohibited', 'forbidden'],
  '📛': ['name badge', 'tag'],
  '🚫': ['prohibited', 'no', 'forbidden'],
  '💯': ['100', 'hundred', 'perfect', 'score'],
  '💢': ['anger', 'symbol', 'mad'],
  '♨️': ['hot springs', 'steam', 'onsen'],
  '🚷': ['no pedestrians', 'prohibited'],
  '🚯': ['no littering', 'prohibited'],
  '🚳': ['no bicycles', 'prohibited'],
  '🚱': ['no drinking water', 'prohibited'],
  '🔞': ['18', 'adult', 'underage', 'nsfw'],
  '📵': ['no phones', 'mobile', 'prohibited'],
  '🚭': ['no smoking', 'prohibited'],
  '❗': ['exclamation', 'important', 'alert'],
  '❕': ['exclamation', 'white', 'important'],
  '❓': ['question', 'what', 'help'],
  '❔': ['question', 'white', 'what'],
  '‼️': ['double exclamation', 'important'],
  '⁉️': ['exclamation question', 'interrobang'],
  '🔅': ['dim', 'brightness', 'low'],
  '🔆': ['bright', 'brightness', 'high'],
  '〽️': ['part alternation', 'mark'],
  '⚠️': ['warning', 'caution', 'alert'],
  '🚸': ['children crossing', 'school', 'caution'],
  '🔱': ['trident', 'emblem'],
  '⚜️': ['fleur de lis', 'scout'],
  '🔰': ['beginner', 'japanese', 'symbol'],
  '♻️': ['recycle', 'environment', 'green'],
  '✅': ['check', 'yes', 'done', 'correct'],
  '🈯': ['reserved', 'japanese', 'kanji'],
  '💹': ['chart', 'upward', 'yen', 'stock'],
  '❇️': ['sparkle', 'star'],
  '✳️': ['star', 'eight spoked'],
  '❎': ['x', 'cross', 'mark', 'no'],
  '🌐': ['globe', 'world', 'internet', 'web'],
  '💠': ['diamond', 'cute', 'flower'],
  'Ⓜ️': ['m', 'metro', 'circle'],
  '🌀': ['cyclone', 'spiral', 'dizzy', 'typhoon'],
  '💤': ['sleep', 'zzz', 'tired', 'snore'],
  '🏧': ['atm', 'bank', 'money'],
  '🚾': ['wc', 'restroom', 'toilet', 'bathroom'],
  '♿': ['wheelchair', 'accessible', 'disability'],
  '🅿️': ['parking', 'sign', 'p'],
  '🛗': ['elevator', 'lift'],
  '🈳': ['vacant', 'japanese', 'kanji'],
  '🈂️': ['service charge', 'japanese', 'kanji'],
  '🛂': ['passport control', 'customs'],
  '🛃': ['customs', 'border'],
  '🛄': ['baggage claim', 'luggage'],
  '🛅': ['left luggage', 'locker'],
  '🚹': ['mens', 'restroom', 'male'],
  '🚺': ['womens', 'restroom', 'female'],
  '🚼': ['baby', 'symbol', 'child'],
  '⚧️': ['transgender', 'symbol', 'gender'],
  '🚻': ['restroom', 'toilet', 'wc'],
  '🚮': ['litter', 'trash', 'bin'],
  '🎦': ['cinema', 'film', 'movie'],
  '📶': ['signal', 'bars', 'antenna', 'wifi'],
  '🈁': ['here', 'japanese', 'katakana'],
  '🔣': ['symbols', 'input'],
  'ℹ️': ['information', 'info', 'i'],
  '🔤': ['abc', 'letters', 'alphabet'],
  '🔡': ['abcd', 'lowercase', 'letters'],
  '🔠': ['abcd', 'uppercase', 'letters'],
  '🆖': ['ng', 'no good'],
  '🆗': ['ok', 'button', 'good'],
  '🆙': ['up', 'button', 'cool'],
  '🆒': ['cool', 'button'],
  '🆕': ['new', 'button'],
  '🆓': ['free', 'button'],
  '0️⃣': ['zero', '0', 'number'],
  '1️⃣': ['one', '1', 'number'],
  '2️⃣': ['two', '2', 'number'],
  '3️⃣': ['three', '3', 'number'],
  '4️⃣': ['four', '4', 'number'],
  '5️⃣': ['five', '5', 'number'],
  '6️⃣': ['six', '6', 'number'],
  '7️⃣': ['seven', '7', 'number'],
  '8️⃣': ['eight', '8', 'number'],
  '9️⃣': ['nine', '9', 'number'],
  '🔟': ['ten', '10', 'number'],
  '🔢': ['1234', 'numbers', 'input'],
  '#️⃣': ['hash', 'hashtag', 'number'],
  '*️⃣': ['asterisk', 'star', 'keycap'],
  '⏏️': ['eject', 'button'],
  '▶️': ['play', 'button', 'forward'],
  '⏸️': ['pause', 'button'],
  '⏯️': ['play pause', 'button'],
  '⏹️': ['stop', 'button'],
  '⏺️': ['record', 'button'],
  '⏭️': ['next', 'track', 'skip'],
  '⏮️': ['previous', 'track', 'skip'],
  '⏩': ['fast forward', 'button'],
  '⏪': ['rewind', 'button', 'fast'],
  '⏫': ['up', 'fast', 'button'],
  '⏬': ['down', 'fast', 'button'],
  '◀️': ['back', 'reverse', 'button'],
  '🔼': ['up', 'button', 'triangle'],
  '🔽': ['down', 'button', 'triangle'],
  '➡️': ['right', 'arrow', 'direction'],
  '⬅️': ['left', 'arrow', 'direction'],
  '⬆️': ['up', 'arrow', 'direction'],
  '⬇️': ['down', 'arrow', 'direction'],
  '↗️': ['up right', 'arrow', 'diagonal'],
  '↘️': ['down right', 'arrow', 'diagonal'],
  '↙️': ['down left', 'arrow', 'diagonal'],
  '↖️': ['up left', 'arrow', 'diagonal'],
  '↕️': ['up down', 'arrow', 'vertical'],
  '↔️': ['left right', 'arrow', 'horizontal'],
  '↪️': ['right curved', 'arrow', 'turn'],
  '↩️': ['left curved', 'arrow', 'return'],
  '⤴️': ['up curved', 'arrow'],
  '⤵️': ['down curved', 'arrow'],
  '🔀': ['shuffle', 'random', 'music'],
  '🔁': ['repeat', 'loop', 'music'],
  '🔂': ['repeat one', 'loop', 'music'],
  '🔄': ['arrows', 'counterclockwise', 'refresh', 'sync'],
  '🔃': ['arrows', 'clockwise', 'refresh'],
  '🎵': ['music', 'note', 'sound'],
  '🎶': ['music', 'notes', 'sound', 'singing'],
  '➕': ['plus', 'add', 'math'],
  '➖': ['minus', 'subtract', 'math'],
  '➗': ['divide', 'division', 'math'],
  '✖️': ['multiply', 'x', 'math'],
  '♾️': ['infinity', 'forever', 'endless'],
  '💲': ['dollar', 'money', 'sign'],
  '💱': ['exchange', 'currency', 'money'],
  '™️': ['trademark', 'tm', 'brand'],
  '©️': ['copyright', 'c', 'legal'],
  '®️': ['registered', 'r', 'brand'],
  '〰️': ['wavy dash', 'line'],
  '➰': ['curly loop', 'line'],
  '➿': ['double curly loop', 'line'],
  '🔚': ['end', 'arrow'],
  '🔙': ['back', 'arrow', 'return'],
  '🔛': ['on', 'arrow', 'mark'],
  '🔝': ['top', 'arrow', 'up'],
  '🔜': ['soon', 'arrow'],
  '✔️': ['check', 'mark', 'done', 'correct'],
  '☑️': ['check box', 'done', 'ballot'],
  '🔘': ['radio button', 'option'],
  '🔴': ['red', 'circle', 'dot'],
  '🟠': ['orange', 'circle', 'dot'],
  '🟡': ['yellow', 'circle', 'dot'],
  '🟢': ['green', 'circle', 'dot'],
  '🔵': ['blue', 'circle', 'dot'],
  '🟣': ['purple', 'circle', 'dot'],
  '⚫': ['black', 'circle', 'dot'],
  '⚪': ['white', 'circle', 'dot'],
  '🟤': ['brown', 'circle', 'dot'],
  '🔺': ['red triangle', 'up'],
  '🔻': ['red triangle', 'down'],
  '🔸': ['orange diamond', 'small'],
  '🔹': ['blue diamond', 'small'],
  '🔶': ['orange diamond', 'large'],
  '🔷': ['blue diamond', 'large'],
  '🔳': ['white square', 'button'],
  '🔲': ['black square', 'button'],
  '▪️': ['black square', 'small'],
  '▫️': ['white square', 'small'],
  '◾': ['black square', 'medium small'],
  '◽': ['white square', 'medium small'],
  '◼️': ['black square', 'medium'],
  '◻️': ['white square', 'medium'],
  '🟥': ['red square'],
  '🟧': ['orange square'],
  '🟨': ['yellow square'],
  '🟩': ['green square'],
  '🟦': ['blue square'],
  '🟪': ['purple square'],
  '⬛': ['black square', 'large'],
  '⬜': ['white square', 'large'],
  '🟫': ['brown square'],
  '🔈': ['speaker', 'low', 'sound'],
  '🔇': ['mute', 'speaker', 'silent'],
  '🔉': ['speaker', 'medium', 'sound'],
  '🔊': ['speaker', 'loud', 'sound', 'volume'],
  '🔔': ['bell', 'notification', 'alert'],
  '🔕': ['bell', 'mute', 'silent', 'no'],
  '📣': ['megaphone', 'announcement', 'cheer'],
  '📢': ['loudspeaker', 'announcement', 'public'],
  '👁️‍🗨️': ['eye speech', 'witness'],
  '💬': ['speech bubble', 'chat', 'talk', 'comment'],
  '💭': ['thought bubble', 'thinking', 'cloud'],
  '🗯️': ['anger bubble', 'mad', 'right'],
  '♠️': ['spade', 'card', 'suit'],
  '♣️': ['club', 'card', 'suit'],
  '♥️': ['heart', 'card', 'suit'],
  '♦️': ['diamond', 'card', 'suit'],
  '🃏': ['joker', 'card', 'wild'],
  '🎴': ['flower card', 'hanafuda', 'japanese'],
  '🀄': ['mahjong', 'red dragon', 'game'],
  '🕐': ['clock', '1', 'one', 'time'],
  '🕑': ['clock', '2', 'two', 'time'],
  '🕒': ['clock', '3', 'three', 'time'],
  '🕓': ['clock', '4', 'four', 'time'],
  '🕔': ['clock', '5', 'five', 'time'],
  '🕕': ['clock', '6', 'six', 'time'],
  '🕖': ['clock', '7', 'seven', 'time'],
  '🕗': ['clock', '8', 'eight', 'time'],
  '🕘': ['clock', '9', 'nine', 'time'],
  '🕙': ['clock', '10', 'ten', 'time'],
  '🕚': ['clock', '11', 'eleven', 'time'],
  '🕛': ['clock', '12', 'twelve', 'time'],
  '🕜': ['clock', '1:30', 'time'],
  '🕝': ['clock', '2:30', 'time'],
  '🕞': ['clock', '3:30', 'time'],
  '🕟': ['clock', '4:30', 'time'],
  '🕠': ['clock', '5:30', 'time'],
  '🕡': ['clock', '6:30', 'time'],
  '🕢': ['clock', '7:30', 'time'],
  '🕣': ['clock', '8:30', 'time'],
  '🕤': ['clock', '9:30', 'time'],
  '🕥': ['clock', '10:30', 'time'],
  '🕦': ['clock', '11:30', 'time'],
  '🕧': ['clock', '12:30', 'time'],
  '🏁': ['checkered flag', 'race', 'finish'],
  '🚩': ['red flag', 'triangular', 'warning'],
  '🎌': ['crossed flags', 'japanese', 'celebration'],
  '🏳️': ['white flag', 'surrender', 'peace'],
  '🏴': ['black flag', 'pirate'],
  '🏳️‍🌈': ['rainbow flag', 'pride', 'lgbtq'],

  // Nature (excluding duplicates that exist in other categories)
  '🌸': ['cherry blossom', 'flower', 'spring', 'sakura'],
  '🌹': ['rose', 'flower', 'red', 'love'],
  '🥀': ['wilted', 'flower', 'dead', 'sad'],
  '🌺': ['hibiscus', 'flower', 'tropical'],
  '🌻': ['sunflower', 'flower', 'yellow', 'summer'],
  '🌼': ['blossom', 'flower', 'yellow'],
  '🌷': ['tulip', 'flower', 'spring'],
  '🌱': ['seedling', 'plant', 'grow', 'sprout'],
  '🪴': ['potted plant', 'houseplant', 'green'],
  '🌲': ['evergreen', 'tree', 'pine', 'christmas'],
  '🌳': ['tree', 'deciduous', 'nature'],
  '🌴': ['palm tree', 'tropical', 'beach'],
  '🌵': ['cactus', 'desert', 'plant'],
  '🌾': ['rice', 'plant', 'grain', 'ear'],
  '🌿': ['herb', 'plant', 'green', 'leaf'],
  '☘️': ['shamrock', 'clover', 'irish', 'luck'],
  '🍀': ['four leaf clover', 'luck', 'irish'],
  '🍁': ['maple leaf', 'fall', 'autumn', 'canada'],
  '🍂': ['fallen leaf', 'autumn', 'fall'],
  '🍃': ['leaf', 'wind', 'blow', 'flutter'],
  '🍄': ['mushroom', 'fungus', 'toadstool'],
  '🌍': ['earth', 'globe', 'europe', 'africa', 'world'],
  '🌎': ['earth', 'globe', 'americas', 'world'],
  '🌏': ['earth', 'globe', 'asia', 'australia', 'world'],
  '🪨': ['rock', 'stone', 'boulder'],
  '🌑': ['new moon', 'dark', 'night'],
  '🌒': ['waxing crescent', 'moon', 'night'],
  '🌓': ['first quarter', 'moon', 'night'],
  '🌔': ['waxing gibbous', 'moon', 'night'],
  '🌕': ['full moon', 'night', 'bright'],
  '🌖': ['waning gibbous', 'moon', 'night'],
  '🌗': ['last quarter', 'moon', 'night'],
  '🌘': ['waning crescent', 'moon', 'night'],
  '🌙': ['crescent moon', 'night', 'sleep'],
  '🌚': ['new moon face', 'night', 'creepy'],
  '🌛': ['first quarter face', 'moon', 'night'],
  '🌜': ['last quarter face', 'moon', 'night'],
  '☀️': ['sun', 'sunny', 'bright', 'weather', 'hot'],
  '🌝': ['full moon face', 'night'],
  '🌞': ['sun face', 'sunny', 'bright'],
  '🪐': ['planet', 'saturn', 'ring', 'space'],
  '⭐': ['star', 'night', 'favorite'],
  '🌟': ['star', 'glowing', 'sparkle', 'shine'],
  '🌠': ['shooting star', 'night', 'wish'],
  '🌌': ['milky way', 'galaxy', 'space', 'stars'],
  '☁️': ['cloud', 'weather', 'sky'],
  '⛅': ['partly cloudy', 'sun', 'weather'],
  '⛈️': ['cloud', 'lightning', 'rain', 'storm', 'thunder'],
  '🌤️': ['sun', 'cloud', 'small', 'weather'],
  '🌥️': ['sun', 'cloud', 'large', 'weather'],
  '🌦️': ['sun', 'cloud', 'rain', 'weather'],
  '🌧️': ['cloud', 'rain', 'weather'],
  '🌨️': ['cloud', 'snow', 'weather', 'winter'],
  '🌩️': ['cloud', 'lightning', 'weather', 'storm'],
  '🌪️': ['tornado', 'cloud', 'weather', 'twister'],
  '🌫️': ['fog', 'cloud', 'weather', 'mist'],
  '🌬️': ['wind', 'blow', 'face', 'weather'],
  '🌈': ['rainbow', 'sky', 'weather', 'pride'],
  '🌂': ['umbrella', 'closed', 'rain'],
  '☂️': ['umbrella', 'open', 'rain'],
  '☔': ['umbrella', 'rain', 'drops', 'weather'],
  '⚡': ['lightning', 'bolt', 'electric', 'zap', 'thunder'],
  '❄️': ['snowflake', 'snow', 'winter', 'cold'],
  '☃️': ['snowman', 'winter', 'snow', 'cold'],
  '⛄': ['snowman', 'without snow', 'winter'],
  '☄️': ['comet', 'space', 'meteor'],
  '🔥': ['fire', 'flame', 'hot', 'lit', 'burn'],
  '💧': ['droplet', 'water', 'tear', 'sweat'],
  '🌊': ['wave', 'ocean', 'sea', 'water', 'surf'],
}

const EMOJI_CATEGORIES: Record<Category, string[]> = {
  'People': ['😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃', '😉', '😊', '😇', '🥰', '😍', '🤩', '😘', '😗', '😚', '😙', '🥲', '😋', '😛', '😜', '🤪', '😝', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐', '🤨', '😐', '😑', '😶', '😏', '😒', '🙄', '😬', '🤥', '😌', '😔', '😪', '🤤', '😴', '😷', '🤒', '🤕', '🤢', '🤮', '🤧', '🥵', '🥶', '🥴', '😵', '🤯', '🤠', '🥳', '🥸', '😎', '🤓', '🧐', '😕', '😟', '🙁', '😮', '😯', '😲', '😳', '🥺', '😦', '😧', '😨', '😰', '😥', '😢', '😭', '😱', '😖', '😣', '😞', '😓', '😩', '😫', '🥱', '😤', '😡', '😠', '🤬', '😈', '👿', '💀', '☠️', '💩', '🤡', '👹', '👺', '👻', '👽', '👾', '🤖'],
  'Gestures': ['👋', '🤚', '🖐️', '✋', '🖖', '👌', '🤌', '🤏', '✌️', '🤞', '🤟', '🤘', '🤙', '👈', '👉', '👆', '🖕', '👇', '☝️', '👍', '👎', '✊', '👊', '🤛', '🤜', '👏', '🙌', '👐', '🤲', '🤝', '🙏', '✍️', '💅', '🤳', '💪', '🦾', '🦿', '🦵', '🦶', '👂', '🦻', '👃', '🧠', '🫀', '🫁', '🦷', '🦴', '👀', '👁️', '👅', '👄'],
  'Animals': ['🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐻‍❄️', '🐨', '🐯', '🦁', '🐮', '🐷', '🐸', '🐵', '🙈', '🙉', '🙊', '🐒', '🐔', '🐧', '🐦', '🐤', '🐣', '🐥', '🦆', '🦅', '🦉', '🦇', '🐺', '🐗', '🐴', '🦄', '🐝', '🪱', '🐛', '🦋', '🐌', '🐞', '🐜', '🪰', '🪲', '🪳', '🦟', '🦗', '🕷️', '🦂', '🐢', '🐍', '🦎', '🦖', '🦕', '🐙', '🦑', '🦐', '🦞', '🦀', '🐡', '🐠', '🐟', '🐬', '🐳', '🐋', '🦈', '🐊', '🐅', '🐆', '🦓', '🦍', '🦧', '🦣', '🐘', '🦛', '🦏', '🐪', '🐫', '🦒', '🦘', '🦬', '🐃', '🐂', '🐄', '🐎', '🐖', '🐏', '🐑', '🦙', '🐐', '🦌', '🐕', '🐩', '🦮', '🐕‍🦺', '🐈', '🐈‍⬛', '🪶', '🐓', '🦃', '🦤', '🦚', '🦜', '🦢', '🦩', '🕊️', '🐇', '🦝', '🦨', '🦡', '🦫', '🦦', '🦥', '🐁', '🐀', '🐿️', '🦔'],
  'Food': ['🍎', '🍐', '🍊', '🍋', '🍌', '🍉', '🍇', '🍓', '🫐', '🍈', '🍒', '🍑', '🥭', '🍍', '🥥', '🥝', '🍅', '🍆', '🥑', '🥦', '🥬', '🥒', '🌶️', '🫑', '🌽', '🥕', '🫒', '🧄', '🧅', '🥔', '🍠', '🥐', '🥯', '🍞', '🥖', '🥨', '🧀', '🥚', '🍳', '🧈', '🥞', '🧇', '🥓', '🥩', '🍗', '🍖', '🦴', '🌭', '🍔', '🍟', '🍕', '🫓', '🥪', '🥙', '🧆', '🌮', '🌯', '🫔', '🥗', '🥘', '🫕', '🥫', '🍝', '🍜', '🍲', '🍛', '🍣', '🍱', '🥟', '🦪', '🍤', '🍙', '🍚', '🍘', '🍥', '🥠', '🥮', '🍢', '🍡', '🍧', '🍨', '🍦', '🥧', '🧁', '🍰', '🎂', '🍮', '🍭', '🍬', '🍫', '🍿', '🍩', '🍪', '🌰', '🥜', '🍯', '🥛', '🍼', '🫖', '☕', '🍵', '🧃', '🥤', '🧋', '🍶', '🍺', '🍻', '🥂', '🍷', '🥃', '🍸', '🍹', '🧉', '🍾', '🧊'],
  'Activities': ['⚽', '🏀', '🏈', '⚾', '🥎', '🎾', '🏐', '🏉', '🥏', '🎱', '🪀', '🏓', '🏸', '🏒', '🏑', '🥍', '🏏', '🪃', '🥅', '⛳', '🪁', '🏹', '🎣', '🤿', '🥊', '🥋', '🎽', '🛹', '🛼', '🛷', '⛸️', '🥌', '🎿', '⛷️', '🏂', '🪂', '🏋️', '🤼', '🤸', '⛹️', '🤺', '🤾', '🏌️', '🏇', '🧘', '🏄', '🏊', '🤽', '🚣', '🧗', '🚵', '🚴', '🏆', '🥇', '🥈', '🥉', '🏅', '🎖️', '🏵️', '🎗️', '🎫', '🎟️', '🎪', '🎭', '🎨', '🎬', '🎤', '🎧', '🎼', '🎹', '🥁', '🪘', '🎷', '🎺', '🪗', '🎸', '🪕', '🎻', '🎲', '♟️', '🎯', '🎳', '🎮', '🎰', '🧩', '🎈', '🎉', '🎊', '🎃', '🎄', '🎋', '🎍', '🎎', '🎏', '🎐', '🎑', '🧧', '🏮', '🎁', '🎀'],
  'Travel': ['🚗', '🚕', '🚙', '🚌', '🚎', '🏎️', '🚓', '🚑', '🚒', '🚐', '🛻', '🚚', '🚛', '🚜', '🦯', '🦽', '🦼', '🛴', '🚲', '🛵', '🏍️', '🛺', '🚨', '🚔', '🚍', '🚘', '🚖', '🚡', '🚠', '🚟', '🚃', '🚋', '🚞', '🚝', '🚄', '🚅', '🚈', '🚂', '🚆', '🚇', '🚊', '🚉', '✈️', '🛫', '🛬', '🛩️', '💺', '🛰️', '🚀', '🛸', '🚁', '🛶', '⛵', '🚤', '🛥️', '🛳️', '⛴️', '🚢', '⚓', '🪝', '⛽', '🚧', '🚦', '🚥', '🚏', '🗺️', '🗿', '🗽', '🗼', '🏰', '🏯', '🏟️', '🎡', '🎢', '🎠', '⛲', '⛱️', '🏖️', '🏝️', '🏜️', '🌋', '⛰️', '🏔️', '🗻', '🏕️', '⛺', '🛖', '🏠', '🏡', '🏘️', '🏚️', '🏗️', '🏭', '🏢', '🏬', '🏣', '🏤', '🏥', '🏦', '🏨', '🏪', '🏫', '🏩', '💒', '🏛️', '⛪', '🕌', '🕍', '🛕', '🕋', '⛩️'],
  'Objects': ['⌚', '📱', '📲', '💻', '⌨️', '🖥️', '🖨️', '🖱️', '🖲️', '🕹️', '🗜️', '💽', '💾', '💿', '📀', '📼', '📷', '📸', '📹', '🎥', '📽️', '🎞️', '📞', '☎️', '📟', '📠', '📺', '📻', '🎙️', '🎚️', '🎛️', '🧭', '⏱️', '⏲️', '⏰', '🕰️', '⌛', '⏳', '📡', '🔋', '🔌', '💡', '🔦', '🕯️', '🪔', '🧯', '🛢️', '💸', '💵', '💴', '💶', '💷', '🪙', '💰', '💳', '💎', '⚖️', '🪜', '🧰', '🪛', '🔧', '🔨', '⚒️', '🛠️', '⛏️', '🪚', '🔩', '⚙️', '🪤', '🧱', '⛓️', '🧲', '🔫', '💣', '🧨', '🪓', '🔪', '🗡️', '⚔️', '🛡️', '🚬', '⚰️', '🪦', '⚱️', '🏺', '🔮', '📿', '🧿', '💈', '⚗️', '🔭', '🔬', '🕳️', '🩹', '🩺', '💊', '💉', '🩸', '🧬', '🦠', '🧫', '🧪', '📝', '✏️', '🖊️', '🖋️', '🖍️', '📖', '📗', '📘', '📙', '📕', '📓', '📔', '📒', '📚', '📰', '🗞️', '📜', '📃', '📄', '📑', '📊', '📈', '📉', '📆', '📅', '🗓️', '📇', '🗃️', '🗳️', '🗄️', '📋', '📌', '📍', '📎', '🖇️', '📏', '📐', '✂️', '🗂️', '🗑️', '✉️', '📧', '📨', '📩', '📤', '📥', '📦', '📫', '📪', '📬', '📭', '📮', '🔒', '🔓', '🔏', '🔐', '🔑', '🗝️', '🪞', '🪟', '🛋️', '🪑', '🚪', '🛏️', '🧸', '🪆', '🖼️', '🛒', '🛍️', '🏷️', '🧴', '🧷', '🧹', '🧺', '🧻', '🪣', '🧼', '🧽', '🪥', '🪒', '🪄', '👑', '👒', '🎩', '🎓', '🧢', '⛑️', '👓', '🕶️', '🥽', '💼', '👜', '👛', '👝', '🎒', '🧳', '👞', '👟', '🥾', '🥿', '👠', '👡', '🩰', '👢', '👗', '👔', '👕', '👖', '🧣', '🧤', '🧥', '🧦', '👙', '👘', '🥻', '🩱', '🩲', '🩳', '💄', '💍'],
  'Symbols': ['❤️', '🧡', '💛', '💚', '💙', '💜', '🖤', '🤍', '🤎', '💔', '❣️', '💕', '💞', '💓', '💗', '💖', '💘', '💝', '💟', '☮️', '✝️', '☪️', '🕉️', '☸️', '✡️', '🔯', '🕎', '☯️', '☦️', '🛐', '⛎', '♈', '♉', '♊', '♋', '♌', '♍', '♎', '♏', '♐', '♑', '♒', '♓', '🆔', '⚛️', '🉑', '☢️', '☣️', '📴', '📳', '🈶', '🈚', '🈸', '🈺', '🈷️', '✴️', '🆚', '💮', '🉐', '㊙️', '㊗️', '🈴', '🈵', '🈹', '🈲', '🅰️', '🅱️', '🆎', '🆑', '🅾️', '🆘', '❌', '⭕', '🛑', '⛔', '📛', '🚫', '💯', '💢', '♨️', '🚷', '🚯', '🚳', '🚱', '🔞', '📵', '🚭', '❗', '❕', '❓', '❔', '‼️', '⁉️', '🔅', '🔆', '〽️', '⚠️', '🚸', '🔱', '⚜️', '🔰', '♻️', '✅', '🈯', '💹', '❇️', '✳️', '❎', '🌐', '💠', 'Ⓜ️', '🌀', '💤', '🏧', '🚾', '♿', '🅿️', '🛗', '🈳', '🈂️', '🛂', '🛃', '🛄', '🛅', '🚹', '🚺', '🚼', '⚧️', '🚻', '🚮', '🎦', '📶', '🈁', '🔣', 'ℹ️', '🔤', '🔡', '🔠', '🆖', '🆗', '🆙', '🆒', '🆕', '🆓', '0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟', '🔢', '#️⃣', '*️⃣', '⏏️', '▶️', '⏸️', '⏯️', '⏹️', '⏺️', '⏭️', '⏮️', '⏩', '⏪', '⏫', '⏬', '◀️', '🔼', '🔽', '➡️', '⬅️', '⬆️', '⬇️', '↗️', '↘️', '↙️', '↖️', '↕️', '↔️', '↪️', '↩️', '⤴️', '⤵️', '🔀', '🔁', '🔂', '🔄', '🔃', '🎵', '🎶', '➕', '➖', '➗', '✖️', '♾️', '💲', '💱', '™️', '©️', '®️', '〰️', '➰', '➿', '🔚', '🔙', '🔛', '🔝', '🔜', '✔️', '☑️', '🔘', '🔴', '🟠', '🟡', '🟢', '🔵', '🟣', '⚫', '⚪', '🟤', '🔺', '🔻', '🔸', '🔹', '🔶', '🔷', '🔳', '🔲', '▪️', '▫️', '◾', '◽', '◼️', '◻️', '🟥', '🟧', '🟨', '🟩', '🟦', '🟪', '⬛', '⬜', '🟫', '🔈', '🔇', '🔉', '🔊', '🔔', '🔕', '📣', '📢', '👁️‍🗨️', '💬', '💭', '🗯️', '♠️', '♣️', '♥️', '♦️', '🃏', '🎴', '🀄', '🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚', '🕛', '🕜', '🕝', '🕞', '🕟', '🕠', '🕡', '🕢', '🕣', '🕤', '🕥', '🕦', '🕧', '🏁', '🚩', '🎌', '🏳️', '🏴', '🏳️‍🌈'],
  'Nature': ['🌸', '💮', '🏵️', '🌹', '🥀', '🌺', '🌻', '🌼', '🌷', '🌱', '🪴', '🌲', '🌳', '🌴', '🌵', '🌾', '🌿', '☘️', '🍀', '🍁', '🍂', '🍃', '🍄', '🌰', '🦀', '🦞', '🦐', '🦑', '🌍', '🌎', '🌏', '🌐', '🪨', '🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘', '🌙', '🌚', '🌛', '🌜', '☀️', '🌝', '🌞', '🪐', '⭐', '🌟', '🌠', '🌌', '☁️', '⛅', '⛈️', '🌤️', '🌥️', '🌦️', '🌧️', '🌨️', '🌩️', '🌪️', '🌫️', '🌬️', '🌀', '🌈', '🌂', '☂️', '☔', '⛱️', '⚡', '❄️', '☃️', '⛄', '☄️', '🔥', '💧', '🌊'],
}

let selectedCategory: Category = 'People'
let onSelectCallback: ((emoji: string) => void) | null = null
let searchQuery = ''

const Container = define('EmojiPickerContainer', {
  display: 'flex',
  flexDirection: 'column',
  gap: 12,
})

const SearchInput = define('EmojiSearchInput', {
  base: 'input',
  width: '100%',
  padding: '8px 12px',
  fontSize: 14,
  border: `1px solid ${theme('colors-border')}`,
  borderRadius: theme('radius-md'),
  background: theme('colors-bg'),
  color: theme('colors-text'),
  outline: 'none',
  selectors: {
    '&:focus': { borderColor: theme('colors-primary') },
    '&::placeholder': { color: theme('colors-textMuted') },
  },
})

const EmojiGrid = define('EmojiGrid', {
  display: 'grid',
  gridTemplateColumns: 'repeat(10, 1fr)',
  gap: 4,
  overflow: 'auto',
  alignContent: 'start',
  height: 280,
})

const TabBar = define('EmojiTabBar', {
  display: 'flex',
  justifyContent: 'center',
  gap: 4,
  paddingTop: 12,
  borderTop: `1px solid ${theme('colors-border')}`,
  marginTop: 'auto',
})

const TabButton = define('EmojiTabButton', {
  base: 'button',
  padding: '8px 10px',
  background: 'none',
  border: 'none',
  borderRadius: theme('radius-md'),
  cursor: 'pointer',
  fontSize: 18,
  lineHeight: 1,
  opacity: 0.5,
  selectors: {
    '&:hover': { opacity: 0.8, background: theme('colors-bgHover') },
  },
  variants: {
    active: { opacity: 1, background: theme('colors-bgSelected') },
  },
})

const EmojiButton = define('EmojiButton', {
  base: 'button',
  padding: 6,
  background: 'none',
  border: 'none',
  borderRadius: theme('radius-md'),
  cursor: 'pointer',
  fontSize: 22,
  lineHeight: 1,
  selectors: {
    '&:hover': { background: theme('colors-bgHover') },
  },
})

const getEmojis = (): string[] => {
  if (searchQuery.trim()) {
    const query = searchQuery.toLowerCase()
    const allEmojis = Object.values(EMOJI_CATEGORIES).flat()
    return [...new Set(allEmojis)].filter(emoji => {
      const keywords = EMOJI_KEYWORDS[emoji] || []
      return keywords.some(keyword => keyword.includes(query)) || emoji.includes(query)
    })
  }
  return EMOJI_CATEGORIES[selectedCategory]
}

const EmojiResults = () => {
  const emojis = getEmojis()
  return (
    <>
      {emojis.map((emoji, i) => (
        <EmojiButton key={i} onClick={() => handleSelect(emoji)}>
          {emoji}
        </EmojiButton>
      ))}
    </>
  )
}

const updateSearch = (query: string) => {
  searchQuery = query
  update('#emoji-results', <EmojiResults />)
}

const selectCategory = (category: Category) => {
  selectedCategory = category
  searchQuery = ''
  // Clear the search input
  const input = document.getElementById('emoji-search') as HTMLInputElement
  if (input) input.value = ''
  update()
}

const handleSelect = (emoji: string) => {
  onSelectCallback?.(emoji)
  closeModal()
}

const CATEGORIES: Category[] = ['People', 'Gestures', 'Animals', 'Food', 'Activities', 'Travel', 'Objects', 'Symbols', 'Nature']

const EmojiPickerContent = define('EmojiPickerContent', {
  render() {
    const isSearching = searchQuery.trim().length > 0

    return (
      <Container>
        <SearchInput
          id="emoji-search"
          type="text"
          placeholder="Search emojis... (e.g. dice, heart, cat)"
          value={searchQuery}
          onInput={(e: Event) => updateSearch((e.target as HTMLInputElement).value)}
          autofocus
        />

        <EmojiGrid id="emoji-results">
          <EmojiResults />
        </EmojiGrid>

        {!isSearching && (
          <TabBar>
            {CATEGORIES.map(cat => (
              <TabButton
                key={cat}
                active={cat === selectedCategory ? true : undefined}
                onClick={() => selectCategory(cat)}
                title={cat}
              >
                {CATEGORY_ICONS[cat]}
              </TabButton>
            ))}
          </TabBar>
        )}
      </Container>
    )
  }
})

export const openEmojiPicker = (onSelect: (emoji: string) => void) => {
  selectedCategory = 'People'
  searchQuery = ''
  onSelectCallback = onSelect
  openModal('Choose Emoji', () => <EmojiPickerContent />)
}
