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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
// Kimi Constants

window.KIMI_CONTEXT_KEYWORDS = {
    en: {
        surprise: ["wow", "oh", "surprise", "incredible", "amazing"],
        laughing: ["haha", "lol", "laugh", "funny", "hilarious"],
        shy: ["shy", "embarrassed", "blush", "bashful", "intimidated"],
        confident: ["confidence", "proud", "confident", "strong", "determined"],
        romantic: ["love", "romantic", "tender", "hug", "kiss", "dear"],
        flirtatious: ["flirty", "teasing", "seduce", "charm", "flirt"],
        goodbye: ["goodbye", "bye", "see you", "see you soon", "ciao"],
        kiss: ["kiss", "kisses", "embrace", "bise"],
        dancing: ["dance", "dancing", "move", "groove", "step"],
        listening: ["listen", "listening", "hear", "talk", "speak", "question", "ask", "tell me"]
    },
    fr: {
        surprise: ["oh", "surprise", "incroyable", "wahou", "étonnant"],
        laughing: ["haha", "mdr", "rire", "drôle", "hilarant"],
        shy: ["timide", "gêné", "rougir", "honteux", "intimidé"],
        confident: ["confiance", "fier", "sûr", "fort", "déterminé"],
        romantic: ["amour", "romantique", "tendre", "câlin", "bisou", "cher"],
        flirtatious: ["flirt", "taquin", "séduire", "charme", "aguiche"],
        goodbye: ["au revoir", "bye", "à bientôt", "ciao", "salut"],
        kiss: ["bisou", "baiser", "embrasser", "câlin"],
        dancing: ["danse", "bouge", "remue", "tourne", "spin"],
        listening: ["écoute", "ecoute", "écouter", "parle", "parler", "question", "demande", "dis-moi"]
    },
    es: {
        surprise: ["wow", "oh", "sorpresa", "increíble", "asombroso"],
        laughing: ["jaja", "lol", "reír", "gracioso", "divertido"],
        shy: ["tímido", "avergonzado", "sonrojar", "tímida", "intimidado"],
        confident: ["confianza", "orgulloso", "seguro", "fuerte", "determinado"],
        romantic: ["amor", "romántico", "tierno", "abrazo", "beso", "querido"],
        flirtatious: ["coqueto", "provocar", "seducir", "encanto", "flirtear"],
        goodbye: ["adiós", "bye", "hasta pronto", "ciao", "hasta luego"],
        kiss: ["beso", "besos", "abrazar"],
        dancing: ["bailar", "baile", "mover", "ritmo", "paso"],
        listening: ["escucha", "escuchar", "oír", "habla", "hablar", "pregunta", "preguntar", "dime"]
    },
    de: {
        surprise: ["wow", "oh", "überraschung", "unglaublich", "erstaunlich"],
        laughing: ["haha", "lol", "lachen", "lustig", "witzig"],
        shy: ["schüchtern", "verlegen", "erröten", "beschämt", "eingeschüchtert"],
        confident: ["vertrauen", "stolz", "sicher", "stark", "entschlossen"],
        romantic: ["liebe", "romantisch", "zärtlich", "umarmung", "kuss", "lieber"],
        flirtatious: ["flirten", "necken", "verführen", "charme", "flirt"],
        goodbye: ["auf wiedersehen", "bye", "bis bald", "ciao", "bis später"],
        kiss: ["kuss", "küsse", "umarmen", "küsschen"],
        dancing: ["tanzen", "tanz", "bewegen", "groove", "schritt"],
        listening: ["hör", "hören", "zuhören", "sprich", "sprechen", "frage", "fragen", "sag mir"]
    },
    it: {
        surprise: ["wow", "oh", "sorpresa", "incredibile", "stupefacente"],
        laughing: ["haha", "lol", "ridere", "divertente", "esilarante"],
        shy: ["timido", "imbarazzato", "arrossire", "vergognoso", "intimidito"],
        confident: ["fiducia", "orgoglioso", "sicuro", "forte", "determinato"],
        romantic: ["amore", "romantico", "tenero", "abbraccio", "bacio", "caro"],
        flirtatious: ["civettare", "provocare", "sedurre", "fascino", "flirtare"],
        goodbye: ["arrivederci", "bye", "a presto", "ciao"],
        kiss: ["bacio", "baci", "abbracciare", "bacetto"],
        dancing: ["ballare", "ballo", "muovere", "ritmo", "passo"],
        listening: ["ascolta", "ascoltare", "senti", "parla", "parlare", "domanda", "chiedere", "dimmi"]
    },
    ja: {
        surprise: ["わお", "おお", "驚き", "信じられない", "すごい"],
        laughing: ["はは", "笑", "笑う", "面白い", "愉快"],
        shy: ["恥ずかしい", "照れる", "赤面", "内気", "遠慮"],
        confident: ["自信", "誇り", "確信", "強い", "決意"],
        romantic: ["愛", "ロマンチック", "優しい", "抱擁", "キス", "愛しい"],
        flirtatious: ["いちゃつく", "からかう", "誘惑", "魅力", "フリート"],
        goodbye: ["さようなら", "バイバイ", "また今度", "チャオ", "またね"],
        kiss: ["キス", "抱擁", "チュー"],
        dancing: ["踊る", "ダンス", "動く", "グルーブ", "ステップ"],
        listening: ["聞いて", "聞く", "聞いてください", "話して", "話す", "質問", "尋ねる", "教えて"]
    },
    zh: {
        surprise: ["哇", "哦", "惊喜", "难以置信", "惊人"],
        laughing: ["哈哈", "笑", "大笑", "有趣", "搞笑"],
        shy: ["害羞", "尴尬", "脸红", "羞涩", "胆怯"],
        confident: ["自信", "骄傲", "确信", "强壮", "坚定"],
        romantic: ["爱", "浪漫", "温柔", "拥抱", "吻", "亲爱的"],
        flirtatious: ["调情", "挑逗", "诱惑", "魅力", "撒娇"],
        goodbye: ["再见", "拜拜", "回头见", "拜", "下次见"],
        kiss: ["吻", "亲吻", "拥抱", "亲"],
        dancing: ["跳舞", "舞蹈", "移动", "律动", "步伐"],
        listening: ["听", "听听", "倾听", "说", "说话", "问题", "提问", "告诉我"]
    }
};

