File size: 268,662 Bytes
7cc8e29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>أَمْر — 28 Letters of Allah's Arabic</title>
<style>
:root {
  --bg: #0a0a12;
  --bg2: #12121e;
  --bg3: #1a1a2e;
  --gold: #d4a843;
  --gold-dim: #8a6e2c;
  --green: #2ecc71;
  --blue: #3498db;
  --red: #e74c3c;
  --text: #e0ddd5;
  --text-dim: #888;
  --border: #2a2a3e;
  --accent: #5b86e5;
  --radius: 8px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', 'Noto Naskh Arabic', serif;
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: normal; }
.latin { font-family: 'Courier New', monospace; direction: ltr; unicode-bidi: embed; }

/* HEADER */
header {
  text-align: center;
  padding: 30px 20px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg2), var(--bg));
}
header h1 { font-size: 2.2em; color: var(--gold); margin-bottom: 5px; }
header .subtitle { color: var(--text-dim); font-size: 1em; }
header .bismillah { font-size: 1.5em; color: var(--gold-dim); margin-bottom: 10px; }

/* NAV */
nav {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--bg2); border-bottom: 1px solid var(--border);
  direction: ltr;
}
nav button {
  background: var(--bg3); color: var(--text-dim); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: var(--radius); cursor: pointer; font-size: 0.85em;
  font-family: inherit; transition: all 0.2s;
}
nav button:hover, nav button.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }

/* SECTIONS */
.section { display: none; padding: 20px; max-width: 1400px; margin: 0 auto; }
.section.active { display: block; }
.section-title { font-size: 1.6em; color: var(--gold); text-align: center; margin: 20px 0; }

/* LETTER GRID */
#grid-section .letter-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}
.letter-cell {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.letter-cell:hover { border-color: var(--gold); transform: translateY(-2px); }
.letter-cell.selected { border-color: var(--gold); background: var(--bg3); box-shadow: 0 0 15px rgba(212,168,67,0.3); }
.letter-cell .letter { font-size: 2.8em; line-height: 1.1; color: var(--text); }
.letter-cell .name { font-size: 0.75em; color: var(--text-dim); margin-top: 2px; }
.letter-cell .translit-small { font-size: 0.65em; color: var(--accent); font-family: 'Courier New', monospace; direction: ltr; unicode-bidi: embed; margin-top: 1px; }
.letter-cell .sound-btn {
  position: absolute; bottom: 4px; left: 4px; font-size: 0.7em; cursor: pointer;
  opacity: 0.4; transition: opacity 0.2s; line-height: 1;
}
.letter-cell .sound-btn:hover { opacity: 1; }
.sound-play-btn {
  background: var(--bg3); color: var(--text-dim); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: var(--radius); cursor: pointer; font-size: 0.85em;
  font-family: inherit; transition: all 0.2s; margin-right: 5px;
}
.sound-play-btn:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.letter-cell .abjad-val {
  position: absolute; top: 4px; left: 4px; font-size: 0.65em;
  color: var(--gold-dim); font-family: monospace; direction: ltr;
}
.letter-cell .dots-indicator {
  position: absolute; top: 4px; right: 4px; font-size: 0.6em; color: var(--accent);
}

/* DETAIL PANEL */
#detail-panel {
  margin-top: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: none;
}
#detail-panel.visible { display: block; }
#detail-panel .detail-header {
  display: flex; align-items: center; gap: 20px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 15px;
}
#detail-panel .big-letter { font-size: 6em; color: var(--gold); line-height: 1; }
#detail-panel .header-info h2 { font-size: 1.4em; color: var(--gold); }
#detail-panel .header-info .translit { color: var(--text-dim); font-size: 0.9em; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.detail-card h3 { color: var(--gold); font-size: 0.95em; margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.detail-card p, .detail-card li { font-size: 0.85em; line-height: 1.5; }
.detail-card ul { list-style: none; padding: 0; }
.detail-card li::before { content: '▸ '; color: var(--gold-dim); }
.detail-card .stat { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.detail-card .stat-label { color: var(--text-dim); font-size: 0.8em; }
.detail-card .stat-value { color: var(--green); font-family: monospace; font-size: 0.85em; direction: ltr; }
.tag { display: inline-block; background: var(--bg); padding: 2px 8px; border-radius: 3px; font-size: 0.75em; margin: 2px; border: 1px solid var(--border); }
.tag.sun { border-color: #e67e22; color: #e67e22; }
.tag.moon { border-color: #3498db; color: #3498db; }
.tag.voiced { border-color: var(--green); color: var(--green); }
.tag.emphatic { border-color: var(--red); color: var(--red); }

/* DIAGRAMS */
.diagrams-row {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin: 20px 0;
}
.diagram-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  flex: 1; min-width: 350px; max-width: 600px;
}
.diagram-container h3 { text-align: center; color: var(--gold); margin-bottom: 10px; font-size: 1em; }
svg text { font-family: 'Amiri', serif; }

/* Zone highlight in SVGs */
.zone { opacity: 0.15; transition: opacity 0.3s, fill 0.3s; cursor: pointer; }
.zone:hover { opacity: 0.4; }
.zone.active { opacity: 0.6; fill: var(--gold) !important; }
.zone-label { font-size: 10px; fill: var(--text-dim); pointer-events: none; }
.zone-label.active { fill: var(--gold); font-weight: bold; }

/* HARAKAT SECTION */
.harakat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; max-width: 1000px; margin: 20px auto;
}
.harakat-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; text-align: center;
}
.harakat-card .sample { font-size: 4em; line-height: 1.3; color: var(--text); }
.harakat-card .mark-name { font-size: 1em; color: var(--gold); margin: 5px 0; }
.harakat-card .mark-desc { font-size: 0.8em; color: var(--text-dim); }
.harakat-card .mark-translit { font-size: 0.75em; color: var(--accent); font-family: monospace; direction: ltr; }

/* DOT FAMILIES */
.dot-families {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px; max-width: 1100px; margin: 20px auto;
}
.family-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px;
}
.family-card .base-shape { font-size: 0.85em; color: var(--gold); margin-bottom: 8px; }
.family-members { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }
.family-member {
  text-align: center; padding: 8px; background: var(--bg3); border-radius: var(--radius);
  min-width: 60px;
}
.family-member .fm-letter { font-size: 2.2em; }
.family-member .fm-dots { font-size: 0.7em; color: var(--accent); }

/* ROOT CALCULATOR */
#calc-section .calc-container {
  max-width: 800px; margin: 0 auto;
}
.calc-input-row {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  margin: 20px 0; flex-wrap: wrap;
}
.calc-input-row input {
  font-size: 2.5em; width: 80px; text-align: center; padding: 10px;
  background: var(--bg2); border: 2px solid var(--border); border-radius: var(--radius);
  color: var(--gold); font-family: inherit; direction: rtl;
}
.calc-input-row input:focus { border-color: var(--gold); outline: none; }
.calc-input-row .separator { font-size: 2em; color: var(--text-dim); }
.calc-btn {
  background: var(--gold); color: var(--bg); border: none; padding: 12px 30px;
  border-radius: var(--radius); font-size: 1.1em; cursor: pointer; font-family: inherit;
  margin-top: 10px;
}
.calc-btn:hover { opacity: 0.9; }
#calc-result {
  margin-top: 20px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; display: none;
}
#calc-result.visible { display: block; }
.calc-formula {
  font-size: 1.2em; text-align: center; margin: 10px 0; direction: ltr;
  font-family: monospace; color: var(--green);
}
.calc-letter-analysis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px; margin: 15px 0;
}
.calc-letter-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: center;
}
.calc-letter-card .clc-letter { font-size: 2.5em; color: var(--gold); }
.calc-letter-card .clc-pos { font-size: 0.75em; color: var(--accent); }
.calc-letter-card .clc-tendency { font-size: 0.8em; color: var(--text-dim); margin-top: 5px; }
.calc-semantic { text-align: center; font-size: 1.1em; margin: 15px 0; padding: 15px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--gold-dim); }

/* ABJAD TABLE */
.abjad-table-wrap { max-width: 900px; margin: 20px auto; overflow-x: auto; }
.abjad-table {
  width: 100%; border-collapse: collapse;
}
.abjad-table th, .abjad-table td {
  padding: 10px 12px; border: 1px solid var(--border); text-align: center;
}
.abjad-table th { background: var(--bg3); color: var(--gold); font-size: 0.85em; }
.abjad-table td { font-size: 0.9em; }
.abjad-table .letter-col { font-size: 1.8em; }
.abjad-table .value-col { font-family: monospace; color: var(--green); direction: ltr; }
.abjad-table tr:hover { background: var(--bg3); }

/* Geometric section */
.geo-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px; max-width: 1100px; margin: 20px auto;
}
.geo-cell {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; text-align: center;
}
.geo-cell .geo-letter { font-size: 3em; color: var(--text); line-height: 1.2; }
.geo-cell .geo-label { font-size: 0.65em; color: var(--text-dim); margin-top: 3px; }
.geo-cell .geo-abjad { font-size: 0.9em; color: var(--gold); font-family: monospace; direction: ltr; }
.geo-cell .geo-div7 { font-size: 0.6em; color: var(--green); }

/* GRID VIEW SELECTOR */
.grid-view-bar {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: 15px auto; max-width: 1100px; padding: 10px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
}
.grid-view-btn {
  background: var(--bg3); color: var(--text-dim); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: var(--radius); cursor: pointer; font-size: 0.72em;
  font-family: inherit; transition: all 0.2s; white-space: nowrap;
}
.grid-view-btn:hover { border-color: var(--gold-dim); color: var(--text); }
.grid-view-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: bold; }

/* GROUP HEADER in grid */
.grid-group-header {
  grid-column: 1 / -1; text-align: center; padding: 8px; margin-top: 8px;
  color: var(--gold); font-size: 0.95em; border-bottom: 1px solid var(--border);
  font-family: inherit;
}
.grid-group-header:first-child { margin-top: 0; }
.grid-group-header .group-count { font-size: 0.75em; color: var(--text-dim); margin-right: 8px; font-family: monospace; }

/* BREATH DIAGRAM — compact display (RTL) */
.letter-cell .breath-diag {
  font-family: monospace; font-size: 0.55em; color: var(--accent);
  direction: rtl; margin-top: 2px;
  letter-spacing: 1px; opacity: 0.7; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.letter-cell:hover .breath-diag { opacity: 1; }
.letter-cell .airflow-label {
  font-family: monospace; font-size: 0.45em; color: var(--text-dim);
  direction: rtl; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#detail-panel .breath-header-diag {
  font-family: monospace; font-size: 1.1em; color: var(--accent);
  direction: rtl; letter-spacing: 2px;
  margin-top: 4px;
}
#detail-panel .breath-header-label {
  font-family: monospace; font-size: 0.7em; color: var(--text-dim);
  direction: rtl;
}

/* LANG FLAG — marks untranslated prose */
.lang-flag {
  display: inline-block; font-size: 0.55em; font-family: monospace;
  background: rgba(255,255,255,0.08); color: var(--text-dim); padding: 1px 5px;
  border-radius: 3px; margin-right: 6px; vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.1); letter-spacing: 0.5px;
  direction: ltr; unicode-bidi: embed;
}

/* LANGUAGE SELECTOR */
.lang-select-wrap {
  position: absolute; top: 15px; left: 15px; z-index: 10;
}
.lang-select {
  background: var(--bg3); color: var(--gold); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: var(--radius); font-size: 0.85em;
  font-family: inherit; cursor: pointer; appearance: none;
  -webkit-appearance: none; -moz-appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4a843' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.lang-select:hover { border-color: var(--gold); }
.lang-select option { background: var(--bg2); color: var(--text); }
header { position: relative; }

/* Footer */
footer { text-align: center; padding: 20px; color: var(--text-dim); font-size: 0.8em; border-top: 1px solid var(--border); margin-top: 40px; }
</style>
</head>
<body>

<header>
  <div class="lang-select-wrap">
    <select class="lang-select" id="lang-select">
      <option value="en">English</option>
      <option value="ru">Русский</option>
      <option value="de">Deutsch</option>
      <option value="uz">O'zbek</option>
    </select>
  </div>
  <div class="bismillah">بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ</div>
  <h1>أَمْر — حُرُوف لِسَان الله</h1>
  <div class="subtitle" data-i18n="subtitle">Letters of Allah's Arabic &mdash; Phase 0 Reference 28</div>
</header>

<nav id="main-nav">
  <button class="active" data-section="grid-section" data-i18n="nav_letters">الحُرُوف / Letters</button>
  <button data-section="makhraj-section" data-i18n="nav_articulation">مَخَارِج / Articulation</button>
  <button data-section="harakat-section" data-i18n="nav_diacritics">حَرَكَات / Diacritics</button>
  <button data-section="dots-section" data-i18n="nav_dots">نُقَط / Dots &amp; Geometry</button>
  <button data-section="abjad-section" data-i18n="nav_values">أَبْجَد / Values</button>
  <button data-section="calc-section" data-i18n="nav_calc">حِسَاب الجَذْر / Root Calculator</button>
</nav>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 1: LETTER GRID + DETAIL -->
<!-- ═══════════════════════════════════════════ -->
<div id="grid-section" class="section active">
  <div class="section-title" data-i18n="section_28">الحُرُوف الثَّمَانِيَة وَالعِشْرُون — The 28 Letters</div>
  <div class="grid-view-bar" id="grid-view-bar">
    <div class="grid-view-btn active" data-view="alphabetical">1. الأَبْجَدِيَّة Alphabetical</div>
    <div class="grid-view-btn" data-view="abjad-tiers">2. أَبْجَد Abjad Tiers</div>
    <div class="grid-view-btn" data-view="articulation">3. مَخَارِج Articulation</div>
    <div class="grid-view-btn" data-view="manner">4. صِفَات Manner</div>
    <div class="grid-view-btn" data-view="voiced">5. مَجْهُور Voiced/Voiceless</div>
    <div class="grid-view-btn" data-view="sun-moon">6. شَمْس/قَمَر Sun/Moon</div>
    <div class="grid-view-btn" data-view="dotted">7. مُعْجَمَة Dotted/Undotted</div>
    <div class="grid-view-btn" data-view="dot-count">8. عَدَد النُّقَط Dot Count</div>
    <div class="grid-view-btn" data-view="shape">9. رَسْم Shape Family</div>
    <div class="grid-view-btn" data-view="connectors">10. اتِّصَال Connectors</div>
    <div class="grid-view-btn" data-view="emphatic">11. تَفْخِيم Emphatic/Plain</div>
    <div class="grid-view-btn" data-view="muqattaat">12. مُقَطَّعَات Muqattaʿāt</div>
    <div class="grid-view-btn" data-view="frequency">13. تَوَاتُر Qur'anic Frequency</div>
  </div>
  <div class="letter-grid" id="letter-grid"></div>
  <div id="detail-panel">
    <div class="detail-header">
      <div class="big-letter" id="dp-letter"></div>
      <div class="header-info">
        <h2 id="dp-name"></h2>
        <div class="translit latin" id="dp-translit"></div>
        <div id="dp-tags"></div>
        <button class="sound-play-btn" id="dp-sound-btn" onclick="playLetterSound(selectedLetter)" style="margin-top:6px;" data-i18n="play_sound">
          &#x1f50a; Play Sound
        </button>
      </div>
      <div style="margin-right:auto; text-align:left; direction:ltr;">
        <div style="font-size:2.5em; color:var(--gold); font-family:monospace;" id="dp-abjad-big"></div>
        <div style="font-size:0.8em; color:var(--text-dim);" id="dp-div7"></div>
        <div class="breath-header-diag" id="dp-breath-diag"></div>
        <div class="breath-header-label" id="dp-breath-label"></div>
      </div>
    </div>
    <!-- ARTICULATION ANIMATION -->
    <div id="anim-container" style="display:none; margin-bottom:20px;">
      <div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;">
        <h3 style="color:var(--gold); font-size:1em;">تَحْرِيك النُّطْق — Articulation Animation</h3>
        <div>
          <button id="anim-play-btn" onclick="playArticulation()" style="background:var(--gold);color:var(--bg);border:none;padding:6px 16px;border-radius:var(--radius);cursor:pointer;font-family:inherit;font-size:0.85em;">
            ▶ Play
          </button>
          <button onclick="playArticulation()" style="background:var(--bg3);color:var(--text-dim);border:1px solid var(--border);padding:6px 12px;border-radius:var(--radius);cursor:pointer;font-family:inherit;font-size:0.85em;margin-right:5px;">
            ↻ Replay
          </button>
        </div>
      </div>
      <div style="display:flex; gap:20px; flex-wrap:wrap;">
        <svg id="anim-svg" viewBox="0 0 500 380" xmlns="http://www.w3.org/2000/svg"
             style="background:var(--bg3); border-radius:var(--radius); border:1px solid var(--border); flex:1; min-width:350px; max-width:550px;">
          <!-- Head outline (static) -->
          <path d="M200,30 C280,30 350,60 370,120 C390,180 380,220 360,260 L340,300 L320,340 L280,360 L240,365 L200,360 L170,345 L150,320 L140,280 L135,240 L130,200 L140,140 L160,80 Z"
                fill="none" stroke="#444" stroke-width="2"/>
          <!-- Nasal cavity -->
          <path d="M200,80 C220,75 260,78 290,90 L285,105 C260,95 225,92 200,95 Z" fill="#1a1a2e" stroke="#333" stroke-width="1"/>
          <!-- Hard palate -->
          <path d="M195,100 C225,88 260,90 290,100" fill="none" stroke="#555" stroke-width="2.5"/>
          <!-- Soft palate -->
          <path d="M290,100 C310,110 325,130 330,155 L325,165 C320,140 305,120 290,110 Z" fill="#1a1a2e" stroke="#555" stroke-width="1.5"/>
          <!-- Pharynx wall -->
          <path d="M330,155 C340,180 345,220 340,260 L335,300" fill="none" stroke="#444" stroke-width="2"/>
          <!-- Larynx -->
          <path d="M310,310 L330,295 L340,310 L335,335 L310,340 Z" fill="#1a1a2e" stroke="#444" stroke-width="1.5"/>

          <!-- ANIMATED PARTS -->
          <!-- Upper lip -->
          <path id="anim-upper-lip" d="M145,185 C150,180 155,178 160,180" fill="none" stroke="#888" stroke-width="3" stroke-linecap="round"/>
          <!-- Lower lip -->
          <path id="anim-lower-lip" d="M145,215 C150,220 155,222 160,220" fill="none" stroke="#888" stroke-width="3" stroke-linecap="round"/>
          <!-- Tongue -->
          <path id="anim-tongue" d="M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190"
                fill="#2a2a3e" stroke="#666" stroke-width="2"/>
          <!-- Upper teeth -->
          <line id="anim-upper-teeth" x1="168" y1="148" x2="168" y2="168" stroke="#777" stroke-width="3" stroke-linecap="round"/>
          <line x1="175" y1="146" x2="173" y2="166" stroke="#777" stroke-width="2.5"/>
          <!-- Lower teeth -->
          <line id="anim-lower-teeth" x1="166" y1="248" x2="166" y2="232" stroke="#777" stroke-width="3" stroke-linecap="round"/>
          <line x1="174" y1="250" x2="172" y2="234" stroke="#777" stroke-width="2.5"/>

          <!-- Airflow arrows (hidden by default) -->
          <g id="anim-airflow" style="opacity:0;">
            <path d="M320,280 L300,250 L280,230" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead)"/>
            <path d="M280,230 L240,210 L200,200" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead)"/>
            <path d="M160,200 L130,200 L100,200" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead)"/>
          </g>

          <!-- Airflow burst (for plosives) -->
          <g id="anim-burst" style="opacity:0;">
            <line x1="130" y1="195" x2="90" y2="185" stroke="#e67e22" stroke-width="2"/>
            <line x1="130" y1="200" x2="80" y2="200" stroke="#e67e22" stroke-width="2"/>
            <line x1="130" y1="205" x2="90" y2="215" stroke="#e67e22" stroke-width="2"/>
            <line x1="130" y1="190" x2="100" y2="175" stroke="#e67e22" stroke-width="1.5"/>
            <line x1="130" y1="210" x2="100" y2="225" stroke="#e67e22" stroke-width="1.5"/>
          </g>

          <!-- Contact point highlight -->
          <circle id="anim-contact" cx="152" cy="200" r="8" fill="none" stroke="#d4a843" stroke-width="2" style="opacity:0;"/>

          <!-- Arrow marker -->
          <defs>
            <marker id="arrowhead" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
              <polygon points="0,0 8,3 0,6" fill="#e67e22"/>
            </marker>
          </defs>

          <!-- Phase label -->
          <text id="anim-phase-label" x="250" y="30" text-anchor="middle" fill="#d4a843" font-size="14" style="opacity:0;"></text>

          <!-- Makhraj highlight zone -->
          <ellipse id="anim-makhraj-zone" cx="152" cy="200" rx="20" ry="30" fill="#d4a843" style="opacity:0;"/>
        </svg>

        <!-- Phase description panel -->
        <div id="anim-desc" style="flex:1; min-width:200px; max-width:350px; background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius); padding:15px;">
          <div id="anim-step-title" style="color:var(--gold); font-size:1em; margin-bottom:8px;">Ready</div>
          <div id="anim-step-desc" style="color:var(--text-dim); font-size:0.85em; line-height:1.5;">
            Click Play to see how this letter is articulated.
          </div>
          <div id="anim-step-num" style="margin-top:15px; display:flex; gap:5px;"></div>
        </div>
      </div>
    </div>

    <div class="detail-grid" id="dp-grid"></div>
  </div>
</div>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 2: MAKHRAJ DIAGRAMS -->
<!-- ═══════════════════════════════════════════ -->
<div id="makhraj-section" class="section">
  <div class="section-title" data-i18n="articulation_title">مَخَارِج الحُرُوف — Articulation Points</div>
  <p style="text-align:center; color:var(--text-dim); margin-bottom:15px;" data-i18n="articulation_hint">Click a letter above or a zone in the diagrams to see which letters articulate there</p>
  <div class="diagrams-row">
    <!-- Sagittal cross-section -->
    <div class="diagram-container">
      <h3>المَقْطَع الجَانِبِي — Sagittal Cross-Section</h3>
      <svg id="sagittal-svg" viewBox="0 0 500 400" xmlns="http://www.w3.org/2000/svg">
        <!-- Head outline -->
        <path d="M200,30 C280,30 350,60 370,120 C390,180 380,220 360,260 L340,300 L320,340 L280,370 L240,380 L200,375 L170,360 L150,330 L140,290 L135,250 L130,200 L140,140 L160,80 Z"
              fill="none" stroke="#444" stroke-width="2"/>
        <!-- Nasal cavity -->
        <path d="M200,80 C220,75 260,78 290,90 L285,105 C260,95 225,92 200,95 Z" fill="#1a1a2e" stroke="#333" stroke-width="1"/>
        <!-- Hard palate -->
        <path d="M195,100 C225,88 260,90 290,100" fill="none" stroke="#555" stroke-width="2.5" id="palate-line"/>
        <!-- Soft palate / velum -->
        <path d="M290,100 C310,110 325,130 330,155 L325,165 C320,140 305,120 290,110 Z" fill="#1a1a2e" stroke="#555" stroke-width="1.5"/>
        <!-- Tongue body -->
        <path d="M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190 L295,200 C285,185 270,175 255,172 C235,170 215,180 200,200 C190,215 180,235 175,255 Z"
              fill="#2a2a3e" stroke="#555" stroke-width="1.5" id="tongue-body"/>
        <!-- Teeth (upper) -->
        <line x1="170" y1="145" x2="170" y2="165" stroke="#666" stroke-width="3" stroke-linecap="round"/>
        <line x1="178" y1="143" x2="175" y2="163" stroke="#666" stroke-width="2.5"/>
        <!-- Teeth (lower) -->
        <line x1="168" y1="255" x2="168" y2="238" stroke="#666" stroke-width="3" stroke-linecap="round"/>
        <line x1="176" y1="256" x2="174" y2="240" stroke="#666" stroke-width="2.5"/>
        <!-- Lips -->
        <ellipse cx="155" cy="200" rx="18" ry="35" fill="none" stroke="#555" stroke-width="2"/>
        <!-- Pharynx wall -->
        <path d="M330,155 C340,180 345,220 340,260 L335,300" fill="none" stroke="#444" stroke-width="2"/>
        <!-- Larynx/Glottis -->
        <path d="M310,320 L330,300 L335,300 L340,310 L335,340 L310,350 Z" fill="#1a1a2e" stroke="#444" stroke-width="1.5"/>

        <!-- ARTICULATION ZONES (clickable) -->
        <!-- Lips / bilabial -->
        <ellipse class="zone" id="z-lips" cx="150" cy="200" rx="22" ry="40" fill="#3498db"/>
        <text class="zone-label" x="115" y="200" text-anchor="end" id="zl-lips">Lips شَفَتَان</text>

        <!-- Labiodental -->
        <circle class="zone" id="z-labiodental" cx="162" cy="172" r="12" fill="#2ecc71"/>
        <text class="zone-label" x="115" y="172" text-anchor="end" id="zl-labiodental">Labiodental</text>

        <!-- Interdental -->
        <ellipse class="zone" id="z-interdental" cx="170" cy="205" rx="10" ry="20" fill="#e74c3c"/>
        <text class="zone-label" x="115" y="220" text-anchor="end" id="zl-interdental">Interdental لَثَوِيَّة</text>

        <!-- Dental/Alveolar -->
        <ellipse class="zone" id="z-dental" cx="182" cy="165" rx="15" ry="12" fill="#e67e22"/>
        <text class="zone-label" x="182" y="140" text-anchor="middle" id="zl-dental">Dental أَسَلِيَّة</text>

        <!-- Alveolar ridge -->
        <ellipse class="zone" id="z-alveolar" cx="195" cy="150" rx="15" ry="10" fill="#9b59b6"/>
        <text class="zone-label" x="195" y="130" text-anchor="middle" id="zl-alveolar">Alveolar ذَلْقِيَّة</text>

        <!-- Palatal -->
        <ellipse class="zone" id="z-palatal" cx="240" cy="120" rx="25" ry="15" fill="#1abc9c"/>
        <text class="zone-label" x="240" y="105" text-anchor="middle" id="zl-palatal">Palatal شَجَرِيَّة</text>

        <!-- Velar -->
        <ellipse class="zone" id="z-velar" cx="290" cy="120" rx="18" ry="15" fill="#f39c12"/>
        <text class="zone-label" x="290" y="100" text-anchor="middle" id="zl-velar">Velar لَهَوِيَّة</text>

        <!-- Uvular -->
        <ellipse class="zone" id="z-uvular" cx="315" cy="145" rx="15" ry="18" fill="#e74c3c"/>
        <text class="zone-label" x="360" y="145" text-anchor="start" id="zl-uvular">Uvular لَهَوِيَّة</text>

        <!-- Pharyngeal -->
        <ellipse class="zone" id="z-pharyngeal" cx="335" cy="210" rx="12" ry="30" fill="#8e44ad"/>
        <text class="zone-label" x="370" y="210" text-anchor="start" id="zl-pharyngeal">Pharyngeal حَلْق</text>

        <!-- Glottal -->
        <ellipse class="zone" id="z-glottal" cx="325" cy="320" rx="15" ry="20" fill="#c0392b"/>
        <text class="zone-label" x="370" y="320" text-anchor="start" id="zl-glottal">Glottal حَلْق أَقْصَى</text>

        <!-- Sibilant (tongue tip to lower teeth) -->
        <ellipse class="zone" id="z-sibilant" cx="178" cy="240" rx="12" ry="10" fill="#16a085"/>
        <text class="zone-label" x="115" y="248" text-anchor="end" id="zl-sibilant">Sibilant صَفِيرِيَّة</text>

        <!-- Letters in zone display -->
        <text id="zone-letters-display" x="250" y="390" text-anchor="middle" fill="#d4a843" font-size="16"></text>
      </svg>
    </div>

    <!-- Top-down mouth map -->
    <div class="diagram-container">
      <h3>المَنْظَر العُلْوِي — Top-Down Mouth Map</h3>
      <svg id="topdown-svg" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
        <!-- Concentric zones from outside (lips) to inside (glottis) -->
        <!-- Outer ring: Lips -->
        <ellipse cx="200" cy="180" rx="180" ry="170" fill="none" stroke="#333" stroke-width="1.5"/>
        <!-- Teeth line -->
        <ellipse cx="200" cy="180" rx="155" ry="145" fill="none" stroke="#444" stroke-width="1" stroke-dasharray="4,3"/>

        <!-- Zone rings (clickable) -->
        <ellipse class="zone" id="ztd-lips" cx="200" cy="180" rx="175" ry="165" fill="#3498db" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-dental" cx="200" cy="180" rx="145" ry="135" fill="#e67e22" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-alveolar" cx="200" cy="180" rx="120" ry="110" fill="#9b59b6" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-palatal" cx="200" cy="180" rx="95" ry="85" fill="#1abc9c" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-velar" cx="200" cy="180" rx="70" ry="60" fill="#f39c12" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-pharyngeal" cx="200" cy="180" rx="45" ry="38" fill="#8e44ad" style="opacity:0.08"/>
        <ellipse class="zone" id="ztd-glottal" cx="200" cy="180" rx="22" ry="18" fill="#c0392b" style="opacity:0.1"/>

        <!-- Zone labels (curved around center) -->
        <text x="200" y="26" text-anchor="middle" fill="#3498db" font-size="11">شَفَتَان Lips</text>
        <text x="200" y="56" text-anchor="middle" fill="#e67e22" font-size="10">أَسَلِيَّة Dental</text>
        <text x="200" y="82" text-anchor="middle" fill="#9b59b6" font-size="10">ذَلْقِيَّة Alveolar</text>
        <text x="200" y="108" text-anchor="middle" fill="#1abc9c" font-size="10">شَجَرِيَّة Palatal</text>
        <text x="200" y="132" text-anchor="middle" fill="#f39c12" font-size="9">لَهَوِيَّة Velar/Uvular</text>
        <text x="200" y="155" text-anchor="middle" fill="#8e44ad" font-size="9">حَلْق Pharyngeal</text>
        <text x="200" y="178" text-anchor="middle" fill="#c0392b" font-size="9">حَلْق أَقْصَى Glottal</text>

        <!-- Letter positions will be placed by JS -->
        <g id="topdown-letters"></g>

        <!-- Bottom label -->
        <text x="200" y="385" text-anchor="middle" fill="#666" font-size="10">Lips = outermost &bull; Glottis = innermost</text>
      </svg>
    </div>
  </div>

  <!-- Zone detail panel -->
  <div id="zone-detail" style="max-width:800px; margin:15px auto; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:15px; display:none;">
    <h3 id="zd-title" style="color:var(--gold); margin-bottom:10px;"></h3>
    <div id="zd-letters" style="display:flex; gap:10px; flex-wrap:wrap; justify-content:center;"></div>
  </div>

  <!-- Articulation animation (cloned into this tab) -->
  <div id="makhraj-anim-container" style="display:none; max-width:1000px; margin:20px auto;">
    <div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;">
      <h3 style="color:var(--gold); font-size:1em;">تَحْرِيك النُّطْق — Articulation Animation</h3>
      <div>
        <button id="makhraj-anim-play" onclick="playArticulationMakhraj()" style="background:var(--gold);color:var(--bg);border:none;padding:6px 16px;border-radius:var(--radius);cursor:pointer;font-family:inherit;font-size:0.85em;">
          ▶ Play
        </button>
        <button onclick="playArticulationMakhraj()" style="background:var(--bg3);color:var(--text-dim);border:1px solid var(--border);padding:6px 12px;border-radius:var(--radius);cursor:pointer;font-family:inherit;font-size:0.85em;margin-right:5px;">
          ↻ Replay
        </button>
      </div>
    </div>
    <div style="display:flex; gap:20px; flex-wrap:wrap;">
      <svg id="makhraj-anim-svg" viewBox="0 0 500 380" xmlns="http://www.w3.org/2000/svg"
           style="background:var(--bg3); border-radius:var(--radius); border:1px solid var(--border); flex:1; min-width:350px; max-width:550px;">
        <!-- Head outline -->
        <path d="M200,30 C280,30 350,60 370,120 C390,180 380,220 360,260 L340,300 L320,340 L280,360 L240,365 L200,360 L170,345 L150,320 L140,280 L135,240 L130,200 L140,140 L160,80 Z"
              fill="none" stroke="#444" stroke-width="2"/>
        <path d="M200,80 C220,75 260,78 290,90 L285,105 C260,95 225,92 200,95 Z" fill="#1a1a2e" stroke="#333" stroke-width="1"/>
        <path d="M195,100 C225,88 260,90 290,100" fill="none" stroke="#555" stroke-width="2.5"/>
        <path d="M290,100 C310,110 325,130 330,155 L325,165 C320,140 305,120 290,110 Z" fill="#1a1a2e" stroke="#555" stroke-width="1.5"/>
        <path d="M330,155 C340,180 345,220 340,260 L335,300" fill="none" stroke="#444" stroke-width="2"/>
        <path d="M310,310 L330,295 L340,310 L335,335 L310,340 Z" fill="#1a1a2e" stroke="#444" stroke-width="1.5"/>
        <path id="ma-upper-lip" d="M145,185 C150,178 155,175 160,178" fill="none" stroke="#888" stroke-width="3" stroke-linecap="round"/>
        <path id="ma-lower-lip" d="M145,215 C150,222 155,225 160,222" fill="none" stroke="#888" stroke-width="3" stroke-linecap="round"/>
        <path id="ma-tongue" d="M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190"
              fill="#2a2a3e" stroke="#666" stroke-width="2"/>
        <line x1="168" y1="148" x2="168" y2="168" stroke="#777" stroke-width="3" stroke-linecap="round"/>
        <line x1="175" y1="146" x2="173" y2="166" stroke="#777" stroke-width="2.5"/>
        <line x1="166" y1="248" x2="166" y2="232" stroke="#777" stroke-width="3" stroke-linecap="round"/>
        <line x1="174" y1="250" x2="172" y2="234" stroke="#777" stroke-width="2.5"/>
        <g id="ma-airflow" style="opacity:0;">
          <path d="M320,280 L300,250 L280,230" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead2)"/>
          <path d="M280,230 L240,210 L200,200" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead2)"/>
          <path d="M160,200 L130,200 L100,200" fill="none" stroke="#e67e22" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#arrowhead2)"/>
        </g>
        <g id="ma-burst" style="opacity:0;">
          <line x1="130" y1="195" x2="90" y2="185" stroke="#e67e22" stroke-width="2"/>
          <line x1="130" y1="200" x2="80" y2="200" stroke="#e67e22" stroke-width="2"/>
          <line x1="130" y1="205" x2="90" y2="215" stroke="#e67e22" stroke-width="2"/>
          <line x1="130" y1="190" x2="100" y2="175" stroke="#e67e22" stroke-width="1.5"/>
          <line x1="130" y1="210" x2="100" y2="225" stroke="#e67e22" stroke-width="1.5"/>
        </g>
        <circle id="ma-contact" cx="152" cy="200" r="8" fill="none" stroke="#d4a843" stroke-width="2" style="opacity:0;"/>
        <defs>
          <marker id="arrowhead2" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
            <polygon points="0,0 8,3 0,6" fill="#e67e22"/>
          </marker>
        </defs>
        <text id="ma-phase-label" x="250" y="30" text-anchor="middle" fill="#d4a843" font-size="14" style="opacity:0;"></text>
        <ellipse id="ma-makhraj-zone" cx="152" cy="200" rx="20" ry="30" fill="#d4a843" style="opacity:0;"/>
      </svg>
      <div id="ma-desc" style="flex:1; min-width:200px; max-width:350px; background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius); padding:15px;">
        <div id="ma-step-title" style="color:var(--gold); font-size:1em; margin-bottom:8px;">Select a letter</div>
        <div id="ma-step-desc" style="color:var(--text-dim); font-size:0.85em; line-height:1.5;">
          Click a letter in the zone detail above, then press Play to see its articulation.
        </div>
        <div id="ma-step-num" style="margin-top:15px; display:flex; gap:5px;"></div>
      </div>
    </div>
  </div>
</div>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 3: HARAKAT / TASHKEEL -->
<!-- ═══════════════════════════════════════════ -->
<div id="harakat-section" class="section">
  <div class="section-title" data-i18n="harakat_title">حَرَكَات وَتَشْكِيل — Vowel Marks &amp; Diacritics</div>
  <p style="text-align:center; color:var(--text-dim); margin-bottom:20px;">
    The marks that give letters their voice. Without حَرَكَات, consonants are silent bones. With them, they speak.
  </p>
  <div class="harakat-grid" id="harakat-grid"></div>

  <div class="section-title" style="margin-top:40px;" data-i18n="tanwin_h">تَنْوِين — Nunation (Indefinite Markers)</div>
  <div class="harakat-grid" id="tanwin-grid"></div>

  <div class="section-title" style="margin-top:40px;" data-i18n="extra_h">عَلَامَات إِضَافِيَّة — Additional Marks</div>
  <div class="harakat-grid" id="extra-marks-grid"></div>
</div>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 4: DOTS & GEOMETRY -->
<!-- ═══════════════════════════════════════════ -->
<div id="dots-section" class="section">
  <div class="section-title" data-i18n="dots_families">نُقَط الحُرُوف — Dot Families &amp; Geometric Identity</div>
  <p style="text-align:center; color:var(--text-dim); margin-bottom:20px;">
    Same base shape, different dots = different letter. The dot is the differentiator of identity.
  </p>
  <div class="dot-families" id="dot-families"></div>

  <div class="section-title" style="margin-top:40px;" data-i18n="dots_geo">الشَّكْل الهَنْدَسِي — Geometric Forms</div>
  <p style="text-align:center; color:var(--text-dim); margin-bottom:20px;">
    Each letter: form + abjad value + divisibility by 7 (٤٦٢ = ٧ × ٦٦ = ٧ × الله)
  </p>
  <div class="geo-grid" id="geo-grid"></div>
