File size: 199,759 Bytes
727766b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>NEXA — کهکشان فناوری و هوش مصنوعی ایرانی؛ ۴۸ فضای زنده، بازی، آموزش و ابزار</title>
<meta name="description" content="NEXA سازمان غیرانتفاعی توسعه هوش مصنوعی ایران؛ ابرسایت رسمی با ۴۸ فضای زنده Hugging Face: مدل بومی kokb1، چت هوش مصنوعی، هزاران بازی، آموزش فیزیک و زیست، سیستم‌عامل وب و ده‌ها ابزار رایگان — اجرا روی هر دستگاه، بدون نصب.">
<meta name="keywords" content="NEXA, nexa, هوش مصنوعی ایرانی, kokb1, مدل زبانی فارسی, بازی آنلاین رایگان, آموزش فیزیک, زیست دهم, داک ای آی, DuckAI, سیستم عامل وب, ابزار آنلاین, Hugging Face, Persian NLP, Iranian AI">
<meta name="author" content="NEXA — Iranian AI Development Organization">
<meta name="publisher" content="NEXA">
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1">
<meta name="googlebot" content="index, follow">
<meta name="bingbot" content="index, follow">
<meta name="rating" content="general">
<meta name="distribution" content="global">
<meta name="coverage" content="Worldwide">
<meta name="application-name" content="NEXA">
<meta name="apple-mobile-web-app-title" content="NEXA">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#0b0722">
<meta name="msapplication-TileColor" content="#0b0722">
<meta name="color-scheme" content="dark">
<meta name="format-detection" content="telephone=no">
<!-- پس از استقرار روی دامنه نهایی، canonical را با همان نشانی تنظیم کنید -->
<link rel="canonical" href="https://nexa.hf.space/">
<link rel="alternate" hreflang="fa" href="https://nexa.hf.space/">
<link rel="alternate" hreflang="x-default" href="https://nexa.hf.space/">
<meta property="og:type" content="website">
<meta property="og:site_name" content="NEXA">
<meta property="og:locale" content="fa_IR">
<meta property="og:title" content="NEXA — کهکشان فناوری و هوش مصنوعی ایرانی">
<meta property="og:description" content="۴۸ فضای زنده، مدل بومی kokb1، هزاران بازی، آموزش تعاملی و ده‌ها ابزار رایگان؛ همه در یک ابرسایت، روی هر دستگاه.">
<meta property="og:url" content="https://nexa.hf.space/">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="NEXA — کهکشان فناوری و هوش مصنوعی ایرانی">
<meta name="twitter:description" content="۴۸ فضای زنده Hugging Face: هوش مصنوعی، بازی، آموزش و ابزار — رایگان و متن‌باز.">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ffc247'/%3E%3Cstop offset='.5' stop-color='%23ff4d8d'/%3E%3Cstop offset='1' stop-color='%238b5cf6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='48' height='48' rx='11' fill='%230b0722'/%3E%3Cpath d='M24 4l4.2 15.8L44 24l-15.8 4.2L24 44l-4.2-15.8L4 24l15.8-4.2z' fill='url(%23g)'/%3E%3Ccircle cx='35' cy='12' r='2.4' fill='%2322d3ee'/%3E%3C/svg%3E">
<link rel="apple-touch-icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' rx='11' fill='%230b0722'/%3E%3Cpath d='M24 4l4.2 15.8L44 24l-15.8 4.2L24 44l-4.2-15.8L4 24l15.8-4.2z' fill='%23ffc247'/%3E%3C/svg%3E">
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<link rel="preconnect" href="https://huggingface.co">
<link rel="dns-prefetch" href="https://nexa-duckai.static.hf.space">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/vazirmatn@5/index.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/lalezar@5/index.css">
<script type="application/ld+json">
{"@context":"https://schema.org","@graph":[
{"@type":"Organization","@id":"https://nexa.hf.space/#org","name":"NEXA","alternateName":["nexa","NEXA AI"],"url":"https://nexa.hf.space/","email":"nexa@gmail.com","description":"سازمان غیرانتفاعی توسعه هوش مصنوعی ایران؛ پردازش زبان فارسی، مدل‌های مولد، هوش مصنوعی بومی و فرهنگی، اپلیکیشن‌های آموزشی و اجتماعی.","foundingDate":"2025","nonprofitStatus":"NonprofitType","sameAs":["https://huggingface.co/nexa","https://sites.google.com/view/nexa","https://www.pinterest.com/nexa/","https://nexa-duckai.static.hf.space","https://nexa-ai.static.hf.space/img.html"]},
{"@type":"WebSite","@id":"https://nexa.hf.space/#site","url":"https://nexa.hf.space/","name":"NEXA","inLanguage":"fa","publisher":{"@id":"https://nexa.hf.space/#org"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://nexa.hf.space/?q={search_term_string}"},"query-input":"required name=search_term_string"}},
{"@type":"ItemList","name":"فضاهای زنده NEXA","itemListElement":[
{"@type":"ListItem","position":1,"item":{"@type":"SoftwareApplication","name":"Video Fizik — فیلم فیزیک بساز","applicationCategory":"EducationalApplication","operatingSystem":"Web","url":"https://nexa-video-fizik.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":2,"item":{"@type":"SoftwareApplication","name":"Zist20 — زیست دهم تجربی","applicationCategory":"EducationalApplication","operatingSystem":"Web","url":"https://nexa-zist20.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":3,"item":{"@type":"SoftwareApplication","name":"DuckAI — چت هوش مصنوعی","applicationCategory":"UtilitiesApplication","operatingSystem":"Web","url":"https://nexa-duckai.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":4,"item":{"@type":"SoftwareApplication","name":"استودیوی تصویر هوش مصنوعی NEXA","applicationCategory":"MultimediaApplication","operatingSystem":"Web","url":"https://nexa-ai.static.hf.space/img.html","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":5,"item":{"@type":"SoftwareApplication","name":"Tiny Thief — نسخه بهینه","applicationCategory":"GameApplication","operatingSystem":"Web","url":"https://nexa-optimized-version-of-the-game-tiny-thief.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":6,"item":{"@type":"SoftwareApplication","name":"Play1000 — آرشیو هزاران بازی","applicationCategory":"GameApplication","operatingSystem":"Web","url":"https://nexa-play1000.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":7,"item":{"@type":"SoftwareApplication","name":"سیستم‌عامل وب داکوم ۱.۱","applicationCategory":"UtilitiesApplication","operatingSystem":"Web","url":"https://nexa-nexa-os1-1.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":8,"item":{"@type":"SoftwareApplication","name":"kokb1 v2 — مدل هوش مصنوعی بومی","applicationCategory":"UtilitiesApplication","operatingSystem":"Web","url":"https://nexa-kokb1-v2-space.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":9,"item":{"@type":"SoftwareApplication","name":"Xortron π — محاسبه‌گر عدد پی","applicationCategory":"EducationalApplication","operatingSystem":"Web","url":"https://xortron-pi.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}},
{"@type":"ListItem","position":10,"item":{"@type":"SoftwareApplication","name":"اطلس قرآن","applicationCategory":"EducationalApplication","operatingSystem":"Web","url":"https://nexa-quran-atlas.static.hf.space","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}}]},
{"@type":"FAQPage","mainEntity":[
{"@type":"Question","name":"NEXA چیست؟","acceptedAnswer":{"@type":"Answer","text":"NEXA یک سازمان غیرانتفاعی ایرانی برای توسعه هوش مصنوعی است که روی Hugging Face فعالیت می‌کند؛ با ۴۸ فضای زنده شامل مدل بومی kokb1، چت هوش مصنوعی، هزاران بازی، آموزش تعاملی فیزیک و زیست و ده‌ها ابزار وب رایگان."}},
{"@type":"Question","name":"آیا استفاده از پروژه‌های NEXA رایگان است؟","acceptedAnswer":{"@type":"Answer","text":"بله؛ همه فضاها و ابزارهای NEXA رایگان و متن‌باز هستند و بدون ثبت‌نام در مرورگر اجرا می‌شوند."}},
{"@type":"Question","name":"پروژه‌ها روی چه دستگاه‌هایی اجرا می‌شوند؟","acceptedAnswer":{"@type":"Answer","text":"همه پروژه‌ها وب‌محور هستند و روی موبایل، تبلت، لپ‌تاپ و حتی سیستم‌های ضعیف اجرا می‌شوند؛ فقط یک مرورگر مدرن کافی است و هیچ نصبی لازم نیست."}},
{"@type":"Question","name":"مدل kokb1 چیست؟","acceptedAnswer":{"@type":"Answer","text":"kokb1 نخستین سری مدل‌های هوش مصنوعی اصیل ایرانی NEXA است؛ سبک، سریع و طراحی‌شده برای زبان فارسی. نسخه ۲ آن روی Hugging Face Inference Providers به‌صورت رایگان اجرا می‌شود."}},
{"@type":"Question","name":"چگونه با NEXA همکاری کنیم؟","acceptedAnswer":{"@type":"Answer","text":"از طریق صفحه سازمان در Hugging Face به نشانی huggingface.co/nexa یا ایمیل nexa@gmail.com می‌توانید با تیم NEXA در ارتباط باشید و در پروژه‌های متن‌باز مشارکت کنید."}}]},
{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"خانه","item":"https://nexa.hf.space/"},{"@type":"ListItem","position":2,"name":"پروژه‌ها","item":"https://nexa.hf.space/#projects"},{"@type":"ListItem","position":3,"name":"هوش مصنوعی","item":"https://nexa.hf.space/#ai"}]}
]}
</script>
<style>
:root{--bg0:#05030f;--bg1:#0b0722;--bg2:#140d33;--bg3:#1c1244;--line:rgba(139,92,246,.22);--line2:rgba(139,92,246,.45);--ink:#efeaff;--mut:#a89fd0;--dim:#7d74a8;--violet:#8b5cf6;--magenta:#ff4d8d;--cyan:#22d3ee;--amber:#ffb020;--gold:#ffc247;--ok:#34d399;--warn:#fbbf24;--bad:#fb7185;--info:#38bdf8;--grad:linear-gradient(105deg,var(--gold),var(--magenta) 45%,var(--violet) 78%,var(--cyan));--ease:cubic-bezier(.22,.9,.3,1);--r:18px;--nav-h:74px;--font:'Vazirmatn Variable',Vazirmatn,Tahoma,'Segoe UI',sans-serif;--disp:'Lalezar','Vazirmatn Variable',Tahoma,sans-serif}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{font-family:var(--font);background:var(--bg0);color:var(--ink);line-height:1.85;overflow-x:hidden;min-height:100vh}
body::before{content:"";position:fixed;inset:0;z-index:-2;background:radial-gradient(900px 600px at 88% -5%,rgba(139,92,246,.2),transparent 60%),radial-gradient(800px 600px at -10% 30%,rgba(34,211,238,.1),transparent 60%),radial-gradient(900px 700px at 50% 110%,rgba(255,77,141,.12),transparent 60%),var(--bg0)}
body::after{content:"";position:fixed;inset:-50%;z-index:2500;pointer-events:none;opacity:.05;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");animation:grain 9s steps(6) infinite}
@keyframes grain{0%,100%{transform:translate(0,0)}25%{transform:translate(-2%,3%)}50%{transform:translate(3%,-2%)}75%{transform:translate(-3%,-3%)}}
::selection{background:rgba(255,77,141,.45);color:#fff}
::-webkit-scrollbar{width:11px;height:11px}
::-webkit-scrollbar-track{background:var(--bg1)}
::-webkit-scrollbar-thumb{background:linear-gradient(180deg,var(--violet),var(--magenta));border-radius:8px;border:2px solid var(--bg1)}
::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,var(--cyan),var(--violet))}
*{scrollbar-width:thin;scrollbar-color:var(--violet) var(--bg1)}
img,svg,canvas,iframe{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
button{font-family:inherit;color:inherit;background:none;border:none;cursor:pointer}
input,select,textarea{font-family:inherit;color:var(--ink)}
h1,h2,h3,.disp{font-family:var(--disp);font-weight:400;line-height:1.35}
:focus-visible{outline:2px solid var(--cyan);outline-offset:3px;border-radius:6px}
.skip{position:fixed;top:-60px;right:16px;z-index:6000;background:var(--amber);color:#16092b;padding:10px 18px;border-radius:0 0 12px 12px;font-weight:700;transition:top .3s}
.skip:focus{top:0}
.container{width:min(1240px,93vw);margin-inline:auto}
.grad-text{background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
.kbd{font-family:ui-monospace,monospace;font-size:.72rem;background:var(--bg3);border:1px solid var(--line2);border-bottom-width:3px;border-radius:6px;padding:1px 7px;color:var(--mut);direction:ltr}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:13px 24px;border-radius:13px;font-weight:700;font-size:.95rem;border:1px solid transparent;transition:transform .22s var(--ease),box-shadow .25s,background .25s,border-color .25s;white-space:nowrap;user-select:none}
.btn:active{transform:scale(.96)}
.btn-primary{background:linear-gradient(120deg,var(--gold),var(--magenta) 58%,var(--violet));color:#1c0a2e;box-shadow:0 10px 32px rgba(255,77,141,.32)}
.btn-primary:hover{transform:translateY(-2px);box-shadow:0 16px 42px rgba(255,77,141,.45);filter:brightness(1.07)}
.btn-ghost{border-color:var(--line2);background:rgba(139,92,246,.09);color:var(--ink)}
.btn-ghost:hover{background:rgba(139,92,246,.2);border-color:var(--violet);transform:translateY(-2px)}
.btn-cyan{background:linear-gradient(120deg,var(--cyan),var(--violet));color:#04121c;box-shadow:0 10px 30px rgba(34,211,238,.28)}
.btn-cyan:hover{transform:translateY(-2px);filter:brightness(1.08)}
.btn-sm{padding:8px 15px;font-size:.83rem;border-radius:10px}
.btn-ico{width:42px;height:42px;padding:0;border-radius:12px;border:1px solid var(--line);background:rgba(139,92,246,.08);font-size:1.05rem;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:.22s;color:var(--ink)}
.btn-ico:hover{border-color:var(--line2);background:rgba(139,92,246,.2);transform:translateY(-2px)}
.chip{display:inline-flex;align-items:center;gap:7px;padding:5px 13px;border-radius:99px;font-size:.78rem;font-weight:600;border:1px solid var(--line);background:rgba(139,92,246,.09);color:var(--mut)}
#loader{position:fixed;inset:0;z-index:5000;background:radial-gradient(800px 500px at 50% 40%,#171040,var(--bg0));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;transition:opacity .6s,visibility .6s}
#loader.done{opacity:0;visibility:hidden}
.loader-star{width:84px;height:84px;animation:spinStar 2.4s linear infinite;filter:drop-shadow(0 0 24px rgba(255,194,71,.6))}
@keyframes spinStar{to{transform:rotate(360deg)}}
.loader-name{font-family:var(--disp);font-size:2.1rem}
.loader-bar{width:220px;height:5px;border-radius:9px;background:var(--bg3);overflow:hidden}
.loader-fill{height:100%;width:0%;border-radius:9px;background:var(--grad);transition:width .35s var(--ease)}
.loader-cap{font-size:.82rem;color:var(--dim)}
#progress{position:fixed;top:0;right:0;left:0;height:3px;z-index:1600;background:transparent}
#progress b{display:block;height:100%;width:0%;background:var(--grad);box-shadow:0 0 12px rgba(255,77,141,.7)}
#glow{position:fixed;top:0;right:0;width:520px;height:520px;border-radius:50%;pointer-events:none;z-index:0;background:radial-gradient(circle,rgba(139,92,246,.14),rgba(34,211,238,.05) 45%,transparent 70%);transform:translate(-50%,-50%);display:none}
#backtop{position:fixed;bottom:22px;left:22px;z-index:1200;width:50px;height:50px;border-radius:14px;background:linear-gradient(135deg,var(--violet),var(--magenta));color:#fff;font-size:1.2rem;box-shadow:0 10px 30px rgba(139,92,246,.45);opacity:0;visibility:hidden;transform:translateY(16px);transition:.35s var(--ease)}
#backtop.show{opacity:1;visibility:visible;transform:none}
#backtop:hover{filter:brightness(1.15)}
#nav{position:fixed;top:0;right:0;left:0;z-index:1500;height:var(--nav-h);transition:background .35s,box-shadow .35s,border-color .35s;border-bottom:1px solid transparent}
#nav.scrolled{background:rgba(8,5,26,.82);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-color:var(--line);box-shadow:0 10px 40px rgba(3,1,12,.55)}
.nav-inner{height:var(--nav-h);display:flex;align-items:center;gap:18px}
.brand{display:flex;align-items:center;gap:11px;flex:none}
.brand svg{width:42px;height:42px;filter:drop-shadow(0 0 12px rgba(255,194,71,.45));transition:transform .5s var(--ease)}
.brand:hover svg{transform:rotate(90deg) scale(1.08)}
.brand-name{font-family:var(--disp);font-size:1.5rem;line-height:1.1}
.brand-sub{display:block;font-family:var(--font);font-size:.58rem;font-weight:600;color:var(--dim);letter-spacing:.32em;direction:ltr;text-align:right}
.nav-links{display:flex;gap:4px;margin-inline:auto}
.nav-links a{position:relative;padding:9px 13px;border-radius:10px;font-size:.9rem;font-weight:600;color:var(--mut);transition:.25s}
.nav-links a:hover{color:var(--ink);background:rgba(139,92,246,.12)}
.nav-links a.active{color:var(--gold)}
.nav-links a.active::after{content:"";position:absolute;bottom:2px;right:13px;left:13px;height:2px;border-radius:2px;background:var(--grad)}
.nav-actions{display:flex;align-items:center;gap:9px;flex:none}
#btn-sound .snd-off{display:none}
#btn-sound.muted .snd-on{display:none}
#btn-sound.muted .snd-off{display:inline}
#btn-sound{position:relative}
#btn-sound::after{content:"";position:absolute;top:7px;left:7px;width:7px;height:7px;border-radius:50%;background:var(--ok);box-shadow:0 0 8px var(--ok)}
#btn-sound.muted::after{background:var(--bad);box-shadow:0 0 8px var(--bad)}
#btn-search{width:auto;padding:0 14px;font-size:.85rem;color:var(--mut)}
#btn-burger{display:none;flex-direction:column;gap:5px;width:42px;height:42px;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:12px;background:rgba(139,92,246,.08)}
#btn-burger span{display:block;width:20px;height:2px;border-radius:2px;background:var(--ink);transition:.3s var(--ease)}
#btn-burger.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
#btn-burger.open span:nth-child(2){opacity:0}
#btn-burger.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
#mmenu{position:fixed;top:var(--nav-h);right:0;left:0;z-index:1490;background:rgba(8,5,26,.97);backdrop-filter:blur(20px);border-bottom:1px solid var(--line);padding:14px 5vw 22px;display:flex;flex-direction:column;gap:4px;transform:translateY(-115%);transition:transform .4s var(--ease);visibility:hidden}
#mmenu.open{transform:none;visibility:visible}
#mmenu a{padding:13px 14px;border-radius:12px;font-weight:600;color:var(--mut);border:1px solid transparent}
#mmenu a:hover,#mmenu a.active{color:var(--gold);background:rgba(139,92,246,.12);border-color:var(--line)}
.sec{padding:96px 0;position:relative;scroll-margin-top:calc(var(--nav-h) + 14px)}
.sec-head{max-width:760px;margin-bottom:44px}
.eyebrow{display:inline-flex;align-items:center;gap:8px;font-size:.8rem;font-weight:700;color:var(--cyan);margin-bottom:12px}
.eyebrow::before{content:"";width:26px;height:2px;background:linear-gradient(90deg,var(--cyan),transparent);border-radius:2px}
.sec-title{font-size:clamp(1.9rem,4.2vw,3rem);margin-bottom:10px}
.sec-sub{color:var(--mut);font-size:.98rem;max-width:640px}
[data-reveal]{opacity:0;transform:translateY(28px);transition:opacity .7s var(--ease),transform .7s var(--ease);transition-delay:var(--d,0s)}
[data-reveal].in{opacity:1;transform:none}
.aurora{position:absolute;border-radius:50%;filter:blur(90px);pointer-events:none;z-index:-1;opacity:.55}
#home{padding:calc(var(--nav-h) + 44px) 0 30px;position:relative;overflow:hidden}
.hero-grid{display:grid;grid-template-columns:minmax(340px,460px) minmax(0,1fr);gap:30px;align-items:stretch}
.hero-copy{display:flex;flex-direction:column;justify-content:center;gap:20px;padding:12px 0}
.hero-eyebrow{align-self:flex-start;color:var(--gold);border-color:rgba(255,194,71,.35);background:rgba(255,176,32,.08)}
.hero-eyebrow i{width:8px;height:8px;border-radius:50%;background:var(--gold);box-shadow:0 0 10px var(--gold);animation:pulse 2s infinite}
@keyframes pulse{50%{opacity:.4}}
.hero-title{font-size:clamp(3rem,7.2vw,5.4rem);line-height:1.12}
.hero-title small{display:block;font-size:clamp(1.25rem,2.6vw,1.9rem);color:var(--mut);font-family:var(--disp);margin-top:6px}
.hero-title .grad-text{background-size:220% 220%;animation:gradMove 7s ease infinite}
@keyframes gradMove{0%,100%{background-position:0% 50%}50%{background-position:100% 50%}}
.hero-lead{color:var(--mut);font-size:1rem;max-width:480px}
.hero-lead b{color:var(--ink)}
.hero-cta{display:flex;gap:12px;flex-wrap:wrap}
.hero-badges{display:flex;gap:9px;flex-wrap:wrap;margin-top:4px}
.hbadge{font-size:.78rem;color:var(--mut);display:inline-flex;gap:6px;align-items:center;padding:6px 12px;border-radius:99px;border:1px dashed var(--line2);background:rgba(11,7,34,.6)}
.hbadge b{color:var(--gold);font-weight:800}
.stage-wrap{display:flex;flex-direction:column;min-width:0}
.stage{position:relative;height:clamp(430px,58vh,600px);border-radius:22px;overflow:hidden;border:1px solid var(--line2);background:#070313;box-shadow:0 30px 80px rgba(3,1,14,.7),inset 0 0 80px rgba(139,92,246,.08)}
.stage canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:pan-y;cursor:crosshair}
.stage-hud{position:absolute;top:14px;right:14px;display:flex;gap:8px;z-index:3;pointer-events:none}
.hud-chip{font-size:.72rem;font-weight:700;padding:5px 12px;border-radius:99px;background:rgba(5,3,15,.65);border:1px solid var(--line2);color:var(--cyan);backdrop-filter:blur(6px);display:inline-flex;align-items:center;gap:6px}
.hud-chip i{width:7px;height:7px;border-radius:50%;background:var(--ok);box-shadow:0 0 8px var(--ok);animation:pulse 1.6s infinite}
.stage-hint{position:absolute;bottom:12px;right:14px;left:14px;z-index:3;pointer-events:none;font-size:.72rem;color:var(--dim);display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.stage-hint span{background:rgba(5,3,15,.55);padding:3px 10px;border-radius:8px;border:1px solid rgba(139,92,246,.15)}
.dock{margin-top:26px;border:1px solid var(--line2);border-radius:20px;background:linear-gradient(160deg,rgba(28,18,68,.75),rgba(11,7,34,.9));padding:20px 22px;position:relative;overflow:hidden}
.dock::before{content:"";position:absolute;top:0;right:0;left:0;height:2px;background:var(--grad);opacity:.8}
.dock-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.dock-title{font-family:var(--disp);font-size:1.25rem;display:flex;align-items:center;gap:9px}
.led{width:9px;height:9px;border-radius:50%;background:var(--ok);box-shadow:0 0 10px var(--ok);animation:pulse 1.8s infinite}
.dock-head .chip{margin-inline-start:auto;direction:ltr;font-family:ui-monospace,monospace;font-size:.72rem;color:var(--cyan)}
.dock-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px 20px}
.ctl{display:flex;flex-direction:column;gap:7px;min-width:0}
.ctl-row{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.ctl-name{font-size:.8rem;font-weight:600;color:var(--mut)}
.ctl-val{font-size:.78rem;font-weight:800;color:var(--gold);font-variant-numeric:tabular-nums}
input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:7px;border-radius:9px;background:linear-gradient(to left,var(--violet) var(--p,50%),#241a4d var(--p,50%));outline-offset:4px;cursor:pointer}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:19px;height:19px;border-radius:50%;background:radial-gradient(circle at 35% 35%,#fff,var(--gold) 60%,var(--magenta));border:2px solid #12082b;box-shadow:0 0 12px rgba(255,194,71,.7);transition:transform .15s}
input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.2)}
input[type=range]::-moz-range-thumb{width:17px;height:17px;border-radius:50%;background:var(--gold);border:2px solid #12082b;box-shadow:0 0 12px rgba(255,194,71,.7)}
input[type=range]::-moz-range-track{height:7px;border-radius:9px;background:#241a4d}
input[type=range]::-moz-range-progress{height:7px;border-radius:9px;background:var(--violet)}
select{appearance:none;-webkit-appearance:none;width:100%;padding:9px 13px;padding-inline-end:34px;border-radius:11px;border:1px solid var(--line2);background:var(--bg2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a89fd0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left 13px center;font-size:.85rem;font-weight:600;cursor:pointer;transition:border-color .25s}
select:hover,select:focus{border-color:var(--violet)}
.switch{display:flex;align-items:center;gap:10px;cursor:pointer;user-select:none;padding-top:4px}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch .track{position:relative;width:42px;height:23px;flex:none;border-radius:99px;background:#241a4d;border:1px solid var(--line2);transition:.3s}
.switch .track::after{content:"";position:absolute;top:2px;right:3px;width:16px;height:16px;border-radius:50%;background:var(--dim);transition:.3s var(--ease)}
.switch input:checked + .track{background:linear-gradient(120deg,var(--violet),var(--magenta));border-color:var(--magenta)}
.switch input:checked + .track::after{transform:translateX(-18px);background:#fff;box-shadow:0 0 10px rgba(255,255,255,.7)}
.switch input:focus-visible + .track{outline:2px solid var(--cyan);outline-offset:3px}
.switch em{font-style:normal;font-size:.8rem;font-weight:600;color:var(--mut)}
.dock-btns{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px;padding-top:16px;border-top:1px dashed var(--line)}
.ticker{border-block:1px solid var(--line);background:rgba(11,7,34,.6);overflow:hidden;direction:ltr;padding:13px 0;position:relative}
.ticker::before,.ticker::after{content:"";position:absolute;top:0;bottom:0;width:90px;z-index:2;pointer-events:none}
.ticker::before{left:0;background:linear-gradient(90deg,var(--bg0),transparent)}
.ticker::after{right:0;background:linear-gradient(-90deg,var(--bg0),transparent)}
.ticker-track{display:flex;width:max-content;animation:tick 36s linear infinite}
.ticker:hover .ticker-track{animation-play-state:paused}
@keyframes tick{to{transform:translateX(-50%)}}
.ticker-track span{direction:rtl;unicode-bidi:isolate;display:inline-flex;align-items:center;gap:9px;padding:0 26px;font-size:.85rem;font-weight:600;color:var(--mut);white-space:nowrap}
.ticker-track span i{font-style:normal;color:var(--gold)}
#stats{padding:64px 0}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}
.stat{position:relative;padding:26px 22px;border-radius:var(--r);border:1px solid var(--line);background:linear-gradient(160deg,rgba(139,92,246,.1),rgba(11,7,34,.7));overflow:hidden;transition:.35s var(--ease)}
.stat:hover{transform:translateY(-5px);border-color:var(--line2);box-shadow:0 18px 44px rgba(139,92,246,.2)}
.stat::after{content:"";position:absolute;top:-30px;left:-30px;width:110px;height:110px;border-radius:50%;background:radial-gradient(circle,var(--sc,rgba(139,92,246,.25)),transparent 70%)}
.stat-icon{font-size:1.5rem;margin-bottom:8px}
.stat-num{font-family:var(--disp);font-size:2.5rem;line-height:1.15;color:var(--sn,var(--gold))}
.stat-label{color:var(--mut);font-size:.85rem;font-weight:600}
.proj-toolbar{display:flex;flex-direction:column;gap:16px;margin-bottom:26px}
.proj-row1{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.search-box{position:relative;flex:1;min-width:230px}
.search-box input{width:100%;padding:13px 46px 13px 42px;border-radius:13px;border:1px solid var(--line2);background:rgba(20,13,51,.7);font-size:.92rem;transition:.25s}
.search-box input:focus{border-color:var(--cyan);box-shadow:0 0 0 4px rgba(34,211,238,.12);outline:none}
.search-box::before{content:"🔍";position:absolute;right:15px;top:50%;transform:translateY(-50%);font-size:.95rem;opacity:.8}
#proj-clear{position:absolute;left:8px;top:50%;transform:translateY(-50%);width:30px;height:30px;border-radius:8px;color:var(--dim);font-size:.9rem;display:none}
#proj-clear:hover{background:rgba(251,113,133,.15);color:var(--bad)}
#proj-sort{width:auto;min-width:170px}
.filter-chips{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.fchip{padding:8px 16px;border-radius:99px;border:1px solid var(--line);background:rgba(139,92,246,.07);font-size:.83rem;font-weight:700;color:var(--mut);transition:.25s;display:inline-flex;gap:7px;align-items:center}
.fchip small{font-size:.7rem;color:var(--dim);font-weight:600}
.fchip:hover{border-color:var(--line2);color:var(--ink);transform:translateY(-2px)}
.fchip.active{background:linear-gradient(120deg,var(--violet),var(--magenta));color:#fff;border-color:transparent;box-shadow:0 6px 20px rgba(255,77,141,.3)}
.fchip.active small{color:rgba(255,255,255,.85)}
#proj-count{margin-inline-start:auto;font-size:.8rem;color:var(--dim)}
.proj-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(258px,1fr));gap:18px}
.pcard{--pc:var(--violet);position:relative;display:flex;flex-direction:column;gap:11px;padding:20px;border-radius:var(--r);border:1px solid var(--line);background:linear-gradient(165deg,rgba(139,92,246,.09),rgba(11,7,34,.85));overflow:hidden;transition:transform .35s var(--ease),border-color .35s,box-shadow .35s;animation:cardIn .5s var(--ease) both}
@keyframes cardIn{from{opacity:0;transform:translateY(18px) scale(.97)}to{opacity:1;transform:none}}
.pcard::before{content:"";position:absolute;top:0;right:0;left:0;height:3px;background:linear-gradient(90deg,var(--pc),transparent);opacity:.9}
.pcard::after{content:"";position:absolute;top:0;bottom:0;right:-80%;width:55%;background:linear-gradient(105deg,transparent,rgba(255,255,255,.06),transparent);transform:skewX(-18deg);transition:right .7s var(--ease);pointer-events:none}
.pcard:hover{transform:translateY(-6px);border-color:var(--line2);box-shadow:0 22px 50px rgba(5,2,18,.7),0 0 0 1px rgba(139,92,246,.12)}
.pcard:hover::after{right:130%}
.pcard-top{display:flex;align-items:center;gap:10px}
.pcard-icon{width:46px;height:46px;flex:none;display:grid;place-items:center;font-size:1.35rem;border-radius:13px;background:color-mix(in srgb,var(--pc) 16%,transparent);border:1px solid color-mix(in srgb,var(--pc) 40%,transparent)}
.pcard-meta{display:flex;flex-direction:column;gap:3px;min-width:0}
.pcard-cat{font-size:.68rem;font-weight:800;color:var(--pc)}
a.pcard-cat:hover{text-decoration:underline;text-underline-offset:3px}
.pcard-badges{display:flex;gap:5px;flex-wrap:wrap}
.pbadge{font-size:.62rem;font-weight:700;padding:2px 8px;border-radius:99px;background:rgba(255,194,71,.12);color:var(--gold);border:1px solid rgba(255,194,71,.3)}
.pbadge.new{background:rgba(52,211,153,.12);color:var(--ok);border-color:rgba(52,211,153,.3)}
.pbadge.like{background:rgba(255,77,141,.12);color:var(--magenta);border-color:rgba(255,77,141,.3)}
.pcard-title{font-size:1.18rem;line-height:1.4}
.pcard-desc{font-size:.8rem;color:var(--mut);line-height:1.8;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;min-height:4.3em}
.pcard-tags{display:flex;gap:5px;flex-wrap:wrap}
.pcard-tags span{font-size:.66rem;color:var(--dim);border:1px solid rgba(139,92,246,.18);padding:2px 8px;border-radius:99px}
.pcard-actions{display:flex;gap:7px;align-items:center;margin-top:auto;padding-top:12px;border-top:1px dashed var(--line)}
.pbtn-play{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:9px 10px;border-radius:11px;font-size:.82rem;font-weight:800;background:linear-gradient(120deg,var(--pc),var(--violet));color:#fff;transition:.25s}
.pbtn-play:hover{filter:brightness(1.12);transform:translateY(-2px)}
.pbtn-ico{width:36px;height:36px;flex:none;display:grid;place-items:center;border-radius:10px;border:1px solid var(--line);background:rgba(139,92,246,.07);font-size:.88rem;transition:.22s;color:var(--mut)}
.pbtn-ico:hover{border-color:var(--line2);background:rgba(139,92,246,.18);transform:translateY(-2px)}
.pbtn-ico.faved{background:rgba(255,77,141,.16);border-color:rgba(255,77,141,.5);color:var(--magenta)}
.empty-state{grid-column:1/-1;text-align:center;padding:60px 20px;border:1px dashed var(--line2);border-radius:var(--r);color:var(--mut)}
.empty-state .big{font-size:2.6rem;margin-bottom:10px}
.lab-tabs{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:22px}
.ltab{display:inline-flex;align-items:center;gap:8px;padding:11px 19px;border-radius:13px;border:1px solid var(--line);background:rgba(139,92,246,.07);font-weight:700;font-size:.88rem;color:var(--mut);transition:.25s}
.ltab:hover{color:var(--ink);border-color:var(--line2);transform:translateY(-2px)}
.ltab.active{background:linear-gradient(120deg,var(--cyan),var(--violet));color:#041220;border-color:transparent;box-shadow:0 8px 26px rgba(34,211,238,.3)}
.lab-panel{display:none;border:1px solid var(--line2);border-radius:22px;background:linear-gradient(165deg,rgba(20,13,51,.8),rgba(8,5,24,.92));padding:22px;position:relative;overflow:hidden}
.lab-panel.active{display:block;animation:labIn .45s var(--ease)}
@keyframes labIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.lab-head{display:flex;justify-content:space-between;gap:14px;flex-wrap:wrap;align-items:baseline;margin-bottom:16px}
.lab-head h3{font-size:1.5rem}
.lab-head p{color:var(--mut);font-size:.83rem;max-width:560px}
.lab-controls{display:flex;gap:14px 20px;flex-wrap:wrap;align-items:flex-end;padding:15px 17px;border:1px solid var(--line);border-radius:15px;background:rgba(5,3,15,.5);margin-bottom:16px}
.lctl{display:flex;flex-direction:column;gap:6px;min-width:130px;flex:1}
.lctl.fixed{flex:none;min-width:0}
.lctl select{min-width:150px}
.lab-btns{display:flex;gap:8px;flex-wrap:wrap}
.lab-stage{position:relative;height:390px;border-radius:15px;overflow:hidden;border:1px solid var(--line);background:#070313}
.lab-stage canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair}
.lab-stats{display:flex;gap:9px;flex-wrap:wrap;margin-top:14px}
.lstat{font-size:.76rem;color:var(--mut);border:1px solid var(--line);background:rgba(139,92,246,.07);padding:5px 13px;border-radius:99px;display:inline-flex;gap:7px;align-items:center}
.lstat b{color:var(--gold);font-variant-numeric:tabular-nums}
.lab-hint{font-size:.72rem;color:var(--dim);margin-top:9px}
.frac-progress{position:absolute;top:0;right:0;left:0;height:3px;z-index:4}
.frac-progress b{display:block;height:100%;width:0%;background:linear-gradient(90deg,var(--cyan),var(--magenta));transition:width .12s linear}
#f-center{direction:ltr;font-family:ui-monospace,monospace;font-size:.72rem}
.ai-grid{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:22px;align-items:start}
.chat-card{border:1px solid var(--line2);border-radius:22px;background:linear-gradient(170deg,rgba(28,18,68,.65),rgba(8,5,24,.94));overflow:hidden;display:flex;flex-direction:column;box-shadow:0 26px 70px rgba(4,2,16,.6)}
.chat-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line);background:rgba(5,3,15,.45)}
.chat-avatar{width:46px;height:46px;flex:none;border-radius:14px;display:grid;place-items:center;font-size:1.3rem;background:linear-gradient(135deg,var(--violet),var(--magenta));box-shadow:0 0 22px rgba(255,77,141,.4);animation:float 5s ease-in-out infinite;color:#fff}
@keyframes float{50%{transform:translateY(-4px)}}
.chat-name{font-family:var(--disp);font-size:1.3rem;line-height:1.2}
.chat-status{font-size:.7rem;color:var(--ok);display:flex;align-items:center;gap:6px}
.chat-status i{width:7px;height:7px;border-radius:50%;background:var(--ok);box-shadow:0 0 8px var(--ok);animation:pulse 1.8s infinite}
#chat-clear{margin-inline-start:auto}
.chat-body{height:380px;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:13px;scroll-behavior:smooth}
.msg{display:flex;flex-direction:column;max-width:86%;gap:7px;animation:msgIn .35s var(--ease)}
@keyframes msgIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.msg.user{align-self:flex-start}
.msg.bot{align-self:flex-end}
.msg-bubble{padding:11px 16px;border-radius:16px;font-size:.86rem;line-height:1.9;white-space:pre-wrap;word-break:break-word}
.msg.user .msg-bubble{background:linear-gradient(120deg,var(--cyan),var(--info));color:#031520;border-start-start-radius:5px;font-weight:600}
.msg.bot .msg-bubble{background:rgba(139,92,246,.14);border:1px solid var(--line2);border-start-end-radius:5px}
.msg.bot .msg-bubble a{color:var(--cyan);text-decoration:underline;text-underline-offset:3px}
.msg.bot .msg-bubble b{color:var(--gold)}
.msg-chips{display:flex;gap:7px;flex-wrap:wrap}
.msg-chips button{font-size:.74rem;font-weight:700;padding:6px 13px;border-radius:99px;border:1px solid rgba(34,211,238,.4);background:rgba(34,211,238,.09);color:var(--cyan);transition:.22s}
.msg-chips button:hover{background:rgba(34,211,238,.22);transform:translateY(-2px)}
.typing{display:inline-flex;gap:5px;padding:14px 18px}
.typing span{width:7px;height:7px;border-radius:50%;background:var(--mut);animation:tp 1.1s infinite}
.typing span:nth-child(2){animation-delay:.15s}
.typing span:nth-child(3){animation-delay:.3s}
@keyframes tp{35%{transform:translateY(-6px);opacity:.5}}
.chat-sugs{display:flex;gap:7px;flex-wrap:wrap;padding:11px 16px;border-top:1px dashed var(--line)}
.chat-sugs button{font-size:.72rem;font-weight:600;color:var(--mut);padding:6px 12px;border-radius:99px;border:1px solid var(--line);background:rgba(139,92,246,.06);transition:.22s}
.chat-sugs button:hover{color:var(--gold);border-color:rgba(255,194,71,.4);transform:translateY(-2px)}
.chat-form{display:flex;gap:9px;padding:13px 16px;border-top:1px solid var(--line);background:rgba(5,3,15,.45)}
.chat-form input{flex:1;padding:12px 16px;border-radius:12px;border:1px solid var(--line2);background:rgba(20,13,51,.8);font-size:.88rem;min-width:0}
.chat-form input:focus{outline:none;border-color:var(--magenta);box-shadow:0 0 0 4px rgba(255,77,141,.12)}
#chat-send{width:48px;height:48px;flex:none;border-radius:12px;background:linear-gradient(135deg,var(--magenta),var(--violet));color:#fff;font-size:1.1rem;box-shadow:0 8px 22px rgba(255,77,141,.35);transition:.22s}
#chat-send:hover{filter:brightness(1.15);transform:translateY(-2px)}
.ai-side{display:flex;flex-direction:column;gap:14px}
.ai-card{--ac:var(--cyan);padding:19px;border-radius:var(--r);border:1px solid var(--line);background:linear-gradient(160deg,color-mix(in srgb,var(--ac) 9%,transparent),rgba(11,7,34,.85));transition:.3s var(--ease);position:relative;overflow:hidden}
.ai-card:hover{transform:translateY(-4px);border-color:color-mix(in srgb,var(--ac) 45%,transparent)}
.ai-card-icon{font-size:1.6rem;margin-bottom:8px}
.ai-card h4{font-family:var(--disp);font-weight:400;font-size:1.15rem;margin-bottom:4px}
.ai-card p{font-size:.78rem;color:var(--mut);margin-bottom:13px;line-height:1.8}
.timeline{position:relative;max-width:860px;margin-inline:auto;padding:10px 0}
.timeline::before{content:"";position:absolute;top:0;bottom:0;right:50%;width:2px;transform:translateX(50%);background:linear-gradient(180deg,var(--gold),var(--magenta),var(--violet),var(--cyan))}
.tl-item{position:relative;width:50%;padding:0 34px 40px 0}
.tl-item:nth-child(even){margin-inline-start:50%;padding:0 0 40px 34px}
.tl-dot{position:absolute;top:6px;left:-8px;width:16px;height:16px;border-radius:50%;background:var(--gold);border:3px solid var(--bg0);box-shadow:0 0 0 3px rgba(255,194,71,.35),0 0 16px rgba(255,194,71,.6);z-index:2}
.tl-item:nth-child(even) .tl-dot{left:auto;right:-8px}
.tl-date{font-size:.74rem;font-weight:800;color:var(--cyan);margin-bottom:5px;display:block}
.tl-card{padding:17px 19px;border-radius:15px;border:1px solid var(--line);background:linear-gradient(160deg,rgba(139,92,246,.1),rgba(11,7,34,.8));transition:.3s var(--ease)}
.tl-card:hover{border-color:var(--line2);transform:translateY(-3px)}
.tl-card h4{font-family:var(--disp);font-weight:400;font-size:1.12rem;margin-bottom:4px}
.tl-card p{font-size:.79rem;color:var(--mut)}
.why-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
.why-card{padding:26px 23px;border-radius:var(--r);border:1px solid var(--line);background:linear-gradient(165deg,rgba(139,92,246,.09),rgba(11,7,34,.8));transition:.35s var(--ease);position:relative;overflow:hidden}
.why-card::after{content:"";position:absolute;bottom:-46px;left:-46px;width:130px;height:130px;border-radius:50%;background:radial-gradient(circle,var(--wc,rgba(139,92,246,.2)),transparent 70%);transition:.4s}
.why-card:hover{transform:translateY(-6px);border-color:var(--line2)}
.why-card:hover::after{transform:scale(1.5)}
.why-icon{width:52px;height:52px;display:grid;place-items:center;font-size:1.5rem;border-radius:15px;background:rgba(139,92,246,.13);border:1px solid var(--line2);margin-bottom:14px}
.why-card h3{font-size:1.3rem;margin-bottom:7px}
.why-card p{font-size:.82rem;color:var(--mut)}
.about-art{margin-top:44px;border-radius:24px;border:1px solid var(--line2);overflow:hidden;position:relative;background:#070313}
.about-art svg{width:100%;height:auto;display:block}
.about-cap{position:absolute;bottom:0;right:0;left:0;padding:22px 26px;background:linear-gradient(0deg,rgba(5,3,15,.92),transparent);display:flex;justify-content:space-between;align-items:flex-end;gap:14px;flex-wrap:wrap}
.about-cap h3{font-size:1.5rem}
.about-cap p{color:var(--mut);font-size:.82rem;max-width:520px}
.faq-list{max-width:820px;display:flex;flex-direction:column;gap:12px}
.faq-item{border:1px solid var(--line);border-radius:16px;background:rgba(139,92,246,.06);overflow:hidden;transition:border-color .3s}
.faq-item.open{border-color:var(--line2);background:rgba(139,92,246,.1)}
.faq-q{width:100%;display:flex;justify-content:space-between;align-items:center;gap:14px;padding:18px 21px;font-weight:700;font-size:.95rem;text-align:right}
.faq-q .fi{flex:none;width:28px;height:28px;display:grid;place-items:center;border-radius:9px;background:rgba(139,92,246,.15);border:1px solid var(--line2);color:var(--gold);transition:transform .35s var(--ease);font-size:.9rem}
.faq-item.open .fi{transform:rotate(45deg);background:linear-gradient(135deg,var(--amber),var(--magenta));color:#1c0a2e}
.faq-a{max-height:0;overflow:hidden;transition:max-height .45s var(--ease)}
.faq-a p{padding:0 21px 19px;color:var(--mut);font-size:.86rem}
.faq-a a{color:var(--cyan);text-decoration:underline;text-underline-offset:3px}
.contact-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:26px;align-items:start}
.contact-info{display:flex;flex-direction:column;gap:14px}
.cinfo-item{display:flex;gap:14px;align-items:flex-start;padding:18px;border-radius:16px;border:1px solid var(--line);background:rgba(139,92,246,.06);transition:.3s}
.cinfo-item:hover{border-color:var(--line2);transform:translateX(-4px)}
.cinfo-item .ci{width:44px;height:44px;flex:none;display:grid;place-items:center;font-size:1.2rem;border-radius:12px;background:rgba(34,211,238,.12);border:1px solid rgba(34,211,238,.3)}
.cinfo-item h4{font-size:.95rem;font-weight:800;margin-bottom:2px}
.cinfo-item p{font-size:.8rem;color:var(--mut);direction:ltr;unicode-bidi:embed;text-align:right}
.cinfo-item a:hover{color:var(--cyan)}
#contact-form{padding:26px;border-radius:20px;border:1px solid var(--line2);background:linear-gradient(165deg,rgba(28,18,68,.6),rgba(8,5,24,.92));display:flex;flex-direction:column;gap:16px}
.field{display:flex;flex-direction:column;gap:7px}
.field label{font-size:.82rem;font-weight:700;color:var(--mut)}
.field input,.field textarea{padding:13px 16px;border-radius:12px;border:1px solid var(--line2);background:rgba(20,13,51,.75);font-size:.9rem;transition:.25s;resize:vertical}
.field input:focus,.field textarea:focus{outline:none;border-color:var(--cyan);box-shadow:0 0 0 4px rgba(34,211,238,.1)}
.field.bad input,.field.bad textarea{border-color:var(--bad);box-shadow:0 0 0 4px rgba(251,113,133,.1)}
.err{font-size:.72rem;color:var(--bad);display:none}
.field.bad .err{display:block}
.form-note{font-size:.72rem;color:var(--dim)}
#cf-mail{display:none}
#cf-mail.show{display:inline-flex}
#footer{border-top:1px solid var(--line);background:linear-gradient(180deg,rgba(11,7,34,.4),rgba(5,3,15,.95));padding:60px 0 26px;margin-top:40px}
.foot-grid{display:grid;grid-template-columns:1.4fr 1fr 1fr 1.1fr;gap:30px;margin-bottom:36px}
.foot-brand p{font-size:.8rem;color:var(--mut);margin:13px 0 17px;max-width:300px}
.foot-social{display:flex;gap:9px}
.foot-col h5{font-family:var(--disp);font-weight:400;font-size:1.05rem;margin-bottom:14px;color:var(--gold)}
.foot-col ul{list-style:none;display:flex;flex-direction:column;gap:9px}
.foot-col a{font-size:.8rem;color:var(--mut);transition:.22s;display:inline-flex;gap:7px;align-items:center}
.foot-col a:hover{color:var(--cyan);transform:translateX(-4px)}
.foot-status{display:flex;flex-direction:column;gap:9px}
.fstat{font-size:.76rem;color:var(--mut);border:1px solid var(--line);border-radius:11px;padding:9px 13px;background:rgba(139,92,246,.05);display:flex;justify-content:space-between;gap:9px}
.fstat b{color:var(--cyan);font-variant-numeric:tabular-nums}
.sitemap{margin-bottom:26px;border:1px dashed var(--line);border-radius:14px;padding:13px 18px}
.sitemap summary{cursor:pointer;font-size:.8rem;font-weight:700;color:var(--mut)}
.sitemap div{display:flex;flex-wrap:wrap;gap:8px 18px;padding-top:12px}
.sitemap a{font-size:.74rem;color:var(--dim)}
.sitemap a:hover{color:var(--gold)}
.foot-bottom{border-top:1px solid var(--line);padding-top:22px;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:.76rem;color:var(--dim)}
.foot-bottom b{color:var(--mut)}
#modal{position:fixed;inset:0;z-index:2000;display:none;align-items:center;justify-content:center;padding:3vh 3vw;background:rgba(3,1,12,.82);backdrop-filter:blur(10px)}
#modal.open{display:flex;animation:fadeIn .3s}
@keyframes fadeIn{from{opacity:0}}
.modal-box{width:min(1200px,100%);height:min(860px,94vh);display:flex;flex-direction:column;border-radius:20px;border:1px solid var(--line2);background:var(--bg1);overflow:hidden;box-shadow:0 40px 120px rgba(0,0,0,.7);animation:popIn .4s var(--ease)}
.modal-box:fullscreen{width:100%;height:100%;border-radius:0}
@keyframes popIn{from{opacity:0;transform:scale(.94) translateY(20px)}}
.modal-head{display:flex;align-items:center;gap:12px;padding:13px 17px;border-bottom:1px solid var(--line);background:rgba(5,3,15,.6);flex-wrap:wrap}
.modal-title-wrap{min-width:0;flex:1}
#modal-title{font-family:var(--disp);font-weight:400;font-size:1.2rem;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#modal-cat{font-size:.7rem;color:var(--cyan)}
.modal-actions{display:flex;gap:7px;flex-wrap:wrap}
.modal-body{position:relative;flex:1;background:#070313}
#modal-frame{width:100%;height:100%;border:0;position:absolute;inset:0;background:#070313}
#modal-loader{position:absolute;inset:0;display:flex;flex-direction:column;gap:15px;align-items:center;justify-content:center;background:rgba(7,3,19,.9);z-index:2;color:var(--mut);font-size:.83rem;transition:opacity .4s,visibility .4s}
#modal-loader.hide{opacity:0;visibility:hidden}
.spin{width:46px;height:46px;border-radius:50%;border:3px solid var(--bg3);border-top-color:var(--magenta);border-right-color:var(--cyan);animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.modal-hint{padding:8px 17px;font-size:.68rem;color:var(--dim);border-top:1px solid var(--line);background:rgba(5,3,15,.6);display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.modal-hint a{color:var(--cyan)}
body.locked{overflow:hidden}
#palette{position:fixed;inset:0;z-index:2100;display:none;align-items:flex-start;justify-content:center;padding:12vh 4vw 4vh;background:rgba(3,1,12,.8);backdrop-filter:blur(10px)}
#palette.open{display:flex;animation:fadeIn .25s}
.pal-box{width:min(640px,100%);max-height:70vh;display:flex;flex-direction:column;border-radius:19px;border:1px solid var(--line2);background:linear-gradient(170deg,#171040,#0b0722);overflow:hidden;box-shadow:0 40px 110px rgba(0,0,0,.75);animation:popIn .3s var(--ease)}
.pal-input-wrap{display:flex;align-items:center;gap:11px;padding:16px 19px;border-bottom:1px solid var(--line)}
.pal-input-wrap span{font-size:1.05rem}
#pal-input{flex:1;background:none;border:none;font-size:1rem;color:var(--ink);min-width:0}
#pal-input:focus{outline:none}
#pal-results{overflow-y:auto;padding:9px}
.pal-group{font-size:.68rem;font-weight:800;color:var(--dim);padding:11px 13px 5px}
.pal-item{display:flex;align-items:center;gap:12px;width:100%;padding:11px 13px;border-radius:12px;text-align:right;transition:.15s;border:1px solid transparent}
.pal-item .pal-ico{width:34px;height:34px;flex:none;display:grid;place-items:center;border-radius:10px;background:rgba(139,92,246,.13);font-size:.95rem}
.pal-item .pal-label{flex:1;font-size:.87rem;font-weight:600;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pal-item .pal-hint{font-size:.68rem;color:var(--dim)}
.pal-item.sel{background:rgba(139,92,246,.18);border-color:var(--line2)}
.pal-item.sel .pal-hint{color:var(--cyan)}
.pal-empty{padding:34px;text-align:center;color:var(--dim);font-size:.85rem}
.pal-foot{display:flex;gap:15px;padding:11px 19px;border-top:1px solid var(--line);font-size:.68rem;color:var(--dim);flex-wrap:wrap}
#toasts{position:fixed;bottom:24px;right:50%;transform:translateX(50%);z-index:3000;display:flex;flex-direction:column;gap:9px;align-items:center;pointer-events:none;width:min(440px,92vw)}
.toast{pointer-events:auto;display:flex;align-items:center;gap:11px;padding:12px 19px;border-radius:14px;font-size:.83rem;font-weight:600;background:rgba(14,9,38,.95);border:1px solid var(--line2);backdrop-filter:blur(12px);box-shadow:0 16px 44px rgba(0,0,0,.55);animation:toastIn .4s var(--ease);max-width:100%}
.toast.out{animation:toastOut .35s var(--ease) forwards}
@keyframes toastIn{from{opacity:0;transform:translateY(18px) scale(.92)}}
@keyframes toastOut{to{opacity:0;transform:translateY(14px) scale(.94)}}
.toast .ti{font-size:1.05rem;flex:none}
.toast.ok{border-color:rgba(52,211,153,.5)}
.toast.bad{border-color:rgba(251,113,133,.5)}
.toast.warn{border-color:rgba(251,191,36,.5)}
.toast.info{border-color:rgba(56,189,248,.5)}
@media (max-width:1120px){
.nav-links a{padding:9px 9px;font-size:.83rem}
.hero-grid{grid-template-columns:minmax(300px,380px) minmax(0,1fr)}
.dock-grid{grid-template-columns:repeat(3,1fr)}
.why-grid{grid-template-columns:repeat(2,1fr)}
.foot-grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:960px){
.nav-links{display:none}
#btn-burger{display:flex}
#btn-search .kbd{display:none}
.hero-grid{grid-template-columns:1fr}
.stage{height:clamp(340px,52vh,520px)}
.dock-grid{grid-template-columns:repeat(2,1fr)}
.stats-grid{grid-template-columns:repeat(2,1fr)}
.ai-grid{grid-template-columns:1fr}
.ai-side{flex-direction:row;flex-wrap:wrap}
.ai-card{flex:1;min-width:220px}
.contact-grid{grid-template-columns:1fr}
.timeline::before{right:8px;transform:none}
.tl-item,.tl-item:nth-child(even){width:100%;margin:0;padding:0 36px 34px 0}
.tl-dot,.tl-item:nth-child(even) .tl-dot{right:1px;left:auto}
}
@media (max-width:640px){
.sec{padding:70px 0}
#btn-search{display:none}
.nav-cta{display:none}
.hero-title{font-size:clamp(2.6rem,11vw,3.4rem)}
.dock{padding:16px}
.dock-grid{grid-template-columns:repeat(2,1fr);gap:12px 14px}
.stats-grid{grid-template-columns:repeat(2,1fr);gap:12px}
.stat{padding:19px 16px}
.stat-num{font-size:1.9rem}
.proj-grid{grid-template-columns:1fr}
.lab-stage{height:300px}
.lab-panel{padding:15px}
.lctl{min-width:44%}
.chat-body{height:330px}
.why-grid{grid-template-columns:1fr}
.foot-grid{grid-template-columns:1fr;gap:24px}
.modal-box{height:96vh;border-radius:14px}
#modal{padding:1.5vh 2vw}
.hero-cta .btn{flex:1;justify-content:center}
}
@media (prefers-reduced-motion:reduce){
*,*::before,*::after{animation-duration:.01s !important;animation-iteration-count:1 !important;transition-duration:.15s !important}
html{scroll-behavior:auto}
.ticker-track{animation:none}
[data-reveal]{opacity:1;transform:none}
}
</style>
</head>
<body>
<a class="skip" href="#projects">پرش به پروژه‌ها</a>
<div id="loader" role="status" aria-label="در حال بارگذاری">
<svg class="loader-star" viewBox="0 0 48 48" aria-hidden="true"><defs><linearGradient id="lg1" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#ffc247"/><stop offset=".5" stop-color="#ff4d8d"/><stop offset="1" stop-color="#8b5cf6"/></linearGradient></defs><path d="M24 2l4.6 17.4L46 24l-17.4 4.6L24 46l-4.6-17.4L2 24l17.4-4.6z" fill="url(#lg1)"/><path d="M24 10l2.6 11.4L38 24l-11.4 2.6L24 38l-2.6-11.4L10 24l11.4-2.6z" fill="#22d3ee" opacity=".55" transform="rotate(45 24 24)"/></svg>
<div class="loader-name grad-text">NEXA</div>
<div class="loader-bar"><div class="loader-fill" id="loader-fill"></div></div>
<div class="loader-cap">در حال روشن‌کردن ستاره‌ها…</div>
</div>
<div id="progress" aria-hidden="true"><b></b></div>
<div id="glow" aria-hidden="true"></div>
<header id="nav">
<div class="container nav-inner">
<a class="brand" href="#home" id="brand" aria-label="NEXA — خانه">
<svg viewBox="0 0 48 48" aria-hidden="true"><defs><linearGradient id="lg2" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#ffc247"/><stop offset=".5" stop-color="#ff4d8d"/><stop offset="1" stop-color="#8b5cf6"/></linearGradient></defs><path d="M24 2l4.6 17.4L46 24l-17.4 4.6L24 46l-4.6-17.4L2 24l17.4-4.6z" fill="url(#lg2)"/><path d="M24 10l2.6 11.4L38 24l-11.4 2.6L24 38l-2.6-11.4L10 24l11.4-2.6z" fill="#22d3ee" opacity=".5" transform="rotate(45 24 24)"/><circle cx="37" cy="10" r="2.2" fill="#22d3ee"/></svg>
<span><span class="brand-name grad-text">NEXA</span><span class="brand-sub">NEXA</span></span>
</a>
<nav class="nav-links" aria-label="ناوبری اصلی">
<a href="#home" class="active">خانه</a>
<a href="#projects">کهکشان پروژه‌ها</a>
<a href="#lab">آزمایشگاه</a>
<a href="#ai">هوش مصنوعی</a>
<a href="#journey">سفر ما</a>
<a href="#faq">پرسش‌ها</a>
<a href="#contact">تماس</a>
</nav>
<div class="nav-actions">
<button class="btn-ico" id="btn-sound" aria-pressed="true" title="صدا روشن/خاموش" aria-label="صدا روشن یا خاموش"><span class="snd-on">🔊</span><span class="snd-off">🔇</span></button>
<button class="btn-ico" id="btn-search" title="جستجوی فرمان">🔍 <span class="kbd">Ctrl K</span></button>
<a class="btn btn-primary btn-sm nav-cta" href="#projects">🚀 کاوش کهکشان</a>
<button id="btn-burger" aria-label="منو" aria-expanded="false"><span></span><span></span><span></span></button>
</div>
</div>
</header>
<nav id="mmenu" aria-label="منوی موبایل">
<a href="#home">🏠 خانه</a>
<a href="#projects">🪐 کهکشان پروژه‌ها</a>
<a href="#lab">🧪 آزمایشگاه الگوریتم‌ها</a>
<a href="#ai">🤖 هوش مصنوعی</a>
<a href="#journey">🛤 سفر ما</a>
<a href="#why">✨ چرا NEXA</a>
<a href="#faq">❓ پرسش‌ها</a>
<a href="#contact">📮 تماس</a>
</nav>
<main id="main">
<section id="home" aria-label="معرفی NEXA">
<div class="container">
<div class="hero-grid">
<div class="hero-copy">
<span class="chip hero-eyebrow" data-reveal><i></i> سازمان غیرانتفاعی توسعه هوش مصنوعی ایران</span>
<h1 class="hero-title" data-reveal style="--d:.08s">NEXA<small>یک <span class="grad-text">کهکشانِ فناوریِ ایرانی</span> در مرورگر شما</small></h1>
<p class="hero-lead" data-reveal style="--d:.16s">از <b>مدل بومی kokb1</b> و چت هوش مصنوعی تا <b>هزاران بازی</b>، آموزش تعاملی فیزیک و زیست، سیستم‌عامل وب و ده‌ها ابزار رایگان — همه‌چیز روی <b>Hugging Face</b> زنده است، بدون نصب، روی هر دستگاه. کهکشان روبه‌رو را با کنسول پایین شکل دهید؛ این سایت خودش یک دمو است.</p>
<div class="hero-cta" data-reveal style="--d:.24s">
<a class="btn btn-primary" href="#projects">🪐 کاوش کهکشان پروژه‌ها</a>
<a class="btn btn-ghost" href="#ai">🤖 گفتگو با نکسا‌یار</a>
</div>
<div class="hero-badges" data-reveal style="--d:.32s">
<span class="hbadge">🛰 <b>۴۸</b> فضای زنده</span>
<span class="hbadge">🧠 <b>۱۰</b> مدل بومی</span>
<span class="hbadge">🎮 <b>۱۰٬۰۰۰+</b> بازی</span>
<span class="hbadge">💚 <b>۱۰۰٪</b> رایگان و متن‌باز</span>
</div>
</div>
<div class="stage-wrap" data-reveal style="--d:.15s">
<div class="stage" id="stage">
<canvas id="galaxy-canvas" aria-label="شبیه‌سازی تعاملی کهکشان NEXA"></canvas>
<div class="stage-hud"><span class="hud-chip"><i></i> شبیه‌سازی زنده کهکشان</span><span class="hud-chip" id="hud-mode">🌀 مارپیچی</span></div>
<div class="stage-hint"><span>🖱 نگه‌دارید تا ستاره‌ها جذب شوند</span><span>✨ دوکلیک = ابرنواختر</span></div>
</div>
</div>
</div>
<div class="dock" data-reveal style="--d:.2s" role="group" aria-label="کنسول کنترل کهکشان">
<div class="dock-head">
<span class="dock-title"><span class="led"></span> 🎛 کنسول کهکشان</span>
<span class="chip">همه تغییرات زنده اعمال می‌شوند</span>
<span class="chip" id="galaxy-readout">— fps • — ★</span>
</div>
<div class="dock-grid">
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-count">تعداد ستاره</label><b class="ctl-val" id="v-count">۹۰۰</b></div><input type="range" id="g-count" min="200" max="2000" step="50" value="900"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-speed">سرعت چرخش</label><b class="ctl-val" id="v-speed">۱</b></div><input type="range" id="g-speed" min="0" max="3" step="0.05" value="1"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-grav">نیروی گرانش</label><b class="ctl-val" id="v-grav">۰٫۹</b></div><input type="range" id="g-grav" min="0.1" max="2" step="0.05" value="0.9"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-size">اندازه ستاره</label><b class="ctl-val" id="v-size">۱٫۴</b></div><input type="range" id="g-size" min="0.5" max="3" step="0.1" value="1.4"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-glow">درخشش</label><b class="ctl-val" id="v-glow">۱</b></div><input type="range" id="g-glow" min="0.2" max="2" step="0.05" value="1"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-trail">دنباله نور</label><b class="ctl-val" id="v-trail">۵۵٪</b></div><input type="range" id="g-trail" min="0" max="0.95" step="0.05" value="0.55"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-link">برد پیوندها</label><b class="ctl-val" id="v-link">۷۰</b></div><input type="range" id="g-link" min="0" max="140" step="5" value="70"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-hue">چرخش رنگ</label><b class="ctl-val" id="v-hue">۰°</b></div><input type="range" id="g-hue" min="0" max="360" step="5" value="0"></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-palette">پالت رنگ</label></div><select id="g-palette"><option value="cosmic" selected>🟣 کیهانی</option><option value="cyan">🔵 فیروزه‌ای</option><option value="amber">🟡 کهربایی</option><option value="magenta">🔴 سرخابی</option><option value="rainbow">🌈 رنگین‌کمان</option></select></div>
<div class="ctl"><div class="ctl-row"><label class="ctl-name" for="g-mode">حالت حرکت</label></div><select id="g-mode"><option value="spiral" selected>🌀 کهکشان مارپیچی</option><option value="nebula">🌫 سحابی شناور</option><option value="meteor">☄️ بارش شهابی</option></select></div>
<label class="switch"><input type="checkbox" id="g-links" checked><span class="track"></span><em>خطوط پیوند ستاره‌ها</em></label>
<label class="switch"><input type="checkbox" id="g-core" checked><span class="track"></span><em>هسته درخشان کهکشان</em></label>
</div>
<div class="dock-btns">
<button class="btn btn-ghost btn-sm" id="g-pause">⏸ مکث</button>
<button class="btn btn-cyan btn-sm" id="g-random">🎲 تصادفی‌سازی</button>
<button class="btn btn-ghost btn-sm" id="g-reset">↺ بازنشانی</button>
<button class="btn btn-primary btn-sm" id="g-export">⬇ خروجی PNG</button>
</div>
</div>
</div>
</section>
<div class="ticker" aria-hidden="true"><div class="ticker-track" id="ticker-track">
<span><i>✦</i> هوش مصنوعی بومی kokb1</span><span><i>✦</i> پردازش زبان فارسی</span><span><i>✦</i> ۴۸ فضای زنده Hugging Face</span><span><i>✦</i> هزاران بازی متن‌باز</span><span><i>✦</i> آموزش تعاملی فیزیک و زیست</span><span><i>✦</i> سیستم‌عامل وب داکوم</span><span><i>✦</i> استیکرساز ایتا</span><span><i>✦</i> حذف صدای خواننده با AI</span><span><i>✦</i> اطلس قرآن</span><span><i>✦</i> مبدل فایل آنلاین</span><span><i>✦</i> کدساز TOTP آفلاین</span><span><i>✦</i> آپارات دانلودر</span><span><i>✦</i> زیرنویس‌ساز</span><span><i>✦</i> غیرانتفاعی و رایگان</span>
</div></div>
<section id="stats" aria-label="آمار NEXA">
<div class="container">
<div class="stats-grid">
<div class="stat" data-reveal style="--sc:rgba(255,194,71,.3);--sn:var(--gold)"><div class="stat-icon">🛰</div><div class="stat-num" data-count="48">۰</div><div class="stat-label">فضای زنده روی Hugging Face</div></div>
<div class="stat" data-reveal style="--d:.08s;--sc:rgba(255,77,141,.3);--sn:var(--magenta)"><div class="stat-icon">🧠</div><div class="stat-num" data-count="10">۰</div><div class="stat-label">مدل هوش مصنوعی بومی</div></div>
<div class="stat" data-reveal style="--d:.16s;--sc:rgba(34,211,238,.3);--sn:var(--cyan)"><div class="stat-icon">🎮</div><div class="stat-num" data-count="10000" data-suffix="+">۰</div><div class="stat-label">بازی متن‌باز در آرشیو Play</div></div>
<div class="stat" data-reveal style="--d:.24s;--sc:rgba(52,211,153,.3);--sn:var(--ok)"><div class="stat-icon">💚</div><div class="stat-num" data-count="100" data-suffix="٪">۰</div><div class="stat-label">رایگان، متن‌باز و بدون نصب</div></div>
</div>
</div>
</section>
<section id="projects" class="sec" aria-labelledby="projects-title">
<div class="aurora" style="width:420px;height:420px;top:6%;left:-160px;background:rgba(139,92,246,.3)"></div>
<div class="aurora" style="width:360px;height:360px;bottom:10%;right:-140px;background:rgba(255,77,141,.22)"></div>
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">کاتالوگ زنده</span>
<h2 class="sec-title" id="projects-title">🪐 کهکشان <span class="grad-text">پروژه‌ها</span></h2>
<p class="sec-sub">همه فضاهای رسمی NEXA یک‌جا؛ جستجو کنید، فیلتر کنید، علاقه‌مندی بسازید و هر پروژه را بدون خروج از همین صفحه اجرا کنید. از یک سایت ساده تا بازی، هوش مصنوعی و سیستم‌عامل وب.</p>
</div>
<div class="proj-toolbar" data-reveal>
<div class="proj-row1">
<div class="search-box"><input type="search" id="proj-q" placeholder="جستجو در پروژه‌ها… (مثلاً: بازی، فیزیک، استیکر)" aria-label="جستجو در پروژه‌ها"><button id="proj-clear" aria-label="پاک کردن جستجو">✕</button></div>
<select id="proj-sort" aria-label="مرتب‌سازی"><option value="featured">⭐ پیشنهاد NEXA</option><option value="name">🔤 نام (الف تا ی)</option><option value="cat">🗂 دسته‌بندی</option></select>
</div>
<div class="filter-chips" id="proj-chips" role="group" aria-label="فیلتر دسته‌بندی"></div>
</div>
<div class="proj-grid" id="proj-grid"></div>
</div>
</section>
<section id="lab" class="sec" aria-labelledby="lab-title">
<div class="aurora" style="width:400px;height:400px;top:0;right:-150px;background:rgba(34,211,238,.2)"></div>
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">الگوریتم‌ها، زنده و قابل لمس</span>
<h2 class="sec-title" id="lab-title">🧪 آزمایشگاه <span class="grad-text">الگوریتم‌ها</span></h2>
<p class="sec-sub">پنج شبیه‌سازی واقعی که همین‌جا در مرورگر شما اجرا می‌شوند؛ مرتب‌سازی، مسیریابی A*، فیزیک برخورد، فراکتال مندلبرو و بازی زندگی کانوی. دست بزنید، خراب کنید، دوباره بسازید!</p>
</div>
<div class="lab-tabs" id="lab-tabs" role="tablist" aria-label="آزمایش‌ها">
<button class="ltab active" data-lab="sort" role="tab" aria-selected="true">📊 مرتب‌سازی</button>
<button class="ltab" data-lab="path" role="tab" aria-selected="false">🧭 مسیریابی A*</button>
<button class="ltab" data-lab="phys" role="tab" aria-selected="false">⚛️ فیزیک برخورد</button>
<button class="ltab" data-lab="frac" role="tab" aria-selected="false">🌀 فراکتال مندلبرو</button>
<button class="ltab" data-lab="life" role="tab" aria-selected="false">🧬 بازی زندگی</button>
</div>
<div class="lab-panel active" id="panel-sort" role="tabpanel">
<div class="lab-head"><h3>📊 رقص مرتب‌سازی</h3><p>شش الگوریتم کلاسیک را با هم مقایسه کنید؛ میله‌های کهربایی مقایسه می‌شوند، سرخابی‌ها جابه‌جا و سبزها مرتب شده‌اند.</p></div>
<div class="lab-controls">
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="s-algo">الگوریتم</label></div><select id="s-algo"><option value="bubble">حبابی (Bubble)</option><option value="quick" selected>سریع (Quick)</option><option value="merge">ادغامی (Merge)</option><option value="insertion">درجی (Insertion)</option><option value="selection">انتخابی (Selection)</option><option value="shell">شل (Shell)</option></select></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="s-size">اندازه آرایه</label><b class="ctl-val" id="sv-size">۷۲</b></div><input type="range" id="s-size" min="24" max="144" step="6" value="72"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="s-speed">سرعت</label><b class="ctl-val" id="sv-speed">۳۰</b></div><input type="range" id="s-speed" min="1" max="120" step="1" value="30"></div>
<div class="lab-btns"><button class="btn btn-cyan btn-sm" id="s-run">▶ شروع</button><button class="btn btn-ghost btn-sm" id="s-step">⏭ گام</button><button class="btn btn-ghost btn-sm" id="s-shuffle">🎲 آرایه جدید</button></div>
</div>
<div class="lab-stage" id="st-sort"><canvas id="c-sort"></canvas></div>
<div class="lab-stats"><span class="lstat">مقایسه‌ها <b id="s-cmp">۰</b></span><span class="lstat">جابه‌جایی‌ها <b id="s-swap">۰</b></span><span class="lstat">وضعیت <b id="s-status">آماده</b></span></div>
<p class="lab-hint">💡 سرعت را کم کنید تا مقایسه‌های QuickSort را دنبال کنید؛ سپس همین آرایه را با حبابی مرتب کنید و تعداد عملیات را مقایسه کنید.</p>
</div>
<div class="lab-panel" id="panel-path" role="tabpanel">
<div class="lab-head"><h3>🧭 مسیریاب هوشمند</h3><p>دیوار بکشید، مبدأ و مقصد را جابه‌جا کنید و ببینید A* چطور کوتاه‌ترین راه را پیدا می‌کند.</p></div>
<div class="lab-controls">
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="p-algo">الگوریتم</label></div><select id="p-algo"><option value="astar" selected>A* (هیوریستیک)</option><option value="dijkstra">دایجسترا</option><option value="bfs">جستجوی سطح‌اول (BFS)</option><option value="greedy">حریصانه (Greedy)</option></select></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="p-speed">سرعت انیمیشن</label><b class="ctl-val" id="pv-speed">۲۴</b></div><input type="range" id="p-speed" min="1" max="80" step="1" value="24"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="p-density">تراکم دیوار تصادفی</label><b class="ctl-val" id="pv-density">۲۸٪</b></div><input type="range" id="p-density" min="10" max="45" step="1" value="28"></div>
<div class="lab-btns"><button class="btn btn-cyan btn-sm" id="p-run">▶ اجرا</button><button class="btn btn-ghost btn-sm" id="p-maze">🧱 دیوار تصادفی</button><button class="btn btn-ghost btn-sm" id="p-clear">🧹 پاک‌سازی</button></div>
</div>
<div class="lab-stage" id="st-path"><canvas id="c-path"></canvas></div>
<div class="lab-stats"><span class="lstat">خانه‌های بررسی‌شده <b id="p-visited">۰</b></span><span class="lstat">طول مسیر <b id="p-len">—</b></span><span class="lstat">زمان محاسبه <b id="p-time">—</b></span><span class="lstat">وضعیت <b id="p-status">آماده</b></span></div>
<p class="lab-hint">💡 با کشیدن انگشت/ماوس دیوار بکشید؛ روی خانه دیوار بکشید تا پاک شود. دایره سبز مبدأ و لوزی سرخابی مقصد است — آن‌ها را هم می‌توانید کشید.</p>
</div>
<div class="lab-panel" id="panel-phys" role="tabpanel">
<div class="lab-head"><h3>⚛️ جعبه فیزیک</h3><p>توپ‌های الاستیک با گرانش، برخورد و پایستگی انرژی. کلیک کوتاه = انفجار؛ نگه‌داشتن = چاه گرانش.</p></div>
<div class="lab-controls">
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="ph-grav">گرانش</label><b class="ctl-val" id="phv-grav">۹۰۰</b></div><input type="range" id="ph-grav" min="0" max="2000" step="50" value="900"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="ph-bounce">کشسانی</label><b class="ctl-val" id="phv-bounce">۸۲٪</b></div><input type="range" id="ph-bounce" min="0.3" max="1" step="0.02" value="0.82"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="ph-count">تعداد توپ</label><b class="ctl-val" id="phv-count">۳۶</b></div><input type="range" id="ph-count" min="5" max="80" step="1" value="36"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="ph-size">اندازه</label><b class="ctl-val" id="phv-size">۱۲</b></div><input type="range" id="ph-size" min="6" max="22" step="1" value="12"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="ph-time">سرعت زمان</label><b class="ctl-val" id="phv-time">۱</b></div><input type="range" id="ph-time" min="0.2" max="2" step="0.1" value="1"></div>
<label class="switch lctl fixed"><input type="checkbox" id="ph-trails" checked><span class="track"></span><em>دنباله</em></label>
<div class="lab-btns"><button class="btn btn-primary btn-sm" id="ph-boom">💥 انفجار</button><button class="btn btn-ghost btn-sm" id="ph-pause">⏸ مکث</button><button class="btn btn-ghost btn-sm" id="ph-reset">↺ بازنشانی</button></div>
</div>
<div class="lab-stage" id="st-phys"><canvas id="c-phys"></canvas></div>
<div class="lab-stats"><span class="lstat">انرژی جنبشی <b id="ph-energy">۰</b></span><span class="lstat">توپ‌ها <b id="ph-balls">۳۶</b></span></div>
<p class="lab-hint">💡 کشسانی را روی ۱۰۰٪ بگذارید و گرانش را صفر کنید تا برخوردهای کاملاً الاستیک را ببینید — مثل مولکول‌های گاز.</p>
</div>
<div class="lab-panel" id="panel-frac" role="tabpanel">
<div class="lab-head"><h3>🌀 کاوشگر مندلبرو</h3><p>بی‌نهایت جزئیات در یک فرمول ساده: z ← z² + c. با چرخ ماوس زوم کنید و با کشیدن، در مرزهای فراکتال سفر کنید.</p></div>
<div class="lab-controls">
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="f-iter">دقت (تکرار)</label><b class="ctl-val" id="fv-iter">۱۸۰</b></div><input type="range" id="f-iter" min="60" max="500" step="10" value="180"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="f-pal">پالت</label></div><select id="f-pal"><option value="neon" selected>🟣 نئون کیهانی</option><option value="fire">🔥 آتش</option><option value="ocean">🌊 اقیانوس</option><option value="gold">🌟 طلایی</option></select></div>
<div class="lab-btns"><button class="btn btn-ghost btn-sm" id="f-zin">➕ زوم</button><button class="btn btn-ghost btn-sm" id="f-zout">➖ خروج</button><button class="btn btn-ghost btn-sm" id="f-reset">↺ بازنشانی</button><button class="btn btn-primary btn-sm" id="f-export">⬇ خروجی PNG</button></div>
</div>
<div class="lab-stage" id="st-frac"><canvas id="c-frac"></canvas><div class="frac-progress" id="f-prog"><b></b></div></div>
<div class="lab-stats"><span class="lstat">بزرگ‌نمایی <b id="f-zoom">×۱</b></span><span class="lstat">مرکز <b id="f-center">‎-0.6 + 0i</b></span><span class="lstat">وضعیت <b id="f-status">آماده</b></span></div>
<p class="lab-hint">💡 دره فیل‌ها حوالی ‎0.27 + 0.008i‎ است؛ زوم کنید و مارپیچ‌های بی‌پایان را کشف کنید. هنگام حرکت، پیش‌نمایش سریع و سپس رندر کامل انجام می‌شود.</p>
</div>
<div class="lab-panel" id="panel-life" role="tabpanel">
<div class="lab-head"><h3>🧬 بازی زندگی کانوی</h3><p>سه قانون ساده، حیات پیچیده: تولد با ۳ همسایه، بقا با ۲ یا ۳. سلول بکشید یا الگوی معروف درج کنید.</p></div>
<div class="lab-controls">
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="l-speed">نسل در ثانیه</label><b class="ctl-val" id="lv-speed">۸</b></div><input type="range" id="l-speed" min="1" max="30" step="1" value="8"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="l-density">تراکم تصادفی</label><b class="ctl-val" id="lv-density">۲۸٪</b></div><input type="range" id="l-density" min="10" max="60" step="1" value="28"></div>
<div class="lctl"><div class="ctl-row"><label class="ctl-name" for="l-pattern">درج الگو</label></div><select id="l-pattern"><option value="" selected>— انتخاب کنید —</option><option value="glider">🛩 گلایدر</option><option value="pulsar">💫 تپنده (Pulsar)</option><option value="rpent">🧩 آر-پنتومینو</option><option value="lwss">🚀 سفینه سبک</option></select></div>
<div class="lab-btns"><button class="btn btn-cyan btn-sm" id="l-run">▶ شروع</button><button class="btn btn-ghost btn-sm" id="l-step">⏭ یک نسل</button><button class="btn btn-ghost btn-sm" id="l-random">🎲 تصادفی</button><button class="btn btn-ghost btn-sm" id="l-clear">🧹 پاک‌سازی</button></div>
</div>
<div class="lab-stage" id="st-life"><canvas id="c-life"></canvas></div>
<div class="lab-stats"><span class="lstat">نسل <b id="l-gen">۰</b></span><span class="lstat">جمعیت <b id="l-pop">۰</b></span><span class="lstat">وضعیت <b id="l-status">آماده</b></span></div>
<p class="lab-hint">💡 الگوی «تپنده» را درج کنید و شروع را بزنید؛ یا آر-پنتومینو را ببینید که پس از ۱۱۰۳ نسل آرام می‌گیرد!</p>
</div>
</div>
</section>
<section id="ai" class="sec" aria-labelledby="ai-title">
<div class="aurora" style="width:440px;height:440px;top:10%;left:-170px;background:rgba(255,77,141,.2)"></div>
<div class="aurora" style="width:380px;height:380px;bottom:0;right:-140px;background:rgba(139,92,246,.26)"></div>
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">دستیار + مدل‌های بومی</span>
<h2 class="sec-title" id="ai-title">🤖 هوش مصنوعی <span class="grad-text">NEXA</span></h2>
<p class="sec-sub">«نکسا‌یار» دستیار همین سایت است: پروژه پیدا می‌کند، سایت را کنترل می‌کند، محاسبه می‌کند و پاسخ می‌دهد — کاملاً در مرورگر شما. برای گفتگوی کامل، سراغ مدل‌های زنده NEXA بروید.</p>
</div>
<div class="ai-grid">
<div class="chat-card" data-reveal>
<div class="chat-head">
<div class="chat-avatar">✦</div>
<div><div class="chat-name">نکسا‌یار</div><div class="chat-status"><i></i> آنلاین — پردازش محلی، بدون ارسال داده</div></div>
<button class="btn-ico" id="chat-clear" title="پاک‌سازی گفتگو" aria-label="پاک‌سازی گفتگو">🗑</button>
</div>
<div class="chat-body" id="chat-body" aria-live="polite"></div>
<div class="chat-sugs" id="chat-sugs">
<button data-say="بازی‌ها را نشان بده">🎮 بازی‌ها</button>
<button data-say="درباره NEXA بگو">✨ درباره NEXA</button>
<button data-say="۲۵×۴+۱۰ را حساب کن">🧮 محاسبه</button>
<button data-say="کهکشان را سرخابی کن">🎨 رنگ کهکشان</button>
<button data-say="تاریخ امروز چیست؟">📅 تاریخ امروز</button>
</div>
<form class="chat-form" id="chat-form">
<input id="chat-input" maxlength="200" autocomplete="off" placeholder="از نکسا‌یار بپرس… (مثلاً: پروژه فیزیک را باز کن)" aria-label="پیام به نکسا‌یار">
<button id="chat-send" type="submit" aria-label="ارسال">➤</button>
</form>
</div>
<div class="ai-side">
<div class="ai-card" style="--ac:var(--cyan)" data-reveal><div class="ai-card-icon">🦆</div><h4>داک‌ای‌آی (DuckAI)</h4><p>چت هوش مصنوعی سریع و رایگان با رابط فارسی؛ بدون ثبت‌نام، مستقیم در مرورگر.</p><button class="btn btn-cyan btn-sm" data-open="duckai">▶ اجرای زنده</button></div>
<div class="ai-card" style="--ac:var(--magenta);--d:.08s" data-reveal><div class="ai-card-icon">🧠</div><h4>kokb1 نسخه ۲</h4><p>مدل بومی سبک و سریع NEXA؛ اجرای رایگان روی Hugging Face Inference Providers بدون محدودیت درخواست.</p><button class="btn btn-primary btn-sm" data-open="kokb1-v2-space">▶ اجرای زنده</button></div>
<div class="ai-card" style="--ac:var(--gold);--d:.16s" data-reveal><div class="ai-card-icon">🎨</div><h4>استودیوی تصویر AI</h4><p>ساخت تصویر با هوش مصنوعی NEXA — همان img.html معروف؛ خلاقیت بی‌مرز در مرورگر.</p><button class="btn btn-ghost btn-sm" data-open="Ai-img">▶ اجرای زنده</button></div>
<div class="ai-card" style="--ac:var(--violet);--d:.24s" data-reveal><div class="ai-card-icon">🛰</div><h4>همه پروژه‌های AI</h4><p>چت‌بات‌ها، جستجوی هوشمند، حذف صدای خواننده و ۱۰ مدل بومی دیگر در کاتالوگ.</p><button class="btn btn-ghost btn-sm" id="ai-all">🗂 مشاهده در کاتالوگ</button></div>
</div>
</div>
</div>
</section>
<section id="journey" class="sec" aria-labelledby="journey-title">
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">از یک سایت ساده تا یک کهکشان</span>
<h2 class="sec-title" id="journey-title">🛤 سفر <span class="grad-text">NEXA</span></h2>
<p class="sec-sub">داستان ما از یک Google Sites ساده شروع شد و به ده‌ها فضای زنده روی Hugging Face رسید. این خط زمانی، واقعی است.</p>
</div>
<div class="timeline">
<div class="tl-item" data-reveal><span class="tl-dot"></span><span class="tl-date">پیش از مهر ۱۴۰۴</span><div class="tl-card"><h4>🌱 جرقه — سایت کلاسیک</h4><p>نخستین خانه NEXA روی Google Sites؛ یک صفحه ساده با یک رؤیای بزرگ: فناوری ایرانی برای همه.</p></div></div>
<div class="tl-item" data-reveal><span class="tl-dot" style="background:var(--magenta);box-shadow:0 0 0 3px rgba(255,77,141,.35),0 0 16px rgba(255,77,141,.6)"></span><span class="tl-date">مهر تا آذر ۱۴۰۴</span><div class="tl-card"><h4>🛰 مهاجرت به Hugging Face</h4><p>اولین فضاها متولد شدند: نمونه‌سایت‌ها، جستجوگر ۱۲ و سپس ربات‌های NEXA روی Gradio و Docker.</p></div></div>
<div class="tl-item" data-reveal><span class="tl-dot" style="background:var(--cyan);box-shadow:0 0 0 3px rgba(34,211,238,.35),0 0 16px rgba(34,211,238,.6)"></span><span class="tl-date">خرداد تا تیر ۱۴۰۵</span><div class="tl-card"><h4>🧰 انفجار ابزارها</h4><p>استیکرساز ایتا، آپارات دانلودر، مبدل NEXA، زیرنویس‌ساز و بازسازی بازی دزد کوچولو — ابزار برای زندگی روزمره ایرانی.</p></div></div>
<div class="tl-item" data-reveal><span class="tl-dot"></span><span class="tl-date">مرداد ۱۴۰۵</span><div class="tl-card"><h4>🖥 سیستم‌عامل وب داکوم</h4><p>DACOMOS 1.1 منتشر شد: دسکتاپ کامل در مرورگر با فایل‌منیجر، ترمینال و دستیار هوشمند؛ به‌همراه اطلس قرآن و حذف صدای خواننده با AI.</p></div></div>
<div class="tl-item" data-reveal><span class="tl-dot" style="background:var(--ok);box-shadow:0 0 0 3px rgba(52,211,153,.35),0 0 16px rgba(52,211,153,.6)"></span><span class="tl-date">شهریور ۱۴۰۵</span><div class="tl-card"><h4>🧠 تولد kokb1 و نسخه ۲</h4><p>اولین سری مدل‌های هوش مصنوعی اصیل ایرانی NEXA؛ سبک، سریع و فارسی‌فهم — با اجرای رایگان روی Inference Providers.</p></div></div>
<div class="tl-item" data-reveal><span class="tl-dot" style="background:var(--violet);box-shadow:0 0 0 3px rgba(139,92,246,.4),0 0 16px rgba(139,92,246,.7)"></span><span class="tl-date">آبان ۱۴۰۵ — اکنون</span><div class="tl-card"><h4>🌌 ابرسایت کهکشانی</h4><p>DuckAI، زیست ۲۰ و ویدیو فیزیک به خانواده پیوستند و این ابرسایت متولد شد: ۴۸ فضا، یک کهکشان، بی‌نهایت امکان.</p></div></div>
</div>
</div>
</section>
<section id="why" class="sec" aria-labelledby="why-title">
<div class="aurora" style="width:400px;height:400px;top:20%;right:-160px;background:rgba(255,176,32,.14)"></div>
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">تعهد ما</span>
<h2 class="sec-title" id="why-title">✨ چرا <span class="grad-text">NEXA</span>؟</h2>
<p class="sec-sub">ساخته‌شده با وسواس مهندسی و عشق به زبان فارسی؛ هر جزء این سایت و فضاهای ما یک دلیل دارد.</p>
</div>
<div class="why-grid">
<div class="why-card" data-reveal style="--wc:rgba(255,194,71,.22)"><div class="why-icon">🔎</div><h3>سئوی رتبه یک</h3><p>داده‌های ساخت‌یافته Schema.org (سازمان، وب‌سایت، فهرست نرم‌افزارها، پرسش‌های متداول)، متاتگ‌های کامل Open Graph و robots برای گوگل، بینگ و همه موتورهای جستجو.</p></div>
<div class="why-card" data-reveal style="--d:.07s;--wc:rgba(34,211,238,.22)"><div class="why-icon">⚡</div><h3>سرعت روی هر سیستم</h3><p>بدون فریم‌ورک سنگین؛ یک فایل، یک حلقه انیمیشن، اسپرایت‌های ازپیش‌رندرشده و سقف چگالی پیکسل. روی موبایل ضعیف هم روان است و وقتی تب پنهان شود، موتور خودش می‌خوابد.</p></div>
<div class="why-card" data-reveal style="--d:.14s;--wc:rgba(255,77,141,.22)"><div class="why-icon">📱</div><h3>همه‌دستگاه، همه‌جا</h3><p>راست‌چین کامل فارسی، واکنش‌گرا از موبایل تا نمایشگر ۴K و بدون هیچ نصبی. پروژه‌ها هم همین‌طورند: فقط یک مرورگر کافی است.</p></div>
<div class="why-card" data-reveal style="--wc:rgba(139,92,246,.25)"><div class="why-icon">🧠</div><h3>هوش مصنوعی بومی</h3><p>از kokb1 تا نکسا‌یارِ همین صفحه: پردازش زبان فارسی، مدل‌های مولد و هوش مصنوعی فرهنگی‌سازگار — تخصص رسمی سازمان ما در Hugging Face.</p></div>
<div class="why-card" data-reveal style="--d:.07s;--wc:rgba(52,211,153,.22)"><div class="why-icon">🔓</div><h3>متن‌باز و غیرانتفاعی</h3><p>همه ۴۸ فضا و ۱۰ مدل، رایگان و متن‌باز روی huggingface.co/nexa. بدون تبلیغ، بدون ردیاب، بدون دیوار پرداخت. دانش باید مثل نور ستاره به همه برسد.</p></div>
<div class="why-card" data-reveal style="--d:.14s;--wc:rgba(56,189,248,.22)"><div class="why-icon">♿</div><h3>دسترس‌پذیری واقعی</h3><p>ناوبری کامل با کیبورد (Ctrl+K)، برچسب‌های ARIA، کنتراست خوانا، احترام به prefers-reduced-motion و نسخه بدون جاوااسکریپت برای خزنده‌ها و دستگاه‌های خاص.</p></div>
</div>
<div class="about-art" data-reveal>
<svg viewBox="0 0 1200 430" role="img" aria-label="تصویر هنری کهکشان NEXA">
<defs>
<radialGradient id="ag-core" cx="50%" cy="50%" r="50%"><stop offset="0" stop-color="#fff7e0"/><stop offset=".25" stop-color="#ffc247"/><stop offset=".55" stop-color="#ff4d8d" stop-opacity=".75"/><stop offset="1" stop-color="#8b5cf6" stop-opacity="0"/></radialGradient>
<radialGradient id="ag-halo" cx="50%" cy="50%" r="50%"><stop offset="0" stop-color="#8b5cf6" stop-opacity=".5"/><stop offset=".6" stop-color="#22d3ee" stop-opacity=".12"/><stop offset="1" stop-color="#22d3ee" stop-opacity="0"/></radialGradient>
<linearGradient id="ag-arm" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#22d3ee"/><stop offset=".5" stop-color="#8b5cf6"/><stop offset="1" stop-color="#ff4d8d"/></linearGradient>
</defs>
<rect width="1200" height="430" fill="#070313"/>
<g opacity=".9"><circle cx="90" cy="60" r="1.6" fill="#efeaff"/><circle cx="210" cy="140" r="1.1" fill="#22d3ee"/><circle cx="330" cy="50" r="1.4" fill="#efeaff"/><circle cx="470" cy="90" r="1" fill="#ffc247"/><circle cx="1080" cy="70" r="1.7" fill="#efeaff"/><circle cx="1140" cy="180" r="1.1" fill="#ff4d8d"/><circle cx="1010" cy="330" r="1.4" fill="#22d3ee"/><circle cx="150" cy="330" r="1.5" fill="#efeaff"/><circle cx="60" cy="220" r="1" fill="#ffc247"/><circle cx="270" cy="380" r="1.2" fill="#8b5cf6"/><circle cx="950" cy="40" r="1.2" fill="#efeaff"/><circle cx="820" cy="380" r="1.5" fill="#ffc247"/><circle cx="1120" cy="300" r="1" fill="#efeaff"/><circle cx="520" cy="30" r="1.3" fill="#22d3ee"/><circle cx="700" cy="45" r="1" fill="#efeaff"/><circle cx="390" cy="360" r="1.1" fill="#ff4d8d"/><circle cx="620" cy="395" r="1.3" fill="#efeaff"/><circle cx="1060" cy="120" r="1" fill="#8b5cf6"/></g>
<ellipse cx="600" cy="215" rx="330" ry="120" fill="url(#ag-halo)"/>
<g fill="none" stroke="url(#ag-arm)" stroke-width="1.6" opacity=".65">
<ellipse cx="600" cy="215" rx="300" ry="104" transform="rotate(-9 600 215)"/>
<ellipse cx="600" cy="215" rx="225" ry="76" transform="rotate(-9 600 215)" opacity=".8"/>
<ellipse cx="600" cy="215" rx="150" ry="49" transform="rotate(-9 600 215)" opacity=".9"/>
</g>
<g fill="#efeaff"><circle cx="898" cy="188" r="3.4"/><circle cx="812" cy="132" r="2.4"/><circle cx="377" cy="288" r="3"/><circle cx="303" cy="238" r="2.2"/><circle cx="742" cy="286" r="2.6"/><circle cx="455" cy="140" r="2.4"/><circle cx="672" cy="128" r="2"/><circle cx="524" cy="296" r="2.2"/></g>
<polyline points="898,188 812,132 672,128 600,215 455,140" stroke="#22d3ee" stroke-width=".8" opacity=".5" fill="none"/>
<polyline points="303,238 377,288 524,296 600,215 742,286" stroke="#ff4d8d" stroke-width=".8" opacity=".5" fill="none"/>
<circle cx="600" cy="215" r="120" fill="url(#ag-core)"/>
<circle cx="600" cy="215" r="7" fill="#fff"/>
<g font-family="Tahoma" font-size="13" fill="#a89fd0"><text x="898" y="172" text-anchor="middle" fill="#22d3ee">DuckAI</text><text x="377" y="316" text-anchor="middle" fill="#ffc247">kokb1</text><text x="812" y="116" text-anchor="middle">Play1000</text><text x="303" y="222" text-anchor="middle" fill="#ff4d8d">Zist20</text><text x="742" y="312" text-anchor="middle">Video Fizik</text><text x="455" y="124" text-anchor="middle">DACOM OS</text></g>
</svg>
<div class="about-cap"><div><h3 class="grad-text">هر ستاره، یک پروژه</h3><p>نقشه کهکشان NEXA؛ پروژه‌های واقعی روی Hugging Face که مثل ستاره‌ها به هم پیوند خورده‌اند — و هر روز ستاره تازه‌ای متولد می‌شود.</p></div><a class="btn btn-primary btn-sm" href="https://huggingface.co/nexa" target="_blank" rel="noopener">🤗 صفحه رسمی سازمان</a></div>
</div>
</div>
</section>
<section id="faq" class="sec" aria-labelledby="faq-title">
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">پاسخ‌های سریع</span>
<h2 class="sec-title" id="faq-title">❓ پرسش‌های <span class="grad-text">متداول</span></h2>
</div>
<div class="faq-list">
<div class="faq-item" data-reveal><button class="faq-q" aria-expanded="false">NEXA چیست؟<span class="fi">+</span></button><div class="faq-a"><p>NEXA یک سازمان غیرانتفاعی ایرانی برای توسعه هوش مصنوعی است که روی Hugging Face فعالیت می‌کند؛ با ۴۸ فضای زنده شامل مدل بومی kokb1، چت هوش مصنوعی، هزاران بازی، آموزش تعاملی فیزیک و زیست و ده‌ها ابزار وب رایگان. تخصص ما پردازش زبان فارسی، مدل‌های مولد و اپلیکیشن‌های آموزشی و اجتماعی است.</p></div></div>
<div class="faq-item" data-reveal><button class="faq-q" aria-expanded="false">آیا استفاده از پروژه‌ها رایگان است؟<span class="fi">+</span></button><div class="faq-a"><p>بله؛ همه فضاها و ابزارهای NEXA رایگان و متن‌باز هستند و بدون ثبت‌نام در مرورگر اجرا می‌شوند. ما غیرانتفاعی هستیم و هیچ دیوار پرداخت یا تبلیغی نداریم.</p></div></div>
<div class="faq-item" data-reveal><button class="faq-q" aria-expanded="false">پروژه‌ها روی چه دستگاه‌هایی اجرا می‌شوند؟<span class="fi">+</span></button><div class="faq-a"><p>همه پروژه‌ها وب‌محور هستند و روی موبایل، تبلت، لپ‌تاپ و حتی سیستم‌های ضعیف اجرا می‌شوند؛ فقط یک مرورگر مدرن کافی است و هیچ نصبی لازم نیست. همین سایت هم روی هر دستگاهی روان است.</p></div></div>
<div class="faq-item" data-reveal><button class="faq-q" aria-expanded="false">مدل kokb1 چیست؟<span class="fi">+</span></button><div class="faq-a"><p>kokb1 نخستین سری مدل‌های هوش مصنوعی اصیل ایرانی NEXA است؛ سبک، سریع و طراحی‌شده برای زبان فارسی. نسخه ۲ آن روی Hugging Face Inference Providers به‌صورت رایگان و بدون محدودیت تعداد درخواست اجرا می‌شود. صفحه مدل‌ها: <a href="https://huggingface.co/nexa" target="_blank" rel="noopener">huggingface.co/nexa</a></p></div></div>
<div class="faq-item" data-reveal><button class="faq-q" aria-expanded="false">چگونه با NEXA همکاری کنیم؟<span class="fi">+</span></button><div class="faq-a"><p>از طریق صفحه سازمان در Hugging Face یا ایمیل nexa@gmail.com با ما در ارتباط باشید. همه پروژه‌ها متن‌باز هستند؛ می‌توانید در Spaces مشارکت کنید، بازخورد بدهید یا فضای خودتان را بسازید و به کهکشان اضافه کنید.</p></div></div>
</div>
</div>
</section>
<section id="contact" class="sec" aria-labelledby="contact-title">
<div class="aurora" style="width:420px;height:420px;bottom:-120px;left:-150px;background:rgba(34,211,238,.16)"></div>
<div class="container">
<div class="sec-head" data-reveal>
<span class="eyebrow">به کهکشان بپیوندید</span>
<h2 class="sec-title" id="contact-title">📮 تماس با <span class="grad-text">NEXA</span></h2>
<p class="sec-sub">ایده، بازخورد یا پیشنهاد همکاری دارید؟ پیام بگذارید یا مستقیم از راه‌های رسمی با ما در ارتباط باشید.</p>
</div>
<div class="contact-grid">
<div class="contact-info" data-reveal>
<a class="cinfo-item" href="https://huggingface.co/nexa" target="_blank" rel="noopener"><span class="ci">🤗</span><div><h4>سازمان در Hugging Face</h4><p>huggingface.co/nexa</p></div></a>
<a class="cinfo-item" href="mailto:nexa@gmail.com"><span class="ci">✉️</span><div><h4>ایمیل رسمی</h4><p>nexa@gmail.com</p></div></a>
<a class="cinfo-item" href="https://sites.google.com/view/nexa" target="_blank" rel="noopener"><span class="ci">🕰</span><div><h4>خانه کلاسیک (Google Sites)</h4><p>sites.google.com/view/nexa</p></div></a>
<div class="cinfo-item"><span class="ci">⚡</span><div><h4>پاسخ‌گویی</h4><p style="direction:rtl">تیم کوچک و چابک ما معمولاً ظرف چند روز پاسخ می‌دهد؛ برای پروژه‌های متن‌باز، مستقیم در بخش Community همان Space گفتگو کنید.</p></div></div>
</div>
<form id="contact-form" data-reveal novalidate>
<div class="field" id="fld-name"><label for="cf-name">نام شما</label><input id="cf-name" type="text" maxlength="60" placeholder="مثلاً: ستاره‌دوست نکسایی"><span class="err">نام باید حداقل ۲ حرف باشد.</span></div>
<div class="field" id="fld-email"><label for="cf-email">ایمیل</label><input id="cf-email" type="email" maxlength="80" placeholder="you@example.com" dir="ltr"><span class="err">یک ایمیل معتبر وارد کنید.</span></div>
<div class="field" id="fld-msg"><label for="cf-msg">پیام <span id="cf-count" style="color:var(--dim);font-weight:400">(۰/۶۰۰)</span></label><textarea id="cf-msg" rows="5" maxlength="600" placeholder="ایده‌ات را برای کهکشان بنویس…"></textarea><span class="err">پیام باید حداقل ۱۰ حرف باشد.</span></div>
<div style="display:flex;gap:10px;flex-wrap:wrap;align-items:center">
<button class="btn btn-primary" id="cf-send" type="submit">🚀 ثبت پیام</button>
<a class="btn btn-cyan" id="cf-mail" href="#">✉️ ارسال با ایمیل</a>
</div>
<p class="form-note">پیام به‌صورت امن روی همین دستگاه ذخیره می‌شود و با دکمه «ارسال با ایمیل» مستقیم به تیم NEXA می‌رسد — هیچ سرور واسطی وجود ندارد.</p>
</form>
</div>
</div>
</section>
</main>
<footer id="footer">
<div class="container">
<div class="foot-grid">
<div class="foot-brand">
<a class="brand" href="#home"><svg viewBox="0 0 48 48" width="40" height="40" aria-hidden="true"><path d="M24 2l4.6 17.4L46 24l-17.4 4.6L24 46l-4.6-17.4L2 24l17.4-4.6z" fill="url(#lg2)"/><circle cx="37" cy="10" r="2.2" fill="#22d3ee"/></svg><span><span class="brand-name grad-text">NEXA</span><span class="brand-sub">NEXA</span></span></a>
<p>سازمان غیرانتفاعی توسعه هوش مصنوعی ایران؛ پردازش زبان فارسی، مدل‌های مولد و اپلیکیشن‌های آموزشی — رایگان و متن‌باز برای همه.</p>
<div class="foot-social">
<a class="btn-ico" href="https://huggingface.co/nexa" target="_blank" rel="noopener" aria-label="Hugging Face">🤗</a>
<a class="btn-ico" href="mailto:nexa@gmail.com" aria-label="ایمیل">✉️</a>
<a class="btn-ico" href="https://sites.google.com/view/nexa" target="_blank" rel="noopener" aria-label="سایت کلاسیک">🕰</a>
<a class="btn-ico" href="https://www.pinterest.com/nexa/" target="_blank" rel="noopener" aria-label="پینترست">📌</a>
</div>
</div>
<div class="foot-col"><h5>دسترسی سریع</h5><ul>
<li><a href="#projects">🪐 کهکشان پروژه‌ها</a></li>
<li><a href="#lab">🧪 آزمایشگاه الگوریتم‌ها</a></li>
<li><a href="#ai">🤖 هوش مصنوعی NEXA</a></li>
<li><a href="#journey">🛤 سفر NEXA</a></li>
<li><a href="#faq">❓ پرسش‌های متداول</a></li>
<li><a href="#contact">📮 تماس و همکاری</a></li>
</ul></div>
<div class="foot-col"><h5>ستاره‌های برگزیده</h5><ul>
<li><a href="https://nexa-video-fizik.static.hf.space" target="_blank" rel="noopener">⚛️ ویدیو فیزیک</a></li>
<li><a href="https://nexa-zist20.static.hf.space" target="_blank" rel="noopener">🧬 زیست ۲۰</a></li>
<li><a href="https://nexa-duckai.static.hf.space" target="_blank" rel="noopener">🦆 داک‌ای‌آی</a></li>
<li><a href="https://nexa-ai.static.hf.space/img.html" target="_blank" rel="noopener">🎨 استودیوی تصویر AI</a></li>
<li><a href="https://nexa-optimized-version-of-the-game-tiny-thief.static.hf.space" target="_blank" rel="noopener">🕵️ دزد کوچولو</a></li>
<li><a href="https://nexa-play1000.static.hf.space" target="_blank" rel="noopener">🎮 پلی ۱۰۰۰</a></li>
</ul></div>
<div class="foot-col"><h5>وضعیت سامانه</h5><div class="foot-status">
<div class="fstat"><span>🟢 وضعیت</span><b>عملیاتی</b></div>
<div class="fstat"><span>📅 امروز</span><b id="fa-clock">—</b></div>
<div class="fstat"><span>⏱ زمان حضور شما</span><b id="fa-uptime">۰۰:۰۰</b></div>
<div class="fstat"><span>👁 بازدیدهای شما</span><b id="fa-visits">۱</b></div>
</div></div>
</div>
<details class="sitemap"><summary>🗺 نقشه کامل سایت و فضاها (برای کاوش سریع و موتورهای جستجو)</summary><div>
<a href="#home">خانه</a><a href="#stats">آمار</a><a href="#projects">کاتالوگ پروژه‌ها</a><a href="#lab">آزمایشگاه</a><a href="#ai">هوش مصنوعی</a><a href="#journey">خط زمانی</a><a href="#why">چرا NEXA</a><a href="#faq">پرسش‌ها</a><a href="#contact">تماس</a>
<a href="https://nexa-nexa-os1-1.static.hf.space" target="_blank" rel="noopener">سیستم‌عامل داکوم</a><a href="https://nexa-kokb1-v2-space.static.hf.space" target="_blank" rel="noopener">kokb1 v2</a><a href="https://nexa-quran-atlas.static.hf.space" target="_blank" rel="noopener">اطلس قرآن</a><a href="https://nexa-sticker-eitaa.static.hf.space" target="_blank" rel="noopener">استیکرساز ایتا</a><a href="https://nexa-ai-voice-removal.static.hf.space" target="_blank" rel="noopener">حذف صدای خواننده</a><a href="https://nexa-totp.static.hf.space" target="_blank" rel="noopener">کدساز TOTP</a><a href="https://nexa-nexa-convert.static.hf.space" target="_blank" rel="noopener">مبدل NEXA</a><a href="https://nexa-news1-1.static.hf.space" target="_blank" rel="noopener">اخبار ۱.۱</a><a href="https://nexa-aparat-downloadr.static.hf.space" target="_blank" rel="noopener">آپارات دانلودر</a><a href="https://nexa-sottotext.static.hf.space" target="_blank" rel="noopener">زیرنویس‌ساز</a><a href="https://xortron-pi.static.hf.space" target="_blank" rel="noopener">محاسبه‌گر π (زورترون)</a>
</div></details>
<div class="foot-bottom">
<span>© <b>۱۴۰۵ NEXA</b> — ساخته‌شده با ❤️ و ستاره‌ها در ایران</span>
<span>متن‌باز • غیرانتفاعی • میزبانی <a href="https://huggingface.co/nexa" target="_blank" rel="noopener" style="color:var(--cyan)">Hugging Face 🤗</a></span>
</div>
</div>
</footer>
<button id="backtop" aria-label="بازگشت به بالا">⬆</button>
<div id="modal" role="dialog" aria-modal="true" aria-labelledby="modal-title">
<div class="modal-box">
<div class="modal-head">
<div class="modal-title-wrap"><div id="modal-title">پروژه</div><div id="modal-cat">—</div></div>
<div class="modal-actions">
<button class="btn btn-ghost btn-sm" id="modal-copy" title="کپی نشانی">⧉ کپی</button>
<a class="btn btn-ghost btn-sm" id="modal-hf" href="#" target="_blank" rel="noopener">🤗 صفحه HF</a>
<a class="btn btn-cyan btn-sm" id="modal-newtab" href="#" target="_blank" rel="noopener">↗ تب جدید</a>
<button class="btn btn-ghost btn-sm" id="modal-full" title="تمام‌صفحه">⛶</button>
<button class="btn btn-primary btn-sm" id="modal-close">✕ بستن</button>
</div>
</div>
<div class="modal-body">
<div id="modal-loader"><div class="spin"></div><span>در حال احضار پروژه از کهکشان…</span></div>
<iframe id="modal-frame" title="پیش‌نمایش زنده پروژه" loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="fullscreen; clipboard-write; autoplay; accelerometer; gyroscope"></iframe>
</div>
<div class="modal-hint"><span>💡 اگر پیش‌نمایش نمایش داده نشد، پروژه را در تب جدید باز کنید.</span><a id="modal-hint-link" href="#" target="_blank" rel="noopener">باز کردن مستقیم ↗</a></div>
</div>
</div>
<div id="palette" role="dialog" aria-modal="true" aria-label="جستجوی فرمان">
<div class="pal-box">
<div class="pal-input-wrap"><span>🔭</span><input id="pal-input" placeholder="جستجوی پروژه، بخش یا فرمان…" autocomplete="off" aria-label="جستجوی فرمان"><span class="kbd">Esc</span></div>
<div id="pal-results"></div>
<div class="pal-foot"><span><span class="kbd">↑↓</span> حرکت</span><span><span class="kbd">Enter</span> اجرا</span><span><span class="kbd">Ctrl K</span> باز/بسته</span></div>
</div>
</div>
<div id="toasts" aria-live="polite"></div>
<noscript>
<div style="position:fixed;inset:auto 0 0 0;background:#140d33;border-top:2px solid #ffb020;padding:18px;z-index:9999;font-size:.85rem">
<b>جاوااسکریپت خاموش است.</b> پروژه‌های NEXA همچنان در دسترس‌اند:
<a style="color:#22d3ee" href="https://huggingface.co/nexa">صفحه رسمی سازمان</a> •
<a style="color:#22d3ee" href="https://nexa-duckai.static.hf.space">DuckAI</a> •
<a style="color:#22d3ee" href="https://nexa-video-fizik.static.hf.space">ویدیو فیزیک</a> •
<a style="color:#22d3ee" href="https://nexa-zist20.static.hf.space">زیست ۲۰</a> •
<a style="color:#22d3ee" href="https://nexa-optimized-version-of-the-game-tiny-thief.static.hf.space">دزد کوچولو</a> •
<a style="color:#22d3ee" href="https://nexa-ai.static.hf.space/img.html">استودیوی تصویر AI</a> •
<a style="color:#22d3ee" href="https://nexa-play1000.static.hf.space">پلی ۱۰۰۰</a>
</div>
</noscript>
<script>
'use strict';
(function(){
function $(id){return document.getElementById(id)}
function $$(sel){return Array.prototype.slice.call(document.querySelectorAll(sel))}
function clamp(v,a,b){return v<a?a:(v>b?b:v)}
function rand(a,b){return a+Math.random()*(b-a)}
function faNum(n){if(!isFinite(n))return '—';return Number(n).toLocaleString('fa-IR',{maximumFractionDigits:2})}
function faDigits(s){return String(s).replace(/[0-9]/g,function(d){return '۰۱۲۳۴۵۶۷۸۹'[+d]})}
function norm(s){return String(s==null?'':s).replace(/ي/g,'ی').replace(/ك/g,'ک').replace(/[\u200c\u200f]/g,' ').toLowerCase().trim()}
function esc(s){return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')}
function store(k,v){try{localStorage.setItem(k,JSON.stringify(v))}catch(e){}}
function load(k,d){try{var v=localStorage.getItem(k);return v===null?d:JSON.parse(v)}catch(e){return d}}
function debounce(fn,ms){var t;return function(){var args=arguments,self=this;clearTimeout(t);t=setTimeout(function(){fn.apply(self,args)},ms)}}
function safe(fn){try{fn()}catch(e){if(window.console)console.error('[nexa]',e)}}
var RM=window.matchMedia&&matchMedia('(prefers-reduced-motion: reduce)').matches;
var FINE=window.matchMedia&&matchMedia('(pointer: fine)').matches;
var TICONS={ok:'✅',bad:'⛔',warn:'⚠️',info:'💡'};
function toast(msg,type){
var box=$('toasts');if(!box)return;type=type||'info';
while(box.children.length>=3)box.removeChild(box.firstChild);
var el=document.createElement('div');el.className='toast '+type;
el.innerHTML='<span class="ti">'+TICONS[type]+'</span><span>'+esc(msg)+'</span>';
box.appendChild(el);
setTimeout(function(){el.classList.add('out');setTimeout(function(){if(el.parentNode)el.parentNode.removeChild(el)},380)},2900);
}
var AudioSys={ctx:null,master:null,on:load('nexa_sound',true),noise:null,
init:function(){
if(this.ctx||!this.on)return;
try{
var AC=window.AudioContext||window.webkitAudioContext;if(!AC)return;
this.ctx=new AC();this.master=this.ctx.createGain();this.master.gain.value=.85;this.master.connect(this.ctx.destination);
var c=this.ctx,g=c.createGain();g.gain.value=.024;
var f=c.createBiquadFilter();f.type='lowpass';f.frequency.value=210;f.Q.value=3;
var o1=c.createOscillator();o1.type='sawtooth';o1.frequency.value=55;
var o2=c.createOscillator();o2.type='sawtooth';o2.frequency.value=55.6;
var o3=c.createOscillator();o3.type='sine';o3.frequency.value=220.4;
var g3=c.createGain();g3.gain.value=.22;
var lfo=c.createOscillator();lfo.frequency.value=.06;var lg=c.createGain();lg.gain.value=85;
lfo.connect(lg);lg.connect(f.frequency);
o1.connect(f);o2.connect(f);o3.connect(g3);g3.connect(f);f.connect(g);g.connect(this.master);
o1.start();o2.start();o3.start();lfo.start();
}catch(e){}
},
tone:function(freq,dur,type,vol,slide,delay){
var c=this.ctx,t=c.currentTime+(delay||0);
var o=c.createOscillator(),g=c.createGain();
o.type=type||'sine';o.frequency.setValueAtTime(freq,t);
if(slide)o.frequency.exponentialRampToValueAtTime(Math.max(20,slide),t+dur);
g.gain.setValueAtTime(.0001,t);g.gain.exponentialRampToValueAtTime(vol||.07,t+.012);
g.gain.exponentialRampToValueAtTime(.0001,t+dur);
o.connect(g);g.connect(this.master);o.start(t);o.stop(t+dur+.06);
},
blip:function(kind){
if(!this.on||!this.ctx)return;
if(this.ctx.state==='suspended')this.ctx.resume();
try{
if(kind==='click')this.tone(760,.07,'triangle',.05,520);
else if(kind==='open')this.tone(240,.22,'sine',.07,880);
else if(kind==='close')this.tone(660,.16,'sine',.05,240);
else if(kind==='ok'){this.tone(523,.12,'triangle',.055);this.tone(659,.12,'triangle',.055,null,.09);this.tone(784,.2,'triangle',.06,null,.18);}
else if(kind==='bad')this.tone(190,.2,'sawtooth',.05,130);
else if(kind==='star')this.tone(1200,.3,'sine',.045,2400);
else if(kind==='boom'){
this.tone(90,.4,'sine',.11,40);
var c=this.ctx;
if(!this.noise){var b=c.createBuffer(1,c.sampleRate*.3|0,c.sampleRate),d=b.getChannelData(0);for(var i=0;i<d.length;i++)d[i]=(Math.random()*2-1)*(1-i/d.length);this.noise=b;}
var s=c.createBufferSource(),g=c.createGain(),f=c.createBiquadFilter();
s.buffer=this.noise;f.type='lowpass';f.frequency.value=700;g.gain.value=.14;
s.connect(f);f.connect(g);g.connect(this.master);s.start();
}
else this.tone(600,.06,'triangle',.045);
}catch(e){}
},
setOn:function(v){
this.on=v;store('nexa_sound',v);
if(v){this.init();if(this.ctx){if(this.ctx.state==='suspended')this.ctx.resume();this.master.gain.setTargetAtTime(.85,this.ctx.currentTime,.08);}}
else if(this.ctx)this.master.gain.setTargetAtTime(0,this.ctx.currentTime,.04);
updateSoundBtn();
}
};
function updateSoundBtn(){var b=$('btn-sound');if(!b)return;b.classList.toggle('muted',!AudioSys.on);b.setAttribute('aria-pressed',AudioSys.on?'true':'false');b.title=AudioSys.on?'صدا روشن است — کلیک برای خاموشی':'صدا خاموش است — کلیک برای روشن‌کردن';}
var gestureDone=false;
function firstGesture(){if(gestureDone)return;gestureDone=true;AudioSys.init();}
window.addEventListener('pointerdown',firstGesture,{passive:true});
window.addEventListener('keydown',firstGesture);
var Engine={fns:{},count:0,running:false,last:0,
add:function(id,fn){if(!this.fns[id])this.count++;this.fns[id]=fn;this.start();},
remove:function(id){if(this.fns[id]){delete this.fns[id];this.count--;}},
start:function(){
if(this.running)return;this.running=true;this.last=performance.now();
var self=this;
requestAnimationFrame(function loop(t){
if(self.count===0){self.running=false;return;}
var dt=Math.min(.05,Math.max(.001,(t-self.last)/1000));self.last=t;
var keys=Object.keys(self.fns);
for(var i=0;i<keys.length;i++){var f=self.fns[keys[i]];if(f){try{f(dt,t/1000)}catch(e){}}}
requestAnimationFrame(loop);
});
}
};
function fitCanvas(canvas,wrap,cap){
var r=wrap.getBoundingClientRect();
var dpr=Math.min(window.devicePixelRatio||1,cap||1.75);
var w=Math.max(60,Math.round(r.width)),h=Math.max(60,Math.round(r.height));
canvas.width=Math.round(w*dpr);canvas.height=Math.round(h*dpr);
var ctx=canvas.getContext('2d');ctx.setTransform(dpr,0,0,dpr,0,0);
return {w:w,h:h,ctx:ctx};
}
function onResize(el,fn){
if(window.ResizeObserver){var ro=new ResizeObserver(debounce(fn,120));ro.observe(el);}
else window.addEventListener('resize',debounce(fn,160));
}
var spriteCache={};
function starSprite(hue){
hue=((Math.round(hue/12)*12)%360+360)%360;
var k='s'+hue;if(spriteCache[k])return spriteCache[k];
var c=document.createElement('canvas');c.width=64;c.height=64;
var x=c.getContext('2d'),g=x.createRadialGradient(32,32,0,32,32,32);
g.addColorStop(0,'rgba(255,255,255,.95)');
g.addColorStop(.18,'hsla('+hue+',100%,72%,.9)');
g.addColorStop(.45,'hsla('+hue+',95%,60%,.32)');
g.addColorStop(1,'hsla('+hue+',95%,55%,0)');
x.fillStyle=g;x.fillRect(0,0,64,64);spriteCache[k]=c;return c;
}
function download(canvas,name){
try{
if(canvas.toBlob){canvas.toBlob(function(b){if(!b){toast('خروجی ممکن نشد','bad');return;}var a=document.createElement('a');a.href=URL.createObjectURL(b);a.download=name;document.body.appendChild(a);a.click();a.remove();setTimeout(function(){URL.revokeObjectURL(a.href)},4000);toast('تصویر ذخیره شد: '+name,'ok');AudioSys.blip('ok');});}
else{var a=document.createElement('a');a.href=canvas.toDataURL('image/png');a.download=name;a.click();toast('تصویر ذخیره شد','ok');}
}catch(e){toast('خروجی در این مرورگر ممکن نیست','bad')}
}
function copyText(txt){
function fallback(){try{var ta=document.createElement('textarea');ta.value=txt;ta.style.position='fixed';ta.style.opacity='0';document.body.appendChild(ta);ta.select();document.execCommand('copy');ta.remove();toast('نشانی کپی شد ⧉','ok');}catch(e){toast('کپی ممکن نشد','bad')}}
if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(txt).then(function(){toast('نشانی کپی شد ⧉','ok')},fallback);
else fallback();
}
var CATS={
ai:{name:'هوش مصنوعی',color:'#22d3ee',icon:'🧠'},
game:{name:'بازی',color:'#ff4d8d',icon:'🎮'},
edu:{name:'آموزش',color:'#34d399',icon:'📚'},
media:{name:'رسانه',color:'#ffb020',icon:'🎬'},
tool:{name:'ابزار',color:'#8b5cf6',icon:'🧰'}
};
function dash(slug){return slug.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-+|-+$/g,'')}
function spaceUrl(slug){return 'https://nexa-'+dash(slug)+'.static.hf.space'}
function nsUrl(slug){return 'https://nexa-'+dash(slug)+'.hf.space'}
function hfUrl(slug){return 'https://huggingface.co/spaces/nexa/'+slug}
function P(slug,t,d,c,tags,icon,opts){
var o={key:slug,slug:slug,t:t,d:d,c:c,tags:tags,icon:icon,url:spaceUrl(slug),hf:hfUrl(slug),feat:false,fresh:false,likes:0};
if(opts)for(var k in opts)o[k]=opts[k];
return o;
}
var PROJECTS=[
P('Video_fizik','ویدیو فیزیک','فیلم فیزیک بساز! شبیه‌سازی و تصویرسازی مفاهیم فیزیک به‌صورت ویدیوی آموزشی — تازه‌ترین ستاره کهکشان.','edu',['فیزیک','ویدیو','آموزش'],'⚛️',{feat:true,fresh:true}),
P('Zist20','زیست ۲۰ — دهم تجربی','آموزش تعاملی زیست‌شناسی دهم تجربی از صفحه ۱ تا ۲۰ کتاب درسی؛ با تصویر و انیمیشن، درس را زندگی کن.','edu',['زیست','دهم','کنکور'],'🧬',{feat:true,fresh:true}),
P('duckai','داک‌ای‌آی (DuckAI)','چت هوش مصنوعی سریع و رایگان با رابط فارسی؛ بدون ثبت‌نام و بدون محدودیت، مستقیم در مرورگر.','ai',['چت','AI','رایگان'],'🦆',{feat:true,fresh:true}),
P('Ai','استودیوی تصویر AI','ساخت تصویر با هوش مصنوعی NEXA — همان img.html معروف؛ از تخیل تا تصویر در چند ثانیه.','ai',['تصویر','AI','خلاقیت'],'🎨',{feat:true,key:'Ai-img',url:spaceUrl('Ai')+'/img.html'}),
P('Optimized_version_of_the_game_Tiny_Thief','دزد کوچولو — نسخه بهینه','بازسازی بهینه‌شده بازی محبوب Tiny Thief؛ روان روی هر دستگاه، با همان حال‌وهوای دوست‌داشتنی.','game',['بازی','ماجراجویی','بهینه'],'🕵️',{feat:true,likes:2}),
P('Play1000','پلی ۱۰۰۰ — آرشیو بازی‌ها','هزاران بازی متن‌باز در یک وب‌اپ؛ کاوش، جستجو و اجرای آنی بدون نصب. آرشیو رسمی بازی‌های NEXA.','game',['بازی','آرشیو','متن‌باز'],'🎮',{feat:true}),
P('Kokbtak_os1.1','سیستم‌عامل وب داکوم ۱.۱','DACOMOS: دسکتاپ کامل در مرورگر با فایل‌منیجر، ترمینال، مرورگر، دستیار هوشمند، پلیر MX و دفترچه — بدون نصب!','tool',['OS','داکوم','دسکتاپ'],'🖥️',{feat:true}),
P('kokb1-v2-space','kokb1 نسخه ۲','مدل بومی سبک، سریع و فوق‌پیشرفته NEXA؛ اجرای رایگان روی Inference Providers بدون محدودیت درخواست.','ai',['مدل','kokb1','فارسی'],'🧠',{feat:true}),
P('xortron-pi','زورترون π — محاسبه‌گر پی','رقم‌های π را با الگوریتم چودنوفسکی و BigInt محاسبه کن؛ تا ۱۰٬۰۰۰ رقم اعشار، زنده در مرورگر!','edu',['ریاضی','pi','چودنوفسکی'],'🧮',{feat:true,url:'https://xortron-pi.static.hf.space',hf:null}),
P('quran-atlas','اطلس قرآن','کاوشگر مفهومی قرآن کریم با نقشه‌ها و پیوندهای معنایی میان آیات و سوره‌ها.','edu',['قرآن','اطلس','مفهومی'],'🕌',{feat:true}),
P('Ai','هوش مصنوعی NEXA (وب)','رابط اصلی گفتگو با هوش مصنوعی NEXA در فضای Ai؛ سبک و همیشه در دسترس.','ai',['چت','AI'],'💬',{}),
P('kokb1-static','kokb1 نسخه ۱','نخستین مدل هوش مصنوعی اصیل ایرانی NEXA؛ سبک، پیشرفته و طراحی‌شده برای فارسی.','ai',['مدل','kokb1'],'🤖',{}),
P('Kokbai_web','وب‌اپ NEXA','رابط وب سبک برای گفتگو با مدل‌های NEXA؛ ساده و سریع.','ai',['چت','وب'],'🌐',{}),
P('poni-chatbot','پونی — چت‌بات','چت‌بات دوستانه پونی با اجرای Gradio روی Hugging Face.','ai',['چت‌بات','Gradio'],'🐴',{url:nsUrl('poni-chatbot')}),
P('Mygimini','مای‌جیمینی','دستیار هوشمند چندمنظوره با استقرار Docker؛ الهام‌گرفته از بهترین‌ها.','ai',['دستیار','Docker'],'✨',{url:nsUrl('Mygimini')}),
P('SearchA','جستجوی هوشمند SearchA','جستجوی پاسخ‌محور با کمک هوش مصنوعی؛ به‌جای لینک، جواب بگیر.','ai',['جستجو','AI'],'🔎',{url:nsUrl('SearchA')}),
P('Kokb-bot','ربات NEXA','ربات گفتگوی NEXA روی Gradio؛ زیرساخت هوشمند سازمان.','ai',['ربات','Gradio'],'🛰️',{url:nsUrl('Kokb-bot')}),
P('Kokbtakbottel','بات NEXA','زیرساخت ربات رسمی سازمان با استقرار Docker روی Spaces.','ai',['ربات','Docker'],'📡',{url:nsUrl('Kokbtakbottel')}),
P('Aiaiakok','آی‌آی‌آی‌NEXA','آزمایشگاه تعاملی هوش مصنوعی NEXA؛ جایی برای تجربه‌های تازه.','ai',['AI','آزمایش'],'🧪',{}),
P('Pramt','پرامپت‌ساز','ساخت و مدیریت پرامپت‌های حرفه‌ای برای مدل‌های زبانی؛ هنرِ درست پرسیدن.','ai',['پرامپت','ابزار'],'📝',{}),
P('tiny-thief-remake','دزد کوچولو — بازسازی','نسخه بازسازی‌شده کلاسیک Tiny Thief با مراحل کامل و اجرای وب.','game',['بازی','کلاسیک'],'🎭',{}),
P('Pley1239','پلی ۱۲۳۹','مجموعه بازی‌های وب NEXA با اجرای فوری؛ سرگرمی بدون مرز.','game',['بازی','وب'],'🕹️',{}),
P('Mekorama_do','مکوراما','بازی فکری سه‌بعدی ربات کوچک در دنیای مکانیکی؛ معماهای دوست‌داشتنی.','game',['فکری','سه‌بعدی'],'🧩',{}),
P('Fruitcraft','فروت‌کرافت','بازی خلاقانه میوه‌ها با طعم ماینکرافت! بساز، بچین، لذت ببر.','game',['خلاقانه','Gradio'],'🍉',{url:nsUrl('Fruitcraft')}),
P('My_Tunnel','تونل من','بازی سرعتی در تونل‌های بی‌پایان؛ واکنش‌هایت را به چالش بکش.','game',['سرعتی','آرکید'],'🚇',{}),
P('Sekob','سکوب','بازی مهارتی سکه‌ها؛ ساده، روان و اعتیادآور.','game',['مهارتی','آرکید'],'🪙',{}),
P('The-Magic-of-Thinking-Big','جادوی تفکر بزرگ','خلاصه تعاملی کتاب «جادوی تفکر بزرگ»؛ درس‌های کاربردی برای فکرهای بزرگ.','edu',['کتاب','تفکر'],'📖',{}),
P('Mozik2','موزیک ۲','پخش و کاوش موسیقی با رابط ساده و سریع روی Gradio.','media',['موسیقی','پخش'],'🎵',{url:nsUrl('Mozik2')}),
P('AI_Voice_Removal','حذف صدای خواننده','جداسازی صدا و موسیقی از آهنگ با هوش مصنوعی؛ کارائوکه‌ساز شخصی تو.','media',['AI','صدا','کارائوکه'],'🎚️',{}),
P('Sottotext','زیرنویس‌ساز','ساخت و ویرایش زیرنویس ویدیو در مرورگر؛ سریع و بدون نرم‌افزار.','media',['زیرنویس','ویدیو'],'🎬',{}),
P('Aparat_downloadr','آپارات دانلودر','دریافت ویدیوهای آپارات با چند کلیک؛ ساده و مستقیم.','media',['آپارات','دانلود'],'📥',{}),
P('Khamenei_Iran_Song','سرود ایران','پخش‌کننده سرودهای میهنی با رابطی زیبا و روان.','media',['سرود','موسیقی'],'🎶',{}),
P('Rubika_post','پست‌ساز روبیکا','ساخت پست و محتوای گرافیکی برای روبیکا؛ قالب‌های آماده و سریع.','media',['روبیکا','گرافیک'],'🖼️',{}),
P('Sticker-eitaa','استیکرساز ایتا','هر تصویری (JPG، PNG، BMP و…) را به استیکر WebP بهینه برای ایتا تبدیل کن.','tool',['ایتا','استیکر','WebP'],'🏷️',{}),
P('kokbtak-convert','مبدل NEXA','تبدیل فرمت فایل‌ها به‌صورت محلی و امن؛ فایل‌هایت جایی نمی‌روند.','tool',['مبدل','فایل'],'🔄',{}),
P('TOTP','کدساز دومرحله‌ای','تولید کدهای TOTP دو مرحله‌ای؛ امن، آفلاین و همیشه همراه.','tool',['امنیت','2FA'],'🔐',{}),
P('News1.1','اخبار ۱.۱','خواننده اخبار با رابط سبک و سریع؛ خبرها بدون شلوغی.','tool',['اخبار','خواندن'],'📰',{}),
P('phoenixLinkOpener','ققنوس — بازکننده لینک','باز کردن امن و گروهی لینک‌ها با یک کلیک.','tool',['لینک','ابزار'],'🔗',{}),
P('Search12','جستجوگر ۱۲','موتور جستجوی سبک NEXA؛ نسخه وب کلاسیک.','tool',['جستجو'],'🔍',{}),
P('Api_internet','API اینترنت','مجموعه APIهای کاربردی وب برای توسعه‌دهندگان؛ چرخ‌ها را دوباره نساز.','tool',['API','توسعه'],'🧰',{url:nsUrl('Api_internet')}),
P('Tkfayl','فایل‌تک','ابزار مدیریت و پردازش فایل روی Gradio.','tool',['فایل','Gradio'],'📁',{url:nsUrl('Tkfayl')}),
P('Webapp','وب‌اپ نمونه','قالب وب‌اپلیکیشن مدرن NEXA؛ نقطه شروع پروژه‌های بعدی.','tool',['قالب','وب'],'📱',{}),
P('Nemone','نمونه — دمو سایت','نمونه سایت ساخته‌شده با DeepSite؛ اولین جرقه‌های کهکشان.','tool',['دمو','DeepSite'],'🧱',{}),
P('Roobot','روبوت — رابط ربات','رابط وب اتصال به ربات‌های NEXA؛ فرمان بده و نتیجه بگیر.','tool',['ربات','رابط'],'🤖',{}),
P('Gem_Protype','جم — نمونه اولیه','نمونه اولیه دستیار جم؛ ایده‌ای در راه ستاره‌شدن.','ai',['نمونه','Gradio'],'💎',{url:nsUrl('Gem_Protype')}),
P('Mymiton','مای‌میتون','ابزار وب آزمایشی NEXA؛ کوچک اما پرانرژی.','tool',['آزمایشی'],'🧩',{}),
P('alaje','آلاژه','پروژه وب ویژه NEXA؛ یکی دیگر از ستاره‌های این آسمان.','tool',['وب','ویژه'],'🪄',{})
];
function byKey(k){for(var i=0;i<PROJECTS.length;i++)if(PROJECTS[i].key===k)return PROJECTS[i];return null}
var favs=load('nexa_favs',[]);
function isFav(k){return favs.indexOf(k)>=0}
var pstate={q:'',cat:'all',sort:'featured'};
function buildChips(){
var box=$('proj-chips');if(!box)return;
var counts={all:PROJECTS.length,fav:favs.length};
for(var c in CATS)counts[c]=0;
PROJECTS.forEach(function(p){counts[p.c]++});
var html='<button class="fchip" data-cat="all">🌌 همه <small>'+faNum(counts.all)+'</small></button>';
for(var k in CATS)html+='<button class="fchip" data-cat="'+k+'">'+CATS[k].icon+' '+CATS[k].name+' <small>'+faNum(counts[k])+'</small></button>';
html+='<button class="fchip" data-cat="fav">⭐ علاقه‌مندی <small>'+faNum(counts.fav)+'</small></button>';
html+='<span id="proj-count"></span>';
box.innerHTML=html;
$$('#proj-chips .fchip').forEach(function(b){
b.addEventListener('click',function(){pstate.cat=b.getAttribute('data-cat');syncChips();renderProjects();AudioSys.blip('click');});
});
syncChips();
}
function syncChips(){$$('#proj-chips .fchip').forEach(function(b){b.classList.toggle('active',b.getAttribute('data-cat')===pstate.cat)})}
function filteredProjects(){
var q=norm(pstate.q);
var list=PROJECTS.filter(function(p){
if(pstate.cat==='fav'&&!isFav(p.key))return false;
if(pstate.cat!=='all'&&pstate.cat!=='fav'&&p.c!==pstate.cat)return false;
if(!q)return true;
return norm(p.t+' '+p.d+' '+p.tags.join(' ')+' '+p.slug).indexOf(q)>=0;
});
if(pstate.sort==='name')list.sort(function(a,b){return a.t.localeCompare(b.t,'fa')});
else if(pstate.sort==='cat')list.sort(function(a,b){return CATS[a.c].name.localeCompare(CATS[b.c].name,'fa')||a.t.localeCompare(b.t,'fa')});
else list.sort(function(a,b){return (b.feat?1:0)-(a.feat?1:0)});
return list;
}
function cardHTML(p,i){
var cat=CATS[p.c];
var badges='';
if(p.feat)badges+='<span class="pbadge">⭐ برگزیده</span>';
if(p.fresh)badges+='<span class="pbadge new">🆕 تازه</span>';
if(p.likes)badges+='<span class="pbadge like">❤ '+faNum(p.likes)+'</span>';
var catEl=p.hf?'<a class="pcard-cat" href="'+p.hf+'" target="_blank" rel="noopener" title="صفحه Hugging Face">'+cat.icon+' '+cat.name+' ↗</a>':'<span class="pcard-cat">'+cat.icon+' '+cat.name+'</span>';
var tags=p.tags.map(function(t){return '<span>'+esc(t)+'</span>'}).join('');
var delay=Math.min(i*35,420);
return '<article class="pcard" style="--pc:'+cat.color+';animation-delay:'+delay+'ms">'
+'<div class="pcard-top"><div class="pcard-icon">'+p.icon+'</div><div class="pcard-meta">'+catEl+'<div class="pcard-badges">'+badges+'</div></div></div>'
+'<h3 class="pcard-title">'+esc(p.t)+'</h3>'
+'<p class="pcard-desc">'+esc(p.d)+'</p>'
+'<div class="pcard-tags">'+tags+'</div>'
+'<div class="pcard-actions">'
+'<button class="pbtn-play" data-act="play" data-key="'+esc(p.key)+'">▶ اجرا</button>'
+'<button class="pbtn-ico'+(isFav(p.key)?' faved':'')+'" data-act="fav" data-key="'+esc(p.key)+'" title="علاقه‌مندی" aria-label="علاقه‌مندی">'+(isFav(p.key)?'❤️':'🤍')+'</button>'
+'<button class="pbtn-ico" data-act="copy" data-key="'+esc(p.key)+'" title="کپی نشانی" aria-label="کپی نشانی">⧉</button>'
+'<a class="pbtn-ico" href="'+p.url+'" target="_blank" rel="noopener" title="باز کردن در تب جدید" aria-label="تب جدید">↗</a>'
+'</div></article>';
}
function renderProjects(){
var grid=$('proj-grid');if(!grid)return;
var list=filteredProjects();
if(list.length===0){
grid.innerHTML='<div class="empty-state"><div class="big">🔭</div><b>ستاره‌ای با این مشخصات پیدا نشد!</b><p style="margin:8px 0 16px">فیلترها را تغییر دهید یا عبارت دیگری جستجو کنید.</p><button class="btn btn-cyan btn-sm" data-act="resetfilter">↺ نمایش همه پروژه‌ها</button></div>';
}else{
grid.innerHTML=list.map(cardHTML).join('');
}
var cnt=$('proj-count');if(cnt)cnt.textContent='نمایش '+faNum(list.length)+' از '+faNum(PROJECTS.length)+' پروژه';
var clr=$('proj-clear');if(clr)clr.style.display=pstate.q?'block':'none';
}
function initProjects(){
buildChips();renderProjects();
var q=$('proj-q');
q.addEventListener('input',debounce(function(){pstate.q=q.value;renderProjects()},120));
$('proj-clear').addEventListener('click',function(){q.value='';pstate.q='';renderProjects();q.focus();AudioSys.blip('click')});
$('proj-sort').addEventListener('change',function(){pstate.sort=this.value;renderProjects();AudioSys.blip('click')});
$('proj-grid').addEventListener('click',function(e){
var el=e.target.closest('[data-act]');if(!el)return;
var act=el.getAttribute('data-act'),key=el.getAttribute('data-key');
if(act==='play')openProject(key);
else if(act==='fav'){
var i=favs.indexOf(key);
if(i>=0){favs.splice(i,1);toast('از علاقه‌مندی‌ها حذف شد','info');}
else{favs.push(key);toast('به علاقه‌مندی‌ها اضافه شد ⭐','ok');AudioSys.blip('ok');}
store('nexa_favs',favs);buildChips();renderProjects();
}
else if(act==='copy'){var p=byKey(key);if(p)copyText(p.url);AudioSys.blip('click');}
else if(act==='resetfilter'){pstate.q='';pstate.cat='all';q.value='';syncChips();renderProjects();AudioSys.blip('click');}
});
try{
var qp=new URLSearchParams(location.search).get('q');
if(qp){q.value=qp;pstate.q=qp;renderProjects();setTimeout(function(){$('projects').scrollIntoView({behavior:RM?'auto':'smooth'})},700);}
}catch(e){}
}
var modalTimer=null;
function updateBodyLock(){
var locked=$('modal').classList.contains('open')||$('palette').classList.contains('open');
document.body.classList.toggle('locked',locked);
}
function openProject(key){
var p=byKey(key);if(!p){toast('پروژه پیدا نشد','bad');return}
var m=$('modal'),f=$('modal-frame'),ld=$('modal-loader');
$('modal-title').textContent=p.icon+' '+p.t;
$('modal-cat').textContent=CATS[p.c].icon+' '+CATS[p.c].name+' • '+p.url.replace('https://','');
$('modal-newtab').href=p.url;$('modal-hint-link').href=p.url;
var hfBtn=$('modal-hf');
if(p.hf){hfBtn.style.display='';hfBtn.href=p.hf;}else hfBtn.style.display='none';
ld.classList.remove('hide');
ld.querySelector('span').textContent='در حال احضار پروژه از کهکشان…';
f.src=p.url;
m.classList.add('open');updateBodyLock();
AudioSys.blip('open');
clearTimeout(modalTimer);
modalTimer=setTimeout(function(){if(!ld.classList.contains('hide'))ld.querySelector('span').textContent='کمی طول کشید… اگر صفحه خالی ماند، «تب جدید» را امتحان کنید.'},9000);
setTimeout(function(){$('modal-close').focus()},80);
}
function closeModal(){
var m=$('modal');if(!m.classList.contains('open'))return;
m.classList.remove('open');$('modal-frame').src='about:blank';
clearTimeout(modalTimer);updateBodyLock();AudioSys.blip('close');
}
function initModal(){
$('modal-close').addEventListener('click',closeModal);
$('modal').addEventListener('click',function(e){if(e.target===this)closeModal()});
$('modal-frame').addEventListener('load',function(){
if(this.src&&this.src!=='about:blank'){$('modal-loader').classList.add('hide');clearTimeout(modalTimer);}
});
$('modal-full').addEventListener('click',function(){
var box=document.querySelector('.modal-box');
try{
if(document.fullscreenElement)document.exitFullscreen();
else if(box.requestFullscreen)box.requestFullscreen();
else toast('تمام‌صفحه در این مرورگر پشتیبانی نمی‌شود','warn');
}catch(e){toast('تمام‌صفحه ممکن نشد','warn')}
AudioSys.blip('click');
});
$('modal-copy').addEventListener('click',function(){var u=$('modal-frame').src;if(u&&u!=='about:blank')copyText(u)});
$$('[data-open]').forEach(function(b){b.addEventListener('click',function(){openProject(b.getAttribute('data-open'))})});
var aiAll=$('ai-all');
if(aiAll)aiAll.addEventListener('click',function(){pstate.cat='ai';syncChips();renderProjects();$('projects').scrollIntoView({behavior:RM?'auto':'smooth'});AudioSys.blip('click');});
}
var PALETTES={cosmic:[265,290,320,45],cyan:[185,200,160,265],amber:[40,28,55,320],magenta:[325,345,300,45],rainbow:[0,50,110,180,240,300]};
var GDEF={count:900,speed:1,grav:.9,size:1.4,glow:1,trail:.55,link:70,hue:0,palette:'cosmic',mode:'spiral',links:true,core:true};
var G={stars:[],meteors:[],p:Object.assign({},GDEF),paused:false,visible:false,w:0,h:0,ctx:null,canvas:null,px:0,py:0,down:false,flash:0,fps:60,roT:0,mT:rand(2,5)};
if(RM){G.p.speed=.4;G.p.trail=.2;}
function gSeed(){
G.stars.length=0;G.meteors.length=0;
var R=Math.min(G.w,G.h)*.46,cx=G.w/2,cy=G.h/2;
for(var i=0;i<G.p.count;i++){
var r=Math.pow(Math.random(),.62)*R+8,a=rand(0,Math.PI*2);
G.stars.push({r:r,a:a,w:rand(.5,1.4),ph:rand(0,6.28),sz:rand(.5,1.6),hi:(Math.random()*6|0),tw:rand(1,3),
x:cx+Math.cos(a)*r,y:cy+Math.sin(a)*r*.62,ox:0,oy:0,vx:-rand(60,220),vy:rand(90,260)});
}
}
function gSupernova(x,y){
for(var i=0;i<G.stars.length;i++){
var s=G.stars[i],dx=s.x-x,dy=s.y-y,d=Math.sqrt(dx*dx+dy*dy)||1;
if(d<280){var f=(1-d/280)*rand(70,170);s.ox+=dx/d*f;s.oy+=dy/d*f;
if(G.p.mode!=='spiral'){s.vx+=dx/d*f*2;s.vy+=dy/d*f*2;}}
}
G.flash=1;AudioSys.blip('boom');AudioSys.blip('star');
}
function gTick(dt,t){
var ctx=G.ctx,p=G.p,w=G.w,h=G.h,cx=w/2,cy=h/2;
if(!ctx)return;
ctx.globalCompositeOperation='source-over';ctx.globalAlpha=1;
ctx.fillStyle='rgba(5,3,15,'+clamp(1-p.trail,.05,1)+')';ctx.fillRect(0,0,w,h);
var hues=PALETTES[p.palette]||PALETTES.cosmic;
var i,s,x,y;
for(i=0;i<G.stars.length;i++){
s=G.stars[i];
if(p.mode==='spiral'){
s.a+=dt*p.speed*s.w*(.25+p.grav*1.1)*(60/(s.r+40));
var wob=Math.sin(t*.7+s.ph)*4*p.grav;
s.x=cx+Math.cos(s.a)*(s.r+wob);
s.y=cy+Math.sin(s.a)*(s.r+wob)*.62;
if(G.down){s.ox+=(G.px-s.x)*2.2*dt;s.oy+=(G.py-s.y)*2.2*dt;}
var dec=Math.pow(.02,dt);s.ox*=dec;s.oy*=dec;
x=s.x+s.ox;y=s.y+s.oy;
}else if(p.mode==='nebula'){
s.x+=(Math.sin(s.y*.006+t*.25)+.4*Math.cos(s.ph+t*.13))*30*p.speed*dt;
s.y+=(Math.cos(s.x*.006-t*.22)+.4*Math.sin(s.ph))*26*p.speed*dt;
s.x+=(cx-s.x)*.02*p.grav*dt;s.y+=(cy-s.y)*.02*p.grav*dt;
if(G.down){s.x+=(G.px-s.x)*1.6*dt;s.y+=(G.py-s.y)*1.6*dt;}
if(s.x<-24)s.x=w+22;if(s.x>w+24)s.x=-22;if(s.y<-24)s.y=h+22;if(s.y>h+24)s.y=-22;
x=s.x;y=s.y;
}else{
s.x+=s.vx*dt*p.speed;s.y+=s.vy*dt*p.speed;
s.vy+=p.grav*22*dt;
if(G.down){s.vx+=(G.px-s.x)*.9*dt;s.vy+=(G.py-s.y)*.9*dt;}
if(s.y>h+26||s.x<-26){s.x=rand(0,w+160);s.y=-20;s.vx=-rand(60,220);s.vy=rand(90,260);}
x=s.x;y=s.y;
}
s.dx=x;s.dy=y;
}
if(p.links&&p.link>4){
var cell=Math.max(30,p.link),grid={},key,gx,gy,j,o,dx,dy,d2,link2=p.link*p.link,made=0;
for(i=0;i<G.stars.length;i++){s=G.stars[i];gx=(s.dx/cell)|0;gy=(s.dy/cell)|0;key=gx+'_'+gy;(grid[key]||(grid[key]=[])).push(i);}
ctx.lineWidth=1;
var perStar={};
for(i=0;i<G.stars.length&&made<520;i++){
s=G.stars[i];gx=(s.dx/cell)|0;gy=(s.dy/cell)|0;
for(var ox2=-1;ox2<=1&&made<520;ox2++)for(var oy2=-1;oy2<=1&&made<520;oy2++){
var bucket=grid[(gx+ox2)+'_'+(gy+oy2)];if(!bucket)continue;
for(j=0;j<bucket.length;j++){
var bi=bucket[j];if(bi<=i)continue;
if((perStar[i]||0)>=3||(perStar[bi]||0)>=3)continue;
o=G.stars[bi];dx=s.dx-o.dx;dy=s.dy-o.dy;d2=dx*dx+dy*dy;
if(d2<link2){
var al=(1-Math.sqrt(d2)/p.link)*.42;
ctx.strokeStyle='hsla('+((190+p.hue)%360)+',85%,66%,'+al.toFixed(3)+')';
ctx.beginPath();ctx.moveTo(s.dx,s.dy);ctx.lineTo(o.dx,o.dy);ctx.stroke();
perStar[i]=(perStar[i]||0)+1;perStar[bi]=(perStar[bi]||0)+1;made++;
if(made>=520)break;
}
}
}
}
}
ctx.globalCompositeOperation='lighter';
var glowSize=6+7*p.glow;
for(i=0;i<G.stars.length;i++){
s=G.stars[i];
var spr=starSprite(hues[s.hi%hues.length]+p.hue);
var sz=s.sz*p.size*glowSize;
ctx.globalAlpha=clamp(.5+.45*Math.sin(t*s.tw+s.ph),.15,1)*clamp(.5+p.glow*.5,.3,1);
ctx.drawImage(spr,s.dx-sz/2,s.dy-sz/2,sz,sz);
}
ctx.globalAlpha=1;
if(p.core&&p.mode!=='meteor'){
var cr=(70+16*Math.sin(t*1.3))*p.glow;
var cg=ctx.createRadialGradient(cx,cy,0,cx,cy,cr);
cg.addColorStop(0,'rgba(255,244,214,.85)');
cg.addColorStop(.25,'hsla('+((45+p.hue)%360)+',100%,62%,.5)');
cg.addColorStop(.6,'hsla('+((320+p.hue)%360)+',95%,60%,.2)');
cg.addColorStop(1,'rgba(139,92,246,0)');
ctx.fillStyle=cg;ctx.beginPath();ctx.arc(cx,cy,cr,0,6.284);ctx.fill();
}
G.mT-=dt;
if(G.mT<=0&&!RM){G.meteors.push({x:rand(w*.25,w),y:rand(0,h*.35),vx:-rand(320,540),vy:rand(130,230),life:.9});G.mT=rand(3,7);}
for(i=G.meteors.length-1;i>=0;i--){
var m=G.meteors[i];m.x+=m.vx*dt;m.y+=m.vy*dt;m.life-=dt;
if(m.life<=0){G.meteors.splice(i,1);continue;}
var mg=ctx.createLinearGradient(m.x,m.y,m.x-m.vx*.16,m.y-m.vy*.16);
mg.addColorStop(0,'rgba(255,255,255,'+(m.life*.9)+')');mg.addColorStop(1,'rgba(34,211,238,0)');
ctx.strokeStyle=mg;ctx.lineWidth=1.6;ctx.beginPath();ctx.moveTo(m.x,m.y);ctx.lineTo(m.x-m.vx*.16,m.y-m.vy*.16);ctx.stroke();
}
if(G.flash>.012){
ctx.fillStyle='rgba(255,240,200,'+(G.flash*.4).toFixed(3)+')';ctx.fillRect(0,0,w,h);
G.flash*=Math.pow(.001,dt);
}
ctx.globalCompositeOperation='source-over';
G.fps=G.fps*.92+(1/dt)*.08;G.roT-=dt;
if(G.roT<=0){G.roT=.45;var ro=$('galaxy-readout');if(ro)ro.textContent=faNum(Math.round(clamp(G.fps,1,240)))+' fps • '+faNum(p.count)+' ★';}
}
function gRegister(){
if(G.visible&&!G.paused&&!document.hidden)Engine.add('galaxy',gTick);
else Engine.remove('galaxy');
}
var RANGES={};
function paintRange(el){
var min=+el.min||0,max=+el.max||100,v=+el.value;
el.style.setProperty('--p',(((v-min)/(max-min))*100).toFixed(1)+'%');
}
function bindRange(id,valId,fmt,cb){
var el=$(id),val=$(valId);if(!el)return;
var f=function(){paintRange(el);if(val)val.textContent=fmt(+el.value);};
RANGES[id]={el:el,val:val,fmt:fmt};
el.addEventListener('input',function(){f();cb(+el.value);});
f();
}
function setRange(id,v){var b=RANGES[id];if(!b)return;b.el.value=v;paintRange(b.el);if(b.val)b.val.textContent=b.fmt(+v);}
function gModeConvert(mode){
var cx=G.w/2,cy=G.h/2;
for(var i=0;i<G.stars.length;i++){
var s=G.stars[i];
if(mode==='spiral'){
var dx=s.x-cx,dy=(s.y-cy)/.62;
s.r=Math.max(8,Math.sqrt(dx*dx+dy*dy));s.a=Math.atan2(dy,dx);s.ox=0;s.oy=0;
}else{
s.x=s.dx||s.x;s.y=s.dy||s.y;
if(mode==='meteor'){s.vx=-rand(60,220);s.vy=rand(90,260);}
}
}
}
function gSyncUI(){
setRange('g-count',G.p.count);setRange('g-speed',G.p.speed);setRange('g-grav',G.p.grav);
setRange('g-size',G.p.size);setRange('g-glow',G.p.glow);setRange('g-trail',G.p.trail);
setRange('g-link',G.p.link);setRange('g-hue',G.p.hue);
$('g-palette').value=G.p.palette;$('g-mode').value=G.p.mode;
$('g-links').checked=G.p.links;$('g-core').checked=G.p.core;
$('hud-mode').textContent={spiral:'🌀 مارپیچی',nebula:'🌫 سحابی',meteor:'☄️ شهابی'}[G.p.mode];
}
function gRandom(){
var keys=Object.keys(PALETTES),modes=['spiral','nebula','meteor'];
G.p.count=Math.round(rand(300,1600)/50)*50;
G.p.speed=+rand(.3,2.4).toFixed(2);G.p.grav=+rand(.3,1.8).toFixed(2);
G.p.size=+rand(.8,2.4).toFixed(1);G.p.glow=+rand(.5,1.8).toFixed(2);
G.p.trail=+rand(0,.9).toFixed(2);G.p.link=Math.round(rand(0,120)/5)*5;
G.p.hue=Math.round(rand(0,360)/5)*5;
G.p.palette=keys[Math.random()*keys.length|0];
var oldMode=G.p.mode;G.p.mode=modes[Math.random()*modes.length|0];
gSeed();if(G.p.mode!==oldMode)gModeConvert(G.p.mode);
gSyncUI();toast('کهکشان تصادفی شد 🎲','info');AudioSys.blip('ok');
}
function gReset(){
G.p=Object.assign({},GDEF);if(RM){G.p.speed=.4;G.p.trail=.2;}
gSeed();gSyncUI();toast('کهکشان به حالت اول برگشت ↺','info');AudioSys.blip('click');
}
function gPauseToggle(){
G.paused=!G.paused;
$('g-pause').textContent=G.paused?'▶ ادامه':'⏸ مکث';
gRegister();AudioSys.blip('click');
toast(G.paused?'کهکشان متوقف شد':'کهکشان دوباره می‌چرخد','info');
}
function initGalaxy(){
G.canvas=$('galaxy-canvas');var stage=$('stage');
if(window.innerWidth<720)G.p.count=450;
function size(){var f=fitCanvas(G.canvas,stage,1.75);G.w=f.w;G.h=f.h;G.ctx=f.ctx;G.ctx.fillStyle='#05030f';G.ctx.fillRect(0,0,G.w,G.h);gSeed();if(G.p.mode!=='spiral')gModeConvert(G.p.mode);}
size();onResize(stage,size);
bindRange('g-count','v-count',function(v){return faNum(v)},function(v){G.p.count=v;gSeed();if(G.p.mode!=='spiral')gModeConvert(G.p.mode);});
bindRange('g-speed','v-speed',function(v){return faNum(v)},function(v){G.p.speed=v});
bindRange('g-grav','v-grav',function(v){return faNum(v)},function(v){G.p.grav=v});
bindRange('g-size','v-size',function(v){return faNum(v)},function(v){G.p.size=v});
bindRange('g-glow','v-glow',function(v){return faNum(v)},function(v){G.p.glow=v});
bindRange('g-trail','v-trail',function(v){return faNum(Math.round(v*100))+'٪'},function(v){G.p.trail=v});
bindRange('g-link','v-link',function(v){return faNum(v)},function(v){G.p.link=v});
bindRange('g-hue','v-hue',function(v){return faNum(v)+'°'},function(v){G.p.hue=v});
$('g-palette').addEventListener('change',function(){G.p.palette=this.value;AudioSys.blip('click')});
$('g-mode').addEventListener('change',function(){G.p.mode=this.value;gModeConvert(this.value);$('hud-mode').textContent={spiral:'🌀 مارپیچی',nebula:'🌫 سحابی',meteor:'☄️ شهابی'}[this.value];AudioSys.blip('open');});
$('g-links').addEventListener('change',function(){G.p.links=this.checked;AudioSys.blip('click')});
$('g-core').addEventListener('change',function(){G.p.core=this.checked;AudioSys.blip('click')});
$('g-pause').addEventListener('click',gPauseToggle);
$('g-random').addEventListener('click',gRandom);
$('g-reset').addEventListener('click',gReset);
$('g-export').addEventListener('click',function(){download(G.canvas,'nexa-galaxy.png')});
gSyncUI();
function pos(e){var r=G.canvas.getBoundingClientRect();G.px=e.clientX-r.left;G.py=e.clientY-r.top;}
G.canvas.addEventListener('pointerdown',function(e){pos(e);G.down=true;try{this.setPointerCapture(e.pointerId)}catch(err){}});
G.canvas.addEventListener('pointermove',function(e){pos(e)});
G.canvas.addEventListener('pointerup',function(){G.down=false});
G.canvas.addEventListener('pointercancel',function(){G.down=false});
G.canvas.addEventListener('dblclick',function(e){pos(e);gSupernova(G.px,G.py);});
if(window.IntersectionObserver){
new IntersectionObserver(function(en){G.visible=en[0].isIntersecting;gRegister();},{threshold:.04}).observe(stage);
}else{G.visible=true;gRegister();}
var clicks=0,ct=null;
$('brand').addEventListener('click',function(){
clicks++;clearTimeout(ct);ct=setTimeout(function(){clicks=0},1600);
if(clicks>=5){clicks=0;gSupernova(G.w/2,G.h/2);toast('🌟 ابرنواختر نکسایی! کهکشان لرزید','ok');}
});
}
var LAB={active:'sort',visible:false,inited:{},objs:{}};
function labRegister(){
var o=LAB.objs[LAB.active];
if(LAB.visible&&o&&!document.hidden)Engine.add('lab',function(dt,t){o.tick(dt,t)});
else Engine.remove('lab');
}
function labActivate(name){
LAB.active=name;
$$('#lab-tabs .ltab').forEach(function(b){var on=b.getAttribute('data-lab')===name;b.classList.toggle('active',on);b.setAttribute('aria-selected',on?'true':'false');});
$$('.lab-panel').forEach(function(pn){pn.classList.toggle('active',pn.id==='panel-'+name)});
if(!LAB.inited[name]){LAB.inited[name]=true;safe(LABINIT[name]);}
var o=LAB.objs[name];if(o)o.resize();
labRegister();
}
var LABINIT={};
LABINIT.sort=function(){
var cv=$('c-sort'),st=$('st-sort'),W=0,H=0,ctx=null;
var S={arr:[],work:[],steps:[],ptr:0,cmp:0,swp:0,running:false,done:false,sweep:0,hiI:-1,hiJ:-1,hiT:-1,n:72,speed:30,algo:'quick'};
function record(algo,src){
var a=src.slice(),st=[];
function cmp(i,j){st.push([0,i,j])}
function swp(i,j){st.push([1,i,j]);var t=a[i];a[i]=a[j];a[j]=t;}
function set(i,v){st.push([2,i,v]);a[i]=v;}
var n=a.length,i,j;
if(algo==='bubble'){
for(i=0;i<n-1;i++){var done=true;for(j=0;j<n-1-i;j++){cmp(j,j+1);if(a[j]>a[j+1]){swp(j,j+1);done=false;}}if(done)break;}
}else if(algo==='selection'){
for(i=0;i<n-1;i++){var mn=i;for(j=i+1;j<n;j++){cmp(j,mn);if(a[j]<a[mn])mn=j;}if(mn!==i)swp(i,mn);}
}else if(algo==='insertion'){
for(i=1;i<n;i++){var key=a[i];j=i-1;while(j>=0){cmp(j,j+1);if(a[j]>key){set(j+1,a[j]);j--;}else break;}set(j+1,key);}
}else if(algo==='merge'){
(function ms(l,r){
if(l>=r)return;var m=(l+r)>>1;ms(l,m);ms(m+1,r);
var aux=a.slice(l,r+1),i2=0,j2=m-l+1,k=l;
while(i2<=m-l&&j2<=r-l){cmp(l+i2,l+j2);if(aux[i2]<=aux[j2])set(k++,aux[i2++]);else set(k++,aux[j2++]);}
while(i2<=m-l)set(k++,aux[i2++]);
while(j2<=r-l)set(k++,aux[j2++]);
})(0,n-1);
}else if(algo==='quick'){
(function qs(l,r){
if(l>=r)return;var pv=a[r],i2=l-1;
for(var j2=l;j2<r;j2++){cmp(j2,r);if(a[j2]<pv){i2++;if(i2!==j2)swp(i2,j2);}}
if(i2+1!==r)swp(i2+1,r);
qs(l,i2);qs(i2+2,r);
})(0,n-1);
}else{
for(var gap=n>>1;gap>0;gap>>=1){
for(i=gap;i<n;i++){var tmp=a[i];j=i;while(j>=gap){cmp(j-gap,j);if(a[j-gap]>tmp){set(j,a[j-gap]);j-=gap;}else break;}set(j,tmp);}
}
}
return st;
}
function gen(){
S.arr=[];for(var i=0;i<S.n;i++)S.arr.push(Math.round(rand(8,100)));
S.work=S.arr.slice();S.steps=record(S.algo,S.arr);S.ptr=0;S.cmp=0;S.swp=0;
S.running=false;S.done=false;S.sweep=0;S.hiI=-1;S.hiJ=-1;
$('s-run').textContent='▶ شروع';$('s-status').textContent='آماده';stats();
}
function stats(){$('s-cmp').textContent=faNum(S.cmp);$('s-swap').textContent=faNum(S.swp);}
function apply(st){
if(st[0]===0){S.cmp++;S.hiT=0;}
else if(st[0]===1){S.swp++;S.hiT=1;var t=S.work[st[1]];S.work[st[1]]=S.work[st[2]];S.work[st[2]]=t;}
else{S.swp++;S.hiT=1;S.work[st[1]]=st[2];}
S.hiI=st[1];S.hiJ=st[0]===2?st[1]:st[2];
}
function advance(k){
for(var i=0;i<k&&S.ptr<S.steps.length;i++){apply(S.steps[S.ptr]);S.ptr++;}
stats();
if(S.ptr>=S.steps.length&&!S.done){S.done=true;S.sweep=0;$('s-status').textContent='در حال تثبیت…';}
}
function draw(){
if(!ctx)return;
ctx.fillStyle='#070313';ctx.fillRect(0,0,W,H);
var n=S.work.length,bw=W/n;
for(var i=0;i<n;i++){
var v=S.work[i],bh=(v/100)*(H-26),x=i*bw,col;
if(S.done&&i<S.sweep)col='#34d399';
else if(i===S.hiI||i===S.hiJ)col=S.hiT===1?'#ff4d8d':'#ffb020';
else col='hsl('+(190+(v/100)*140)+',82%,60%)';
ctx.fillStyle=col;
ctx.fillRect(x+.5,H-bh,Math.max(1,bw-1.4),bh);
}
ctx.fillStyle='rgba(168,159,208,.75)';ctx.font='11px Tahoma';ctx.textAlign='left';
ctx.fillText(S.algo.toUpperCase()+' • n='+S.n,8,16);
}
var o={
resize:function(){var f=fitCanvas(cv,st,1.75);W=f.w;H=f.h;ctx=f.ctx;draw();},
tick:function(dt){
if(S.running){
if(!S.done)advance(Math.max(1,Math.round(S.speed*dt*60)));
else{
S.sweep+=dt*S.n*1.4;
if(S.sweep>=S.n){S.sweep=S.n;S.running=false;$('s-status').textContent='مرتب شد ✓';$('s-run').textContent='▶ شروع';AudioSys.blip('ok');}
}
}
draw();
}
};
LAB.objs.sort=o;
o.resize();gen();
bindRange('s-size','sv-size',function(v){return faNum(v)},function(v){S.n=v;gen();});
bindRange('s-speed','sv-speed',function(v){return faNum(v)},function(v){S.speed=v});
$('s-algo').addEventListener('change',function(){S.algo=this.value;gen();AudioSys.blip('click');});
$('s-run').addEventListener('click',function(){
if(S.done)gen();
S.running=!S.running;
this.textContent=S.running?'⏸ مکث':'▶ شروع';
$('s-status').textContent=S.running?'در حال مرتب‌سازی…':'مکث';
AudioSys.blip('click');
});
$('s-step').addEventListener('click',function(){
if(S.done)return;
S.running=false;$('s-run').textContent='▶ شروع';
advance(1);$('s-status').textContent='گام‌به‌گام';AudioSys.blip('click');
});
$('s-shuffle').addEventListener('click',function(){gen();AudioSys.blip('click');toast('آرایه تازه تولید شد 🎲','info');});
};
LABINIT.path=function(){
var cv=$('c-path'),st=$('st-path'),W=0,H=0,ctx=null;
var PF={cols:0,rows:0,cell:24,ox:0,oy:0,grid:null,start:0,end:0,order:[],parent:null,found:false,path:[],animV:0,animP:0,phase:'idle',speed:24,density:28,algo:'astar',ms:0,drag:null};
function idx(c,r){return r*PF.cols+c}
function clearOverlays(){PF.order=[];PF.path=[];PF.animV=0;PF.animP=0;PF.phase='idle';PF.found=false;$('p-visited').textContent='۰';$('p-len').textContent='—';$('p-time').textContent='—';$('p-status').textContent='آماده';$('p-run').textContent='▶ اجرا';}
function Heap(){this.a=[];}
Heap.prototype.push=function(node){var a=this.a;a.push(node);var i=a.length-1;while(i>0){var p=(i-1)>>1;if(a[p].f<=a[i].f)break;var t=a[p];a[p]=a[i];a[i]=t;i=p;}};
Heap.prototype.pop=function(){var a=this.a,top=a[0],last=a.pop();if(a.length){a[0]=last;var i=0;for(;;){var l=i*2+1,r=l+1,m=i;if(l<a.length&&a[l].f<a[m].f)m=l;if(r<a.length&&a[r].f<a[m].f)m=r;if(m===i)break;var t=a[m];a[m]=a[i];a[i]=t;i=m;}}return top;};
function compute(){
var t0=performance.now(),n=PF.cols*PF.rows;
var parent=new Int32Array(n);for(var i=0;i<n;i++)parent[i]=-1;
var order=[],closed=new Uint8Array(n);
var endC=PF.end%PF.cols,endR=(PF.end/PF.cols)|0;
function h(i2){return Math.abs(i2%PF.cols-endC)+Math.abs(((i2/PF.cols)|0)-endR)}
function nbs(i2,out){
var c=i2%PF.cols,r=(i2/PF.cols)|0;
if(c>0)out.push(i2-1);if(c<PF.cols-1)out.push(i2+1);
if(r>0)out.push(i2-PF.cols);if(r<PF.rows-1)out.push(i2+PF.cols);
}
var found=false;
if(PF.algo==='bfs'){
var q=[PF.start],head=0,seen=new Uint8Array(n);seen[PF.start]=1;
var nb=[];
while(head<q.length){
var cur=q[head++];order.push(cur);
if(cur===PF.end){found=true;break;}
nb.length=0;nbs(cur,nb);
for(var k=0;k<nb.length;k++){var v=nb[k];if(!seen[v]&&!PF.grid[v]){seen[v]=1;parent[v]=cur;q.push(v);}}
}
}else{
var g=new Float64Array(n);for(i=0;i<n;i++)g[i]=Infinity;
g[PF.start]=0;
var heap=new Heap();heap.push({f:PF.algo==='dijkstra'?0:h(PF.start),i:PF.start});
var nb2=[];
while(heap.a.length){
var node=heap.pop(),ci=node.i;
if(closed[ci])continue;closed[ci]=1;order.push(ci);
if(ci===PF.end){found=true;break;}
nb2.length=0;nbs(ci,nb2);
for(k=0;k<nb2.length;k++){
var w=nb2[k];
if(PF.grid[w]||closed[w])continue;
var ng=g[ci]+1;
if(ng<g[w]){g[w]=ng;parent[w]=ci;
var f=PF.algo==='astar'?ng+h(w):(PF.algo==='dijkstra'?ng:h(w));
heap.push({f:f,i:w});}
}
}
}
PF.parent=parent;PF.order=order;PF.found=found;
PF.path=[];
if(found){var c2=PF.end;while(c2>=0){PF.path.push(c2);c2=parent[c2];}PF.path.reverse();}
PF.ms=performance.now()-t0;
PF.animV=0;PF.animP=0;PF.phase='visiting';
$('p-time').textContent=faNum(+PF.ms.toFixed(1))+' ms';
$('p-status').textContent='در حال کاوش…';$('p-run').textContent='⏸ توقف';
}
function draw(){
if(!ctx||!PF.grid)return;
ctx.fillStyle='#070313';ctx.fillRect(0,0,W,H);
var c=PF.cell,i,r2,x,y;
var visN=Math.min(PF.animV|0,PF.order.length);
for(i=0;i<visN;i++){
var vi=PF.order[i];x=PF.ox+(vi%PF.cols)*c;y=PF.oy+((vi/PF.cols)|0)*c;
var rec=i/Math.max(1,visN);
ctx.fillStyle='rgba(34,211,238,'+(.1+rec*.3).toFixed(3)+')';
ctx.fillRect(x+1,y+1,c-2,c-2);
}
for(i=Math.max(0,visN-10);i<visN;i++){
var fi=PF.order[i];x=PF.ox+(fi%PF.cols)*c;y=PF.oy+((fi/PF.cols)|0)*c;
ctx.fillStyle='rgba(139,92,246,.55)';ctx.fillRect(x+1,y+1,c-2,c-2);
}
var pathN=Math.min(PF.animP|0,PF.path.length);
for(i=0;i<pathN;i++){
var pi=PF.path[i];x=PF.ox+(pi%PF.cols)*c;y=PF.oy+((pi/PF.cols)|0)*c;
ctx.fillStyle='rgba(255,176,32,.28)';ctx.fillRect(x,y,c,c);
ctx.fillStyle='#ffc247';ctx.fillRect(x+c*.22,y+c*.22,c*.56,c*.56);
}
for(i=0;i<PF.grid.length;i++){
if(PF.grid[i]){x=PF.ox+(i%PF.cols)*c;y=PF.oy+((i/PF.cols)|0)*c;
ctx.fillStyle='#2a1b5e';ctx.fillRect(x+1,y+1,c-2,c-2);
ctx.fillStyle='rgba(139,92,246,.35)';ctx.fillRect(x+1,y+1,c-2,2);}
}
ctx.strokeStyle='rgba(139,92,246,.09)';ctx.lineWidth=1;ctx.beginPath();
for(i=0;i<=PF.cols;i++){ctx.moveTo(PF.ox+i*c+.5,PF.oy);ctx.lineTo(PF.ox+i*c+.5,PF.oy+PF.rows*c);}
for(r2=0;r2<=PF.rows;r2++){ctx.moveTo(PF.ox,PF.oy+r2*c+.5);ctx.lineTo(PF.ox+PF.cols*c,PF.oy+r2*c+.5);}
ctx.stroke();
var sx=PF.ox+(PF.start%PF.cols)*c+c/2,sy=PF.oy+((PF.start/PF.cols)|0)*c+c/2;
ctx.fillStyle='#34d399';ctx.beginPath();ctx.arc(sx,sy,c*.32,0,6.284);ctx.fill();
ctx.fillStyle='rgba(52,211,153,.3)';ctx.beginPath();ctx.arc(sx,sy,c*.46,0,6.284);ctx.fill();
var ex=PF.ox+(PF.end%PF.cols)*c+c/2,ey=PF.oy+((PF.end/PF.cols)|0)*c+c/2;
ctx.save();ctx.translate(ex,ey);ctx.rotate(Math.PI/4);
ctx.fillStyle='#ff4d8d';ctx.fillRect(-c*.3,-c*.3,c*.6,c*.6);
ctx.restore();
}
var o={
resize:function(){
var f=fitCanvas(cv,st,1.75);W=f.w;H=f.h;ctx=f.ctx;
PF.cell=W<560?18:24;
PF.cols=Math.max(8,Math.floor(W/PF.cell));PF.rows=Math.max(6,Math.floor(H/PF.cell));
PF.ox=(W-PF.cols*PF.cell)/2;PF.oy=(H-PF.rows*PF.cell)/2;
PF.grid=new Uint8Array(PF.cols*PF.rows);
PF.start=idx(2,PF.rows>>1);PF.end=idx(PF.cols-3,PF.rows>>1);
clearOverlays();draw();
},
tick:function(dt){
if(PF.phase==='visiting'){
PF.animV+=Math.max(1,PF.speed*dt*60);
$('p-visited').textContent=faNum(Math.min(PF.animV|0,PF.order.length));
if(PF.animV>=PF.order.length){
if(PF.found){PF.phase='pathing';$('p-status').textContent='رسم مسیر…';}
else{PF.phase='done';$('p-status').textContent='مسیری نیست ⛔';$('p-run').textContent='▶ اجرا';toast('دیوارها راه را بسته‌اند! مسیر دیگری بچینید.','warn');AudioSys.blip('bad');}
}
}else if(PF.phase==='pathing'){
PF.animP+=Math.max(1,PF.speed*dt*30);
if(PF.animP>=PF.path.length){PF.animP=PF.path.length;PF.phase='done';
$('p-len').textContent=faNum(PF.path.length);$('p-status').textContent='مسیر یافت شد ✓';
$('p-run').textContent='▶ اجرا';AudioSys.blip('ok');}
}
draw();
}
};
LAB.objs.path=o;o.resize();
function cellAt(e){
var r=cv.getBoundingClientRect();
var c=Math.floor((e.clientX-r.left-PF.ox)/PF.cell),rr=Math.floor((e.clientY-r.top-PF.oy)/PF.cell);
if(c<0||rr<0||c>=PF.cols||rr>=PF.rows)return -1;
return idx(c,rr);
}
function applyDrag(i){
if(i<0)return;
if(PF.drag==='start'){if(i!==PF.end&&!PF.grid[i])PF.start=i;}
else if(PF.drag==='end'){if(i!==PF.start&&!PF.grid[i])PF.end=i;}
else if(PF.drag==='paint'){if(i!==PF.start&&i!==PF.end)PF.grid[i]=1;}
else if(PF.drag==='erase'){PF.grid[i]=0;}
}
cv.addEventListener('pointerdown',function(e){
var i=cellAt(e);if(i<0)return;
clearOverlays();
if(i===PF.start)PF.drag='start';
else if(i===PF.end)PF.drag='end';
else PF.drag=PF.grid[i]?'erase':'paint';
applyDrag(i);
try{this.setPointerCapture(e.pointerId)}catch(err){}
});
cv.addEventListener('pointermove',function(e){if(PF.drag)applyDrag(cellAt(e))});
cv.addEventListener('pointerup',function(){PF.drag=null});
cv.addEventListener('pointercancel',function(){PF.drag=null});
bindRange('p-speed','pv-speed',function(v){return faNum(v)},function(v){PF.speed=v});
bindRange('p-density','pv-density',function(v){return faNum(v)+'٪'},function(v){PF.density=v});
$('p-algo').addEventListener('change',function(){PF.algo=this.value;clearOverlays();AudioSys.blip('click');});
$('p-run').addEventListener('click',function(){
if(PF.phase==='visiting'||PF.phase==='pathing'){PF.phase='done';this.textContent='▶ اجرا';$('p-status').textContent='متوقف شد';}
else{clearOverlays();compute();}
AudioSys.blip('click');
});
$('p-maze').addEventListener('click',function(){
clearOverlays();
for(var i=0;i<PF.grid.length;i++)PF.grid[i]=(i!==PF.start&&i!==PF.end&&Math.random()<PF.density/100)?1:0;
AudioSys.blip('click');toast('دیوارهای تصادفی چیده شد 🧱','info');
});
$('p-clear').addEventListener('click',function(){if(PF.grid)PF.grid.fill(0);clearOverlays();AudioSys.blip('click');});
};
LABINIT.phys=function(){
var cv=$('c-phys'),st=$('st-phys'),W=0,H=0,ctx=null;
var PH={balls:[],rings:[],grav:900,bounce:.82,count:36,size:12,time:1,trails:true,paused:false,down:false,px:0,py:0,downT:0,moved:0,eT:0};
var HUES=[265,320,190,45];
function addBall(){
var br=rand(.6,1.4);
PH.balls.push({x:rand(30,W-30),y:rand(30,H*.5),vx:rand(-160,160),vy:rand(-80,80),br:br,hi:PH.balls.length%4});
}
function seed(){PH.balls=[];PH.rings=[];for(var i=0;i<PH.count;i++)addBall();}
function boom(x,y){
for(var i=0;i<PH.balls.length;i++){
var b=PH.balls[i],dx=b.x-x,dy=b.y-y,d=Math.sqrt(dx*dx+dy*dy)||1;
if(d<260){var f=(1-d/260)*rand(320,720);b.vx+=dx/d*f;b.vy+=dy/d*f;}
}
PH.rings.push({x:x,y:y,r:12,a:1});
AudioSys.blip('boom');
}
var o={
resize:function(){var f=fitCanvas(cv,st,1.75);W=f.w;H=f.h;ctx=f.ctx;
for(var i=0;i<PH.balls.length;i++){var b=PH.balls[i];b.x=clamp(b.x,20,W-20);b.y=clamp(b.y,20,H-20);}
ctx.fillStyle='#070313';ctx.fillRect(0,0,W,H);},
tick:function(dt,t){
if(!ctx)return;
var i,j,b;
if(!PH.paused){
var steps=2,sdt=dt*PH.time/steps;
for(var s=0;s<steps;s++){
for(i=0;i<PH.balls.length;i++){
b=PH.balls[i];var r=b.br*PH.size;
b.vy+=PH.grav*sdt;
if(PH.down){var dx=PH.px-b.x,dy=PH.py-b.y,d=Math.sqrt(dx*dx+dy*dy)||1;if(d>4){b.vx+=dx/d*900*sdt;b.vy+=dy/d*900*sdt;}}
b.vx=clamp(b.vx,-1600,1600);b.vy=clamp(b.vy,-1600,1600);
b.x+=b.vx*sdt;b.y+=b.vy*sdt;
if(b.x<r){b.x=r;b.vx=Math.abs(b.vx)*PH.bounce;}
if(b.x>W-r){b.x=W-r;b.vx=-Math.abs(b.vx)*PH.bounce;}
if(b.y<r){b.y=r;b.vy=Math.abs(b.vy)*PH.bounce;}
if(b.y>H-r){b.y=H-r;b.vy=-Math.abs(b.vy)*PH.bounce;if(Math.abs(b.vy)<14)b.vy=0;}
}
for(i=0;i<PH.balls.length;i++)for(j=i+1;j<PH.balls.length;j++){
var a=PH.balls[i];b=PH.balls[j];
var ra=a.br*PH.size,rb=b.br*PH.size;
var ddx=b.x-a.x,ddy=b.y-a.y,dd=Math.sqrt(ddx*ddx+ddy*ddy),min=ra+rb;
if(dd>0&&dd<min){
var nx=ddx/dd,ny=ddy/dd,ma=ra*ra,mb=rb*rb,tm=ma+mb;
var overlap=(min-dd);
a.x-=nx*overlap*(mb/tm);a.y-=ny*overlap*(mb/tm);
b.x+=nx*overlap*(ma/tm);b.y+=ny*overlap*(ma/tm);
var rvx=b.vx-a.vx,rvy=b.vy-a.vy,vn=rvx*nx+rvy*ny;
if(vn<0){
var imp=-(1+PH.bounce)*vn/(1/ma+1/mb);
a.vx-=imp*nx/ma;a.vy-=imp*ny/ma;
b.vx+=imp*nx/mb;b.vy+=imp*ny/mb;
}
}
}
}
}
ctx.globalCompositeOperation='source-over';ctx.globalAlpha=1;
ctx.fillStyle='rgba(7,3,19,'+(PH.trails ? .28 : 1)+')';ctx.fillRect(0,0,W,H);
ctx.globalCompositeOperation='lighter';
for(i=0;i<PH.balls.length;i++){
b=PH.balls[i];var rr=b.br*PH.size,hue=HUES[b.hi];
var spr=starSprite(hue),gs=rr*3.1;
ctx.globalAlpha=.8;ctx.drawImage(spr,b.x-gs/2,b.y-gs/2,gs,gs);
ctx.globalAlpha=1;ctx.fillStyle='hsla('+hue+',90%,72%,.95)';
ctx.beginPath();ctx.arc(b.x,b.y,rr*.8,0,6.284);ctx.fill();
}
for(i=PH.rings.length-1;i>=0;i--){
var ring=PH.rings[i];ring.r+=620*dt;ring.a-=2.2*dt;
if(ring.a<=0){PH.rings.splice(i,1);continue;}
ctx.strokeStyle='rgba(255,194,71,'+ring.a.toFixed(3)+')';ctx.lineWidth=2.4;
ctx.beginPath();ctx.arc(ring.x,ring.y,ring.r,0,6.284);ctx.stroke();
}
ctx.globalCompositeOperation='source-over';
PH.eT-=dt;
if(PH.eT<=0){PH.eT=.3;var E=0;
for(i=0;i<PH.balls.length;i++){b=PH.balls[i];var m2=Math.pow(b.br*PH.size,2);E+=.5*m2*(b.vx*b.vx+b.vy*b.vy);}
$('ph-energy').textContent=faNum(Math.round(E/1e6));$('ph-balls').textContent=faNum(PH.balls.length);}
}
};
LAB.objs.phys=o;o.resize();seed();
bindRange('ph-grav','phv-grav',function(v){return faNum(v)},function(v){PH.grav=v});
bindRange('ph-bounce','phv-bounce',function(v){return faNum(Math.round(v*100))+'٪'},function(v){PH.bounce=v});
bindRange('ph-count','phv-count',function(v){return faNum(v)},function(v){PH.count=v;while(PH.balls.length<v)addBall();while(PH.balls.length>v)PH.balls.pop();});
bindRange('ph-size','phv-size',function(v){return faNum(v)},function(v){PH.size=v});
bindRange('ph-time','phv-time',function(v){return faNum(v)},function(v){PH.time=v});
$('ph-trails').addEventListener('change',function(){PH.trails=this.checked;AudioSys.blip('click')});
$('ph-boom').addEventListener('click',function(){boom(W/2,H/2)});
$('ph-pause').addEventListener('click',function(){PH.paused=!PH.paused;this.textContent=PH.paused?'▶ ادامه':'⏸ مکث';AudioSys.blip('click');});
$('ph-reset').addEventListener('click',function(){seed();AudioSys.blip('click');toast('جعبه فیزیک نو شد ↺','info');});
function pos(e){var r=cv.getBoundingClientRect();PH.px=e.clientX-r.left;PH.py=e.clientY-r.top;}
cv.addEventListener('pointerdown',function(e){pos(e);PH.down=true;PH.downT=performance.now();PH.moved=0;try{this.setPointerCapture(e.pointerId)}catch(err){}});
cv.addEventListener('pointermove',function(e){if(PH.down){PH.moved+=Math.abs(e.movementX||0)+Math.abs(e.movementY||0);pos(e);}});
cv.addEventListener('pointerup',function(e){
pos(e);PH.down=false;
if(performance.now()-PH.downT<220&&PH.moved<10)boom(PH.px,PH.py);
});
cv.addEventListener('pointercancel',function(){PH.down=false});
};
LABINIT.frac=function(){
var cv=$('c-frac'),st=$('st-frac'),W=0,H=0,ctx=null;
var buf=document.createElement('canvas'),bctx=buf.getContext('2d');
var F={cx:-.6,cy:0,span:3.2,iter:180,pal:'neon',token:0,row:0,rw:0,rh:0,img:null,rendering:false,quality:1,lut:[],pend:null,drag:null};
var PALS={
neon:[[0,5,3,15],[.16,59,7,100],[.42,139,92,246],[.64,255,77,141],[.82,34,211,238],[1,255,255,255]],
fire:[[0,2,0,4],[.25,80,10,8],[.5,255,77,0],[.75,255,194,71],[1,255,255,240]],
ocean:[[0,2,6,23],[.3,14,116,180],[.6,34,211,238],[.85,165,243,252],[1,255,255,255]],
gold:[[0,10,6,18],[.3,124,45,18],[.6,255,176,32],[.85,255,233,176],[1,255,255,255]]
};
function buildLut(){
var stops=PALS[F.pal],lut=[];
for(var i=0;i<512;i++){
var t=i/511,k=0;
while(k<stops.length-2&&t>stops[k+1][0])k++;
var a=stops[k],b=stops[k+1],u=(t-a[0])/Math.max(1e-6,b[0]-a[0]);u=clamp(u,0,1);
lut.push([Math.round(a[1]+(b[1]-a[1])*u),Math.round(a[2]+(b[2]-a[2])*u),Math.round(a[3]+(b[3]-a[3])*u)]);
}
F.lut=lut;
}
function status(){
$('f-zoom').textContent='×'+faNum(+(3.2/F.span).toPrecision(4));
$('f-center').textContent=F.cx.toFixed(4)+(F.cy>=0?' + ':' − ')+Math.abs(F.cy).toFixed(4)+'i';
}
function render(q){
F.token++;F.quality=q;
F.rw=Math.max(80,Math.round(W*q));F.rh=Math.max(60,Math.round(H*q));
buf.width=F.rw;buf.height=F.rh;
F.img=bctx.createImageData(F.rw,F.rh);
F.row=0;F.rendering=true;
$('f-status').textContent=q<1?'پیش‌نمایش…':'رندر کامل…';
}
function chunk(){
var budget=8e6,rows=Math.max(2,Math.floor(budget/(F.rw*F.iter)));
if(F.quality<1)rows=F.rh;
var end=Math.min(F.rh,F.row+rows),d=F.img.data,scale=F.span/F.rw,it=F.quality<1?Math.min(F.iter,240):F.iter,lut=F.lut;
for(var y=F.row;y<end;y++){
var cim=F.cy+(y-F.rh/2)*scale;
for(var x=0;x<F.rw;x++){
var cre=F.cx+(x-F.rw/2)*scale;
var zr=0,zi=0,zr2=0,zi2=0,i=0;
while(i<it&&zr2+zi2<=4){zi=2*zr*zi+cim;zr=zr2-zi2+cre;zr2=zr*zr;zi2=zi*zi;i++;}
var o=(y*F.rw+x)*4;
if(i>=it){d[o]=5;d[o+1]=3;d[o+2]=15;}
else{
var nu=i+1-Math.log(Math.log(Math.sqrt(zr2+zi2)))/Math.LN2;
var v=Math.sqrt(clamp(nu/it,0,1));
var c=lut[Math.min(511,(v*511)|0)];
d[o]=c[0];d[o+1]=c[1];d[o+2]=c[2];
}
d[o+3]=255;
}
}
F.row=end;
bctx.putImageData(F.img,0,0);
ctx.imageSmoothingEnabled=true;
ctx.drawImage(buf,0,0,W,H);
$('f-prog').firstElementChild.style.width=(F.row/F.rh*100).toFixed(1)+'%';
if(F.row>=F.rh){
F.rendering=false;
$('f-prog').firstElementChild.style.width='0%';
$('f-status').textContent='آماده ✓';
if(F.quality<1){clearTimeout(F.pend);F.pend=setTimeout(function(){render(1)},240);}
}
}
function zoomAt(fx,fy,factor){
var scale=F.span/W;
var mx=F.cx+(fx-W/2)*scale,my=F.cy+(fy-H/2)*scale;
F.span=clamp(F.span/factor,1e-12,6);
var ns=F.span/W;
F.cx=mx-(fx-W/2)*ns;F.cy=my-(fy-H/2)*ns;
status();render(.3);
}
var o={
resize:function(){var f=fitCanvas(cv,st,1.5);W=f.w;H=f.h;ctx=f.ctx;status();render(1);},
tick:function(){if(F.rendering)chunk();}
};
LAB.objs.frac=o;buildLut();o.resize();
bindRange('f-iter','fv-iter',function(v){return faNum(v)},debounce(function(v){F.iter=v;render(F.rendering ? .34 : 1)},140));
$('f-pal').addEventListener('change',function(){F.pal=this.value;buildLut();render(1);AudioSys.blip('click');});
$('f-zin').addEventListener('click',function(){zoomAt(W/2,H/2,1.7);AudioSys.blip('click');});
$('f-zout').addEventListener('click',function(){zoomAt(W/2,H/2,1/1.7);AudioSys.blip('click');});
$('f-reset').addEventListener('click',function(){F.cx=-.6;F.cy=0;F.span=3.2;status();render(1);AudioSys.blip('click');toast('نمای فراکتال بازنشانی شد','info');});
$('f-export').addEventListener('click',function(){download(cv,'nexa-mandelbrot.png')});
cv.addEventListener('wheel',function(e){
e.preventDefault();
var r=cv.getBoundingClientRect();
zoomAt(e.clientX-r.left,e.clientY-r.top,e.deltaY<0?1.22:1/1.22);
},{passive:false});
cv.addEventListener('pointerdown',function(e){
F.drag={x:e.clientX,y:e.clientY,cx:F.cx,cy:F.cy};
try{this.setPointerCapture(e.pointerId)}catch(err){}
});
cv.addEventListener('pointermove',function(e){
if(!F.drag)return;
var scale=F.span/W;
F.cx=F.drag.cx-(e.clientX-F.drag.x)*scale;
F.cy=F.drag.cy-(e.clientY-F.drag.y)*scale;
status();render(.3);
});
cv.addEventListener('pointerup',function(){F.drag=null});
cv.addEventListener('pointercancel',function(){F.drag=null});
cv.addEventListener('dblclick',function(e){var r=cv.getBoundingClientRect();zoomAt(e.clientX-r.left,e.clientY-r.top,2.2);});
};
LABINIT.life=function(){
var cv=$('c-life'),st=$('st-life'),W=0,H=0,ctx=null;
var L={cols:0,rows:0,cell:10,grid:null,age:null,gen:0,pop:0,running:false,speed:8,density:28,acc:0,drag:null};
var PAT={
glider:['.O.','..O','OOO'],
rpent:['.OO','OO.','.O.'],
lwss:['O..O.','....O','O...O','.OOOO'],
pulsar:['..OOO...OOO..','.............','O....O.O....O','O....O.O....O','O....O.O....O','..OOO...OOO..','.............','..OOO...OOO..','O....O.O....O','O....O.O....O','O....O.O....O','.............','..OOO...OOO..']
};
function recount(){var p=0;for(var i=0;i<L.grid.length;i++)if(L.grid[i])p++;L.pop=p;$('l-pop').textContent=faNum(p);}
function step(){
var next=new Uint8Array(L.grid.length),cols=L.cols,rows=L.rows;
for(var r=0;r<rows;r++)for(var c=0;c<cols;c++){
var n=0;
for(var dr=-1;dr<=1;dr++)for(var dc=-1;dc<=1;dc++){
if(!dr&&!dc)continue;
n+=L.grid[((r+dr+rows)%rows)*cols+((c+dc+cols)%cols)];
}
var i=r*cols+c,alive=L.grid[i];
next[i]=(alive&&(n===2||n===3))||(!alive&&n===3)?1:0;
L.age[i]=next[i]?Math.min(60,L.age[i]+1):0;
}
L.grid=next;L.gen++;
$('l-gen').textContent=faNum(L.gen);recount();
}
function draw(){
if(!ctx||!L.grid)return;
ctx.fillStyle='#070313';ctx.fillRect(0,0,W,H);
var c=L.cell;
for(var r=0;r<L.rows;r++)for(var cc=0;cc<L.cols;cc++){
var i=r*L.cols+cc;
if(L.grid[i]){
var hue=190+(Math.min(60,L.age[i])/60)*95;
ctx.fillStyle='hsl('+hue+',85%,62%)';
ctx.fillRect(cc*c+1,r*c+1,c-2,c-2);
}
}
}
function stamp(name){
var pat=PAT[name];if(!pat)return;
var ph=pat.length,pw=pat[0].length;
var r0=(L.rows>>1)-(ph>>1),c0=(L.cols>>1)-(pw>>1);
for(var r=0;r<ph;r++)for(var c=0;c<pw;c++){
if(pat[r][c]==='O'){var i=(r0+r)*L.cols+(c0+c);L.grid[i]=1;L.age[i]=1;}
}
recount();draw();toast('الگو در مرکز درج شد ✨','ok');AudioSys.blip('ok');
}
var o={
resize:function(){
var f=fitCanvas(cv,st,1.75);W=f.w;H=f.h;ctx=f.ctx;
L.cols=Math.max(10,Math.floor(W/L.cell));L.rows=Math.max(8,Math.floor(H/L.cell));
L.grid=new Uint8Array(L.cols*L.rows);L.age=new Uint16Array(L.cols*L.rows);
L.gen=0;$('l-gen').textContent='۰';recount();draw();
},
tick:function(dt){
if(L.running){
L.acc+=dt;var iv=1/L.speed,guard=0;
while(L.acc>=iv&&guard<4){step();L.acc-=iv;guard++;}
if(guard>=4)L.acc=0;
}
draw();
}
};
LAB.objs.life=o;o.resize();
bindRange('l-speed','lv-speed',function(v){return faNum(v)},function(v){L.speed=v});
bindRange('l-density','lv-density',function(v){return faNum(v)+'٪'},function(v){L.density=v});
$('l-pattern').addEventListener('change',function(){if(this.value){stamp(this.value);this.value='';}});
$('l-run').addEventListener('click',function(){
L.running=!L.running;this.textContent=L.running?'⏸ مکث':'▶ شروع';
$('l-status').textContent=L.running?'در حال تکامل':'مکث';AudioSys.blip('click');
});
$('l-step').addEventListener('click',function(){
L.running=false;$('l-run').textContent='▶ شروع';
step();$('l-status').textContent='گام‌به‌گام';AudioSys.blip('click');
});
$('l-random').addEventListener('click',function(){
for(var i=0;i<L.grid.length;i++){L.grid[i]=Math.random()<L.density/100?1:0;L.age[i]=L.grid[i];}
L.gen=0;$('l-gen').textContent='۰';recount();AudioSys.blip('click');toast('حیات تصادفی پاشیده شد 🎲','info');
});
$('l-clear').addEventListener('click',function(){
L.grid.fill(0);L.age.fill(0);L.gen=0;L.running=false;
$('l-run').textContent='▶ شروع';$('l-gen').textContent='۰';$('l-status').textContent='آماده';
recount();AudioSys.blip('click');
});
function cellAt(e){
var r=cv.getBoundingClientRect();
var c=Math.floor((e.clientX-r.left)/L.cell),rr=Math.floor((e.clientY-r.top)/L.cell);
if(c<0||rr<0||c>=L.cols||rr>=L.rows)return -1;
return rr*L.cols+c;
}
cv.addEventListener('pointerdown',function(e){
var i=cellAt(e);if(i<0)return;
L.drag=L.grid[i]?'erase':'paint';
L.grid[i]=L.drag==='paint'?1:0;L.age[i]=L.grid[i];recount();
try{this.setPointerCapture(e.pointerId)}catch(err){}
});
cv.addEventListener('pointermove',function(e){
if(!L.drag)return;
var i=cellAt(e);if(i<0)return;
L.grid[i]=L.drag==='paint'?1:0;L.age[i]=L.grid[i];recount();
});
cv.addEventListener('pointerup',function(){L.drag=null});
cv.addEventListener('pointercancel',function(){L.drag=null});
};
function initLabs(){
window.addEventListener('resize',debounce(function(){var o=LAB.objs[LAB.active];if(o&&LAB.visible)o.resize();},180));
$$('#lab-tabs .ltab').forEach(function(b){
b.addEventListener('click',function(){labActivate(b.getAttribute('data-lab'));AudioSys.blip('click');});
});
if(window.IntersectionObserver){
new IntersectionObserver(function(en){
LAB.visible=en[0].isIntersecting;
if(LAB.visible&&!LAB.inited[LAB.active]){LAB.inited[LAB.active]=true;safe(LABINIT[LAB.active]);}
labRegister();
},{threshold:.05}).observe($('lab'));
}else{LAB.visible=true;LAB.inited.sort=true;safe(LABINIT.sort);labRegister();}
}
function gotoSection(id){var el=$(id);if(el){el.scrollIntoView({behavior:RM?'auto':'smooth'});AudioSys.blip('click');}}
function labGo(name){gotoSection('lab');labActivate(name);}
function setCatGo(cat){pstate.cat=cat;syncChips();renderProjects();gotoSection('projects');}
function projChip(p){return {label:'▶ '+p.t,fn:function(){openProject(p.key)}}}
function chatAdd(role,html,chips){
var body=$('chat-body');
var m=document.createElement('div');m.className='msg '+role;
var b=document.createElement('div');b.className='msg-bubble';b.innerHTML=html;
m.appendChild(b);
if(chips&&chips.length){
var cw=document.createElement('div');cw.className='msg-chips';
chips.forEach(function(c){
var btn=document.createElement('button');btn.type='button';btn.textContent=c.label;
btn.addEventListener('click',function(){AudioSys.blip('click');c.fn();});
cw.appendChild(btn);
});
m.appendChild(cw);
}
body.appendChild(m);body.scrollTop=body.scrollHeight;
return m;
}
function enDigits(s){
return String(s).replace(/[۰-۹]/g,function(d){return String('۰۱۲۳۴۵۶۷۸۹'.indexOf(d))})
.replace(/[٠-٩]/g,function(d){return String('٠١٢٣٤٥٦٧٨٩'.indexOf(d))});
}
function calcExpr(raw){
var s=enDigits(raw).replace(/×/g,'*').replace(/÷/g,'/').replace(/٪/g,'%');
s=s.replace(/[^0-9+\-*/^().%\s]/g,' ').trim();
if(!/\d/.test(s))return null;
if(!/[+\-*/^%]/.test(s)&&!/^[\d.\s]+$/.test(s))return null;
var toks=s.match(/(\d+(?:\.\d+)?|[+\-*/^()%])/g);
if(!toks||toks.length>60)return null;
var out=[],ops=[],prec={'+':1,'-':1,'*':2,'/':2,'^':3},prev=null;
for(var i=0;i<toks.length;i++){
var tk=toks[i];
if(/^\d/.test(tk)){out.push(+tk);}
else if(tk==='%'){out.push('%');}
else if(tk==='('){ops.push(tk);}
else if(tk===')'){
while(ops.length&&ops[ops.length-1]!=='(')out.push(ops.pop());
if(!ops.length)return null;ops.pop();
}else{
if(tk==='-'&&(prev===null||prev==='('||prec[prev]!==undefined))out.push(0);
while(ops.length){
var top=ops[ops.length-1];
if(top==='(')break;
if(prec[top]>prec[tk]||(prec[top]===prec[tk]&&tk!=='^'))out.push(ops.pop());else break;
}
ops.push(tk);
}
prev=tk;
}
while(ops.length){var o2=ops.pop();if(o2==='(')return null;out.push(o2);}
var st=[];
for(i=0;i<out.length;i++){
var t=out[i];
if(typeof t==='number'){st.push(t);continue;}
if(t==='%'){if(!st.length)return null;st.push(st.pop()/100);continue;}
if(st.length<2)return null;
var b2=st.pop(),a2=st.pop(),r2;
if(t==='+')r2=a2+b2;else if(t==='-')r2=a2-b2;else if(t==='*')r2=a2*b2;
else if(t==='/'){if(b2===0)return 'DIV0';r2=a2/b2;}
else if(t==='^')r2=Math.pow(a2,b2);else return null;
st.push(r2);
}
if(st.length!==1||!isFinite(st[0]))return null;
return Math.round(st[0]*1e6)/1e6;
}
function respond(text){
var q=norm(text),i;
var R=function(html,chips){return {html:html,chips:chips||[]}};
if(q.indexOf('صدا')>=0||q.indexOf('سکوت')>=0||q.indexOf('میوت')>=0){
var want=q.indexOf('خاموش')>=0||q.indexOf('قطع')>=0||q.indexOf('سکوت')>=0?false:(q.indexOf('روشن')>=0||q.indexOf('پخش')>=0?true:!AudioSys.on);
AudioSys.setOn(want);
return R(want?'صدا روشن شد 🔊 صدای کهکشان را بشنو!':'صدا خاموش شد 🔇 سکوت کامل.',[{label:'🎛 کنسول کهکشان',fn:function(){gotoSection('home')}}]);
}
var colorMap=[['سرخابی','magenta','سرخابی'],['قرمز','magenta','سرخابی'],['صورتی','magenta','سرخابی'],['فیروزه','cyan','فیروزه‌ای'],['آبی','cyan','فیروزه‌ای'],['کهربا','amber','کهربایی'],['طلایی','amber','کهربایی'],['زرد','amber','کهربایی'],['بنفش','cosmic','کیهانی بنفش'],['کیهانی','cosmic','کیهانی'],['رنگین','rainbow','رنگین‌کمان']];
if(q.indexOf('رنگ')>=0||q.indexOf('پالت')>=0){
for(i=0;i<colorMap.length;i++){
if(q.indexOf(colorMap[i][0])>=0){
G.p.palette=colorMap[i][1];G.p.hue=0;setRange('g-hue',0);$('g-palette').value=colorMap[i][1];
return R('انجام شد! پالت کهکشان به <b>'+colorMap[i][2]+'</b> تغییر کرد 🎨✨',[{label:'🌌 تماشای کهکشان',fn:function(){gotoSection('home')}},{label:'🎲 تصادفی‌سازی',fn:gRandom}]);
}
}
}
if(q.indexOf('کهکشان')>=0||q.indexOf('ستاره')>=0){
if(q.indexOf('سریع')>=0){G.p.speed=clamp(G.p.speed+.5,0,3);setRange('g-speed',G.p.speed);return R('چرخش کهکشان سریع‌تر شد 🚀 (سرعت: '+faNum(G.p.speed)+')');}
if(q.indexOf('کند')>=0||q.indexOf('آروم')>=0||q.indexOf('اهسته')>=0){G.p.speed=clamp(G.p.speed-.5,0,3);setRange('g-speed',G.p.speed);return R('کهکشان آرام‌تر شد 🐢 (سرعت: '+faNum(G.p.speed)+')');}
if(q.indexOf('بیشتر')>=0||q.indexOf('زیاد')>=0){G.p.count=clamp(G.p.count+200,200,2000);setRange('g-count',G.p.count);gSeed();return R(faNum(G.p.count)+' ستاره حالا می‌درخشند ✨');}
if(q.indexOf('کمتر')>=0){G.p.count=clamp(G.p.count-200,200,2000);setRange('g-count',G.p.count);gSeed();return R('ستاره‌ها به '+faNum(G.p.count)+' کاهش یافتند 🌙');}
if(q.indexOf('مکث')>=0||q.indexOf('توقف')>=0||q.indexOf('ادامه')>=0){gPauseToggle();return R(G.paused?'کهکشان متوقف شد ⏸':'کهکشان دوباره می‌چرخد ▶');}
if(q.indexOf('خروجی')>=0||q.indexOf('عکس')>=0||q.indexOf('ذخیره')>=0){download(G.canvas,'nexa-galaxy.png');return R('دارم تصویر کهکشان را به PNG ذخیره می‌کنم ⬇');}
if(q.indexOf('تصادفی')>=0||q.indexOf('راندم')>=0){gRandom();return R('کهکشان تصادفی شد 🎲 هر بار یک آسمان تازه!');}
if(q.indexOf('ابرنواختر')>=0||q.indexOf('انفجار')>=0){gSupernova(G.w/2,G.h/2);return R('💥 ابرنواختر! کهکشان لرزید — دوباره بگو تا بازهم منفجر شود!');}
}
if(/حساب|محاسبه|چند\s*(میشه|می شود|می‌شود)|جمع|ضرب|تقسیم|توان/.test(q)||/^[\d۰-۹٠-٩+\-*/^().%\s×÷٪=]+$/.test(text.trim())){
var res=calcExpr(text);
if(res==='DIV0')return R('تقسیم بر صفر؟! 😄 حتی سیاه‌چاله هم از این کار سر درنمی‌آورد!');
if(res!==null)return R('🧮 نتیجه: <b>'+faNum(res)+'</b>
ماشین‌حساب نکسا‌یار در خدمت است — عبارت‌های پیچیده‌تر با پرانتز و توان (^) هم بفرست!');
}
if(/ساعت|تاریخ|امروز|چندم|چه روزی|الان چند/.test(q)){
var now=new Date();
var d=new Intl.DateTimeFormat('fa-IR',{weekday:'long',year:'numeric',month:'long',day:'numeric'}).format(now);
var tm=new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit'}).format(now);
return R('📅 امروز <b>'+d+'</b> (هجری شمسی) است.
🕐 ساعت: <b>'+tm+'</b>
روز خوبی برای ساختن یک ستاره تازه است! ✨');
}
if(/^(سلام|درود|هی|هلو|hello|hi|salam)/.test(q))return R('سلام دوست نکسایی! 🌟 خوش آمدی به کهکشان. من می‌توانم پروژه پیدا کنم، کهکشان را کنترل کنم، محاسبه کنم و درباره سازمان بگویم. چه کار کنیم؟',[{label:'🎮 بازی‌ها',fn:function(){chatSay('بازی‌ها را نشان بده')}},{label:'✨ درباره NEXA',fn:function(){chatSay('درباره NEXA بگو')}},{label:'🧮 یک محاسبه',fn:function(){chatSay('۱۲۳×۴۵۶ را حساب کن')}}]);
if(/ممنون|مرسی|سپاس|دمت گرم/.test(q))return R('خواهش می‌کنم! 💫 وظیفه یک دستیار ستاره‌ای همین است. باز هم امری باشد در خدمتم.');
if(/خداحافظ|بای|فعلا|فعلاً/.test(q))return R('خدانگهدار! 🌠 هر وقت برگشتی، کهکشان همین‌جا می‌چرخد.');
if(/درباره|سازمان|کی هستی|چی هستی|NEXA چیست|نکسا چیست|معرفی/.test(q)){
return R('<b>NEXA</b> یک سازمان غیرانتفاعی ایرانی برای توسعه هوش مصنوعی است 🇮🇷
تخصص ما: پردازش زبان فارسی، مدل‌های مولد، هوش مصنوعی بومی و اپلیکیشن‌های آموزشی.
🛰 ۴۸ فضای زنده + 🧠 ۱۰ مدل (از جمله kokb1) روی Hugging Face داریم و همه‌چیز رایگان و متن‌باز است.',[{label:'🤗 صفحه رسمی HF',fn:function(){window.open('https://huggingface.co/nexa','_blank')}},{label:'🪐 کاتالوگ پروژه‌ها',fn:function(){gotoSection('projects')}},{label:'🛤 سفر ما',fn:function(){gotoSection('journey')}}]);
}
if(/کمک|راهنما|چیکار|چه کار|امکانات|چه قابلیت|بلدی/.test(q)){
return R('این کارها را بلدم 😎:
🔎 پیدا کردن و اجرای پروژه‌ها («بازی‌ها»، «پروژه فیزیک را باز کن»)
🎨 کنترل کهکشان («کهکشان را سرخابی کن»، «ستاره بیشتر»، «تصادفی»)
🧮 محاسبه («۲۵×۴+۱۰»)
📅 تاریخ و ساعت شمسی
🧭 بردن به بخش‌ها («برو به آزمایشگاه»)
🔊 کنترل صدا («صدا را خاموش کن»)
برای گفتگوی کامل هم DuckAI و kokb1 زنده‌اند!',[{label:'🦆 DuckAI',fn:function(){openProject('duckai')}},{label:'🧠 kokb1 v2',fn:function(){openProject('kokb1-v2-space')}}]);
}
if(/سئو|seo|گوگل|بینگ|موتور جستجو|رتبه|ایندکس/.test(q)){
return R('این سایت برای رتبه یک ساخته شده 🔎:
✅ داده‌های ساخت‌یافته Schema.org (Organization، WebSite، ItemList، FAQPage)
✅ متاتگ‌های کامل Open Graph و robots برای گوگل و بینگ
✅ HTML معنایی، فارسی راست‌چین و سرعت بالا
✅ نقشه سایت داخلی و نسخه بدون جاوااسکریپت برای خزنده‌ها
همه‌چیز در همین یک فایل! ⚡');
}
if(/برو به|بریم|نشان بده|باز کن|اجرا/.test(q)||q.length<14){
if(q.indexOf('آزمایشگاه')>=0||q.indexOf('الگوریتم')>=0)return R('به آزمایشگاه می‌رویم 🧪 پنج شبیه‌سازی زنده آنجاست.',[{label:'📊 مرتب‌سازی',fn:function(){labGo('sort')}},{label:'🧭 مسیریابی',fn:function(){labGo('path')}},{label:'🌀 فراکتال',fn:function(){labGo('frac')}}]);
if(q.indexOf('تماس')>=0){gotoSection('contact');return R('به بخش تماس می‌رویم 📮 منتظر پیامت هستیم!');}
if(q.indexOf('پرسش')>=0||q.indexOf('سوال')>=0||q.indexOf('faq')>=0){gotoSection('faq');return R('پرسش‌های متداول اینجاست ❓');}
}
if(q.indexOf('بازی')>=0||q.indexOf('گیم')>=0){
return R('🎮 کهکشان بازی‌های NEXA پربار است! این‌ها را امتحان کن:',[projChip(byKey('Optimized_version_of_the_game_Tiny_Thief')),projChip(byKey('Play1000')),projChip(byKey('Mekorama_do')),projChip(byKey('Fruitcraft')),{label:'🗂 همه بازی‌ها',fn:function(){setCatGo('game')}}]);
}
if(q.indexOf('فیزیک')>=0){
return R('⚛️ دو تجربه فیزیکی داریم: ویدیوهای آموزشی فیزیک و جعبه فیزیک زنده همین سایت!',[projChip(byKey('Video_fizik')),{label:'⚛️ جعبه فیزیک سایت',fn:function(){labGo('phys')}}]);
}
if(q.indexOf('زیست')>=0){
return R('🧬 زیست ۲۰: آموزش تعاملی زیست دهم تجربی از صفحه ۱ تا ۲۰ — درس را زندگی کن!',[projChip(byKey('Zist20')),{label:'🧬 بازی زندگی (الگوریتم)',fn:function(){labGo('life')}}]);
}
if(q.indexOf('ابزار')>=0){
return R('🧰 جعبه‌ابزار کهکشان: سیستم‌عامل وب، استیکرساز، مبدل، کدساز امنیتی و کلی ابزار دیگر:',[projChip(byKey('Kokbtak_os1.1')),projChip(byKey('Sticker-eitaa')),projChip(byKey('kokbtak-convert')),projChip(byKey('TOTP')),{label:'🗂 همه ابزارها',fn:function(){setCatGo('tool')}}]);
}
if(q.indexOf('قرآن')>=0)return R('🕌 اطلس قرآن: کاوش مفهومی آیات و سوره‌ها با نقشه‌های معنایی.',[projChip(byKey('quran-atlas'))]);
if(q.indexOf('عدد پی')>=0||q.indexOf('π')>=0||q.indexOf('چودنوفسکی')>=0||q.indexOf('ریاضی')>=0||q.indexOf('زورترون')>=0){
return R('🧮 زورترون π: محاسبه زنده رقم‌های π با الگوریتم چودنوفسکی تا ۱۰٬۰۰۰ رقم! ریاضی در کهکشان ما زنده است:',[projChip(byKey('xortron-pi')),{label:'🌀 کاوشگر فراکتال سایت',fn:function(){labGo('frac')}}]);
}
if(q.indexOf('هوش')>=0||q.indexOf('مدل')>=0||q.indexOf('kokb')>=0||q.indexOf('ai')>=0||q.indexOf('چت')>=0){
return R('🧠 قلب تپنده کهکشان: مدل بومی <b>kokb1</b> (نسخه ۱ و ۲)، DuckAI و استودیوی تصویر — همه رایگان و زنده:',[projChip(byKey('duckai')),projChip(byKey('kokb1-v2-space')),projChip(byKey('Ai-img')),{label:'🗂 همه پروژه‌های AI',fn:function(){setCatGo('ai')}}]);
}
if(q.indexOf('آموزش')>=0||q.indexOf('درس')>=0||q.indexOf('کتاب')>=0){
return R('📚 آموزش تعاملی، تخصص ماست:',[projChip(byKey('Zist20')),projChip(byKey('Video_fizik')),projChip(byKey('The-Magic-of-Thinking-Big')),{label:'🗂 همه آموزشی‌ها',fn:function(){setCatGo('edu')}}]);
}
if(q.indexOf('موسیقی')>=0||q.indexOf('اهنگ')>=0||q.indexOf('آهنگ')>=0||q.indexOf('ویدیو')>=0||q.indexOf('فیلم')>=0||q.indexOf('رسانه')>=0){
return R('🎬 بخش رسانه کهکشان: موسیقی، حذف صدای خواننده با AI، زیرنویس‌ساز و دانلودر آپارات:',[projChip(byKey('AI_Voice_Removal')),projChip(byKey('Mozik2')),projChip(byKey('Sottotext')),projChip(byKey('Aparat_downloadr')),{label:'🗂 همه رسانه‌ها',fn:function(){setCatGo('media')}}]);
}
var stop={'را':1,'باز':1,'کن':1,'نشان':1,'بده':1,'پروژه':1,'لطفا':1,'اجرا':1,'برو':1,'به':1,'بخش':1,'سایت':1,'فضای':1,'فضا':1,'the':1,'open':1,'show':1};
var tokens=q.split(/\s+/).filter(function(t){return t.length>=2&&!stop[t]});
var best=null,bestScore=0;
for(i=0;i<PROJECTS.length;i++){
var p=PROJECTS[i],hay=norm(p.t+' '+p.slug+' '+p.tags.join(' ')),score=0;
for(var j=0;j<tokens.length;j++)if(hay.indexOf(tokens[j])>=0)score++;
if(norm(p.t).indexOf(q)>=0&&q.length>=3)score+=2;
if(score>bestScore){bestScore=score;best=p;}
}
if(best&&bestScore>=1){
return R('پیدایش کردم! 🔭 <b>'+esc(best.t)+'</b>
'+esc(best.d),[projChip(best),{label:'⧉ کپی نشانی',fn:function(){copyText(best.url)}},{label:'🗂 در کاتالوگ',fn:function(){gotoSection('projects')}}]);
}
if(q.indexOf('پروژه')>=0||q.indexOf('فضا')>=0||q.indexOf('کاتالوگ')>=0||q.indexOf('همه')>=0){
return R('🪐 '+faNum(PROJECTS.length)+' پروژه در کاتالوگ زنده است. برگزیده‌ها:',[projChip(byKey('Video_fizik')),projChip(byKey('duckai')),projChip(byKey('Play1000')),{label:'🗂 کاتالوگ کامل',fn:function(){gotoSection('projects')}}]);
}
return R('هنوز دارم یاد می‌گیرم 🌱 این را دقیق نفهمیدم، ولی این‌ها را امتحان کن:
«بازی‌ها را نشان بده» • «کهکشان را فیروزه‌ای کن» • «۱۲۳×۴۵۶» • «تاریخ امروز»
برای گفتگوی کامل و نامحدود، مدل‌های زنده ما آماده‌اند:',[{label:'🦆 گفتگو با DuckAI',fn:function(){openProject('duckai')}},{label:'🧠 kokb1 v2',fn:function(){openProject('kokb1-v2-space')}},{label:'❓ راهنمای من',fn:function(){chatSay('چه کارهایی بلدی؟')}}]);
}
function chatSay(text){
text=String(text||'').trim();if(!text)return;
chatAdd('user',esc(text));
var inp=$('chat-input');if(inp)inp.value='';
AudioSys.blip('click');
var body=$('chat-body');
var tp=document.createElement('div');tp.className='msg bot';
tp.innerHTML='<div class="msg-bubble typing"><span></span><span></span><span></span></div>';
body.appendChild(tp);body.scrollTop=body.scrollHeight;
var res=null;
try{res=respond(text)}catch(e){res={html:'یک خطای کوچک در مدارم رخ داد 🛰 دوباره بپرس!',chips:[]}}
if(!res)res={html:'دوباره بپرس! 🛰',chips:[]};
var delay=RM?120:clamp(420+res.html.length*3,450,1300);
setTimeout(function(){
if(tp.parentNode)tp.parentNode.removeChild(tp);
chatAdd('bot',res.html,res.chips);
AudioSys.blip('open');
},delay);
}
function chatGreet(){
chatAdd('bot','سلام! من <b>نکسا‌یار</b> ✦ دستیار کهکشان NEXA هستم.
پروژه پیدا می‌کنم، کهکشان را کنترل می‌کنم، محاسبه می‌کنم و پاسخ می‌دهم — همه‌چیز همین‌جا در مرورگر تو، بدون ارسال هیچ داده‌ای. از کجا شروع کنیم؟',[
{label:'🎮 بازی‌ها',fn:function(){chatSay('بازی‌ها را نشان بده')}},
{label:'✨ درباره NEXA',fn:function(){chatSay('درباره NEXA بگو')}},
{label:'🎨 کهکشان را سرخابی کن',fn:function(){chatSay('کهکشان را سرخابی کن')}}
]);
}
function initChat(){
chatGreet();
$('chat-form').addEventListener('submit',function(e){e.preventDefault();chatSay($('chat-input').value);});
$$('#chat-sugs button').forEach(function(b){b.addEventListener('click',function(){chatSay(b.getAttribute('data-say'))});});
$('chat-clear').addEventListener('click',function(){$('chat-body').innerHTML='';chatGreet();toast('گفتگو پاک شد 🗑','info');AudioSys.blip('click');});
}
var PAL={items:[],view:[],sel:0};
function buildPalItems(){
PAL.items=[];
var secs=[['home','🏠','خانه'],['projects','🪐','کهکشان پروژه‌ها'],['lab','🧪','آزمایشگاه الگوریتم‌ها'],['ai','🤖','هوش مصنوعی'],['journey','🛤','سفر NEXA'],['why','✨','چرا NEXA'],['faq','❓','پرسش‌های متداول'],['contact','📮','تماس']];
secs.forEach(function(s){PAL.items.push({g:'بخش‌ها',ico:s[1],label:s[2],hint:'پرش',kw:s[0],run:function(){gotoSection(s[0])}});});
PAL.items.push({g:'فرمان‌ها',ico:'🔊',label:'صدا روشن/خاموش',hint:'فرمان',kw:'sound seda',run:function(){AudioSys.setOn(!AudioSys.on);toast(AudioSys.on?'صدا روشن شد 🔊':'صدا خاموش شد 🔇','info');}});
PAL.items.push({g:'فرمان‌ها',ico:'🎲',label:'تصادفی‌سازی کهکشان',hint:'فرمان',kw:'random galaxy',run:gRandom});
PAL.items.push({g:'فرمان‌ها',ico:'⬇',label:'خروجی PNG از کهکشان',hint:'فرمان',kw:'export png',run:function(){download(G.canvas,'nexa-galaxy.png')}});
PAL.items.push({g:'فرمان‌ها',ico:'⏯',label:'مکث / ادامه کهکشان',hint:'فرمان',kw:'pause',run:gPauseToggle});
PAL.items.push({g:'فرمان‌ها',ico:'💬',label:'گفتگو با نکسا‌یار',hint:'فرمان',kw:'chat ai',run:function(){gotoSection('ai');setTimeout(function(){$('chat-input').focus()},600);}});
PAL.items.push({g:'فرمان‌ها',ico:'💥',label:'ابرنواختر در کهکشان',hint:'فرمان',kw:'supernova',run:function(){gotoSection('home');setTimeout(function(){gSupernova(G.w/2,G.h/2)},400);}});
PROJECTS.forEach(function(p){PAL.items.push({g:'پروژه‌ها',ico:p.icon,label:p.t,hint:CATS[p.c].name,kw:norm(p.slug+' '+p.tags.join(' ')),run:function(){openProject(p.key)}});});
}
function renderPal(qraw){
var q=norm(qraw),box=$('pal-results');
var list;
if(!q){
list=PAL.items.filter(function(it){return it.g!=='پروژه‌ها'});
var feat=PROJECTS.filter(function(p){return p.feat}).slice(0,6);
feat.forEach(function(p){for(var i=0;i<PAL.items.length;i++){var it=PAL.items[i];if(it.g==='پروژه‌ها'&&it.label===p.t){list.push(it);break;}}});
}else{
list=PAL.items.filter(function(it){return norm(it.label+' '+it.kw).indexOf(q)>=0}).slice(0,16);
}
PAL.view=list;PAL.sel=0;
if(!list.length){box.innerHTML='<div class="pal-empty">🔭 چیزی پیدا نشد — عبارت دیگری امتحان کن.</div>';return;}
var html='',lastG='';
list.forEach(function(it,i){
if(it.g!==lastG){html+='<div class="pal-group">'+it.g+'</div>';lastG=it.g;}
html+='<button class="pal-item'+(i===0?' sel':'')+'" data-i="'+i+'"><span class="pal-ico">'+it.ico+'</span><span class="pal-label">'+esc(it.label)+'</span><span class="pal-hint">'+esc(it.hint)+'</span></button>';
});
box.innerHTML=html;
}
function palPaint(){
$$('#pal-results .pal-item').forEach(function(b){b.classList.toggle('sel',+b.getAttribute('data-i')===PAL.sel)});
var sel=document.querySelector('#pal-results .pal-item.sel');
if(sel&&sel.scrollIntoView)sel.scrollIntoView({block:'nearest'});
}
function openPal(){
buildPalItems();
$('palette').classList.add('open');updateBodyLock();
$('pal-input').value='';renderPal('');
setTimeout(function(){$('pal-input').focus()},60);
AudioSys.blip('open');
}
function closePal(){
if(!$('palette').classList.contains('open'))return;
$('palette').classList.remove('open');updateBodyLock();AudioSys.blip('close');
}
function palRun(i){
var it=PAL.view[i];if(!it)return;
closePal();
setTimeout(function(){it.run()},60);
}
function initPalette(){
$('btn-search').addEventListener('click',openPal);
$('pal-input').addEventListener('input',function(){renderPal(this.value)});
$('palette').addEventListener('click',function(e){if(e.target===this)closePal();});
$('pal-results').addEventListener('click',function(e){
var b=e.target.closest('.pal-item');if(b)palRun(+b.getAttribute('data-i'));
});
$('pal-results').addEventListener('mousemove',function(e){
var b=e.target.closest('.pal-item');
if(b&&+b.getAttribute('data-i')!==PAL.sel){PAL.sel=+b.getAttribute('data-i');palPaint();}
});
$('palette').addEventListener('keydown',function(e){
if(e.key==='ArrowDown'){e.preventDefault();PAL.sel=(PAL.sel+1)%Math.max(1,PAL.view.length);palPaint();}
else if(e.key==='ArrowUp'){e.preventDefault();PAL.sel=(PAL.sel-1+PAL.view.length)%Math.max(1,PAL.view.length);palPaint();}
else if(e.key==='Enter'){e.preventDefault();palRun(PAL.sel);}
});
}
function initKeys(){
document.addEventListener('keydown',function(e){
if((e.ctrlKey||e.metaKey)&&(e.key==='k'||e.key==='K')){
e.preventDefault();
if($('palette').classList.contains('open'))closePal();else openPal();
return;
}
if(e.key==='Escape'){
if($('palette').classList.contains('open'))closePal();
else if($('modal').classList.contains('open'))closeModal();
else if($('mmenu').classList.contains('open'))toggleMenu(false);
}
});
}
function toggleMenu(force){
var m=$('mmenu'),b=$('btn-burger');
var open=typeof force==='boolean'?force:!m.classList.contains('open');
m.classList.toggle('open',open);b.classList.toggle('open',open);
b.setAttribute('aria-expanded',open?'true':'false');
}
function initNav(){
var nav=$('nav'),bar=document.querySelector('#progress b'),bt=$('backtop'),tick=false;
function onScroll(){
if(tick)return;tick=true;
requestAnimationFrame(function(){
tick=false;
var y=window.scrollY||document.documentElement.scrollTop;
nav.classList.toggle('scrolled',y>10);
var dh=document.documentElement.scrollHeight-window.innerHeight;
bar.style.width=(dh>0?clamp(y/dh*100,0,100):0)+'%';
bt.classList.toggle('show',y>600);
});
}
window.addEventListener('scroll',onScroll,{passive:true});onScroll();
bt.addEventListener('click',function(){window.scrollTo({top:0,behavior:RM?'auto':'smooth'});AudioSys.blip('click');});
$('btn-burger').addEventListener('click',function(){toggleMenu();AudioSys.blip('click');});
$$('#mmenu a').forEach(function(a){a.addEventListener('click',function(){toggleMenu(false)})});
window.addEventListener('resize',debounce(function(){if(window.innerWidth>960)toggleMenu(false)},150));
$('btn-sound').addEventListener('click',function(){
AudioSys.setOn(!AudioSys.on);
toast(AudioSys.on?'صدا روشن شد 🔊':'صدا خاموش شد 🔇','info');
if(AudioSys.on)AudioSys.blip('ok');
});
if(window.IntersectionObserver){
var ids=['home','projects','lab','ai','journey','faq','contact'];
var io=new IntersectionObserver(function(entries){
entries.forEach(function(en){
if(en.isIntersecting){
var id=en.target.id;
$$('.nav-links a').forEach(function(a){a.classList.toggle('active',a.getAttribute('href')==='#'+id)});
$$('#mmenu a').forEach(function(a){a.classList.toggle('active',a.getAttribute('href')==='#'+id)});
}
});
},{rootMargin:'-40% 0px -55% 0px'});
ids.forEach(function(id){var el=$(id);if(el)io.observe(el)});
}
}
function initReveal(){
var els=$$('[data-reveal]');
if(!window.IntersectionObserver||RM){els.forEach(function(e){e.classList.add('in')});return;}
var io=new IntersectionObserver(function(entries){
entries.forEach(function(en){if(en.isIntersecting){en.target.classList.add('in');io.unobserve(en.target);}});
},{threshold:.1,rootMargin:'0px 0px -30px 0px'});
els.forEach(function(e){io.observe(e)});
}
function initCounters(){
var els=$$('[data-count]');
function run(el){
var target=+el.getAttribute('data-count'),suffix=el.getAttribute('data-suffix')||'';
if(RM){el.textContent=faNum(target)+suffix;return;}
var t0=performance.now();
(function step(){
var p=clamp((performance.now()-t0)/1400,0,1),e=1-Math.pow(1-p,3);
el.textContent=faNum(Math.round(target*e))+suffix;
if(p<1)requestAnimationFrame(step);
})();
}
if(!window.IntersectionObserver){els.forEach(run);return;}
var io=new IntersectionObserver(function(entries){
entries.forEach(function(en){if(en.isIntersecting){run(en.target);io.unobserve(en.target);}});
},{threshold:.4});
els.forEach(function(e){io.observe(e)});
}
function initTicker(){var t=$('ticker-track');if(t)t.innerHTML+=t.innerHTML;}
function initGlow(){
if(!FINE||RM)return;
var g=$('glow');g.style.display='block';g.style.right='auto';g.style.left='0';
window.addEventListener('pointermove',function(e){
g.style.transform='translate3d('+(e.clientX-260)+'px,'+(e.clientY-260)+'px,0)';
},{passive:true});
}
function initFaq(){
$$('.faq-item').forEach(function(item){
var q=item.querySelector('.faq-q'),a=item.querySelector('.faq-a');
q.addEventListener('click',function(){
var open=item.classList.contains('open');
$$('.faq-item.open').forEach(function(o){o.classList.remove('open');o.querySelector('.faq-a').style.maxHeight='0px';o.querySelector('.faq-q').setAttribute('aria-expanded','false');});
if(!open){item.classList.add('open');a.style.maxHeight=a.scrollHeight+'px';q.setAttribute('aria-expanded','true');}
AudioSys.blip('click');
});
});
}
function initContact(){
var form=$('contact-form'),msg=$('cf-msg');
msg.addEventListener('input',function(){$('cf-count').textContent='('+faNum(msg.value.length)+'/'+faNum(600)+')';});
form.addEventListener('submit',function(e){
e.preventDefault();
var name=$('cf-name').value.trim(),email=$('cf-email').value.trim(),text=msg.value.trim();
var ok=true;
$('fld-name').classList.toggle('bad',name.length<2);if(name.length<2)ok=false;
var emOk=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email);
$('fld-email').classList.toggle('bad',!emOk);if(!emOk)ok=false;
$('fld-msg').classList.toggle('bad',text.length<10);if(text.length<10)ok=false;
if(!ok){toast('لطفاً خطاهای فرم را برطرف کنید','warn');AudioSys.blip('bad');return;}
var drafts=load('nexa_msgs',[]);
drafts.push({name:name,email:email,text:text,at:new Date().toISOString()});
store('nexa_msgs',drafts);
var body=encodeURIComponent('نام: '+name+'
ایمیل: '+email+'
'+text);
var mail=$('cf-mail');
mail.href='mailto:nexa@gmail.com?subject='+encodeURIComponent('پیام از سایت NEXA — '+name)+'&body='+body;
mail.classList.add('show');
toast('پیام ثبت شد! حالا با «ارسال با ایمیل» به دست ما برسان 🚀','ok');
AudioSys.blip('ok');
});
}
function initFooter(){
var visits=load('nexa_visits',0)+1;store('nexa_visits',visits);
$('fa-visits').textContent=faNum(visits);
var t0=Date.now();
function pad(n){return (n<10?'0':'')+n}
function tick(){
try{
var now=new Date();
var d=new Intl.DateTimeFormat('fa-IR',{day:'numeric',month:'long'}).format(now);
var tm=new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit'}).format(now);
$('fa-clock').textContent=d+' • '+tm;
}catch(e){}
var s=Math.floor((Date.now()-t0)/1000);
var hh=Math.floor(s/3600),mm=Math.floor((s%3600)/60),ss=s%60;
$('fa-uptime').textContent=faDigits((hh>0?pad(hh)+':':'')+pad(mm)+':'+pad(ss));
}
tick();setInterval(tick,1000);
}
var loaderDone=false;
function loaderFinish(){
if(loaderDone)return;loaderDone=true;
var f=$('loader-fill');if(f)f.style.width='100%';
setTimeout(function(){var l=$('loader');if(l)l.classList.add('done');},RM?60:420);
}
function boot(){
var f=$('loader-fill');if(f)f.style.width='35%';
safe(updateSoundBtn);
safe(initNav);safe(initReveal);safe(initCounters);safe(initTicker);safe(initGlow);
safe(initGalaxy);
if(f)f.style.width='65%';
safe(initProjects);safe(initModal);safe(initChat);safe(initLabs);safe(initPalette);
safe(initFaq);safe(initContact);safe(initFooter);safe(initKeys);
document.addEventListener('visibilitychange',function(){gRegister();labRegister();});
if(f)f.style.width='85%';
setTimeout(loaderFinish,RM?80:650);
setTimeout(function(){var l=$('loader');if(l)l.classList.add('done');},2600);
}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',boot);
else boot();
})();
</script>
</body>
</html>