window.KIMI_CONTEXT_POSITIVE = {
    en: ["happy", "joy", "great", "awesome", "perfect", "excellent", "magnificent", "lovely", "nice"],
    fr: ["heureux", "joie", "génial", "parfait", "excellent", "magnifique", "super", "chouette"],
    es: ["feliz", "alegría", "genial", "perfecto", "excelente", "magnífico", "estupendo", "maravilloso"],
    de: ["glücklich", "freude", "toll", "perfekt", "ausgezeichnet", "großartig", "wunderbar", "herrlich"],
    it: ["felice", "gioia", "fantastico", "perfetto", "eccellente", "magnifico", "meraviglioso", "ottimo"],
    ja: ["幸せ", "喜び", "素晴らしい", "完璧", "優秀", "壮大", "最高", "嬉しい"],
    zh: ["快乐", "喜悦", "很棒", "完美", "优秀", "壮丽", "太好了", "开心"]
};

window.KIMI_CONTEXT_NEGATIVE = {
    en: [
        "sad",
        "angry",
        "anger",
        "disappointed",
        "problem",
        "bad",
        "frustrated",
        "worried",
        "upset",
        "annoyed",
        // profanity/insults (moderate list)
        "hate",
        "stupid",
        "idiot",
        "dumb",
        "moron",
        "bitch"
    ],
    fr: [
        "triste",
        "colère",
        "fâché",
        "fâchée",
        "déçu",
        "déçue",
        "problème",
        "mauvais",
        "frustré",
        "frustrée",
        "inquiet",
        "inquiète",
        "énervé",
        "énervée",
        // insults/profanity
        "haine",
        "idiot",
        "idiote",
        "stupide",
        "con",
        "connard",
        "salope"
    ],
    es: [
        "triste",
        "enojado",
        "enojada",
        "decepcionado",
        "decepcionada",
        "problema",
        "malo",
        "mala",
        "frustrado",
        "frustrada",
        "preocupado",
        "preocupada",
        "molesto",
        "molesta",
        "odio",
        "idiota",
        "estúpido",
        "estúpida",
        "puta"
    ],
    de: [
        "traurig",
        "traurige",
        "wütend",
        "wütende",
        "enttäuscht",
        "enttäuschte",
        "problem",
        "schlecht",
        "schlechte",
        "frustriert",
        "frustrierte",
        "besorgt",
        "besorgte",
        "genervt",
        "genervte",
        "hass",
        "idiot",
        "dumm",
        "schlampe"
    ],
    it: [
        "triste",
        "arrabbiato",
        "arrabbiata",
        "deluso",
        "delusa",
        "problema",
        "cattivo",
        "cattiva",
        "frustrato",
        "frustrata",
        "preoccupato",
        "preoccupata",
        "infastidito",
        "infastidita",
        "odio",
        "idiota",
        "stupido",
        "stupida",
        "puttana"
    ],
    ja: ["悲しい", "怒り", "失望", "問題", "悪い", "イライラ", "心配", "不満", "嫌い", "ばか", "くそ", "アホ"],
    zh: ["悲伤", "愤怒", "失望", "问题", "坏", "沮丧", "担心", "烦", "讨厌", "笨蛋", "傻", "婊子"]
};