</div>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 5: ABJAD TABLE -->
<!-- ═══════════════════════════════════════════ -->
<div id="abjad-section" class="section">
  <div class="section-title" data-i18n="abjad_title">القِيَم الأَبْجَدِيَّة — Abjad Numerical Values</div>
  <div class="abjad-table-wrap">
    <table class="abjad-table" id="abjad-table">
      <thead>
        <tr>
          <th>الحَرْف</th><th>الاسم</th><th>Transliteration</th><th>القِيمَة / Value</th><th>÷ 7</th><th>المَجْمُوعَة / Group</th>
        </tr>
      </thead>
      <tbody id="abjad-tbody"></tbody>
    </table>
  </div>
  <div style="text-align:center; margin-top:20px; padding:15px; background:var(--bg2); border-radius:var(--radius); max-width:600px; margin-left:auto; margin-right:auto;">
    <div style="color:var(--gold); font-size:1.2em;">مَجْمُوع الأَبْجَد — Total Abjad Sum</div>
    <div style="font-size:3em; color:var(--green); font-family:monospace; direction:ltr;" id="abjad-total"></div>
    <div style="color:var(--text-dim); font-size:0.85em;" id="abjad-total-div7"></div>
  </div>
</div>

<!-- ═══════════════════════════════════════════ -->
<!-- SECTION 6: ROOT CALCULATOR -->
<!-- ═══════════════════════════════════════════ -->
<div id="calc-section" class="section">
  <div class="section-title" data-i18n="calc_title">حِسَاب مَعْنَى الجَذْر — Root Meaning Calculator</div>
  <p style="text-align:center; color:var(--text-dim); margin-bottom:10px;">
    Enter 2-4 root letters. The calculator derives meaning from each letter's abjad value, semantic tendency, and positional behaviour.
  </p>
  <div class="calc-container">
    <div class="calc-input-row">
      <input type="text" id="root-1" maxlength="1" placeholder="ف" dir="rtl">
      <span class="separator">-</span>
      <input type="text" id="root-2" maxlength="1" placeholder="ع" dir="rtl">
      <span class="separator">-</span>
      <input type="text" id="root-3" maxlength="1" placeholder="ل" dir="rtl">
      <span class="separator">-</span>
      <input type="text" id="root-4" maxlength="1" placeholder="" dir="rtl" style="opacity:0.5;">
    </div>
    <div style="text-align:center;">
      <button class="calc-btn" onclick="computeRoot()">اِحْسِبْ — Compute</button>
    </div>
    <div id="calc-result">
      <div class="calc-formula" id="cr-formula"></div>
      <div class="calc-letter-analysis" id="cr-letters"></div>
      <div class="calc-semantic" id="cr-semantic"></div>
      <div id="cr-positional" style="margin-top:15px;"></div>
    </div>
  </div>
</div>

