File size: 53,362 Bytes
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
09402b5
 
 
 
 
8a1c980
09402b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a1c980
 
 
 
 
 
 
 
 
 
a416849
 
 
 
 
 
 
 
 
09402b5
 
 
 
 
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a416849
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921b721
 
 
 
 
 
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921b721
 
 
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a416849
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
a416849
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68b0f89
 
 
 
 
a416849
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a416849
68b0f89
 
 
 
 
 
 
 
 
 
a416849
 
 
68b0f89
 
 
 
 
 
 
 
 
a416849
 
 
 
68b0f89
 
 
 
 
 
 
 
 
 
df880f7
 
 
 
 
 
 
 
 
 
 
a416849
 
 
df880f7
 
 
09402b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68b0f89
 
 
a416849
68b0f89
 
 
 
 
921b721
 
 
 
a416849
921b721
 
 
 
09402b5
8a1c980
 
 
921b721
09402b5
 
 
68b0f89
a416849
68b0f89
a416849
68b0f89
 
 
 
a416849
 
 
 
 
68b0f89
 
a416849
 
68b0f89
a416849
68b0f89
 
a416849
 
68b0f89
a416849
68b0f89
 
a416849
 
68b0f89
a416849
68b0f89
 
 
 
c9eb6d8
 
09402b5
 
 
c9eb6d8
 
 
 
 
 
 
 
 
09402b5
 
 
 
 
c9eb6d8
 
68b0f89
 
a416849
68b0f89
 
 
 
 
c9eb6d8
 
68b0f89
 
 
a416849
68b0f89
c9eb6d8
 
 
09402b5
 
 
a416849
09402b5
 
 
 
a416849
09402b5
 
68b0f89
 
 
 
 
 
 
 
a416849
 
68b0f89
 
 
 
a416849
09402b5
68b0f89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921b721
 
 
 
 
 
a416849
921b721
 
 
 
 
a416849
921b721
 
 
 
 
 