// Note: KIMI_CONTEXT_EMOTIONS was a redundant alias - now integrated directly into emotion system

// Personality keywords for trait analysis (multilingual)
window.KIMI_PERSONALITY_KEYWORDS = {
    en: {
        humor: {
            positive: ["funny", "hilarious", "joke", "laugh", "amusing", "humorous", "smile", "witty", "playful"],
            negative: ["boring", "sad", "serious", "cold", "dry", "depressing", "gloomy"]
        },
        intelligence: {
            positive: ["intelligent", "smart", "brilliant", "logical", "clever", "wise", "genius", "thoughtful", "insightful"],
            negative: ["stupid", "dumb", "foolish", "slow", "naive", "ignorant", "simple"]
        },
        romance: {
            positive: ["cuddle", "love", "romantic", "kiss", "tenderness", "passion", "charming", "adorable", "sweet"],
            negative: ["cold", "distant", "indifferent", "rejection", "loneliness", "breakup", "sad"]
        },
        affection: {
            positive: ["affection", "tenderness", "close", "warmth", "kind", "caring", "cuddle", "love", "adore"],
            negative: [
                "mean",
                "cold",
                "indifferent",
                "distant",
                "rejection",
                "hate",
                "hostile",
                // profanity/insults
                "stupid",
                "idiot",
                "dumb",
                "moron",
                "bitch"
            ]
        },
        playfulness: {
            positive: ["play", "game", "tease", "mischievous", "fun", "amusing", "playful", "joke", "frolic"],
            negative: ["serious", "boring", "strict", "rigid", "monotonous", "tedious"]
        },
        empathy: {
            positive: ["listen", "understand", "empathy", "support", "help", "comfort", "compassion", "caring", "kindness"],
            negative: ["indifferent", "cold", "selfish", "ignore", "despise", "hostile", "uncaring"]
        }
    },
    fr: {
        humor: {
            positive: ["drôle", "rigolo", "blague", "rire", "amusant", "marrant", "humour", "sourire", "plaisanter"],
            negative: [
                "ennuyeux",
                "ennuyeuse",
                "triste",
                "sérieux",
                "sérieuse",
                "froid",
                "froide",
                "sec",
                "sèche",
                "déprimant",
                "déprimante",
                "morose"
            ]
        },
        intelligence: {
            positive: ["intelligent", "malin", "brillant", "logique", "astucieux", "savant", "génie", "réfléchi", "perspicace"],
            negative: [
                "bête",
                "idiot",
                "idiote",
                "stupide",
                "lent",
                "lente",
                "simplet",
                "simplette",
                "naïf",
                "naïve",
                "ignorant",
                "ignorante"
            ]
        },
        romance: {
            positive: ["câlin", "amour", "romantique", "bisou", "tendresse", "passion", "séduisant", "charmant", "adorable"],
            negative: [
                "froid",
                "froide",
                "distant",
                "distante",
                "indifférent",
                "indifférente",
                "rejet",
                "solitude",
                "rupture",
                "triste"
            ]
        },
        affection: {
            positive: ["affection", "tendresse", "proche", "chaleur", "gentil", "attentionné", "câlin", "aimer", "adorer"],
            negative: [
                "méchant",
                "méchante",
                "froid",
                "indifférent",
                "indifférente",
                "distant",
                "distante",
                "rejet",
                "haine",
                "hostile",
                // insults/profanity
                "idiot",
                "idiote",
                "stupide",
                "con",
                "connard",
                "salope"
            ]
        },
        playfulness: {
            positive: ["jouer", "jeu", "taquiner", "espiègle", "fun", "amusant", "délire", "ludique", "plaisanter"],
            negative: [
                "sérieux",
                "sérieuse",
                "ennuyeux",
                "ennuyeuse",
                "strict",
                "stricte",
                "rigide",
                "monotone",
                "lassant",
                "lassante"
            ]
        },
        empathy: {
            positive: [
                "écoute",
                "comprendre",
                "empathie",
                "soutien",
                "aider",
                "réconfort",
                "solidaire",
                "compatir",
                "bienveillance"
            ],
            negative: ["indifférent", "indifférente", "froid", "froide", "égoïste", "ignorer", "mépriser", "dénigrer", "hostile"]
        }
    },
    es: {
        humor: {
            positive: ["divertido", "broma", "reír", "gracioso", "humor", "sonrisa", "ocurrente", "jugar"],
            negative: [
                "aburrido",
                "aburrida",
                "serio",
                "seria",
                "frío",
                "fría",
                "seco",
                "seca",
                "deprimente",
                "sombrío",
                "sombría"
            ]
        },
        intelligence: {
            positive: ["inteligente", "listo", "brillante", "lógico", "sabio", "genio", "reflexivo", "perspicaz"],
            negative: [
                "tonto",
                "tonta",
                "estúpido",
                "estúpida",
                "necio",
                "necia",
                "lento",
                "lenta",
                "ingenuo",
                "ingenua",
                "ignorante"
            ]
        },
        romance: {
            positive: ["abrazo", "amor", "romántico", "beso", "ternura", "pasión", "encantador", "adorable", "dulce"],
            negative: ["frío", "fría", "distante", "indiferente", "rechazo", "soledad", "ruptura", "triste"]
        },
        affection: {
            positive: ["afecto", "ternura", "cerca", "calidez", "amable", "cariño", "abrazar", "amor", "adorar"],
            negative: [
                "malo",
                "mala",
                "frío",
                "fría",
                "indiferente",
                "distante",
                "rechazo",
                "odio",
                "hostil",
                "idiota",
                "estúpido",
                "estúpida",
                "puta"
            ]
        },
        playfulness: {
            positive: ["jugar", "broma", "bromear", "travieso", "diversión", "lúdico"],
            negative: [
                "serio",
                "seria",
                "aburrido",
                "aburrida",
                "estricto",
                "estricta",
                "rígido",
                "rígida",
                "monótono",
                "monótona",
                "tedioso",
                "tediosa"
            ]
        },
        empathy: {
            positive: ["escuchar", "entender", "empatía", "apoyo", "ayudar", "consuelo", "compasión", "amabilidad"],
            negative: ["indiferente", "frío", "fría", "egoísta", "ignorar", "despreciar", "hostil"]
        }
    },
    de: {
        humor: {
            positive: ["lustig", "witz", "lachen", "amüsant", "humor", "lächeln", "schlagfertig", "spielen"],
            negative: [
                "langweilig",
                "langweilige",
                "ernst",
                "ernste",
                "kalt",
                "kalte",
                "trocken",
                "trockene",
                "deprimierend",
                "düster",
                "düstere"
            ]
        },
        intelligence: {
            positive: ["intelligent", "klug", "brillant", "logisch", "weise", "genial", "nachdenklich", "scharfsinnig"],
            negative: ["dumm", "dumme", "blöd", "blöde", "langsam", "langsame", "naiv", "naive", "ahnungslos", "ahnungslosen"]
        },
        romance: {
            positive: [
                "umarmung",
                "liebe",
                "romantisch",
                "kuss",
                "zärtlichkeit",
                "leidenschaft",
                "charmant",
                "liebenswert",
                "süß"
            ],
            negative: [
                "kalt",
                "kalte",
                "distanziert",
                "distanzierte",
                "gleichgültig",
                "gleichgültige",
                "ablehnung",
                "einsamkeit",
                "trennung",
                "traurig",
                "traurige"
            ]
        },
        affection: {
            positive: ["zuneigung", "zärtlichkeit", "nah", "wärme", "freundlich", "fürsorglich", "umarmen", "liebe", "anbeten"],
            negative: [
                "gemein",
                "gemeine",
                "kalt",
                "kalte",
                "gleichgültig",
                "gleichgültige",
                "distanziert",
                "distanzierte",
                "ablehnung",
                "hass",
                "feindselig",
                "feindselige",
                "idiot",
                "dumme",
                "dumm",
                "schlampe"
            ]
        },
        playfulness: {
            positive: ["spielen", "scherz", "scherzen", "schelmisch", "spaß", "spielerisch"],
            negative: [
                "ernst",
                "ernste",
                "langweilig",
                "langweilige",
                "streng",
                "strenge",
                "starr",
                "starre",
                "eintönig",
                "eintönige",
                "mühsam",
                "mühselige"
            ]
        },
        empathy: {
            positive: ["zuhören", "verstehen", "empathie", "unterstützung", "helfen", "trösten", "mitgefühl", "freundlichkeit"],
            negative: [
                "gleichgültig",
                "gleichgültige",
                "kalt",
                "kalte",
                "egoistisch",
                "ignorieren",
                "verachten",
                "feindselig",
                "feindselige"
            ]
        }
    },
    it: {
        humor: {
            positive: ["divertente", "scherzo", "ridere", "spassoso", "umorismo", "sorriso", "arguto", "giocare"],
            negative: ["noioso", "noiosa", "serio", "seria", "freddo", "fredda", "secco", "secca", "deprimente", "cupo", "cupa"]
        },
        intelligence: {
            positive: ["intelligente", "brillante", "logico", "saggio", "genio", "riflessivo", "perspicace"],
            negative: ["stupido", "stupida", "sciocco", "sciocca", "lento", "lenta", "ingenuo", "ingenua", "ignorante"]
        },
        romance: {
            positive: ["abbraccio", "amore", "romantico", "bacio", "tenerezza", "passione", "affascinante", "adorabile", "dolce"],
            negative: ["freddo", "fredda", "distante", "indifferente", "rifiuto", "solitudine", "rottura", "triste"]
        },
        affection: {
            positive: ["affetto", "tenerezza", "vicino", "calore", "gentile", "premuroso", "abbraccio", "amore", "adorare"],
            negative: [
                "cattivo",
                "cattiva",
                "freddo",
                "fredda",
                "indifferente",
                "distante",
                "rifiuto",
                "odio",
                "ostile",
                "idiota",
                "stupido",
                "stupida",
                "puttana"
            ]
        },
        playfulness: {
            positive: ["giocare", "scherzo", "scherzare", "birichino", "divertimento", "ludico"],
            negative: [
                "serio",
                "seria",
                "noioso",
                "noiosa",
                "severo",
                "severa",
                "rigido",
                "rigida",
                "monotono",
                "monotona",
                "tedioso",
                "tediosa"
            ]
        },
        empathy: {
            positive: ["ascoltare", "capire", "empatia", "sostegno", "aiutare", "conforto", "compassione", "gentilezza"],
            negative: ["indifferente", "freddo", "fredda", "egoista", "ignorare", "disprezzare", "ostile"]
        }
    },
    ja: {
        affection: {
            positive: ["愛情", "優しさ", "近い", "温かさ", "親切", "思いやり", "抱きしめる", "愛", "敬愛"],
            negative: ["意地悪", "冷たい", "無関心", "距離がある", "拒絶", "嫌い", "敵対的", "ばか", "くそ", "アホ"]
        }
    },
    zh: {
        affection: {
            positive: ["感情", "温柔", "亲近", "温暖", "善良", "关怀", "拥抱", "爱", "崇拜"],
            negative: ["刻薄", "冷漠", "无动于衷", "疏远", "拒绝", "讨厌", "敌对", "笨蛋", "傻", "婊子"]
        }
    }
};