<footer>
  أَمْر Phase 0 — حُرُوف لِسَان الله — Data from <span class="latin">amr_alphabet.py</span> (77,881 Qur'anic word tokens, 1,680 roots)
</footer>

<script>
// ═══════════════════════════════════════════════════════════════
// DATA — loaded from amr_alphabet.py export
// ═══════════════════════════════════════════════════════════════
const AMR_DATA = {"ALPHABET":{"ء":{"name":"هَمْزَة","transliteration":"hamza","abjad":1,"phonetic":{"makhraj":"أَقْصَى الحَلْق — deepest point of the throat (glottal)","manner":"Glottal stop. Complete closure of the vocal cords, then abrupt release. The MOST INTERNAL articulation — deeper than any other consonant.","voiced":false,"emphatic":false,"description":"Hamza is the glottal stop — the catch in the throat before a vowel. It is NOT alif. Alif is the CARRIER; hamza is the SOUND. Hamza initiates the highest-frequency roots: أ-ل-ه (2930), أ-م-ن (832), أ-ت-ي (385), أ-م-ر (223), أ-خ-ذ (217). The glottal stop = the FIRST act of speech — before any vowel can sound, the glottis must open. Hamza IS that opening."},"classification":{"sun_moon":"Neither — hamza is not a solar or lunar letter; it precedes the article.","type":"Glottal stop","group":"حُرُوف الحَلْق — throat letters (deepest)"},"behaviour":{"as_first_radical":"THE most important position. Roots with hamza as first radical carry the foundational concepts: أ-ل-ه (divinity, 2930), أ-م-ن (security, 832), أ-ي-ي (signs, 388), أ-ت-ي (coming, 385), أ-م-ر (command, 223), أ-خ-ذ (taking, 217), أ-ر-ض (earth, 465). Hamza as opener = PRIMORDIAL — the first sound initiates the deepest concepts.","as_second_radical":"Rare. س-أ-ل (asking, 68), ر-أ-ي (seeing, 135). As core, hamza provides INTERRUPTION — a glottal pause at the root's heart.","as_third_radical":"ج-ي-أ (coming, 149), ش-ي-أ (thing, 355), ب-د-أ (beginning, 10). As closer, hamza CUTS — the word ends in an abrupt glottal closure.","as_prefix":"أَ = interrogative prefix (أَلَمْ = did not?). أُ = first person singular imperfect in Form IV (أُرْسِلُ = I send).","as_suffix":"ـأ = rare final hamza (بَدَأَ = he began)."},"shifts":[{"downstream":"(drop)","shift_id":"HAMZA","note":"Hamza drops entirely in most DS corridors"},{"downstream":"(vowel)","shift_id":"HAMZA-DROP","note":"Hamza resolves to a bare vowel"}],"quranic_stats":{"tokens_any_position":null,"distinct_roots_any":null,"roots_as_first":null,"top5_first":[["أ-ل-ه",2930],["أ-م-ن",832],["أ-ر-ض",465],["أ-ي-ي",388],["أ-ت-ي",385]],"top5_second":[["ر-أ-ي",135],["س-أ-ل",68]],"top5_third":[["ش-ي-أ",355],["ج-ي-أ",149],["ب-د-أ",10]],"muqattaat":[],"note":"Hamza statistics overlap with alif (ا) — roots like أ-ل-ه are catalogued under alif in the compiler but the first radical is hamza phonetically. The top5_first list here represents the TRUE hamza-initial roots."},"semantic_tendency":"STOP. INITIATION. THE FIRST ACT. Hamza begins the most fundamental concepts: divinity (أ-ل-ه), security (أ-م-ن), command (أ-م-ر), creation (أ-ر-ض = earth). The glottal stop = the first physical act of speech = the beginning of everything.","paired_letters":{"ل (lām)":"أ-ل = origin + flow (أ-ل-ه divinity). The divine = origin flowing.","م (mīm)":"أ-م = origin + seal (أ-م-ن security, أ-م-ر command). Sealed origin = certainty.","خ (khāʾ)":"أ-خ = origin + passage (أ-خ-ذ taking). Taking = passing from origin."},"unique":"Abjad 1 (shared with its carrier alif). Hamza initiates أ-ل-ه (2930) — the HIGHEST-frequency root in the Qur'an. It is the FIRST sound. In the أَمْر system, ء = the initializer — the system boot, the first instruction."},"ا":{"name":"أَلِف","transliteration":"alif","abjad":1,"phonetic":{"makhraj":"أَقْصَى الحَلْق — deepest point of the throat (furthest cavity)","manner":"Glottal opener. Not a consonant in the articulated sense — it is the CARRIER of the hamza (ء) and the vessel for long vowels (ā). It opens the airway. It is the BEGINNING.","voiced":true,"emphatic":false,"description":"Alif is the vertical stroke — the ONE. Abjad value 1 = unity. It does not articulate against any surface; it is the pure opening of the throat. In Qur'anic morphology it serves as: (1) carrier of hamza at word-initial position, (2) long vowel marker (ā), (3) the alif of waṣl (connecting alif in definite article ال). It has NO downstream shift — no DS language has alif. They inherit only what alif carries (the hamza or the vowel), never alif itself."},"classification":{"sun_moon":"Neither — alif is not a solar or lunar letter; it is the carrier of the definite article but does not assimilate with it.","type":"Glottal / Vowel carrier","group":"حُرُوف الحَلْق — throat letters"},"behaviour":{"as_first_radical":"Rare as true first radical (5 roots, 87 tokens). When ا opens a root, it marks PRIMORDIAL concepts: ا-ل-ه (divinity, 2930 tokens via أ-ل-ه), ا-ن-س (humanity/familiarity). The alif-initial root points to ORIGINS.","as_second_radical":"Extremely rare (3 roots). ا in the middle = the root's core is a VOWEL — openness, space, air.","as_third_radical":"Rare (2 roots). ا at the end = the root terminates in openness, trailing away.","as_prefix":"Hamzat al-waṣl (ٱ): definite article carrier. Hamzat al-qaṭʿ (أَ): interrogative marker (أَلَمْ = did not?). First-person singular imperfect prefix (أَعْلَمُ = I know).","as_suffix":"Dual marker (ا as part of ان). Alif maqṣūra (ى pronounced ā) marks certain verb endings and proper nouns."},"shifts":[{"downstream":"(drop)","shift_id":"HAMZA","note":"Hamza carried by alif drops entirely in DS languages"},{"downstream":"(vowel)","shift_id":"HAMZA-DROP","note":"Hamza resolves to a bare vowel sound"}],"quranic_stats":{"tokens_any_position":173,"distinct_roots_any":10,"roots_as_first":5,"top5_first":[["ا-ل-س",36],["ا-ن-س",28],["ا-و-ب",12],["ا-ز-ر",6],["ا-ج-ج",5]],"top5_second":[["م-ا-ء",8],["ه-ا-ت",6],["ه-ا-ء",3]],"top5_third":[["س-ر-ا",42],["ر-ي-ا",27]],"muqattaat":[],"note":"Alif's true Qur'anic weight is HIDDEN in these numbers — ا carries the hamza in roots like أ-ل-ه (2930), أ-م-ن (832), أ-ت-ي (385), أ-م-ر (223), أ-خ-ذ (217). These are catalogued under hamza (ء) in the ALPHABET dict, but alif is the VESSEL. See ء entry for hamza-initial root statistics."},"semantic_tendency":"OPENING. UNITY. BEGINNING. Alif opens. Abjad 1 = the ONE. Roots with alif/hamza as first radical point to fundamental concepts: divinity (أ-ل-ه), security (أ-م-ن), command (أ-م-ر), coming (أ-ت-ي), taking (أ-خ-ذ), humanity (أ-ن-س).","paired_letters":{"ل (lām)":"أ-ل = the definite article ال. The most frequent pairing in all of AA. Alif (origin/unity) + lām (connection) = THE definite marker.","م (mīm)":"أ-م = the mother principle. أُمّ (mother), أَمْن (security), أَمْر (command). Alif (unity) + mīm (enclosure) = what encloses from the beginning.","ن (nūn)":"أ-ن = the self-declaration. أَنَا (I), أَنَّ (that/indeed). Alif (unity) + nūn (continuation) = the self continuing."},"unique":"Abjad value 1. The ONLY letter that is a pure vertical stroke. The only letter with no articulation point in the mouth — it is the opening of the throat itself. Every word begins with a breath, and alif IS that breath. In the أَمْر system, ا = the boot sequence — the system opens."},"ب":{"name":"بَاء","transliteration":"bāʾ","abjad":2,"phonetic":{"makhraj":"الشَّفَتَان — the two lips (bilabial)","manner":"Plosive. Both lips close completely, then release. The FIRST articulated consonant — lips are the outermost gate.","voiced":true,"emphatic":false,"description":"Bāʾ is the first letter that requires physical contact — lips touching. If alif is the opening of the throat (internal), bāʾ is the first EXTERNAL articulation. Abjad 2 = duality, pair (the two lips). It is the letter of BUILDING — things constructed from parts touching."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate with ال","type":"Voiced bilabial plosive","group":"حُرُوف الشَّفَتَيْن — lip letters"},"behaviour":{"as_first_radical":"88 roots, 2194 tokens. Opens roots of CONSTRUCTION and CLARITY: ب-ي-ن (to make clear, 282), ب-ع-د (distance, 236), ب-ن-ي (to build, 128), ب-ش-ر (human skin/glad tidings, 124), ب-ص-ر (to see, 100). When ب opens, it BUILDS or SHOWS.","as_second_radical":"ر-ب-ب (to nurture, 907 — the HIGHEST), ق-ب-ل (to accept, 291), ع-ب-د (to devote, 265), س-ب-ل (a path, 177), ت-ب-ع (to follow, 166). As the core of a root, ب provides CONTINUITY — nurturing, following, accepting.","as_third_radical":"ر-ب-ب (907), ع-ذ-ب (denial of sweetness, 373), ك-ت-ب (to write, 311), ك-ذ-ب (to deny, 282), ق-ل-ب (to turn/heart, 166). As closer, ب SEALS — it closes with an emphatic bilabial stop.","as_prefix":"بِ = the preposition \"by/with/in.\" Q96:1 بِٱسْمِ = \"in/by the name of.\" The ب of instrumentality — HOW something is done.","as_suffix":"Not typically a suffix letter."},"shifts":[{"downstream":"b","shift_id":"S09","note":"Preserved in most DS corridors"},{"downstream":"p","shift_id":"S09","note":"Devoicing: ب→p. Common in DS05 (Latin), Bitig"},{"downstream":"v","shift_id":"S09","note":"Fricativisation: ب→v. Common in DS05"}],"quranic_stats":{"tokens_any_position":8322,"distinct_roots_any":296,"roots_as_first":88,"top5_first":[["ب-ي-ن",282],["ب-ع-د",236],["ب-ن-ي",128],["ب-ش-ر",124],["ب-ص-ر",100]],"top5_second":[["ر-ب-ب",907],["ق-ب-ل",291],["ع-ب-د",265],["س-ب-ل",177],["ت-ب-ع",166]],"top5_third":[["ر-ب-ب",907],["ع-ذ-ب",373],["ك-ت-ب",311],["ك-ذ-ب",282],["ق-ل-ب",166]],"muqattaat":[]},"semantic_tendency":"CLOSURE. CONSTRUCTION. CONTACT. CLARITY. ب is the letter of things that TOUCH and BUILD: ب-ن-ي (building), ب-ي-ن (clarifying by separating), ب-ص-ر (seeing = light touching the eye). The two lips touch = two things brought together = construction.","paired_letters":{"ن (nūn)":"ب-ن = to build (ب-ن-ي). Lips (ب) + continuation (ن) = construction that continues.","ي (yāʾ)":"ب-ي = house/between (ب-ي-ت/ب-ي-ن). The built enclosure or the space between.","ر (rāʾ)":"ب-ر = land/righteousness (ب-ر-ر). Building outward = open land, goodness."},"unique":"Abjad 2 = duality. The two lips = the first PAIR. ب is the letter of بِسْمِ — the very first letter uttered in the Qur'an after the opening. بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ begins with ب. In the أَمْر system, ب = the construction operator — what builds structures."},"ت":{"name":"تَاء","transliteration":"tāʾ","abjad":400,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا العُلْيَا — tip of tongue against upper front teeth roots","manner":"Voiceless dental plosive. Tongue tip strikes upper teeth base, releases sharply. The NON-emphatic partner of ط (ṭāʾ). Where ط is heavy/deep, ت is light/sharp.","voiced":false,"emphatic":false,"description":"Tāʾ is the light dental stop. Abjad 400 — high value for a light letter. It marks FOLLOWING and SUCCESSION — things that come AFTER. ت-ب-ع (to follow), ت-و-ب (to return/repent = to follow back). As a prefix it marks second person (أَنْتَ تَعْلَمُ = you know) and feminine (كَتَبَتْ = she wrote)."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates with ال: التَّوْبَة","type":"Voiceless dental plosive","group":"حُرُوف أَسَلِيَّة — tongue-tip letters"},"behaviour":{"as_first_radical":"20 roots. Opens FOLLOWING/SUCCESSION: ت-ب-ع (to follow, 166), ت-و-ب (to return, 106), ت-ل-و (to recite/follow, 71), ت-ج-ر (commerce, 61). When ت opens, it marks what COMES AFTER.","as_second_radical":"أ-ت-ي (to come/arrive, 385), ك-ت-ب (to write/prescribe, 311), ق-ت-ل (to fight, 164). As core, ت provides the STRIKING action — the sharp dental contact = impact, arrival, inscription.","as_third_radical":"م-و-ت (to die, 148), ب-ي-ت (house, 77), ت-ح-ت (beneath, 56). As closer, ت CUTS OFF — the sharp stop ends the word decisively.","as_prefix":"Second person imperfect: تَفْعَلُ (you do). Feminine marker: كَتَبَتْ (she wrote). Verbal noun pattern: تَفْعِيل (intensification).","as_suffix":"تْ = feminine past tense marker. تُ = first person past (كَتَبْتُ = I wrote)."},"shifts":[{"downstream":"t","shift_id":"S24","note":"Preserved as t in most DS corridors"}],"quranic_stats":{"tokens_any_position":2710,"distinct_roots_any":97,"roots_as_first":20,"top5_first":[["ت-ب-ع",166],["ت-و-ب",106],["ت-ل-و",71],["ت-ج-ر",61],["ت-ح-ت",56]],"top5_second":[["أ-ت-ي",385],["ك-ت-ب",311],["ق-ت-ل",164],["ء-ت-ي",116],["م-ت-ع",67]],"top5_third":[["م-و-ت",148],["ب-ي-ت",77],["ت-ح-ت",56],["ف-و-ت",40],["م-ر-ت",26]],"muqattaat":[]},"semantic_tendency":"SNAP. FOLLOWING. SHARP ACTION. ت marks what comes AFTER — following (ت-ب-ع), returning (ت-و-ب), reciting (ت-ل-و = following the text). The sharp dental strike = decisive action.","paired_letters":{"ب (bāʾ)":"ت-ب = following + building (ت-ب-ع). To follow is to build upon what came before.","و (wāw)":"ت-و = succession + connection (ت-و-ب). Returning = reconnecting after succession.","ل (lām)":"ت-ل = succession + flow (ت-ل-و). Recitation = following the flow."},"unique":"Abjad 400. The feminine marker of AA — grammatical gender lives in ت. As prefix (تَ) it addresses YOU directly (second person). In the أَمْر system, ت = the iterator — what follows, what comes next."},"ث":{"name":"ثَاء","transliteration":"thāʾ","abjad":500,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أَطْرَاف الثَّنَايَا العُلْيَا — tongue tip between upper/lower front teeth","manner":"Voiceless interdental fricative. Tongue tip protrudes slightly between teeth, air passes as friction. The NON-emphatic partner of ظ (ẓāʾ).","voiced":false,"emphatic":false,"description":"Thāʾ is the lightest interdental. Abjad 500. The tongue protrudes between the teeth — exposed, vulnerable. ث roots deal with WEIGHT, MULTIPLICATION, REMAINS: ث-ل-ث (three/third), ث-ق-ل (heaviness), ث-م-ر (fruit = product of growth)."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates with ال: الثَّمَر","type":"Voiceless interdental fricative","group":"حُرُوف لَثَوِيَّة — interdental letters"},"behaviour":{"as_first_radical":"20 roots. Opens MULTIPLICATION/WEIGHT: ث-ل-ث (three, 32), ث-ق-ل (heavy, 28), ث-م-د (Thamūd, 26), ث-م-ر (fruit, 24), ث-و-ب (garment/reward, 21). When ث opens, it marks what MULTIPLIES or WEIGHS.","as_second_radical":"ك-ث-ر (many/abundance, 166), م-ث-ل (likeness/example, 119), أ-ث-م (sin, 60), و-ث-ق (trust/bind, 33). As core, ث provides DENSITY — thickness, multiplicity, heaviness.","as_third_radical":"ب-ع-ث (to raise/resurrect, 67), ح-د-ث (event/new, 36). As closer, ث trails off — the interdental lets the word DISSIPATE.","as_prefix":"Not a prefix letter.","as_suffix":"Not a typical suffix."},"shifts":[{"downstream":"th","shift_id":"S26","note":"Preserved as th in DS05 corridor"}],"quranic_stats":{"tokens_any_position":943,"distinct_roots_any":63,"roots_as_first":20,"top5_first":[["ث-ل-ث",32],["ث-ق-ل",28],["ث-م-د",26],["ث-م-ر",24],["ث-و-ب",21]],"top5_second":[["ك-ث-ر",166],["م-ث-ل",119],["أ-ث-م",60],["و-ث-ق",33],["أ-ث-ر",22]],"top5_third":[["ب-ع-ث",67],["ح-د-ث",36],["ث-ل-ث",32],["و-ر-ث",31],["ل-ب-ث",31]],"muqattaat":[]},"semantic_tendency":"THINNING. DENSITY. WEIGHT. REMAINS. ث marks what accumulates: ك-ث-ر (many), ث-ق-ل (heavy), ث-م-ر (fruit = accumulated growth), و-ر-ث (inheritance = what remains).","paired_letters":{"ل (lām)":"ث-ل = multiplication + flow (ث-ل-ث = three). The first number beyond duality.","ق (qāf)":"ث-ق = weight + force (ث-ق-ل = heavy). Density meeting deep articulation.","م (mīm)":"ث-م = density + enclosure (ث-م-ر = fruit). Growth enclosed and multiplied."},"unique":"Abjad 500. The interdental that DS languages LOSE first — English preserves it (th) but most DS corridors collapse ث→t or ث→s. In the أَمْر system, ث = the multiplier — what produces abundance."},"ج":{"name":"جِيم","transliteration":"jīm","abjad":3,"phonetic":{"makhraj":"وَسَط اللِّسَان مَعَ الحَنَك الأَعْلَى — middle of tongue against upper palate","manner":"Voiced palatal affricate. Tongue body rises to palate, releases with friction. The voiced partner of ش (shīn) in articulation zone.","voiced":true,"emphatic":false,"description":"Jīm is the palatal voiced affricate. Abjad 3 = the first odd number after 1. Three = the triangle, the first stable structure. ج roots deal with GATHERING, MAKING, COMING: ج-ع-ل (to make/set, 345), ج-ن-ن (to conceal, 172), ج-م-ع (to gather, 129)."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الجَنَّة","type":"Voiced palatal affricate","group":"حُرُوف شَجَرِيَّة — palatal letters"},"behaviour":{"as_first_radical":"68 roots. Opens MAKING/GATHERING/CONCEALING: ج-ع-ل (to make, 345), ج-ن-ن (to conceal, 172), ج-ي-أ (to come, 149), ج-م-ع (to gather, 129). When ج opens, it BRINGS TOGETHER or MAKES.","as_second_radical":"ر-ج-ع (to return, 103), أ-ج-ر (reward, 98), و-ج-د (to find, 97), س-ج-د (to prostrate, 93). As core, ج is the PIVOT — the turning point.","as_third_radical":"خ-ر-ج (to exit/extract, 170), ز-و-ج (pair, 85), و-ل-ج (to enter, 21). As closer, ج COMPLETES by gathering/joining.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"g","shift_id":"S02","note":"ج→g in most DS corridors (hard g)"},{"downstream":"j","shift_id":"S02","note":"ج→j in DS05 and some Bitig corridors"}],"quranic_stats":{"tokens_any_position":3258,"distinct_roots_any":145,"roots_as_first":68,"top5_first":[["ج-ع-ل",345],["ج-ن-ن",172],["ج-ي-أ",149],["ج-م-ع",129],["ج-ي-ء",111]],"top5_second":[["ر-ج-ع",103],["أ-ج-ر",98],["و-ج-د",97],["س-ج-د",93],["و-ج-ه",87]],"top5_third":[["خ-ر-ج",170],["ز-و-ج",85],["و-ل-ج",21],["د-ر-ج",20],["ح-و-ج",16]],"muqattaat":[]},"semantic_tendency":"PRESS. MAKING. CONCEALING. ARRIVAL. ج brings things together: ج-م-ع (gather), ج-ع-ل (make/place), ج-ن-ن (conceal = gather into hiddenness). Abjad 3 = first stable structure (triangle).","paired_letters":{"ع (ʿayn)":"ج-ع = making + depth (ج-ع-ل). To make something requires reaching deep.","ن (nūn)":"ج-ن = gathering + continuation (ج-ن-ن). What is concealed continues hidden.","م (mīm)":"ج-م = gathering + enclosure (ج-م-ع). To collect into a contained whole."},"unique":"Abjad 3. The MAKER letter. ج-ع-ل is the second most frequent verb root used for Allah's creative action after خ-ل-ق. ج-ع-ل = to MAKE/SET (appoint), خ-ل-ق = to CREATE (from nothing). In the أَمْر system, ج = the assembler — what gathers parts into wholes."},"ح":{"name":"حَاء","transliteration":"ḥāʾ","abjad":8,"phonetic":{"makhraj":"وَسَط الحَلْق — middle of the throat (pharyngeal)","manner":"Voiceless pharyngeal fricative. Air passes through the constricted pharynx without voicing. The voiceless partner of ع (ʿayn). NO DS language has this sound — it is UNIQUE to AA.","voiced":false,"emphatic":false,"description":"Ḥāʾ is the voiceless pharyngeal. Abjad 8. From the middle of the throat — deeper than the mouth, not as deep as hamza. ح roots deal with TRUTH, JUDGEMENT, LIFE, BEAUTY: ح-ق-ق (truth/binding, 263), ح-ك-م (rule/wisdom, 195), ح-س-ن (beauty/goodness, 189), ح-ي-ي (life, 153). The pharyngeal squeeze = PRESSURE that tests and refines."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الحَقّ","type":"Voiceless pharyngeal fricative","group":"حُرُوف الحَلْق — throat letters"},"behaviour":{"as_first_radical":"95 roots. Opens TRUTH/LIFE/BEAUTY/JUDGEMENT: ح-ق-ق (truth, 263), ح-ك-م (rule, 195), ح-س-ن (good, 189), ح-ي-ي (life, 153), ح-س-ب (reckon, 106). When ح opens, it tests and establishes what is TRUE.","as_second_radical":"ر-ح-م (womb/mercy, 553 — MASSIVE), ص-ح-ب (companion, 97), و-ح-ي (revelation, 78), أ-ح-د (one/unique, 78). As core, ح provides the WARMTH — the pharyngeal heat that nurtures.","as_third_radical":"ص-ل-ح (righteousness, 177), س-ب-ح (glorification, 91), ن-و-ح (Nūḥ, 48), ر-و-ح (spirit, 48). As closer, ح seals with BREATH — the spirit exhalation.","as_prefix":"Not a standard prefix in verbal morphology.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"h","shift_id":"S03","note":"ح→h (weakened to plain h, pharyngeal quality lost)"},{"downstream":"c","shift_id":"S03","note":"ح→c in some DS05 Latin corridor words"}],"quranic_stats":{"tokens_any_position":4036,"distinct_roots_any":193,"roots_as_first":95,"top5_first":[["ح-ق-ق",263],["ح-ك-م",195],["ح-س-ن",189],["ح-ي-ي",153],["ح-س-ب",106]],"top5_second":[["ر-ح-م",553],["ص-ح-ب",97],["و-ح-ي",78],["أ-ح-د",78],["و-ح-د",75]],"top5_third":[["ص-ل-ح",177],["س-ب-ح",91],["ن-و-ح",48],["ر-و-ح",48],["ص-ب-ح",45]],"muqattaat":["حم — Surahs 40,41,42,43,44,45,46 (the حم series)"]},"semantic_tendency":"CONSTRICTION. LIFE. JUDGEMENT. BEAUTY. WARMTH. ح is the letter of what is REAL and ALIVE. حَقّ (truth), حَيَاة (life), حُسْن (beauty), حِكْمَة (wisdom). The pharyngeal warmth = the heat of life itself. ر-ح-م (553 tokens) — the WOMB — is ح at its core: warmth that nurtures.","paired_letters":{"ق (qāf)":"ح-ق = truth + force (ح-ق-ق). What is binding and established.","ك (kāf)":"ح-ك = life + containment (ح-ك-م). Judgement = life-force contained in rules.","س (sīn)":"ح-س = warmth + flow (ح-س-ن). Beauty = warmth flowing."},"unique":"Abjad 8. NO DS language has ح. It collapses to h (losing pharyngeal quality) or c. The حم muqaṭṭaʿāt series (7 surahs) = ح paired with م = warmth + enclosure. In the أَمْر system, ح = the validator — what tests truth and establishes binding state."},"خ":{"name":"خَاء","transliteration":"khāʾ","abjad":600,"phonetic":{"makhraj":"أَدْنَى الحَلْق — nearest part of the throat to the mouth (uvular)","manner":"Voiceless uvular/velar fricative. Air passes over the raised back of tongue near the uvula. The voiceless partner of غ (ghayn).","voiced":false,"emphatic":false,"description":"Khāʾ is the voiceless uvular fricative. Abjad 600. From the back of the throat but nearer the mouth than ح — it is the EXIT from the throat. خ roots deal with CREATION, EMERGENCE, EXTRACTION: خ-ل-ق (to create, 261), خ-ر-ج (to exit/extract, 170), خ-ل-ف (to succeed, 123). The uvular friction = passage from inner to outer."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الخَلْق","type":"Voiceless uvular fricative","group":"حُرُوف الحَلْق — throat letters (nearest the mouth)"},"behaviour":{"as_first_radical":"68 roots. Opens CREATION/EXTRACTION/GOODNESS: خ-ل-ق (to create, 261), خ-ي-ر (good, 191), خ-ر-ج (to exit, 170), خ-ل-ف (to succeed, 123), خ-و-ف (fear, 120). When خ opens, things EMERGE into existence.","as_second_radical":"أ-خ-ر (other/latter, 250), أ-خ-ذ (to take/seize, 217), د-خ-ل (to enter, 120). As core, خ is the PASSAGE — through which things move.","as_third_radical":"ن-ف-خ (to blow, 20), ن-س-خ (to copy, 4). As closer, خ opens outward — the word does not stop but breathes out.","as_prefix":"Not a standard verbal prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"k","shift_id":"S11","note":"خ→k (uvular friction lost, becomes velar stop)"},{"downstream":"ch","shift_id":"S11","note":"خ→ch in Germanic DS corridors"},{"downstream":"x","shift_id":"S11","note":"خ→x in Bitig and some DS corridors"}],"quranic_stats":{"tokens_any_position":2450,"distinct_roots_any":100,"roots_as_first":68,"top5_first":[["خ-ل-ق",261],["خ-ي-ر",191],["خ-ر-ج",170],["خ-ل-ف",123],["خ-و-ف",120]],"top5_second":[["أ-خ-ر",250],["أ-خ-ذ",217],["د-خ-ل",120],["أ-خ-و",48],["ء-خ-ذ",45]],"top5_third":[["ن-ف-خ",20],["م-س-خ",5],["ن-س-خ",4],["ص-ر-خ",4],["ش-ي-خ",4]],"muqattaat":[]},"semantic_tendency":"PASSAGE. EMERGENCE. EXTRACTION. CREATION. خ marks what COMES FORTH: خ-ل-ق (creation from nothing), خ-ر-ج (exiting), خ-ي-ر (goodness = what emerges as best). The uvular passage = the throat-gate between inside and outside.","paired_letters":{"ل (lām)":"خ-ل = emergence + flow (خ-ل-ق creation, خ-ل-ف succession). The creative flow.","ر (rāʾ)":"خ-ر = emergence + movement (خ-ر-ج exit). Moving outward.","ي (yāʾ)":"خ-ي = emergence + reach (خ-ي-ر good). What emerges and extends as best."},"unique":"Abjad 600. خ-ل-ق is THE Qur'anic word for creation from nothing — Allah as الخَالِق. Q96:1-2 uses خ-ل-ق TWICE in the first revelation. In the أَمْر system, خ = the constructor — what brings new entities into existence."},"د":{"name":"دَال","transliteration":"dāl","abjad":4,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا العُلْيَا — tongue tip against upper front teeth roots","manner":"Voiced dental plosive. Tongue tip strikes upper teeth base with voicing. The voiced partner of ت (tāʾ). Where ت is light/voiceless, د is heavy/voiced.","voiced":true,"emphatic":false,"description":"Dāl is the voiced dental stop. Abjad 4 = stability (four corners, four directions). د roots deal with CALLING, ENTERING, INDEBTEDNESS, NEARNESS: د-ع-و (to call, 123), د-خ-ل (to enter, 120), د-ي-ن (accountability, 113). The voiced dental = DEFINITE impact (stronger than ت)."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الدِّين","type":"Voiced dental plosive","group":"حُرُوف أَسَلِيَّة — tongue-tip letters"},"behaviour":{"as_first_radical":"48 roots. Opens CALLING/ENTERING/ACCOUNTABILITY: د-و-ن (below/beneath, 155), د-ع-و (to call, 123), د-خ-ل (to enter, 120), د-ي-ن (system of accountability, 113). When د opens, it CALLS or ESTABLISHES position.","as_second_radical":"ه-د-ي (guidance, 259), ص-د-ق (truth/sincerity, 149), ق-د-ر (measure/decree, 132). As core, د provides WEIGHT — the definite impact that makes guidance, truth, and decree REAL.","as_third_radical":"ع-ب-د (to devote, 265), ب-ع-د (distance, 236), ر-و-د (to seek/intend, 159), ش-ه-د (to witness, 158). As closer, د ANCHORS — the voiced dental pins the word down.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"d","shift_id":"S19","note":"Preserved as d in most corridors"},{"downstream":"t","shift_id":"S19","note":"د→t devoicing in some DS corridors"}],"quranic_stats":{"tokens_any_position":5204,"distinct_roots_any":223,"roots_as_first":48,"top5_first":[["د-و-ن",155],["د-ع-و",123],["د-خ-ل",120],["د-ي-ن",113],["د-ن-ي",110]],"top5_second":[["ه-د-ي",259],["ص-د-ق",149],["ق-د-ر",132],["ي-د-ي",106],["ش-د-د",93]],"top5_third":[["ع-ب-د",265],["ب-ع-د",236],["ر-و-د",159],["ش-ه-د",158],["و-ع-د",139]],"muqattaat":[]},"semantic_tendency":"KNOCK. POSITION. ACCOUNTABILITY. ANCHORING. د establishes WHERE something is: د-و-ن (below), د-خ-ل (inside), د-ن-ي (near/low). And it establishes OBLIGATION: د-ي-ن (the system of accounts). Abjad 4 = four directions = establishing position in space.","paired_letters":{"ع (ʿayn)":"د-ع = calling + depth (د-ع-و). To call from deep within.","ي (yāʾ)":"د-ي = position + reach (د-ي-ن). The system that extends accountability.","خ (khāʾ)":"د-خ = position + passage (د-خ-ل). Entering = establishing position through a passage."},"unique":"Abjad 4. د-ي-ن is THE USLaP concept — the system of accountability. Q1:4 مَالِكِ يَوْمِ الدِّينِ — Master of the Day of الدِّين. In the أَمْر system, د = the pointer — what establishes position and reference."},"ذ":{"name":"ذَال","transliteration":"dhāl","abjad":700,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أَطْرَاف الثَّنَايَا العُلْيَا — tongue tip between teeth","manner":"Voiced interdental fricative. Tongue protrudes between teeth with voicing. The voiced partner of ث (thāʾ).","voiced":true,"emphatic":false,"description":"Dhāl is the voiced interdental. Abjad 700. ذ roots deal with REMEMBRANCE, TASTING, GOING: ذ-ك-ر (to mention/remember, 286), ذ-و-ق (to taste, 58), ذ-ه-ب (to go, 56). The voiced interdental = an ACTIVE protrusion — reaching out to experience."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الذِّكْر","type":"Voiced interdental fricative","group":"حُرُوف لَثَوِيَّة — interdental letters"},"behaviour":{"as_first_radical":"21 roots. Opens REMEMBRANCE/EXPERIENCE: ذ-ك-ر (to remember/mention, 286), ذ-و-ق (to taste, 58), ذ-ه-ب (to go, 56), ذ-ن-ب (sin/fault, 38). When ذ opens, it REACHES OUT to experience or recall.","as_second_radical":"ع-ذ-ب (denial of sweetness, 373), ك-ذ-ب (to deny, 282), ن-ذ-ر (to warn, 134), أ-ذ-ن (permission, 74). As core, ذ provides SENSATION — the experience-contact.","as_third_radical":"أ-خ-ذ (to take/seize, 217), ل-و-ذ (to take refuge, 27). As closer, ذ trails with voiced interdental friction — the word lingers.","as_prefix":"ذُو / ذَا / ذِي = possessor/owner (ذُو العَرْشِ = Owner of the Throne).","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"th","shift_id":"S12","note":"ذ→th voiced (as in English \"this\")"},{"downstream":"d","shift_id":"S12","note":"ذ→d in most DS corridors (interdental lost)"}],"quranic_stats":{"tokens_any_position":1896,"distinct_roots_any":49,"roots_as_first":21,"top5_first":[["ذ-ك-ر",286],["ذ-و-ق",58],["ذ-ه-ب",56],["ذ-ن-ب",38],["ذ-ر-ر",25]],"top5_second":[["ع-ذ-ب",373],["ك-ذ-ب",282],["ن-ذ-ر",134],["أ-ذ-ن",74],["أ-ذ-ي",47]],"top5_third":[["أ-خ-ذ",217],["ء-خ-ذ",45],["ل-و-ذ",27],["ع-و-ذ",17],["ن-ب-ذ",10]],"muqattaat":[]},"semantic_tendency":"EXTENSION. TASTING. EXPERIENCE. SENSATION. ذ is the letter of DIRECT CONTACT with reality: ذ-ك-ر (remembering = re-contacting), ذ-و-ق (tasting = direct sensory contact). The tongue protrudes between teeth to TOUCH — ذ is the letter of touching reality.","paired_letters":{"ك (kāf)":"ذ-ك = experience + containment (ذ-ك-ر). Remembrance = containing experience.","و (wāw)":"ذ-و = experience + connection (ذ-و-ق). Tasting = connecting through experience.","ه (hāʾ)":"ذ-ه = experience + breath (ذ-ه-ب). Going = experiencing departure."},"unique":"Abjad 700. ذ-ك-ر (286 tokens) is the Qur'anic concept of ACTIVE REMEMBRANCE — not passive memory but BRINGING TO AWARENESS. Q33:41 اذْكُرُوا اللَّهَ ذِكْرًا كَثِيرًا. In the أَمْر system, ذ = the memory accessor — what recalls stored data into active state."},"ر":{"name":"رَاء","transliteration":"rāʾ","abjad":200,"phonetic":{"makhraj":"طَرَف اللِّسَان قَرِيبًا مِنَ اللِّثَة — tongue tip near the gums (alveolar)","manner":"Voiced alveolar trill/tap. Tongue tip vibrates against the alveolar ridge. The MOST resistant consonant — survives in almost ALL DS corridors.","voiced":true,"emphatic":false,"description":"Rāʾ is the alveolar trill. Abjad 200. The VIBRATING letter — the tongue REPEATS its contact. ر roots are the HIGHEST-frequency family: ر-ب-ب (nurturing, 907), ر-ح-م (womb, 553), ر-س-ل (sending, 509). ر = MOVEMENT, FLOW, REPETITION. It is the letter of PROCESS."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الرَّحْمَٰن","type":"Voiced alveolar trill/tap (liquid)","group":"حُرُوف ذَلْقِيَّة — tongue-tip letters (liquids)"},"behaviour":{"as_first_radical":"90 roots. Opens NURTURING/SENDING/MERCY: ر-ب-ب (nurturing, 907), ر-ح-م (womb, 553), ر-س-ل (sending, 509). When ر opens, it initiates SUSTAINED PROCESS — vibration that continues.","as_second_radical":"أ-ر-ض (earth, 465), خ-ر-ج (exit, 170), ش-ر-ك (sharing, 149). As core, ر provides the MOVEMENT — the oscillating energy at the root's heart.","as_third_radical":"ك-ف-ر (covering, 487), ذ-ك-ر (remembering, 286), أ-خ-ر (other, 250), غ-ف-ر (shielding, 231), أ-م-ر (commanding, 223). As closer, ر CONTINUES — the trill does not stop abruptly.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"r","shift_id":"S15","note":"ر→r (nearly always preserved — highest resistance)"}],"quranic_stats":{"tokens_any_position":12268,"distinct_roots_any":439,"roots_as_first":90,"top5_first":[["ر-ب-ب",907],["ر-ح-م",553],["ر-س-ل",509],["ر-و-د",159],["ر-أ-ي",135]],"top5_second":[["أ-ر-ض",465],["خ-ر-ج",170],["ش-ر-ك",149],["و-ر-ي",94],["ق-ر-ب",93]],"top5_third":[["ك-ف-ر",487],["ذ-ك-ر",286],["أ-خ-ر",250],["غ-ف-ر",231],["أ-م-ر",223]],"muqattaat":["الر — Surahs 10,11,12,14,15. المر — Surah 13"]},"semantic_tendency":"MOVEMENT. PROCESS. FLOW. NURTURING. REPETITION. ر = the vibrating letter. 12,268 tokens, 439 roots — the MOST connected letter. Every process-word has ر: nurturing (ر-ب-ب), mercy (ر-ح-م), sending (ر-س-ل), returning (ر-ج-ع). The trill = repeated contact = ongoing process.","paired_letters":{"ب (bāʾ)":"ر-ب = flow + building (ر-ب-ب). Nurturing = sustained building. THE highest root.","ح (ḥāʾ)":"ر-ح = flow + warmth (ر-ح-م). The womb = flowing warmth. 553 tokens.","س (sīn)":"ر-س = flow + streaming (ر-س-ل). Sending = flowing outward."},"unique":"Abjad 200. THE most connected letter in the entire Qur'an — 439 distinct roots, 12,268 tokens. ر-ب-ب (907) is the root of رَبّ (the Nurturer). The trill = the only consonant that inherently REPEATS itself. In the أَمْر system, ر = the process runner — what executes continuously."},"ز":{"name":"زَاي","transliteration":"zāy","abjad":7,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا السُّفْلَى — tongue tip near lower front teeth","manner":"Voiced alveolar fricative. Air passes through narrow channel between tongue tip and alveolar ridge with voicing. The voiced partner of س (sīn).","voiced":true,"emphatic":false,"description":"Zāy is the voiced sibilant. Abjad 7 = THE number (seven heavens, seven earths, seven circuits, heptad structure). ز roots deal with PAIRING, GROWTH, ADORNMENT: ز-و-ج (pair, 85), ز-ك-و (purification/growth, 59), ز-ي-ن (adornment, 47). The buzzing voiced sibilant = ENERGY that pairs and purifies."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الزَّوْج","type":"Voiced alveolar fricative (sibilant)","group":"حُرُوف صَفِيرِيَّة — whistling/sibilant letters"},"behaviour":{"as_first_radical":"38 roots. Opens PAIRING/GROWTH/PURIFICATION: ز-و-ج (pair, 85), ز-ك-و (purification, 59), ز-ي-ن (adornment, 47), ز-ي-د (increase, 31). When ز opens, it PAIRS or GROWS.","as_second_radical":"ن-ز-ل (to descend/reveal, 293), ر-ز-ق (provision, 121), ع-ز-ز (might, 118). As core, ز provides ENERGY — the buzzing force.","as_third_radical":"ع-ز-ز (might, 118), ف-و-ز (triumph, 26), ع-ج-ز (inability, 26). As closer, ز BUZZES — the word ends with resonant energy.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"z","shift_id":"S22","note":"ز→z (preserved)"},{"downstream":"s","shift_id":"S22","note":"ز→s (devoicing — loses the buzzing quality)"}],"quranic_stats":{"tokens_any_position":1462,"distinct_roots_any":101,"roots_as_first":38,"top5_first":[["ز-و-ج",85],["ز-ك-و",59],["ز-ي-ن",47],["ز-ي-د",31],["ز-و-د",23]],"top5_second":[["ن-ز-ل",293],["ر-ز-ق",121],["ع-ز-ز",118],["ج-ز-ي",69],["ج-ز-أ",45]],"top5_third":[["ع-ز-ز",118],["ف-و-ز",26],["ع-ج-ز",26],["ر-ج-ز",10],["ك-ن-ز",9]],"muqattaat":[]},"semantic_tendency":"BUZZ. PURIFICATION. GROWTH. ENERGY. ز is the letter of DUALITY MADE PRODUCTIVE: ز-و-ج (pair), ز-ك-و (purify = grow clean), ز-ي-ن (adorn = add beauty). Abjad 7 = the heptad number = completeness through pairing.","paired_letters":{"و (wāw)":"ز-و = energy + connection (ز-و-ج pair). Two connected with energy = a productive pair.","ك (kāf)":"ز-ك = energy + containment (ز-ك-و). Purification = contained growth energy.","ي (yāʾ)":"ز-ي = energy + extension (ز-ي-ن adorn, ز-ي-د increase). Energy extending outward."},"unique":"Abjad 7. THE heptad letter. Every heptad in the lattice sums to 462 = 7 × 66 = 7 × Allah. ز-و-ج (pair) is the Qur'anic structure of creation: everything in pairs (Q36:36, Q51:49). In the أَمْر system, ز = the pair operator — what creates matched/coupled structures."},"س":{"name":"سِين","transliteration":"sīn","abjad":60,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا السُّفْلَى — tongue tip near lower teeth","manner":"Voiceless alveolar fricative. Air streams through narrow channel. The voiceless partner of ز (zāy). The NON-emphatic partner of ص (ṣād).","voiced":false,"emphatic":false,"description":"Sīn is the voiceless sibilant. Abjad 60. STREAMING air — the hissing sound of things FLOWING. س roots: س-م-و (elevation, 457), س-م-ع (hearing, 197), س-ب-ل (a path, 177), س-ل-م (peace/wholeness, 148). The streaming sibilant = CONTINUOUS FLOW."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: السَّمَاء","type":"Voiceless alveolar fricative (sibilant)","group":"حُرُوف صَفِيرِيَّة — whistling/sibilant letters"},"behaviour":{"as_first_radical":"108 roots — second most prolific opener. س-م-و (elevation/sky, 457), س-م-ع (hearing, 197), س-ب-ل (path, 177), س-و-أ (wrongdoing, 150), س-ل-م (peace, 148). When س opens, things STREAM or FLOW.","as_second_radical":"ر-س-ل (sending, 509), ح-س-ن (beauty, 189), ح-س-ب (reckoning, 106). As core, س is the CHANNEL — the flowing middle.","as_third_radical":"ن-ف-س (self/soul, 296), أ-ن-س (humanity, 263). As closer, س hisses away — the word trails into breath.","as_prefix":"سَـ = near future marker (سَيَعْلَمُونَ = they will soon know). The سين of futurity — what is COMING.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"s","shift_id":"S21","note":"Preserved as s"},{"downstream":"c","shift_id":"S21","note":"س→c before front vowels in DS05 Latin"},{"downstream":"z","shift_id":"S21","note":"س→z (voicing) in some corridors"}],"quranic_stats":{"tokens_any_position":5429,"distinct_roots_any":232,"roots_as_first":108,"top5_first":[["س-م-و",457],["س-م-ع",197],["س-ب-ل",177],["س-و-أ",150],["س-ل-م",148]],"top5_second":[["ر-س-ل",509],["ح-س-ن",189],["ح-س-ب",106],["خ-س-ر",65],["ن-س-أ",60]],"top5_third":[["ن-ف-س",296],["أ-ن-س",263],["م-و-س",105],["ل-ي-س",59],["ن-و-س",56]],"muqattaat":["يس — Surah 36. طس — Surah 27. طسم — Surahs 26,28"]},"semantic_tendency":"FLOW. STREAMING. ELEVATION. PATH. س is the letter of things that MOVE CONTINUOUSLY: sky (س-م-و), path (س-ب-ل), peace (س-ل-م = wholeness flowing). As future prefix (سَـ), it marks what FLOWS toward you.","paired_letters":{"م (mīm)":"س-م = stream + enclosure (س-م-و sky, س-م-ع hearing). The sky = streaming enclosure above.","ل (lām)":"س-ل = stream + flow (س-ل-م peace). Peace = streaming flow.","ب (bāʾ)":"س-ب = stream + building (س-ب-ل path). A path = a built stream for travel."},"unique":"Abjad 60. Second most prolific opener (108 roots). The future prefix سَـ makes س the letter of ANTICIPATION. In the أَمْر system, س = the stream — data flow, I/O channel, pipeline."},"ش":{"name":"شِين","transliteration":"shīn","abjad":300,"phonetic":{"makhraj":"وَسَط اللِّسَان مَعَ الحَنَك — middle tongue against palate","manner":"Voiceless palatal fricative. Broad air flow over flattened tongue. The voiceless partner of ج (jīm) in articulation zone.","voiced":false,"emphatic":false,"description":"Shīn is the voiceless palatal fricative. Abjad 300. WIDE dispersal — air spreads across the palate (unlike the narrow channel of س). ش roots: ش-ي-أ (a thing, 355), ش-ه-د (to witness, 158), ش-ر-ك (to share, 149). ش = SPREADING, DISPERSAL, SHARING."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الشَّمْس","type":"Voiceless palatal fricative","group":"حُرُوف شَجَرِيَّة — palatal letters"},"behaviour":{"as_first_radical":"62 roots. Opens THINGS/WITNESSING/SHARING: ش-ي-أ (a thing, 355), ش-ه-د (to witness, 158), ش-ر-ك (to share, 149). When ش opens, it SPREADS or EXPOSES.","as_second_radical":"ب-ش-ر (humanity/glad tidings, 124), خ-ش-ي (to fear, 45). As core, ش provides DISPERSAL — the wide spreading.","as_third_radical":"ع-ر-ش (throne, 31), ف-ح-ش (obscenity, 17). As closer, ش DISSIPATES — the word spreads and fades.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"sh","shift_id":"S05","note":"Preserved as sh"},{"downstream":"s","shift_id":"S05","note":"ش→s (narrowing — loses palatal width)"},{"downstream":"s / sh","shift_id":"S-SIB-SH","note":"Sibilant-palatalization interchange"}],"quranic_stats":{"tokens_any_position":2088,"distinct_roots_any":99,"roots_as_first":62,"top5_first":[["ش-ي-أ",355],["ش-ه-د",158],["ش-ي-ء",151],["ش-ر-ك",149],["ش-د-د",93]],"top5_second":[["ب-ش-ر",124],["خ-ش-ي",45],["ح-ش-ر",41],["ع-ش-ر",25],["م-ش-ي",23]],"top5_third":[["ع-ر-ش",31],["ف-ح-ش",17],["ب-ط-ش",10],["ن-و-ش",6],["ف-ر-ش",6]],"muqattaat":[]},"semantic_tendency":"SPREADING. THINGNESS. WITNESSING. SHARING. ش is the letter of DISPERSAL: ش-ي-أ (thing = entity spread in existence), ش-ه-د (witness = perception spread across reality), ش-ر-ك (sharing = spreading ownership).","paired_letters":{"ي (yāʾ)":"ش-ي = spreading + extension (ش-ي-أ thing). A thing = what extends spread in existence.","ه (hāʾ)":"ش-ه = spreading + breath (ش-ه-د witness). To witness = to breathe in the spread reality.","ر (rāʾ)":"ش-ر = spreading + flow (ش-ر-ك sharing). To share = spreading flow among many."},"unique":"Abjad 300. ش-ي-أ (355 tokens) is how the Qur'an says THING — any entity. Q36:82 إِنَّمَا أَمْرُهُ إِذَا أَرَادَ شَيْئًا أَن يَقُولَ لَهُ كُن فَيَكُونُ — His أَمْر when He intends a شَيْء is to say كُن. In the أَمْر system, ش = the object type — entities spread in the system."},"ص":{"name":"صَاد","transliteration":"ṣād","abjad":90,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا السُّفْلَى — tongue tip near lower teeth","manner":"Voiceless emphatic alveolar fricative. Same position as س but with tongue body raised toward the palate (تَفْخِيم). The EMPHATIC partner of س. Heavier, deeper, more forceful.","voiced":false,"emphatic":true,"description":"Ṣād is the emphatic sibilant. Abjad 90. Same air-stream as س but with WEIGHT — the tongue body presses upward. ص roots: ص-ل-ح (righteousness, 177), ص-د-ق (truth, 149), ص-ب-ر (endurance, 102). ص = TRUTH UNDER PRESSURE — what holds when tested."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الصَّبْر","type":"Voiceless emphatic alveolar fricative","group":"حُرُوف صَفِيرِيَّة — whistling/sibilant letters (emphatic)"},"behaviour":{"as_first_radical":"64 roots. Opens RIGHTEOUSNESS/TRUTH/ENDURANCE: ص-ل-ح (righteousness, 177), ص-د-ق (truth, 149), ص-ب-ر (patience, 102). When ص opens, it declares what is TRUE AND WEIGHTY.","as_second_radical":"ن-ص-ر (help/victory, 111), ب-ص-ر (vision, 100), ف-ص-ل (separation, 40). As core, ص provides FORCE — the emphatic weight of certainty.","as_third_radical":"خ-ل-ص (purity, 31), ق-ص-ص (narration, 23). As closer, ص seals with AUTHORITY — heavy, definitive.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"s","shift_id":"S13","note":"ص→s (emphasis lost — flattened to plain s)"},{"downstream":"c","shift_id":"S13","note":"ص→c in DS05 Latin corridor"},{"downstream":"z","shift_id":"S13","note":"ص→z (voiced + de-emphasized)"},{"downstream":"ص→s retention","shift_id":"S-SIB-E","note":"Emphatic sibilant preserved as s"}],"quranic_stats":{"tokens_any_position":1957,"distinct_roots_any":122,"roots_as_first":64,"top5_first":[["ص-ل-ح",177],["ص-د-ق",149],["ص-ب-ر",102],["ص-ي-ر",97],["ص-ح-ب",97]],"top5_second":[["ن-ص-ر",111],["ب-ص-ر",100],["ف-ص-ل",40],["و-ص-د",38],["و-ص-ي",33]],"top5_third":[["خ-ل-ص",31],["ق-ص-ص",23],["ن-ق-ص",16],["ح-ي-ص",9],["ر-ب-ص",8]],"muqattaat":["ص — Surah 38. المص — Surah 7. كهيعص — Surah 19"]},"semantic_tendency":"HEAVY STREAM. ENDURANCE. RIGHTEOUSNESS. WEIGHT. ص is the emphatic س — what stands under PRESSURE. ص-د-ق (truth = what holds firm), ص-ب-ر (patience = enduring weight), ص-ل-ح (righteousness = corrected under pressure).","paired_letters":{"ل (lām)":"ص-ل = weight + flow (ص-ل-ح righteousness). Heavy flow = righteous conduct.","د (dāl)":"ص-د = weight + anchor (ص-د-ق truth). Weighted and anchored = truth.","ب (bāʾ)":"ص-ب = weight + building (ص-ب-ر patience). Built under weight = endurance."},"unique":"Abjad 90. ص appears as a standalone muqaṭṭaʿa (Surah 38). ص-ر-ط (الصِّرَاط = THE path) — the emphatic path, the one with weight and authority. In the أَمْر system, ص = the assertion — what declares truth with authority."},"ض":{"name":"ضَاد","transliteration":"ḍād","abjad":800,"phonetic":{"makhraj":"حَافَّة اللِّسَان مَعَ الأَضْرَاس — side of tongue against molars","manner":"Voiced emphatic lateral fricative. Air passes along the SIDE of the tongue. The ONLY letter in AA articulated from the side. Unique to AA — لُغَة الضَّاد (the language of ḍād).","voiced":true,"emphatic":true,"description":"Ḍād is the DEFINING letter of AA. Abjad 800. NO other language in history has this sound. ض roots: ض-ل-ل (going astray/displacement, 172), ض-ر-ب (striking, 56), ض-ع-ف (weakness, 49). ض = DISPLACEMENT, WRONG POSITION. The lateral articulation = SIDEWAYS motion = off the straight path."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الضَّلَال","type":"Voiced emphatic lateral fricative","group":"UNIQUE — no group. ض is the only lateral fricative."},"behaviour":{"as_first_radical":"25 roots. Opens DISPLACEMENT/STRIKING/WEAKNESS: ض-ل-ل (displacement, 172), ض-ر-ب (striking, 56), ض-ع-ف (weakness, 49). When ض opens, something is DISPLACED or STRUCK.","as_second_radical":"ف-ض-ل (excellence, 106), ق-ض-ي (decree, 57), و-ض-ع (placing, 26). As core, ض is the FORCE — lateral pressure that distinguishes or displaces.","as_third_radical":"أ-ر-ض (earth, 465 — MASSIVE), ب-ع-ض (some/part, 97), ع-ر-ض (width, 79). As closer, ض GROUNDS — the heavy lateral stops the word firmly.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"d","shift_id":"S06","note":"ض→d (lateral quality lost entirely)"},{"downstream":"th","shift_id":"S06","note":"ض→th in some DS corridors"}],"quranic_stats":{"tokens_any_position":1601,"distinct_roots_any":79,"roots_as_first":25,"top5_first":[["ض-ل-ل",172],["ض-ر-ب",56],["ض-ع-ف",49],["ض-و-أ",34],["ض-ر-ر",34]],"top5_second":[["ف-ض-ل",106],["ق-ض-ي",57],["و-ض-ع",26],["ح-ض-ر",25],["غ-ض-ب",24]],"top5_third":[["أ-ر-ض",465],["ب-ع-ض",97],["ع-ر-ض",79],["ر-و-ض",47],["م-ر-ض",28]],"muqattaat":[]},"semantic_tendency":"EDGE. STRIKING. GROUNDING. THE DEFINITIVE LETTER. ض = what is OFF PATH or what FORCES distinction. ض-ل-ل (astray = displaced), but also أ-ر-ض (earth = the GROUND itself, 465 tokens). The lateral letter DEFINES AA — no imitation possible.","paired_letters":{"ل (lām)":"ض-ل = displacement + flow (ض-ل-ل). Going astray = flowing off path.","ر (rāʾ)":"ض-ر = force + process (ض-ر-ب). Striking = forced process.","ع (ʿayn)":"ض-ع = force + depth (ض-ع-ف). Weakness = deep force deficit."},"unique":"Abjad 800. THE letter that DEFINES AA (لُغَة الضَّاد). UNIQUE in human phonetics — no other language has a voiced emphatic lateral fricative. أَرْض (Layer 3 of the أَمْر system) ends with ض — the OS kernel is grounded in THE defining letter. In the أَمْر system, ض = the exception handler — what catches displacement/error."},"ط":{"name":"طَاء","transliteration":"ṭāʾ","abjad":9,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أُصُول الثَّنَايَا العُلْيَا — tongue tip against upper teeth roots","manner":"Voiceless emphatic dental plosive. Same position as ت but with tongue body raised (تَفْخِيم). The EMPHATIC partner of ت. Heavy, authoritative, commanding.","voiced":false,"emphatic":true,"description":"Ṭāʾ is the emphatic dental stop. Abjad 9. The HEAVY ت — where ت is light succession, ط is COMMANDING authority. ط roots: ط-و-ع (obedience, 111), ط-ع-م (food, 50), ط-ي-ب (pure/good, 49). The emphatic dental = AUTHORITATIVE impact."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الطَّاعَة","type":"Voiceless emphatic dental plosive","group":"حُرُوف أَسَلِيَّة — tongue-tip letters (emphatic)"},"behaviour":{"as_first_radical":"37 roots. Opens OBEDIENCE/PURITY/AUTHORITY: ط-و-ع (obedience, 111), ط-ع-م (food/provision, 50), ط-ي-ب (pure/good, 49), ط-و-ف (circling, 36), ط-غ-ي (transgression, 35). When ط opens, it marks AUTHORITY — either obeyed (ط-و-ع) or transgressed (ط-غ-ي).","as_second_radical":"ش-ط-ن (adversary, 88), ق-ط-ع (cutting, 35), ب-ط-ل (falsehood, 33). As core, ط provides FORCE OF AUTHORITY.","as_third_radical":"ص-ر-ط (the path, 45), س-ل-ط (authority, 36), ل-و-ط (Lūṭ, 28). As closer, ط STAMPS — definitive, authoritative closure.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"t","shift_id":"S04","note":"ط→t (emphasis lost — flattened to plain t)"}],"quranic_stats":{"tokens_any_position":1205,"distinct_roots_any":109,"roots_as_first":37,"top5_first":[["ط-و-ع",111],["ط-ع-م",50],["ط-ي-ب",49],["ط-و-ف",36],["ط-غ-ي",35]],"top5_second":[["ش-ط-ن",88],["ق-ط-ع",35],["ب-ط-ل",33],["ب-ط-ن",19],["ف-ط-ر",18]],"top5_third":[["ص-ر-ط",45],["س-ل-ط",36],["ل-و-ط",28],["ق-س-ط",25],["ح-و-ط",25]],"muqattaat":["طه — Surah 20. طس — Surah 27. طسم — Surahs 26,28"]},"semantic_tendency":"SEAL. OBEDIENCE. PURITY. COMMAND. ط is the letter of SOVEREIGN FORCE: ط-و-ع (submit to authority), ط-ي-ب (pure = meeting the authority's standard), ط-غ-ي (transgress authority). Abjad 9 = completion of single digits.","paired_letters":{"و (wāw)":"ط-و = authority + connection (ط-و-ع obedience). Submitting = connecting to authority.","ع (ʿayn)":"ط-ع = authority + depth (ط-ع-م food). Nourishment = authority reaching deep.","ي (yāʾ)":"ط-ي = authority + extension (ط-ي-ب pure). Purity = authority extended."},"unique":"Abjad 9. The emphatic ت. طه is one of the Qur'anic muqaṭṭaʿāt (Surah 20). الصِّرَاطَ الْمُسْتَقِيمَ (Q1:6) ends with ط — the STRAIGHT path is stamped with authority. In the أَمْر system, ط = the permission gate — the authority check."},"ظ":{"name":"ظَاء","transliteration":"ẓāʾ","abjad":900,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ أَطْرَاف الثَّنَايَا العُلْيَا — tongue tip between teeth","manner":"Voiced emphatic interdental fricative. Tongue protrudes between teeth with emphasis (tongue body raised). The EMPHATIC partner of ذ (dhāl).","voiced":true,"emphatic":true,"description":"Ẓāʾ is the emphatic interdental. Abjad 900 — highest single-letter abjad except غ (1000). ظ roots: ظ-ل-م (displacement/darkness, 315), ظ-ن-ن (assumption, 62), ظ-ه-ر (appearing/manifest, 58). The heavy interdental = WHAT APPEARS or WHAT IS DISPLACED."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: الظُّلْم","type":"Voiced emphatic interdental fricative","group":"حُرُوف لَثَوِيَّة — interdental letters (emphatic)"},"behaviour":{"as_first_radical":"7 roots — the RAREST opener. ظ-ل-م (displacement, 315), ظ-ن-ن (assumption, 62), ظ-ه-ر (manifesting, 58). When ظ opens, it marks the HEAVIEST concepts: oppression, assumption, manifestation.","as_second_radical":"ن-ظ-ر (looking, 128), ع-ظ-م (greatness, 128). As core, ظ provides MAGNITUDE — what is great and visible.","as_third_radical":"ح-ف-ظ (preservation, 37), و-ع-ظ (admonition, 24), غ-ل-ظ (harshness, 13). As closer, ظ seals with WEIGHT AND EXPOSURE.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"z","shift_id":"S25","note":"ظ→z (emphatic interdental → plain fricative)"},{"downstream":"th","shift_id":"S25","note":"ظ→th (emphatic quality lost)"}],"quranic_stats":{"tokens_any_position":833,"distinct_roots_any":21,"roots_as_first":7,"top5_first":[["ظ-ل-م",315],["ظ-ن-ن",62],["ظ-ه-ر",58],["ظ-ل-ل",30],["ظ-م-أ",3]],"top5_second":[["ن-ظ-ر",128],["ع-ظ-م",128],["ح-ظ-ظ",7],["ك-ظ-م",6],["ل-ظ-ي",3]],"top5_third":[["ح-ف-ظ",37],["و-ع-ظ",24],["غ-ل-ظ",13],["غ-ي-ظ",10],["ح-ظ-ظ",7]],"muqattaat":[]},"semantic_tendency":"HEAVY CONTACT. APPEARANCE. MAGNITUDE. HEAVINESS. ظ marks what is OUT OF PLACE or what is MASSIVE: ظ-ل-م (315 — placing in wrong position), ع-ظ-م (greatness), ظ-ه-ر (manifestation = becoming visible/apparent).","paired_letters":{"ل (lām)":"ظ-ل = magnitude + flow (ظ-ل-م displacement). Wrong-flowing = oppression.","ن (nūn)":"ظ-ن = magnitude + continuation (ظ-ن-ن assumption). Assumed magnitude.","ه (hāʾ)":"ظ-ه = magnitude + breath (ظ-ه-ر manifesting). Breathing into visibility."},"unique":"Abjad 900. Only 7 roots as opener — the RAREST first radical. But ظ-ل-م alone has 315 tokens — the concept of DISPLACEMENT is massive. In the أَمْر system, ظ = the error state — displacement from correct position."},"ع":{"name":"عَيْن","transliteration":"ʿayn","abjad":70,"phonetic":{"makhraj":"وَسَط الحَلْق — middle of the throat (pharyngeal)","manner":"Voiced pharyngeal fricative. The throat constricts with voicing. The voiced partner of ح (ḥāʾ). NO DS language has this sound.","voiced":true,"emphatic":false,"description":"ʿAyn is the voiced pharyngeal. Abjad 70. The DEEPEST voiced consonant — from the middle of the throat, it represents DEEP KNOWLEDGE and INNER REALITY. ع roots: ع-ل-م (knowledge, 846 — 2nd highest verb), ع-ذ-ب (denial of sweetness, 373), ع-م-ل (action, 360), ع-ب-د (devotion, 265). ع = DEPTH. KNOWLEDGE. ACTION."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: العِلْم","type":"Voiced pharyngeal fricative","group":"حُرُوف الحَلْق — throat letters"},"behaviour":{"as_first_radical":"102 roots. Opens KNOWLEDGE/ACTION/DEVOTION: ع-ل-م (knowledge, 846), ع-ذ-ب (denial of sweetness, 373), ع-م-ل (action, 360), ع-ب-د (devotion, 265), ع-ظ-م (greatness, 128). When ع opens, it reaches DEEP — knowledge, action, devotion all come from depth.","as_second_radical":"ج-ع-ل (making, 345), ب-ع-د (distance, 236), و-ع-د (promise, 139), ن-ع-م (blessing, 133). As core, ع provides DEPTH — the deep well from which meaning rises.","as_third_radical":"س-م-ع (hearing, 197), ت-ب-ع (following, 166), ج-م-ع (gathering, 129), ط-و-ع (obedience, 111). As closer, ع pulls INWARD — the word concludes by going deep.","as_prefix":"Not a standard verbal prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"a","shift_id":"S07","note":"ع→a (pharyngeal collapses to vowel)"},{"downstream":"e","shift_id":"S07","note":"ع→e (pharyngeal collapses to vowel)"},{"downstream":"(drops)","shift_id":"S07","note":"ع drops entirely in many DS corridors"},{"downstream":"(vowel / silent)","shift_id":"AYN-DROP","note":"Pharyngeal quality disappears completely"}],"quranic_stats":{"tokens_any_position":6878,"distinct_roots_any":220,"roots_as_first":102,"top5_first":[["ع-ل-م",846],["ع-ذ-ب",373],["ع-م-ل",360],["ع-ب-د",265],["ع-ظ-م",128]],"top5_second":[["ج-ع-ل",345],["ب-ع-د",236],["و-ع-د",139],["ن-ع-م",133],["د-ع-و",123]],"top5_third":[["س-م-ع",197],["ت-ب-ع",166],["ج-م-ع",129],["ط-و-ع",111],["ر-ج-ع",103]],"muqattaat":["كهيعص — Surah 19 (ع is one of the five letters)"]},"semantic_tendency":"DEPTH. KNOWLEDGE. ACTION. DEVOTION. THE INNER. ع is the letter of the DEEP INTERIOR — ع-ل-م (846) is knowledge gained from depth, ع-م-ل (action = depth manifested), ع-ب-د (devotion = depth committed). NO DS language can produce this sound — they lose the depth entirely.","paired_letters":{"ل (lām)":"ع-ل = depth + flow (ع-ل-م knowledge). Knowledge = deep flow.","م (mīm)":"ع-م = depth + enclosure (ع-م-ل action). Action = depth enclosed and expressed.","ب (bāʾ)":"ع-ب = depth + building (ع-ب-د devotion). Devotion = building from deep within."},"unique":"Abjad 70. NO equivalent in ANY DS language — ع DROPS or becomes a bare vowel. This is the MOST lost letter in degradation — and it carries the DEEPEST concepts. ع-ل-م (846 tokens) = knowledge. Q96:5 عَلَّمَ الإِنسَانَ مَا لَمْ يَعْلَمْ. In the أَمْر system, ع = the kernel depth — the deep internal state that no surface can access."},"غ":{"name":"غَيْن","transliteration":"ghayn","abjad":1000,"phonetic":{"makhraj":"أَدْنَى الحَلْق — nearest part of the throat to the mouth (uvular)","manner":"Voiced uvular fricative. Air passes over raised back of tongue near uvula with voicing. The voiced partner of خ (khāʾ).","voiced":true,"emphatic":false,"description":"Ghayn is the voiced uvular fricative. Abjad 1000 — the HIGHEST single-letter value. غ roots: غ-ف-ر (covering/shielding, 231), غ-ي-ر (other/change, 84), غ-ن-ي (richness, 73). غ = COVERING, CONCEALMENT, ABUNDANCE. The uvular rumble = what lies HIDDEN or what is OVERFLOWING."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الغَفُور","type":"Voiced uvular fricative","group":"حُرُوف الحَلْق — throat letters (nearest the mouth)"},"behaviour":{"as_first_radical":"49 roots. Opens COVERING/CHANGE/RICHNESS: غ-ف-ر (shielding, 231), غ-ي-ر (change, 84), غ-ن-ي (richness, 73), غ-ي-ب (unseen, 57). When غ opens, something is HIDDEN or CHANGED.","as_second_radical":"ب-غ-ي (seeking/transgression, 94), ط-غ-ي (overflowing, 35). As core, غ provides CONCEALMENT — the hidden force.","as_third_radical":"ب-ل-غ (reaching, 71), ز-ي-غ (deviation, 10). As closer, غ veils — the word ends in concealment.","as_prefix":"Not a standard prefix.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"g","shift_id":"S14","note":"غ→g (uvular fricative → velar stop)"},{"downstream":"gh","shift_id":"S14","note":"غ→gh (preserved in some corridors)"},{"downstream":"silent / g","shift_id":"GH-DROP","note":"غ drops or weakens to g"}],"quranic_stats":{"tokens_any_position":1134,"distinct_roots_any":78,"roots_as_first":49,"top5_first":[["غ-ف-ر",231],["غ-ي-ر",84],["غ-ن-ي",73],["غ-ي-ب",57],["غ-ف-ل",35]],"top5_second":[["ب-غ-ي",94],["ط-غ-ي",35],["ل-غ-و",21],["ب-غ-ت",15],["ص-غ-ر",13]],"top5_third":[["ب-ل-غ",71],["ز-ي-غ",10],["ن-ز-غ",6],["ف-ر-غ",5],["م-ض-غ",3]],"muqattaat":[]},"semantic_tendency":"SCRAPE. CONCEALMENT. CHANGE. RICHNESS. THE HIDDEN. غ = what is VEILED: غ-ف-ر (shielding from consequences), غ-ي-ب (the unseen), غ-ن-ي (rich = concealed resources). Abjad 1000 = the largest single-letter value = abundance.","paired_letters":{"ف (fāʾ)":"غ-ف = concealment + release (غ-ف-ر shielding). Forgiving = releasing from under cover.","ي (yāʾ)":"غ-ي = concealment + extension (غ-ي-ب unseen). The unseen = hidden extension.","ن (nūn)":"غ-ن = concealment + continuation (غ-ن-ي richness). Wealth = hidden continuity."},"unique":"Abjad 1000 — the HIGHEST value. غ-ف-ر (231 tokens) is how the Qur'an describes Allah's covering/shielding (الغَفُور). غ-ي-ب (the unseen) is a core Qur'anic concept. In the أَمْر system, غ = the encryption/hidden layer — what is concealed from surface access."},"ف":{"name":"فَاء","transliteration":"fāʾ","abjad":80,"phonetic":{"makhraj":"بَاطِن الشَّفَة السُّفْلَى مَعَ أَطْرَاف الثَّنَايَا العُلْيَا — inner lower lip + upper teeth","manner":"Voiceless labiodental fricative. Lower lip touches upper teeth, air passes as friction.","voiced":false,"emphatic":false,"description":"Fāʾ is the labiodental fricative. Abjad 80. Lip meets teeth — an INTERFACE between two surfaces. ف roots: ف-ض-ل (excellence, 106), ف-ع-ل (doing, 103), ف-ر-ق (separating, 67). ف = SEPARATION, ACTION, RELEASE. The air escapes between lip and teeth = release."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الفَضْل","type":"Voiceless labiodental fricative","group":"حُرُوف الشَّفَتَيْن — lip letters (labiodental)"},"behaviour":{"as_first_radical":"71 roots. Opens SEPARATION/ACTION/SPLITTING: ف-ض-ل (excellence, 106), ف-ع-ل (doing, 103), ف-ر-ع (branching, 75), ف-ر-ق (separating, 67). When ف opens, it SEPARATES or RELEASES.","as_second_radical":"ك-ف-ر (covering, 487), ن-ف-س (self, 296), غ-ف-ر (shielding, 231). As core, ف provides the ESCAPE — the air-release at the root's heart.","as_third_radical":"خ-ل-ف (succession, 123), خ-و-ف (fear, 120), ع-ر-ف (knowing, 70). As closer, ف releases — the word opens at the end.","as_prefix":"فَـ = THEN/SO (sequential conjunction). Q2:37 فَتَابَ عَلَيْهِ = then He turned to him. The ف of consequence — what FOLLOWS from what came before.","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"f","shift_id":"S08","note":"Preserved as f"},{"downstream":"p","shift_id":"S08","note":"ف→p in Bitig and some DS corridors"},{"downstream":"v","shift_id":"S08","note":"ف→v (voicing in some corridors)"}],"quranic_stats":{"tokens_any_position":4126,"distinct_roots_any":215,"roots_as_first":71,"top5_first":[["ف-ض-ل",106],["ف-ع-ل",103],["ف-ر-ع",75],["ف-ر-ق",67],["ف-ق-د",60]],"top5_second":[["ك-ف-ر",487],["ن-ف-س",296],["غ-ف-ر",231],["ن-ف-ق",100],["و-ف-ي",74]],"top5_third":[["خ-ل-ف",123],["خ-و-ف",120],["ع-ر-ف",70],["ض-ع-ف",49],["أ-ل-ف",41]],"muqattaat":[]},"semantic_tendency":"SEPARATION. RELEASE. ACTION. CONSEQUENCE. ف marks what SPLITS or what FOLLOWS: ف-ر-ق (separate), ف-ع-ل (do/act). As prefix فَـ it marks THEN — the consequence connector. The labiodental release = air escaping = action released.","paired_letters":{"ع (ʿayn)":"ف-ع = release + depth (ف-ع-ل action). To act = to release from depth.","ر (rāʾ)":"ف-ر = release + process (ف-ر-ق separation). Separating = releasing through process.","ض (ḍād)":"ف-ض = release + force (ف-ض-ل excellence). Excellence = forceful release."},"unique":"Abjad 80. The CONSEQUENCE letter — فَـ (then/so) is the most frequent Qur'anic connector. Every conditional leads to فَـ: إِنْ...فَـ (if...then). In the أَمْر system, ف = the conditional branch — the THEN of if-then logic."},"ق":{"name":"قَاف","transliteration":"qāf","abjad":100,"phonetic":{"makhraj":"أَقْصَى اللِّسَان مَعَ الحَنَك الأَعْلَى — back of tongue against soft palate (uvular)","manner":"Voiceless uvular plosive. Back of tongue strikes uvula/soft palate, releases with a deep pop. DEEPER than ك (kāf). No DS language has a true ق — it collapses to k/g/c.","voiced":false,"emphatic":false,"description":"Qāf is the deep uvular stop. Abjad 100. The DEEPEST plosive — from the back of the throat. ق roots: ق-و-ل (speech, 1690 — THE highest), ق-و-م (standing, 583), ق-ب-ل (accepting, 291), ق-ل-ب (heart, 166). ق = FORCE. SPEECH. STANDING. The deep pop = DECISIVE utterance."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: القَوْل","type":"Voiceless uvular plosive","group":"حُرُوف لَهَوِيَّة — uvular letters"},"behaviour":{"as_first_radical":"77 roots. Opens SPEECH/STANDING/FORCE: ق-و-ل (speech, 1690 — HIGHEST root), ق-و-م (standing, 583), ق-ب-ل (accepting, 291), ق-ل-ب (heart, 166), ق-ت-ل (fighting, 164). When ق opens, it DECLARES with force.","as_second_radical":"ح-ق-ق (truth, 263), و-ق-ي (protection, 162). As core, ق provides FORCE — the deep uvular impact.","as_third_radical":"ح-ق-ق (truth, 263), خ-ل-ق (creation, 261), ص-د-ق (truth, 149), ر-ز-ق (provision, 121). As closer, ق STAMPS with deep authority.","as_prefix":"قَدْ = particle of emphasis/certainty (قَدْ أَفْلَحَ = certainly succeeded).","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"k","shift_id":"S01","note":"ق→k (uvular → velar, most common shift)"},{"downstream":"c","shift_id":"S01","note":"ق→c in DS05 Latin corridor"},{"downstream":"q","shift_id":"S01","note":"ق→q (preserved in some corridors)"},{"downstream":"g","shift_id":"S01","note":"ق→g (voiced in some corridors)"},{"downstream":"k / c / g (hard)","shift_id":"Q-VEL","note":"General velar range"}],"quranic_stats":{"tokens_any_position":6570,"distinct_roots_any":205,"roots_as_first":77,"top5_first":[["ق-و-ل",1690],["ق-و-م",583],["ق-ب-ل",291],["ق-ل-ب",166],["ق-ت-ل",164]],"top5_second":[["ح-ق-ق",263],["و-ق-ي",162],["ل-ق-ي",113],["ع-ق-ب",96],["ف-ق-د",60]],"top5_third":[["ح-ق-ق",263],["خ-ل-ق",261],["ص-د-ق",149],["ر-ز-ق",121],["ن-ف-ق",100]],"muqattaat":["ق — Surah 50 (standalone)"]},"semantic_tendency":"STRIKE. FORCE. STANDING. HEART. DECLARATION. ق is the letter of DECISIVE UTTERANCE. ق-و-ل (1690) = speech/saying. ق-و-م (583) = standing/establishing. ق-ل-ب (heart = the core that turns). The deep uvular pop = what cannot be taken back.","paired_letters":{"و (wāw)":"ق-و = force + connection (ق-و-ل speech, ق-و-م standing). Force that connects.","ل (lām)":"ق-ل = force + flow (ق-ل-ب heart). The heart = force flowing.","ب (bāʾ)":"ق-ب = force + contact (ق-ب-ل accepting). Accepting = force meeting contact."},"unique":"Abjad 100. ق-و-ل (1690) is the HIGHEST-frequency root in the entire Qur'an. ق appears as standalone muqaṭṭaʿa (Surah 50). Q36:82 أَمْرُهُ... كُن فَيَكُونُ — His أَمْر is to SAY (from ق-و-ل) كُن (from ك-و-ن). Speech IS creation. In the أَمْر system, ق = the execution engine — what DECLARES and EXECUTES."},"ك":{"name":"كَاف","transliteration":"kāf","abjad":20,"phonetic":{"makhraj":"أَدْنَى اللِّسَان مَعَ الحَنَك الأَعْلَى — back of tongue near soft palate (velar)","manner":"Voiceless velar plosive. Shallower than ق — tongue strikes soft palate rather than uvula. ك is the LIGHT version of ق.","voiced":false,"emphatic":false,"description":"Kāf is the velar stop. Abjad 20. ك roots: ك-و-ن (being/existence, 1032), ك-ف-ر (covering, 487), ك-ت-ب (writing, 311). ك = EXISTENCE, CONTAINMENT, COVERING. Q36:82: كُن فَيَكُونُ — BE and it IS. ك-و-ن is the root of BEING."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الكِتَاب","type":"Voiceless velar plosive","group":"حُرُوف لَهَوِيَّة — velar letters"},"behaviour":{"as_first_radical":"57 roots. Opens BEING/COVERING/WRITING: ك-و-ن (being, 1032), ك-ف-ر (covering, 487), ك-ت-ب (writing, 311), ك-ذ-ب (denial, 282). When ك opens, it ESTABLISHES existence or CONTAINS.","as_second_radical":"ذ-ك-ر (remembrance, 286), ح-ك-م (judgement, 195), و-ك-ل (reliance, 108). As core, ك is the VESSEL — what holds.","as_third_radical":"م-ل-ك (sovereignty, 185), ش-ر-ك (sharing, 149), ه-ل-ك (destruction, 44). As closer, ك GRASPS — the velar stop seizes.","as_prefix":"كَـ = like/as (comparison). كَمَثَلِ = like the example of. Also second person pronoun suffix: كِتَابُكَ = your book.","as_suffix":"ـكَ/ـكِ = your (second person possessive)."},"shifts":[{"downstream":"k","shift_id":"S20","note":"Preserved as k"},{"downstream":"c","shift_id":"S20","note":"ك→c in DS05 Latin"},{"downstream":"g","shift_id":"S20","note":"ك→g (voicing)"},{"downstream":"ch","shift_id":"S20","note":"ك→ch in some corridors"}],"quranic_stats":{"tokens_any_position":4804,"distinct_roots_any":127,"roots_as_first":57,"top5_first":[["ك-و-ن",1032],["ك-ف-ر",487],["ك-ت-ب",311],["ك-ذ-ب",282],["ك-ث-ر",166]],"top5_second":[["ذ-ك-ر",286],["ح-ك-م",195],["و-ك-ل",108],["أ-ك-ل",76],["ش-ك-ر",74]],"top5_third":[["م-ل-ك",185],["ش-ر-ك",149],["ه-ل-ك",44],["ت-ر-ك",40],["م-س-ك",35]],"muqattaat":["كهيعص — Surah 19"]},"semantic_tendency":"TAP. EXISTENCE. CONTAINMENT. COVERING. ك is the letter of WHAT IS: ك-و-ن (1032) = to be/exist. كُن = BE. ك-ف-ر (covering), ك-ت-ب (writing = prescribed containment). Abjad 20 = contained completeness.","paired_letters":{"و (wāw)":"ك-و = containment + connection (ك-و-ن being). Being = contained connection.","ف (fāʾ)":"ك-ف = containment + release (ك-ف-ر covering). Covering = sealed containment.","ت (tāʾ)":"ك-ت = containment + succession (ك-ت-ب writing). Writing = successive containment."},"unique":"Abjad 20. كُن (BE!) is the divine command of creation (Q36:82). ك-و-ن (1032) is the 2nd highest-frequency root. In the أَمْر system, ك = the instantiator — كُن = bring into being."},"ل":{"name":"لَام","transliteration":"lām","abjad":30,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ اللِّثَة العُلْيَا — tongue tip against upper gum ridge","manner":"Voiced alveolar lateral approximant. Air flows along the SIDES of the tongue while the tip touches the ridge. The FLOWING letter.","voiced":true,"emphatic":false,"description":"Lām is the lateral approximant. Abjad 30. The MOST CONNECTED letter by token count (14,445). Air flows AROUND the tongue = CONNECTION, BINDING, FLOWING. ل is the letter of ال (the definite article) — what DEFINES."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: اللَّيْل. BUT ل IS the second letter of ال — it defines ALL other letters.","type":"Voiced alveolar lateral approximant (liquid)","group":"حُرُوف ذَلْقِيَّة — tongue-tip letters (liquids)"},"behaviour":{"as_first_radical":"53 roots. Opens MEETING/NIGHT/NEGATION: ل-ق-ي (meeting, 113), ل-ي-ل (night, 99), ل-ي-س (is not, 59). When ل opens, it CONNECTS or BINDS.","as_second_radical":"أ-ل-ه (divinity, 2930 — THE HIGHEST), ع-ل-م (knowledge, 846), ظ-ل-م (displacement, 315), خ-ل-ق (creation, 261). As core, ل is THE FLOW — the connective tissue of the most important roots.","as_third_radical":"ق-و-ل (speech, 1690), ر-س-ل (sending, 509), ع-م-ل (action, 360), ج-ع-ل (making, 345). As closer, ل FLOWS ONWARD — the word does not stop but continues.","as_prefix":"لِـ = for/to (purpose). لَـ = surely/indeed (emphasis). ال = THE (definite article — the DEFINING function). لَا = not (negation).","as_suffix":"Not a standard suffix."},"shifts":[{"downstream":"l","shift_id":"S16","note":"Preserved as l (highest resistance after ر)"},{"downstream":"r / l swap","shift_id":"L-META","note":"ل↔ر metathesis in some corridors"}],"quranic_stats":{"tokens_any_position":14445,"distinct_roots_any":282,"roots_as_first":53,"top5_first":[["ل-ق-ي",113],["ل-ي-ل",99],["ل-ي-س",59],["ل-ع-ن",39],["ل-ب-ث",31]],"top5_second":[["أ-ل-ه",2930],["ع-ل-م",846],["ظ-ل-م",315],["خ-ل-ق",261],["و-ل-ي",204]],"top5_third":[["ق-و-ل",1690],["ر-س-ل",509],["ع-م-ل",360],["ج-ع-ل",345],["ن-ز-ل",293]],"muqattaat":["الم — Surahs 2,3,29,30,31,32. الر — Surahs 10,11,12,14,15. المص — Surah 7. المر — Surah 13"]},"semantic_tendency":"CONNECTION. DEFINITION. FLOW. BINDING. ل is in MORE roots than any other letter (14,445 tokens). أ-ل-ه (2930) = divinity. ع-ل-م (846) = knowledge. ق-و-ل (1690) = speech. ل connects everything — it IS the lattice itself.","paired_letters":{"ا (alif)":"ل-ا / ا-ل = THE definite article. Alif (unity) + lām (connection) = definition.","م (mīm)":"ل-م = flow + enclosure (الم muqaṭṭaʿāt, عِلْم knowledge). The core triad.","ه (hāʾ)":"ل-ه = flow + breath (أ-ل-ه divinity). The divine = flowing breath."},"unique":"Abjad 30. THE most connected letter — 14,445 tokens, appears in the TOP roots of EVERY category. ل IS ال — the definite article that defines all nouns. In the أَمْر system, ل = the connector — the pipe, the link, the binding operator."},"م":{"name":"مِيم","transliteration":"mīm","abjad":40,"phonetic":{"makhraj":"الشَّفَتَان — the two lips (bilabial)","manner":"Voiced bilabial nasal. Lips close, air passes through the nose. The NASAL partner of ب (bāʾ). Where ب explodes outward, م resonates inward.","voiced":true,"emphatic":false,"description":"Mīm is the bilabial nasal. Abjad 40. Lips close and SEAL — air redirected through nose = ENCLOSURE. م roots: م-ل-ك (sovereignty, 185), م-و-ت (death, 148), م-ث-ل (likeness, 119). م = ENCLOSURE. SEALING. WHAT IS CONTAINED."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: المَوْت","type":"Voiced bilabial nasal","group":"حُرُوف الشَّفَتَيْن — lip letters (nasal)"},"behaviour":{"as_first_radical":"70 roots. Opens SOVEREIGNTY/DEATH/LIKENESS: م-ل-ك (sovereignty, 185), م-و-ت (death, 148), م-ث-ل (likeness, 119). When م opens, it ENCLOSES or CONTAINS.","as_second_radical":"أ-م-ن (security, 832), س-م-و (elevation, 457), ع-م-ل (action, 360), أ-م-ر (command, 223). As core, م is the SEAL — what holds the root's content.","as_third_radical":"ع-ل-م (knowledge, 846), ق-و-م (standing, 583), ر-ح-م (womb, 553), ي-و-م (day, 551), ظ-ل-م (displacement, 315). As closer, م SEALS — the lips close the word with finality.","as_prefix":"مَـ = what/that which (مَا = what. مَنْ = who). مُـ = active participle prefix (مُسْلِم = one who submits). مَفْعُول pattern = passive participle (مَكْتُوب = written).","as_suffix":"ـم = plural masculine pronoun suffix (هُمْ = them, كُمْ = you all)."},"shifts":[{"downstream":"m","shift_id":"S17","note":"Preserved as m (nasal = highest resistance)"}],"quranic_stats":{"tokens_any_position":9522,"distinct_roots_any":268,"roots_as_first":70,"top5_first":[["م-ل-ك",185],["م-و-ت",148],["م-ث-ل",119],["م-و-ل",108],["م-و-س",105]],"top5_second":[["أ-م-ن",832],["س-م-و",457],["ع-م-ل",360],["أ-م-ر",223],["س-م-ع",197]],"top5_third":[["ع-ل-م",846],["ق-و-م",583],["ر-ح-م",553],["ي-و-م",551],["ظ-ل-م",315]],"muqattaat":["الم — Surahs 2,3,29,30,31,32. حم — Surahs 40-46. المص — Surah 7. المر — Surah 13"]},"semantic_tendency":"ENCLOSURE. SEALING. CONTAINMENT. FINALITY. م is the SEALER — lips close, word is contained. م-و-ت (death = final seal), م-ل-ك (sovereignty = sealed authority). As third radical in ع-ل-م, ق-و-م, ر-ح-م — م seals the deepest concepts.","paired_letters":{"ل (lām)":"م-ل = seal + flow (م-ل-ك sovereignty). Sealed flow = dominion.","و (wāw)":"م-و = seal + connection (م-و-ت death). Death = sealed connection.","ن (nūn)":"م-ن = seal + continuation (مِن from, مَن who). The sealed question."},"unique":"Abjad 40. The SEALER. م appears in more muqaṭṭaʿāt than any letter. م + ن = the two nasals = the MOST RESISTANT consonant pair in all languages. In the أَمْر system, م = the encapsulator — what wraps and seals data."},"ن":{"name":"نُون","transliteration":"nūn","abjad":50,"phonetic":{"makhraj":"طَرَف اللِّسَان مَعَ اللِّثَة العُلْيَا — tongue tip against upper gum ridge","manner":"Voiced alveolar nasal. Tongue tip touches ridge, air flows through nose. The CONTINUATION nasal — where م (mīm) seals with lips, ن continues with tongue.","voiced":true,"emphatic":false,"description":"Nūn is the alveolar nasal. Abjad 50. ن roots: ن-ف-س (self/soul, 296), ن-ز-ل (descending, 293), ن-و-ر (light, 191), ن-ذ-ر (warning, 134). ن = CONTINUATION. SOUL. DESCENT. The nasal hum that continues."},"classification":{"sun_moon":"Sun letter (شَمْسِيَّة) — assimilates: النُّور","type":"Voiced alveolar nasal","group":"حُرُوف ذَلْقِيَّة — tongue-tip letters (nasal)"},"behaviour":{"as_first_radical":"105 roots. Opens SOUL/DESCENT/LIGHT/WARNING: ن-ف-س (self, 296), ن-ز-ل (descending, 293), ن-و-ر (light, 191), ن-ذ-ر (warning, 134). When ن opens, it marks what CONTINUES or DESCENDS.","as_second_radical":"أ-ن-س (humanity, 263), ج-ن-ن (concealment, 172), ب-ن-ي (building, 128). As core, ن is the THREAD — what runs through.","as_third_radical":"ك-و-ن (being, 1032), أ-م-ن (security, 832), ب-ي-ن (clarity, 282), ح-س-ن (beauty, 189). As closer, ن HUMS — the word trails with nasal resonance, continuing.","as_prefix":"نَـ = first person plural imperfect (نَعْبُدُ = we devote). Also tanwīn (nunation): ـًا ـٍ ـٌ = indefinite marker.","as_suffix":"ـنَ = feminine plural. ـنَا = our/us."},"shifts":[{"downstream":"n","shift_id":"S18","note":"Preserved as n (nasal = highest resistance)"}],"quranic_stats":{"tokens_any_position":7924,"distinct_roots_any":261,"roots_as_first":105,"top5_first":[["ن-ف-س",296],["ن-ز-ل",293],["ن-و-ر",191],["ن-ذ-ر",134],["ن-ع-م",133]],"top5_second":[["أ-ن-س",263],["ج-ن-ن",172],["ب-ن-ي",128],["د-ن-ي",110],["غ-ن-ي",73]],"top5_third":[["ك-و-ن",1032],["أ-م-ن",832],["ب-ي-ن",282],["ح-س-ن",189],["ج-ن-ن",172]],"muqattaat":["ن — Surah 68 (standalone, opening of Sūrat al-Qalam)"]},"semantic_tendency":"CONTINUATION. SOUL. LIGHT. DESCENT. THE THREAD. ن continues what م seals: م closes, ن carries forward. ن-ف-س (soul = the continuing self), ن-و-ر (light = continuous illumination). As third radical in ك-و-ن (1032) and أ-م-ن (832) — ن carries BEING and SECURITY forward.","paired_letters":{"ف (fāʾ)":"ن-ف = continuation + release (ن-ف-س self). The self = what continues released.","و (wāw)":"ن-و = continuation + connection (ن-و-ر light). Light = connected continuation.","ز (zāy)":"ن-ز = continuation + energy (ن-ز-ل descent). Descending = energized continuation."},"unique":"Abjad 50. ن opens Surah 68 as standalone muqaṭṭaʿa — followed immediately by وَٱلْقَلَمِ (and the pen). ن + قَلَم = the nūn + the pen. Tanwīn (ـًا ـٍ ـٌ) = the hidden ن that makes nouns INDEFINITE. In the أَمْر system, ن = the continuation/loop — what keeps running."},"ه":{"name":"هَاء","transliteration":"hāʾ","abjad":5,"phonetic":{"makhraj":"أَقْصَى الحَلْق — deepest part of the throat (glottal)","manner":"Voiceless glottal fricative. Pure breath from the deepest point. The lightest consonant — almost just breath.","voiced":false,"emphatic":false,"description":"Hāʾ is the glottal breath. Abjad 5. PURE BREATH from the deepest point of the throat. ه roots: ه-د-ي (guidance, 259), ه-و-د (descending, 88). ه = BREATH. GUIDANCE. THE LIGHTEST TOUCH."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الهُدَى","type":"Voiceless glottal fricative","group":"حُرُوف الحَلْق — throat letters (deepest)"},"behaviour":{"as_first_radical":"42 roots. Opens GUIDANCE/DESCENT: ه-د-ي (guidance, 259), ه-و-د (descending, 88), ه-و-ر (collapsing, 61). When ه opens, it BREATHES — the lightest possible opening.","as_second_radical":"ش-ه-د (witnessing, 158), أ-ه-ل (people, 135), ظ-ه-ر (appearing, 58). As core, ه is the BREATH — what animates from within.","as_third_radical":"أ-ل-ه (divinity, 2930 — THE HIGHEST), و-ج-ه (face, 87). As closer, ه BREATHES OUT — the word ends in exhalation. أ-ل-ه (2930) ends with ه — DIVINITY concludes in pure breath.","as_prefix":"هَلْ = interrogative particle (هَلْ أَتَاكَ = has there come to you?). هُـ = third person masculine prefix in some forms.","as_suffix":"ـهُ/ـهِ = his/him/it. The third person pronoun = the ABSENT one referred to by breath."},"shifts":[{"downstream":"h","shift_id":"S23","note":"ه→h (preserved but weakened)"},{"downstream":"(drops)","shift_id":"S23","note":"ه drops entirely in many positions"}],"quranic_stats":{"tokens_any_position":5101,"distinct_roots_any":117,"roots_as_first":42,"top5_first":[["ه-د-ي",259],["ه-و-د",88],["ه-و-ر",61],["ه-و-ي",49],["ه-ل-ك",44]],"top5_second":[["ش-ه-د",158],["أ-ه-ل",135],["ج-ه-ن-م",77],["ظ-ه-ر",58],["ن-ه-ر",56]],"top5_third":[["أ-ل-ه",2930],["و-ج-ه",87],["م-و-ه",71],["ك-ر-ه",33],["ف-ق-ه",20]],"muqattaat":["كهيعص — Surah 19. طه — Surah 20"]},"semantic_tendency":"BREATH. GUIDANCE. THE LIGHTEST. THE DEEPEST. ه is almost nothing — pure breath. Yet it closes the HIGHEST root: أ-ل-ه (2930) = divinity ends in breath. ه-د-ي (259) = guidance starts in breath. The lightest letter carries the heaviest concept.","paired_letters":{"د (dāl)":"ه-د = breath + anchor (ه-د-ي guidance). Guidance = breath that anchors.","ل (lām)":"ه-ل = breath + flow (ه-ل-ك destruction). Destruction = breath flowing away.","و (wāw)":"ه-و = breath + connection (ه-و-ي desire). Desire = breath seeking connection."},"unique":"Abjad 5. The BREATH letter. أ-ل-ه ends with ه — the name of Allah concludes in breath. The تَاء مَرْبُوطَة (ة) is a ه with two dots — the feminine ending IS a hāʾ. In the أَمْر system, ه = the null/void — the lightest possible state, pure space."},"و":{"name":"وَاو","transliteration":"wāw","abjad":6,"phonetic":{"makhraj":"الشَّفَتَان — the two lips (bilabial approximant)","manner":"Voiced bilabial-velar approximant / semivowel. Lips round, back of tongue rises. Serves as BOTH consonant (w) AND long vowel (ū/ō).","voiced":true,"emphatic":false,"description":"Wāw is the rounded semivowel. Abjad 6. DUAL NATURE — consonant AND vowel. The CONNECTOR. و as particle = AND (the most frequent word in the Qur'an). و roots: و-ل-ي (closeness/governance, 204), و-ق-ي (protection, 162), و-ع-د (promise, 139). و = CONNECTION. JOINING. AND."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: الوَعْد","type":"Voiced bilabial-velar approximant / semivowel","group":"حُرُوف العِلَّة — weak/vowel letters"},"behaviour":{"as_first_radical":"81 roots. Opens CLOSENESS/PROTECTION/PROMISE: و-ل-ي (closeness, 204), و-ق-ي (protection, 162), و-ع-د (promise, 139), و-ك-ل (reliance, 108). When و opens, it CONNECTS or PROTECTS.","as_second_radical":"ق-و-ل (speech, 1690), ك-و-ن (being, 1032), ق-و-م (standing, 583), ي-و-م (day, 551). As core, و is the BRIDGE — connecting first and last radical.","as_third_radical":"س-م-و (elevation, 457), د-ع-و (calling, 123), ص-ل-و (connection, 86). As closer, و OPENS OUT — the lips round and release.","as_prefix":"وَ = AND (conjunction). The most frequent word in the Qur'an. Every sentence connects to the next through و.","as_suffix":"ـوا = third person masculine plural past (كَتَبُوا = they wrote). ـون = masculine plural present (يَكْتُبُونَ = they write)."},"shifts":[{"downstream":"w","shift_id":"S10","note":"Preserved as w"},{"downstream":"v","shift_id":"S10","note":"و→v in many DS corridors"},{"downstream":"o","shift_id":"S10","note":"و→o (vowelized)"},{"downstream":"r","shift_id":"S10","note":"و→r in some rare corridors"}],"quranic_stats":{"tokens_any_position":12299,"distinct_roots_any":325,"roots_as_first":81,"top5_first":[["و-ل-ي",204],["و-ق-ي",162],["و-ع-د",139],["و-ك-ل",108],["و-ج-د",97]],"top5_second":[["ق-و-ل",1690],["ك-و-ن",1032],["ق-و-م",583],["ي-و-م",551],["أ-و-ل",199]],"top5_third":[["س-م-و",457],["د-ع-و",123],["ص-ل-و",86],["ت-ل-و",71],["أ-ل-و",67]],"muqattaat":[]},"semantic_tendency":"ROUNDING. AND. JOINING. BRIDGING. THE LINK. و IS connection itself: the word AND. As middle radical in ق-و-ل (1690), ك-و-ن (1032), ق-و-م (583) — و bridges the BIGGEST roots. The rounded lips = embrace = what brings together.","paired_letters":{"ل (lām)":"و-ل = connection + flow (و-ل-ي closeness). Closeness = connected flow.","ق (qāf)":"و-ق = connection + force (و-ق-ي protection). Protection = connected force.","ع (ʿayn)":"و-ع = connection + depth (و-ع-د promise). Promise = deep connection."},"unique":"Abjad 6. وَ (AND) is the most frequent word in the entire Qur'an. و is in the CORE of the three highest roots: ق-و-ل, ك-و-ن, ق-و-م. DUAL nature: consonant + vowel. In the أَمْر system, و = the AND operator — the fundamental connector."},"ي":{"name":"يَاء","transliteration":"yāʾ","abjad":10,"phonetic":{"makhraj":"وَسَط اللِّسَان مَعَ الحَنَك — middle tongue toward palate","manner":"Voiced palatal approximant / semivowel. Tongue body rises toward palate. Serves as BOTH consonant (y) AND long vowel (ī/ē). The REACHING letter — tongue extends upward.","voiced":true,"emphatic":false,"description":"Yāʾ is the palatal semivowel. Abjad 10. DUAL NATURE — consonant AND vowel (like و). ي roots: ي-و-م (day, 551), ي-م-ن (right/oath, 125), ي-د-ي (hand, 106). ي = REACHING. EXTENSION. TIME. The tongue reaches up = aspiration, extension toward."},"classification":{"sun_moon":"Moon letter (قَمَرِيَّة) — does not assimilate: اليَوْم","type":"Voiced palatal approximant / semivowel","group":"حُرُوف العِلَّة — weak/vowel letters"},"behaviour":{"as_first_radical":"13 roots — rare as opener. ي-و-م (day, 551), ي-م-ن (right/oath, 125), ي-د-ي (hand, 106). When ي opens, it marks TIME or EXTENSION.","as_second_radical":"أ-ي-ي (sign, 388), ش-ي-أ (thing, 355), ب-ي-ن (clarity, 282), خ-ي-ر (good, 191). As core, ي is the REACH — extension at the heart of the root.","as_third_radical":"أ-ي-ي (sign, 388), أ-ت-ي (coming, 385), ه-د-ي (guidance, 259), و-ل-ي (closeness, 204). As closer, ي EXTENDS — the word reaches forward, does not stop.","as_prefix":"يَـ = third person masculine imperfect (يَعْلَمُ = he knows). Also vocative in يَا (يَا أَيُّهَا النَّاسُ = O people).","as_suffix":"ـي = my (first person possessive). ـين = masculine plural oblique."},"shifts":[{"downstream":"y","shift_id":"S27","note":"ي→y (preserved as palatal approximant)"},{"downstream":"i","shift_id":"S27","note":"ي→i/ī (vowelized, loses consonantal quality)"}],"quranic_stats":{"tokens_any_position":8429,"distinct_roots_any":224,"roots_as_first":13,"top5_first":[["ي-و-م",551],["ي-م-ن",125],["ي-د-ي",106],["ي-ت-م",49],["ي-س-ر",31]],"top5_second":[["أ-ي-ي",388],["ش-ي-أ",355],["ب-ي-ن",282],["خ-ي-ر",191],["ح-ي-ي",153]],"top5_third":[["أ-ي-ي",388],["أ-ت-ي",385],["ه-د-ي",259],["و-ل-ي",204],["و-ق-ي",162]],"muqattaat":["يس — Surah 36. كهيعص — Surah 19"]},"semantic_tendency":"CONTRACTION. REACHING. TIME. ASPIRATION. ي is the letter of REACHING FORWARD: ي-و-م (day = a unit of time extending), ي-د-ي (hand = what reaches), ي-م-ن (right side = the reaching hand). As يَا it CALLS OUT — reaching toward the addressed.","paired_letters":{"و (wāw)":"ي-و = extension + connection (ي-و-م day). A day = connected extension of time.","م (mīm)":"ي-م = extension + seal (ي-م-ن oath). An oath = sealed extension.","د (dāl)":"ي-د = extension + position (ي-د-ي hand). Hand = positioned extension."},"unique":"Abjad 10. DUAL nature like و — consonant + vowel. يَا = the VOCATIVE — how you CALL someone. The reaching call. ي-و-م (551) = day — the fundamental unit of TIME in the Qur'an. Q1:4 مَالِكِ يَوْمِ الدِّينِ — Master of the يَوْم of the دِين. In the أَمْر system, ي = the iterator/pointer — what reaches toward the next element."}},"ABJAD":{"ا":1,"ب":2,"ج":3,"د":4,"ه":5,"و":6,"ز":7,"ح":8,"ط":9,"ي":10,"ك":20,"ل":30,"م":40,"ن":50,"س":60,"ع":70,"ف":80,"ص":90,"ق":100,"ر":200,"ش":300,"ت":400,"ث":500,"خ":600,"ذ":700,"ض":800,"ظ":900,"غ":1000}};

