-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard-index.html
More file actions
2595 lines (2428 loc) · 138 KB
/
Copy pathdashboard-index.html
File metadata and controls
2595 lines (2428 loc) · 138 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CORTEX — Split Brain</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0a0a0a; color: #ccc; font-family: 'Segoe UI', Arial, sans-serif; height: 100vh; display: flex; }
/* LEFT: Chat */
.chat-col { flex: 1; display: flex; flex-direction: column; border-right: 1px solid #1a1a1a; }
.chat-header { text-align: center; padding: 0.4rem 0; border-bottom: 1px solid #1a1a1a; }
.brand { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.15em; display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.brand .w { color: #fff; } .brand .g { color: #daa520; }
.hemi-link { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; cursor: pointer; padding: 0.15rem 0.5rem; border-radius: 4px; border: 1px solid transparent; transition: all 0.2s; text-transform: uppercase; }
.hemi-link.left { color: #4a8; }
.hemi-link.left:hover, .hemi-link.left.active { background: #1a2a1a; border-color: #4a8; color: #6fc; }
.hemi-link.right { color: #c44; }
.hemi-link.right:hover, .hemi-link.right.active { background: #2a1a1a; border-color: #c44; color: #f66; }
.hemi-link.cortex { color: #ccc; }
.hemi-link.cortex:hover, .hemi-link.cortex.active { background: #1a1a1a; border-color: #fff; color: #fff; }
.chat-mode-label { font-size: 0.5rem; color: #444; display: block; text-align: center; margin-top: 0.15rem; letter-spacing: 0.15em; }
.chat-area { flex: 1; overflow-y: auto; padding: 0.6rem; }
.msg { margin-bottom: 0.5rem; display: flex; gap: 0.4rem; align-items: flex-start; animation: fadeIn 0.2s; }
.msg.user { flex-direction: row-reverse; }
.avatar { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; }
.msg.user .avatar { background: #1a3a1a; color: #6a6; }
.msg.bot .avatar { background: #2a1a0a; color: #daa520; }
.bubble { max-width: 80%; padding: 0.4rem 0.7rem; border-radius: 10px; font-size: 0.82rem; line-height: 1.4; }
.msg.user .bubble { background: #1a2a1a; color: #bdb; border-bottom-right-radius: 3px; }
.msg.user.question .bubble { background: #0a1a2a; color: #7cf; }
.msg.user.command .bubble { background: #2a1a0a; color: #fc6; }
.msg.user.statement .bubble { background: #1a2a1a; color: #bdb; }
.intent-tag { font-size: 0.5rem; padding: 1px 4px; border-radius: 3px; margin-right: 4px; font-weight: 600; vertical-align: middle; display: inline-block; margin-bottom: 1px; }
.intent-tag.question { background: #0a2a3a; color: #4cf; }
.intent-tag.command { background: #3a2a0a; color: #fa0; }
.intent-tag.statement { background: #1a2a1a; color: #5a5; }
/* Hemisphere colours */
.w-left { color: #4a8; font-weight: 600; }
.w-right { color: #c44; font-weight: 600; }
.w-cortex { color: #fff; font-weight: 600; }
/* POS colours (for "both" hemisphere words) */
.w-noun { color: #d4a06a; font-weight: 600; }
.w-verb { color: #7eb8c9; font-weight: 600; }
.w-adj { color: #c49bd4; font-weight: 600; }
.w-adv { color: #8fb89a; font-weight: 600; }
.w-both { color: #a0a0a0; font-weight: 600; }
/* POS underline indicators */
.w-pos-noun { border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.w-pos-verb { border-bottom: 1px dashed currentColor; padding-bottom: 1px; }
.w-pos-adj { border-bottom: 1px dotted currentColor; padding-bottom: 1px; }
/* Misspelling glow */
@keyframes misspellGlow {
0%, 100% { text-shadow: 0 0 4px rgba(255,255,255,0.3); }
50% { text-shadow: 0 0 8px rgba(255,255,255,0.8), 0 0 16px rgba(255,255,255,0.3); }
}
.w-unknown { color: #fff; font-style: italic; animation: misspellGlow 2s ease-in-out infinite; }
/* Self-modification quality badge */
.quality-badge { display: inline-block; font-size: 9px; padding: 1px 5px; border-radius: 8px; margin-left: 6px; opacity: 0.7; font-family: monospace; vertical-align: middle; }
.q-good { background: #1a3a1a; color: #6d6; border: 1px solid #2a4a2a; }
.q-mid { background: #3a3a1a; color: #cc6; border: 1px solid #4a4a2a; }
.q-bad { background: #3a1a1a; color: #f66; border: 1px solid #4a2a2a; }
.stage-badge { display: inline-block; font-size: 9px; padding: 1px 5px; border-radius: 8px; margin-left: 4px; opacity: 0.6; font-family: monospace; vertical-align: middle; background: #1a1a2a; color: #88f; border: 1px solid #2a2a4a; cursor: help; }
.wrong-btn { display: inline-block; font-size: 8px; padding: 1px 5px; border-radius: 8px; margin-left: 6px; font-family: monospace; vertical-align: middle; background: #2a1a1a; color: #a44; border: 1px solid #3a2020; cursor: pointer; opacity: 0.5; transition: all 0.2s; }
.wrong-btn:hover { opacity: 1; background: #3a1a1a; color: #f66; border-color: #f44; }
.correction-form { margin-top: 6px; padding: 6px 8px; background: #1a1010; border: 1px solid #3a2020; border-radius: 6px; animation: fadeIn 0.2s; }
.correction-form textarea { width: 100%; background: #111; border: 1px solid #333; color: #ddd; font-size: 0.75rem; padding: 4px 6px; border-radius: 4px; resize: vertical; min-height: 40px; font-family: inherit; }
.correction-form textarea:focus { outline: none; border-color: #f66; }
.correction-form .cf-actions { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.correction-form .cf-submit { font-size: 0.65rem; padding: 2px 10px; background: #3a1a1a; color: #f66; border: 1px solid #f44; border-radius: 4px; cursor: pointer; font-weight: 700; }
.correction-form .cf-submit:hover { background: #f44; color: #fff; }
.correction-form .cf-cancel { font-size: 0.65rem; padding: 2px 8px; background: none; color: #666; border: 1px solid #333; border-radius: 4px; cursor: pointer; }
.correction-form .cf-cancel:hover { color: #aaa; border-color: #666; }
.correction-sent { font-size: 0.65rem; color: #f66; margin-top: 4px; animation: fadeIn 0.2s; }
.gaps-link { display: block; text-align: center; font-size: 0.5rem; color: #555; letter-spacing: 0.15em; cursor: pointer; margin-top: 2px; transition: color 0.2s; }
.gaps-link:hover { color: #daa520; }
.gaps-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 999; overflow-y: auto; padding: 2rem; }
.gaps-overlay.show { display: block; }
.gaps-panel { max-width: 800px; margin: 0 auto; background: #111; border: 1px solid #2a2a2a; border-radius: 8px; padding: 1.2rem; }
.gaps-panel h2 { font-size: 1rem; color: #daa520; margin-bottom: 0.8rem; display: flex; align-items: center; justify-content: space-between; }
.gaps-panel h2 .close-btn { cursor: pointer; color: #666; font-size: 1.2rem; }
.gaps-panel h2 .close-btn:hover { color: #fff; }
.gaps-brain { margin-bottom: 1rem; }
.gaps-brain h3 { font-size: 0.75rem; color: #888; margin-bottom: 0.4rem; letter-spacing: 0.1em; }
.gaps-brain h3.left { color: #4a8; } .gaps-brain h3.right { color: #c44; } .gaps-brain h3.cortex { color: #fff; }
.gap-word { display: inline-block; padding: 2px 7px; margin: 2px; border-radius: 4px; font-size: 0.7rem; font-family: monospace; cursor: default; }
.gap-word.high { background: #3a1a1a; color: #f88; border: 1px solid #4a2a2a; }
.gap-word.med { background: #3a3a1a; color: #cc6; border: 1px solid #4a4a2a; }
.gap-word.low { background: #1a1a2a; color: #88c; border: 1px solid #2a2a3a; }
.gaps-summary { font-size: 0.7rem; color: #666; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #1a1a1a; }
.msg.bot .bubble { background: #1a1510; color: #ddd; border: 1px solid #2a2010; border-bottom-left-radius: 3px; }
.hemisphere-tag { font-size: 0.5rem; padding: 1px 4px; border-radius: 3px; margin-left: 4px; font-weight: 600; vertical-align: middle; }
.hemisphere-tag.left_only, .hemisphere-tag.agreement, .hemisphere-tag.left { background: #1a2a1a; color: #4a8; }
.hemisphere-tag.right_only, .hemisphere-tag.right { background: #2a1a1a; color: #a44; }
.hemisphere-tag.debate { background: #2a2a0a; color: #da4; }
.thinking { color: #555; font-size: 0.7rem; padding: 0.2rem; text-align: center; display: none; }
.thinking.show { display: block; }
.dots span { animation: blink 1.4s infinite; opacity: 0.2; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0.2} 40%{opacity:1} }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
/* === THINKING TICKER === */
.ticker-container { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; margin-top: 4px; }
.ticker-container.open { max-height: 500px; overflow-y: auto; }
.ticker-step { display: flex; align-items: flex-start; gap: 0.4rem; padding: 2px 0; opacity: 0; transform: translateY(3px); animation: tickerIn 0.3s forwards; border-left: 2px solid #222; padding-left: 8px; margin-left: 2px; }
@keyframes tickerIn { to { opacity: 1; transform: translateY(0); } }
.ticker-label { font-size: 0.5rem; font-weight: 700; letter-spacing: 0.06em; min-width: 90px; flex-shrink: 0; font-family: 'Consolas','Courier New',monospace; }
.ticker-text { font-size: 0.6rem; color: #777; font-family: 'Consolas','Courier New',monospace; line-height: 1.3; word-break: break-word; }
.ticker-step.stage-detect { border-left-color: #daa520; } .ticker-step.stage-detect .ticker-label { color: #daa520; }
.ticker-step.stage-equation { border-left-color: #daa520; } .ticker-step.stage-equation .ticker-label { color: #daa520; }
.ticker-step.stage-left { border-left-color: #4a8; } .ticker-step.stage-left .ticker-label { color: #4a8; }
.ticker-step.stage-right { border-left-color: #c44; } .ticker-step.stage-right .ticker-label { color: #c44; }
.ticker-step.stage-weights { border-left-color: #888; } .ticker-step.stage-weights .ticker-label { color: #888; }
.ticker-step.stage-agreement { border-left-color: #aaf; } .ticker-step.stage-agreement .ticker-label { color: #aaf; }
.ticker-step.stage-dictionary { border-left-color: #ccc; } .ticker-step.stage-dictionary .ticker-label { color: #ccc; }
.ticker-step.stage-synthesis { border-left-color: #fff; } .ticker-step.stage-synthesis .ticker-label { color: #fff; }
.ticker-step.stage-quality { border-left-color: #8a8; } .ticker-step.stage-quality .ticker-label { color: #8a8; }
.ticker-step.stage-learning { border-left-color: #f80; } .ticker-step.stage-learning .ticker-label { color: #f80; }
.ticker-step.stage-identity { border-left-color: #fff; } .ticker-step.stage-identity .ticker-label { color: #fff; }
.ticker-step.stage-source { border-left-color: #5af; } .ticker-step.stage-source .ticker-label { color: #5af; }
.ticker-step.stage-gauntlet { border-left-color: #f00; } .ticker-step.stage-gauntlet .ticker-label { color: #f00; }
/* Equation library rank badges */
.eq-locked { opacity: 0.4; }
.eq-locked:hover { opacity: 0.6; }
.rank-badge { display: inline-block; font-size: 0.45rem; padding: 1px 4px; border-radius: 3px; font-weight: 700; letter-spacing: 0.05em; font-family: monospace; }
.rank-badge.locked { background: #2a1a1a; color: #a44; border: 1px solid #3a2020; }
.rank-badge.unlocked { background: #1a2a1a; color: #5a5; border: 1px solid #2a3a2a; }
.eq-formula { font-size: 0.5rem; color: #888; font-family: 'Consolas','Courier New',monospace; margin-top: 2px; word-break: break-word; }
.eq-jobs { font-size: 0.45rem; color: #daa520; font-family: monospace; }
/* Request form */
.req-form { padding: 6px 8px; background: #0a0a1a; border: 1px solid #1a1a3a; border-radius: 6px; margin-top: 6px; }
.req-form input, .req-form textarea { width: 100%; background: #111; border: 1px solid #333; color: #ddd; font-size: 0.6rem; padding: 3px 6px; border-radius: 3px; margin-bottom: 4px; font-family: inherit; }
.req-form textarea { resize: vertical; min-height: 30px; }
.req-form input:focus, .req-form textarea:focus { outline: none; border-color: #5af; }
.req-item { padding: 4px 6px; background: #0a0a0a; border: 1px solid #1a1a1a; border-radius: 4px; margin-bottom: 3px; }
.req-vote-btn { font-size: 0.5rem; padding: 1px 6px; background: #1a1a2a; color: #5af; border: 1px solid #2a2a4a; border-radius: 3px; cursor: pointer; font-family: monospace; }
.req-vote-btn:hover { background: #2a2a4a; color: #8cf; }
/* === EQUATION FORGE === */
.eq-forge-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.92); z-index:1000; overflow-y:auto; padding:1.5rem; }
.eq-forge-overlay.show { display:flex; align-items:flex-start; justify-content:center; }
.eq-forge-panel { width:100%; max-width:720px; background:#111; border:1px solid #2a2a2a; border-radius:10px; padding:1rem 1.2rem; margin-top:2rem; }
.forge-title { font-size:0.85rem; font-weight:700; color:#daa520; letter-spacing:0.12em; text-align:center; margin-bottom:0.6rem; }
.forge-close { float:right; cursor:pointer; color:#555; font-size:1.2rem; line-height:1; }
.forge-close:hover { color:#fff; }
/* Live chain */
.eq-chain { display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:center; padding:10px 8px; background:#0a0a0a; border:1px solid #1a1a1a; border-radius:6px; margin-bottom:0.8rem; min-height:44px; }
.eq-dim-block { display:inline-flex; align-items:center; gap:3px; padding:4px 8px; border-radius:6px; font-weight:800; font-size:0.75rem; cursor:pointer; transition:all 0.2s; border:2px solid transparent; user-select:none; }
.eq-dim-block:hover { filter:brightness(1.3); transform:scale(1.05); }
.eq-dim-block.active { border-color:#fff; }
.eq-dim-block .dim-letter { font-size:0.9rem; }
.eq-dim-block .dim-val { font-size:0.65rem; opacity:0.8; }
.eq-chain-op { color:#555; font-size:0.7rem; font-weight:700; }
.eq-balance-block { display:inline-flex; align-items:center; gap:0; border-radius:6px; overflow:hidden; cursor:pointer; font-size:0.6rem; font-weight:800; height:28px; min-width:80px; }
.eq-balance-block .angel-part { background:#1a3a1a; color:#6f6; padding:2px 6px; height:100%; display:flex; align-items:center; transition:width 0.3s; }
.eq-balance-block .demon-part { background:#3a1a1a; color:#f66; padding:2px 6px; height:100%; display:flex; align-items:center; transition:width 0.3s; }
.eq-result-block { display:inline-flex; align-items:center; padding:4px 10px; border:2px dashed #333; border-radius:6px; font-size:0.6rem; color:#888; font-style:italic; max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* Forge controls grid */
.forge-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.6rem; margin-bottom:0.8rem; }
.forge-section { background:#0a0a0a; border:1px solid #1a1a1a; border-radius:6px; padding:8px 10px; }
.forge-section-title { font-size:0.5rem; color:#555; letter-spacing:0.12em; font-weight:700; margin-bottom:6px; text-transform:uppercase; }
.forge-dim-row { display:flex; align-items:center; gap:6px; margin-bottom:4px; }
.forge-dim-row .fdl { min-width:14px; font-weight:800; font-size:0.6rem; }
.forge-dim-row .fdn { font-size:0.5rem; color:#777; min-width:52px; }
.forge-dim-row input[type=range] { flex:1; height:6px; cursor:pointer; }
.forge-dim-row .fdv { min-width:26px; text-align:right; font-size:0.55rem; color:#888; font-family:monospace; }
/* Templates */
.forge-tpl-row { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:8px; }
.forge-tpl-btn { font-size:0.5rem; padding:3px 8px; border-radius:12px; border:1px solid #333; background:#111; color:#888; cursor:pointer; font-weight:600; transition:all 0.2s; }
.forge-tpl-btn:hover { border-color:#daa520; color:#daa520; }
.forge-tpl-btn.active { background:#2a2a0a; border-color:#daa520; color:#daa520; }
/* Forge footer */
.forge-footer { border-top:1px solid #1a1a1a; padding-top:8px; }
.forge-footer input, .forge-footer textarea { width:100%; background:#0a0a0a; border:1px solid #222; color:#ddd; font-size:0.6rem; padding:4px 8px; border-radius:4px; margin-bottom:4px; box-sizing:border-box; font-family:inherit; }
.forge-footer input:focus, .forge-footer textarea:focus { outline:none; border-color:#daa520; }
.forge-formula-display { font-family:'Consolas','Courier New',monospace; font-size:0.6rem; color:#daa520; padding:6px 8px; background:#0a0a0a; border:1px solid #332200; border-radius:4px; margin-bottom:6px; word-break:break-word; min-height:20px; }
.forge-actions { display:flex; gap:8px; justify-content:center; margin-top:6px; }
.forge-actions button { padding:6px 18px; border-radius:5px; font-size:0.6rem; font-weight:700; cursor:pointer; border:none; transition:all 0.2s; }
.forge-btn-create { background:#daa520; color:#000; }
.forge-btn-create:hover { background:#e8b830; }
.forge-btn-test { background:#1a2a1a; color:#4a8; border:1px solid #2a4a2a !important; }
.forge-btn-test:hover { background:#2a4a2a; color:#6f6; }
.forge-btn-cancel { background:#1a1a1a; color:#666; border:1px solid #333 !important; }
.forge-btn-cancel:hover { color:#ccc; }
/* Dimension pips in leaderboard */
.eq-pips { display:inline-flex; gap:2px; margin-left:4px; vertical-align:middle; }
.eq-pip { width:5px; height:5px; border-radius:50%; display:inline-block; border:1px solid rgba(255,255,255,0.1); }
.ticker-toggle { display: inline-block; font-size: 0.45rem; color: #444; cursor: pointer; margin-left: 6px; border: 1px solid #333; padding: 1px 5px; border-radius: 3px; font-family: monospace; user-select: none; vertical-align: middle; }
.ticker-toggle:hover { color: #daa520; border-color: #daa520; }
.input-area { border-top: 1px solid #1a1a1a; padding: 0.4rem; background: #0d0d0d; }
.input-row { display: flex; gap: 0.3rem; }
#msg-input { flex: 1; background: #141414; border: 1px solid #2a2a2a; color: #eee; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 0.82rem; font-family: inherit; outline: none; resize: none; min-height: 34px; max-height: 200px; }
#msg-input:focus { border-color: #daa520; }
#send-btn { background: #daa520; color: #000; border: none; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.8rem; padding: 0 0.8rem; height: 34px; }
#send-btn:hover { background: #e8b830; }
.hint { font-size: 0.55rem; color: #333; margin-top: 0.2rem; display: flex; justify-content: space-between; }
.hint a { color: #444; cursor: pointer; text-decoration: none; }
.hint a:hover { color: #daa520; }
/* OR GATE pressure meter */
#or-meter { height: 3px; margin-top: 2px; border-radius: 2px; background: transparent; overflow: hidden; transition: background 0.3s; }
#or-meter.active { background: #1a1a1a; }
#or-meter-fill { height: 100%; width: 0%; border-radius: 2px; transition: width 0.4s ease, background 0.4s ease; }
#or-meter-label { font-size: 0.5rem; font-family: monospace; letter-spacing: 2px; color: #333; margin-top: 1px; text-align: right; height: 0; overflow: hidden; transition: height 0.3s, color 0.3s; }
#or-meter-label.show { height: 12px; }
/* Soul Shape panel */
.soul-panel { text-align:center; padding:0.6rem; }
#soul-cv { display:block; margin:0 auto; }
#soul-emotion { font-size:0.62rem; letter-spacing:0.25em; color:#888; text-transform:uppercase; margin-top:0.3rem; transition:color 0.5s; }
#soul-genome-display { font-size:0.5rem; color:#2a2a2a; letter-spacing:0.15em; margin-top:0.2rem; }
/* RIGHT: Dashboard */
.dash-col { width: 380px; display: flex; flex-direction: column; overflow-y: auto; background: #0d0d0d; }
.dash-col::-webkit-scrollbar { width: 4px; }
.dash-col::-webkit-scrollbar-thumb { background: #222; }
.panel { border-bottom: 1px solid #1a1a1a; padding: 0.5rem 0.6rem; }
.panel-title { font-size: 0.65rem; color: #daa520; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem; font-weight: 700; }
/* Split brain stats */
.brain-split { display: flex; gap: 0.5rem; }
.hemi-col { flex: 1; }
.hemi-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.2rem; padding-bottom: 0.15rem; border-bottom: 1px solid #1a1a1a; }
.hemi-label.left { color: #4a8; }
.hemi-label.right { color: #a44; }
.hemi-divider { width: 1px; background: #1a1a1a; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 0.4rem; }
.stat-item { display: flex; justify-content: space-between; font-size: 0.68rem; }
.stat-item .label { color: #555; }
.stat-item .value { color: #eee; font-weight: 600; }
.stat-item .value.up { color: #4f4; }
.stat-item .value.down { color: #f44; }
/* Abilities */
.ability { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; font-size: 0.7rem; }
.ability .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ability .dot.on { background: #daa520; box-shadow: 0 0 4px #daa520; }
.ability .dot.off { background: #333; }
.ability .name { color: #aaa; flex: 1; }
.ability .name.on { color: #eee; }
.ability .pct { color: #666; font-size: 0.6rem; }
/* Activity feed */
.feed-item { font-size: 0.68rem; padding: 0.15rem 0; border-bottom: 1px solid #111; display: flex; gap: 0.3rem; }
.feed-item .time { color: #444; font-size: 0.6rem; min-width: 50px; }
.feed-item .word { color: #daa520; font-weight: 600; }
.feed-item .src { color: #555; font-size: 0.58rem; }
.feed-item .def { color: #888; }
/* Clusters */
.cluster { margin-bottom: 0.3rem; }
.cluster-name { color: #daa520; font-size: 0.7rem; font-weight: 600; }
.cluster-words { color: #777; font-size: 0.62rem; }
/* Sound bar */
.sound-bar { display: flex; gap: 2px; height: 14px; margin-top: 0.2rem; }
.sound-seg { flex: 1; border-radius: 2px; position: relative; min-width: 0; }
.sound-seg .fill { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 2px; transition: height 0.3s; }
.sound-seg .lbl { position: absolute; bottom: -10px; left: 0; right: 0; text-align: center; font-size: 0.45rem; color: #555; }
/* Debates */
.debate-item { font-size: 0.65rem; padding: 0.3rem 0; border-bottom: 1px solid #151515; }
.debate-header { display: flex; justify-content: space-between; margin-bottom: 0.15rem; }
.debate-q { color: #888; font-style: italic; margin-bottom: 0.15rem; }
.debate-side { display: flex; gap: 0.3rem; font-size: 0.62rem; margin-bottom: 0.1rem; }
.debate-side .tag { font-weight: 700; min-width: 28px; }
.debate-side .tag.L { color: #4a8; }
.debate-side .tag.R { color: #a44; }
.debate-side .text { color: #777; }
.debate-result { font-size: 0.58rem; }
.debate-result .agree { color: #4a8; }
.debate-result .disagree { color: #da4; }
.debate-result .winner { color: #daa520; font-weight: 600; }
/* Delta flash */
@keyframes flash { 0%{opacity:1} 100%{opacity:0} }
.delta { font-size: 0.55rem; color: #4f4; margin-left: 0.15rem; animation: flash 2s forwards; }
/* Brain activity pulse */
@keyframes brainPulse {
0%, 100% { opacity: 0.15; transform: scale(1); }
50% { opacity: 1; transform: scale(1.1); }
}
@keyframes neuronFire {
0% { box-shadow: 0 0 2px currentColor; }
50% { box-shadow: 0 0 12px currentColor, 0 0 24px currentColor; }
100% { box-shadow: 0 0 2px currentColor; }
}
.activity-orb {
width: 8px; height: 8px; border-radius: 50%; display: inline-block;
margin-left: 6px; vertical-align: middle; opacity: 0.15;
transition: opacity 0.3s;
}
.activity-orb.left { background: #4a8; color: #4a8; }
.activity-orb.right { background: #c44; color: #c44; }
.activity-orb.cortex { background: #daa520; color: #daa520; }
.activity-orb.firing { animation: neuronFire 0.6s ease; opacity: 1; }
.activity-orb.active { animation: brainPulse 1.2s ease-in-out infinite; opacity: 1; }
/* Ramble thinking pulse */
@keyframes ramblePulse {
0%, 100% { text-shadow: none; }
50% { text-shadow: 0 0 8px #daa520, 0 0 16px rgba(218,165,32,0.4); }
}
.ramble-active-pulse { animation: ramblePulse 1.5s ease-in-out infinite; }
/* Hemisphere border glow when active */
@keyframes hemiGlow {
0%, 100% { border-color: #1a1a1a; }
50% { border-color: currentColor; }
}
.hemi-col.pulse-left { color: #4a8; }
.hemi-col.pulse-left .hemi-label { animation: hemiGlow 1.5s ease-in-out infinite; border-color: #4a8; }
.hemi-col.pulse-right { color: #c44; }
.hemi-col.pulse-right .hemi-label { animation: hemiGlow 1.5s ease-in-out infinite; border-color: #c44; }
/* Activity sparkline */
.activity-bar { display: flex; gap: 1px; height: 16px; align-items: flex-end; margin-top: 0.3rem; }
.activity-tick { width: 3px; min-height: 1px; border-radius: 1px; transition: height 0.2s; }
.activity-tick.left { background: #4a8; }
.activity-tick.right { background: #c44; }
.activity-tick.cortex { background: #daa520; }
/* Recent words split */
.words-split { display: flex; gap: 0.5rem; }
.words-col { flex: 1; }
/* Ramble — internal monologue */
.ramble-item { font-size: 0.63rem; padding: 0.3rem 0; border-bottom: 1px solid #151515; }
.ramble-q { color: #fff; font-weight: 600; margin-bottom: 0.15rem; }
.ramble-side { display: flex; gap: 0.3rem; font-size: 0.6rem; margin-bottom: 0.05rem; }
.ramble-side .angel { color: #4a8; font-weight: 700; min-width: 12px; }
.ramble-side .demon { color: #c44; font-weight: 700; min-width: 12px; }
.ramble-side .text { color: #666; }
.ramble-verdict { font-size: 0.55rem; color: #daa520; font-style: italic; }
/* Memory Banks */
.mem-emo { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 4px; font-size: 0.58rem; font-weight: 700; background: #111; border: 1px solid #222; }
.mem-emo.happy { border-color: #2a4a2a; color: #4f4; }
.mem-emo.sad { border-color: #2a2a4a; color: #66f; }
.mem-emo.angry { border-color: #4a2a2a; color: #f44; }
.mem-emo.neutral { border-color: #333; color: #888; }
.mem-emo.cache { border-color: #4a4a2a; color: #daa520; }
.mem-emo .count { font-size: 0.7rem; }
.mem-backend { display: flex; align-items: center; gap: 6px; font-size: 0.55rem; color: #555; padding: 2px 0; }
.mem-backend .dot { width: 6px; height: 6px; border-radius: 50%; }
.mem-backend .dot.ok { background: #4f4; box-shadow: 0 0 4px #4f4; }
.mem-backend .dot.fail { background: #f44; box-shadow: 0 0 4px #f44; }
.mem-backend .name { color: #888; font-weight: 600; }
.mem-backend .lat { color: #daa520; }
.mem-item { display: flex; align-items: flex-start; gap: 4px; font-size: 0.58rem; padding: 3px 0; border-bottom: 1px solid #111; }
.mem-item .emo { min-width: 16px; text-align: center; }
.mem-item .time { color: #444; min-width: 32px; font-size: 0.52rem; }
.mem-item .content { flex: 1; color: #666; }
.mem-item .content b { color: #888; }
.mem-item .qual { font-size: 0.5rem; font-weight: 700; padding: 1px 3px; border-radius: 2px; }
.mem-item .qual.good { color: #4f4; }
.mem-item .qual.mid { color: #da4; }
.mem-item .qual.bad { color: #f44; }
/* Equation Library */
.eq-row { display: flex; align-items: center; gap: 5px; font-size: 0.55rem; padding: 4px 2px; border-bottom: 1px solid #111; cursor: pointer; transition: background 0.2s; }
.eq-row:hover { background: #151515; }
.eq-row .icon { min-width: 18px; height: 18px; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.55rem; color: #000; }
.eq-row .name { color: #888; font-weight: 600; min-width: 60px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-row .bar-wrap { flex: 1; height: 10px; background: #111; border-radius: 2px; overflow: hidden; }
.eq-row .bar { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.eq-row .pct { min-width: 32px; text-align: right; font-size: 0.52rem; font-weight: 700; }
.eq-row .uses { min-width: 28px; text-align: right; color: #444; font-size: 0.48rem; }
.eq-badge { font-size: 0.4rem; padding: 1px 3px; border-radius: 2px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.eq-badge.golden { background: #2a2a0a; color: #daa520; border: 1px solid #3a3a1a; }
.eq-badge.seed { background: #1a1a2a; color: #88f; border: 1px solid #2a2a3a; }
.eq-badge.mut { background: #1a2a1a; color: #4a8; border: 1px solid #2a3a2a; }
.eq-badge.user { background: #2a1a1a; color: #f84; border: 1px solid #3a2a2a; }
.strat-dim { display: inline-flex; align-items: center; gap: 2px; padding: 2px 5px; border-radius: 3px; font-size: 0.5rem; font-weight: 700; background: #111; border: 1px solid #222; color: #666; }
.strat-dim .val { color: #daa520; }
.strat-event { padding: 1px 0; border-bottom: 1px solid #0a0a0a; color: #444; }
.eq-detail-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.88); z-index:999; overflow-y:auto; padding:1.5rem; }
.eq-detail-overlay.show { display:block; }
.eq-detail-panel { max-width:520px; margin:0 auto; background:#111; border:1px solid #2a2a2a; border-radius:8px; padding:1rem; }
.aff-row { display:flex; align-items:center; gap:4px; font-size:0.55rem; padding:2px 0; }
.aff-row .dim-l { min-width:16px; font-weight:700; }
.aff-row .dim-bar { flex:1; height:8px; background:#0a0a0a; border-radius:2px; overflow:hidden; }
.aff-row .dim-fill { height:100%; border-radius:2px; }
.aff-row .dim-v { min-width:24px; text-align:right; color:#666; }
.mem-item .hemi-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; }
</style>
</head>
<body>
<!-- CHAT COLUMN -->
<div class="chat-col">
<div class="chat-header">
<div class="brand">
<span class="hemi-link left" onclick="setChatMode('left')" id="btn-left">LEFT</span>
<span class="hemi-link cortex active" onclick="setChatMode('cortex')" id="btn-cortex">CORTEX BRAIN</span>
<span class="hemi-link right" onclick="setChatMode('right')" id="btn-right">RIGHT</span>
</div>
<span class="chat-mode-label" id="mode-label">BOTH HEMISPHERES</span>
<span id="age-badge" style="display:inline-block;padding:2px 8px;border-radius:4px;font-size:0.6rem;font-weight:700;letter-spacing:1px;border:1px solid #333;color:#555;margin:0 4px;cursor:help;" title="Developmental age based on vocabulary, comprehension, wiring, curiosity">AGE: --</span>
<span id="stm-badge" style="display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:4px;font-size:0.55rem;font-weight:700;letter-spacing:1px;border:1px solid #333;color:#555;margin:0 4px;cursor:help;" title="Short-term memory usage">
STM: <span id="stm-bar-wrap" style="display:inline-block;width:40px;height:8px;background:#111;border-radius:3px;overflow:hidden;vertical-align:middle;"><span id="stm-bar-fill" style="display:block;height:100%;width:0%;background:#0f8;border-radius:3px;transition:width 0.5s,background 0.5s;"></span></span> <span id="stm-pct">--%</span>
</span>
<a class="gaps-link" onclick="triggerSleep()" id="sleep-btn" style="color:#4af;margin:0 4px;">SLEEP</a>
<a class="gaps-link" onclick="showGaps()">KNOWLEDGE GAPS</a>
<a class="gaps-link" onclick="showMemoryArchive()" style="color:#4af;">ARCHIVE</a>
</div>
<div class="chat-area" id="chat-area">
<div class="msg bot">
<div class="avatar">C</div>
<div class="bubble">Alright. Type something. Both hemispheres are listening.</div>
</div>
</div>
<div class="thinking" id="thinking">synthesizing<span class="dots"><span>.</span><span>.</span><span>.</span></span></div>
<div class="input-area">
<div class="input-row">
<textarea id="msg-input" placeholder="Type something..." rows="1"></textarea>
<button id="send-btn" onclick="sendMsg()">Send</button>
</div>
<div class="hint">
<span>Enter = send | <a onclick="saveIPFS()">Save IPFS</a></span>
<a onclick="resetChat()">Reset</a>
</div>
<div id="or-meter"><div id="or-meter-fill"></div></div>
<div id="or-meter-label"></div>
</div>
</div>
<!-- KNOWLEDGE GAPS OVERLAY -->
<div class="gaps-overlay" id="gaps-overlay" onclick="if(event.target===this)this.classList.remove('show')">
<div class="gaps-panel">
<h2>Knowledge Gaps <span class="close-btn" onclick="document.getElementById('gaps-overlay').classList.remove('show')">×</span></h2>
<div style="margin-bottom:10px;text-align:center;">
<button onclick="triggerSelfStudy()" id="selfStudyBtn" style="background:#1a2a1a;color:#0f8;border:1px solid #0f8;padding:6px 16px;border-radius:6px;cursor:pointer;font-family:monospace;font-size:0.75rem;letter-spacing:1px;">SELF-STUDY NOW</button>
<div id="selfStudyStatus" style="font-size:0.65rem;color:#555;margin-top:4px;"></div>
</div>
<div id="gaps-content"><div style="color:#555;font-size:0.7rem;">Loading...</div></div>
</div>
</div>
<!-- DASHBOARD COLUMN -->
<div class="dash-col" id="dashboard">
<!-- Split Brain Stats -->
<div class="panel">
<div class="panel-title">Split Brain Stats</div>
<div class="brain-split">
<div class="hemi-col">
<div class="hemi-label left">LEFT — Morality <span class="activity-orb left" id="orb-left"></span></div>
<div class="stat-grid" id="left-stats">
<div class="stat-item"><span class="label">Nodes</span><span class="value" id="sl-nodes">-</span></div>
<div class="stat-item"><span class="label">Defined</span><span class="value" id="sl-defined">-</span></div>
<div class="stat-item"><span class="label">Conns</span><span class="value" id="sl-conns">-</span></div>
<div class="stat-item"><span class="label">Msgs</span><span class="value" id="sl-msgs">-</span></div>
<div class="stat-item"><span class="label">Auto</span><span class="value" id="sl-auto">-</span></div>
<div class="stat-item"><span class="label">Deep</span><span class="value" id="sl-deep">-</span></div>
</div>
</div>
<div class="hemi-divider"></div>
<div class="hemi-col">
<div class="hemi-label right">RIGHT — Darkness <span class="activity-orb right" id="orb-right"></span></div>
<div class="stat-grid" id="right-stats">
<div class="stat-item"><span class="label">Nodes</span><span class="value" id="sr-nodes">-</span></div>
<div class="stat-item"><span class="label">Defined</span><span class="value" id="sr-defined">-</span></div>
<div class="stat-item"><span class="label">Conns</span><span class="value" id="sr-conns">-</span></div>
<div class="stat-item"><span class="label">Msgs</span><span class="value" id="sr-msgs">-</span></div>
<div class="stat-item"><span class="label">Auto</span><span class="value" id="sr-auto">-</span></div>
<div class="stat-item"><span class="label">Deep</span><span class="value" id="sr-deep">-</span></div>
</div>
</div>
</div>
</div>
<!-- Brain Activity -->
<div class="panel">
<div class="panel-title" style="display:flex;justify-content:space-between;align-items:center">
<span>Brain Activity <span class="activity-orb cortex" id="orb-cortex"></span></span>
<span id="activity-rate" style="font-size:0.55rem;color:#444">0 ops/s</span>
</div>
<div class="activity-bar" id="activity-bar"></div>
</div>
<!-- Sound — Separate emotional wheels per hemisphere -->
<div class="panel">
<div class="panel-title" style="display:flex;justify-content:space-between;align-items:center">
<span>Emotional State</span>
<span id="emo-link-btn" title="Click to cycle: LINKED → UNLINKED → SELECTIVE"
style="cursor:pointer;font-size:0.55rem;padding:1px 5px;border:1px solid #333;border-radius:3px;color:#888;user-select:none">
🔗 LINKED
</span>
</div>
<div class="sound-bar" id="sound-bar"></div>
<div id="emo-split" style="display:none;gap:8px;margin-top:6px">
<div style="flex:1">
<div style="font-size:0.45rem;color:#4a8;text-align:center;margin-bottom:2px">ANGEL</div>
<div class="sound-bar" id="sound-bar-left"></div>
</div>
<div style="flex:1">
<div style="font-size:0.45rem;color:#a44;text-align:center;margin-bottom:2px">DEMON</div>
<div class="sound-bar" id="sound-bar-right"></div>
</div>
</div>
</div>
<!-- Soul Shape -->
<div class="panel soul-panel">
<div class="panel-title">Soul Shape · φ Genome</div>
<canvas id="soul-cv" width="160" height="160"></canvas>
<div id="soul-emotion">reading…</div>
<div id="soul-genome-display">[ — , — , — ]</div>
</div>
<!-- Abilities -->
<div class="panel">
<div class="panel-title">Abilities</div>
<div id="abilities-list"></div>
</div>
<!-- Ramble Mode — Internal Monologue -->
<div class="panel">
<div class="panel-title" style="display:flex;justify-content:space-between;align-items:center">
<span>Internal Monologue</span>
<span id="ramble-status" style="font-size:0.55rem;color:#444">OFF</span>
</div>
<div style="margin-bottom:0.3rem">
<button onclick="toggleRamble()" id="ramble-btn" style="font-size:0.6rem;background:#222;color:#888;border:1px solid #333;padding:2px 8px;border-radius:3px;cursor:pointer">Start Ramble</button>
</div>
<div id="ramble-list"></div>
</div>
<!-- Debates -->
<div class="panel">
<div class="panel-title">Hemisphere Debates</div>
<div id="debates-list"></div>
</div>
<!-- Recent Learning — Split -->
<div class="panel">
<div class="panel-title">Recently Learned</div>
<div class="words-split">
<div class="words-col">
<div class="hemi-label left" style="font-size:0.55rem">LEFT</div>
<div id="recent-words-left"></div>
</div>
<div class="words-col">
<div class="hemi-label right" style="font-size:0.55rem">RIGHT</div>
<div id="recent-words-right"></div>
</div>
</div>
</div>
<!-- Clusters -->
<div class="panel">
<div class="panel-title">Word Clusters</div>
<div id="clusters-list"></div>
</div>
<!-- Chat Log -->
<div class="panel">
<div class="panel-title">Recent Activity</div>
<div id="recent-chat"></div>
</div>
<!-- Memory Banks -->
<div class="panel">
<div class="panel-title">Memory <span id="mem-total" style="color:#555;font-size:0.55rem;font-weight:400;margin-left:6px">0 memories</span></div>
<div id="mem-emotions" style="display:flex;gap:8px;margin-bottom:6px;flex-wrap:wrap;"></div>
<div id="mem-backends" style="margin-bottom:6px;"></div>
<div id="mem-recent" style="max-height:220px;overflow-y:auto;"></div>
</div>
<!-- Equation Library -->
<div class="panel">
<div class="panel-title" style="display:flex;justify-content:space-between;align-items:center">
<span>Equation Library <span id="strat-total" style="color:#555;font-size:0.55rem;font-weight:400;margin-left:4px">0</span></span>
<span style="display:flex;gap:6px">
<span id="eq-golden-ct" style="font-size:0.45rem;color:#daa520">0 golden</span>
<span id="eq-active-ct" style="font-size:0.45rem;color:#4a8">0 active</span>
</span>
</div>
<div id="eq-current" style="font-size:0.5rem;color:#666;padding:3px 0;border-bottom:1px solid #111;margin-bottom:4px"></div>
<div id="strat-leaderboard" style="margin-bottom:8px;max-height:260px;overflow-y:auto;"></div>
<div id="strat-dims" style="display:flex;gap:6px;margin-bottom:8px;flex-wrap:wrap;"></div>
<div style="display:flex;gap:6px;margin-bottom:6px;flex-wrap:wrap">
<button onclick="openForge()" style="font-size:0.5rem;background:#daa520;color:#000;border:none;padding:2px 8px;border-radius:3px;cursor:pointer;font-weight:700">+ New Equation</button>
<button onclick="triggerMutation()" style="font-size:0.5rem;background:#222;color:#888;border:1px solid #333;padding:2px 8px;border-radius:3px;cursor:pointer">Mutate Now</button>
<button onclick="toggleRequestPanel()" style="font-size:0.5rem;background:#0a0a2a;color:#5af;border:1px solid #1a1a4a;padding:2px 8px;border-radius:3px;cursor:pointer">Request Equation</button>
</div>
<div id="eq-form-box" style="display:none;margin-bottom:8px"></div>
<div id="eq-request-box" style="display:none;margin-bottom:8px">
<div class="req-form">
<div style="font-size:0.55rem;color:#5af;margin-bottom:4px;font-weight:700">REQUEST NEW EQUATION</div>
<input id="req-name" placeholder="Equation name" style="font-size:0.6rem;padding:3px 6px;background:#111;border:1px solid #333;color:#ddd;border-radius:3px;width:100%;margin-bottom:3px;box-sizing:border-box">
<input id="req-formula" placeholder="Formula e.g. t(time)+S(SEARCH)+U(query)" style="font-size:0.6rem;padding:3px 6px;background:#111;border:1px solid #333;color:#daa520;border-radius:3px;width:100%;margin-bottom:3px;box-sizing:border-box;font-family:Consolas,monospace">
<textarea id="req-desc" placeholder="What should this equation do?" style="font-size:0.6rem;padding:3px 6px;background:#111;border:1px solid #333;color:#ddd;border-radius:3px;width:100%;min-height:30px;resize:vertical;margin-bottom:4px;box-sizing:border-box"></textarea>
<button onclick="submitRequest()" style="width:100%;padding:4px;background:#1a1a4a;color:#5af;border:1px solid #2a2a6a;border-radius:3px;font-size:0.55rem;font-weight:700;cursor:pointer">SUBMIT REQUEST</button>
<div style="font-size:0.45rem;color:#555;margin-top:6px;font-weight:700">PENDING REQUESTS</div>
<div id="req-list" style="max-height:150px;overflow-y:auto;margin-top:4px"></div>
</div>
</div>
<div id="strat-events" style="max-height:140px;overflow-y:auto;font-size:0.5rem;color:#555;"></div>
</div>
<!-- Equation Detail Overlay -->
<div class="eq-detail-overlay" id="eq-detail-overlay" onclick="if(event.target===this)this.classList.remove('show')">
<div class="eq-detail-panel">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:0.8rem">
<span id="eq-detail-title" style="font-size:0.9rem;color:#daa520;font-weight:700">Equation</span>
<span style="cursor:pointer;color:#666;font-size:1.2rem" onclick="document.getElementById('eq-detail-overlay').classList.remove('show')">×</span>
</div>
<div id="eq-detail-content"></div>
</div>
</div>
<!-- EQUATION FORGE OVERLAY -->
<div class="eq-forge-overlay" id="eq-forge-overlay" onclick="if(event.target===this)closeForge()">
<div class="eq-forge-panel">
<span class="forge-close" onclick="closeForge()">×</span>
<div class="forge-title">EQUATION FORGE</div>
<!-- Live visual chain -->
<div class="eq-chain" id="forge-chain"></div>
<!-- Controls grid -->
<div class="forge-grid">
<!-- Left: Dimensions -->
<div class="forge-section">
<div class="forge-section-title">Dimensions</div>
<div id="forge-dim-sliders"></div>
<div class="forge-section-title" style="margin-top:8px">Templates</div>
<div class="forge-tpl-row" id="forge-templates"></div>
</div>
<!-- Right: Hemisphere + Optional -->
<div class="forge-section">
<div class="forge-section-title">Hemisphere Balance</div>
<div class="forge-dim-row">
<span class="fdl" style="color:#4a8">A</span>
<span class="fdn">Angel</span>
<input type="range" id="forge-lw" min="0" max="100" value="50" style="accent-color:#4a8">
<span class="fdv" id="forge-lw-v">0.50</span>
</div>
<div class="forge-dim-row">
<span class="fdl" style="color:#c44">D</span>
<span class="fdn">Demon</span>
<input type="range" id="forge-rw" min="0" max="100" value="50" style="accent-color:#c44">
<span class="fdv" id="forge-rw-v">0.50</span>
</div>
<div class="forge-dim-row">
<span class="fdl" style="color:#daa520">S</span>
<span class="fdn">Synth</span>
<input type="range" id="forge-sb" min="0" max="100" value="30" style="accent-color:#daa520">
<span class="fdv" id="forge-sb-v">0.30</span>
</div>
<div class="forge-section-title" style="margin-top:10px">Optional</div>
<div class="forge-dim-row">
<span class="fdn" style="min-width:36px">Timer</span>
<input type="number" id="forge-timer" placeholder="secs" min="0" max="300" style="flex:1;background:#111;border:1px solid #333;color:#ddd;font-size:0.55rem;padding:2px 4px;border-radius:3px;width:60px">
</div>
<div class="forge-dim-row" style="margin-top:3px">
<span class="fdn" style="min-width:36px">URL</span>
<input type="text" id="forge-url" placeholder="https://..." style="flex:1;background:#111;border:1px solid #333;color:#5af;font-size:0.55rem;padding:2px 4px;border-radius:3px">
</div>
<div class="forge-section-title" style="margin-top:10px">Result Preview</div>
<div id="forge-preview" style="font-size:0.55rem;color:#888;font-style:italic;min-height:18px;padding:4px;background:#0a0a0a;border-radius:3px">Drag sliders to shape Cortex thinking</div>
</div>
</div>
<!-- Footer: name, desc, formula, buttons -->
<div class="forge-footer">
<div class="forge-formula-display" id="forge-formula-display"></div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:4px">
<input id="forge-name" placeholder="Equation name">
<input id="forge-desc" placeholder="What does it do?">
</div>
<div class="forge-actions">
<button class="forge-btn-create" id="forge-btn-save" onclick="forgeSubmit()">CREATE EQUATION</button>
<button class="forge-btn-test" onclick="forgeTest()">TEST IT</button>
<button class="forge-btn-cancel" onclick="closeForge()">CANCEL</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Lightweight CortexPlayer shim — reads sc_player credits from localStorage
if (typeof window.CortexPlayer === 'undefined') {
var RANK_THRESHOLDS = [
{rank:'GIGACHAD',min:50000},{rank:'LEGENDARY',min:20000},{rank:'COMMANDER',min:10000},
{rank:'VETERAN',min:5000},{rank:'SERGEANT',min:3000},{rank:'CORPORAL',min:1000},
{rank:'PRIVATE',min:0}
];
window.CortexPlayer = {
getStats: function() {
var p = null; try { p = JSON.parse(localStorage.getItem('sc_player')); } catch(e) {}
var credits = (p && p.credits) ? p.credits : 0;
var rank = 'PRIVATE';
for (var i = 0; i < RANK_THRESHOLDS.length; i++) {
if (credits >= RANK_THRESHOLDS[i].min) { rank = RANK_THRESHOLDS[i].rank; break; }
}
return { credits: credits, rank: rank };
}
};
}
var SERVER = location.hostname === 'localhost' || location.hostname === '127.0.0.1'
? 'http://localhost:8643'
: location.pathname.replace(/\/index\.html$/, '').replace(/\/$/, '');
var chatArea = document.getElementById('chat-area');
var input = document.getElementById('msg-input');
var thinkEl = document.getElementById('thinking');
var prevStats = {};
var chatMode = 'cortex'; // 'cortex' = both, 'left' = left only, 'right' = right only
// --- Emotional link toggle ---
window._emoLinkMode = 'linked';
(function() {
var modes = ['linked', 'unlinked', 'selective'];
var labels = {
linked: '\u{1F517} LINKED',
unlinked: '\u{26D3}\uFE0F UNLINKED',
selective: '\u{1F50C} SELECTIVE'
};
var colors = {
linked: '#888',
unlinked: '#f44',
selective: '#fd0'
};
var btn = document.getElementById('emo-link-btn');
if (btn) {
btn.addEventListener('click', function() {
var idx = modes.indexOf(window._emoLinkMode);
window._emoLinkMode = modes[(idx + 1) % modes.length];
btn.innerHTML = labels[window._emoLinkMode];
btn.style.color = colors[window._emoLinkMode];
btn.style.borderColor = colors[window._emoLinkMode];
});
}
})();
var chatEndpoints = { cortex: '/api/chat-cortex', left: '/api/chat-left', right: '/api/chat-right' };
var modeLabels = { cortex: 'CORTEX MIND', left: 'LEFT HEMISPHERE — ANGEL', right: 'RIGHT HEMISPHERE — DEMON' };
var rambleActive = false;
var chatInFlight = false; // pause polling while chat is processing
// --- Intent Detection ---
function detectIntent(text) {
var t = text.trim().toLowerCase();
// Question: ends with ? or starts with question words
if (t.endsWith('?') || /^(who|what|when|where|why|how|is|are|do|does|can|could|would|should|will|which|have|has|did|was|were)\b/.test(t)) return 'question';
// Command: starts with imperative verbs
if (/^(do|make|create|build|show|tell|give|find|get|stop|start|run|go|set|put|delete|remove|add|change|update|fix|open|close|turn|send|save|load|reset|clear|explain|describe|list|write|read|play|think|learn|remember|forget|shut|be|act|try|help|search|fetch|move|copy|check|test|deploy|push|pull|download|upload|sort|filter|compare|generate|convert|translate|calculate|enable|disable|toggle|switch|pick|choose|select|define|summarize|summarise|combine|merge|split|connect|sync|backup|restore|log|track|monitor|watch|dont|never|always|keep|use|take)\b/.test(t)) return 'command';
return 'statement';
}
var intentLabels = { question: '?', command: '!', statement: '—' };
var intentNames = { question: 'QUERY', command: 'CMD', statement: 'NOTE' };
var lastUserMsg = '';
var msgCounter = 0;
function setChatMode(mode) {
chatMode = mode;
document.getElementById('btn-left').classList.toggle('active', mode === 'left');
document.getElementById('btn-cortex').classList.toggle('active', mode === 'cortex');
document.getElementById('btn-right').classList.toggle('active', mode === 'right');
document.getElementById('mode-label').textContent = modeLabels[mode];
}
// --- Session ID for playbook tracking ---
var sessionId = sessionStorage.getItem('cortex_sid');
if (!sessionId) { sessionId = Date.now().toString(36) + Math.random().toString(36).slice(2,8); sessionStorage.setItem('cortex_sid', sessionId); }
// --- Chat ---
async function sendMsg() {
var text = input.value.trim();
if (!text) return;
input.value = '';
input.style.height = 'auto';
var intent = detectIntent(text);
lastUserMsg = text;
addMsg('user', text, null, null, intent);
thinkEl.classList.add('show');
chatInFlight = true;
try {
var resp = await fetch(SERVER + chatEndpoints[chatMode], {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ text: text, intent: intent, session_id: sessionId,
rank: window.CortexPlayer ? CortexPlayer.getStats().rank : 'RECRUIT',
credits: window.CortexPlayer ? CortexPlayer.getStats().credits : 0 })
});
var data = await resp.json();
thinkEl.classList.remove('show');
var reply = data.ok ? data.reply : ('Error: ' + (data.error || '?'));
var thinkingLog = data.thinking_log || [];
var multiParts = (data.ok && data.multi_parts && data.multi_parts.length > 1) ? data.multi_parts : null;
if (reply && reply.length > 0) {
// Animate thinking ticker BEFORE showing the reply
if (thinkingLog.length > 0) {
await animateTicker(thinkingLog);
}
// Multi-part or single response
if (multiParts) {
for (var pi = 0; pi < multiParts.length; pi++) {
addMsg('bot', multiParts[pi], data.hemisphere || chatMode, data.agreement, null,
data.word_sources || {}, data.word_roles || {}, data.unknown_words || [],
pi === 0 ? data.quality : null, pi === 0 ? data.playbook : null,
pi === 0 ? data.strategy : null, pi === 0 ? thinkingLog : []);
if (pi < multiParts.length - 1) await sleep(600);
}
} else {
addMsg('bot', reply, data.hemisphere || chatMode, data.agreement, null,
data.word_sources || {}, data.word_roles || {}, data.unknown_words || [],
data.quality, data.playbook, data.strategy, thinkingLog);
}
}
} catch (e) {
thinkEl.classList.remove('show');
addMsg('bot', 'Server dead. Python running?');
}
chatInFlight = false;
input.focus();
refreshDash();
}
function sleep(ms) { return new Promise(function(r) { setTimeout(r, ms); }); }
function animateTicker(steps) {
return new Promise(function(resolve) {
var container = document.createElement('div');
container.className = 'ticker-container open';
container.id = 'live-ticker';
chatArea.appendChild(container);
chatArea.scrollTop = chatArea.scrollHeight;
var i = 0;
function showNext() {
if (i >= steps.length) {
setTimeout(function() {
container.style.opacity = '0';
container.style.transition = 'opacity 0.3s';
setTimeout(function() {
if (container.parentNode) container.parentNode.removeChild(container);
resolve();
}, 300);
}, 400);
return;
}
var step = steps[i];
var el = document.createElement('div');
el.className = 'ticker-step stage-' + (step.stage || 'detect');
el.innerHTML = '<span class="ticker-label">' + esc(step.label || step.stage || '?') + '</span>'
+ '<span class="ticker-text">' + esc(step.text || '') + '</span>';
container.appendChild(el);
chatArea.scrollTop = chatArea.scrollHeight;
i++;
setTimeout(showNext, 250);
}
showNext();
});
}
function toggleTickerHistory(id, btn) {
var el = document.getElementById(id);
if (!el) return;
if (el.classList.contains('open')) {
el.classList.remove('open');
btn.textContent = 'THINKING';
} else {
el.classList.add('open');
btn.textContent = 'HIDE';
}
}
function addMsg(who, text, hemisphere, agreement, intent, wordSources, wordRoles, unknownWords, quality, playbook, strategy, thinkingLog) {
var d = document.createElement('div');
d.className = 'msg ' + who;
var av = who === 'user' ? 'U' : 'C';
var tag = '';
// User messages: color by intent
if (who === 'user' && intent) {
d.className += ' ' + intent;
tag = '<span class="intent-tag ' + intent + '">' + intentNames[intent] + '</span>';
}
// Bot messages: hemisphere tag
if (who === 'bot' && hemisphere) {
var tagLabel = hemisphere === 'agreement' ? 'BOTH' :
hemisphere === 'left_only' ? 'L' :
hemisphere === 'right_only' ? 'R' :
hemisphere === 'synthesis' ? 'SYN' :
hemisphere === 'debate' ? 'DEBATE' : '';
if (tagLabel) {
tag = '<span class="hemisphere-tag ' + hemisphere + '">' + tagLabel;
if (agreement !== null && agreement !== undefined) tag += ' ' + Math.round(agreement * 100) + '%';
tag += '</span>';
}
}
// Bot messages: color words by hemisphere source + POS role + misspellings
var body = '';
if (who === 'bot' && wordSources && Object.keys(wordSources).length > 0) {
body = colorWords(text, wordSources, wordRoles || {}, unknownWords || []);
} else {
body = esc(text);
}
// Quality badge from self-modification engine
var qBadge = '';
if (who === 'bot' && quality && quality.total !== undefined) {
var pct = Math.round(quality.total * 100);
var cls = pct >= 60 ? 'q-good' : pct >= 35 ? 'q-mid' : 'q-bad';
qBadge = ' <span class="quality-badge ' + cls + '">' + pct + '%</span>';
}
// Stage badge from playbook engine
var sBadge = '';
if (who === 'bot' && playbook && playbook.stage !== undefined) {
var sn = playbook.stage_name || ('S' + playbook.stage);
var eq = playbook.equation || '';
sBadge = ' <span class="stage-badge" title="' + eq + '">' + sn + '</span>';
}
// Strategy badge from strategy engine
var stratBadge = '';
if (who === 'bot' && strategy && strategy.strategy_name) {
var stratColors = {
analytical: '#4af', creative: '#f4a', balanced: '#8a8',
empathetic: '#fa4', provocative: '#f44', scholarly: '#aaf', intuitive: '#4fa'
};
var sc = stratColors[strategy.strategy] || '#888';
var stratScore = strategy.scores ? Math.round((strategy.scores[strategy.strategy] || 0) * 100) : '';
stratBadge = ' <span style="font-size:0.5rem;font-weight:700;color:' + sc + ';background:#111;padding:1px 4px;border-radius:2px;border:1px solid ' + sc + '" title="' + strategy.dominant_dim + ' ' + (strategy.explored ? 'EXPLORE' : '') + '">' + strategy.strategy_icon + ' ' + strategy.strategy_name.toUpperCase() + (stratScore ? ' ' + stratScore : '') + '</span>';
}
// WRONG button on bot messages (for user correction)
var wrongBtn = '';
if (who === 'bot' && strategy && strategy.strategy) {
var mid = ++msgCounter;
wrongBtn = ' <span class="wrong-btn" onclick="showCorrectionForm(' + mid + ')" id="wb-' + mid + '">WRONG</span>';
// Store context on the element after render
setTimeout(function() {
var el = document.getElementById('wb-' + mid);
if (el) {
el.dataset.eqId = strategy.strategy;
el.dataset.userMsg = lastUserMsg;
el.dataset.wrongReply = text;
el.dataset.mid = mid;
}
}, 0);
}
// Thinking ticker toggle (collapsed history)
var tickerHtml = '';
if (who === 'bot' && thinkingLog && thinkingLog.length > 0) {
var tid = 'ticker-' + msgCounter;
var stepsHtml = '';
for (var ti = 0; ti < thinkingLog.length; ti++) {
var ts = thinkingLog[ti];
stepsHtml += '<div class="ticker-step stage-' + (ts.stage || 'detect') + '">'
+ '<span class="ticker-label">' + esc(ts.label || ts.stage || '?') + '</span>'
+ '<span class="ticker-text">' + esc(ts.text || '') + '</span></div>';
}
tickerHtml = ' <span class="ticker-toggle" onclick="toggleTickerHistory(\'' + tid + '\', this)">THINKING</span>'
+ '<div class="ticker-container" id="' + tid + '">' + stepsHtml + '</div>';
}
d.innerHTML = '<div class="avatar">' + av + '</div><div class="bubble">' + tag + body + qBadge + sBadge + stratBadge + wrongBtn + tickerHtml + '<div id="cf-' + msgCounter + '"></div></div>';
chatArea.appendChild(d);
chatArea.scrollTop = chatArea.scrollHeight;
}
function showCorrectionForm(mid) {
var wb = document.getElementById('wb-' + mid);
if (!wb) return;
var cf = document.getElementById('cf-' + mid);
if (!cf) return;
wb.style.display = 'none';
cf.innerHTML = '<div class="correction-form">' +
'<textarea id="ca-' + mid + '" placeholder="Type the correct answer..." rows="2"></textarea>' +
'<div class="cf-actions">' +
'<button class="cf-submit" onclick="submitCorrection(' + mid + ')">TEACH CORTEX</button>' +
'<button class="cf-cancel" onclick="cancelCorrection(' + mid + ')">Cancel</button>' +
'</div></div>';
var ta = document.getElementById('ca-' + mid);
if (ta) ta.focus();
}
function cancelCorrection(mid) {
var wb = document.getElementById('wb-' + mid);
var cf = document.getElementById('cf-' + mid);
if (wb) wb.style.display = '';
if (cf) cf.innerHTML = '';
}
async function submitCorrection(mid) {
var wb = document.getElementById('wb-' + mid);
var cf = document.getElementById('cf-' + mid);
var ta = document.getElementById('ca-' + mid);
if (!wb || !ta) return;
var correctAnswer = ta.value.trim();
if (!correctAnswer) { ta.style.borderColor = '#f44'; return; }
try {
var resp = await fetch(SERVER + '/api/equation-feedback', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
equation_id: wb.dataset.eqId,
user_msg: wb.dataset.userMsg,
wrong_reply: wb.dataset.wrongReply,
correct_answer: correctAnswer