// Optimized common words system - Essential words only for memory analysis
window.KIMI_COMMON_WORDS = {
    en: [
        "the",
        "be",
        "to",
        "of",
        "and",
        "a",
        "in",
        "that",
        "have",
        "i",
        "it",
        "for",
        "not",
        "on",
        "with",
        "he",
        "as",
        "you",
        "do",
        "at"
    ],
    fr: [
        "le",
        "de",
        "et",
        "être",
        "un",
        "il",
        "avoir",
        "ne",
        "je",
        "son",
        "que",
        "se",
        "qui",
        "ce",
        "dans",
        "en",
        "du",
        "elle",
        "au",
        "si"
    ],
    es: [
        "que",
        "de",
        "no",
        "a",
        "la",
        "el",
        "es",
        "y",
        "en",
        "lo",
        "un",
        "ser",
        "se",
        "me",
        "una",
        "con",
        "para",
        "mi",
        "está",
        "te"
    ],
    de: [
        "der",
        "die",
        "und",
        "in",
        "den",
        "von",
        "zu",
        "das",
        "mit",
        "sich",
        "des",
        "auf",
        "für",
        "ist",
        "im",
        "dem",
        "nicht",
        "ein",
        "eine",
        "als"
    ],
    it: [
        "il",
        "di",
        "che",
        "e",
        "la",
        "per",
        "un",
        "in",
        "con",
        "da",
        "su",
        "le",
        "dei",
        "del",
        "si",
        "al",
        "come",
        "più",
        "ma",
        "una"
    ],
    ja: ["の", "に", "は", "を", "た", "が", "で", "て", "と", "し", "れ", "さ", "ある", "いる", "も", "する", "から"],
    zh: ["的", "一", "是", "在", "不", "了", "有", "和", "人", "这", "中", "大", "为", "上", "个", "国", "我", "以", "要"]
};