const AMR_I18N = {"ا":{"name":"أَلِف","transliteration":"alif","abjad":1,"top_roots":[{"root":"ا-ج-ج","amr":"ا(1)=ORIGIN | ج(3)=GATHERING | ج(3)=GATHERING [=7]"},{"root":"ا-ز-ر","amr":"ا(1)=ORIGIN | ز(7)=PAIRING | ر(200)=MOVEMENT [=208]"},{"root":"ا-ل-س","amr":"ا(1)=ORIGIN | ل(30)=CONNECTION | س(60)=FLOW [=91]"},{"root":"ا-ن-س","amr":"ا(1)=ORIGIN | ن(50)=CONTINUATION | س(60)=FLOW [=111]"},{"root":"ا-و-ب","amr":"ا(1)=ORIGIN | و(6)=CONNECTION | ب(2)=BUILDING [=9]"}],"en":[],"ru":[],"de":[],"uz":[]},"ب":{"name":"بَاء","transliteration":"bāʾ","abjad":2,"top_roots":[{"root":"ب-ش-ر","amr":"ب(2)=BUILDING | ش(300)=SPREADING | ر(200)=MOVEMENT [=502]"},{"root":"ب-ص-ر","amr":"ب(2)=BUILDING | ص(90)=TRUTH | ر(200)=MOVEMENT [=292]"},{"root":"ب-ع-د","amr":"ب(2)=BUILDING | ع(70)=DEPTH | د(4)=CALLING [=76]"},{"root":"ب-ن-ي","amr":"ب(2)=BUILDING | ن(50)=CONTINUATION | ي(10)=EXTENSION [=62]"},{"root":"ب-ي-ن","amr":"ب(2)=BUILDING | ي(10)=EXTENSION | ن(50)=CONTINUATION [=62]"}],"en":["BASHER","VISOR","BESIEGE","BAD","BONE","BAN","BANNER","BANE","TAB","RABBI","REBAR","SABLE","SYMBOL","ABODE","ADEPT"],"ru":["БИСЕР","БЕСИЕГЕ","ВИЗИР","ВОЙНА","БАНЕ","ТАБУН","РЕБАР","РАВВИН","САБЛЯ","КУПОЛ","КАБЛУК","КАБАЛА","КОБЕЛЬ","ГОЛОВА","КЛУБ"],"de":["SCHLÄGER","VISIER","BESIEGE","BANNER","VERBANNEN","BANE","REITER","RABBINER","REBÄR","SABEL","SYMBOL","WOHNSTÄTTE","ADEPT","ADAPT","ADOPT"],"uz":["qalb","kitob","kotib","maktab","maktub","kutubxona","badan","bozor"]},"ت":{"name":"تَاء","transliteration":"tāʾ","abjad":400,"top_roots":[{"root":"ء-ت-ي","amr":"ء(1)=ORIGIN | ت(400)=SUCCESSION | ي(10)=EXTENSION [=411]"},{"root":"أ-ت-ي","amr":"ء(1)=ORIGIN | ت(400)=SUCCESSION | ي(10)=EXTENSION [=411]"},{"root":"ب-ي-ت","amr":"ب(2)=BUILDING | ي(10)=EXTENSION | ت(400)=SUCCESSION [=412]"},{"root":"ت-ب-ع","amr":"ت(400)=SUCCESSION | ب(2)=BUILDING | ع(70)=DEPTH [=472]"},{"root":"ت-ج-ر","amr":"ت(400)=SUCCESSION | ج(3)=GATHERING | ر(200)=MOVEMENT [=603]"}],"en":["OUTTA","ATE","BAIT","BITE","BEAT","TAB","TACIT","TIGHT","TELL","TALE","TRIBE","TUBE","CATTLE","CUTLASS","KILL"],"ru":["АТЕ","БИТЕ","БЕАТ","ТАБУН","ТАХТА","СПРАВЕДЛИВОСТЬ","ТУБЕ","КОТЁЛ","КИЛЛ","КЕТТЛЕ","КИТАБ","СКРИПТ","МУТЕ","СМЕРТЬ","МЁРТВЫЙ"],"de":["OUTTA","AT","BAIT","BITE","BEAT","REITER","TACIT","TIGHT","TELL","TALE","STAMM","TUBE","CATTLE","CUTLASS","KILL"],"uz":["kitob","kotib","maktab","maktub","kutubxona"]},"ث":{"name":"ثَاء","transliteration":"thāʾ","abjad":500,"top_roots":[{"root":"أ-ث-ر","amr":"ء(1)=ORIGIN | ث(500)=MULTIPLICATION | ر(200)=MOVEMENT [=701]"},{"root":"أ-ث-م","amr":"ء(1)=ORIGIN | ث(500)=MULTIPLICATION | م(40)=ENCLOSURE [=541]"},{"root":"ب-ع-ث","amr":"ب(2)=BUILDING | ع(70)=DEPTH | ث(500)=MULTIPLICATION [=572]"},{"root":"ث-ق-ل","amr":"ث(500)=MULTIPLICATION | ق(100)=SPEECH | ل(30)=CONNECTION [=630]"},{"root":"ث-ل-ث","amr":"ث(500)=MULTIPLICATION | ل(30)=CONNECTION | ث(500)=MULTIPLICATION [=1030]"}],"en":["ETHER","ATOM","BOOST","BATH","TACKLE","TICKLE","HEALTH","FILTH","THAW","DAMMIT","TIMBER","THAWB","HADITH","HEADY","ACCRUE"],"ru":["УТРО","БАТХ","ТИККЛЕ","ХЕАЛТХ","ФИЛТХ","ТХАВ","ДАММИТ","ТХАВБ","ХАДИТХ","ХЕАДИ","КАТХЕТЕР","ЛАБИРИНТХ","ЛОАТХЕ","АПТЕКА","ВОУКХ"],"de":["ÄTHER","ATOM","VERSTÄRKEN","BATH","ANPACKEN","TICKLE","HEALTH","FILTH","THAW","DAMMIT","HOLZ","THAWB","HADITH","HEADY","ANWACHSEN"],"uz":[]},"ج":{"name":"جِيم","transliteration":"jīm","abjad":3,"top_roots":[{"root":"أ-ج-ر","amr":"ء(1)=ORIGIN | ج(3)=GATHERING | ر(200)=MOVEMENT [=204]"},{"root":"ج-ع-ل","amr":"ج(3)=GATHERING | ع(70)=DEPTH | ل(30)=CONNECTION [=103]"},{"root":"ج-م-ع","amr":"ج(3)=GATHERING | م(40)=ENCLOSURE | ع(70)=DEPTH [=113]"},{"root":"ج-ن-ن","amr":"ج(3)=GATHERING | ن(50)=CONTINUATION | ن(50)=CONTINUATION [=103]"},{"root":"ج-ي-ء","amr":"ج(3)=GATHERING | ي(10)=EXTENSION | ء(1)=ORIGIN [=14]"}],"en":["ACRE","JEWEL","JELL","GAME","JAM","JUMBLE","GEM","GUM","JAMBOREE","Genie","GENE","GENIUS","JINNI","JAW","JOY"],"ru":["ДжЕЛЛ","ГЕНЕ","ГЕНИУС","ДжИННИ","ДЖИНН","ДжОИ","ХИРУРГИЯ","ДРУГ","ИОКЕ","ДжОУСТ","МЕЧЕТЬ","МАСДЖИД","ВОЖДЬ","ВИДГЕТ","ВОГУЕ"],"de":["ACKER","JUWEL","JELL","DSCHINN","GENE","GENIUS","JINNI","KIEFER","JOY","CHARGE","CARGO","DEGRADE","GRAT","BELAGERUNG","YOKE"],"uz":["juma","jamoa","masjid","jihod"]},"ح":{"name":"حَاء","transliteration":"ḥāʾ","abjad":8,"top_roots":[{"root":"أ-ح-د","amr":"ء(1)=ORIGIN | ح(8)=TRUTH | د(4)=CALLING [=13]"},{"root":"ح-س-ب","amr":"ح(8)=TRUTH | س(60)=FLOW | ب(2)=BUILDING [=70]"},{"root":"ح-س-ن","amr":"ح(8)=TRUTH | س(60)=FLOW | ن(50)=CONTINUATION [=118]"},{"root":"ح-ق-ق","amr":"ح(8)=TRUTH | ق(100)=SPEECH | ق(100)=SPEECH [=208]"},{"root":"ح-ك-م","amr":"ح(8)=TRUTH | ك(20)=BEING | م(40)=ENCLOSURE [=68]"}],"en":["EACH","HOPE","HESB","HASTY","HONEST","CHECK","HACK","HOKUM","HIGH","HIVE","RHYME","ROOM","Racket","RUSH","SPACE"],"ru":["ЕАКХ","ХАСТИ","ХАКИ","ХОКУМ","ХИВЕ","РООМ","РИФМА","РУСХ","РАКЕТКА","СПАН","СОАП","СОПХОС","СЛАБ","СУЛК","НОАХ"],"de":["EACH","HOPE","HESB","HASTY","SCHACH","HACKEN","HOKUM","HOCH","HIV","REIM","ROOM","RAKETT","RUSH","RAUM","SPAN"],"uz":["haq","haqiqat","huquq","hukm","hakim","hikmat","hukumat","mahkama","rahm","rahmat","ramazon","ruh","haram","halol"]},"خ":{"name":"خَاء","transliteration":"khāʾ","abjad":600,"top_roots":[{"root":"ء-خ-ذ","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ذ(700)=REMEMBRANCE [=1301]"},{"root":"أ-خ-ذ","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ذ(700)=REMEMBRANCE [=1301]"},{"root":"أ-خ-ر","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ر(200)=MOVEMENT [=801]"},{"root":"أ-خ-و","amr":"ء(1)=ORIGIN | خ(600)=CREATION | و(6)=CONNECTION [=607]"},{"root":"خ-ر-ج","amr":"خ(600)=CREATION | ر(200)=MOVEMENT | ج(3)=GATHERING [=803]"}],"en":["ACHE","ACHIEVE","OCHRE","OGRE","ECHO","CHARGE","CARGO","Caliphate","CALF","CALIPH","CHALK","COWARD","COW","HERO","CHOIR"],"ru":["АКХИЕВЕ","ХИРУРГИЯ","ХЛОПОК","ХОЛОП","КАЛФ","КАЛИПХ","ШЁЛК","КХОИР","МИТКАЛЬ","ШАЙКА","ЗЕРКАЛО","МАСКА"],"de":["SCHMERZ","ACHIEVE","OCHRE","OGRE","ECHO","CHARGE","CARGO","KALIFAT","CALF","CALIPH","KREIDE","HELD","CHOIR","DOCIL","MASKE"],"uz":[]},"د":{"name":"دَال","transliteration":"dāl","abjad":4,"top_roots":[{"root":"ب-ع-د","amr":"ب(2)=BUILDING | ع(70)=DEPTH | د(4)=CALLING [=76]"},{"root":"د-خ-ل","amr":"د(4)=CALLING | خ(600)=CREATION | ل(30)=CONNECTION [=634]"},{"root":"د-ع-و","amr":"د(4)=CALLING | ع(70)=DEPTH | و(6)=CONNECTION [=80]"},{"root":"د-ن-ي","amr":"د(4)=CALLING | ن(50)=CONTINUATION | ي(10)=EXTENSION [=64]"},{"root":"د-و-ن","amr":"د(4)=CALLING | و(6)=CONNECTION | ن(50)=CONTINUATION [=60]"}],"en":["BAD","DOCILE","DUE","DAW","DAWN","DEAN","DIN","DINE","ROD","SERVANT","SHUDDER","SHAD","SHED","SHADOW","SHADE"],"ru":["МИТКАЛЬ","ДАВ","ДИВАН","ДЕНЬ","ДИН","ДИНЕ","ПРАВДА","СТРАЖА","ЩИТ","СХАД","ШАХТА","СХАДЕ","ГЕОМЕТРИЯ","КЕДР","КАДРЕ"],"de":["DOCIL","FÄLLIG","DAW","MORGENDÄMMERUNG","DIN","DIENER","SHUDDER","SHAD","SHED","SHADOW","SHADE","SYNDISCH","WOHNSTÄTTE","KADER","CADRE"],"uz":["dunyo","dehqonchilik","dasturxon"]},"ذ":{"name":"ذَال","transliteration":"dhāl","abjad":700,"top_roots":[{"root":"ء-خ-ذ","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ذ(700)=REMEMBRANCE [=1301]"},{"root":"أ-خ-ذ","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ذ(700)=REMEMBRANCE [=1301]"},{"root":"أ-ذ-ن","amr":"ء(1)=ORIGIN | ذ(700)=REMEMBRANCE | ن(50)=CONTINUATION [=751]"},{"root":"أ-ذ-ي","amr":"ء(1)=ORIGIN | ذ(700)=REMEMBRANCE | ي(10)=EXTENSION [=711]"},{"root":"ذ-ر-ر","amr":"ذ(700)=REMEMBRANCE | ر(200)=MOVEMENT | ر(200)=MOVEMENT [=1100]"}],"en":["ACHE","ACHIEVE","EDEN","AUDITION","AUDIENCE","ADORN","DRIZZLE","DRYER","DECREE","DECORUM","DUNB","DUNE","DANK","DAHAB","DEBIT"],"ru":["АКХИЕВЕ","АДОРН","ДРИЗЗЛЕ","ДРИЕР","ДЕКОР","ДЕКОРУМ","ДУНБ","ДУНЕ","ДАНК","ЯЗЫК","КАДЕТ","ТУНДРА","НЕРД"],"de":["SCHMERZ","ACHIEVE","EDEN","AUDITION","AUDIENZ","ADORN","DRIZZLE","DRYER","DEKRET","DECORUM","DUNB","DUNE","DANK","DAHAB","DEBIT"],"uz":[]},"ر":{"name":"رَاء","transliteration":"rāʾ","abjad":200,"top_roots":[{"root":"أ-خ-ر","amr":"ء(1)=ORIGIN | خ(600)=CREATION | ر(200)=MOVEMENT [=801]"},{"root":"أ-ر-ض","amr":"ء(1)=ORIGIN | ر(200)=MOVEMENT | ض(800)=DISPLACEMENT [=1001]"},{"root":"أ-م-ر","amr":"ء(1)=ORIGIN | م(40)=ENCLOSURE | ر(200)=MOVEMENT [=241]"},{"root":"خ-ر-ج","amr":"خ(600)=CREATION | ر(200)=MOVEMENT | ج(3)=GATHERING [=803]"},{"root":"ذ-ك-ر","amr":"ذ(700)=REMEMBRANCE | ك(20)=BEING | ر(200)=MOVEMENT [=920]"}],"en":["OCHRE","OGRE","Earth","ARID","Empire","Admiral","Army","AMOUR","EMIR","CHARGE","CARGO","DECREE","DECORUM","Mirror","RAY"],"ru":["АРИД","ЗЕМЛЯ","АДМИРАЛ","АМОУР","ЕМИР","ХИРУРГИЯ","ДЕКОР","ДЕКОРУМ","РАИ","ЗЕРКАЛО","РЕБАР","РАВВИН","РООМ","РИФМА","РЕМЕСЛО"],"de":["OCHRE","OGRE","ERDE","ARID","IMPERIUM","ADMIRAL","ARMEE","AMOUR","EMIR","CHARGE","CARGO","DEKRET","DECORUM","SPIEGEL","RAY"],"uz":["amir","amr","rahm","rahmat","ramazon","rizq","ruh"]},"ز":{"name":"زَاي","transliteration":"zāy","abjad":7,"top_roots":[{"root":"ج-ز-أ","amr":"ج(3)=GATHERING | ز(7)=PAIRING | ء(1)=ORIGIN [=11]"},{"root":"ج-ز-ي","amr":"ج(3)=GATHERING | ز(7)=PAIRING | ي(10)=EXTENSION [=20]"},{"root":"ر-ج-ز","amr":"ر(200)=MOVEMENT | ج(3)=GATHERING | ز(7)=PAIRING [=210]"},{"root":"ر-ز-ق","amr":"ر(200)=MOVEMENT | ز(7)=PAIRING | ق(100)=SPEECH [=307]"},{"root":"ز-ك-و","amr":"ز(7)=PAIRING | ك(20)=BEING | و(6)=CONNECTION [=33]"}],"en":["JUST","JUSTICE","JERSEY","Risk","SAKE","SIEGE","YOKE","JOUST","SEED","ZEAL","SANE","AGELESS","AZURE","ASSESS","ASSET"],"ru":["ДжЕРСЕИ","РИСК","ИОКЕ","ДжОУСТ","ЗЕАЛ","АГЕЛЕСС","АССЕСС","АССЕТ","ЛАЗУРЬ","ФОЕС","НАСАЛ"],"de":["JUST","JUSTICE","JERSEY","RISIKO","SAKE","BELAGERUNG","YOKE","JOUST","SEED","ZEAL","SANE","AGELESS","AZURBLAU","ASSESS","ASSET"],"uz":["rizq","foiz","zanjir"]},"س":{"name":"سِين","transliteration":"sīn","abjad":60,"top_roots":[{"root":"أ-ن-س","amr":"ء(1)=ORIGIN | ن(50)=CONTINUATION | س(60)=FLOW [=111]"},{"root":"ح-س-ب","amr":"ح(8)=TRUTH | س(60)=FLOW | ب(2)=BUILDING [=70]"},{"root":"ح-س-ن","amr":"ح(8)=TRUTH | س(60)=FLOW | ن(50)=CONTINUATION [=118]"},{"root":"خ-س-ر","amr":"خ(600)=CREATION | س(60)=FLOW | ر(200)=MOVEMENT [=860]"},{"root":"ر-س-ل","amr":"ر(200)=MOVEMENT | س(60)=FLOW | ل(30)=CONNECTION [=290]"}],"en":["ONUS","ANNOUNCE","HOPE","HESB","HASTY","HONEST","CURSOR","CENSER","MIRACLE","RESALE","SABLE","SYMBOL","Solemn","PSALM","SLAM"],"ru":["АНИС","АННОУНКЕ","ХАСТИ","КУРСОР","КЕНСЕР","РЕМЕСЛО","РЕСАЛЕ","САБЛЯ","ЧАЛМА","ПСАЛМ","СЛАМ","СЕМАПХОРЕ","САМОВАР","СЕМИНАР","НАВЕ"],"de":["LAST","ANNOUNCE","HOPE","HESB","HASTY","CURSOR","CENSER","MIRAKEL","RESALE","SABEL","SYMBOL","FEIERLICH","PSALM","SLAM","EINBERUFEN"],"uz":["salom","islom","muslim","musulmon","nafs","nafas","masjid","savdo"]},"ش":{"name":"شِين","transliteration":"shīn","abjad":300,"top_roots":[{"root":"ب-ش-ر","amr":"ب(2)=BUILDING | ش(300)=SPREADING | ر(200)=MOVEMENT [=502]"},{"root":"ب-ط-ش","amr":"ب(2)=BUILDING | ط(9)=AUTHORITY | ش(300)=SPREADING [=311]"},{"root":"ح-ش-ر","amr":"ح(8)=TRUTH | ش(300)=SPREADING | ر(200)=MOVEMENT [=508]"},{"root":"خ-ش-ي","amr":"خ(600)=CREATION | ش(300)=SPREADING | ي(10)=EXTENSION [=910]"},{"root":"ش-د-د","amr":"ش(300)=SPREADING | د(4)=CALLING | د(4)=CALLING [=308]"}],"en":["BASHER","HEARSE","HARSH","CAUTION","CASH","SHUDDER","SHAD","SHARE","SHARK","SHED","SHADOW","SHADE","SHOW","THRASH","ASHER"],"ru":["БИТЬ","ХЕАРСЕ","ХАРСХ","КАСХ","СТРАЖА","ЩИТ","СХАД","ЧУРЕК","СХАРК","ШАХТА","СХАДЕ","ТХРАСХ","АСХЕР","ПАРУС","ПАРЧА"],"de":["SCHLÄGER","HEARSE","HARSH","CASH","SHUDDER","SHAD","ANTEIL","SHARK","SHED","SHADOW","SHADE","ZEIGEN","THRASH","ASHER","EINRICHTEN"],"uz":["shukr"]},"ص":{"name":"صَاد","transliteration":"ṣād","abjad":90,"top_roots":[{"root":"ب-ص-ر","amr":"ب(2)=BUILDING | ص(90)=TRUTH | ر(200)=MOVEMENT [=292]"},{"root":"ح-ي-ص","amr":"ح(8)=TRUTH | ي(10)=EXTENSION | ص(90)=TRUTH [=108]"},{"root":"خ-ل-ص","amr":"خ(600)=CREATION | ل(30)=CONNECTION | ص(90)=TRUTH [=720]"},{"root":"ر-ب-ص","amr":"ر(200)=MOVEMENT | ب(2)=BUILDING | ص(90)=TRUTH [=292]"},{"root":"ص-ب-ر","amr":"ص(90)=TRUTH | ب(2)=BUILDING | ر(200)=MOVEMENT [=292]"}],"en":["VISOR","BESIEGE","Class","CLASSIC","REBUS","SPIRIT","SABRE","SABER","CYBER","SAHIB","SLAB","SYNDIC","SALUTE","SALVATION","SULK"],"ru":["БИСЕР","БЕСИЕГЕ","ВИЗИР","ГЛАЗ","КЛАССИК","РЕБУС","ЗАБОР","САБЕР","КИБЕР","СЛАБ","СУЛК","СТИР","СИРЕ","ПОСОЛ","УКСУС"],"de":["VISIER","BESIEGE","KLASSE","CLASSISCH","REBUS","GEIST","SÄBEL","SABER","CYBER","SAHIB","SLAB","SYNDISCH","SALVATION","SULK","STIR"],"uz":["sabr","nasr","sifr"]},"ض":{"name":"ضَاد","transliteration":"ḍād","abjad":800,"top_roots":[{"root":"أ-ر-ض","amr":"ء(1)=ORIGIN | ر(200)=MOVEMENT | ض(800)=DISPLACEMENT [=1001]"},{"root":"ب-ع-ض","amr":"ب(2)=BUILDING | ع(70)=DEPTH | ض(800)=DISPLACEMENT [=872]"},{"root":"ح-ض-ر","amr":"ح(8)=TRUTH | ض(800)=DISPLACEMENT | ر(200)=MOVEMENT [=1008]"},{"root":"ر-و-ض","amr":"ر(200)=MOVEMENT | و(6)=CONNECTION | ض(800)=DISPLACEMENT [=1006]"},{"root":"ض-ر-ب","amr":"ض(800)=DISPLACEMENT | ر(200)=MOVEMENT | ب(2)=BUILDING [=1002]"}],"en":["Earth","ARID","PATH","BATHE","BADGE","HAZIER","Drub","DISTURB","DREAD","TERROR","DIRE","DWARF","DEAF","THIEF","DULL"],"ru":["АРИД","ЗЕМЛЯ","БАДГЕ","ХАЗИЕР","ДЕРЖАВА","ДЕРВИШ","ДИСТУРБ","ДЕЛИ","АРИСЕ","ПОДВАЛ","ФИСКАЛ","КАСЕ","КАУСЕ","КАДИ","МУРЗА"],"de":["ERDE","ARID","PATH","BATHE","BADGE","HAZIER","VERPRÜGELN","DISTURB","DREAD","TERROR","DIRE","DWARF","DEAF","THIEF","STUMPF"],"uz":[]},"ط":{"name":"طَاء","transliteration":"ṭāʾ","abjad":9,"top_roots":[{"root":"ب-ط-ل","amr":"ب(2)=BUILDING | ط(9)=AUTHORITY | ل(30)=CONNECTION [=41]"},{"root":"ب-ط-ن","amr":"ب(2)=BUILDING | ط(9)=AUTHORITY | ن(50)=CONTINUATION [=61]"},{"root":"ح-و-ط","amr":"ح(8)=TRUTH | و(6)=CONNECTION | ط(9)=AUTHORITY [=23]"},{"root":"س-ل-ط","amr":"س(60)=FLOW | ل(30)=CONNECTION | ط(9)=AUTHORITY [=99]"},{"root":"ش-ط-ن","amr":"ش(300)=SPREADING | ط(9)=AUTHORITY | ن(50)=CONTINUATION [=359]"}],"en":["BATTLE","BOTTLE","BUTTON","HOOT","Sultan","Sultana","Salute","SALT","ASSAULT","SHUNT","STAIN","STREET","STRAIT","TAME","THYME"],"ru":["БАТТЛЕ","БОТТЛЕ","БУТТОН","ХООТ","САЛТ","АССАУЛТ","СУЛТАН","СУЛТАНКА","БАСТИОН","ИСТИНА","СМЕРТЬ","ШАРИАТ","СТРАИТ","ТХИМЕ","ТОВ"],"de":["BATTLE","BOTTLE","BUTTON","HOOT","SULTAN","SALT","ASSAULT","SHUNT","STAIN","STRASSE","STRAIT","TAME","THYME","FROMM","TOW"],"uz":[]},"ظ":{"name":"ظَاء","transliteration":"ẓāʾ","abjad":900,"top_roots":[{"root":"ح-ظ-ظ","amr":"ح(8)=TRUTH | ظ(900)=DISPLACEMENT | ظ(900)=DISPLACEMENT [=1808]"},{"root":"ح-ف-ظ","amr":"ح(8)=TRUTH | ف(80)=SEPARATION | ظ(900)=DISPLACEMENT [=988]"},{"root":"ظ-ل-ل","amr":"ظ(900)=DISPLACEMENT | ل(30)=CONNECTION | ل(30)=CONNECTION [=960]"},{"root":"ظ-ل-م","amr":"ظ(900)=DISPLACEMENT | ل(30)=CONNECTION | م(40)=ENCLOSURE [=970]"},{"root":"ظ-م-أ","amr":"ظ(900)=DISPLACEMENT | م(40)=ENCLOSURE | ء(1)=ORIGIN [=941]"}],"en":["HAFIZ","ZEALOT","GLOOM","REALM","THALAMI","ZONE","ZEN","AUTHOR","AMAZING","AMAZON","AUTUMN","Nadir","NATURE","WASTE"],"ru":["ХАФИЗ","ЗЛОЙ","ТХАЛАМИ","АУТУМН","НАТУРЕ","НАДИР","ВАСТЕ"],"de":["HAFIZ","ZELOT","GLOOM","REALM","THALAMI","ZONE","ZEN","AUTHOR","AMAZING","AMAZON","AUTUMN","NADIR","NATUR","WASTE"],"uz":[]},"ع":{"name":"عَيْن","transliteration":"ʿayn","abjad":70,"top_roots":[{"root":"ب-ع-د","amr":"ب(2)=BUILDING | ع(70)=DEPTH | د(4)=CALLING [=76]"},{"root":"ت-ب-ع","amr":"ت(400)=SUCCESSION | ب(2)=BUILDING | ع(70)=DEPTH [=472]"},{"root":"ج-ع-ل","amr":"ج(3)=GATHERING | ع(70)=DEPTH | ل(30)=CONNECTION [=103]"},{"root":"ج-م-ع","amr":"ج(3)=GATHERING | م(40)=ENCLOSURE | ع(70)=DEPTH [=113]"},{"root":"د-ع-و","amr":"د(4)=CALLING | ع(70)=DEPTH | و(6)=CONNECTION [=80]"}],"en":["BAD","TAB","JEWEL","JELL","GAME","JAM","JUMBLE","GEM","GUM","JAMBOREE","DUE","DAW","RIDGE","SUMMON","SEMAPHORE"],"ru":["ТАБУН","ДжЕЛЛ","ДАВ","СЕМАПХОРЕ","ТОВ","АУТУМН","АЛМА","АМЕЛИОРАТЕ","МУЛЛ","НОМЕ"],"de":["REITER","JUWEL","JELL","FÄLLIG","DAW","GRAT","EINBERUFEN","SEMAPHORE","FROMM","TOW","WOHNSTÄTTE","ADEPT","ADAPT","ADOPT","AMAZING"],"uz":["juma","jamoa","ilm","olim","olam","ma'lum","ta'lim","amal","aql","ishga","oilam"]},"غ":{"name":"غَيْن","transliteration":"ghayn","abjad":1000,"top_roots":[{"root":"ب-غ-ت","amr":"ب(2)=BUILDING | غ(1000)=COVERING | ت(400)=SUCCESSION [=1402]"},{"root":"ب-غ-ي","amr":"ب(2)=BUILDING | غ(1000)=COVERING | ي(10)=EXTENSION [=1012]"},{"root":"ب-ل-غ","amr":"ب(2)=BUILDING | ل(30)=CONNECTION | غ(1000)=COVERING [=1032]"},{"root":"ز-ي-غ","amr":"ز(7)=PAIRING | ي(10)=EXTENSION | غ(1000)=COVERING [=1017]"},{"root":"ص-غ-ر","amr":"ص(90)=TRUTH | غ(1000)=COVERING | ر(200)=MOVEMENT [=1290]"}],"en":["BEG","BUG","BIG","BELONG","CIGAR","THUG","COVER","GOPHER","GAVEL","GAIN","GUINEA","GIVE","GYM","GEAR","GYRATE"],"ru":["БОГАТСТВО","БИГ","КИГАР","ГОПХЕР","ГУИНЕА","ГИМ"],"de":["BEG","BUG","BIG","CIGÄR","GOPHER","HAMMER","GEWINN","GUINEA","GEBEN","GYM","GEÄR","GYRAT"],"uz":[]},"ف":{"name":"فَاء","transliteration":"fāʾ","abjad":80,"top_roots":[{"root":"أ-ل-ف","amr":"ء(1)=ORIGIN | ل(30)=CONNECTION | ف(80)=SEPARATION [=111]"},{"root":"خ-ل-ف","amr":"خ(600)=CREATION | ل(30)=CONNECTION | ف(80)=SEPARATION [=710]"},{"root":"خ-و-ف","amr":"خ(600)=CREATION | و(6)=CONNECTION | ف(80)=SEPARATION [=686]"},{"root":"ض-ع-ف","amr":"ض(800)=DISPLACEMENT | ع(70)=DEPTH | ف(80)=SEPARATION [=950]"},{"root":"ع-ر-ف","amr":"ع(70)=DEPTH | ر(200)=MOVEMENT | ف(80)=SEPARATION [=350]"}],"en":["ALFA","Caliphate","CALF","CALIPH","COWARD","COW","DWARF","DEAF","THIEF","Tariff","PROPHET","WHARF","COVER","GOPHER","FIRE"],"ru":["АЛФА","ХЛОПОК","ХОЛОП","КАЛФ","КАЛИПХ","ТАРИФ","ВХАРФ","ГОПХЕР","ФУРРОВ","ПОРЯДОК","ПИРОГ","СЕВРЮГА","ПОРОГ","ФОРК","ФРЕАК"],"de":["ALFA","KALIFAT","CALF","CALIPH","DWARF","DEAF","THIEF","TARIF","PROPHET","WHARF","GOPHER","FRANKREICH","KRAFT","PARASIT","FURROW"],"uz":["nafs","nafas","fath","kalit","foiz"]},"ق":{"name":"قَاف","transliteration":"qāf","abjad":100,"top_roots":[{"root":"ح-ق-ق","amr":"ح(8)=TRUTH | ق(100)=SPEECH | ق(100)=SPEECH [=208]"},{"root":"خ-ل-ق","amr":"خ(600)=CREATION | ل(30)=CONNECTION | ق(100)=SPEECH [=730]"},{"root":"ر-ز-ق","amr":"ر(200)=MOVEMENT | ز(7)=PAIRING | ق(100)=SPEECH [=307]"},{"root":"ص-د-ق","amr":"ص(90)=TRUTH | د(4)=CALLING | ق(100)=SPEECH [=194]"},{"root":"ع-ق-ب","amr":"ع(70)=DEPTH | ق(100)=SPEECH | ب(2)=BUILDING [=172]"}],"en":["CHECK","CHALK","Risk","SYNDIC","OCCUPY","Cabal","CATTLE","CUTLASS","KILL","KETTLE","Calibre","Calibrate","CLUB","KNOWLEDGE","CALL"],"ru":["ХАКИ","ШЁЛК","РИСК","КУПОЛ","КАБЛУК","КАБАЛА","КОБЕЛЬ","КОТЁЛ","КИЛЛ","КЕТТЛЕ","ГОЛОВА","КЛУБ","КАРАКУЛИ","ГОЛОС","КАЛЛ"],"de":["SCHACH","KREIDE","RISIKO","SYNDISCH","KABALE","CATTLE","CUTLASS","KILL","KETTLE","KALIBER","CALIBRAT","CLUB","KENNTNIS","CALL","COUNCIL"],"uz":["haq","haqiqat","huquq","rizq","qalb","qavl","qalam"]},"ك":{"name":"كَاف","transliteration":"kāf","abjad":20,"top_roots":[{"root":"أ-ك-ل","amr":"ء(1)=ORIGIN | ك(20)=BEING | ل(30)=CONNECTION [=51]"},{"root":"ت-ر-ك","amr":"ت(400)=SUCCESSION | ر(200)=MOVEMENT | ك(20)=BEING [=620]"},{"root":"ح-ك-م","amr":"ح(8)=TRUTH | ك(20)=BEING | م(40)=ENCLOSURE [=68]"},{"root":"ذ-ك-ر","amr":"ذ(700)=REMEMBRANCE | ك(20)=BEING | ر(200)=MOVEMENT [=920]"},{"root":"ش-ر-ك","amr":"ش(300)=SPREADING | ر(200)=MOVEMENT | ك(20)=BEING [=520]"}],"en":["ALKALI","UNCLE","TRACK","TRUCK","HACK","HOKUM","DECREE","DECORUM","SHARE","SHARK","SACRIFICE","CITE","SCRIPT","ACCRUE","CATHETER"],"ru":["УНКЛЕ","ТРАКК","ТРУКК","ХОКУМ","ДЕКОР","ДЕКОРУМ","ЧУРЕК","СХАРК","КИТАБ","СКРИПТ","КАТХЕТЕР","КАДЕТ","КРЫТЬ","КАВАРДАК","КОФФЕР"],"de":["UNCLE","TRACK","TRUCK","HACKEN","HOKUM","DEKRET","DECORUM","ANTEIL","SHARK","OPFER","ZITIEREN","SCRIPT","ANWACHSEN","CATHETER","TÄUSCHEN"],"uz":["hukm","hakim","hikmat","hukumat","mahkama","shukr","kitob","kotib","maktab","maktub","kutubxona","mulk","malik","mamlakat"]},"ل":{"name":"لَام","transliteration":"lām","abjad":30,"top_roots":[{"root":"أ-ل-ه","amr":"ء(1)=ORIGIN | ل(30)=CONNECTION | ه(5)=BREATH [=36]"},{"root":"ج-ع-ل","amr":"ج(3)=GATHERING | ع(70)=DEPTH | ل(30)=CONNECTION [=103]"},{"root":"خ-ل-ق","amr":"خ(600)=CREATION | ل(30)=CONNECTION | ق(100)=SPEECH [=730]"},{"root":"ر-س-ل","amr":"ر(200)=MOVEMENT | س(60)=FLOW | ل(30)=CONNECTION [=290]"},{"root":"ظ-ل-م","amr":"ظ(900)=DISPLACEMENT | ل(30)=CONNECTION | م(40)=ENCLOSURE [=970]"}],"en":["ALL","ELOHIM","JEWEL","JELL","CHALK","MIRACLE","RESALE","GLOOM","REALM","THALAMI","ALMA","MALL","AMELIORATE","MULL","KNOWLEDGE"],"ru":["АЛЛЕЯ","ЕЛОХИМ","ДжЕЛЛ","ШЁЛК","РЕМЕСЛО","РЕСАЛЕ","ТХАЛАМИ","АЛМА","АМЕЛИОРАТЕ","МУЛЛ","КАРАКУЛИ","ГОЛОС","КАЛЛ","КОУНКИЛ","ЛАБИРИНТХ"],"de":["ALLES","ELOHIM","JUWEL","JELL","KREIDE","MIRAKEL","RESALE","GLOOM","REALM","THALAMI","ALMA","EINKAUFSZENTRUM","AMELIORAT","MULL","KENNTNIS"],"uz":["ilm","olim","olam","ma'lum","ta'lim","amal","qavl"]},"م":{"name":"مِيم","transliteration":"mīm","abjad":40,"top_roots":[{"root":"أ-م-ر","amr":"ء(1)=ORIGIN | م(40)=ENCLOSURE | ر(200)=MOVEMENT [=241]"},{"root":"أ-م-ن","amr":"ء(1)=ORIGIN | م(40)=ENCLOSURE | ن(50)=CONTINUATION [=91]"},{"root":"ر-ح-م","amr":"ر(200)=MOVEMENT | ح(8)=TRUTH | م(40)=ENCLOSURE [=248]"},{"root":"س-م-ع","amr":"س(60)=FLOW | م(40)=ENCLOSURE | ع(70)=DEPTH [=170]"},{"root":"س-م-و","amr":"س(60)=FLOW | م(40)=ENCLOSURE | و(6)=CONNECTION [=106]"}],"en":["Empire","Admiral","Army","AMOUR","EMIR","Amen","ALMANIA","AMNESTY","RHYME","ROOM","SUMMON","SEMAPHORE","SUM","SUMMIT","SEMINAR"],"ru":["АДМИРАЛ","АМОУР","ЕМИР","АМНЕСТИ","АМИНЬ","РООМ","РИФМА","СЕМАПХОРЕ","САМОВАР","СЕМИНАР","ТХАЛАМИ","АЛМА","АМЕЛИОРАТЕ","МУЛЛ","МОЛОКО"],"de":["IMPERIUM","ADMIRAL","ARMEE","AMOUR","EMIR","AMEN","ALEMANNIEN","AMNESTY","REIM","ROOM","EINBERUFEN","SEMAPHORE","SUMME","SEMINÄR","GLOOM"],"uz":["amir","amr","taʼminot","taʼmin","rahm","rahmat","ramazon","ilm","olim","olam","ma'lum","ta'lim","amal","mulk","malik"]},"ن":{"name":"نُون","transliteration":"nūn","abjad":50,"top_roots":[{"root":"أ-م-ن","amr":"ء(1)=ORIGIN | م(40)=ENCLOSURE | ن(50)=CONTINUATION [=91]"},{"root":"أ-ن-س","amr":"ء(1)=ORIGIN | ن(50)=CONTINUATION | س(60)=FLOW [=111]"},{"root":"ب-ن-ي","amr":"ب(2)=BUILDING | ن(50)=CONTINUATION | ي(10)=EXTENSION [=62]"},{"root":"ب-ي-ن","amr":"ب(2)=BUILDING | ي(10)=EXTENSION | ن(50)=CONTINUATION [=62]"},{"root":"ج-ن-ن","amr":"ج(3)=GATHERING | ن(50)=CONTINUATION | ن(50)=CONTINUATION [=103]"}],"en":["Amen","ALMANIA","AMNESTY","ONUS","ANNOUNCE","BONE","BAN","BANNER","BANE","Genie","GENE","GENIUS","JINNI","HONEST","GAIN"],"ru":["АМНЕСТИ","АМИНЬ","АНИС","АННОУНКЕ","ВОЙНА","БАНЕ","ГЕНЕ","ГЕНИУС","ДжИННИ","ДЖИНН","ГУИНЕА","КУВШИН","КОН","ТУНДРА","НЕРД"],"de":["AMEN","ALEMANNIEN","AMNESTY","LAST","ANNOUNCE","BANNER","VERBANNEN","BANE","DSCHINN","GENE","GENIUS","JINNI","GEWINN","GUINEA","MÜNZE"],"uz":["taʼminot","taʼmin","nafs","nafas","nasr","nikoh","narx","nonushta"]},"ه":{"name":"هَاء","transliteration":"hāʾ","abjad":5,"top_roots":[{"root":"أ-ل-ه","amr":"ء(1)=ORIGIN | ل(30)=CONNECTION | ه(5)=BREATH [=36]"},{"root":"أ-ه-ل","amr":"ء(1)=ORIGIN | ه(5)=BREATH | ل(30)=CONNECTION [=36]"},{"root":"ج-ه-ن-م","amr":"ج(3)=GATHERING | ه(5)=BREATH | ن(50)=CONTINUATION | م(40)=ENCLOSURE [=98]"},{"root":"ش-ه-د","amr":"ش(300)=SPREADING | ه(5)=BREATH | د(4)=CALLING [=309]"},{"root":"ظ-ه-ر","amr":"ظ(900)=DISPLACEMENT | ه(5)=BREATH | ر(200)=MOVEMENT [=1105]"}],"en":["ALL","ELOHIM","HALE","SHED","SHADOW","SHADE","AUTHOR","CRACK","CREEK","MOAT","MONEY","NEAR","NAHAR","Heed","HIDE"],"ru":["АЛЛЕЯ","ЕЛОХИМ","ШАХТА","СХАДЕ","КРАКК","КРЕЕК","МОНЕИ","НАХАР","ХОД","ХИДЕ","ГИД","ХАВОК","ХОВЛ","ХОВ","ХОЛЛОВ"],"de":["ALLES","ELOHIM","RÜSTIG","SHED","SHADOW","SHADE","AUTHOR","CRACK","CREEK","MOAT","MONEY","NAH","NAHÄR","BEACHTUNG","HIDE"],"uz":["hafta"]},"و":{"name":"وَاو","transliteration":"wāw","abjad":6,"top_roots":[{"root":"أ-ل-و","amr":"ء(1)=ORIGIN | ل(30)=CONNECTION | و(6)=CONNECTION [=37]"},{"root":"أ-و-ل","amr":"ء(1)=ORIGIN | و(6)=CONNECTION | ل(30)=CONNECTION [=37]"},{"root":"ت-ل-و","amr":"ت(400)=SUCCESSION | ل(30)=CONNECTION | و(6)=CONNECTION [=436]"},{"root":"د-ع-و","amr":"د(4)=CALLING | ع(70)=DEPTH | و(6)=CONNECTION [=80]"},{"root":"س-م-و","amr":"س(60)=FLOW | م(40)=ENCLOSURE | و(6)=CONNECTION [=106]"}],"en":["ALLOT","OAL","OIL","TELL","TALE","DUE","DAW","SUM","SUMMIT","SEMINAR","SALUTE","SOLO","SALVO","KNOWLEDGE","CALL"],"ru":["АЛЛОТ","ОАЛ","ОИЛ","СПРАВЕДЛИВОСТЬ","ДАВ","САМОВАР","СЕМИНАР","СОЛОВЕЙ","СЛОВО","СОЛО","САЛВО","КАРАКУЛИ","ГОЛОС","КАЛЛ","КОУНКИЛ"],"de":["ALLOT","OAL","OIL","TELL","TALE","FÄLLIG","DAW","SUMME","SEMINÄR","GRUSS","SOLO","SALVO","KENNTNIS","CALL","COUNCIL"],"uz":["qavl","vaqt","valad","ovqat"]},"ي":{"name":"يَاء","transliteration":"yāʾ","abjad":10,"top_roots":[{"root":"أ-ت-ي","amr":"ء(1)=ORIGIN | ت(400)=SUCCESSION | ي(10)=EXTENSION [=411]"},{"root":"أ-ي-ي","amr":"ء(1)=ORIGIN | ي(10)=EXTENSION | ي(10)=EXTENSION [=21]"},{"root":"ب-ي-ن","amr":"ب(2)=BUILDING | ي(10)=EXTENSION | ن(50)=CONTINUATION [=62]"},{"root":"ح-ي-ي","amr":"ح(8)=TRUTH | ي(10)=EXTENSION | ي(10)=EXTENSION [=28]"},{"root":"خ-ي-ر","amr":"خ(600)=CREATION | ي(10)=EXTENSION | ر(200)=MOVEMENT [=810]"}],"en":["OUTTA","ATE","EYE","BAN","BANNER","BANE","HIGH","HIVE","HERO","CHOIR","SHOW","Heed","HIDE","PROTECT","WAKE"],"ru":["АТЕ","ЕИЕ","ВОЙНА","БАНЕ","ХИВЕ","КХОИР","ХОД","ХИДЕ","ВАКЕ","ВАЛЕ","ВИЛЛ","ИТЕМ","ЕДА","ДжАДЕ","АИДЕ"],"de":["OUTTA","AT","EYE","BANNER","VERBANNEN","BANE","HOCH","HIV","HELD","CHOIR","ZEIGEN","BEACHTUNG","HIDE","SCHÜTZEN","WAKE"],"uz":[]}};