68b0f89
 
 
a416849
df880f7
68b0f89
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Aegis-Graph | Sovereign Academic Audit Protocol | ACLAS College</title>
    <meta name="description" content="Aegis-Graph is the world's first sovereign academic audit network using Agentic GraphRAG and Multi-Agent Intelligence to verify institutional credentials. Developed by the Atlanta College of Liberal Arts and Sciences (ACLAS).">
    <meta name="keywords" content="Aegis-Graph, ACLAS College, Atlanta College of Liberal Arts and Sciences, Sovereign Academic Audit, Agentic GraphRAG, AI Fraud Detection, Academic Integrity Protocol, MCP Protocol">
    <meta name="author" content="Atlanta College of Liberal Arts and Sciences (ACLAS)">
    
    <!-- Geo / Local SEO -->
    <meta name="geo.region" content="US-GA">
    <meta name="geo.placename" content="Atlanta">
    
    <!-- OpenGraph / Social SEO -->
    <meta property="og:title" content="Aegis-Graph: Sovereign Academic Audit Protocol">
    <meta property="og:description" content="Securing global academic integrity through decentralized AI reasoning and institutional graph consensus.">
    <meta property="og:url" content="https://aclascollege.github.io/aegis-graph/">
    <meta property="og:site_name" content="Aegis-Graph Sovereign Network">
    <meta property="og:type" content="website">
    <link rel="icon" href="assets/favicon.ico">
    
    <!-- Structured Data for AEO (JSON-LD) -->
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "SoftwareApplication",
      "name": "Aegis-Graph",
      "operatingSystem": "Web, Python, Docker",
      "applicationCategory": "AcademicSecurityApplication",
      "description": "Decentralized protocol for sovereign academic auditing and credential verification using Multi-Agent Reasoning Swarms.",
      "author": {
        "@type": "EducationalOrganization",
        "name": "Atlanta College of Liberal Arts and Sciences",
        "alternateName": "ACLAS College",
        "url": "https://aclas.college/"
      },
      "publisher": {
        "@type": "EducationalOrganization",
        "name": "Atlanta College of Liberal Arts and Sciences"
      },
      "offers": {
        "@type": "Offer",
        "price": "0",
        "priceCurrency": "USD"
      }
    }
    </script>

    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --bg: #010204; 
            --card: rgba(13, 17, 23, 0.7); 
            --border: rgba(255, 255, 255, 0.08);
            --accent: #00ffaa; 
            --accent-glow: rgba(0, 255, 170, 0.2); 
            --text: #ffffff; 
            --dim: #8b949e;
            --glass: blur(12px) saturate(180%);
        }
        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
        body { 
            background: var(--bg); 
            color: var(--text); 
            font-family: 'Inter', sans-serif; 
            overflow: hidden; 
            height: 100vh; 
            display: flex; 
            flex-direction: column; 
            background-image: 
                radial-gradient(circle at 50% -20%, rgba(0, 255, 170, 0.05), transparent 50%),
                radial-gradient(circle at 0% 100%, rgba(0, 100, 255, 0.03), transparent 40%);
        }
        header { 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            padding: 18px 40px; 
            border-bottom: 1px solid var(--border); 
            backdrop-filter: var(--glass); 
            z-index: 1000;
        }
        .logo-group { display: flex; align-items: center; gap: 12px; }
        .logo-group img { height: 24px; }
        .logo-group h1 { font-family: 'Outfit'; font-size: 18px; letter-spacing: 3px; font-weight: 800; text-transform: uppercase; }
        
        .header-tools { display: flex; align-items: center; gap: 24px; }
        .header-icons { display: flex; gap: 20px; border-right: 1px solid var(--border); padding-right: 24px; }
        .icon-link { color: var(--text); opacity: 0.6; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
        .icon-link:hover { opacity: 1; color: var(--accent); transform: translateY(-3px); }

        .container { 
            display: grid; 
            grid-template-columns: 300px 1fr 340px; 
            gap: 20px; 
            padding: 24px; 
            flex: 1; 
            overflow: hidden; 
        }
        .bento { 
            background: var(--card); 
            border: 1px solid var(--border); 
            border-radius: 16px; 
            padding: 24px; 
            display: flex; 
            flex-direction: column; 
            overflow: hidden; 
            backdrop-filter: var(--glass);
            transition: 0.3s;
        }
        .bento:hover { border-color: rgba(0, 255, 170, 0.3); }
        
        .label { 
            font-size: 10px; 
            color: var(--dim); 
            text-transform: uppercase; 
            letter-spacing: 2px; 
            margin-bottom: 16px; 
            font-weight: 700; 
            display: flex; 
            align-items: center; 
            gap: 10px; 
        }
        .label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

        .agent-card { 
            background: rgba(255, 255, 255, 0.03); 
            border: 1px solid var(--border); 
            padding: 16px; 
            border-radius: 12px; 
            margin-bottom: 12px; 
            transition: 0.3s;
        }
        .agent-card:hover { background: rgba(255, 255, 255, 0.05); }
        
        .energy-bar { height: 3px; background: rgba(255, 255, 255, 0.05); margin-top: 10px; overflow: hidden; border-radius: 2px; }
        .energy-fill { height: 100%; background: var(--accent); width: 0%; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 10px var(--accent); }

        .drop-zone { 
            width: 100%; 
            height: 100%; 
            border: 2px dashed var(--border); 
            border-radius: 20px; 
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            justify-content: center; 
            cursor: pointer; 
            transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
            background: rgba(255, 255, 255, 0.01);
        }
        .drop-zone:hover { border-color: var(--accent); background: rgba(0, 255, 170, 0.03); transform: scale(0.99); }

        .sample-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin-top: 14px;
            width: 100%;
        }

        .sample-btn {
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.04);
            color: var(--text);
            border-radius: 8px;
            padding: 10px 8px;
            font-size: 10px;
            font-weight: 700;
            font-family: 'Outfit';
            letter-spacing: 0.5px;
            cursor: pointer;
            min-height: 44px;
        }

        .sample-btn span {
            display: block;
            color: var(--dim);
            font-size: 9px;
            font-family: 'Inter';
            font-weight: 600;
            letter-spacing: 0;
            margin-top: 3px;
        }

        .sample-btn span:first-child {
            color: inherit;
            font-size: 10px;
            font-family: 'Outfit';
            font-weight: 800;
            letter-spacing: 0.5px;
            margin-top: 0;
        }

        .sample-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
            background: rgba(0, 255, 170, 0.06);
        }
        
        .terminal { 
            background: rgba(0, 0, 0, 0.4); 
            border-radius: 12px; 
            padding: 20px; 
            font-family: 'JetBrains Mono', monospace; 
            font-size: 11px; 
            flex: 1; 
            overflow-y: auto; 
            line-height: 1.7; 
            color: var(--dim); 
            border: 1px solid var(--border); 
        }
        .terminal::-webkit-scrollbar { width: 4px; }
        .terminal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

        .btn-main { 
            background: var(--accent); 
            color: #000; 
            border: none; 
            padding: 14px 28px; 
            border-radius: 8px; 
            font-weight: 700; 
            font-size: 13px; 
            cursor: pointer; 
            font-family: 'Outfit';
            letter-spacing: 1px;
            transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .btn-main:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-glow); filter: brightness(1.1); }
        .btn-main:active { transform: translateY(0); }
        .btn-main:disabled { opacity: 0.65; cursor: wait; transform: none; }
        
        .meta-item { background: rgba(255, 255, 255, 0.02); padding: 14px; border-radius: 10px; border: 1px solid var(--border); }
        .meta-val { font-size: 14px; font-weight: 700; color: var(--accent); margin-top: 6px; font-family: 'JetBrains Mono'; }

        .custom-dropdown {
            position: relative;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            min-width: 130px;
            z-index: 2000;
        }
        .dropdown-selected {
            padding: 8px 16px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border);
            border-radius: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: 0.3s;
        }
        .dropdown-selected:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.2);
        }
        .dropdown-options {
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            background: #0d1117;
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            display: none;
            flex-direction: column;
            min-width: 100%;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            backdrop-filter: var(--glass);
        }
        .custom-dropdown.open .dropdown-options {
            display: flex;
            animation: dropdownFade 0.2s ease-out;
        }
        @keyframes dropdownFade {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .dropdown-option {
            padding: 10px 20px;
            transition: 0.3s;
            white-space: nowrap;
        }
        .dropdown-option:hover {
            background: var(--accent);
            color: #000;
        }

        .modal { 
            position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
            background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(20px);
            display: none; justify-content: center; align-items: center; z-index: 3000; 
        }
        .report { 
            background: #ffffff; color: #000; width: 540px; padding: 60px; 
            border-radius: 24px; box-shadow: 0 30px 60px rgba(0,0,0,0.5);
            animation: modalPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        .modal-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 12px;
        }
        @keyframes modalPop { from { transform: scale(0.9) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

        @media (max-width: 900px) {
            body {
                overflow-y: auto;
                height: auto;
                min-height: 100vh;
            }
            header {
                flex-wrap: wrap;
                gap: 14px;
                padding: 16px;
            }
            .logo-group h1 {
                font-size: 15px;
                letter-spacing: 1px;
            }
            .header-tools {
                width: 100%;
                justify-content: space-between;
                gap: 12px;
            }
            .header-icons {
                gap: 14px;
                padding-right: 12px;
            }
            .custom-dropdown {
                min-width: 112px;
            }
            .btn-main {
                padding: 12px 14px;
                font-size: 12px;
                white-space: nowrap;
            }
            .container {
                display: flex;
                flex-direction: column;
                padding: 16px;
                overflow: visible;
            }
            .bento {
                min-height: 220px;
            }
            .terminal {
                min-height: 220px;
            }
            .modal {
                padding: 16px;
            }
            .report {
                width: min(100%, 540px);
                padding: 32px 24px;
                border-radius: 16px;
            }
            .modal-actions {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <header>
        <div class="logo-group">
            <img src="assets/logo-new.png" alt="Logo">
            <h1>AEGIS-GRAPH <span style="font-size: 9px; color:var(--accent); opacity: 0.8;">SOVEREIGN_NODE v2.15</span></h1>
        </div>
        <div class="header-tools">
            <div class="header-icons">
                <a href="https://aclas.college" target="_blank" class="icon-link" title="Institution">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21h18M3 10h18M5 10V7a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v3M4 10v11M20 10v11M10 14v4M14 14v4"/></svg>
                </a>
                <a href="https://docs.aclas.college/aegis-graph" target="_blank" class="icon-link" title="GitBook Documentation">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20M4 19.5A2.5 2.5 0 0 0 6.5 22H20M4 19.5V3A2.5 2.5 0 0 1 6.5 0.5H20v16.5H6.5a2.5 2.5 0 0 0-2.5 2.5z"/></svg>
                </a>
                <a href="https://github.com/aclascollege/aegis-graph" target="_blank" class="icon-link" title="GitHub Repository">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/></svg>
                </a>
            </div>
            <div class="custom-dropdown" id="lang-dropdown">
                <div class="dropdown-selected" id="lang-current">English <span style="font-size: 8px;"></span></div>
                <div class="dropdown-options">
                    <div class="dropdown-option" data-value="en">English</div>
                    <div class="dropdown-option" data-value="cn">简体中文</div>
                    <div class="dropdown-option" data-value="es">Español</div>
                    <div class="dropdown-option" data-value="fr">Français</div>
                    <div class="dropdown-option" data-value="de">Deutsch</div>
                    <div class="dropdown-option" data-value="jp">日本語</div>
                    <div class="dropdown-option" data-value="kr">한국어</div>
                    <div class="dropdown-option" data-value="pt">Português</div>
                </div>
            </div>
            <button class="btn-main" id="audit-btn" data-i18n="btn_audit">START AUDIT</button>
        </div>
    </header>

    <div class="container">
        <div class="bento" style="grid-row: span 2;">
            <p class="label" data-i18n="label_agents">System Swarm</p>
            <div class="agent-card"><div style="display:flex; justify-content:space-between; font-size:12px; font-weight: 600;"><span data-i18n="agent_v">Vision Forensics</span><span id="v-status" style="color:var(--dim)">IDLE</span></div><div class="energy-bar"><div class="energy-fill" id="v-fill"></div></div></div>
            <div class="agent-card"><div style="display:flex; justify-content:space-between; font-size:12px; font-weight: 600;"><span data-i18n="agent_g">Graph Navigator</span><span id="g-status" style="color:var(--dim)">IDLE</span></div><div class="energy-bar"><div class="energy-fill" id="g-fill"></div></div></div>
            <div class="agent-card"><div style="display:flex; justify-content:space-between; font-size:12px; font-weight: 600;"><span data-i18n="agent_l">Logic Auditor</span><span id="l-status" style="color:var(--dim)">IDLE</span></div><div class="energy-bar"><div class="energy-fill" id="l-fill"></div></div></div>
            <div style="margin-top: auto; padding: 20px; background: rgba(0, 255, 170, 0.03); border-radius: 12px; border: 1px solid var(--border);">
                <p class="label" data-i18n="label_node_title" style="margin-bottom: 8px;">Active Node</p>
                <p style="font-size: 13px; font-weight: 800; color:var(--accent); font-family: 'Outfit';">AEGIS_SOV_7822</p>
                <p style="font-size: 11px; color:var(--dim); line-height: 1.5; margin-top: 4px;">Maintained by the <a href="https://aclas.college" style="color:var(--accent); text-decoration: underline;">Atlanta College of Liberal Arts and Sciences</a>. Global sovereign research partner.</p>
                <a href="https://github.com/aclascollege/aegis-graph" target="_blank" style="font-size: 10px; color: var(--accent); text-decoration: none; margin-top: 12px; display: inline-block; font-weight: 700; letter-spacing: 0.5px;">PROTOCOL SOURCE ↗</a>
            </div>
        </div>
        <div class="bento"><p class="label" data-i18n="label_hub">Evidence Processing</p><div class="center-hub" style="height: 100%;"><div class="drop-zone" id="drop-zone"><div style="font-size: 32px; color: var(--accent); margin-bottom: 12px;"></div><p style="font-size: 15px; font-weight: 700; font-family: 'Outfit'; letter-spacing: 1px;" data-i18n="drop_text">INGEST CREDENTIAL</p><p style="font-size: 10px; color: var(--dim); margin-top: 4px;" data-i18n="file_support">PDF, JPG, PNG SUPPORTED</p><p style="font-size: 9px; color: #ffcc66; margin-top: 8px; max-width: 260px; line-height: 1.4;" data-i18n="demo_disclaimer">DEMO MODE: local preview only. Final credential verification requires a server-signed audit.</p><input type="file" id="f-input" accept=".pdf,image/png,image/jpeg" style="display: none"></div><div class="sample-grid"><button class="sample-btn" data-sample="aclas_alumni_2025.png"><span data-i18n="sample_verified_main">VERIFIED</span><span data-i18n="sample_verified_sub">ACLAS</span></button><button class="sample-btn" data-sample="fake_degree_sample.png"><span data-i18n="sample_fraud_main">FRAUD</span><span data-i18n="sample_fraud_sub">Pacific Western</span></button><button class="sample-btn" data-sample="graham_university_transcript.pdf"><span data-i18n="sample_blacklist_main">BLACKLIST</span><span data-i18n="sample_blacklist_sub">Graham</span></button></div></div></div>
        <div class="bento" style="grid-row: span 2;"><p class="label" data-i18n="label_telemetry">Live Telemetry</p><div class="terminal" id="console"><div>[SYSTEM] Sovereign Node Active. Waiting for ingestion...</div></div></div>
        <div class="bento">
            <p class="label" data-i18n="label_metadata">Sovereign Analytics</p>
            <div class="meta-grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;">
                <div class="meta-item"><span class="label" style="margin-bottom:0; font-size: 8px;" data-i18n="meta_issuer">Issuer</span><div class="meta-val" id="m-issuer">--</div></div>
                <div class="meta-item"><span class="label" style="margin-bottom:0; font-size: 8px;" data-i18n="meta_status">Status</span><div class="meta-val" id="m-status">--</div></div>
            </div>
        </div>
    </div>
    <div class="modal" id="modal"><div class="report" id="rep-body"></div></div>

    <script>
        const i18n = {
            en: { btn_audit: "START AUDIT", label_agents: "System Agents", agent_v: "Vision Forensics", agent_g: "Graph Navigator", agent_l: "Logic Auditor", label_node_title: "Institutional Node", label_hub: "Evidence Processing", drop_text: "Ingest Credential", file_support: "PDF, JPG, PNG SUPPORTED", demo_disclaimer: "DEMO MODE: local preview only. Final credential verification requires a server-signed audit.", label_telemetry: "Live Telemetry", label_metadata: "Metadata Analytics", meta_issuer: "Issuer", meta_status: "Status", sample_verified_main: "VERIFIED", sample_verified_sub: "ACLAS", sample_fraud_main: "FRAUD", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "BLACKLIST", sample_blacklist_sub: "Graham", verdict_ok: "SERVER AUDIT REQUIRED", verdict_no: "AUDIT REJECTED" },
            cn: { btn_audit: "开始审计", label_agents: "系统代理", agent_v: "视觉法证", agent_g: "图谱导航", agent_l: "逻辑审计", label_node_title: "主权节点", label_hub: "证据处理中心", drop_text: "载入凭证", file_support: "支持 PDF、JPG、PNG", demo_disclaimer: "演示模式:仅本地预览。正式凭证验证需要服务端签名审计。", label_telemetry: "实时遥测", label_metadata: "元数据分析", meta_issuer: "签发机构", meta_status: "状态", sample_verified_main: "通过样本", sample_verified_sub: "ACLAS", sample_fraud_main: "欺诈样本", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "黑名单", sample_blacklist_sub: "Graham", verdict_ok: "需要服务端审计", verdict_no: "审计拒绝" },
            es: { btn_audit: "INICIAR AUDITORÍA", label_agents: "Agentes de Sistema", agent_v: "Forense Visual", agent_g: "Navegador de Grafos", agent_l: "Auditor Lógico", label_node_title: "Nodo Institucional", label_hub: "Procesamiento", drop_text: "Ingresar Credencial", file_support: "PDF, JPG, PNG SOPORTADOS", demo_disclaimer: "MODO DEMO: vista previa local. La verificación final requiere auditoría firmada por servidor.", label_telemetry: "Telemetría", label_metadata: "Metadatos", meta_issuer: "Emisor", meta_status: "Estado", sample_verified_main: "VÁLIDA", sample_verified_sub: "ACLAS", sample_fraud_main: "FRAUDE", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "LISTA NEGRA", sample_blacklist_sub: "Graham", verdict_ok: "AUDITORÍA REQUERIDA", verdict_no: "RECHAZADO" },
            fr: { btn_audit: "LANCER L'AUDIT", label_agents: "Agents Système", agent_v: "Forensique Visuelle", agent_g: "Navigateur", agent_l: "Auditeur Logique", label_node_title: "Nœud Institutionnel", label_hub: "Traitement", drop_text: "Ingérer", file_support: "PDF, JPG, PNG PRIS EN CHARGE", demo_disclaimer: "MODE DÉMO: aperçu local. La vérification finale exige un audit signé serveur.", label_telemetry: "Télémétrie", label_metadata: "Métadonnées", meta_issuer: "Émetteur", meta_status: "Statut", sample_verified_main: "VÉRIFIÉ", sample_verified_sub: "ACLAS", sample_fraud_main: "FRAUDE", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "LISTE NOIRE", sample_blacklist_sub: "Graham", verdict_ok: "AUDIT REQUIS", verdict_no: "REJETÉ" },
            de: { btn_audit: "AUDIT STARTEN", label_agents: "System-Agenten", agent_v: "Visuelle Forensik", agent_g: "Graph-Navigator", agent_l: "Logik-Auditor", label_node_title: "Institutioneller Knoten", label_hub: "Verarbeitung", drop_text: "Nachweis Einreichen", file_support: "PDF, JPG, PNG UNTERSTÜTZT", demo_disclaimer: "DEMO-MODUS: lokale Vorschau. Finale Verifikation erfordert serverseitig signierten Audit.", label_telemetry: "Telemetrie", label_metadata: "Metadaten", meta_issuer: "Aussteller", meta_status: "Status", sample_verified_main: "VERIFIZIERT", sample_verified_sub: "ACLAS", sample_fraud_main: "BETRUG", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "BLACKLIST", sample_blacklist_sub: "Graham", verdict_ok: "SERVER-AUDIT ERFORDERLICH", verdict_no: "ABGELEHNT" },
            jp: { btn_audit: "監査開始", label_agents: "システムエージェント", agent_v: "視覚法医学", agent_g: "グラフナビ", agent_l: "ロジック監査", label_node_title: "機関ノード", label_hub: "証拠処理", drop_text: "資格情報を入れる", file_support: "PDF、JPG、PNG対応", demo_disclaimer: "デモモード: ローカルプレビューのみ。最終検証にはサーバー署名監査が必要です。", label_telemetry: "テレメトリ", label_metadata: "メタデータ", meta_issuer: "発行者", meta_status: "ステータス", sample_verified_main: "検証済み", sample_verified_sub: "ACLAS", sample_fraud_main: "不正", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "ブラックリスト", sample_blacklist_sub: "Graham", verdict_ok: "サーバー監査が必要", verdict_no: "拒否" },
            kr: { btn_audit: "감사 시작", label_agents: "시스템 에이전트", agent_v: "시각적 법의학", agent_g: "그래프 탐색", agent_l: "논리 감사", label_node_title: "기관 노드", label_hub: "증거 처리", drop_text: "자격 증명 제출", file_support: "PDF, JPG, PNG 지원", demo_disclaimer: "데모 모드: 로컬 미리보기 전용. 최종 검증에는 서버 서명 감사가 필요합니다.", label_telemetry: "원격 측정", label_metadata: "메타데이터", meta_issuer: "발행자", meta_status: "상태", sample_verified_main: "검증됨", sample_verified_sub: "ACLAS", sample_fraud_main: "사기", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "블랙리스트", sample_blacklist_sub: "Graham", verdict_ok: "서버 감사 필요", verdict_no: "거부" },
            pt: { btn_audit: "INICIAR AUDITORIA", label_agents: "Agentes de Sistema", agent_v: "Forense Visual", agent_g: "Navegador", agent_l: "Auditor Lógico", label_node_title: "Nó Institucional", label_hub: "Processamento", drop_text: "Inserir Credencial", file_support: "PDF, JPG, PNG SUPORTADOS", demo_disclaimer: "MODO DEMO: prévia local. A verificação final requer auditoria assinada pelo servidor.", label_telemetry: "Telemetria", label_metadata: "Metadados", meta_issuer: "Emissor", meta_status: "Estado", sample_verified_main: "VERIFICADO", sample_verified_sub: "ACLAS", sample_fraud_main: "FRAUDE", sample_fraud_sub: "Pacific Western", sample_blacklist_main: "LISTA NEGRA", sample_blacklist_sub: "Graham", verdict_ok: "AUDITORIA REQUERIDA", verdict_no: "REJEITADO" }
        };

        const extraText = {
            en: {
                auditing: "AUDITING...",
                idle: "IDLE",
                scanning: "SCANNING",
                resolving: "RESOLVING",
                done: "DONE",
                logicAuditing: "AUDITING",
                needsReview: "NEEDS REVIEW",
                demoVerified: "DEMO VERIFIED",
                runAnother: "RUN ANOTHER AUDIT",
                runFraud: "RUN FRAUD SAMPLE",
                runVerified: "RUN VERIFIED SAMPLE",
                uploadNote: "Demo intake only; no browser-side approval will be issued.",
                sampleNote: "Built-in demo fixture selected.",
                noFile: "SYSTEM: Select a PDF, PNG, or JPEG credential before starting the demo audit.",
                init: "INIT: Preparing local demo intake...",
                vision: "VISION: Demo animation only; document bytes are not authenticated in-browser...",
                graph: "GRAPH: Resolving institution evidence in local demo mode...",
                logic: "LOGIC: Applying demo policy rules...",
                unsupported: "Unsupported file type. Upload a PDF, PNG, or JPEG credential for a production server-side audit.",
                unknownReason: "This uploaded file is accepted by the demo intake, but this static browser page cannot read document contents or issue credential approval. Use the built-in samples to demonstrate verified and rejected outcomes, or connect a server-side audit API for real files.",
                rejectedReason: issuer => `${issuer} matches the public demo blacklist fixture. This is a browser-side demo result only; production rejection still requires a server-signed audit trail.`,
                verifiedReason: issuer => `${issuer} matches the built-in verified demo fixture. This browser-side status is only a UI demonstration, not a production credential approval.`
            },
            cn: {
                auditing: "审计中...",
                idle: "待命",
                scanning: "扫描中",
                resolving: "解析中",
                done: "完成",
                logicAuditing: "审计中",
                needsReview: "需要复核",
                demoVerified: "演示验证通过",
                runAnother: "继续测试",
                runFraud: "运行欺诈样本",
                runVerified: "运行通过样本",
                uploadNote: "仅演示载入;浏览器端不会签发审核结论。",
                sampleNote: "已选择内置演示样本。",
                noFile: "系统:请先选择 PDF、PNG 或 JPEG 凭证。",
                init: "初始化:准备本地演示审计...",
                vision: "视觉:浏览器演示不会认证文件字节...",
                graph: "图谱:正在本地演示模式解析机构证据...",
                logic: "逻辑:正在应用演示规则...",
                unsupported: "文件类型不支持。请上传 PDF、PNG 或 JPEG。",
                unknownReason: "该文件已进入演示流程,但静态网页无法读取文件内容或签发凭证结论。请使用内置样本演示通过/拒绝结果,或接入服务端审计 API 处理真实文件。",
                rejectedReason: issuer => `${issuer} 命中公开演示黑名单样本。该结果仅为浏览器端演示;正式拒绝仍需要服务端签名审计轨迹。`,
                verifiedReason: issuer => `${issuer} 命中内置通过样本。该状态仅为界面演示,不代表正式凭证批准。`
            },
            es: {
                auditing: "AUDITANDO...",
                idle: "INACTIVO",
                scanning: "ESCANEANDO",
                resolving: "RESOLVIENDO",
                done: "LISTO",
                logicAuditing: "AUDITANDO",
                needsReview: "REVISIÓN NECESARIA",
                demoVerified: "DEMO VERIFICADA",
                runAnother: "EJECUTAR OTRA AUDITORÍA",
                runFraud: "EJECUTAR MUESTRA FRAUDE",
                runVerified: "EJECUTAR MUESTRA VÁLIDA",
                uploadNote: "Solo entrada demo; no se emite aprobación en el navegador.",
                sampleNote: "Muestra demo integrada seleccionada.",
                noFile: "SISTEMA: Seleccione PDF, PNG o JPEG antes de iniciar.",
                init: "INIT: Preparando auditoría demo local...",
                vision: "VISIÓN: La demo no autentica bytes del documento en navegador...",
                graph: "GRAFO: Resolviendo evidencia institucional en modo demo...",
                logic: "LÓGICA: Aplicando reglas demo...",
                unsupported: "Tipo de archivo no compatible. Suba PDF, PNG o JPEG.",
                unknownReason: "El archivo fue aceptado por la demo, pero esta página estática no puede leer contenidos ni emitir aprobación. Use las muestras integradas o conecte una API de auditoría.",
                rejectedReason: issuer => `${issuer} coincide con la lista negra demo. Es solo un resultado de navegador; producción requiere auditoría firmada por servidor.`,
                verifiedReason: issuer => `${issuer} coincide con la muestra verificada demo. Es solo demostración de UI, no aprobación real.`
            },
            fr: {
                auditing: "AUDIT EN COURS...",
                idle: "INACTIF",
                scanning: "ANALYSE",
                resolving: "RÉSOLUTION",
                done: "TERMINÉ",
                logicAuditing: "AUDIT",
                needsReview: "REVUE REQUISE",
                demoVerified: "DÉMO VÉRIFIÉE",
                runAnother: "RELANCER UN AUDIT",
                runFraud: "LANCER ÉCHANTILLON FRAUDE",
                runVerified: "LANCER ÉCHANTILLON VALIDE",
                uploadNote: "Entrée de démonstration uniquement; aucune approbation navigateur.",
                sampleNote: "Échantillon démo intégré sélectionné.",
                noFile: "SYSTÈME: Sélectionnez un PDF, PNG ou JPEG avant l'audit.",
                init: "INIT: Préparation de l'audit démo local...",
                vision: "VISION: La démo n'authentifie pas les octets du document...",
                graph: "GRAPHE: Résolution des preuves institutionnelles en mode démo...",
                logic: "LOGIQUE: Application des règles de démonstration...",
                unsupported: "Type de fichier non pris en charge. Chargez un PDF, PNG ou JPEG.",
                unknownReason: "Le fichier est accepté par la démo, mais cette page statique ne peut pas lire le contenu ni approuver un diplôme. Utilisez les exemples intégrés ou connectez une API serveur.",
                rejectedReason: issuer => `${issuer} correspond à la liste noire de démonstration. Résultat navigateur uniquement; la production exige un audit signé serveur.`,
                verifiedReason: issuer => `${issuer} correspond à l'exemple vérifié intégré. C'est une démonstration UI, pas une approbation réelle.`
            },
            de: {
                auditing: "AUDIT LÄUFT...",
                idle: "BEREIT",
                scanning: "SCANNT",
                resolving: "PRÜFT",
                done: "FERTIG",
                logicAuditing: "AUDIT",
                needsReview: "PRÜFUNG NÖTIG",
                demoVerified: "DEMO VERIFIZIERT",
                runAnother: "WEITEREN AUDIT STARTEN",
                runFraud: "BETRUGSBEISPIEL",
                runVerified: "VERIFIZIERTES BEISPIEL",
                uploadNote: "Nur Demo-Eingabe; keine Browser-Freigabe.",
                sampleNote: "Integriertes Demo-Beispiel ausgewählt.",
                noFile: "SYSTEM: Bitte PDF, PNG oder JPEG auswählen.",
                init: "INIT: Lokalen Demo-Audit vorbereiten...",
                vision: "VISION: Browser-Demo authentifiziert keine Dokumentbytes...",
                graph: "GRAPH: Institutionelle Evidenz im Demo-Modus wird geprüft...",
                logic: "LOGIK: Demo-Regeln werden angewendet...",
                unsupported: "Nicht unterstützter Dateityp. PDF, PNG oder JPEG hochladen.",
                unknownReason: "Die Datei wurde angenommen, aber diese statische Seite kann Inhalte nicht lesen oder genehmigen. Nutzen Sie die Beispiele oder verbinden Sie eine Server-API.",
                rejectedReason: issuer => `${issuer} passt zum Demo-Blacklist-Beispiel. Nur Browser-Demo; Produktion braucht serverseitig signierten Audit.`,
                verifiedReason: issuer => `${issuer} passt zum verifizierten Demo-Beispiel. Das ist UI-Demo, keine echte Freigabe.`
            },
            jp: {
                auditing: "監査中...",
                idle: "待機",
                scanning: "解析中",
                resolving: "照合中",
                done: "完了",
                logicAuditing: "監査中",
                needsReview: "レビュー必要",
                demoVerified: "デモ検証済み",
                runAnother: "別の監査を実行",
                runFraud: "不正サンプル実行",
                runVerified: "検証サンプル実行",
                uploadNote: "デモ取込のみ。ブラウザでは承認しません。",
                sampleNote: "内蔵デモサンプルを選択しました。",
                noFile: "システム: PDF、PNG、JPEGを選択してください。",
                init: "INIT: ローカルデモ監査を準備中...",
                vision: "VISION: ブラウザデモでは文書バイトを認証しません...",
                graph: "GRAPH: デモモードで機関証拠を照合中...",
                logic: "LOGIC: デモルールを適用中...",
                unsupported: "非対応ファイルです。PDF、PNG、JPEGをアップロードしてください。",
                unknownReason: "ファイルはデモに受理されましたが、静的ページでは内容読取や承認はできません。内蔵サンプルを使うか、サーバーAPIを接続してください。",
                rejectedReason: issuer => `${issuer} はデモ用ブラックリストに一致しました。これはブラウザデモであり、本番拒否には署名済み監査が必要です。`,
                verifiedReason: issuer => `${issuer} は検証済みデモサンプルに一致しました。これはUIデモであり正式承認ではありません。`
            },
            kr: {
                auditing: "감사 중...",
                idle: "대기",
                scanning: "스캔 중",
                resolving: "확인 중",
                done: "완료",
                logicAuditing: "감사 중",
                needsReview: "검토 필요",
                demoVerified: "데모 검증됨",
                runAnother: "다른 감사 실행",
                runFraud: "사기 샘플 실행",
                runVerified: "검증 샘플 실행",
                uploadNote: "데모 입력 전용이며 브라우저 승인은 발급되지 않습니다.",
                sampleNote: "내장 데모 샘플이 선택되었습니다.",
                noFile: "시스템: PDF, PNG 또는 JPEG를 먼저 선택하세요.",
                init: "INIT: 로컬 데모 감사를 준비 중...",
                vision: "VISION: 브라우저 데모는 문서 바이트를 인증하지 않습니다...",
                graph: "GRAPH: 데모 모드에서 기관 증거를 확인 중...",
                logic: "LOGIC: 데모 정책 규칙 적용 중...",
                unsupported: "지원하지 않는 파일 형식입니다. PDF, PNG 또는 JPEG를 업로드하세요.",
                unknownReason: "파일은 데모 입력으로 허용되었지만 정적 페이지는 내용을 읽거나 승인할 수 없습니다. 내장 샘플을 사용하거나 서버 감사 API를 연결하세요.",
                rejectedReason: issuer => `${issuer} 이 데모 블랙리스트 샘플과 일치합니다. 브라우저 데모 결과이며 실제 거부에는 서버 서명 감사가 필요합니다.`,
                verifiedReason: issuer => `${issuer} 이 내장 검증 샘플과 일치합니다. UI 데모일 뿐 실제 승인이 아닙니다.`
            },
            pt: {
                auditing: "AUDITANDO...",
                idle: "OCIOSO",
                scanning: "ESCANEANDO",
                resolving: "RESOLVENDO",
                done: "CONCLUÍDO",
                logicAuditing: "AUDITANDO",
                needsReview: "REVISÃO NECESSÁRIA",
                demoVerified: "DEMO VERIFICADA",
                runAnother: "EXECUTAR OUTRA AUDITORIA",
                runFraud: "EXECUTAR AMOSTRA FRAUDE",
                runVerified: "EXECUTAR AMOSTRA VÁLIDA",
                uploadNote: "Entrada de demo; nenhuma aprovação no navegador.",
                sampleNote: "Amostra demo integrada selecionada.",
                noFile: "SISTEMA: selecione PDF, PNG ou JPEG antes de iniciar.",
                init: "INIT: Preparando auditoria demo local...",
                vision: "VISÃO: a demo não autentica bytes do documento no navegador...",
                graph: "GRAFO: resolvendo evidências institucionais em modo demo...",
                logic: "LÓGICA: aplicando regras de demo...",
                unsupported: "Tipo de arquivo não suportado. Envie PDF, PNG ou JPEG.",
                unknownReason: "O arquivo foi aceito pela demo, mas esta página estática não lê conteúdo nem emite aprovação. Use as amostras integradas ou conecte uma API de auditoria.",
                rejectedReason: issuer => `${issuer} corresponde à lista negra de demonstração. É apenas resultado no navegador; produção exige auditoria assinada pelo servidor.`,
                verifiedReason: issuer => `${issuer} corresponde à amostra verificada integrada. É demonstração de UI, não aprovação real.`
            }
        };

        const dropdown = document.getElementById('lang-dropdown');
        const langCurrent = document.getElementById('lang-current');
        let currentLang = 'en';
        const htmlLangMap = { en: 'en', cn: 'zh-CN', es: 'es', fr: 'fr', de: 'de', jp: 'ja', kr: 'ko', pt: 'pt' };

        dropdown.onclick = (e) => {
            dropdown.classList.toggle('open');
            e.stopPropagation();
        };

        // Close dropdown when clicking outside
        window.addEventListener('click', (e) => {
            if (!dropdown.contains(e.target)) {
                dropdown.classList.remove('open');
            }
        });

        document.querySelectorAll('.dropdown-option').forEach(opt => {
            opt.onclick = (e) => {
                currentLang = opt.getAttribute('data-value');
                document.documentElement.lang = htmlLangMap[currentLang] || 'en';
                langCurrent.replaceChildren();
                langCurrent.appendChild(document.createTextNode(`${opt.innerText} `));
                const arrow = document.createElement('span');
                arrow.style.fontSize = '8px';
                arrow.innerText = '▼';
                langCurrent.appendChild(arrow);
                document.querySelectorAll('[data-i18n]').forEach(el => {
                    const key = el.getAttribute('data-i18n');
                    if(i18n[currentLang][key]) el.innerText = i18n[currentLang][key];
                });
                if (!btn.disabled && document.getElementById('modal').style.display !== 'flex') {
                    resetRunState();
                }
                e.stopPropagation();
                dropdown.classList.remove('open');
            };
        });

        const btn = document.getElementById('audit-btn');
        const cons = document.getElementById('console');
        let file = null;

        function tx(key) {
            return (extraText[currentLang] && extraText[currentLang][key]) || extraText.en[key];
        }

        function log(msg) {
            const d = document.createElement('div');
            const prompt = document.createElement('span');
            prompt.style.color = 'var(--accent)';
            prompt.innerText = '> ';
            d.appendChild(prompt);
            d.appendChild(document.createTextNode(msg));
            cons.appendChild(d); cons.scrollTop = cons.scrollHeight;
        }

        function setAgent(id, label, width, color = 'var(--accent)') {
            const status = document.getElementById(`${id}-status`);
            const fill = document.getElementById(`${id}-fill`);
            status.innerText = label;
            status.style.color = color;
            fill.style.width = width;
        }

        function resetRunState() {
            btn.disabled = false;
            btn.innerText = i18n[currentLang].btn_audit;
            setAgent('v', tx('idle'), '0%', 'var(--dim)');
            setAgent('g', tx('idle'), '0%', 'var(--dim)');
            setAgent('l', tx('idle'), '0%', 'var(--dim)');
            document.getElementById('modal').style.display = 'none';
        }

        function showSelectedFile(name, noteText) {
            const dropZone = document.getElementById('drop-zone');
            dropZone.replaceChildren();

            const check = document.createElement('div');
            check.style.color = 'var(--accent)';
            check.innerText = '✓';
            dropZone.appendChild(check);

            const selectedName = document.createElement('p');
            selectedName.style.fontSize = '10px';
            selectedName.innerText = name;
            dropZone.appendChild(selectedName);

            const note = document.createElement('p');
            note.style.fontSize = '9px';
            note.style.color = '#ffcc66';
            note.style.marginTop = '8px';
            note.innerText = noteText;
            dropZone.appendChild(note);
        }

        document.getElementById('f-input').onchange = (e) => {
            if(e.target.files.length) {
                file = e.target.files[0];
                showSelectedFile(file.name, tx('uploadNote'));
                log(`INGESTED: ${file.name}`);
            }
        };
        document.getElementById('drop-zone').onclick = () => document.getElementById('f-input').click();

        function runSampleAudit(sampleName) {
            resetRunState();
            const mimeType = sampleName.endsWith('.pdf') ? 'application/pdf' : 'image/png';
            file = { name: sampleName, type: mimeType, demoSample: true };
            showSelectedFile(sampleName, tx('sampleNote'));
            log(`SAMPLE LOADED: ${sampleName}`);
            setTimeout(() => btn.click(), 80);
        }

        document.querySelectorAll('.sample-btn').forEach(sampleBtn => {
            sampleBtn.onclick = (e) => {
                e.stopPropagation();
                if (btn.disabled) return;
                runSampleAudit(sampleBtn.getAttribute('data-sample'));
            };
        });

        btn.onclick = async () => {
            if (document.getElementById('modal').style.display === 'flex') return;
            if(!file) {
                log(tx('noFile'));
                document.getElementById('drop-zone').style.borderColor = '#ffcc66';
                return;
            }
            btn.disabled = true;
            btn.innerText = tx('auditing');
            setAgent('v', tx('idle'), '0%', 'var(--dim)');
            setAgent('g', tx('idle'), '0%', 'var(--dim)');
            setAgent('l', tx('idle'), '0%', 'var(--dim)');
            log(tx('init'));
            
            // Vision Agent
            setAgent('v', tx('scanning'), '100%');
            log(tx('vision'));
            await new Promise(r => setTimeout(r, 800));
            setAgent('v', tx('done'), '100%');
            
            // Graph Agent
            setAgent('g', tx('resolving'), '100%');
            log(tx('graph'));
            await new Promise(r => setTimeout(r, 1500)); // Simulating a deeper search
            setAgent('g', tx('done'), '100%');
            
            // Logic Agent
            setAgent('l', tx('logicAuditing'), '100%');
            log(tx('logic'));
            await new Promise(r => setTimeout(r, 800));
            setAgent('l', tx('done'), '100%');
            
            await finish();
        };

        function inferDemoOutcome(uploadedFile) {
            const name = uploadedFile.name.toLowerCase();
            const demoApprovals = [
                { pattern: 'aclas', issuer: 'Atlanta College of Liberal Arts and Sciences' }
            ];
            const demoBlacklist = [
                { pattern: 'graham', issuer: 'Graham International University' },
                { pattern: 'giu', issuer: 'Graham International University' },
                { pattern: 'pacific', issuer: 'Pacific Western University' },
                { pattern: 'fake', issuer: 'Pacific Western University' },
                { pattern: 'fraud', issuer: 'Pacific Western University' },
                { pattern: 'belford', issuer: 'Belford University' },
                { pattern: 'almeda', issuer: 'Almeda University' }
            ];
            const rejected = demoBlacklist.find(item => name.includes(item.pattern));
            if (rejected) return { ...rejected, verdict: 'REJECTED' };
            const approved = demoApprovals.find(item => name.includes(item.pattern));
            if (approved) return { ...approved, verdict: 'APPROVED' };
            return null;
        }

        async function finish() {
            let verdict = 'NEEDS_REVIEW';
            let reason = tx('unknownReason');
            let status_code = 'DEMO_ONLY';
            let issuer = 'UNVERIFIED';
            let ror_id = '--';

            const allowedTypes = ['application/pdf', 'image/png', 'image/jpeg'];
            const allowedExtensions = ['.pdf', '.png', '.jpg', '.jpeg'];
            const fileTypeKnown = allowedTypes.includes(file.type) || allowedExtensions.some(ext => file.name.toLowerCase().endsWith(ext));
            if (!fileTypeKnown) {
                verdict = 'REJECTED';
                status_code = 'UNSUPPORTED_TYPE';
                reason = tx('unsupported');
                log('SYSTEM: REJECTED - Unsupported file type for audit intake.');
            } else if (inferDemoOutcome(file)) {
                const fixture = inferDemoOutcome(file);
                issuer = fixture.issuer;
                if (fixture.verdict === 'REJECTED') {
                    verdict = 'REJECTED';
                    status_code = 'DEMO_BLACKLIST_MATCH';
                    reason = tx('rejectedReason')(fixture.issuer);
                    log(`SYSTEM: DEMO REJECTED - ${fixture.issuer} matched the local demo blacklist fixture.`);
                } else {
                    verdict = 'APPROVED';
                    status_code = 'DEMO_VERIFIED';
                    reason = tx('verifiedReason')(fixture.issuer);
                    log(`SYSTEM: DEMO VERIFIED - ${fixture.issuer} matched the local verified fixture.`);
                }
            } else {
                log('SYSTEM: DEMO ONLY - File content was not sent to a trusted audit service.');
                log('SYSTEM: NEEDS REVIEW - No browser-side approval is issued.');
            }

            const modal = document.getElementById('modal');
            modal.style.display = 'flex';
            const t = i18n[currentLang];
            btn.disabled = false;
            btn.innerText = i18n[currentLang].btn_audit;
            
            document.getElementById('m-issuer').innerText = issuer;
            document.getElementById('m-status').innerText = status_code;
            
            const verdictTitle = verdict === 'REJECTED' ? t.verdict_no : (verdict === 'APPROVED' ? tx('demoVerified') : tx('needsReview'));
            const verdictColor = verdict === 'REJECTED' ? '#ff3366' : (verdict === 'APPROVED' ? '#00ffaa' : '#ffcc66');

            const report = document.getElementById('rep-body');
            report.replaceChildren();

            const title = document.createElement('h2');
            title.style.color = verdictColor;
            title.innerText = verdictTitle;
            report.appendChild(title);

            const summary = document.createElement('p');
            summary.style.margin = '20px 0';
            summary.style.lineHeight = '1.6';
            summary.innerText = reason;
            report.appendChild(summary);

            const details = document.createElement('div');
            details.style.borderTop = '1px solid #eee';
            details.style.paddingTop = '15px';
            details.style.fontSize = '11px';
            details.style.color = '#666';
            details.style.marginBottom = '20px';
            details.innerText = `ROR ID: ${ror_id}\nAudit Trace: LOCAL-DEMO-NOT-SIGNED`;
            report.appendChild(details);

            if (verdict === 'NEEDS_REVIEW') {
                const sampleActions = document.createElement('div');
                sampleActions.className = 'modal-actions';

                const fraudSample = document.createElement('button');
                fraudSample.className = 'btn-main';
                fraudSample.innerText = tx('runFraud');
                fraudSample.onclick = () => runSampleAudit('fake_degree_sample.png');
                sampleActions.appendChild(fraudSample);

                const verifiedSample = document.createElement('button');
                verifiedSample.className = 'btn-main';
                verifiedSample.innerText = tx('runVerified');
                verifiedSample.onclick = () => runSampleAudit('aclas_alumni_2025.png');
                sampleActions.appendChild(verifiedSample);

                report.appendChild(sampleActions);
            }

            const done = document.createElement('button');
            done.className = 'btn-main';
            done.style.width = '100%';
            done.innerText = tx('runAnother');
            done.onclick = resetRunState;
            report.appendChild(done);
        }
    </script>
</body>
</html>