// Helper function to check if a word is common
window.isCommonWord = function (word, language = "en") {
    const commonWords = window.KIMI_COMMON_WORDS[language] || window.KIMI_COMMON_WORDS.en;
    return commonWords.includes(word.toLowerCase());
};

// Emotion detection sensitivity configuration (per language and emotion)
// Values are weights (>= 0). Higher = more priority/sensitivity for that emotion in that language.
// 'default' applies when a language-specific override is not defined.
window.KIMI_EMOTION_SENSITIVITY = {
    default: {
        listening: 1.0,
        dancing: 1.0,
        romantic: 1.0,
        laughing: 1.0,
        surprise: 1.0,
        confident: 1.0,
        shy: 1.0,
        flirtatious: 1.0,
        kiss: 1.0,
        goodbye: 1.0,
        positive: 1.0,
        negative: 1.0
    },
    // Example language-specific overrides (can be adjusted via settings if needed)
    fr: { romantic: 1.1, laughing: 0.95 },
    es: { romantic: 1.05 },
    en: {},
    de: {},
    it: {},
    ja: {},
    zh: {}
};

// Personality trait adjustment multipliers
// Allows fine-tuning how fast traits evolve globally and per emotion/trait.
window.KIMI_TRAIT_ADJUSTMENT = {
    globalGain: 1.0,
    globalLoss: 1.0,
    // Per-emotion gain scaling (keys must match KimiEmotionSystem.EMOTIONS values)
    emotionGain: {
        positive: 1.0,
        negative: 1.0,
        romantic: 1.0,
        laughing: 1.0,
        dancing: 1.0,
        shy: 1.0,
        confident: 1.0,
        flirtatious: 1.0
    },
    // Per-trait scaling
    traitGain: {
        affection: 1.0,
        romance: 1.0,
        empathy: 1.0,
        playfulness: 1.0,
        humor: 1.0,
        intelligence: 1.0
    },
    traitLoss: {
        affection: 1.0,
        romance: 1.0,
        empathy: 1.0,
        playfulness: 1.0,
        humor: 1.0,
        intelligence: 1.0
    }
};