const ALPHABET = AMR_DATA.ALPHABET;
const ABJAD = AMR_DATA.ABJAD;

// ═══════════════════════════════════════════════════════════════
// I18N — Multilingual UI
// ═══════════════════════════════════════════════════════════════
let currentLang = 'en';

const I18N = {
  en: {
    subtitle: 'Letters of Allah\'s Arabic — Phase 0 Reference 28',
    nav_letters: 'الحُرُوف / Letters',
    nav_articulation: 'مَخَارِج / Articulation',
    nav_diacritics: 'حَرَكَات / Diacritics',
    nav_dots: 'نُقَط / Dots & Geometry',
    nav_values: 'أَبْجَد / Values',
    nav_calc: 'حِسَاب الجَذْر / Root Calculator',
    section_28: 'الحُرُوف الثَّمَانِيَة وَالعِشْرُون — The 28 Letters',
    play_sound: '&#x1f50a; Play Sound',
    phonetics: 'صَوْتِيَّات — Phonetics',
    classification: 'تَصْنِيف — Classification',
    behaviour: 'سُلُوك — Positional Behaviour',
    semantic: 'مَيْل دَلَالِي — Semantic Tendency',
    shifts: 'تَحَوُّلَات — Downstream Shifts',
    quranic_stats: 'إِحْصَاءَات قُرْآنِيَّة — Qur\'anic Statistics',
    pairs: 'أَزْوَاج — Paired Letters',
    unique_props: 'فَرِيد — Unique Properties',
    makhraj: 'مَخْرَج / Makhraj',
    manner: 'طَرِيقَة / Manner',
    description: 'وَصْف / Description',
    sun_moon: 'Sun/Moon',
    type: 'Type',
    group: 'Group',
    as_first: 'As 1st radical (فاء):',
    as_second: 'As 2nd radical (عين):',
    as_third: 'As 3rd radical (لام):',
    as_prefix: 'As prefix:',
    as_suffix: 'As suffix:',
    no_shifts: 'No shifts recorded',
    no_pairs: 'No pairs documented',
    articulation_title: 'مَخَارِج الحُرُوف — Articulation Points',
    articulation_hint: 'Click a letter above or a zone in the diagrams to see which letters articulate there',
    topdown_title: 'المَنْظَر العُلْوِي — Top-Down Mouth Map',
    sagittal_title: 'المَقْطَع الجَانِبِي — Sagittal Cross-Section',
    harakat_title: 'حَرَكَات — Diacritics & Vowel Marks',
    harakat_h: 'الحَرَكَات — Short Vowels',
    tanwin_h: 'تَنْوِين — Tanwīn (Nunation)',
    extra_h: 'عَلَامَات إِضَافِيَّة — Additional Marks',
    dots_title: 'نُقَط وَهَنْدَسَة — Dots & Geometry',
    dots_families: 'عَائِلَات الشَّكْل — Shape Families (Dot Differentiation)',
    dots_geo: 'هَنْدَسَة — Geometric & Abjad Properties',
    abjad_title: 'أَبْجَد — Abjad Numerical Values',
    calc_title: 'حِسَاب الجَذْر — Root Calculator',
    calc_enter: 'Enter root letters:',
    calc_btn: 'حِسَاب — Calculate',
    // Grid view labels
    gv_alphabetical: '1. الأَبْجَدِيَّة Alphabetical',
    gv_abjad: '2. أَبْجَد Abjad Tiers',
    gv_articulation: '3. مَخَارِج Articulation',
    gv_manner: '4. صِفَات Manner',
    gv_voiced: '5. مَجْهُور Voiced/Voiceless',
    gv_sun_moon: '6. شَمْس/قَمَر Sun/Moon',
    gv_dotted: '7. مُعْجَمَة Dotted/Undotted',
    gv_dot_count: '8. عَدَد النُّقَط Dot Count',
    gv_shape: '9. رَسْم Shape Family',
    gv_connectors: '10. اتِّصَال Connectors',
    gv_emphatic: '11. تَفْخِيم Emphatic/Plain',
    gv_muqattaat: '12. مُقَطَّعَات Muqattaʿāt',
    gv_frequency: '13. تَوَاتُر Qur\'anic Frequency',
  },
  ru: {
    subtitle: 'Буквы Языка Аллаха — Фаза 0, Справочник 28',
    nav_letters: 'الحُرُوف / Буквы',
    nav_articulation: 'مَخَارِج / Артикуляция',
    nav_diacritics: 'حَرَكَات / Диакритика',
    nav_dots: 'نُقَط / Точки и геометрия',
    nav_values: 'أَبْجَد / Значения',
    nav_calc: 'حِسَاب الجَذْر / Калькулятор корней',
    section_28: 'الحُرُوف الثَّمَانِيَة وَالعِشْرُون — 28 Букв',
    play_sound: '&#x1f50a; Воспроизвести',
    phonetics: 'صَوْتِيَّات — Фонетика',
    classification: 'تَصْنِيف — Классификация',
    behaviour: 'سُلُوك — Позиционное поведение',
    semantic: 'مَيْل دَلَالِي — Семантическая тенденция',
    shifts: 'تَحَوُّلَات — Нисходящие сдвиги',
    quranic_stats: 'إِحْصَاءَات قُرْآنِيَّة — Кораническая статистика',
    pairs: 'أَزْوَاج — Парные буквы',
    unique_props: 'فَرِيد — Уникальные свойства',
    makhraj: 'مَخْرَج / Махрадж',
    manner: 'طَرِيقَة / Способ',
    description: 'وَصْف / Описание',
    sun_moon: 'Солнечная/Лунная',
    type: 'Тип',
    group: 'Группа',
    as_first: '1-й коренной (فاء):',
    as_second: '2-й коренной (عين):',
    as_third: '3-й коренной (لام):',
    as_prefix: 'Как приставка:',
    as_suffix: 'Как суффикс:',
    no_shifts: 'Сдвиги не зафиксированы',
    no_pairs: 'Пары не задокументированы',
    articulation_title: 'مَخَارِج الحُرُوف — Точки артикуляции',
    articulation_hint: 'Нажмите на букву или зону диаграммы, чтобы увидеть артикуляцию',
    topdown_title: 'المَنْظَر العُلْوِي — Вид сверху полости рта',
    sagittal_title: 'المَقْطَع الجَانِبِي — Сагиттальное сечение',
    harakat_title: 'حَرَكَات — Диакритика и огласовки',
    harakat_h: 'الحَرَكَات — Краткие гласные',
    tanwin_h: 'تَنْوِين — Танвин (нунация)',
    extra_h: 'عَلَامَات إِضَافِيَّة — Дополнительные знаки',
    dots_title: 'نُقَط وَهَنْدَسَة — Точки и геометрия',
    dots_families: 'عَائِلَات الشَّكْل — Семейства форм',
    dots_geo: 'هَنْدَسَة — Геометрия и числовые свойства',
    abjad_title: 'أَبْجَد — Числовые значения Абджад',
    calc_title: 'حِسَاب الجَذْر — Калькулятор корней',
    calc_enter: 'Введите корневые буквы:',
    calc_btn: 'حِسَاب — Вычислить',
    gv_alphabetical: '1. الأَبْجَدِيَّة Алфавитный',
    gv_abjad: '2. أَبْجَد Абджад-ярусы',
    gv_articulation: '3. مَخَارِج Артикуляция',
    gv_manner: '4. صِفَات Способ',
    gv_voiced: '5. مَجْهُور Звонк./Глух.',
    gv_sun_moon: '6. شَمْس/قَمَر Солн./Лун.',
    gv_dotted: '7. مُعْجَمَة С точками/Без',
    gv_dot_count: '8. عَدَد النُّقَط Кол-во точек',
    gv_shape: '9. رَسْم Семейство форм',
    gv_connectors: '10. اتِّصَال Соединение',
    gv_emphatic: '11. تَفْخِيم Эмфатич./Прост.',
    gv_muqattaat: '12. مُقَطَّعَات Мукаттаат',
    gv_frequency: '13. تَوَاتُر Коран. частота',
  },
  de: {
    subtitle: 'Buchstaben der Sprache Allahs — Phase 0 Referenz 28',
    nav_letters: 'الحُرُوف / Buchstaben',
    nav_articulation: 'مَخَارِج / Artikulation',
    nav_diacritics: 'حَرَكَات / Diakritika',
    nav_dots: 'نُقَط / Punkte & Geometrie',
    nav_values: 'أَبْجَد / Werte',
    nav_calc: 'حِسَاب الجَذْر / Wurzelrechner',
    section_28: 'الحُرُوف الثَّمَانِيَة وَالعِشْرُون — Die 28 Buchstaben',
    play_sound: '&#x1f50a; Abspielen',
    phonetics: 'صَوْتِيَّات — Phonetik',
    classification: 'تَصْنِيف — Klassifikation',
    behaviour: 'سُلُوك — Positionsverhalten',
    semantic: 'مَيْل دَلَالِي — Semantische Tendenz',
    shifts: 'تَحَوُّلَات — Absteigende Verschiebungen',
    quranic_stats: 'إِحْصَاءَات قُرْآنِيَّة — Koranische Statistik',
    pairs: 'أَزْوَاج — Gepaarte Buchstaben',
    unique_props: 'فَرِيد — Einzigartige Eigenschaften',
    makhraj: 'مَخْرَج / Makhradsch',
    manner: 'طَرِيقَة / Art',
    description: 'وَصْف / Beschreibung',
    sun_moon: 'Sonnen-/Mondbuchstabe',
    type: 'Typ',
    group: 'Gruppe',
    as_first: '1. Radikal (فاء):',
    as_second: '2. Radikal (عين):',
    as_third: '3. Radikal (لام):',
    as_prefix: 'Als Präfix:',
    as_suffix: 'Als Suffix:',
    no_shifts: 'Keine Verschiebungen dokumentiert',
    no_pairs: 'Keine Paare dokumentiert',
    articulation_title: 'مَخَارِج الحُرُوف — Artikulationspunkte',
    articulation_hint: 'Klicken Sie auf einen Buchstaben oder eine Zone im Diagramm',
    topdown_title: 'المَنْظَر العُلْوِي — Draufsicht Mundraum',
    sagittal_title: 'المَقْطَع الجَانِبِي — Sagittalschnitt',
    harakat_title: 'حَرَكَات — Diakritische Zeichen',
    harakat_h: 'الحَرَكَات — Kurze Vokale',
    tanwin_h: 'تَنْوِين — Tanwīn (Nunation)',
    extra_h: 'عَلَامَات إِضَافِيَّة — Zusätzliche Zeichen',
    dots_title: 'نُقَط وَهَنْدَسَة — Punkte & Geometrie',
    dots_families: 'عَائِلَات الشَّكْل — Formfamilien',
    dots_geo: 'هَنْدَسَة — Geometrie & Zahlenwerte',
    abjad_title: 'أَبْجَد — Abdschad-Zahlenwerte',
    calc_title: 'حِسَاب الجَذْر — Wurzelrechner',
    calc_enter: 'Wurzelbuchstaben eingeben:',
    calc_btn: 'حِسَاب — Berechnen',
    gv_alphabetical: '1. الأَبْجَدِيَّة Alphabetisch',
    gv_abjad: '2. أَبْجَد Abdschad-Stufen',
    gv_articulation: '3. مَخَارِج Artikulation',
    gv_manner: '4. صِفَات Artikulationsart',
    gv_voiced: '5. مَجْهُور Stimmh./Stimml.',
    gv_sun_moon: '6. شَمْس/قَمَر Sonnen/Mond',
    gv_dotted: '7. مُعْجَمَة Punktiert/Ohne',
    gv_dot_count: '8. عَدَد النُّقَط Punktanzahl',
    gv_shape: '9. رَسْم Formfamilie',
    gv_connectors: '10. اتِّصَال Verbindung',
    gv_emphatic: '11. تَفْخِيم Emphatisch/Einfach',
    gv_muqattaat: '12. مُقَطَّعَات Muqattaʿāt',
    gv_frequency: '13. تَوَاتُر Koranische Häufigkeit',
  },
  uz: {
    subtitle: 'Allohning Arabchasi Harflari — Bosqich 0 Ma\'lumotnoma 28',
    nav_letters: 'الحُرُوف / Harflar',
    nav_articulation: 'مَخَارِج / Talaffuz',
    nav_diacritics: 'حَرَكَات / Diakritika',
    nav_dots: 'نُقَط / Nuqtalar va geometriya',
    nav_values: 'أَبْجَد / Qiymatlar',
    nav_calc: 'حِسَاب الجَذْر / Ildiz hisoblagich',
    section_28: 'الحُرُوف الثَّمَانِيَة وَالعِشْرُون — 28 ta Harf',
    play_sound: '&#x1f50a; Tinglash',
    phonetics: 'صَوْتِيَّات — Fonetika',
    classification: 'تَصْنِيف — Tasnif',
    behaviour: 'سُلُوك — Pozitsion xatti-harakati',
    semantic: 'مَيْل دَلَالِي — Semantik moyillik',
    shifts: 'تَحَوُّلَات — Quyi oqim siljishlari',
    quranic_stats: 'إِحْصَاءَات قُرْآنِيَّة — Qur\'on statistikasi',
    pairs: 'أَزْوَاج — Juft harflar',
    unique_props: 'فَرِيد — Noyob xususiyatlar',
    makhraj: 'مَخْرَج / Maxraj',
    manner: 'طَرِيقَة / Usul',
    description: 'وَصْف / Tavsif',
    sun_moon: 'Quyosh/Oy',
    type: 'Tur',
    group: 'Guruh',
    as_first: '1-radikal (فاء):',
    as_second: '2-radikal (عين):',
    as_third: '3-radikal (لام):',
    as_prefix: 'Old qo\'shimcha:',
    as_suffix: 'Orqa qo\'shimcha:',
    no_shifts: 'Siljishlar qayd etilmagan',
    no_pairs: 'Juftlar hujjatlashtirilmagan',
    articulation_title: 'مَخَارِج الحُرُوف — Talaffuz nuqtalari',
    articulation_hint: 'Harfni yoki diagrammadagi zonani bosing',
    topdown_title: 'المَنْظَر العُلْوِي — Og\'iz bo\'shlig\'i ustdan ko\'rinishi',
    sagittal_title: 'المَقْطَع الجَانِبِي — Sagittal kesim',
    harakat_title: 'حَرَكَات — Diakritik belgilar',
    harakat_h: 'الحَرَكَات — Qisqa unlиlar',
    tanwin_h: 'تَنْوِين — Tanvin',
    extra_h: 'عَلَامَات إِضَافِيَّة — Qo\'shimcha belgilar',
    dots_title: 'نُقَط وَهَنْدَسَة — Nuqtalar va geometriya',
    dots_families: 'عَائِلَات الشَّكْل — Shakl oilalari',
    dots_geo: 'هَنْدَسَة — Geometriya va raqamiy xususiyatlar',
    abjad_title: 'أَبْجَد — Abjad raqamiy qiymatlari',
    calc_title: 'حِسَاب الجَذْر — Ildiz hisoblagich',
    calc_enter: 'Ildiz harflarini kiriting:',
    calc_btn: 'حِسَاب — Hisoblash',
    gv_alphabetical: '1. الأَبْجَدِيَّة Alifbo',
    gv_abjad: '2. أَبْجَد Abjad darajalari',
    gv_articulation: '3. مَخَارِج Talaffuz',
    gv_manner: '4. صِفَات Usul',
    gv_voiced: '5. مَجْهُور Jarangli/Jarangsiz',
    gv_sun_moon: '6. شَمْس/قَمَر Quyosh/Oy',
    gv_dotted: '7. مُعْجَمَة Nuqtali/Nuqtasiz',
    gv_dot_count: '8. عَدَد النُّقَط Nuqtalar soni',
    gv_shape: '9. رَسْم Shakl oilasi',
    gv_connectors: '10. اتِّصَال Ulanish',
    gv_emphatic: '11. تَفْخِيم Emfatik/Oddiy',
    gv_muqattaat: '12. مُقَطَّعَات Muqattaot',
    gv_frequency: '13. تَوَاتُر Qur\'on chastotasi',
  },
};

// Grid view button i18n keys
const GV_I18N_MAP = {
  'alphabetical': 'gv_alphabetical', 'abjad-tiers': 'gv_abjad', 'articulation': 'gv_articulation',
  'manner': 'gv_manner', 'voiced': 'gv_voiced', 'sun-moon': 'gv_sun_moon',
  'dotted': 'gv_dotted', 'dot-count': 'gv_dot_count', 'shape': 'gv_shape',
  'connectors': 'gv_connectors', 'emphatic': 'gv_emphatic', 'muqattaat': 'gv_muqattaat',
  'frequency': 'gv_frequency',
};

function t(key) { return (I18N[currentLang] || I18N.en)[key] || I18N.en[key] || key; }

// Flag for untranslated English prose — only shows when UI lang ≠ EN
function enFlag() { return currentLang !== 'en' ? '<span class="lang-flag">EN</span>' : ''; }

function applyI18n() {
  // All elements with data-i18n
  document.querySelectorAll('[data-i18n]').forEach(el => {
    const key = el.dataset.i18n;
    const val = t(key);
    if (val) el.innerHTML = val;
  });
  // Grid view buttons
  document.querySelectorAll('#grid-view-bar .grid-view-btn').forEach(btn => {
    const view = btn.dataset.view;
    const key = GV_I18N_MAP[view];
    if (key) btn.textContent = t(key);
  });
  // Re-render detail panel if a letter is selected
  if (selectedLetter) showDetail(selectedLetter);
  // Rebuild grid (group headers change with language)
  buildGrid();
}

document.getElementById('lang-select').addEventListener('change', function() {
  currentLang = this.value;
  applyI18n();
});
const LETTERS_ORDER = 'ءابتثجحخدذرزسشصضطظعغفقكلمنهوي'.split('');
const LETTERS_28 = 'ابتثجحخدذرزسشصضطظعغفقكلمنهوي'.split('');

// Hamza normalization map
const HAMZA_MAP = {'أ':'ء','إ':'ء','آ':'ء','ؤ':'ء','ئ':'ء','ى':'ي','ة':'ه'};

// ═══════════════════════════════════════════════════════════════
// ZONE MAPPING — letter → articulation zone
// ═══════════════════════════════════════════════════════════════
const ZONE_MAP = {
  'ء': 'glottal', 'ا': 'glottal', 'ه': 'glottal',
  'ع': 'pharyngeal', 'ح': 'pharyngeal',
  'غ': 'uvular', 'خ': 'uvular',
  'ق': 'uvular', 'ك': 'velar',
  'ج': 'palatal', 'ش': 'palatal', 'ي': 'palatal',
  'ل': 'alveolar', 'ن': 'alveolar', 'ر': 'alveolar',
  'ت': 'dental', 'د': 'dental', 'ط': 'dental', 'ض': 'dental',
  'ث': 'interdental', 'ذ': 'interdental', 'ظ': 'interdental',
  'ز': 'sibilant', 'س': 'sibilant', 'ص': 'sibilant',
  'ف': 'labiodental',
  'ب': 'lips', 'م': 'lips', 'و': 'lips',
};

const ZONE_NAMES_I18N = {
  en: {
    'glottal': 'حَلْق أَقْصَى — Glottal (deepest throat)',
    'pharyngeal': 'وَسَط الحَلْق — Pharyngeal (mid-throat)',
    'uvular': 'أَدْنَى الحَلْق — Uvular (near mouth)',
    'velar': 'لَهَوِيَّة — Velar (back tongue + soft palate)',
    'palatal': 'شَجَرِيَّة — Palatal (mid tongue + hard palate)',
    'alveolar': 'ذَلْقِيَّة — Alveolar (tongue tip + gum ridge)',
    'dental': 'أَسَلِيَّة — Dental (tongue tip + teeth)',
    'interdental': 'لَثَوِيَّة — Interdental (tongue between teeth)',
    'sibilant': 'صَفِيرِيَّة — Sibilant (tongue tip + lower teeth)',
    'labiodental': 'شَفَوِيَّة سِنِّيَّة — Labiodental (lip + teeth)',
    'lips': 'شَفَتَان — Bilabial (two lips)',
  },
  ru: {
    'glottal': 'حَلْق أَقْصَى — Гортанные (глубина горла)',
    'pharyngeal': 'وَسَط الحَلْق — Глоточные (середина горла)',
    'uvular': 'أَدْنَى الحَلْق — Увулярные (ближе ко рту)',
    'velar': 'لَهَوِيَّة — Велярные (задняя часть языка + мягкое нёбо)',
    'palatal': 'شَجَرِيَّة — Палатальные (средняя часть языка + твёрдое нёбо)',
    'alveolar': 'ذَلْقِيَّة — Альвеолярные (кончик языка + альвеолы)',
    'dental': 'أَسَلِيَّة — Зубные (кончик языка + зубы)',
    'interdental': 'لَثَوِيَّة — Межзубные (язык между зубами)',
    'sibilant': 'صَفِيرِيَّة — Свистящие (кончик языка + нижние зубы)',
    'labiodental': 'شَفَوِيَّة سِنِّيَّة — Губно-зубные (губа + зубы)',
    'lips': 'شَفَتَان — Губные (две губы)',
  },
  de: {
    'glottal': 'حَلْق أَقْصَى — Glottal (tiefster Rachen)',
    'pharyngeal': 'وَسَط الحَلْق — Pharyngal (mittlerer Rachen)',
    'uvular': 'أَدْنَى الحَلْق — Uvular (nahe am Mund)',
    'velar': 'لَهَوِيَّة — Velar (Zungenrücken + Gaumensegel)',
    'palatal': 'شَجَرِيَّة — Palatal (Zungenmitte + harter Gaumen)',
    'alveolar': 'ذَلْقِيَّة — Alveolar (Zungenspitze + Zahndamm)',
    'dental': 'أَسَلِيَّة — Dental (Zungenspitze + Zähne)',
    'interdental': 'لَثَوِيَّة — Interdental (Zunge zwischen Zähnen)',
    'sibilant': 'صَفِيرِيَّة — Sibilant (Zungenspitze + untere Zähne)',
    'labiodental': 'شَفَوِيَّة سِنِّيَّة — Labiodental (Lippe + Zähne)',
    'lips': 'شَفَتَان — Bilabial (zwei Lippen)',
  },
  uz: {
    'glottal': 'حَلْق أَقْصَى — Glottal (tomoqning tubi)',
    'pharyngeal': 'وَسَط الحَلْق — Faringal (tomoq o\'rtasi)',
    'uvular': 'أَدْنَى الحَلْق — Uvular (og\'izga yaqin)',
    'velar': 'لَهَوِيَّة — Velar (til orqasi + yumshoq tanglay)',
    'palatal': 'شَجَرِيَّة — Palatal (til o\'rtasi + qattiq tanglay)',
    'alveolar': 'ذَلْقِيَّة — Alveolar (til uchi + milklar)',
    'dental': 'أَسَلِيَّة — Dental (til uchi + tishlar)',
    'interdental': 'لَثَوِيَّة — Interdental (til tishlar orasida)',
    'sibilant': 'صَفِيرِيَّة — Sibilant (til uchi + pastki tishlar)',
    'labiodental': 'شَفَوِيَّة سِنِّيَّة — Labiodental (lab + tishlar)',
    'lips': 'شَفَتَان — Bilabial (ikki lab)',
  },
};
// Dynamic accessor
const ZONE_NAMES = new Proxy({}, { get: (_, zone) => (ZONE_NAMES_I18N[currentLang] || ZONE_NAMES_I18N.en)[zone] || zone });

// ═══════════════════════════════════════════════════════════════
// BREATH MAP — how air moves during each letter's production
// and how the breath pattern embodies the letter's meaning
// ═══════════════════════════════════════════════════════════════
const BREATH_MAP = {
  'ء': {
    airflow: 'STOP → RELEASE',
    breath: 'Breath is cut at the deepest point — the glottis slams shut then opens. Total interruption before any sound can begin.',
    embodies: 'The breath STARTS from nothing. Silence → sound. This is why ء = ORIGIN — it is the act of beginning itself. You cannot speak without first opening the glottis. Every utterance begins with hamza, whether you hear it or not.',
    diagram: '◀━━╳━━  (blocked, then released)',
  },
  'ا': {
    airflow: 'OPEN CHANNEL',
    breath: 'Breath flows unobstructed through the fully open throat. No tongue, no lips, no contact. Pure column of air.',
    embodies: 'The breath has NO obstacle — it is the ONE unblocked path. This is why ا = UNITY — it is the only letter that touches nothing. Abjad 1. The vertical stroke. The single open column.',
    diagram: '◀══════  (fully open, no contact)',
  },
  'ب': {
    airflow: 'SEAL → BUILD PRESSURE → BURST',
    breath: 'Both lips close completely (seal). Air pressure builds behind the seal. Lips open — burst of air escapes.',
    embodies: 'The breath is CONSTRUCTED — two parts come together (the lips), hold something inside (pressure), then release. This is why ب = BUILDING — the physical act of saying ب IS building. Two surfaces touching = abjad 2 = pair.',
    diagram: '◀━━║▓▓║━━  (lips seal, pressure builds, burst)',
  },
  'ت': {
    airflow: 'TAP → SHARP RELEASE',
    breath: 'Tongue tip taps upper teeth base — quick, precise closure and release. Sharper and lighter than ط.',
    embodies: 'The breath is MARKED — a precise, light tap that creates a clear boundary. This is why ت = SUCCESSION/MARKING — it stamps a point in the flow. The feminine marker (ة) uses this letter because it marks/distinguishes.',
    diagram: '◀━━╽━━  (light tap, sharp release)',
  },
  'ث': {
    airflow: 'THIN CONTINUOUS FRICTION',
    breath: 'Tongue tip sits between upper and lower teeth. Air pushes through the thin gap above the tongue — a soft, diffuse hiss.',
    embodies: 'The breath SCATTERS through a wide, thin gap. Not focused. This is why ث often appears in roots of SPREADING and DISPERSAL (ث-ن-ي fold/double, ب-ع-ث scatter/resurrect). The air itself spreads.',
    diagram: '◀━≈≈≈━━  (thin spread, diffuse)',
  },
  'ج': {
    airflow: 'COMPRESS → FRICTION RELEASE',
    breath: 'Tongue body presses against hard palate (like د), then releases into friction (like ش). Two-phase: stop + turbulence.',
    embodies: 'The breath is COMPOUNDED — it does two things in one motion (stop + friction). This is why ج = GATHERING/COMBINING — the sound itself is a combination. ج-م-ع (gather), ج-ع-ل (make/do).',
    diagram: '◀━≋≋║━━  (compress, then turbulent release)',
  },
  'ح': {
    airflow: 'WARM CONSTRICTED EXHALE',
    breath: 'Throat narrows at the pharynx — NOT closed (that would be ء), but constricted. Air pushes through a narrowed warm passage. Breathy, effortful.',
    embodies: 'The breath requires EFFORT through a living passage. This is why ح = LIFE/VITALITY — the sound of ح IS the sound of breathing with effort. حَيَاة (life), رُوح (spirit/breath). Saying ح feels like a deliberate exhale.',
    diagram: '◀━━⟩⟩━━  (pharynx narrows, warm air)',
  },
  'خ': {
    airflow: 'BACK-OF-THROAT SCRAPE',
    breath: 'Back of tongue rises toward soft palate, creating turbulence. A rasping, scraping friction from deep in the mouth.',
    embodies: 'The breath is FORCED through a rough passage — passage itself is transformed. This is why خ = PASSAGE/PENETRATION — خ-ر-ج (exit), خ-ل-ق (create/penetrate into existence). The air breaks through.',
    diagram: '◀━≋≋≋━━  (deep scraping turbulence)',
  },
  'د': {
    airflow: 'TONGUE-STRIKE → VOICED BURST',
    breath: 'Tongue tip strikes upper teeth base with voicing — the vocal cords vibrate through the stop. Heavier than ت.',
    embodies: 'The breath CALLS — it strikes with voice behind it, an announcement. This is why د = CALLING/POINTING — the voiced strike demands attention. دَعَا (call), هُدَى (guidance = calling to the path).',
    diagram: '◀━━╽̤━━  (voiced strike, weighted burst)',
  },
  'ذ': {
    airflow: 'VOICED THIN FRICTION',
    breath: 'Like ث but with vocal cords vibrating. Tongue between teeth, air + voice push through together.',
    embodies: 'The breath REMEMBERS — sustained vibration through a visible opening (tongue visible between teeth). This is why ذ = REMEMBERING/MENTIONING — ذ-ك-ر (remember). The vibration sustains, keeps going.',
    diagram: '◀━≈̤≈̤≈̤━━  (voiced, thin, sustained)',
  },
  'ر': {
    airflow: 'REPEATED TAPS (TRILL)',
    breath: 'Tongue tip vibrates rapidly against the alveolar ridge — air is released in quick repeated bursts. The tongue MOVES.',
    embodies: 'The breath MOVES REPEATEDLY — it cannot stay still. This is why ر = MOVEMENT/RETURN — the tongue literally goes back and forth. رَجَعَ (return), سَيْر (journey). The letter IS motion.',
    diagram: '◀━╽╽╽╽━  (rapid repeated taps = motion)',
  },
  'ز': {
    airflow: 'FOCUSED VOICED BUZZ',
    breath: 'Like س but with vocal cords vibrating. Tongue tip near lower teeth, air + voice create a buzzing resonance.',
    embodies: 'The breath VIBRATES with energy — a concentrated buzz. This is why ز appears in roots of INCREASE and ADORNMENT — ز-ي-د (increase), ز-ي-ن (adorn). The buzz adds energy to what was silent.',
    diagram: '◀━∿∿∿━━  (focused vibrating buzz)',
  },
  'س': {
    airflow: 'SHARP FOCUSED HISS',
    breath: 'Tongue tip near lower teeth, blade near alveolar ridge. Air is channeled into a narrow, high-frequency stream — the sharpest friction in the alphabet.',
    embodies: 'The breath is CHANNELED with precision — a laser of air. This is why س = FLOW/CONTINUITY — السَّمَاء (sky), سَبِيل (path). The air flows in one focused direction without stopping.',
    diagram: '◀━⟫⟫⟫━━  (narrow, focused, continuous)',
  },
  'ش': {
    airflow: 'BROAD WARM HISS',
    breath: 'Wider than س. Tongue body rises, air spreads across a broad surface. A "hushing" sound — diffuse, not focused.',
    embodies: 'The breath SPREADS widely — the opposite of س\'s focus. This is why ش = SPREADING/EXPANSION — ش-ر-ك (share/spread among), ش-ي-أ (thing = what has spread into existence).',
    diagram: '◀━⟩⟩⟩⟩━━  (broad, warm, spread out)',
  },
  'ص': {
    airflow: 'HEAVY CHANNELED HISS',
    breath: 'Like س but with the tongue root pulled back (velarized/emphatic). The air channel is narrower AND the throat constricts — creating a heavy, dark whistle.',
    embodies: 'The breath carries WEIGHT and TRUTH — it is س made heavy, made real. This is why ص = TRUTH/SINCERITY — صَدَقَ (be true), صَبَرَ (endure). The extra effort = the cost of truth.',
    diagram: '◀━⟫̤⟫̤⟫̤━━  (heavy, weighted, earnest)',
  },
  'ض': {
    airflow: 'HEAVY VOICED LATERAL STRIKE',
    breath: 'Tongue edges press against upper molars, tip strikes alveolar ridge with emphatic backing. Air escapes laterally (the sides). Unique in the world\'s languages.',
    embodies: 'The breath is FORCED SIDEWAYS — the only letter where air goes AROUND, not through. This is why ض = OPPOSITION/CONTRAST — ضَرَبَ (strike), ضَلَّ (go astray = deviate from the path). The air itself deviates.',
    diagram: '◀━⇥⇤╽̤━━  (lateral escape, heavy)',
  },
  'ط': {
    airflow: 'HEAVY SEALED BURST',
    breath: 'Like ت but with the tongue root pulled back (emphatic). Full tongue surface presses the palate — massive seal, then heavy release.',
    embodies: 'The breath is CONTAINED with full authority before release — a heavier seal than ب or ت. This is why ط = AUTHORITY/ENCOMPASSING — طَرِيق (road = what the authority laid), طَيِّب (good/pure).',
    diagram: '◀━║̤▓▓▓║̤━━  (heavy seal, authoritative burst)',
  },
  'ظ': {
    airflow: 'HEAVY VOICED INTERDENTAL',
    breath: 'Like ذ but emphatic — tongue between teeth with throat constriction. A thick, dark, sustained friction.',
    embodies: 'The breath is VISIBLE and HEAVY — tongue visible between teeth + weight of emphasis. This is why ظ = VISIBILITY/MANIFESTATION — ظَهَرَ (appear), ظَلَمَ (darken = make the visible disappear).',
    diagram: '◀━≈̤≈̤≈̤━━  (heavy, visible, sustained)',
  },
  'ع': {
    airflow: 'DEEP CONSTRICTED VOICE',
    breath: 'Throat constricts at the pharynx WITH voicing — deeper than ح. The vocal cords vibrate while the pharynx narrows. A strangled, creaky resonance from the depths.',
    embodies: 'The breath comes from DEPTH with effort and voice — you can feel it in your body. This is why ع = DEPTH/KNOWLEDGE — عَلِمَ (know), عَمِلَ (do), عَبَدَ (devote). True knowledge comes from deep effort. The deepest voiced consonant.',
    diagram: '◀━━⟩̤⟩̤━━  (deep, voiced, effortful)',
  },
  'غ': {
    airflow: 'VOICED BACK SCRAPE',
    breath: 'Like خ but voiced — back of tongue near uvula/soft palate with vocal cord vibration. A gargling, rolling friction.',
    embodies: 'The breath is CONCEALED in turbulence — you hear vibration but not clarity. This is why غ = CONCEALMENT/ABSENCE — غَيْب (unseen), غَفَرَ (cover/forgive). The sound itself hides in its own noise.',
    diagram: '◀━≋̤≋̤≋̤━━  (voiced, turbulent, concealed)',
  },
  'ف': {
    airflow: 'LIP-TOOTH CONTINUOUS STREAM',
    breath: 'Lower lip touches upper teeth. Air flows continuously between lip and teeth — steady, directional, splittable.',
    embodies: 'The breath OPENS and SEPARATES — air splits around the teeth. This is why ف = OPENING/SPLITTING — فَتَحَ (open), فَرَقَ (separate), فَعَلَ (do = open into action). The air IS the opening.',
    diagram: '◀━⌇⌇⌇━━  (splits between lip and teeth)',
  },
  'ق': {
    airflow: 'DEEP BACK STOP → HEAVY RELEASE',
    breath: 'Back of tongue strikes the uvular region — deeper than ك. Complete stop at the deepest plosive point, then release.',
    embodies: 'The breath COMMANDS from depth — the deepest plosive in the mouth. This is why ق = POWER/SPEECH — قَالَ (said), قَدَرَ (power/decree), قَلْب (heart). The deepest stop = the weightiest command.',
    diagram: '◀━║̤▓▓║̤━━  (deep stop, commanding release)',
  },
  'ك': {
    airflow: 'BACK STOP → ASPIRATED RELEASE',
    breath: 'Back of tongue strikes soft palate — lighter than ق but deeper than ت. Stop, then release with a breath of aspiration.',
    embodies: 'The breath ENCOMPASSES — the tongue covers a wide surface (velar). This is why ك = BEING/ENCOMPASSING — كَانَ (was/being), كُلّ (all/every), كَتَبَ (write = encompass in marks). The tongue covers, the sound contains.',
    diagram: '◀━━║▓║━━  (velar stop, encompassing)',
  },
  'ل': {
    airflow: 'LATERAL FLOW AROUND TONGUE',
    breath: 'Tongue tip touches alveolar ridge, but air flows freely around BOTH SIDES of the tongue. The only true lateral consonant.',
    embodies: 'The breath CONNECTS by flowing around — it does not stop, it finds a way. This is why ل = CONNECTION/FLOW — the definite article اللام connects words to meaning. لَيْل (night = what flows around). The air wraps around the obstacle.',
    diagram: '◀━⇥━╽━⇤━  (flows around both sides)',
  },
  'م': {
    airflow: 'LIPS SEAL → NASAL RESONANCE',
    breath: 'Lips close completely (like ب) BUT air is redirected through the nose. The mouth is sealed; the sound resonates in the nasal cavity.',
    embodies: 'The breath is ENCLOSED and REDIRECTED — sealed at the mouth, escaping through a hidden passage. This is why م = ENCLOSURE — أُمّ (mother = the first enclosure), مَاء (water = what is enclosed in vessels). The womb IS م — sealed outside, life inside.',
    diagram: '◀↑↑║▓▓║━━  (lips seal, air exits through nose)',
  },
  'ن': {
    airflow: 'TONGUE SEAL → NASAL CONTINUATION',
    breath: 'Tongue tip touches alveolar ridge (like ل), but air redirects through nose (like م). Nasal resonance from a higher point than م.',
    embodies: 'The breath CONTINUES through a hidden channel — it appears to stop but keeps going nasally. This is why ن = CONTINUATION/SOUL — نَفْس (soul/self), نُور (light). The soul continues after apparent ending. نون — the whale that continues beneath the surface.',
    diagram: '◀━━↑↑╽━━  (tongue seals, air continues through nose)',
  },
  'ه': {
    airflow: 'PURE BREATH — VOICELESS EXHALE',
    breath: 'The lightest articulation — just breath through a slightly narrowed glottis. No contact, no friction, barely a sound. The sound of breathing itself.',
    embodies: 'The breath IS the letter — there is nothing else. This is why ه = IDENTITY/BEING — هُوَ (He/it), هَٰذَا (this). The pronoun for God is هُوَ — pure breath, nothing added. The letter that is nothing but breath = the letter of pure existence.',
    diagram: '◀━━━━━━  (pure breath, nearly nothing)',
  },
  'و': {
    airflow: 'ROUNDED LIP GLIDE',
    breath: 'Lips round (like beginning ب but never closing). Air flows through a rounded opening — warm, continuous, vowel-like.',
    embodies: 'The breath JOINS without stopping — the lips shape but never seal. This is why و = JOINING/CONJUNCTION — the conjunction وَ (and). و connects without cutting. The breath rounds everything into one continuous flow.',
    diagram: '◀━◯◯◯━━  (rounded, open, joining)',
  },
  'ي': {
    airflow: 'RAISED TONGUE GLIDE',
    breath: 'Tongue body rises toward hard palate (like beginning ج but never touching). Air flows over a raised surface — bright, high, continuous.',
    embodies: 'The breath EXTENDS upward and forward — it reaches. This is why ي = REACHING/EXTENSION — يَد (hand = what reaches), يَوْم (day = time extending). The possessive يَاء (my/its) = extension of ownership.',
    diagram: '◀━⌒⌒⌒━━  (tongue rises, bright forward flow)',
  },
};