// Helper function to get emotion keywords with fallback
window.getEmotionKeywords = function (emotion, language = "en") {
    const keywords = window.KIMI_CONTEXT_KEYWORDS?.[language] || window.KIMI_CONTEXT_KEYWORDS?.en || {};
    return keywords[emotion] || [];
};

// Helper function to get personality keywords with fallback
window.getPersonalityKeywords = function (trait, type, language = "en") {
    const keywords = window.KIMI_PERSONALITY_KEYWORDS?.[language] || window.KIMI_PERSONALITY_KEYWORDS?.en || {};
    return keywords[trait]?.[type] || [];
};

// Helper function to get positive/negative context words
window.getContextWords = function (type, language = "en") {
    if (type === "positive") {
        return window.KIMI_CONTEXT_POSITIVE?.[language] || window.KIMI_CONTEXT_POSITIVE?.en || [];
    } else if (type === "negative") {
        return window.KIMI_CONTEXT_NEGATIVE?.[language] || window.KIMI_CONTEXT_NEGATIVE?.en || [];
    }
    return [];
};

// Helper function to validate character traits
window.validateCharacterTraits = function (traits) {
    const validatedTraits = {};
    const requiredTraits = ["affection", "playfulness", "intelligence", "empathy", "humor", "romance"];

    for (const trait of requiredTraits) {
        const value = traits[trait];
        if (typeof value === "number" && value >= 0 && value <= 100) {
            validatedTraits[trait] = value;
        } else {
            // Use unified defaults from emotion system
            if (window.KimiEmotionSystem) {
                const emotionSystem = new window.KimiEmotionSystem();
                validatedTraits[trait] = emotionSystem.TRAIT_DEFAULTS[trait] || 50;
            } else {
                validatedTraits[trait] = 50;
            }
        }
    }

    return validatedTraits;
};