// Dot information per letter
const DOT_INFO = {
  'ا': {dots: 0, pos: ''}, 'ب': {dots: 1, pos: 'below'}, 'ت': {dots: 2, pos: 'above'},
  'ث': {dots: 3, pos: 'above'}, 'ج': {dots: 1, pos: 'below'}, 'ح': {dots: 0, pos: ''},
  'خ': {dots: 1, pos: 'above'}, 'د': {dots: 0, pos: ''}, 'ذ': {dots: 1, pos: 'above'},
  'ر': {dots: 0, pos: ''}, 'ز': {dots: 1, pos: 'above'}, 'س': {dots: 0, pos: ''},
  'ش': {dots: 3, pos: 'above'}, 'ص': {dots: 0, pos: ''}, 'ض': {dots: 1, pos: 'above'},
  'ط': {dots: 0, pos: ''}, 'ظ': {dots: 1, pos: 'above'}, 'ع': {dots: 0, pos: ''},
  'غ': {dots: 1, pos: 'above'}, 'ف': {dots: 1, pos: 'above'}, 'ق': {dots: 2, pos: 'above'},
  'ك': {dots: 0, pos: ''}, 'ل': {dots: 0, pos: ''}, 'م': {dots: 0, pos: ''},
  'ن': {dots: 1, pos: 'above'}, 'ه': {dots: 0, pos: ''}, 'و': {dots: 0, pos: ''},
  'ي': {dots: 2, pos: 'below'}, 'ء': {dots: 0, pos: ''},
};

// Dot families (same base shape)
const DOT_FAMILIES = [
  {base: 'Bowl shape (بَاء family)', members: [
    {letter: 'ب', dots: '1 below'}, {letter: 'ت', dots: '2 above'}, {letter: 'ث', dots: '3 above'},
    {letter: 'ن', dots: '1 above'}, {letter: 'ي', dots: '2 below'}
  ]},
  {base: 'Cup shape (جِيم family)', members: [
    {letter: 'ج', dots: '1 below'}, {letter: 'ح', dots: 'none'}, {letter: 'خ', dots: '1 above'}
  ]},
  {base: 'Tooth shape (دَال family)', members: [
    {letter: 'د', dots: 'none'}, {letter: 'ذ', dots: '1 above'}
  ]},
  {base: 'Hook shape (رَاء family)', members: [
    {letter: 'ر', dots: 'none'}, {letter: 'ز', dots: '1 above'}
  ]},
  {base: 'Teeth shape (سِين family)', members: [
    {letter: 'س', dots: 'none'}, {letter: 'ش', dots: '3 above'}
  ]},
  {base: 'Closed loop (صَاد family)', members: [
    {letter: 'ص', dots: 'none'}, {letter: 'ض', dots: '1 above'}
  ]},
  {base: 'Tall loop (طَاء family)', members: [
    {letter: 'ط', dots: 'none'}, {letter: 'ظ', dots: '1 above'}
  ]},
  {base: 'Eye shape (عَيْن family)', members: [
    {letter: 'ع', dots: 'none'}, {letter: 'غ', dots: '1 above'}
  ]},
  {base: 'Head shape (فَاء/قَاف family)', members: [
    {letter: 'ف', dots: '1 above'}, {letter: 'ق', dots: '2 above'}
  ]},
  {base: 'Standalone forms', members: [
    {letter: 'ا', dots: 'none (vertical stroke)'}, {letter: 'ك', dots: 'hamza-like mark'},
    {letter: 'ل', dots: 'none (lam stroke)'}, {letter: 'م', dots: 'none (closed)'},
    {letter: 'ه', dots: 'none (circle)'}, {letter: 'و', dots: 'none (hook)'},
  ]},
];

// ═══════════════════════════════════════════════════════════════
// GRID VIEW CLASSIFICATION DATA
// ═══════════════════════════════════════════════════════════════

// Non-connecting letters (don't join to the next letter)
const NON_CONNECTORS = new Set(['ا','د','ذ','ر','ز','و','ء']);

// The 14 Muqattaʿāt letters (appear as surah openers)
const MUQATTAAT = new Set(['ا','ح','ر','س','ص','ط','ع','ق','ك','ل','م','ن','ه','ي']);

// Emphatic letters (مُفَخَّمَة)
const EMPHATICS = new Set(['ص','ض','ط','ظ','خ','غ','ق']);

// Abjad order (historical أَبْجَد هَوَّز)
const ABJAD_ORDER = 'ابجدهوزحطيكلمنسعفصقرشتثخذضظغ'.split('');

// Manner of articulation groups
const MANNER_MAP = {
  'ب':'plosive','ت':'plosive','د':'plosive','ط':'plosive','ض':'plosive','ك':'plosive','ق':'plosive',
  'ف':'fricative','ث':'fricative','ذ':'fricative','ظ':'fricative','س':'fricative','ز':'fricative',
  'ص':'fricative','ش':'fricative','خ':'fricative','غ':'fricative','ح':'fricative','ع':'fricative','ه':'fricative',
  'م':'nasal','ن':'nasal',
  'ل':'liquid','ر':'liquid',
  'و':'glide','ي':'glide',
  'ا':'vowel','ء':'glottal_stop',
  'ج':'affricate',
};
const MANNER_LABELS_I18N = {
  en: {
    'plosive':'انْفِجَارِيَّة Plosive','fricative':'اِحْتِكَاكِيَّة Fricative','nasal':'أَنْفِيَّة Nasal',
    'liquid':'جَانِبِيَّة Liquid','glide':'شِبْه صَوْت Glide','vowel':'صَائِت Vowel',
    'glottal_stop':'هَمْزَة Glottal Stop','affricate':'مُرَكَّبَة Affricate',
  },
  ru: {
    'plosive':'انْفِجَارِيَّة Взрывные','fricative':'اِحْتِكَاكِيَّة Щелевые','nasal':'أَنْفِيَّة Носовые',
    'liquid':'جَانِبِيَّة Плавные','glide':'شِبْه صَوْت Скользящие','vowel':'صَائِت Гласные',
    'glottal_stop':'هَمْزَة Гортанная смычка','affricate':'مُرَكَّبَة Аффрикаты',
  },
  de: {
    'plosive':'انْفِجَارِيَّة Plosive','fricative':'اِحْتِكَاكِيَّة Frikative','nasal':'أَنْفِيَّة Nasale',
    'liquid':'جَانِبِيَّة Liquide','glide':'شِبْه صَوْت Gleitlaute','vowel':'صَائِت Vokale',
    'glottal_stop':'هَمْزَة Glottisschlag','affricate':'مُرَكَّبَة Affrikaten',
  },
  uz: {
    'plosive':'انْفِجَارِيَّة Portlovchi','fricative':'اِحْتِكَاكِيَّة Sirg\'aluvchi','nasal':'أَنْفِيَّة Burun',
    'liquid':'جَانِبِيَّة Suyuq','glide':'شِبْه صَوْت Sirpanuvchi','vowel':'صَائِت Unli',
    'glottal_stop':'هَمْزَة Glottal to\'siq','affricate':'مُرَكَّبَة Affrikat',
  },
};
const MANNER_LABELS = new Proxy({}, { get: (_, k) => (MANNER_LABELS_I18N[currentLang] || MANNER_LABELS_I18N.en)[k] || k });

// Shape families for grouping
const SHAPE_FAMILIES = {
  'بَاء bowl': ['ب','ت','ث','ن','ي'],
  'جِيم cup': ['ج','ح','خ'],
  'دَال tooth': ['د','ذ'],
  'رَاء hook': ['ر','ز'],
  'سِين teeth': ['س','ش'],
  'صَاد loop': ['ص','ض'],
  'طَاء tall': ['ط','ظ'],
  'عَيْن eye': ['ع','غ'],
  'فَاء head': ['ف','ق'],
  'standalone': ['ا','ك','ل','م','ه','و','ء'],
};

// Articulation zone order (throat → lips)
const ZONE_ORDER = ['glottal','pharyngeal','uvular','velar','palatal','alveolar','dental','interdental','sibilant','labiodental','lips'];

// Quranic frequency data (approximate token counts — from compiler)
const QURAN_FREQ = {
  'ا':43470,'ل':38191,'م':26735,'ن':26560,'و':25536,'ي':21480,'ه':14850,'ر':11793,
  'ب':11491,'ت':10520,'ك':10497,'ف':8747,'ع':9220,'د':5991,'ق':6933,'س':5891,
  'ح':4140,'ج':3317,'ذ':4932,'ص':2071,'ش':2182,'ء':2607,'خ':2497,'ط':1273,
  'ث':1414,'غ':1221,'ض':1607,'ز':1599,'ظ':853,'ف':8747,'ة':0,'ى':0,
};

// ═══════════════════════════════════════════════════════════════
// HARAKAT DATA
// ═══════════════════════════════════════════════════════════════
const HARAKAT = [
  {name: 'فَتْحَة', translit: 'fatḥa', sample: 'بَ', mark: '\u064E', desc: 'Short "a" — a diagonal stroke above the letter. Opens the sound upward. The most basic vowel.', geometric: 'A small slanted line (/) above = opening, like a door ajar.'},
  {name: 'ضَمَّة', translit: 'ḍamma', sample: 'بُ', mark: '\u064F', desc: 'Short "u" — a small و (waw) above the letter. Rounds the lips. Enclosure.', geometric: 'A miniature و above = the lips rounding into a circle.'},
  {name: 'كَسْرَة', translit: 'kasra', sample: 'بِ', mark: '\u0650', desc: 'Short "i" — a diagonal stroke below the letter. Pulls the sound downward. The preposition بِ uses this.', geometric: 'A small slanted line (/) below = directing downward, beneath.'},
  {name: 'سُكُون', translit: 'sukūn', sample: 'بْ', mark: '\u0652', desc: 'Silence — a small circle above. The letter has NO vowel. It stops.', geometric: 'A zero/circle above = nothing. The letter is sealed shut.'},
  {name: 'شَدَّة', translit: 'shadda', sample: 'بّ', mark: '\u0651', desc: 'Doubling/Gemination — a small ش-like mark above. The letter is pronounced twice. Intensification.', geometric: 'A small w-shape above = the letter folds back on itself, doubles.'},
];

const TANWIN = [
  {name: 'فَتْحَتَان', translit: 'fatḥatān', sample: 'بًا', mark: '\u064B', desc: 'Double fatḥa = "-an" sound. Indefinite accusative. Written with alif seat.', geometric: 'Two fatḥa stacked = the opening doubled, trailing into nūn.'},
  {name: 'ضَمَّتَان', translit: 'ḍammatān', sample: 'بٌ', mark: '\u064C', desc: 'Double ḍamma = "-un" sound. Indefinite nominative.', geometric: 'Two ḍamma stacked = enclosure doubled.'},
  {name: 'كَسْرَتَان', translit: 'kasratān', sample: 'بٍ', mark: '\u064D', desc: 'Double kasra = "-in" sound. Indefinite genitive.', geometric: 'Two kasra stacked = direction-below doubled.'},
];

const EXTRA_MARKS = [
  {name: 'مَدَّة', translit: 'madda', sample: 'آ', mark: '\u0653', desc: 'Elongation mark on alif. Represents hamza + long ā (آ = أَا). The opening stretched.', geometric: 'A tilde (~) on alif = the sound extends, stretches beyond its normal length.'},
  {name: 'هَمْزَة فَوْقِيَّة', translit: 'hamza above', sample: 'أَ', mark: '\u0654', desc: 'Hamza seated above alif. The glottal stop before a fatḥa or ḍamma vowel.', geometric: 'A small ع-shape above = the throat catches before the vowel releases.'},
  {name: 'هَمْزَة تَحْتِيَّة', translit: 'hamza below', sample: 'إِ', mark: '\u0655', desc: 'Hamza seated below alif. The glottal stop before a kasra vowel.', geometric: 'Hamza beneath = the throat catches and the sound goes below (kasra direction).'},
  {name: 'أَلِف خَنْجَرِيَّة', translit: 'dagger alif', sample: 'رَحْمٰن', mark: '\u0670', desc: 'Superscript alif — represents a long ā that is written above instead of after. Found in Qur\'anic orthography: اللّٰه، الرَّحْمٰن.', geometric: 'A tiny vertical stroke above = the alif is HIDDEN inside the letter, not beside it.'},
];

// ═══════════════════════════════════════════════════════════════
// NAVIGATION
// ═══════════════════════════════════════════════════════════════
let selectedLetter = null;

document.querySelectorAll('#main-nav button').forEach(btn => {
  btn.addEventListener('click', () => {
    document.querySelectorAll('#main-nav button').forEach(b => b.classList.remove('active'));
    btn.classList.add('active');
    document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
    document.getElementById(btn.dataset.section).classList.add('active');
  });
});

// ═══════════════════════════════════════════════════════════════
// AUDIO ENGINE — Pre-recorded mp3 files (Google TTS)
// ═══════════════════════════════════════════════════════════════

const LETTER_AUDIO_MAP = {
  'ا': 'alif', 'ب': 'ba', 'ت': 'ta', 'ث': 'tha', 'ج': 'jim',
  'ح': 'ha', 'خ': 'kha', 'د': 'dal', 'ذ': 'dhal', 'ر': 'ra',
  'ز': 'zay', 'س': 'sin', 'ش': 'shin', 'ص': 'sad', 'ض': 'dad',
  'ط': 'taa', 'ظ': 'dhaa', 'ع': 'ayn', 'غ': 'ghayn', 'ف': 'fa',
  'ق': 'qaf', 'ك': 'kaf', 'ل': 'lam', 'م': 'mim', 'ن': 'nun',
  'ه': 'haa', 'و': 'waw', 'ي': 'ya', 'ء': 'alif',
};

let currentAudio = null;

function playLetterSound(letter) {
  const file = LETTER_AUDIO_MAP[letter];
  if (!file) return;
  if (currentAudio) { currentAudio.pause(); currentAudio.currentTime = 0; }
  currentAudio = new Audio('audio/' + file + '.mp3');
  currentAudio.play().catch(e => console.warn('Audio play failed:', e));
}

// ═══════════════════════════════════════════════════════════════
// LETTER GRID — 13 VIEW MODES
// ═══════════════════════════════════════════════════════════════
let currentGridView = 'alphabetical';

function makeCell(letter) {
  const data = ALPHABET[letter];
  if (!data) return null;
  const cell = document.createElement('div');
  cell.className = 'letter-cell';
  cell.dataset.letter = letter;
  if (letter === selectedLetter) cell.classList.add('selected');
  const di = DOT_INFO[letter];
  const dotText = di && di.dots > 0 ? '●'.repeat(di.dots) : '';
  const br = BREATH_MAP[letter];
  cell.innerHTML = `
    <div class="abjad-val">${data.abjad}</div>
    <div class="dots-indicator">${dotText}</div>
    <div class="letter">${letter}</div>
    <div class="name">${data.name}</div>
    <div class="translit-small">${data.transliteration}</div>
    ${br ? `<div class="breath-diag">${br.diagram}</div><div class="airflow-label">${br.airflow}</div>` : ''}
    <div class="sound-btn" onclick="event.stopPropagation(); playLetterSound('${letter}')" title="Play sound">&#x1f50a;</div>
  `;
  cell.addEventListener('click', () => selectLetter(letter));
  return cell;
}

function makeGroupHeader(label, count) {
  const h = document.createElement('div');
  h.className = 'grid-group-header';
  h.innerHTML = `<span class="group-count">[${count}]</span>${label}`;
  return h;
}

function addGroupedLetters(grid, groups) {
  for (const [label, letters] of groups) {
    grid.appendChild(makeGroupHeader(label, letters.length));
    letters.forEach(l => { const c = makeCell(l); if (c) grid.appendChild(c); });
  }
}

// Group header translations
const GH_I18N = {
  en: {
    std_order: 'الأَبْجَدِيَّة — Standard Order',
    units: 'آحَاد — Units (1–9)', tens: 'عَشَرَات — Tens (10–90)',
    hundreds: 'مِئَات — Hundreds (100–900)', thousands: 'أُلُوف — Thousands (1000)',
    voiced: 'مَجْهُور — Voiced (vocal cords vibrate)', voiceless: 'مَهْمُوس — Voiceless (no vibration)',
    sun: 'شَمْسِيَّة — Sun Letters (assimilate with ال)', moon: 'قَمَرِيَّة — Moon Letters (no assimilation)',
    neither: 'Neither',
    undotted: 'مُهْمَلَة — Undotted (original skeleton)', dotted_g: 'مُعْجَمَة — Dotted (marked variants)',
    d0: '٠ نُقَط — No dots', d1: '١ نُقْطَة — 1 dot', d2: '٢ نُقْطَتَان — 2 dots', d3: '٣ نُقَط — 3 dots',
    connecting: 'مُتَّصِلَة — Connecting (joins to next letter)', non_connecting: 'مُنْفَصِلَة — Non-connecting (breaks the chain)',
    emphatic_g: 'مُفَخَّمَة — Emphatic (velarized/heavy)', plain: 'مُرَقَّقَة — Plain (light)',
    muq_in: 'الحُرُوف المُقَطَّعَات — Surah Openers (14 letters)', muq_out: 'غَيْر مُقَطَّعَة — Not in Fawātiḥ (14 letters)',
    freq: 'تَوَاتُر — Qur\'anic Frequency (highest → lowest)',
    sf_bowl: 'بَاء bowl', sf_cup: 'جِيم cup', sf_tooth: 'دَال tooth', sf_hook: 'رَاء hook',
    sf_teeth: 'سِين teeth', sf_loop: 'صَاد loop', sf_tall: 'طَاء tall', sf_eye: 'عَيْن eye',
    sf_head: 'فَاء head', sf_standalone: 'standalone',
  },
  ru: {
    std_order: 'الأَبْجَدِيَّة — Стандартный порядок',
    units: 'آحَاد — Единицы (1–9)', tens: 'عَشَرَات — Десятки (10–90)',
    hundreds: 'مِئَات — Сотни (100–900)', thousands: 'أُلُوف — Тысячи (1000)',
    voiced: 'مَجْهُور — Звонкие (голосовые связки вибрируют)', voiceless: 'مَهْمُوس — Глухие (без вибрации)',
    sun: 'شَمْسِيَّة — Солнечные буквы (ассимиляция с ال)', moon: 'قَمَرِيَّة — Лунные буквы (без ассимиляции)',
    neither: 'Ни то, ни другое',
    undotted: 'مُهْمَلَة — Без точек (исходный скелет)', dotted_g: 'مُعْجَمَة — С точками (отмеченные варианты)',
    d0: '٠ نُقَط — Без точек', d1: '١ نُقْطَة — 1 точка', d2: '٢ نُقْطَتَان — 2 точки', d3: '٣ نُقَط — 3 точки',
    connecting: 'مُتَّصِلَة — Соединяющиеся (связываются со следующей)', non_connecting: 'مُنْفَصِلَة — Несоединяющиеся (разрывают цепочку)',
    emphatic_g: 'مُفَخَّمَة — Эмфатические (веляризованные/тяжёлые)', plain: 'مُرَقَّقَة — Простые (лёгкие)',
    muq_in: 'الحُرُوف المُقَطَّعَات — Открывающие суры (14 букв)', muq_out: 'غَيْر مُقَطَّعَة — Не в фаватих (14 букв)',
    freq: 'تَوَاتُر — Частота в Коране (от высшей к низшей)',
    sf_bowl: 'بَاء чаша', sf_cup: 'جِيم кубок', sf_tooth: 'دَال зуб', sf_hook: 'رَاء крюк',
    sf_teeth: 'سِين зубцы', sf_loop: 'صَاد петля', sf_tall: 'طَاء высокая', sf_eye: 'عَيْن глаз',
    sf_head: 'فَاء голова', sf_standalone: 'отдельные',
  },
  de: {
    std_order: 'الأَبْجَدِيَّة — Standardreihenfolge',
    units: 'آحَاد — Einer (1–9)', tens: 'عَشَرَات — Zehner (10–90)',
    hundreds: 'مِئَات — Hunderter (100–900)', thousands: 'أُلُوف — Tausender (1000)',
    voiced: 'مَجْهُور — Stimmhaft (Stimmbänder vibrieren)', voiceless: 'مَهْمُوس — Stimmlos (keine Vibration)',
    sun: 'شَمْسِيَّة — Sonnenbuchstaben (Assimilation mit ال)', moon: 'قَمَرِيَّة — Mondbuchstaben (keine Assimilation)',
    neither: 'Weder noch',
    undotted: 'مُهْمَلَة — Ohne Punkte (Originalskelett)', dotted_g: 'مُعْجَمَة — Mit Punkten (markierte Varianten)',
    d0: '٠ نُقَط — Keine Punkte', d1: '١ نُقْطَة — 1 Punkt', d2: '٢ نُقْطَتَان — 2 Punkte', d3: '٣ نُقَط — 3 Punkte',
    connecting: 'مُتَّصِلَة — Verbindend (schließt an nächsten an)', non_connecting: 'مُنْفَصِلَة — Nicht verbindend (unterbricht die Kette)',
    emphatic_g: 'مُفَخَّمَة — Emphatisch (velarisiert/schwer)', plain: 'مُرَقَّقَة — Einfach (leicht)',
    muq_in: 'الحُرُوف المُقَطَّعَات — Suren-Eröffner (14 Buchstaben)', muq_out: 'غَيْر مُقَطَّعَة — Nicht in Fawātiḥ (14 Buchstaben)',
    freq: 'تَوَاتُر — Koranische Häufigkeit (höchste → niedrigste)',
    sf_bowl: 'بَاء Schale', sf_cup: 'جِيم Becher', sf_tooth: 'دَال Zahn', sf_hook: 'رَاء Haken',
    sf_teeth: 'سِين Zähne', sf_loop: 'صَاد Schlaufe', sf_tall: 'طَاء Hoch', sf_eye: 'عَيْن Auge',
    sf_head: 'فَاء Kopf', sf_standalone: 'Einzelformen',
  },
  uz: {
    std_order: 'الأَبْجَدِيَّة — Standart tartib',
    units: 'آحَاد — Birliklar (1–9)', tens: 'عَشَرَات — O\'nliklar (10–90)',
    hundreds: 'مِئَات — Yuzliklar (100–900)', thousands: 'أُلُوف — Mingliklar (1000)',
    voiced: 'مَجْهُور — Jarangli (tovush paychalari tebranadi)', voiceless: 'مَهْمُوس — Jarangsiz (tebranishsiz)',
    sun: 'شَمْسِيَّة — Quyosh harflari (ال bilan assimilyatsiya)', moon: 'قَمَرِيَّة — Oy harflari (assimilyatsiyasiz)',
    neither: 'Hech biri',
    undotted: 'مُهْمَلَة — Nuqtasiz (asl skelet)', dotted_g: 'مُعْجَمَة — Nuqtali (belgilangan variantlar)',
    d0: '٠ نُقَط — Nuqtasiz', d1: '١ نُقْطَة — 1 nuqta', d2: '٢ نُقْطَتَان — 2 nuqta', d3: '٣ نُقَط — 3 nuqta',
    connecting: 'مُتَّصِلَة — Ulanuvchi (keyingi harfga ulanadi)', non_connecting: 'مُنْفَصِلَة — Ulanmaydigan (zanjirni uzadi)',
    emphatic_g: 'مُفَخَّمَة — Emfatik (velyarizatsiya/og\'ir)', plain: 'مُرَقَّقَة — Oddiy (yengil)',
    muq_in: 'الحُرُوف المُقَطَّعَات — Sura ochuvchilar (14 harf)', muq_out: 'غَيْر مُقَطَّعَة — Favotihda emas (14 harf)',
    freq: 'تَوَاتُر — Qur\'on chastotasi (yuqoridan pastga)',
    sf_bowl: 'بَاء kosa', sf_cup: 'جِيم piyola', sf_tooth: 'دَال tish', sf_hook: 'رَاء ilgak',
    sf_teeth: 'سِين tishlar', sf_loop: 'صَاد halqa', sf_tall: 'طَاء baland', sf_eye: 'عَيْن ko\'z',
    sf_head: 'فَاء bosh', sf_standalone: 'mustaqil',
  },
};

function gh(key) { return (GH_I18N[currentLang] || GH_I18N.en)[key] || GH_I18N.en[key] || key; }

// Shape family key mapping
const SF_KEY_MAP = {
  'بَاء bowl': 'sf_bowl', 'جِيم cup': 'sf_cup', 'دَال tooth': 'sf_tooth', 'رَاء hook': 'sf_hook',
  'سِين teeth': 'sf_teeth', 'صَاد loop': 'sf_loop', 'طَاء tall': 'sf_tall', 'عَيْن eye': 'sf_eye',
  'فَاء head': 'sf_head', 'standalone': 'sf_standalone',
};

function getGridGroups(view) {
  const L = LETTERS_28;
  switch (view) {
    case 'alphabetical':
      return [[gh('std_order'), L]];

    case 'abjad-tiers': {
      const units = ABJAD_ORDER.filter(l => L.includes(l) && ABJAD[l] >= 1 && ABJAD[l] <= 9);
      const tens = ABJAD_ORDER.filter(l => L.includes(l) && ABJAD[l] >= 10 && ABJAD[l] <= 90);
      const hundreds = ABJAD_ORDER.filter(l => L.includes(l) && ABJAD[l] >= 100 && ABJAD[l] <= 900);
      const thousand = ABJAD_ORDER.filter(l => L.includes(l) && ABJAD[l] >= 1000);
      return [
        [gh('units'), units], [gh('tens'), tens],
        [gh('hundreds'), hundreds], [gh('thousands'), thousand],
      ].filter(g => g[1].length > 0);
    }

    case 'articulation': {
      return ZONE_ORDER.map(zone => {
        const zLetters = L.filter(l => ZONE_MAP[l] === zone);
        return [ZONE_NAMES[zone] || zone, zLetters];
      }).filter(g => g[1].length > 0);
    }

    case 'manner': {
      const order = ['plosive','affricate','fricative','nasal','liquid','glide','vowel','glottal_stop'];
      return order.map(m => {
        const mLetters = L.filter(l => MANNER_MAP[l] === m);
        return [MANNER_LABELS[m] || m, mLetters];
      }).filter(g => g[1].length > 0);
    }

    case 'voiced': {
      const voiced = L.filter(l => ALPHABET[l]?.phonetic?.voiced);
      const voiceless = L.filter(l => !ALPHABET[l]?.phonetic?.voiced);
      return [[gh('voiced'), voiced], [gh('voiceless'), voiceless]];
    }

    case 'sun-moon': {
      const sun = L.filter(l => ALPHABET[l]?.classification?.sun_moon?.includes('Sun'));
      const moon = L.filter(l => ALPHABET[l]?.classification?.sun_moon?.includes('Moon'));
      const neither = L.filter(l => {
        const sm = ALPHABET[l]?.classification?.sun_moon || '';
        return !sm.includes('Sun') && !sm.includes('Moon');
      });
      const groups = [[gh('sun'), sun], [gh('moon'), moon]];
      if (neither.length) groups.push([gh('neither'), neither]);
      return groups;
    }

    case 'dotted': {
      const undotted = L.filter(l => (DOT_INFO[l]?.dots || 0) === 0);
      const dotted = L.filter(l => (DOT_INFO[l]?.dots || 0) > 0);
      return [[gh('undotted'), undotted], [gh('dotted_g'), dotted]];
    }

    case 'dot-count': {
      const d0 = L.filter(l => (DOT_INFO[l]?.dots || 0) === 0);
      const d1 = L.filter(l => DOT_INFO[l]?.dots === 1);
      const d2 = L.filter(l => DOT_INFO[l]?.dots === 2);
      const d3 = L.filter(l => DOT_INFO[l]?.dots === 3);
      return [[gh('d0'), d0], [gh('d1'), d1], [gh('d2'), d2], [gh('d3'), d3]].filter(g => g[1].length > 0);
    }

    case 'shape': {
      return Object.entries(SHAPE_FAMILIES).map(([name, letters]) => {
        const filtered = letters.filter(l => L.includes(l) || l === 'ء');
        const key = SF_KEY_MAP[name] || name;
        return [gh(key), filtered];
      }).filter(g => g[1].length > 0);
    }

    case 'connectors': {
      const conn = L.filter(l => !NON_CONNECTORS.has(l));
      const nonConn = L.filter(l => NON_CONNECTORS.has(l));
      return [[gh('connecting'), conn], [gh('non_connecting'), nonConn]];
    }

    case 'emphatic': {
      const emph = L.filter(l => EMPHATICS.has(l));
      const plain = L.filter(l => !EMPHATICS.has(l));
      return [[gh('emphatic_g'), emph], [gh('plain'), plain]];
    }

    case 'muqattaat': {
      const inM = L.filter(l => MUQATTAAT.has(l));
      const notM = L.filter(l => !MUQATTAAT.has(l));
      return [[gh('muq_in'), inM], [gh('muq_out'), notM]];
    }

    case 'frequency': {
      const sorted = [...L].sort((a, b) => (QURAN_FREQ[b] || 0) - (QURAN_FREQ[a] || 0));
      return [[gh('freq'), sorted]];
    }

    default:
      return [['', L]];
  }
}

function buildGrid() {
  const grid = document.getElementById('letter-grid');
  grid.innerHTML = '';
  const groups = getGridGroups(currentGridView);
  addGroupedLetters(grid, groups);
}

// Grid view button listeners
document.querySelectorAll('#grid-view-bar .grid-view-btn').forEach(btn => {
  btn.addEventListener('click', () => {
    document.querySelectorAll('#grid-view-bar .grid-view-btn').forEach(b => b.classList.remove('active'));
    btn.classList.add('active');
    currentGridView = btn.dataset.view;
    buildGrid();
  });
});

function selectLetter(letter) {
  selectedLetter = letter;
  // Update grid selection
  document.querySelectorAll('.letter-cell').forEach(c => c.classList.remove('selected'));
  const cell = document.querySelector(`.letter-cell[data-letter="${letter}"]`);
  if (cell) cell.classList.add('selected');

  showDetail(letter);
  highlightZone(ZONE_MAP[letter]);
}

// ═══════════════════════════════════════════════════════════════
// DETAIL PANEL
// ═══════════════════════════════════════════════════════════════
function showDetail(letter) {
  const data = ALPHABET[letter];
  if (!data) return;
  const panel = document.getElementById('detail-panel');
  panel.classList.add('visible');

  document.getElementById('dp-letter').textContent = letter;
  document.getElementById('dp-name').textContent = data.name;
  document.getElementById('dp-translit').textContent = data.transliteration;

  const abjadVal = data.abjad;
  document.getElementById('dp-abjad-big').textContent = abjadVal;
  const div7 = abjadVal % 7 === 0;
  document.getElementById('dp-div7').textContent = div7 ? `${abjadVal} ÷ 7 = ${abjadVal/7} ✓` : `${abjadVal} ÷ 7 = ${(abjadVal/7).toFixed(2)}`;
  document.getElementById('dp-div7').style.color = div7 ? 'var(--green)' : 'var(--text-dim)';

  // Breath diagram in header
  const brH = BREATH_MAP[letter];
  document.getElementById('dp-breath-diag').textContent = brH ? brH.diagram : '';
  document.getElementById('dp-breath-label').textContent = brH ? brH.airflow : '';

  // Tags
  const tags = [];
  const ph = data.phonetic || {};
  const cl = data.classification || {};
  if (ph.voiced) tags.push('<span class="tag voiced">Voiced مَجْهُور</span>');
  else tags.push('<span class="tag" style="border-color:#e67e22;color:#e67e22;">Voiceless مَهْمُوس</span>');
  if (ph.emphatic) tags.push('<span class="tag emphatic">Emphatic مُفَخَّم</span>');
  if (cl.sun_moon && cl.sun_moon.includes('Sun')) tags.push('<span class="tag sun">Sun شَمْسِيَّة</span>');
  else if (cl.sun_moon && cl.sun_moon.includes('Moon')) tags.push('<span class="tag moon">Moon قَمَرِيَّة</span>');
  document.getElementById('dp-tags').innerHTML = tags.join(' ');

  // Build detail cards
  const grid = document.getElementById('dp-grid');
  grid.innerHTML = '';

  // 1. Phonetics
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('phonetics')}</h3>
    <div class="stat"><span class="stat-label">${t('makhraj')}</span></div>
    <p>${ph.makhraj || ''}</p>
    <div class="stat" style="margin-top:8px;"><span class="stat-label">${t('manner')}</span></div>
    <p>${ph.manner || ''}</p>
    <div class="stat" style="margin-top:8px;"><span class="stat-label">${t('description')}</span></div>
    <p>${ph.description || ''}</p>
  </div>`;

  // 2. Classification
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('classification')}</h3>
    <div class="stat"><span class="stat-label">${t('sun_moon')}</span><span class="stat-value">${cl.sun_moon || ''}</span></div>
    <div class="stat"><span class="stat-label">${t('type')}</span><span class="stat-value">${cl.type || ''}</span></div>
    <div class="stat"><span class="stat-label">${t('group')}</span><span class="stat-value">${cl.group || ''}</span></div>
  </div>`;

  // 3. Behaviour
  const bh = data.behaviour || {};
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('behaviour')}</h3>
    <p><strong style="color:var(--gold);">${t('as_first')}</strong> ${bh.as_first_radical || ''}</p>
    <p style="margin-top:8px;"><strong style="color:var(--gold);">${t('as_second')}</strong> ${bh.as_second_radical || ''}</p>
    <p style="margin-top:8px;"><strong style="color:var(--gold);">${t('as_third')}</strong> ${bh.as_third_radical || ''}</p>
    <p style="margin-top:8px;"><strong style="color:var(--gold);">${t('as_prefix')}</strong> ${bh.as_prefix || ''}</p>
    <p style="margin-top:8px;"><strong style="color:var(--gold);">${t('as_suffix')}</strong> ${bh.as_suffix || ''}</p>
  </div>`;

  // 4. Semantic tendency
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('semantic')}</h3>
    <p style="font-size:1em; color:var(--gold);">${data.semantic_tendency || ''}</p>
  </div>`;

  // 5. Shifts
  const shifts = data.shifts || [];
  let shiftHtml = shifts.map(s =>
    `<li><span class="latin">${s.downstream}</span> (${s.shift_id}) — ${s.note}</li>`
  ).join('');
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('shifts')}</h3>
    <ul>${shiftHtml || `<li>${t('no_shifts')}</li>`}</ul>
  </div>`;

  // 6. Quranic stats
  const qs = data.quranic_stats || {};
  let statsHtml = '';
  if (qs.tokens_any_position != null) {
    statsHtml += `<div class="stat"><span class="stat-label">Tokens (any position)</span><span class="stat-value">${qs.tokens_any_position?.toLocaleString() || '—'}</span></div>`;
  }
  if (qs.distinct_roots_any != null) {
    statsHtml += `<div class="stat"><span class="stat-label">Distinct roots</span><span class="stat-value">${qs.distinct_roots_any || '—'}</span></div>`;
  }
  if (qs.roots_as_first != null) {
    statsHtml += `<div class="stat"><span class="stat-label">Roots as 1st radical</span><span class="stat-value">${qs.roots_as_first || '—'}</span></div>`;
  }
  const topRoots = (arr) => (arr || []).map(r => `<li>${r[0]} (${r[1]})</li>`).join('');
  if (qs.top5_first?.length) statsHtml += `<div style="margin-top:6px;"><strong style="color:var(--gold);font-size:0.8em;">Top as 1st:</strong><ul>${topRoots(qs.top5_first)}</ul></div>`;
  if (qs.top5_second?.length) statsHtml += `<div style="margin-top:4px;"><strong style="color:var(--gold);font-size:0.8em;">Top as 2nd:</strong><ul>${topRoots(qs.top5_second)}</ul></div>`;
  if (qs.top5_third?.length) statsHtml += `<div style="margin-top:4px;"><strong style="color:var(--gold);font-size:0.8em;">Top as 3rd:</strong><ul>${topRoots(qs.top5_third)}</ul></div>`;
  if (qs.note) statsHtml += `<p style="margin-top:6px; font-style:italic; color:var(--text-dim); font-size:0.8em;">${qs.note}</p>`;

  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('quranic_stats')}</h3>
    ${statsHtml || '<p>See hamza (ء) entry</p>'}
  </div>`;

  // 7. Paired letters
  const pairs = data.paired_letters || {};
  let pairHtml = Object.entries(pairs).map(([k,v]) =>
    `<li><strong style="color:var(--accent);">${k}:</strong> ${v}</li>`
  ).join('');
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('pairs')}</h3>
    <ul>${pairHtml || `<li>${t('no_pairs')}</li>`}</ul>
  </div>`;

  // 8. Unique
  grid.innerHTML += `<div class="detail-card">
    <h3>${enFlag()}${t('unique_props')}</h3>
    <p>${data.unique || ''}</p>
  </div>`;

  // 9. Breath Pattern
  const br = BREATH_MAP[letter];
  if (br) {
    grid.innerHTML += `<div class="detail-card" style="grid-column: 1 / -1;">
      <h3>${enFlag()}نَفَس — Breath Pattern</h3>
      <div style="font-family:monospace; font-size:1.4em; text-align:center; color:var(--gold); margin:10px 0; direction:rtl; letter-spacing:2px;">${br.diagram}</div>
      <div style="font-size:0.8em; text-align:center; color:var(--accent); margin-bottom:12px; font-family:monospace; direction:rtl;">${br.airflow}</div>
      <p style="margin-bottom:10px;"><strong style="color:var(--text-dim);">How the breath moves:</strong><br>${br.breath}</p>
      <p><strong style="color:var(--gold);">Why this IS the meaning:</strong><br>${br.embodies}</p>
    </div>`;
  }

  // 10. Language Siblings (from AMR_I18N — DB data via amr_tarjama pipeline)
  const i18nData = AMR_I18N[letter];
  if (i18nData) {
    // Top roots with AMR meanings
    let rootsHtml = (i18nData.top_roots || []).map(r =>
      `<li><span style="color:var(--gold);">${r.root}</span> → <span class="latin" style="font-size:0.8em;">${r.amr}</span></li>`
    ).join('');

    // Language-specific siblings
    const langMap = {en: 'English', ru: 'Русский', de: 'Deutsch', uz: 'O\'zbek'};
    const langKey = currentLang;
    const siblings = i18nData[langKey] || i18nData.en || [];
    const otherLangs = Object.keys(langMap).filter(k => k !== langKey);

    let siblingsHtml = '';
    if (siblings.length) {
      siblingsHtml += `<div style="margin-top:8px;"><strong style="color:var(--gold);">${langMap[langKey]} (${siblings.length}):</strong>
        <div style="display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;">
          ${siblings.map(w => `<span class="tag" style="direction:ltr;">${w}</span>`).join('')}
        </div></div>`;
    }

    // Show other languages too (collapsed)
    for (const olang of otherLangs) {
      const owords = i18nData[olang] || [];
      if (owords.length) {
        siblingsHtml += `<div style="margin-top:6px;"><strong style="color:var(--text-dim); font-size:0.8em;">${langMap[olang]} (${owords.length}):</strong>
          <div style="display:flex; flex-wrap:wrap; gap:3px; margin-top:3px;">
            ${owords.slice(0, 8).map(w => `<span class="tag" style="direction:ltr; font-size:0.75em; opacity:0.7;">${w}</span>`).join('')}
            ${owords.length > 8 ? `<span class="tag" style="font-size:0.7em; opacity:0.5;">+${owords.length - 8}</span>` : ''}
          </div></div>`;
      }
    }

    grid.innerHTML += `<div class="detail-card" style="grid-column: 1 / -1;">
      <h3>أَشِقَّاء — Sibling Words (via أَمْر tarjama pipeline → DB)</h3>
      <div style="font-size:0.75em; color:var(--text-dim); margin-bottom:8px;">
        Top roots where ${letter} appears — expanded to all language siblings from lattice
      </div>
      <ul style="font-size:0.85em;">${rootsHtml}</ul>
      ${siblingsHtml}
    </div>`;
  }

  // Show animation container if animation data exists
  const animContainer = document.getElementById('anim-container');
  if (ARTICULATION_ANIMS[letter]) {
    animContainer.style.display = 'block';
    resetAnimation();
  } else {
    animContainer.style.display = 'none';
  }
}

// ═══════════════════════════════════════════════════════════════
// MAKHRAJ DIAGRAMS — Zone highlighting
// ═══════════════════════════════════════════════════════════════
function getLettersInZone(zone) {
  return LETTERS_ORDER.filter(l => ZONE_MAP[l] === zone);
}

function highlightZone(zone) {
  if (!zone) return;
  // Clear all zones in sagittal
  document.querySelectorAll('#sagittal-svg .zone').forEach(z => z.classList.remove('active'));
  document.querySelectorAll('#sagittal-svg .zone-label').forEach(l => l.classList.remove('active'));
  // Clear topdown
  document.querySelectorAll('#topdown-svg .zone').forEach(z => z.classList.remove('active'));

  // Sagittal zone mapping
  const sagMap = {
    'glottal': 'z-glottal', 'pharyngeal': 'z-pharyngeal', 'uvular': 'z-uvular',
    'velar': 'z-velar', 'palatal': 'z-palatal', 'alveolar': 'z-alveolar',
    'dental': 'z-dental', 'interdental': 'z-interdental', 'sibilant': 'z-sibilant',
    'labiodental': 'z-labiodental', 'lips': 'z-lips',
  };
  const tdMap = {
    'glottal': 'ztd-glottal', 'pharyngeal': 'ztd-pharyngeal', 'uvular': 'ztd-velar',
    'velar': 'ztd-velar', 'palatal': 'ztd-palatal', 'alveolar': 'ztd-alveolar',
    'dental': 'ztd-dental', 'interdental': 'ztd-dental', 'sibilant': 'ztd-dental',
    'labiodental': 'ztd-lips', 'lips': 'ztd-lips',
  };

  const sagEl = document.getElementById(sagMap[zone]);
  if (sagEl) sagEl.classList.add('active');
  const sagLabel = document.getElementById('zl-' + zone.replace('z-',''));
  if (sagLabel) sagLabel.classList.add('active');

  const tdEl = document.getElementById(tdMap[zone]);
  if (tdEl) tdEl.classList.add('active');

  // Show zone detail
  const letters = getLettersInZone(zone);
  const zd = document.getElementById('zone-detail');
  zd.style.display = 'block';
  document.getElementById('zd-title').textContent = ZONE_NAMES[zone] || zone;
  const zdLetters = document.getElementById('zd-letters');
  zdLetters.innerHTML = letters.map(l => {
    const d = ALPHABET[l];
    const hasAnim = ARTICULATION_ANIMS[l] ? ' ▶' : '';
    return `<div style="text-align:center; padding:8px 12px; background:var(--bg3); border-radius:var(--radius); border:1px solid var(--border); cursor:pointer;" onclick="selectLetter('${l}'); selectLetterMakhraj('${l}')">
      <div style="font-size:2.5em;">${l}</div>
      <div style="font-size:0.75em; color:var(--gold);">${d?.name || ''}${hasAnim}</div>
      <div style="font-size:0.65em; color:var(--text-dim);">${d?.transliteration || ''}</div>
    </div>`;
  }).join('');

  // Display letters in sagittal SVG
  document.getElementById('zone-letters-display').textContent = letters.join('  ');
}

// Wire up sagittal zone clicks
document.querySelectorAll('#sagittal-svg .zone').forEach(el => {
  el.addEventListener('click', () => {
    const zoneId = el.id.replace('z-', '');
    highlightZone(zoneId);
  });
});

// ═══════════════════════════════════════════════════════════════
// TOP-DOWN LETTER PLACEMENT
// ═══════════════════════════════════════════════════════════════
function placeTopDownLetters() {
  const g = document.getElementById('topdown-letters');
  g.innerHTML = '';

  // Position letters in rings based on zone
  const ringRadii = {
    'lips': 168, 'labiodental': 155,
    'interdental': 140, 'dental': 130, 'sibilant': 125,
    'alveolar': 108,
    'palatal': 88,
    'velar': 65, 'uvular': 55,
    'pharyngeal': 38,
    'glottal': 18,
  };

  // Group letters by zone
  const zoneGroups = {};
  LETTERS_ORDER.forEach(l => {
    const z = ZONE_MAP[l];
    if (!zoneGroups[z]) zoneGroups[z] = [];
    zoneGroups[z].push(l);
  });

  Object.entries(zoneGroups).forEach(([zone, letters]) => {
    const r = ringRadii[zone] || 100;
    const ry = r * 0.9;
    const angleStep = (Math.PI * 1.2) / Math.max(letters.length, 1);
    const startAngle = -Math.PI * 0.1;

    letters.forEach((letter, i) => {
      const angle = startAngle + i * angleStep;
      const x = 200 + r * Math.cos(angle);
      const y = 180 + ry * Math.sin(angle);

      const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
      text.setAttribute('x', x);
      text.setAttribute('y', y);
      text.setAttribute('text-anchor', 'middle');
      text.setAttribute('dominant-baseline', 'central');
      text.setAttribute('fill', '#ccc');
      text.setAttribute('font-size', '14');
      text.setAttribute('cursor', 'pointer');
      text.setAttribute('data-letter', letter);
      text.textContent = letter;
      text.addEventListener('click', () => selectLetter(letter));
      g.appendChild(text);
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// HARAKAT SECTION
// ═══════════════════════════════════════════════════════════════
function buildHarakat() {
  const grid = document.getElementById('harakat-grid');
  HARAKAT.forEach(h => {
    grid.innerHTML += `<div class="harakat-card">
      <div class="sample">${h.sample}</div>
      <div class="mark-name">${h.name}</div>
      <div class="mark-translit">${h.translit}</div>
      <div class="mark-desc">${h.desc}</div>
      <div style="margin-top:8px; font-size:0.75em; color:var(--accent);">Geometric: ${h.geometric}</div>
    </div>`;
  });

  const tGrid = document.getElementById('tanwin-grid');
  TANWIN.forEach(h => {
    tGrid.innerHTML += `<div class="harakat-card">
      <div class="sample">${h.sample}</div>
      <div class="mark-name">${h.name}</div>
      <div class="mark-translit">${h.translit}</div>
      <div class="mark-desc">${h.desc}</div>
      <div style="margin-top:8px; font-size:0.75em; color:var(--accent);">Geometric: ${h.geometric}</div>
    </div>`;
  });

  const eGrid = document.getElementById('extra-marks-grid');
  EXTRA_MARKS.forEach(h => {
    eGrid.innerHTML += `<div class="harakat-card">
      <div class="sample">${h.sample}</div>
      <div class="mark-name">${h.name}</div>
      <div class="mark-translit">${h.translit}</div>
      <div class="mark-desc">${h.desc}</div>
      <div style="margin-top:8px; font-size:0.75em; color:var(--accent);">Geometric: ${h.geometric}</div>
    </div>`;
  });
}

// ═══════════════════════════════════════════════════════════════
// DOT FAMILIES & GEOMETRY
// ═══════════════════════════════════════════════════════════════
function buildDotFamilies() {
  const container = document.getElementById('dot-families');
  DOT_FAMILIES.forEach(fam => {
    let membersHtml = fam.members.map(m => `
      <div class="family-member" onclick="selectLetter('${m.letter}')" style="cursor:pointer;">
        <div class="fm-letter">${m.letter}</div>
        <div class="fm-dots">${m.dots}</div>
      </div>
    `).join('');

    container.innerHTML += `<div class="family-card">
      <div class="base-shape">${fam.base}</div>
      <div class="family-members">${membersHtml}</div>
    </div>`;
  });
}

function buildGeoGrid() {
  const grid = document.getElementById('geo-grid');
  LETTERS_28.forEach(letter => {
    const data = ALPHABET[letter];
    if (!data) return;
    const val = data.abjad;
    const div7 = val % 7 === 0;
    grid.innerHTML += `<div class="geo-cell" onclick="selectLetter('${letter}')" style="cursor:pointer; ${div7 ? 'border-color:var(--green);' : ''}">
      <div class="geo-letter">${letter}</div>
      <div class="geo-abjad">${val}</div>
      ${div7 ? `<div class="geo-div7">${val} = 7 × ${val/7}</div>` : ''}
      <div class="geo-label">${data.name}</div>
    </div>`;
  });
}

// ═══════════════════════════════════════════════════════════════
// ABJAD TABLE
// ═══════════════════════════════════════════════════════════════
function buildAbjadTable() {
  const tbody = document.getElementById('abjad-tbody');
  let total = 0;

  // Abjad order (traditional): ا ب ج د ه و ز ح ط ي ك ل م ن س ع ف ص ق ر ش ت ث خ ذ ض ظ غ
  const abjadOrder = 'ابجدهوزحطيكلمنسعفصقرشتثخذضظغ'.split('');

  abjadOrder.forEach(letter => {
    const data = ALPHABET[letter];
    if (!data) return;
    const val = data.abjad;
    total += val;
    const div7 = val % 7 === 0;
    const cl = data.classification || {};

    tbody.innerHTML += `<tr onclick="selectLetter('${letter}')" style="cursor:pointer;">
      <td class="letter-col">${letter}</td>
      <td>${data.name}</td>
      <td class="latin">${data.transliteration}</td>
      <td class="value-col">${val}</td>
      <td style="color:${div7 ? 'var(--green)' : 'var(--text-dim)'};">${div7 ? val/7 : '—'}</td>
      <td style="font-size:0.75em;">${cl.group || ''}</td>
    </tr>`;
  });

  document.getElementById('abjad-total').textContent = total;
  const div7 = total % 7 === 0;
  document.getElementById('abjad-total-div7').textContent = div7
    ? `${total} ÷ 7 = ${total/7} (${total/7} = ${total/7/66 === 1 ? '66 × 1' : (total/7).toFixed(0)})`
    : `${total} ÷ 7 = ${(total/7).toFixed(2)}`;
}

// ═══════════════════════════════════════════════════════════════
// ROOT CALCULATOR
// ═══════════════════════════════════════════════════════════════
function computeRoot() {
  const inputs = [
    document.getElementById('root-1').value.trim(),
    document.getElementById('root-2').value.trim(),
    document.getElementById('root-3').value.trim(),
    document.getElementById('root-4').value.trim(),
  ].filter(Boolean);

  if (inputs.length < 2) {
    alert('Enter at least 2 root letters');
    return;
  }

  // Normalize
  const letters = inputs.map(c => HAMZA_MAP[c] || c);
  const positions = ['as_first_radical', 'as_second_radical', 'as_third_radical', 'as_third_radical'];
  const posNames = ['1st radical (فاء)', '2nd radical (عين)', '3rd radical (لام)', '4th radical'];

  let abjadSum = 0;
  let formulaParts = [];
  let semanticParts = [];
  let letterCards = '';
  let positionalHtml = '';

  letters.forEach((letter, i) => {
    const data = ALPHABET[letter];
    if (!data) return;

    const val = data.abjad;
    abjadSum += val;
    formulaParts.push(`${letter}(${val})`);

    const tendency = data.semantic_tendency || '';
    const core = tendency.split('.')[0].trim();
    semanticParts.push(core);

    const behaviour = data.behaviour || {};
    const posKey = positions[i] || positions[positions.length - 1];
    const posMeaning = behaviour[posKey] || '';

    letterCards += `<div class="calc-letter-card">
      <div class="clc-letter">${letter}</div>
      <div style="font-size:0.9em; color:var(--green); font-family:monospace;">${val}</div>
      <div class="clc-pos">${posNames[i]}</div>
      <div class="clc-tendency">${core}</div>
    </div>`;

    positionalHtml += `<div style="background:var(--bg3); padding:10px; border-radius:var(--radius); margin:5px 0; border:1px solid var(--border);">
      <strong style="color:var(--gold);">${letter} as ${posNames[i]}:</strong>
      <p style="font-size:0.85em; margin-top:4px;">${posMeaning}</p>
    </div>`;
  });

  // Show results
  const result = document.getElementById('calc-result');
  result.classList.add('visible');

  document.getElementById('cr-formula').textContent =
    formulaParts.join(' + ') + ` = ${abjadSum}` + (abjadSum % 7 === 0 ? ` (7 × ${abjadSum/7})` : '');

  document.getElementById('cr-letters').innerHTML = letterCards;

  document.getElementById('cr-semantic').innerHTML =
    `<div style="color:var(--gold); font-size:0.85em; margin-bottom:5px;">Semantic Derivation:</div>
     <div style="font-size:1.1em;">${semanticParts.join(' + ')}</div>
     <div style="margin-top:8px; font-size:0.85em; color:var(--text-dim);">
       Root: ${letters.join('-')} | Abjad: ${abjadSum}${abjadSum % 7 === 0 ? ' (divisible by 7)' : ''}
     </div>`;

  document.getElementById('cr-positional').innerHTML =
    `<h3 style="color:var(--gold); margin-bottom:10px;">Positional Behaviour in This Root:</h3>${positionalHtml}`;
}

// Enter key triggers compute
document.querySelectorAll('#calc-section input').forEach((input, i, all) => {
  input.addEventListener('keyup', e => {
    if (e.key === 'Enter') computeRoot();
    // Auto-advance to next input
    if (input.value.length === 1 && i < all.length - 1) {
      all[i + 1].focus();
      all[i + 1].style.opacity = '1';
    }
  });
});

// ═══════════════════════════════════════════════════════════════
// ARTICULATION ANIMATION ENGINE
// ═══════════════════════════════════════════════════════════════

let animTimer = null;
let animStep = 0;

// Animation data per letter — each has phases with SVG transforms
// Mouth parts: upper-lip, lower-lip, tongue, contact-point, airflow, burst, makhraj-zone
const ARTICULATION_ANIMS = {
  'ب': {
    name: 'بَاء — Bilabial Plosive',
    phases: [
      {
        title: '١ — Rest / Open',
        titleEn: 'Phase 1: Open Position',
        desc: 'Mouth is relaxed and open. Air flows freely through the vocal tract. The lips are apart.',
        duration: 1200,
        upperLip: 'M145,185 C150,178 155,175 160,178',
        lowerLip: 'M145,215 C150,222 155,225 160,222',
        tongue: 'M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190',
        contact: {cx: 152, cy: 200, r: 0, opacity: 0},
        airflow: 0.4,
        burst: 0,
        makhraj: {cx: 152, cy: 200, rx: 20, ry: 30, opacity: 0.15},
        phaseLabel: 'مَفْتُوح — Open',
      },
      {
        title: '٢ — Closure',
        titleEn: 'Phase 2: Lip Closure',
        desc: 'Both lips come together completely, forming an airtight seal. Air pressure builds behind the closure. The vocal cords vibrate (ب is voiced).',
        duration: 1000,
        upperLip: 'M145,197 C150,195 155,194 160,195',
        lowerLip: 'M145,203 C150,205 155,206 160,205',
        tongue: 'M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190',
        contact: {cx: 152, cy: 200, r: 10, opacity: 0.8},
        airflow: 0,
        burst: 0,
        makhraj: {cx: 152, cy: 200, rx: 18, ry: 15, opacity: 0.4},
        phaseLabel: 'إِغْلاق — Closure',
      },
      {
        title: '٣ — Pressure',
        titleEn: 'Phase 3: Pressure Build-Up',
        desc: 'Lips are sealed tight. Air pressure builds behind them — the oral cavity becomes a pressure chamber. The vocal cords continue to vibrate. This is the moment of containment before release.',
        duration: 800,
        upperLip: 'M145,198 C150,197 155,196 160,197',
        lowerLip: 'M145,202 C150,203 155,204 160,203',
        tongue: 'M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190',
        contact: {cx: 152, cy: 200, r: 14, opacity: 1},
        airflow: 0,
        burst: 0,
        makhraj: {cx: 152, cy: 200, rx: 22, ry: 18, opacity: 0.6},
        phaseLabel: 'ضَغْط — Pressure',
      },
      {
        title: '٤ — Release / Burst',
        titleEn: 'Phase 4: Plosive Release',
        desc: 'The lips open suddenly. The built-up air bursts outward — this is the plosive release, the characteristic sound of ب. The burst is voiced (vibration continues through release).',
        duration: 600,
        upperLip: 'M145,183 C150,176 155,173 160,176',
        lowerLip: 'M145,217 C150,224 155,227 160,224',
        tongue: 'M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190',
        contact: {cx: 152, cy: 200, r: 5, opacity: 0.3},
        airflow: 0,
        burst: 1,
        makhraj: {cx: 152, cy: 200, rx: 25, ry: 35, opacity: 0.3},
        phaseLabel: 'اِنْفِجَار — Burst',
      },
      {
        title: '٥ — Resolution',
        titleEn: 'Phase 5: Resolution',
        desc: 'Air continues to flow outward. The lips return to neutral. The sound of ب is complete — a voiced bilabial plosive. The two lips (الشَّفَتَان) = abjad 2 = duality = the first PAIR.',
        duration: 1000,
        upperLip: 'M145,185 C150,178 155,175 160,178',
        lowerLip: 'M145,215 C150,222 155,225 160,222',
        tongue: 'M170,250 C175,230 185,200 200,180 C215,165 235,155 260,160 C280,165 295,175 300,190',
        contact: {cx: 152, cy: 200, r: 0, opacity: 0},
        airflow: 0.5,
        burst: 0,
        makhraj: {cx: 152, cy: 200, rx: 20, ry: 30, opacity: 0.1},
        phaseLabel: 'تَمَام — Complete',
      },
    ],
  },
};

function resetAnimation() {
  if (animTimer) { clearTimeout(animTimer); animTimer = null; }
  animStep = 0;
  const letter = selectedLetter;
  const anim = ARTICULATION_ANIMS[letter];
  if (!anim) return;

  // Reset all SVG elements to initial state
  applyPhase(anim.phases[0], false);
  document.getElementById('anim-step-title').textContent = 'Ready — ' + anim.name;
  document.getElementById('anim-step-desc').textContent = 'Click Play to see how this letter is articulated step by step.';

  // Build step indicators
  const stepContainer = document.getElementById('anim-step-num');
  stepContainer.innerHTML = anim.phases.map((p, i) =>
    `<div class="anim-dot" id="anim-dot-${i}" style="width:12px;height:12px;border-radius:50%;background:var(--bg);border:2px solid var(--border);transition:all 0.3s;"></div>`
  ).join('');
}

// Parse SVG path numbers for interpolation
function parsePathNums(d) {
  return d.match(/-?\d+\.?\d*/g).map(Number);
}
function buildPath(template, nums) {
  let i = 0;
  return template.replace(/-?\d+\.?\d*/g, () => nums[i++].toFixed(1));
}
function lerp(a, b, t) { return a + (b - a) * t; }
function easeInOut(t) { return t < 0.5 ? 2*t*t : -1+(4-2*t)*t; }

let morphRAF = null;
let prevPhaseData = null; // store current numeric state for smooth morphing

function applyPhase(phase, animate) {
  if (morphRAF) { cancelAnimationFrame(morphRAF); morphRAF = null; }

  const ul = document.getElementById('anim-upper-lip');
  const ll = document.getElementById('anim-lower-lip');
  const tg = document.getElementById('anim-tongue');
  const ct = document.getElementById('anim-contact');
  const af = document.getElementById('anim-airflow');
  const br = document.getElementById('anim-burst');
  const mz = document.getElementById('anim-makhraj-zone');
  const pl = document.getElementById('anim-phase-label');

  const targetUL = parsePathNums(phase.upperLip);
  const targetLL = parsePathNums(phase.lowerLip);
  const targetTG = parsePathNums(phase.tongue);

  if (!animate || !prevPhaseData) {
    // Instant apply
    ul.setAttribute('d', phase.upperLip);
    ll.setAttribute('d', phase.lowerLip);
    tg.setAttribute('d', phase.tongue);
    ct.setAttribute('cx', phase.contact.cx);
    ct.setAttribute('cy', phase.contact.cy);
    ct.setAttribute('r', phase.contact.r);
    ct.style.opacity = phase.contact.opacity;
    af.style.opacity = phase.airflow;
    br.style.opacity = phase.burst;
    mz.setAttribute('cx', phase.makhraj.cx);
    mz.setAttribute('cy', phase.makhraj.cy);
    mz.setAttribute('rx', phase.makhraj.rx);
    mz.setAttribute('ry', phase.makhraj.ry);
    mz.style.opacity = phase.makhraj.opacity;
    pl.textContent = phase.phaseLabel;
    pl.style.opacity = animate ? 1 : 0;

    prevPhaseData = {
      ul: targetUL, ll: targetLL, tg: targetTG,
      ctCx: phase.contact.cx, ctCy: phase.contact.cy, ctR: phase.contact.r, ctO: phase.contact.opacity,
      afO: phase.airflow, brO: phase.burst,
      mzCx: phase.makhraj.cx, mzCy: phase.makhraj.cy, mzRx: phase.makhraj.rx, mzRy: phase.makhraj.ry, mzO: phase.makhraj.opacity,
    };
    return;
  }

  // Animated morph using requestAnimationFrame
  const startUL = prevPhaseData.ul.slice();
  const startLL = prevPhaseData.ll.slice();
  const startTG = prevPhaseData.tg.slice();
  const startCt = { cx: prevPhaseData.ctCx, cy: prevPhaseData.ctCy, r: prevPhaseData.ctR, o: prevPhaseData.ctO };
  const startAf = prevPhaseData.afO;
  const startBr = prevPhaseData.brO;
  const startMz = { cx: prevPhaseData.mzCx, cy: prevPhaseData.mzCy, rx: prevPhaseData.mzRx, ry: prevPhaseData.mzRy, o: prevPhaseData.mzO };

  const duration = 400; // ms
  const startTime = performance.now();

  pl.textContent = phase.phaseLabel;
  pl.style.opacity = 1;

  function frame(now) {
    const elapsed = now - startTime;
    const rawT = Math.min(elapsed / duration, 1);
    const t = easeInOut(rawT);

    // Interpolate paths
    const curUL = startUL.map((v, i) => lerp(v, targetUL[i], t));
    const curLL = startLL.map((v, i) => lerp(v, targetLL[i], t));
    const curTG = startTG.map((v, i) => lerp(v, targetTG[i], t));

    ul.setAttribute('d', buildPath(phase.upperLip, curUL));
    ll.setAttribute('d', buildPath(phase.lowerLip, curLL));
    tg.setAttribute('d', buildPath(phase.tongue, curTG));

    // Interpolate other properties
    ct.setAttribute('cx', lerp(startCt.cx, phase.contact.cx, t));
    ct.setAttribute('cy', lerp(startCt.cy, phase.contact.cy, t));
    ct.setAttribute('r', lerp(startCt.r, phase.contact.r, t));
    ct.style.opacity = lerp(startCt.o, phase.contact.opacity, t);

    af.style.opacity = lerp(startAf, phase.airflow, t);
    br.style.opacity = lerp(startBr, phase.burst, t);

    mz.setAttribute('cx', lerp(startMz.cx, phase.makhraj.cx, t));
    mz.setAttribute('cy', lerp(startMz.cy, phase.makhraj.cy, t));
    mz.setAttribute('rx', lerp(startMz.rx, phase.makhraj.rx, t));
    mz.setAttribute('ry', lerp(startMz.ry, phase.makhraj.ry, t));
    mz.style.opacity = lerp(startMz.o, phase.makhraj.opacity, t);

    if (rawT < 1) {
      morphRAF = requestAnimationFrame(frame);
    } else {
      morphRAF = null;
    }
  }

  morphRAF = requestAnimationFrame(frame);

  // Store target as new prevPhaseData
  prevPhaseData = {
    ul: targetUL, ll: targetLL, tg: targetTG,
    ctCx: phase.contact.cx, ctCy: phase.contact.cy, ctR: phase.contact.r, ctO: phase.contact.opacity,
    afO: phase.airflow, brO: phase.burst,
    mzCx: phase.makhraj.cx, mzCy: phase.makhraj.cy, mzRx: phase.makhraj.rx, mzRy: phase.makhraj.ry, mzO: phase.makhraj.opacity,
  };
}

function playArticulation() {
  const letter = selectedLetter;
  const anim = ARTICULATION_ANIMS[letter];
  if (!anim) return;

  // Reset
  if (animTimer) { clearTimeout(animTimer); animTimer = null; }
  animStep = 0;

  function runStep() {
    if (animStep >= anim.phases.length) {
      // Done
      document.getElementById('anim-step-title').textContent = 'تَمَام — Complete';
      document.getElementById('anim-step-desc').textContent = 'The full articulation of ' + anim.name + ' is complete. Click Replay to watch again.';
      return;
    }

    const phase = anim.phases[animStep];
    applyPhase(phase, true);

    // Play sound on the burst/release phase (phase 4, index 3)
    if (phase.phaseLabel && (phase.phaseLabel.includes('Burst') || phase.phaseLabel.includes('اِنْفِجَار'))) {
      playLetterSound(letter);
    }

    // Update description
    document.getElementById('anim-step-title').textContent = phase.title;
    document.getElementById('anim-step-desc').innerHTML =
      `<div style="color:var(--accent);font-size:0.8em;margin-bottom:5px;">${phase.titleEn}</div>${phase.desc}`;

    // Update step dots
    for (let i = 0; i < anim.phases.length; i++) {
      const dot = document.getElementById('anim-dot-' + i);
      if (dot) {
        if (i < animStep) dot.style.background = 'var(--gold-dim)';
        else if (i === animStep) { dot.style.background = 'var(--gold)'; dot.style.borderColor = 'var(--gold)'; dot.style.transform = 'scale(1.3)'; }
        else { dot.style.background = 'var(--bg)'; dot.style.borderColor = 'var(--border)'; dot.style.transform = 'scale(1)'; }
      }
    }

    animStep++;
    animTimer = setTimeout(runStep, phase.duration);
  }

  runStep();
}

// ═══════════════════════════════════════════════════════════════
// MAKHRAJ TAB ANIMATION (mirrors the Letters tab animation with ma- prefixed IDs)
// ═══════════════════════════════════════════════════════════════

let maAnimTimer = null;
let maAnimStep = 0;
let maPrevPhaseData = null;
let maMorphRAF = null;
let maSelectedLetter = null;

function applyPhaseMa(phase, animate) {
  if (maMorphRAF) { cancelAnimationFrame(maMorphRAF); maMorphRAF = null; }

  const ul = document.getElementById('ma-upper-lip');
  const ll = document.getElementById('ma-lower-lip');
  const tg = document.getElementById('ma-tongue');
  const ct = document.getElementById('ma-contact');
  const af = document.getElementById('ma-airflow');
  const br = document.getElementById('ma-burst');
  const mz = document.getElementById('ma-makhraj-zone');
  const pl = document.getElementById('ma-phase-label');

  const targetUL = parsePathNums(phase.upperLip);
  const targetLL = parsePathNums(phase.lowerLip);
  const targetTG = parsePathNums(phase.tongue);

  if (!animate || !maPrevPhaseData) {
    ul.setAttribute('d', phase.upperLip);
    ll.setAttribute('d', phase.lowerLip);
    tg.setAttribute('d', phase.tongue);
    ct.setAttribute('cx', phase.contact.cx); ct.setAttribute('cy', phase.contact.cy);
    ct.setAttribute('r', phase.contact.r); ct.style.opacity = phase.contact.opacity;
    af.style.opacity = phase.airflow; br.style.opacity = phase.burst;
    mz.setAttribute('cx', phase.makhraj.cx); mz.setAttribute('cy', phase.makhraj.cy);
    mz.setAttribute('rx', phase.makhraj.rx); mz.setAttribute('ry', phase.makhraj.ry);
    mz.style.opacity = phase.makhraj.opacity;
    pl.textContent = phase.phaseLabel; pl.style.opacity = animate ? 1 : 0;

    maPrevPhaseData = {
      ul: targetUL, ll: targetLL, tg: targetTG,
      ctCx: phase.contact.cx, ctCy: phase.contact.cy, ctR: phase.contact.r, ctO: phase.contact.opacity,
      afO: phase.airflow, brO: phase.burst,
      mzCx: phase.makhraj.cx, mzCy: phase.makhraj.cy, mzRx: phase.makhraj.rx, mzRy: phase.makhraj.ry, mzO: phase.makhraj.opacity,
    };
    return;
  }

  const startUL = maPrevPhaseData.ul.slice();
  const startLL = maPrevPhaseData.ll.slice();
  const startTG = maPrevPhaseData.tg.slice();
  const startCt = { cx: maPrevPhaseData.ctCx, cy: maPrevPhaseData.ctCy, r: maPrevPhaseData.ctR, o: maPrevPhaseData.ctO };
  const startAf = maPrevPhaseData.afO; const startBr = maPrevPhaseData.brO;
  const startMz = { cx: maPrevPhaseData.mzCx, cy: maPrevPhaseData.mzCy, rx: maPrevPhaseData.mzRx, ry: maPrevPhaseData.mzRy, o: maPrevPhaseData.mzO };

  const duration = 400; const startTime = performance.now();
  pl.textContent = phase.phaseLabel; pl.style.opacity = 1;

  function frame(now) {
    const elapsed = now - startTime;
    const rawT = Math.min(elapsed / duration, 1); const t = easeInOut(rawT);
    const curUL = startUL.map((v, i) => lerp(v, targetUL[i], t));
    const curLL = startLL.map((v, i) => lerp(v, targetLL[i], t));
    const curTG = startTG.map((v, i) => lerp(v, targetTG[i], t));
    ul.setAttribute('d', buildPath(phase.upperLip, curUL));
    ll.setAttribute('d', buildPath(phase.lowerLip, curLL));
    tg.setAttribute('d', buildPath(phase.tongue, curTG));
    ct.setAttribute('cx', lerp(startCt.cx, phase.contact.cx, t));
    ct.setAttribute('cy', lerp(startCt.cy, phase.contact.cy, t));
    ct.setAttribute('r', lerp(startCt.r, phase.contact.r, t));
    ct.style.opacity = lerp(startCt.o, phase.contact.opacity, t);
    af.style.opacity = lerp(startAf, phase.airflow, t);
    br.style.opacity = lerp(startBr, phase.burst, t);
    mz.setAttribute('cx', lerp(startMz.cx, phase.makhraj.cx, t));
    mz.setAttribute('cy', lerp(startMz.cy, phase.makhraj.cy, t));
    mz.setAttribute('rx', lerp(startMz.rx, phase.makhraj.rx, t));
    mz.setAttribute('ry', lerp(startMz.ry, phase.makhraj.ry, t));
    mz.style.opacity = lerp(startMz.o, phase.makhraj.opacity, t);
    if (rawT < 1) maMorphRAF = requestAnimationFrame(frame); else maMorphRAF = null;
  }
  maMorphRAF = requestAnimationFrame(frame);

  maPrevPhaseData = {
    ul: targetUL, ll: targetLL, tg: targetTG,
    ctCx: phase.contact.cx, ctCy: phase.contact.cy, ctR: phase.contact.r, ctO: phase.contact.opacity,
    afO: phase.airflow, brO: phase.burst,
    mzCx: phase.makhraj.cx, mzCy: phase.makhraj.cy, mzRx: phase.makhraj.rx, mzRy: phase.makhraj.ry, mzO: phase.makhraj.opacity,
  };
}

function selectLetterMakhraj(letter) {
  maSelectedLetter = letter;
  const anim = ARTICULATION_ANIMS[letter];
  const container = document.getElementById('makhraj-anim-container');
  if (anim) {
    container.style.display = 'block';
    if (maAnimTimer) { clearTimeout(maAnimTimer); maAnimTimer = null; }
    maAnimStep = 0; maPrevPhaseData = null;
    applyPhaseMa(anim.phases[0], false);
    document.getElementById('ma-step-title').textContent = 'Ready — ' + anim.name;
    document.getElementById('ma-step-desc').textContent = 'Click Play to see how this letter is articulated.';
    document.getElementById('ma-step-num').innerHTML = anim.phases.map((p, i) =>
      `<div id="ma-dot-${i}" style="width:12px;height:12px;border-radius:50%;background:var(--bg);border:2px solid var(--border);transition:all 0.3s;"></div>`
    ).join('');
  } else {
    container.style.display = 'none';
  }
}

function playArticulationMakhraj() {
  const letter = maSelectedLetter;
  const anim = ARTICULATION_ANIMS[letter];
  if (!anim) return;
  if (maAnimTimer) { clearTimeout(maAnimTimer); maAnimTimer = null; }
  maAnimStep = 0; maPrevPhaseData = null;

  function runStep() {
    if (maAnimStep >= anim.phases.length) {
      document.getElementById('ma-step-title').textContent = 'تَمَام — Complete';
      document.getElementById('ma-step-desc').textContent = 'The full articulation of ' + anim.name + ' is complete. Click Replay to watch again.';
      return;
    }
    const phase = anim.phases[maAnimStep];
    applyPhaseMa(phase, true);
    document.getElementById('ma-step-title').textContent = phase.title;
    document.getElementById('ma-step-desc').innerHTML =
      `<div style="color:var(--accent);font-size:0.8em;margin-bottom:5px;">${phase.titleEn}</div>${phase.desc}`;
    for (let i = 0; i < anim.phases.length; i++) {
      const dot = document.getElementById('ma-dot-' + i);
      if (dot) {
        if (i < maAnimStep) dot.style.background = 'var(--gold-dim)';
        else if (i === maAnimStep) { dot.style.background = 'var(--gold)'; dot.style.borderColor = 'var(--gold)'; dot.style.transform = 'scale(1.3)'; }
        else { dot.style.background = 'var(--bg)'; dot.style.borderColor = 'var(--border)'; dot.style.transform = 'scale(1)'; }
      }
    }
    maAnimStep++;
    maAnimTimer = setTimeout(runStep, phase.duration);
  }
  runStep();
}

// ═══════════════════════════════════════════════════════════════
// INIT
// ═══════════════════════════════════════════════════════════════
buildGrid();
placeTopDownLetters();
buildHarakat();
buildDotFamilies();
buildGeoGrid();
buildAbjadTable();

// Select first letter by default
selectLetter('ا');
</script>
</body>
</html>