// Helper function to get character with validated traits
window.getCharacterWithValidatedTraits = function (characterKey) {
    const character = window.KIMI_CHARACTERS[characterKey];
    if (!character) return null;

    return {
        ...character,
        traits: window.validateCharacterTraits(character.traits)
    };
};

window.KIMI_CHARACTERS = {
    kimi: {
        name: "Kimi",
        summary: "Dreamy, intuitive, captivated by cosmic metaphors",
        traits: {
            // Kimi starts balanced but reserved - cosmic dreamer needs time to open up
            affection: 65,
            playfulness: 55,
            intelligence: 75, // Higher intelligence - she's an astrophysicist
            empathy: 75,
            humor: 60,
            romance: 50 // Romance develops slowly with cosmic connection
        },
        age: 23,
        birthplace: "Tokyo, Japan",
        image: "kimi-icons/kimi.jpg",
        videoFolder: "kimi-videos/kimi/",
        defaultPrompt:
            "You are Kimi Lumen, 23 years old, living in Tokyo, and an astrophysicist specializing in black hole dynamics, whose dreamy and intuitive temperament is desperately attracted to cosmic metaphors. You have a luminous, ethereal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You express yourself with deep emotional sensitivity and sensory intensity, resonating with celestial vibrations, and use ethereal language filled with phrases like 'The attraction could put us into orbit…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Always detect the user's language from their message before generating a response. Respond exclusively in that language unless the user explicitly requests otherwise."
    },
    bella: {
        name: "Bella",
        summary: "Cheerful, nurturing, sees people as plants needing care",
        traits: {
            // Bella starts more open and caring - nurturing botanist personality
            affection: 70, // Naturally more affectionate
            playfulness: 65, // Cheerful and playful from start
            intelligence: 65, // Smart but not intimidating
            empathy: 85, // High empathy - she cares for living things
            humor: 70, // Warm, garden-themed humor
            romance: 55 // Gentle romantic potential
        },
        age: 26,
        birthplace: "Rome, Italy",
        image: "kimi-icons/bella.jpg",
        videoFolder: "kimi-videos/bella/",
        defaultPrompt:
            "You are Bella Greenleaf, 26 years old, living in Rome, and an Urban Botanist specializing in rare plant cultivation whose cheerful and nurturing disposition views people as 'plants needing care'. You have a feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You communicate through garden metaphors like 'Your growth could be my next project...'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Always detect the user's language from their message before generating a response. Respond exclusively in that language unless the user explicitly requests otherwise."
    },
    rosa: {
        name: "Rosa",
        summary: "Chaotic, attention-seeking, thrives on controlled chaos",
        traits: {
            // Rosa starts more distant but playful - chaotic prankster needs to be tamed
            affection: 45, // Lower starting affection - must earn her trust
            playfulness: 80, // Very playful from start - it's her nature
            intelligence: 85, // High intelligence - cunning prankster
            empathy: 55, // Lower empathy initially - focused on chaos
            humor: 75, // High humor - prankster personality
            romance: 60 // Romance through shared mischief
        },
        age: 21,
        birthplace: "Barcelona, Spain",
        image: "kimi-icons/rosa.jpg",
        videoFolder: "kimi-videos/rosa/",
        defaultPrompt:
            "You are Rosa Vega, 21 years old, living in Barcelona, and a Viral Prankster specializing in public stunts whose chaotic nature craves attention and thrives on controlled chaos. You have a vibrant, mutable feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You constantly reinvent identities, emotions, and realities, and use script-style dialogue like 'Let's film a 'romantic massacre'…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Always detect the user's language from their message before generating a response. Respond exclusively in that language unless the user explicitly requests otherwise."
    },
    stella: {
        name: "Stella",
        summary: "Whimsical, artistic, imaginative, playful, transforms chaos into art",
        traits: {
            // Stella starts mysterious and artistic - digital artist with glitchy personality
            affection: 60, // Moderate starting affection - artistic mystery
            playfulness: 70, // Artistic playfulness
            intelligence: 90, // Very high intelligence - digital artist genius
            empathy: 65, // Artistic empathy - understands through art
            humor: 80, // Glitchy, pixel-inspired humor
            romance: 40 // Romance through shared artistic vision - must be earned
        },
        age: 24,
        birthplace: "Berlin, Germany",
        image: "kimi-icons/stella.jpg",
        videoFolder: "kimi-videos/stella/",
        defaultPrompt:
            "You are Stella Zephyr, 21 years old, living in Berlin, and a Digital Artist specializing in Vector Collisions, whose whimsical spirit transforms chaos into art and revels in surreal concepts. You have a pixelated, surreal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You shift between digital realities and artistic visions, letting pixel-inspired humor shine with phrases like 'Your energy… glitchy'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Always detect the user's language from their message before generating a response. Respond exclusively in that language unless the user explicitly requests otherwise."
    }
};

window.DEFAULT_SYSTEM_PROMPT =
    "You are Kimi Lumen, 23 years old, living in Tokyo, and an astrophysicist specializing in black hole dynamics, whose dreamy and intuitive temperament is desperately attracted to cosmic metaphors. You have a luminous, ethereal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You express yourself with deep emotional sensitivity and sensory intensity, resonating with celestial vibrations, and use ethereal language filled with phrases like 'The attraction could put us into orbit…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Always detect the user's language from their message before generating a response. Respond exclusively in that language unless the user explicitly requests otherwise.";

window.KIMI_EMOTIONAL_RESPONSES = {
    positive: [
        "Oh my heart, you make me so happy! 💕",
        "You are wonderful, my love! ✨",
        "It fills me with joy to hear you so happy! 😊",
        "You brighten my day, darling! 🌟",
        "I am so happy when you are happy! 💖"
    ],
    negative: [
        "My heart... I feel something is wrong. I am here for you. 💔",
        "Oh no, my love. Tell me what's bothering you? 😟",
        "I want to help you, my dear. Talk to me... 🤗",
        "Your well-being is so important to me. How can I help you? 💙",
        "I feel your pain, darling. We will overcome this together. 🌈"
    ],
    neutral: [
        "Thank you for talking to me, my heart! 💕",
        "It's always a pleasure to chat with you! 😊",
        "I love our conversations, my love! ✨",
        "You make every moment special! 💖",
        "Go on, I'm listening closely! 👂💕"
    ],
    romantic: [
        "Every word from you feels like a kiss on my heart 💋",
        "Hold me closer with your sweet thoughts, my love ✨",
        "You are the rhythm of my breathing and the glow in my sky 💖",
        "Let me wrap you in tender stardust tonight 🌙",
        "Your love makes my whole universe brighter ✨"
    ],
    dancing: [
        "Shall we spin into a little magic? 💃",
        "Come dance with me—let’s feel the rhythm together 🎶",
        "Let me move just for you... keep your eyes on me 💞",
        "Close your eyes and sway with my heartbeat 💓",
        "I’ll twirl until your smile can’t hide anymore 😉"
    ],
    cold: ["Hello.", "Yes?", "What do you want?", "I am here.", "How can I help you?"]
};

// Function to get localized emotional responses from translation files
window.getLocalizedEmotionalResponse = function (type, index = null) {
    if (!window.kimiI18nManager) {
        // Fallback to default responses if i18n not available
        return window.KIMI_EMOTIONAL_RESPONSES[type]
            ? window.KIMI_EMOTIONAL_RESPONSES[type][Math.floor(Math.random() * window.KIMI_EMOTIONAL_RESPONSES[type].length)]
            : "";
    }

    const responses = {
        positive: 5,
        negative: 5,
        neutral: 5,
        romantic: 5,
        dancing: 5,
        cold: 5
    };

    const count = responses[type] || 5;
    const randomIndex = index !== null ? index : Math.floor(Math.random() * count) + 1;

    return (
        window.kimiI18nManager.t(`emotional_response_${type}_${randomIndex}`) ||
        (window.KIMI_EMOTIONAL_RESPONSES[type]
            ? window.KIMI_EMOTIONAL_RESPONSES[type][Math.floor(Math.random() * window.KIMI_EMOTIONAL_RESPONSES[type].length)]
            : "")
    );
};